Changeset 56212 in vbox
- Timestamp:
- Jun 3, 2015 9:27:13 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 100755
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.cpp
r55988 r56212 3813 3813 * Once the lock bit is set, this MSR can no longer be modified. 3814 3814 * 3815 * Set both the VMXON and SMX_VMXON bits as we can't determine SMX mode 3816 * accurately. See @bugref{6873}. 3815 * Set both the VMXON and SMX_VMXON bits (if supported) as we can't 3816 * determine SMX mode accurately. See @bugref{6873}. 3817 * 3818 * The reason we are being paranoid here and (re)checking is that we don't assume all callers 3819 * of this function to check it like SUPR0QueryVTCaps() currently does. If we get something 3820 * wrong here, we can throw a #GP and panic the box. This isn't a performance critical path. 3817 3821 */ 3818 u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_LOCK 3819 | MSR_IA32_FEATURE_CONTROL_SMX_VMXON 3820 | MSR_IA32_FEATURE_CONTROL_VMXON; 3821 ASMWrMsr(MSR_IA32_FEATURE_CONTROL, u64FeatMsr); 3822 3823 /* Verify. */ 3824 u64FeatMsr = ASMRdMsr(MSR_IA32_FEATURE_CONTROL); 3825 fMsrLocked = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_LOCK); 3826 fSmxVmxAllowed = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMXON); 3827 fVmxAllowed = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMXON); 3828 if (fSmxVmxAllowed && fVmxAllowed) 3829 rc = VINF_SUCCESS; 3822 uint32_t fFeaturesECX, uDummy; 3823 uint32_t uMaxId, uVendorEBX, uVendorECX, uVendorEDX; 3824 ASMCpuId(0, &uMaxId, &uVendorEBX, &uVendorECX, &uVendorEDX); 3825 ASMCpuId(1, &uDummy, &uDummy, &fFeaturesECX, &uDummy); 3826 if ( ASMIsValidStdRange(uMaxId) 3827 && ( ASMIsIntelCpuEx( uVendorEBX, uVendorECX, uVendorEDX) 3828 || ASMIsViaCentaurCpuEx(uVendorEBX, uVendorECX, uVendorEDX))) 3829 { 3830 bool fSmxVmxHwSupport = false; 3831 if ( (fFeaturesECX & X86_CPUID_FEATURE_ECX_VMX) 3832 && (fFeaturesECX & X86_CPUID_FEATURE_ECX_SMX)) 3833 fSmxVmxHwSupport = true; 3834 3835 u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_LOCK 3836 | MSR_IA32_FEATURE_CONTROL_VMXON; 3837 if (fSmxVmxHwSupport) 3838 u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_SMX_VMXON; 3839 3840 /* Commit. */ 3841 ASMWrMsr(MSR_IA32_FEATURE_CONTROL, u64FeatMsr); 3842 3843 /* Verify. */ 3844 u64FeatMsr = ASMRdMsr(MSR_IA32_FEATURE_CONTROL); 3845 fMsrLocked = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_LOCK); 3846 fSmxVmxAllowed = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMXON); 3847 fVmxAllowed = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMXON); 3848 if ( fVmxAllowed 3849 && ( !fSmxVmxHwSupport 3850 || fSmxVmxAllowed)) 3851 rc = VINF_SUCCESS; 3852 else 3853 rc = VERR_VMX_MSR_LOCKING_FAILED; 3854 } 3830 3855 else 3831 rc = VERR_VMX_ MSR_LOCKING_FAILED;3856 rc = VERR_VMX_IPE_5; 3832 3857 } 3833 3858
Note:
See TracChangeset
for help on using the changeset viewer.