Changeset 95179 in vbox
- Timestamp:
- Jun 2, 2022 9:24:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
r95174 r95179 3262 3262 PCPUMMSRRANGE pMsrRange; 3263 3263 3264 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64) 3265 # define CHECK_X86_HOST_FEATURE_RET(a_fFeature, a_szFeature) \ 3266 if (!pVM->cpum.s.HostFeatures. a_fFeature) \ 3267 { \ 3268 LogRel(("CPUM: WARNING! Can't turn on " a_szFeature " when the host doesn't support it!\n")); \ 3269 return; \ 3270 } else do { } while (0) 3271 #else 3272 # define CHECK_X86_HOST_FEATURE_RET(a_fFeature, a_szFeature) do { } while (0) 3273 #endif 3274 3275 #define GET_8000_0001_CHECK_X86_HOST_FEATURE_RET(a_fFeature, a_szFeature) \ 3276 do \ 3277 { \ 3278 pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001)); \ 3279 if (!pLeaf) \ 3280 { \ 3281 LogRel(("CPUM: WARNING! Can't turn on " a_szFeature " when no 0x80000001 CPUID leaf!\n")); \ 3282 return; \ 3283 } \ 3284 CHECK_X86_HOST_FEATURE_RET(a_fFeature,a_szFeature); \ 3285 } while (0) 3286 3264 3287 switch (enmFeature) 3265 3288 { … … 3322 3345 */ 3323 3346 case CPUMCPUIDFEATURE_SEP: 3324 if (!pVM->cpum.s.HostFeatures.fSysEnter) 3325 { 3326 AssertMsgFailed(("ERROR: Can't turn on SEP when the host doesn't support it!!\n")); 3327 return; 3328 } 3329 3347 CHECK_X86_HOST_FEATURE_RET(fSysEnter, "SEP"); 3330 3348 pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001)); 3331 3349 if (pLeaf) … … 3340 3358 */ 3341 3359 case CPUMCPUIDFEATURE_SYSCALL: 3342 pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001)); 3343 if ( !pLeaf 3344 || !pVM->cpum.s.HostFeatures.fSysCall) 3345 { 3346 LogRel(("CPUM: WARNING! Can't turn on SYSCALL/SYSRET when the host doesn't support it!\n")); 3347 return; 3348 } 3360 GET_8000_0001_CHECK_X86_HOST_FEATURE_RET(fSysCall, "SYSCALL/SYSRET"); 3349 3361 3350 3362 /* Valid for both Intel and AMD CPUs, although only in 64 bits mode for Intel. */ … … 3359 3371 */ 3360 3372 case CPUMCPUIDFEATURE_PAE: 3361 if (!pVM->cpum.s.HostFeatures.fPae)3362 {3363 LogRel(("CPUM: WARNING! Can't turn on PAE when the host doesn't support it!\n"));3364 return;3365 }3366 3367 3373 pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001)); 3368 3374 if (pLeaf) … … 3384 3390 */ 3385 3391 case CPUMCPUIDFEATURE_LONG_MODE: 3386 pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001)); 3387 if ( !pLeaf 3388 || !pVM->cpum.s.HostFeatures.fLongMode) 3389 { 3390 LogRel(("CPUM: WARNING! Can't turn on LONG MODE when the host doesn't support it!\n")); 3391 return; 3392 } 3392 GET_8000_0001_CHECK_X86_HOST_FEATURE_RET(fLongMode, "LONG MODE"); 3393 3393 3394 3394 /* Valid for both Intel and AMD. */ … … 3410 3410 */ 3411 3411 case CPUMCPUIDFEATURE_NX: 3412 pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001)); 3413 if ( !pLeaf 3414 || !pVM->cpum.s.HostFeatures.fNoExecute) 3415 { 3416 LogRel(("CPUM: WARNING! Can't turn on NX/XD when the host doesn't support it!\n")); 3417 return; 3418 } 3412 GET_8000_0001_CHECK_X86_HOST_FEATURE_RET(fNoExecute, "NX/XD"); 3419 3413 3420 3414 /* Valid for both Intel and AMD. */ … … 3430 3424 */ 3431 3425 case CPUMCPUIDFEATURE_LAHF: 3432 pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001)); 3433 if ( !pLeaf 3434 || !pVM->cpum.s.HostFeatures.fLahfSahf) 3435 { 3436 LogRel(("CPUM: WARNING! Can't turn on LAHF/SAHF when the host doesn't support it!\n")); 3437 return; 3438 } 3426 GET_8000_0001_CHECK_X86_HOST_FEATURE_RET(fLahfSahf, "LAHF/SAHF"); 3439 3427 3440 3428 /* Valid for both Intel and AMD. */ … … 3449 3437 */ 3450 3438 case CPUMCPUIDFEATURE_RDTSCP: 3439 if (pVM->cpum.s.u8PortableCpuIdLevel > 0) 3440 return; 3441 GET_8000_0001_CHECK_X86_HOST_FEATURE_RET(fRdTscP, "RDTSCP"); 3451 3442 pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001)); 3452 if ( !pLeaf3453 || !pVM->cpum.s.HostFeatures.fRdTscP3454 || pVM->cpum.s.u8PortableCpuIdLevel > 0)3455 {3456 if (!pVM->cpum.s.u8PortableCpuIdLevel)3457 LogRel(("CPUM: WARNING! Can't turn on RDTSCP when the host doesn't support it!\n"));3458 return;3459 }3460 3443 3461 3444 /* Valid for both Intel and AMD. */ … … 3580 3563 pVCpu->cpum.s.fChanged |= CPUM_CHANGED_CPUID; 3581 3564 } 3565 3566 #undef GET_8000_0001_CHECK_X86_HOST_FEATURE_RET 3567 #undef CHECK_X86_HOST_FEATURE_RET 3582 3568 } 3583 3569
Note:
See TracChangeset
for help on using the changeset viewer.