VirtualBox

Changeset 47766 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Aug 15, 2013 1:23:31 PM (11 years ago)
Author:
vboxsync
Message:

VMM/HM: Preemption hooks.

Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r47760 r47766  
    15561556    LogFlowFunc(("pVM=%p pVCpu=%p\n", pVM, pVCpu));
    15571557
    1558     /* Nothing to do here. */
     1558    pVCpu->hm.s.fLeaveDone = false;
    15591559    return VINF_SUCCESS;
    15601560}
     
    15761576    NOREF(pCtx);
    15771577
    1578     /* Nothing to do here. Everything is taken care of in hmR0SvmLongJmpToRing3(). */
     1578    /* Nothing to do here. Everything is taken care of in hmR0SvmLeave(). */
    15791579    return VINF_SUCCESS;
    15801580}
     
    18871887    Assert(VMMR0IsLogFlushDisabled(pVCpu));
    18881888
     1889    /* Avoid repeating this work when thread-context hooks are used and we had been preempted before
     1890       which would've done this work from the SVMR0ThreadCtxCallback(). */
     1891    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     1892    bool fPreemptDisabled = false;
     1893    if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))
     1894    {
     1895        Assert(VMMR0ThreadCtxHooksAreRegistered(pVCpu));
     1896        RTThreadPreemptDisable(&PreemptState);
     1897        fPreemptDisabled = true;
     1898        if (pVCpu->hm.s.fLeaveDone)
     1899        {
     1900            RTThreadPreemptRestore(&PreemptState);
     1901            return;
     1902        }
     1903    }
     1904
    18891905    /* Restore host FPU state if necessary and resync on next R0 reentry .*/
    18901906    if (CPUMIsGuestFPUStateActive(pVCpu))
     
    19121928    Assert(!CPUMIsGuestDebugStateActive(pVCpu));
    19131929
    1914 
    19151930    STAM_PROFILE_ADV_SET_STOPPED(&pVCpu->hm.s.StatEntry);
    19161931    STAM_PROFILE_ADV_SET_STOPPED(&pVCpu->hm.s.StatLoadGuestState);
     
    19201935
    19211936    VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_HM, VMCPUSTATE_STARTED_EXEC);
     1937
     1938    /* Restore preemption if we previous disabled it ourselves. */
     1939    if (fPreemptDisabled)
     1940    {
     1941        pVCpu->hm.s.fLeaveDone = true;
     1942        RTThreadPreemptRestore(&PreemptState);
     1943    }
    19221944}
    19231945
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r47760 r47766  
    60406040        RTThreadPreemptDisable(&PreemptState);
    60416041        fPreemptDisabled = true;
    6042         if (pVCpu->hm.s.vmx.fVmxLeaveDone)
     6042        if (pVCpu->hm.s.fLeaveDone)
    60436043        {
    60446044            RTThreadPreemptRestore(&PreemptState);
     
    60946094    if (fPreemptDisabled)
    60956095    {
    6096         pVCpu->hm.s.vmx.fVmxLeaveDone = true;
     6096        pVCpu->hm.s.fLeaveDone = true;
    60976097        RTThreadPreemptRestore(&PreemptState);
    60986098    }
     
    67966796    /** @todo this will change with preemption hooks where can VMRESUME as long
    67976797     *        as we're no preempted. */
    6798     pVCpu->hm.s.fResumeVM = false;
    6799     pVCpu->hm.s.vmx.fVmxLeaveDone = false;
     6798    pVCpu->hm.s.fResumeVM  = false;
     6799    pVCpu->hm.s.fLeaveDone = false;
    68006800    return VINF_SUCCESS;
    68016801}
     
    68486848            AssertRC(rc);
    68496849
    6850             pVCpu->hm.s.fResumeVM = false;
    6851             pVCpu->hm.s.vmx.fVmxLeaveDone = false;
     6850            pVCpu->hm.s.fResumeVM  = false;
     6851            pVCpu->hm.s.fLeaveDone = false;
    68526852            pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_HOST_CONTEXT;
    68536853
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette