Changeset 80844 in vbox
- Timestamp:
- Sep 17, 2019 8:44:53 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMR0.cpp
r80587 r80844 405 405 return rc; 406 406 } 407 void *pvScatchPage = RTR0MemObjAddress(hScatchMemObj);408 RTHCPHYS 407 void *pvScatchPage = RTR0MemObjAddress(hScatchMemObj); 408 RTHCPHYS const HCPhysScratchPage = RTR0MemObjGetPagePhysAddr(hScatchMemObj, 0); 409 409 ASMMemZeroPage(pvScatchPage); 410 410 … … 415 415 RTCCUINTREG const fEFlags = ASMIntDisableFlags(); 416 416 417 /* Check CR4.VMXE. */ 418 g_HmR0.hwvirt.u.vmx.u64HostCr4 = ASMGetCR4(); 419 if (!(g_HmR0.hwvirt.u.vmx.u64HostCr4 & X86_CR4_VMXE)) 420 { 421 /* In theory this bit could be cleared behind our back. Which would cause #UD 422 faults when we try to execute the VMX instructions... */ 423 ASMSetCR4(g_HmR0.hwvirt.u.vmx.u64HostCr4 | X86_CR4_VMXE); 424 } 417 /* Enable CR4.VMXE if it isn't already set. */ 418 RTCCUINTREG const uOldCr4 = SUPR0ChangeCR4(X86_CR4_VMXE, RTCCUINTREG_MAX); 425 419 426 420 /* … … 452 446 } 453 447 454 /* 455 * Restore CR4 again; don't leave the X86_CR4_VMXE flag set if it was not456 * set before (some software could incorrectly think it is in VMX mode).457 */ 458 ASMSetCR4(g_HmR0.hwvirt.u.vmx.u64HostCr4);448 /* Restore CR4.VMXE if it wasn't set prior to us setting it above. */ 449 if (!(uOldCr4 & X86_CR4_VMXE)) 450 SUPR0ChangeCR4(0 /* fOrMask */, ~X86_CR4_VMXE); 451 452 /* Restore interrupts. */ 459 453 ASMSetFlags(fEFlags); 460 454
Note:
See TracChangeset
for help on using the changeset viewer.