Changeset 74488 in vbox
- Timestamp:
- Sep 27, 2018 6:04:58 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r74486 r74488 902 902 903 903 /** 904 * Initializes (or re-initializes) per-VCPU SVM hardware virtualization state. 905 * 906 * @param pVCpu The cross context virtual CPU structure. 907 */ 908 DECLINLINE(void) cpumR3InitSvmHwVirtState(PVMCPU pVCpu) 909 { 910 PCPUMCTX pCtx = &pVCpu->cpum.s.Guest; 911 Assert(pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_SVM); 912 Assert(pCtx->hwvirt.svm.CTX_SUFF(pVmcb)); 913 914 memset(pCtx->hwvirt.svm.CTX_SUFF(pVmcb), 0, SVM_VMCB_PAGES << PAGE_SHIFT); 915 pCtx->hwvirt.svm.uMsrHSavePa = 0; 916 pCtx->hwvirt.svm.uPrevPauseTick = 0; 917 } 918 919 920 /** 904 921 * Frees memory allocated for the VMX hardware virtualization state. 905 922 * … … 1036 1053 1037 1054 return rc; 1055 } 1056 1057 1058 /** 1059 * Initializes (or re-initializes) per-VCPU VMX hardware virtualization state. 1060 * 1061 * @param pVCpu The cross context virtual CPU structure. 1062 */ 1063 DECLINLINE(void) cpumR3InitVmxHwVirtState(PVMCPU pVCpu) 1064 { 1065 PCPUMCTX pCtx = &pVCpu->cpum.s.Guest; 1066 Assert(pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_VMX); 1067 Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)); 1068 Assert(pCtx->hwvirt.vmx.CTX_SUFF(pShadowVmcs)); 1069 1070 memset(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs), 0, VMX_V_VMCS_SIZE); 1071 memset(pCtx->hwvirt.vmx.CTX_SUFF(pShadowVmcs), 0, VMX_V_VMCS_SIZE); 1072 pCtx->hwvirt.vmx.GCPhysVmxon = NIL_RTGCPHYS; 1073 pCtx->hwvirt.vmx.GCPhysShadowVmcs = NIL_RTGCPHYS; 1074 pCtx->hwvirt.vmx.GCPhysVmxon = NIL_RTGCPHYS; 1075 pCtx->hwvirt.vmx.fInVmxRootMode = false; 1076 pCtx->hwvirt.vmx.fInVmxNonRootMode = false; 1077 /* Don't reset diagnostics here. */ 1038 1078 } 1039 1079 … … 1578 1618 else if (pVM->cpum.ro.GuestFeatures.fSvm) 1579 1619 rc = cpumR3AllocSvmHwVirtState(pVM); 1620 else 1621 Assert(pVM->aCpus[0].cpum.s.Guest.hwvirt.enmHwvirt == CPUMHWVIRT_NONE); 1580 1622 if (RT_FAILURE(rc)) 1581 1623 return rc; 1624 1625 /* 1626 * Initialize guest hardware virtualization state. 1627 */ 1628 CPUMHWVIRT const enmHwvirt = pVM->aCpus[0].cpum.s.Guest.hwvirt.enmHwvirt; 1629 if (enmHwvirt == CPUMHWVIRT_VMX) 1630 { 1631 for (VMCPUID i = 0; i < pVM->cCpus; i++) 1632 cpumR3InitVmxHwVirtState(&pVM->aCpus[i]); 1633 } 1634 else if (enmHwvirt == CPUMHWVIRT_SVM) 1635 { 1636 for (VMCPUID i = 0; i < pVM->cCpus; i++) 1637 cpumR3InitSvmHwVirtState(&pVM->aCpus[i]); 1638 } 1582 1639 1583 1640 /* … … 1816 1873 */ 1817 1874 pCtx->hwvirt.fGif = true; 1818 1819 /* SVM. */ 1820 if (pCtx->hwvirt.svm.CTX_SUFF(pVmcb)) 1821 { 1822 memset(pCtx->hwvirt.svm.CTX_SUFF(pVmcb), 0, SVM_VMCB_PAGES << PAGE_SHIFT); 1823 pCtx->hwvirt.svm.uMsrHSavePa = 0; 1824 pCtx->hwvirt.svm.uPrevPauseTick = 0; 1825 } 1875 Assert(!pVM->cpum.ro.GuestFeatures.fVmx || !pVM->cpum.ro.GuestFeatures.fSvm); /* Paranoia. */ 1876 if (pVM->cpum.ro.GuestFeatures.fVmx) 1877 cpumR3InitVmxHwVirtState(pVCpu); 1878 else if (pVM->cpum.ro.GuestFeatures.fSvm) 1879 cpumR3InitSvmHwVirtState(pVCpu); 1826 1880 } 1827 1881
Note:
See TracChangeset
for help on using the changeset viewer.