From ebc8f02885eeee26cbd62a0931fd94c141524ea0 Mon Sep 17 00:00:00 2001 From: gnick79 Date: Wed, 2 Feb 2011 04:08:52 +0000 Subject: [PATCH] * Better fix for CPUID (and this time is the right time) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7038 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/CPUDetect.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 063c55abba..53bcbae5dc 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -133,13 +133,15 @@ void CPUInfo::Detect() strcpy(brand_string, cpu_string); // Detect family and other misc stuff. - HTT = false; + bool ht = false; + HTT = ht; logical_cpu_count = 1; if (max_std_fn >= 1) { __cpuid(cpu_id, 0x00000001); logical_cpu_count = (cpu_id[1] >> 16) & 0xFF; - // HTT is valid for intel processors only. - HTT = ((cpu_id[3] >> 28) & 1) && vendor == VENDOR_INTEL; + ht = (cpu_id[3] >> 28) & 1; + // True HTT is valid for intel processors only. + HTT = (ht && vendor == VENDOR_INTEL); if ((cpu_id[3] >> 25) & 1) bSSE = true; if ((cpu_id[3] >> 26) & 1) bSSE2 = true; if ((cpu_id[2]) & 1) bSSE3 = true; @@ -171,14 +173,16 @@ void CPUInfo::Detect() __cpuid(cpu_id, 0x80000008); int apic_id_core_id_size = (cpu_id[2] >> 12) & 0xF; if (apic_id_core_id_size == 0) { - // New mechanism for modern CPUs. num_cores = logical_cpu_count; - if (HTT) { - __cpuid(cpu_id, 0x00000004); - int cores_x_package = ((cpu_id[0] >> 26) & 0x3F) + 1; - cores_x_package = ((logical_cpu_count % cores_x_package) == 0) ? cores_x_package : 1; - num_cores = (cores_x_package > 1) ? cores_x_package : num_cores; - logical_cpu_count /= cores_x_package; + if (ht) { + // New mechanism for modern Intel CPUs. + if (HTT) { + __cpuid(cpu_id, 0x00000004); + int cores_x_package = ((cpu_id[0] >> 26) & 0x3F) + 1; + cores_x_package = ((logical_cpu_count % cores_x_package) == 0) ? cores_x_package : 1; + num_cores = (cores_x_package > 1) ? cores_x_package : num_cores; + logical_cpu_count /= cores_x_package; + } } else {