402 } else {
403 result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
404 }
405 } else if (is_amd()) {
406 result = (_cpuid_info.ext_cpuid8_ecx.bits.cores_per_cpu + 1);
407 }
408 return result;
409 }
410
411 static uint threads_per_core() {
412 uint result = 1;
413 if (is_intel() && supports_processor_topology()) {
414 result = _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
415 } else if (_cpuid_info.std_cpuid1_edx.bits.ht != 0) {
416 result = _cpuid_info.std_cpuid1_ebx.bits.threads_per_cpu /
417 cores_per_cpu();
418 }
419 return result;
420 }
421
422 static intx L1_data_cache_line_size() {
423 intx result = 0;
424 if (is_intel()) {
425 result = (_cpuid_info.dcp_cpuid4_ebx.bits.L1_line_size + 1);
426 } else if (is_amd()) {
427 result = _cpuid_info.ext_cpuid5_ecx.bits.L1_line_size;
428 }
429 if (result < 32) // not defined ?
430 result = 32; // 32 bytes by default on x86 and other x64
431 return result;
432 }
433
434 //
435 // Feature identification
436 //
437 static bool supports_cpuid() { return _cpuFeatures != 0; }
438 static bool supports_cmpxchg8() { return (_cpuFeatures & CPU_CX8) != 0; }
439 static bool supports_cmov() { return (_cpuFeatures & CPU_CMOV) != 0; }
440 static bool supports_fxsr() { return (_cpuFeatures & CPU_FXSR) != 0; }
441 static bool supports_ht() { return (_cpuFeatures & CPU_HT) != 0; }
442 static bool supports_mmx() { return (_cpuFeatures & CPU_MMX) != 0; }
|
402 } else {
403 result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
404 }
405 } else if (is_amd()) {
406 result = (_cpuid_info.ext_cpuid8_ecx.bits.cores_per_cpu + 1);
407 }
408 return result;
409 }
410
411 static uint threads_per_core() {
412 uint result = 1;
413 if (is_intel() && supports_processor_topology()) {
414 result = _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
415 } else if (_cpuid_info.std_cpuid1_edx.bits.ht != 0) {
416 result = _cpuid_info.std_cpuid1_ebx.bits.threads_per_cpu /
417 cores_per_cpu();
418 }
419 return result;
420 }
421
422 static intx prefetch_data_size() {
423 intx result = 0;
424 if (is_intel()) {
425 result = (_cpuid_info.dcp_cpuid4_ebx.bits.L1_line_size + 1);
426 } else if (is_amd()) {
427 result = _cpuid_info.ext_cpuid5_ecx.bits.L1_line_size;
428 }
429 if (result < 32) // not defined ?
430 result = 32; // 32 bytes by default on x86 and other x64
431 return result;
432 }
433
434 //
435 // Feature identification
436 //
437 static bool supports_cpuid() { return _cpuFeatures != 0; }
438 static bool supports_cmpxchg8() { return (_cpuFeatures & CPU_CX8) != 0; }
439 static bool supports_cmov() { return (_cpuFeatures & CPU_CMOV) != 0; }
440 static bool supports_fxsr() { return (_cpuFeatures & CPU_FXSR) != 0; }
441 static bool supports_ht() { return (_cpuFeatures & CPU_HT) != 0; }
442 static bool supports_mmx() { return (_cpuFeatures & CPU_MMX) != 0; }
|