summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAugustin Cavalier <waddlesplash@gmail.com>2014-10-20 14:01:50 -0400
committerAugustin Cavalier <waddlesplash@gmail.com>2014-10-24 16:09:21 -0400
commit51700a2b6873b698e7d446c73a519bf5e9e863ee (patch)
tree252506b9947d0d66e16f9bf24113a9d41c634965
parent8d4068527bf2e74aae36f33fabbbdfde29fcb8e9 (diff)
Fix the brand/cpu_string reversal.
Before this commit, the two were reversed ("cpu_string" had the brand, e.g. "AuthenticAMD"; and "brand_string" had the CPU type, e.g. "AMD Phenom II X4 925").
-rw-r--r--Source/Core/Common/CPUDetect.h4
-rw-r--r--Source/Core/Common/x64CPUDetect.cpp26
2 files changed, 17 insertions, 13 deletions
diff --git a/Source/Core/Common/CPUDetect.h b/Source/Core/Common/CPUDetect.h
index 5d73be28ee..d66ace3c62 100644
--- a/Source/Core/Common/CPUDetect.h
+++ b/Source/Core/Common/CPUDetect.h
@@ -20,8 +20,8 @@ struct CPUInfo
{
CPUVendor vendor;
- char cpu_string[0x21];
- char brand_string[0x41];
+ char cpu_string[0x41];
+ char brand_string[0x21];
bool OS64bit;
bool CPU64bit;
bool Mode64bit;
diff --git a/Source/Core/Common/x64CPUDetect.cpp b/Source/Core/Common/x64CPUDetect.cpp
index d0dab9a256..4150a4159f 100644
--- a/Source/Core/Common/x64CPUDetect.cpp
+++ b/Source/Core/Common/x64CPUDetect.cpp
@@ -102,25 +102,25 @@ void CPUInfo::Detect()
// Assume CPU supports the CPUID instruction. Those that don't can barely
// boot modern OS:es anyway.
int cpu_id[4];
- memset(cpu_string, 0, sizeof(cpu_string));
+ memset(brand_string, 0, sizeof(brand_string));
// Detect CPU's CPUID capabilities, and grab cpu string
__cpuid(cpu_id, 0x00000000);
u32 max_std_fn = cpu_id[0]; // EAX
- *((int *)cpu_string) = cpu_id[1];
- *((int *)(cpu_string + 4)) = cpu_id[3];
- *((int *)(cpu_string + 8)) = cpu_id[2];
+ *((int *)brand_string) = cpu_id[1];
+ *((int *)(brand_string + 4)) = cpu_id[3];
+ *((int *)(brand_string + 8)) = cpu_id[2];
__cpuid(cpu_id, 0x80000000);
u32 max_ex_fn = cpu_id[0];
- if (!strcmp(cpu_string, "GenuineIntel"))
+ if (!strcmp(brand_string, "GenuineIntel"))
vendor = VENDOR_INTEL;
- else if (!strcmp(cpu_string, "AuthenticAMD"))
+ else if (!strcmp(brand_string, "AuthenticAMD"))
vendor = VENDOR_AMD;
else
vendor = VENDOR_OTHER;
// Set reasonable default brand string even if brand string not available.
- strcpy(brand_string, cpu_string);
+ strcpy(cpu_string, brand_string);
// Detect family and other misc stuff.
bool ht = false;
@@ -178,13 +178,13 @@ void CPUInfo::Detect()
if (max_ex_fn >= 0x80000004)
{
- // Extract brand string
+ // Extract CPU model string
__cpuid(cpu_id, 0x80000002);
- memcpy(brand_string, cpu_id, sizeof(cpu_id));
+ memcpy(cpu_string, cpu_id, sizeof(cpu_id));
__cpuid(cpu_id, 0x80000003);
- memcpy(brand_string + 16, cpu_id, sizeof(cpu_id));
+ memcpy(cpu_string + 16, cpu_id, sizeof(cpu_id));
__cpuid(cpu_id, 0x80000004);
- memcpy(brand_string + 32, cpu_id, sizeof(cpu_id));
+ memcpy(cpu_string + 32, cpu_id, sizeof(cpu_id));
}
if (max_ex_fn >= 0x80000001)
{
@@ -229,6 +229,10 @@ void CPUInfo::Detect()
std::string CPUInfo::Summarize()
{
std::string sum(cpu_string);
+ sum += " (";
+ sum += brand_string;
+ sum += ")";
+
if (bSSE) sum += ", SSE";
if (bSSE2)
{