Changeset 52279 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Aug 5, 2014 2:13:40 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r52192 r52279 1439 1439 * Note: If you're adding MSRs here, make sure to update the MSR-bitmap permissions in hmR0VmxSetupProcCtls(). 1440 1440 */ 1441 if (!(pVCpu->hm.s.vmx.f RestoreHostMsrs & VMX_RESTORE_HOST_MSR_LOADED_GUEST))1441 if (!(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST)) 1442 1442 { 1443 1443 pVCpu->hm.s.vmx.u64HostLStarMsr = ASMRdMsr(MSR_K8_LSTAR); … … 1445 1445 pVCpu->hm.s.vmx.u64HostSFMaskMsr = ASMRdMsr(MSR_K8_SF_MASK); 1446 1446 pVCpu->hm.s.vmx.u64HostKernelGSBaseMsr = ASMRdMsr(MSR_K8_KERNEL_GS_BASE); 1447 pVCpu->hm.s.vmx.f RestoreHostMsrs |= VMX_RESTORE_HOST_MSR_SAVED_HOST;1447 pVCpu->hm.s.vmx.fLazyMsrs |= VMX_LAZY_MSRS_SAVED_HOST; 1448 1448 } 1449 1449 } … … 1474 1474 1475 1475 /** 1476 * Saves a set of guest sMSRs back into the guest-CPU context.1476 * Saves a set of guest MSRs back into the guest-CPU context. 1477 1477 * 1478 1478 * @param pVCpu Pointer to the VMCPU. … … 1488 1488 Assert(!VMMRZCallRing3IsEnabled(pVCpu)); 1489 1489 1490 if (pVCpu->hm.s.vmx.f RestoreHostMsrs & VMX_RESTORE_HOST_MSR_LOADED_GUEST)1491 { 1492 Assert(pVCpu->hm.s.vmx.f RestoreHostMsrs & VMX_RESTORE_HOST_MSR_SAVED_HOST);1490 if (pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST) 1491 { 1492 Assert(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_SAVED_HOST); 1493 1493 pMixedCtx->msrLSTAR = ASMRdMsr(MSR_K8_LSTAR); 1494 1494 pMixedCtx->msrSTAR = ASMRdMsr(MSR_K6_STAR); … … 1519 1519 Assert(!VMMRZCallRing3IsEnabled(pVCpu)); 1520 1520 1521 Assert(pVCpu->hm.s.vmx.fRestoreHostMsrs & VMX_RESTORE_HOST_MSR_SAVED_HOST);1522 if (!(pVCpu->hm.s.vmx.fRestoreHostMsrs & VMX_RESTORE_HOST_MSR_LOADED_GUEST))1523 {1524 1521 #define VMXLOCAL_LAZY_LOAD_GUEST_MSR(uMsr, a_GuestMsr, a_HostMsr) \ 1525 1522 do { \ … … 1530 1527 } while (0) 1531 1528 1529 Assert(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_SAVED_HOST); 1530 if (!(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST)) 1531 { 1532 1532 VMXLOCAL_LAZY_LOAD_GUEST_MSR(MSR_K8_LSTAR, LSTAR, LStar); 1533 1533 VMXLOCAL_LAZY_LOAD_GUEST_MSR(MSR_K6_STAR, STAR, Star); 1534 1534 VMXLOCAL_LAZY_LOAD_GUEST_MSR(MSR_K8_SF_MASK, SFMASK, SFMask); 1535 1535 VMXLOCAL_LAZY_LOAD_GUEST_MSR(MSR_K8_KERNEL_GS_BASE, KERNELGSBASE, KernelGSBase); 1536 #undef VMXLOCAL_LAZY_LOAD_GUEST_MSR 1536 pVCpu->hm.s.vmx.fLazyMsrs |= VMX_LAZY_MSRS_LOADED_GUEST; 1537 1537 } 1538 1538 else … … 1543 1543 ASMWrMsr(MSR_K8_KERNEL_GS_BASE, pMixedCtx->msrKERNELGSBASE); 1544 1544 } 1545 pVCpu->hm.s.vmx.fRestoreHostMsrs |= VMX_RESTORE_HOST_MSR_LOADED_GUEST; 1545 1546 #undef VMXLOCAL_LAZY_LOAD_GUEST_MSR 1546 1547 } 1547 1548 … … 1562 1563 Assert(!VMMRZCallRing3IsEnabled(pVCpu)); 1563 1564 1564 if (pVCpu->hm.s.vmx.f RestoreHostMsrs & VMX_RESTORE_HOST_MSR_LOADED_GUEST)1565 { 1566 Assert(pVCpu->hm.s.vmx.f RestoreHostMsrs & VMX_RESTORE_HOST_MSR_SAVED_HOST);1565 if (pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST) 1566 { 1567 Assert(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_SAVED_HOST); 1567 1568 ASMWrMsr(MSR_K8_LSTAR, pVCpu->hm.s.vmx.u64HostLStarMsr); 1568 1569 ASMWrMsr(MSR_K6_STAR, pVCpu->hm.s.vmx.u64HostStarMsr); … … 1570 1571 ASMWrMsr(MSR_K8_KERNEL_GS_BASE, pVCpu->hm.s.vmx.u64HostKernelGSBaseMsr); 1571 1572 } 1572 pVCpu->hm.s.vmx.f RestoreHostMsrs &= ~(VMX_RESTORE_HOST_MSR_LOADED_GUEST | VMX_RESTORE_HOST_MSR_SAVED_HOST);1573 pVCpu->hm.s.vmx.fLazyMsrs &= ~(VMX_LAZY_MSRS_LOADED_GUEST | VMX_LAZY_MSRS_SAVED_HOST); 1573 1574 } 1574 1575 #endif /* HC_ARCH_BITS == 64 */ … … 7029 7030 7030 7031 #if HC_ARCH_BITS == 64 7031 /* Restore the host MSRs as we're leaving VT-x context. */7032 /* Restore the lazy host MSRs as we're leaving VT-x context. */ 7032 7033 if ( pVM->hm.s.fAllow64BitGuests 7033 && pVCpu->hm.s.vmx.f RestoreHostMsrs)7034 && pVCpu->hm.s.vmx.fLazyMsrs) 7034 7035 { 7035 7036 /* We shouldn't reload the guest MSRs without saving it first. */ … … 7041 7042 Assert(HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_LAZY_MSRS)); 7042 7043 hmR0VmxLazyRestoreHostMsrs(pVCpu); 7043 Assert(!pVCpu->hm.s.vmx.f RestoreHostMsrs);7044 Assert(!pVCpu->hm.s.vmx.fLazyMsrs); 7044 7045 } 7045 7046 #endif … … 7262 7263 pVCpu->hm.s.vmx.fRestoreHostFlags = 0; 7263 7264 7264 /* Restore the host MSRs as we're leaving VT-x context. */7265 /* Restore the lazy host MSRs as we're leaving VT-x context. */ 7265 7266 if ( pVM->hm.s.fAllow64BitGuests 7266 && pVCpu->hm.s.vmx.f RestoreHostMsrs)7267 && pVCpu->hm.s.vmx.fLazyMsrs) 7267 7268 { 7268 7269 hmR0VmxLazyRestoreHostMsrs(pVCpu);
Note:
See TracChangeset
for help on using the changeset viewer.