VirtualBox

Changeset 46399 in vbox


Ignore:
Timestamp:
Jun 5, 2013 4:57:05 PM (11 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Avoid re-reading CR4 as it cannot be changed by vmxoff and some comments.

File:
1 edited

Legend:

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

    r46393 r46399  
    677677
    678678    /* If we're for some reason not in VMX root mode, then don't leave it. */
    679     if (ASMGetCR4() & X86_CR4_VMXE)
    680     {
    681         /* Exit VMX root mode and clear the VMX bit in CR4 */
     679    RTCCUINTREG uHostCR4 = ASMGetCR4();
     680    if (uHostCR4 & X86_CR4_VMXE)
     681    {
     682        /* Exit VMX root mode and clear the VMX bit in CR4. */
    682683        VMXDisable();
    683         ASMSetCR4(ASMGetCR4() & ~X86_CR4_VMXE);
     684        ASMSetCR4(uHostCR4 & ~X86_CR4_VMXE);
    684685        return VINF_SUCCESS;
    685686    }
     
    928929 *                          @a fEnabledByHost is true).
    929930 * @param   fEnabledByHost  Set if SUPR0EnableVTx() or similar was used to
    930  *                          enable VT-x/AMD-V on the host.
     931 *                          enable VT-x on the host.
    931932 */
    932933VMMR0DECL(int) VMXR0EnableCpu(PHMGLOBLCPUINFO pCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage, bool fEnabledByHost)
     
    971972 * @param   pvCpuPage       Pointer to the VMXON region.
    972973 * @param   HCPhysCpuPage   Physical address of the VMXON region.
     974 *
     975 * @remarks This function should never be called when SUPR0EnableVTx() or
     976 *          similar was used to enable VT-x on the host.
    973977 */
    974978VMMR0DECL(int) VMXR0DisableCpu(PHMGLOBLCPUINFO pCpu, void *pvCpuPage, RTHCPHYS HCPhysCpuPage)
     
    978982    NOREF(HCPhysCpuPage);
    979983
     984    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    980985    return hmR0VmxLeaveRootMode();
    981986}
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