VirtualBox

Changeset 45848 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 30, 2013 6:00:08 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85426
Message:

VMM/HMVMX0: We're already in non-preemptible context. Too paranoid to assume CR4.VMXE can be changed by interrupt handlers. Do less work, assert instead.

File:
1 edited

Legend:

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

    r45846 r45848  
    631631 * @param   pvCpuPage           Pointer to the VMXON region.
    632632 */
    633 DECLINLINE(int) hmR0VmxEnterRootMode(PVM pVM, RTHCPHYS HCPhysCpuPage, void *pvCpuPage)
     633static int hmR0VmxEnterRootMode(PVM pVM, RTHCPHYS HCPhysCpuPage, void *pvCpuPage)
    634634{
    635635    AssertReturn(HCPhysCpuPage != 0 && HCPhysCpuPage != NIL_RTHCPHYS, VERR_INVALID_PARAMETER);
    636636    AssertReturn(pvCpuPage, VERR_INVALID_PARAMETER);
     637    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    637638
    638639    if (pVM)
     
    641642        *(uint32_t *)pvCpuPage = MSR_IA32_VMX_BASIC_INFO_VMCS_ID(pVM->hm.s.vmx.msr.vmx_basic_info);
    642643    }
    643 
    644     /* Disable interrupts. Interrupts handlers might, in theory, change CR4. */
    645     RTCCUINTREG fFlags = ASMIntDisableFlags();
    646644
    647645    /* Enable the VMX bit in CR4 if necessary. */
     
    651649
    652650    /* Enter VMX root mode. */
    653     int rc = VMXEnable(HCPhysCpuPage);  /** @todo This would #GP(0) if we are already in VMX root mode... try skip it? */
     651    int rc = VMXEnable(HCPhysCpuPage);
    654652    if (RT_FAILURE(rc))
    655653        ASMSetCR4(uCr4);
    656654
    657     /* Restore interrupts. */
    658     ASMSetFlags(fFlags);
    659655    return rc;
    660656}
     
    668664static int hmR0VmxLeaveRootMode(void)
    669665{
    670     /* Disable interrupts. Interrupt handlers might, in theory, change CR4. */
    671     RTCCUINTREG fFlags = ASMIntDisableFlags();
    672     int         rc     = VINF_SUCCESS;
     666    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    673667
    674668    /* If we're for some reason not in VMX root mode, then don't leave it. */
     
    678672        VMXDisable();
    679673        ASMSetCR4(ASMGetCR4() & ~X86_CR4_VMXE);
    680     }
    681     else
    682         rc = VERR_VMX_NOT_IN_VMX_ROOT_MODE;
    683 
    684     /* Restore interrupts. */
    685     ASMSetFlags(fFlags);
    686     return rc;
     674        return VINF_SUCCESS;
     675    }
     676
     677    return VERR_VMX_NOT_IN_VMX_ROOT_MODE;
    687678}
    688679
     
    976967    NOREF(pvCpuPage);
    977968    NOREF(HCPhysCpuPage);
     969    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    978970
    979971    hmR0VmxLeaveRootMode();
Note: See TracChangeset for help on using the changeset viewer.

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