Changeset 48267 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Sep 4, 2013 2:06:50 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 88682
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r48209 r48267 3394 3394 uint32_t fFeaturesECX, fFeaturesEDX, uDummy; 3395 3395 uint32_t uMaxId, uVendorEBX, uVendorECX, uVendorEDX; 3396 uint64_t u64 Value;3396 uint64_t u64FeatMsr; 3397 3397 3398 3398 ASMCpuId(0, &uMaxId, &uVendorEBX, &uVendorECX, &uVendorEDX); … … 3409 3409 ) 3410 3410 { 3411 bool fInSmxMode; 3412 bool fMsrLocked; 3413 bool fSmxVmxAllowed; 3414 bool fVmxAllowed; 3415 3411 3416 /* 3412 * Both the LOCK and VMXON bit must be set; otherwise VMXON will generate a #GP. 3413 * Once the lock bit is set, this MSR can no longer be modified. 3417 * We require the lock bit and the appropriate VMXON bit to be set otherwise VMXON will generate a #GP 3418 * This is a simplified check (assumes BIOS does it job and properly locks the control bit). For the more 3419 * extensive procedure see hmR0InitIntelCpu(). 3414 3420 */ 3415 u64Value = ASMRdMsr(MSR_IA32_FEATURE_CONTROL); 3416 if ( (u64Value & (MSR_IA32_FEATURE_CONTROL_VMXON | MSR_IA32_FEATURE_CONTROL_LOCK)) 3417 == (MSR_IA32_FEATURE_CONTROL_VMXON | MSR_IA32_FEATURE_CONTROL_LOCK) /* enabled and locked */ 3418 || !(u64Value & MSR_IA32_FEATURE_CONTROL_LOCK) /* not enabled, but not locked either */ 3419 ) 3421 u64FeatMsr = ASMRdMsr(MSR_IA32_FEATURE_CONTROL); 3422 fInSmxMode = !!(ASMGetCR4() & X86_CR4_SMXE); 3423 fMsrLocked = !!(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_LOCK); 3424 fSmxVmxAllowed = fMsrLocked && !!(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMXON); 3425 fVmxAllowed = fMsrLocked && !!(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMXON); 3426 if ( (fInSmxMode && fSmxVmxAllowed) 3427 || fVmxAllowed) 3420 3428 { 3421 3429 VMX_CAPABILITY vtCaps; … … 3432 3440 return VINF_SUCCESS; 3433 3441 } 3434 return VERR_VMX_MSR_LOCKED_OR_DISABLED;3442 return fInSmxMode ? VERR_VMX_MSR_SMX_VMXON_DISABLED : VERR_VMX_MSR_VMXON_DISABLED; 3435 3443 } 3436 3444 return VERR_VMX_NO_VMX; … … 3451 3459 { 3452 3460 /* Check if SVM is disabled */ 3453 u64 Value= ASMRdMsr(MSR_K8_VM_CR);3454 if (!(u64 Value& MSR_K8_VM_CR_SVM_DISABLE))3461 u64FeatMsr = ASMRdMsr(MSR_K8_VM_CR); 3462 if (!(u64FeatMsr & MSR_K8_VM_CR_SVM_DISABLE)) 3455 3463 { 3456 3464 uint32_t fSvmFeatures;
Note:
See TracChangeset
for help on using the changeset viewer.