Changeset 54650 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Mar 5, 2015 1:42:10 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r54384 r54650 773 773 774 774 /* Enable the VMX bit in CR4 if necessary. */ 775 RTCCUINTREG uCr4 = ASMGetCR4(); 776 if (!(uCr4 & X86_CR4_VMXE)) 777 ASMSetCR4(uCr4 | X86_CR4_VMXE); 775 RTCCUINTREG uOldCr4 = SUPR0ChangeCR4(X86_CR4_VMXE, ~0); 778 776 779 777 /* Enter VMX root mode. */ 780 778 int rc = VMXEnable(HCPhysCpuPage); 781 if (RT_FAILURE(rc)) 782 ASMSetCR4(uCr4); 779 if ( RT_FAILURE(rc) 780 && !(uOldCr4 & X86_CR4_VMXE)) 781 SUPR0ChangeCR4(0, ~X86_CR4_VMXE); 783 782 784 783 /* Restore interrupts. */ … … 808 807 /* Exit VMX root mode and clear the VMX bit in CR4. */ 809 808 VMXDisable(); 810 ASMSetCR4(uHostCR4 &~X86_CR4_VMXE);809 SUPR0ChangeCR4(0, ~X86_CR4_VMXE); 811 810 rc = VINF_SUCCESS; 812 811 } … … 5216 5215 VMXDisable(); 5217 5216 5218 ASMSetCR4(ASMGetCR4() &~X86_CR4_VMXE);5217 SUPR0ChangeCR4(0, ~X86_CR4_VMXE); 5219 5218 5220 5219 CPUMSetHyperESP(pVCpu, VMMGetStackRC(pVCpu)); … … 5231 5230 /** @todo replace with hmR0VmxEnterRootMode() and hmR0VmxLeaveRootMode(). */ 5232 5231 /* Make sure the VMX instructions don't cause #UD faults. */ 5233 ASMSetCR4(ASMGetCR4() | X86_CR4_VMXE);5232 SUPR0ChangeCR4(X86_CR4_VMXE, ~0); 5234 5233 5235 5234 /* Re-enter VMX Root Mode */ … … 5237 5236 if (RT_FAILURE(rc2)) 5238 5237 { 5239 ASMSetCR4(ASMGetCR4() &~X86_CR4_VMXE);5238 SUPR0ChangeCR4(0, ~X86_CR4_VMXE); 5240 5239 ASMSetFlags(uOldEflags); 5241 5240 return rc2;
Note:
See TracChangeset
for help on using the changeset viewer.