Changeset 87543 in vbox
- Timestamp:
- Feb 2, 2021 5:00:24 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142569
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/HMAll.cpp
r87542 r87543 683 683 684 684 if ( pVM->hm.s.vmx.fSupported 685 && (pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_MSR_BITMAPS)) 685 && ( CTX_EXPR(pVM->hm.s.vmx.MsrsForRing3.ProcCtls.n.allowed1, g_HmMsrs.u.vmx.ProcCtls.n.allowed1, RT_NOTHING) 686 & VMX_PROC_CTLS_USE_MSR_BITMAPS)) 686 687 return true; 687 688 } -
trunk/src/VBox/VMM/VMMAll/HMVMXAll.cpp
r87541 r87543 767 767 { 768 768 /* If bit N is set in cr0_fixed0, then it must be set in the guest's cr0. */ 769 uint32_t uCr0Mask = (uint32_t)CTX_EXPR(pVM->hm.s.vmx.Msrs .u64Cr0Fixed0, g_HmMsrs.u.vmx.u64Cr0Fixed0, RT_NOTHING);769 uint32_t uCr0Mask = (uint32_t)CTX_EXPR(pVM->hm.s.vmx.MsrsForRing3.u64Cr0Fixed0, g_HmMsrs.u.vmx.u64Cr0Fixed0, RT_NOTHING); 770 770 771 771 /* We ignore the NE bit here on purpose; see HMR0.cpp for details. */ … … 786 786 787 787 /* If bit N is cleared in cr0_fixed1, then it must be zero in the guest's cr0. */ 788 uCr0Mask = (uint32_t)~CTX_EXPR(pVM->hm.s.vmx.Msrs .u64Cr0Fixed1, g_HmMsrs.u.vmx.u64Cr0Fixed1, RT_NOTHING);788 uCr0Mask = (uint32_t)~CTX_EXPR(pVM->hm.s.vmx.MsrsForRing3.u64Cr0Fixed1, g_HmMsrs.u.vmx.u64Cr0Fixed1, RT_NOTHING); 789 789 if ((pCtx->cr0 & uCr0Mask) != 0) 790 790 return false; 791 791 792 792 /* If bit N is set in cr4_fixed0, then it must be set in the guest's cr4. */ 793 uCr0Mask = (uint32_t)CTX_EXPR(pVM->hm.s.vmx.Msrs .u64Cr4Fixed0, g_HmMsrs.u.vmx.u64Cr4Fixed0, RT_NOTHING);793 uCr0Mask = (uint32_t)CTX_EXPR(pVM->hm.s.vmx.MsrsForRing3.u64Cr4Fixed0, g_HmMsrs.u.vmx.u64Cr4Fixed0, RT_NOTHING); 794 794 uCr0Mask &= ~X86_CR4_VMXE; 795 795 if ((pCtx->cr4 & uCr0Mask) != uCr0Mask) … … 797 797 798 798 /* If bit N is cleared in cr4_fixed1, then it must be zero in the guest's cr4. */ 799 uCr0Mask = (uint32_t)~CTX_EXPR(pVM->hm.s.vmx.Msrs .u64Cr4Fixed1, g_HmMsrs.u.vmx.u64Cr4Fixed1, RT_NOTHING);799 uCr0Mask = (uint32_t)~CTX_EXPR(pVM->hm.s.vmx.MsrsForRing3.u64Cr4Fixed1, g_HmMsrs.u.vmx.u64Cr4Fixed1, RT_NOTHING); 800 800 if ((pCtx->cr4 & uCr0Mask) != 0) 801 801 return false; -
trunk/src/VBox/VMM/VMMR0/HMR0.cpp
r87542 r87543 1166 1166 pVM->hm.s.vmx.u64HostMsrEfer = g_uHmVmxHostMsrEfer; 1167 1167 pVM->hm.s.vmx.u64HostSmmMonitorCtl = g_uHmVmxHostSmmMonitorCtl; 1168 HMGetVmxMsrsFromHwvirtMsrs(&g_HmMsrs, &pVM->hm.s.vmx.Msrs );1168 HMGetVmxMsrsFromHwvirtMsrs(&g_HmMsrs, &pVM->hm.s.vmx.MsrsForRing3); 1169 1169 /* If you need to tweak host MSRs for testing VMX R0 code, do it here. */ 1170 1170 1171 1171 /* Enable VPID if supported and configured. */ 1172 if ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VPID)1172 if (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VPID) 1173 1173 pVM->hm.s.vmx.fVpid = pVM->hm.s.vmx.fAllowVpid; /* Can be overridden by CFGM in HMR3Init(). */ 1174 1174 … … 1176 1176 Assert(!pVM->hm.s.vmx.fUseVmcsShadowing); 1177 1177 if ( pVM->cpum.ro.GuestFeatures.fVmx 1178 && ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VMCS_SHADOWING))1178 && (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VMCS_SHADOWING)) 1179 1179 pVM->hm.s.vmx.fUseVmcsShadowing = true; 1180 1180 1181 1181 /* Use the VMCS controls for swapping the EFER MSR if supported. */ 1182 1182 Assert(!pVM->hm.s.vmx.fSupportsVmcsEfer); 1183 if ( ( pVM->hm.s.vmx.Msrs.EntryCtls.n.allowed1 & VMX_ENTRY_CTLS_LOAD_EFER_MSR)1184 && ( pVM->hm.s.vmx.Msrs.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_LOAD_EFER_MSR)1185 && ( pVM->hm.s.vmx.Msrs.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_SAVE_EFER_MSR))1183 if ( (g_HmMsrs.u.vmx.EntryCtls.n.allowed1 & VMX_ENTRY_CTLS_LOAD_EFER_MSR) 1184 && (g_HmMsrs.u.vmx.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_LOAD_EFER_MSR) 1185 && (g_HmMsrs.u.vmx.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_SAVE_EFER_MSR)) 1186 1186 pVM->hm.s.vmx.fSupportsVmcsEfer = true; 1187 1187 1188 1188 #if 0 1189 1189 /* Enable APIC register virtualization and virtual-interrupt delivery if supported. */ 1190 if ( ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_APIC_REG_VIRT)1191 && ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_INTR_DELIVERY))1190 if ( (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_APIC_REG_VIRT) 1191 && (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_INTR_DELIVERY)) 1192 1192 pVM->hm.s.fVirtApicRegs = true; 1193 1193 … … 1195 1195 /** @todo Add and query IPRT API for host OS support for posted-interrupt IPI 1196 1196 * here. */ 1197 if ( ( pVM->hm.s.vmx.Msrs.PinCtls.n.allowed1 & VMX_PIN_CTLS_POSTED_INT)1198 && ( pVM->hm.s.vmx.Msrs.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_ACK_EXT_INT))1197 if ( (g_HmMsrs.u.vmx.PinCtls.n.allowed1 & VMX_PIN_CTLS_POSTED_INT) 1198 && (g_HmMsrs.u.vmx.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_ACK_EXT_INT)) 1199 1199 pVM->hm.s.fPostedIntrs = true; 1200 1200 #endif -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r87541 r87543 1915 1915 PVMCC pVM = pVCpu->CTX_SUFF(pVM); 1916 1916 1917 bool const fMsrBitmaps = RT_BOOL( pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_MSR_BITMAPS);1917 bool const fMsrBitmaps = RT_BOOL(g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_MSR_BITMAPS); 1918 1918 bool const fShadowVmcs = !fIsNstGstVmcs ? pVM->hm.s.vmx.fUseVmcsShadowing : pVM->cpum.ro.GuestFeatures.fVmxVmcsShadowing; 1919 1919 Assert(!pVM->cpum.ro.GuestFeatures.fVmxVmcsShadowing); /* VMCS shadowing is not yet exposed to the guest. */ … … 1943 1943 * Get the virtual-APIC page rather than allocating them again. 1944 1944 */ 1945 if ( pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_TPR_SHADOW)1945 if (g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_TPR_SHADOW) 1946 1946 { 1947 1947 if (!fIsNstGstVmcs) … … 2027 2027 * Allocate per-VM VT-x structures. 2028 2028 */ 2029 bool const fVirtApicAccess = RT_BOOL( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS);2029 bool const fVirtApicAccess = RT_BOOL(g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS); 2030 2030 bool const fUseVmcsShadowing = pVM->hm.s.vmx.fUseVmcsShadowing; 2031 2031 VMXPAGEALLOCINFO aAllocInfo[] = … … 2235 2235 { 2236 2236 /* Shouldn't ever happen but there -is- a number. We're well within the recommended 512. */ 2237 uint32_t const cMaxSupportedMsrs = VMX_MISC_MAX_MSRS( pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.u64Misc);2237 uint32_t const cMaxSupportedMsrs = VMX_MISC_MAX_MSRS(g_HmMsrs.u.vmx.u64Misc); 2238 2238 if (RT_LIKELY(cMsrs < cMaxSupportedMsrs)) 2239 2239 { … … 2749 2749 2750 2750 /* Verify the MSR counts do not exceed the maximum count supported by the hardware. */ 2751 Assert(cMsrs < VMX_MISC_MAX_MSRS( pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.u64Misc));2751 Assert(cMsrs < VMX_MISC_MAX_MSRS(g_HmMsrs.u.vmx.u64Misc)); 2752 2752 2753 2753 /* Verify the MSR counts are within the allocated page size. */ … … 3796 3796 { 3797 3797 PVMCC pVM = pVCpu->CTX_SUFF(pVM); 3798 uint32_t fVal = pVM->hm.s.vmx.Msrs.PinCtls.n.allowed0; /* Bits set here must always be set. */3799 uint32_t const fZap = pVM->hm.s.vmx.Msrs.PinCtls.n.allowed1; /* Bits cleared here must always be cleared. */3798 uint32_t fVal = g_HmMsrs.u.vmx.PinCtls.n.allowed0; /* Bits set here must always be set. */ 3799 uint32_t const fZap = g_HmMsrs.u.vmx.PinCtls.n.allowed1; /* Bits cleared here must always be cleared. */ 3800 3800 3801 3801 fVal |= VMX_PIN_CTLS_EXT_INT_EXIT /* External interrupts cause a VM-exit. */ 3802 3802 | VMX_PIN_CTLS_NMI_EXIT; /* Non-maskable interrupts (NMIs) cause a VM-exit. */ 3803 3803 3804 if ( pVM->hm.s.vmx.Msrs.PinCtls.n.allowed1 & VMX_PIN_CTLS_VIRT_NMI)3804 if (g_HmMsrs.u.vmx.PinCtls.n.allowed1 & VMX_PIN_CTLS_VIRT_NMI) 3805 3805 fVal |= VMX_PIN_CTLS_VIRT_NMI; /* Use virtual NMIs and virtual-NMI blocking features. */ 3806 3806 … … 3808 3808 if (pVM->hm.s.vmx.fUsePreemptTimer) 3809 3809 { 3810 Assert( pVM->hm.s.vmx.Msrs.PinCtls.n.allowed1 & VMX_PIN_CTLS_PREEMPT_TIMER);3810 Assert(g_HmMsrs.u.vmx.PinCtls.n.allowed1 & VMX_PIN_CTLS_PREEMPT_TIMER); 3811 3811 fVal |= VMX_PIN_CTLS_PREEMPT_TIMER; 3812 3812 } … … 3816 3816 if (pVM->hm.s.fPostedIntrs) 3817 3817 { 3818 Assert( pVM->hm.s.vmx.Msrs.PinCtls.n.allowed1 & VMX_PIN_CTLS_POSTED_INT);3819 Assert( pVM->hm.s.vmx.Msrs.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_ACK_EXT_INT);3818 Assert(g_HmMsrs.u.vmx.PinCtls.n.allowed1 & VMX_PIN_CTLS_POSTED_INT); 3819 Assert(g_HmMsrs.u.vmx.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_ACK_EXT_INT); 3820 3820 fVal |= VMX_PIN_CTLS_POSTED_INT; 3821 3821 } … … 3825 3825 { 3826 3826 LogRelFunc(("Invalid pin-based VM-execution controls combo! Cpu=%#RX32 fVal=%#RX32 fZap=%#RX32\n", 3827 pVM->hm.s.vmx.Msrs.PinCtls.n.allowed0, fVal, fZap));3827 g_HmMsrs.u.vmx.PinCtls.n.allowed0, fVal, fZap)); 3828 3828 pVCpu->hm.s.u32HMError = VMX_UFC_CTRL_PIN_EXEC; 3829 3829 return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO; … … 3849 3849 { 3850 3850 PVMCC pVM = pVCpu->CTX_SUFF(pVM); 3851 uint32_t fVal = pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed0; /* Bits set here must be set in the VMCS. */3852 uint32_t const fZap = pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1; /* Bits cleared here must be cleared in the VMCS. */3851 uint32_t fVal = g_HmMsrs.u.vmx.ProcCtls2.n.allowed0; /* Bits set here must be set in the VMCS. */ 3852 uint32_t const fZap = g_HmMsrs.u.vmx.ProcCtls2.n.allowed1; /* Bits cleared here must be cleared in the VMCS. */ 3853 3853 3854 3854 /* WBINVD causes a VM-exit. */ 3855 if ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_WBINVD_EXIT)3855 if (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_WBINVD_EXIT) 3856 3856 fVal |= VMX_PROC_CTLS2_WBINVD_EXIT; 3857 3857 … … 3863 3863 by the hardware. Without this, guest executing INVPCID would cause a #UD. */ 3864 3864 if ( pVM->cpum.ro.GuestFeatures.fInvpcid 3865 && ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_INVPCID))3865 && (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_INVPCID)) 3866 3866 fVal |= VMX_PROC_CTLS2_INVPCID; 3867 3867 … … 3878 3878 { 3879 3879 /* Enable APIC-register virtualization. */ 3880 Assert( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_APIC_REG_VIRT);3880 Assert(g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_APIC_REG_VIRT); 3881 3881 fVal |= VMX_PROC_CTLS2_APIC_REG_VIRT; 3882 3882 3883 3883 /* Enable virtual-interrupt delivery. */ 3884 Assert( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_INTR_DELIVERY);3884 Assert(g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_INTR_DELIVERY); 3885 3885 fVal |= VMX_PROC_CTLS2_VIRT_INTR_DELIVERY; 3886 3886 } … … 3891 3891 /** @todo VIRT_X2APIC support, it's mutually exclusive with this. So must be 3892 3892 * done dynamically. */ 3893 if ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS)3893 if (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS) 3894 3894 { 3895 3895 fVal |= VMX_PROC_CTLS2_VIRT_APIC_ACCESS; … … 3900 3900 by the hardware. Without this, guest executing RDTSCP would cause a #UD. */ 3901 3901 if ( pVM->cpum.ro.GuestFeatures.fRdTscP 3902 && ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_RDTSCP))3902 && (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_RDTSCP)) 3903 3903 fVal |= VMX_PROC_CTLS2_RDTSCP; 3904 3904 3905 3905 /* Enable Pause-Loop exiting. */ 3906 if ( ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_PAUSE_LOOP_EXIT)3906 if ( (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_PAUSE_LOOP_EXIT) 3907 3907 && pVM->hm.s.vmx.cPleGapTicks 3908 3908 && pVM->hm.s.vmx.cPleWindowTicks) … … 3917 3917 { 3918 3918 LogRelFunc(("Invalid secondary processor-based VM-execution controls combo! cpu=%#RX32 fVal=%#RX32 fZap=%#RX32\n", 3919 pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed0, fVal, fZap));3919 g_HmMsrs.u.vmx.ProcCtls2.n.allowed0, fVal, fZap)); 3920 3920 pVCpu->hm.s.u32HMError = VMX_UFC_CTRL_PROC_EXEC2; 3921 3921 return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO; … … 3941 3941 { 3942 3942 PVMCC pVM = pVCpu->CTX_SUFF(pVM); 3943 uint32_t fVal = pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed0; /* Bits set here must be set in the VMCS. */3944 uint32_t const fZap = pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1; /* Bits cleared here must be cleared in the VMCS. */3943 uint32_t fVal = g_HmMsrs.u.vmx.ProcCtls.n.allowed0; /* Bits set here must be set in the VMCS. */ 3944 uint32_t const fZap = g_HmMsrs.u.vmx.ProcCtls.n.allowed1; /* Bits cleared here must be cleared in the VMCS. */ 3945 3945 3946 3946 fVal |= VMX_PROC_CTLS_HLT_EXIT /* HLT causes a VM-exit. */ … … 3953 3953 3954 3954 /* We toggle VMX_PROC_CTLS_MOV_DR_EXIT later, check if it's not -always- needed to be set or clear. */ 3955 if ( !( pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_MOV_DR_EXIT)3956 || ( pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed0 & VMX_PROC_CTLS_MOV_DR_EXIT))3955 if ( !(g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_MOV_DR_EXIT) 3956 || (g_HmMsrs.u.vmx.ProcCtls.n.allowed0 & VMX_PROC_CTLS_MOV_DR_EXIT)) 3957 3957 { 3958 3958 pVCpu->hm.s.u32HMError = VMX_UFC_CTRL_PROC_MOV_DRX_EXIT; … … 3971 3971 /* Use TPR shadowing if supported by the CPU. */ 3972 3972 if ( PDMHasApic(pVM) 3973 && ( pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_TPR_SHADOW))3973 && (g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_TPR_SHADOW)) 3974 3974 { 3975 3975 fVal |= VMX_PROC_CTLS_USE_TPR_SHADOW; /* CR8 reads from the Virtual-APIC page. */ … … 3989 3989 3990 3990 /* Use MSR-bitmaps if supported by the CPU. */ 3991 if ( pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_MSR_BITMAPS)3991 if (g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_MSR_BITMAPS) 3992 3992 { 3993 3993 fVal |= VMX_PROC_CTLS_USE_MSR_BITMAPS; … … 3996 3996 3997 3997 /* Use the secondary processor-based VM-execution controls if supported by the CPU. */ 3998 if ( pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_SECONDARY_CTLS)3998 if (g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_SECONDARY_CTLS) 3999 3999 fVal |= VMX_PROC_CTLS_USE_SECONDARY_CTLS; 4000 4000 … … 4002 4002 { 4003 4003 LogRelFunc(("Invalid processor-based VM-execution controls combo! cpu=%#RX32 fVal=%#RX32 fZap=%#RX32\n", 4004 pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed0, fVal, fZap));4004 g_HmMsrs.u.vmx.ProcCtls.n.allowed0, fVal, fZap)); 4005 4005 pVCpu->hm.s.u32HMError = VMX_UFC_CTRL_PROC_EXEC; 4006 4006 return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO; … … 4132 4132 if (RT_SUCCESS(rc)) 4133 4133 { 4134 if ( pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_MSR_BITMAPS)4134 if (g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_MSR_BITMAPS) 4135 4135 hmR0VmxSetupVmcsMsrBitmapAddr(pVmcsInfo); 4136 4136 … … 4522 4522 bool const fNestedPaging = pVM->hm.s.fNestedPagingCfg; 4523 4523 AssertReturn( !fNestedPaging 4524 || ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_EPT), /** @todo use a ring-0 copy of ProcCtls2.n.allowed1 */4524 || (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_EPT), /** @todo use a ring-0 copy of ProcCtls2.n.allowed1 */ 4525 4525 VERR_INCOMPATIBLE_CONFIG); 4526 4526 pVM->hmr0.s.fNestedPaging = fNestedPaging; … … 4991 4991 */ 4992 4992 { 4993 uint32_t fVal = pVM->hm.s.vmx.Msrs.EntryCtls.n.allowed0; /* Bits set here must be set in the VMCS. */4994 uint32_t const fZap = pVM->hm.s.vmx.Msrs.EntryCtls.n.allowed1; /* Bits cleared here must be cleared in the VMCS. */4993 uint32_t fVal = g_HmMsrs.u.vmx.EntryCtls.n.allowed0; /* Bits set here must be set in the VMCS. */ 4994 uint32_t const fZap = g_HmMsrs.u.vmx.EntryCtls.n.allowed1; /* Bits cleared here must be cleared in the VMCS. */ 4995 4995 4996 4996 /* … … 5048 5048 { 5049 5049 Log4Func(("Invalid VM-entry controls combo! Cpu=%#RX32 fVal=%#RX32 fZap=%#RX32\n", 5050 pVM->hm.s.vmx.Msrs.EntryCtls.n.allowed0, fVal, fZap));5050 g_HmMsrs.u.vmx.EntryCtls.n.allowed0, fVal, fZap)); 5051 5051 pVCpu->hm.s.u32HMError = VMX_UFC_CTRL_ENTRY; 5052 5052 return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO; … … 5066 5066 */ 5067 5067 { 5068 uint32_t fVal = pVM->hm.s.vmx.Msrs.ExitCtls.n.allowed0; /* Bits set here must be set in the VMCS. */5069 uint32_t const fZap = pVM->hm.s.vmx.Msrs.ExitCtls.n.allowed1; /* Bits cleared here must be cleared in the VMCS. */5068 uint32_t fVal = g_HmMsrs.u.vmx.ExitCtls.n.allowed0; /* Bits set here must be set in the VMCS. */ 5069 uint32_t const fZap = g_HmMsrs.u.vmx.ExitCtls.n.allowed1; /* Bits cleared here must be cleared in the VMCS. */ 5070 5070 5071 5071 /* … … 5107 5107 */ 5108 5108 if ( pVM->hm.s.vmx.fUsePreemptTimer 5109 && ( pVM->hm.s.vmx.Msrs.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_SAVE_PREEMPT_TIMER))5109 && (g_HmMsrs.u.vmx.ExitCtls.n.allowed1 & VMX_EXIT_CTLS_SAVE_PREEMPT_TIMER)) 5110 5110 fVal |= VMX_EXIT_CTLS_SAVE_PREEMPT_TIMER; 5111 5111 … … 5122 5122 { 5123 5123 Log4Func(("Invalid VM-exit controls combo! cpu=%#RX32 fVal=%#RX32 fZap=%R#X32\n", 5124 pVM->hm.s.vmx.Msrs.ExitCtls.n.allowed0, fVal, fZap));5124 g_HmMsrs.u.vmx.ExitCtls.n.allowed0, fVal, fZap)); 5125 5125 pVCpu->hm.s.u32HMError = VMX_UFC_CTRL_EXIT; 5126 5126 return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO; … … 6085 6085 { 6086 6086 /* If the CPU supports the monitor trap flag, use it for single stepping in DBGF and avoid intercepting #DB. */ 6087 PVMCC pVM = pVCpu->CTX_SUFF(pVM); 6088 if (pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_MONITOR_TRAP_FLAG) 6087 if (g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_MONITOR_TRAP_FLAG) 6089 6088 { 6090 6089 uProcCtls |= VMX_PROC_CTLS_MONITOR_TRAP_FLAG; … … 8233 8232 static void hmR0VmxSetIntWindowExitVmcs(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo) 8234 8233 { 8235 if ( pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_INT_WINDOW_EXIT)8234 if (g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_INT_WINDOW_EXIT) 8236 8235 { 8237 8236 if (!(pVmcsInfo->u32ProcCtls & VMX_PROC_CTLS_INT_WINDOW_EXIT)) … … 8270 8269 static void hmR0VmxSetNmiWindowExitVmcs(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo) 8271 8270 { 8272 if ( pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_NMI_WINDOW_EXIT)8271 if (g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_NMI_WINDOW_EXIT) 8273 8272 { 8274 8273 if (!(pVmcsInfo->u32ProcCtls & VMX_PROC_CTLS_NMI_WINDOW_EXIT)) … … 10522 10521 if (u32ProcCtls2 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS) 10523 10522 { 10524 Assert( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS);10523 Assert(g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS); 10525 10524 RTGCPHYS const GCPhysApicAccess = pVmcsNstGst->u64AddrApicAccess.u; 10526 10525 … … 10554 10553 if (u32ProcCtls & VMX_PROC_CTLS_USE_TPR_SHADOW) 10555 10554 { 10556 Assert( pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_TPR_SHADOW);10555 Assert(g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_TPR_SHADOW); 10557 10556 RTGCPHYS const GCPhysVirtApic = pVmcsNstGst->u64AddrVirtApic.u; 10558 10557 … … 10593 10592 PVMXVMCSINFO pVmcsInfoNstGst = &pVCpu->hmr0.s.vmx.VmcsInfoNstGst; 10594 10593 Assert(pVM->hm.s.vmx.fUnrestrictedGuest); 10595 Assert( pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_SECONDARY_CTLS);10594 Assert(g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_SECONDARY_CTLS); 10596 10595 Assert(hmGetVmxActiveVmcsInfo(pVCpu) == pVmcsInfoNstGst); 10597 10596 … … 10619 10618 && (u32ProcCtls2 & VMX_PROC_CTLS2_PAUSE_LOOP_EXIT)) 10620 10619 { 10621 Assert( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_PAUSE_LOOP_EXIT);10620 Assert(g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_PAUSE_LOOP_EXIT); 10622 10621 rc |= VMXWriteVmcs32(VMX_VMCS32_CTRL_PLE_GAP, cPleGapTicks); 10623 10622 rc |= VMXWriteVmcs32(VMX_VMCS32_CTRL_PLE_WINDOW, cPleWindowTicks); … … 10737 10736 PVMCC pVM = pVCpu->CTX_SUFF(pVM); 10738 10737 if ( !pVCpu->hm.s.vmx.u64GstMsrApicBase 10739 && ( pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS)10738 && (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS) 10740 10739 && PDMHasApic(pVM)) 10741 10740 { … … 11977 11976 * Sanitize the control stuff. 11978 11977 */ 11979 pDbgState->fCpe2Extra &= pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1;11978 pDbgState->fCpe2Extra &= g_HmMsrs.u.vmx.ProcCtls2.n.allowed1; 11980 11979 if (pDbgState->fCpe2Extra) 11981 11980 pDbgState->fCpe1Extra |= VMX_PROC_CTLS_USE_SECONDARY_CTLS; 11982 pDbgState->fCpe1Extra &= pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1;11983 pDbgState->fCpe1Unwanted &= ~ pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed0;11981 pDbgState->fCpe1Extra &= g_HmMsrs.u.vmx.ProcCtls.n.allowed1; 11982 pDbgState->fCpe1Unwanted &= ~g_HmMsrs.u.vmx.ProcCtls.n.allowed0; 11984 11983 if (pVCpu->hmr0.s.fDebugWantRdTscExit != RT_BOOL(pDbgState->fCpe1Extra & VMX_PROC_CTLS_RDTSC_EXIT)) 11985 11984 { -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r87531 r87543 1073 1073 { 1074 1074 LogRel(("HM: Failed to initialize VT-x / AMD-V: %Rrc\n", pVM->hm.s.rcInit)); 1075 LogRel(("HM: VMX MSR_IA32_FEATURE_CONTROL=%RX64\n", pVM->hm.s.vmx.Msrs .u64FeatCtrl));1075 LogRel(("HM: VMX MSR_IA32_FEATURE_CONTROL=%RX64\n", pVM->hm.s.vmx.MsrsForRing3.u64FeatCtrl)); 1076 1076 switch (pVM->hm.s.rcInit) 1077 1077 { … … 1502 1502 1503 1503 LogFunc(("pVM->hm.s.vmx.fSupported = %d\n", pVM->hm.s.vmx.fSupported)); 1504 AssertLogRelReturn(pVM->hm.s.vmx.Msrs .u64FeatCtrl != 0, VERR_HM_IPE_4);1504 AssertLogRelReturn(pVM->hm.s.vmx.MsrsForRing3.u64FeatCtrl != 0, VERR_HM_IPE_4); 1505 1505 1506 1506 LogRel(("HM: Using VT-x implementation 3.0\n")); … … 1510 1510 LogRel(("HM: MSR_IA32_SMM_MONITOR_CTL = %#RX64\n", pVM->hm.s.vmx.u64HostSmmMonitorCtl)); 1511 1511 1512 hmR3VmxReportFeatCtlMsr(pVM->hm.s.vmx.Msrs .u64FeatCtrl);1513 hmR3VmxReportBasicMsr(pVM->hm.s.vmx.Msrs .u64Basic);1514 1515 hmR3VmxReportPinBasedCtlsMsr(&pVM->hm.s.vmx.Msrs .PinCtls);1516 hmR3VmxReportProcBasedCtlsMsr(&pVM->hm.s.vmx.Msrs .ProcCtls);1517 if (pVM->hm.s.vmx.Msrs .ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_SECONDARY_CTLS)1518 hmR3VmxReportProcBasedCtls2Msr(&pVM->hm.s.vmx.Msrs .ProcCtls2);1519 1520 hmR3VmxReportEntryCtlsMsr(&pVM->hm.s.vmx.Msrs .EntryCtls);1521 hmR3VmxReportExitCtlsMsr(&pVM->hm.s.vmx.Msrs .ExitCtls);1522 1523 if (RT_BF_GET(pVM->hm.s.vmx.Msrs .u64Basic, VMX_BF_BASIC_TRUE_CTLS))1512 hmR3VmxReportFeatCtlMsr(pVM->hm.s.vmx.MsrsForRing3.u64FeatCtrl); 1513 hmR3VmxReportBasicMsr(pVM->hm.s.vmx.MsrsForRing3.u64Basic); 1514 1515 hmR3VmxReportPinBasedCtlsMsr(&pVM->hm.s.vmx.MsrsForRing3.PinCtls); 1516 hmR3VmxReportProcBasedCtlsMsr(&pVM->hm.s.vmx.MsrsForRing3.ProcCtls); 1517 if (pVM->hm.s.vmx.MsrsForRing3.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_SECONDARY_CTLS) 1518 hmR3VmxReportProcBasedCtls2Msr(&pVM->hm.s.vmx.MsrsForRing3.ProcCtls2); 1519 1520 hmR3VmxReportEntryCtlsMsr(&pVM->hm.s.vmx.MsrsForRing3.EntryCtls); 1521 hmR3VmxReportExitCtlsMsr(&pVM->hm.s.vmx.MsrsForRing3.ExitCtls); 1522 1523 if (RT_BF_GET(pVM->hm.s.vmx.MsrsForRing3.u64Basic, VMX_BF_BASIC_TRUE_CTLS)) 1524 1524 { 1525 1525 /* We don't extensively dump the true capability MSRs as we don't use them, see @bugref{9180#c5}. */ 1526 LogRel(("HM: MSR_IA32_VMX_TRUE_PINBASED_CTLS = %#RX64\n", pVM->hm.s.vmx.Msrs .TruePinCtls));1527 LogRel(("HM: MSR_IA32_VMX_TRUE_PROCBASED_CTLS = %#RX64\n", pVM->hm.s.vmx.Msrs .TrueProcCtls));1528 LogRel(("HM: MSR_IA32_VMX_TRUE_ENTRY_CTLS = %#RX64\n", pVM->hm.s.vmx.Msrs .TrueEntryCtls));1529 LogRel(("HM: MSR_IA32_VMX_TRUE_EXIT_CTLS = %#RX64\n", pVM->hm.s.vmx.Msrs .TrueExitCtls));1530 } 1531 1532 hmR3VmxReportMiscMsr(pVM, pVM->hm.s.vmx.Msrs .u64Misc);1533 hmR3VmxReportVmcsEnumMsr(pVM->hm.s.vmx.Msrs .u64VmcsEnum);1534 if (pVM->hm.s.vmx.Msrs .u64EptVpidCaps)1535 hmR3VmxReportEptVpidCapsMsr(pVM->hm.s.vmx.Msrs .u64EptVpidCaps);1536 if (pVM->hm.s.vmx.Msrs .u64VmFunc)1537 hmR3VmxReportVmFuncMsr(pVM->hm.s.vmx.Msrs .u64VmFunc);1538 hmR3VmxReportCrFixedMsrs(&pVM->hm.s.vmx.Msrs );1526 LogRel(("HM: MSR_IA32_VMX_TRUE_PINBASED_CTLS = %#RX64\n", pVM->hm.s.vmx.MsrsForRing3.TruePinCtls)); 1527 LogRel(("HM: MSR_IA32_VMX_TRUE_PROCBASED_CTLS = %#RX64\n", pVM->hm.s.vmx.MsrsForRing3.TrueProcCtls)); 1528 LogRel(("HM: MSR_IA32_VMX_TRUE_ENTRY_CTLS = %#RX64\n", pVM->hm.s.vmx.MsrsForRing3.TrueEntryCtls)); 1529 LogRel(("HM: MSR_IA32_VMX_TRUE_EXIT_CTLS = %#RX64\n", pVM->hm.s.vmx.MsrsForRing3.TrueExitCtls)); 1530 } 1531 1532 hmR3VmxReportMiscMsr(pVM, pVM->hm.s.vmx.MsrsForRing3.u64Misc); 1533 hmR3VmxReportVmcsEnumMsr(pVM->hm.s.vmx.MsrsForRing3.u64VmcsEnum); 1534 if (pVM->hm.s.vmx.MsrsForRing3.u64EptVpidCaps) 1535 hmR3VmxReportEptVpidCapsMsr(pVM->hm.s.vmx.MsrsForRing3.u64EptVpidCaps); 1536 if (pVM->hm.s.vmx.MsrsForRing3.u64VmFunc) 1537 hmR3VmxReportVmFuncMsr(pVM->hm.s.vmx.MsrsForRing3.u64VmFunc); 1538 hmR3VmxReportCrFixedMsrs(&pVM->hm.s.vmx.MsrsForRing3); 1539 1539 1540 1540 #ifdef TODO_9217_VMCSINFO … … 1564 1564 */ 1565 1565 AssertLogRelReturn( !pVM->hm.s.fNestedPagingCfg 1566 || (pVM->hm.s.vmx.Msrs .ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_EPT),1566 || (pVM->hm.s.vmx.MsrsForRing3.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_EPT), 1567 1567 VERR_HM_IPE_1); 1568 1568 AssertLogRelReturn( !pVM->hm.s.vmx.fUnrestrictedGuest 1569 || ( (pVM->hm.s.vmx.Msrs .ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_UNRESTRICTED_GUEST)1569 || ( (pVM->hm.s.vmx.MsrsForRing3.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_UNRESTRICTED_GUEST) 1570 1570 && pVM->hm.s.fNestedPagingCfg), 1571 1571 VERR_HM_IPE_1); … … 1576 1576 * in Nehalems and secondary VM exec. controls should be supported in all of them, but nonetheless it's Intel... 1577 1577 */ 1578 if ( !(pVM->hm.s.vmx.Msrs .ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_SECONDARY_CTLS)1578 if ( !(pVM->hm.s.vmx.MsrsForRing3.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_SECONDARY_CTLS) 1579 1579 && CPUMR3GetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_RDTSCP)) 1580 1580 { … … 1749 1749 if (pVM->hm.s.vmx.fUseVmcsShadowing) 1750 1750 { 1751 bool const fFullVmcsShadow = RT_BOOL(pVM->hm.s.vmx.Msrs .u64Misc & VMX_MISC_VMWRITE_ALL);1751 bool const fFullVmcsShadow = RT_BOOL(pVM->hm.s.vmx.MsrsForRing3.u64Misc & VMX_MISC_VMWRITE_ALL); 1752 1752 LogRel(("HM: Enabled %s VMCS shadowing\n", fFullVmcsShadow ? "full" : "partial")); 1753 1753 } … … 3072 3072 if (iStatusCode == VERR_VMX_UNABLE_TO_START_VM) 3073 3073 { 3074 LogRel(("HM: VERR_VMX_UNABLE_TO_START_VM: VM-entry allowed-1 %#RX32\n", pVM->hm.s.vmx.Msrs .EntryCtls.n.allowed1));3075 LogRel(("HM: VERR_VMX_UNABLE_TO_START_VM: VM-entry allowed-0 %#RX32\n", pVM->hm.s.vmx.Msrs .EntryCtls.n.allowed0));3074 LogRel(("HM: VERR_VMX_UNABLE_TO_START_VM: VM-entry allowed-1 %#RX32\n", pVM->hm.s.vmx.MsrsForRing3.EntryCtls.n.allowed1)); 3075 LogRel(("HM: VERR_VMX_UNABLE_TO_START_VM: VM-entry allowed-0 %#RX32\n", pVM->hm.s.vmx.MsrsForRing3.EntryCtls.n.allowed0)); 3076 3076 } 3077 3077 else if (iStatusCode == VERR_VMX_INVALID_VMXON_PTR) -
trunk/src/VBox/VMM/include/HMInternal.h
r87539 r87543 552 552 553 553 /** VMX MSR values. */ 554 VMXMSRS Msrs ;554 VMXMSRS MsrsForRing3; 555 555 556 556 /** Virtual address of the TSS page used for real mode emulation. */ -
trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp
r87521 r87543 370 370 CHECK_MEMBER_ALIGNMENT(HM, uMaxAsidForLog, 8); 371 371 CHECK_MEMBER_ALIGNMENT(HM, vmx, 8); 372 CHECK_MEMBER_ALIGNMENT(HM, vmx.Msrs , 8);372 CHECK_MEMBER_ALIGNMENT(HM, vmx.MsrsForRing3, 8); 373 373 CHECK_MEMBER_ALIGNMENT(HM, svm, 8); 374 374 CHECK_MEMBER_ALIGNMENT(HM, PatchTree, 8);
Note:
See TracChangeset
for help on using the changeset viewer.