From a56942d4978786686b0f0bd0c4e84d0af4e1eacb Mon Sep 17 00:00:00 2001 From: David McPaul Date: Fri, 17 Apr 2009 20:59:14 +0000 Subject: [PATCH] correct the model calculations for intel processors git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30231 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/sysinfo.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/bin/sysinfo.c b/src/bin/sysinfo.c index b83ad7de45..efae277265 100644 --- a/src/bin/sysinfo.c +++ b/src/bin/sysinfo.c @@ -379,15 +379,27 @@ print_features(uint32 features) #ifdef __INTEL__ static void -print_processor_signature(cpuid_info *info, const char *prefix) +print_processor_signature(system_info *sys_info, cpuid_info *info, const char *prefix) { - printf("\t%s%sype %u, family %u, model %u, stepping %u, features 0x%08lx\n", - prefix ? prefix : "", prefix && prefix[0] ? "t" : "T", - info->eax_1.type, - info->eax_1.family + (info->eax_1.family == 0xf ? info->eax_1.extended_family : 0), - info->eax_1.model + (info->eax_1.model == 0xf ? info->eax_1.extended_model << 4 : 0), - info->eax_1.stepping, - info->eax_1.features); + + if ((sys_info->cpu_type & B_CPU_x86_VENDOR_MASK) == B_CPU_AMD_x86) { + printf("\t%s%sype %u, family %u, model %u, stepping %u, features 0x%08lx\n", + prefix ? prefix : "", prefix && prefix[0] ? "t" : "T", + info->eax_1.type, + info->eax_1.family + (info->eax_1.family == 0xf ? info->eax_1.extended_family : 0), + info->eax_1.model + (info->eax_1.model == 0xf ? info->eax_1.extended_model << 4 : 0), + info->eax_1.stepping, + info->eax_1.features); + } else if ((sys_info->cpu_type & B_CPU_x86_VENDOR_MASK) == B_CPU_INTEL_x86) { + // model calculation is different for INTEL + printf("\t%s%sype %u, family %u, model %u, stepping %u, features 0x%08lx\n", + prefix ? prefix : "", prefix && prefix[0] ? "t" : "T", + info->eax_1.type, + info->eax_1.family + (info->eax_1.family == 0xf ? info->eax_1.extended_family : 0), + info->eax_1.model + ((info->eax_1.family == 0xf || info->eax_1.family == 0x6) ? info->eax_1.extended_model << 4 : 0), + info->eax_1.stepping, + info->eax_1.features); + } } #endif // __INTEL__ @@ -475,7 +487,7 @@ dump_cpu(system_info *info, int32 cpu) } get_cpuid(&cpuInfo, 1, cpu); - print_processor_signature(&cpuInfo, NULL); + print_processor_signature(info, &cpuInfo, NULL); print_features(cpuInfo.eax_1.features); if (maxStandardFunction >= 1) { @@ -487,7 +499,7 @@ dump_cpu(system_info *info, int32 cpu) /* Extended CPUID */ if (maxExtendedFunction >= 1) { get_cpuid(&cpuInfo, 0x80000001, cpu); - print_processor_signature(&cpuInfo, "Extended AMD: "); + print_processor_signature(info, &cpuInfo, "Extended AMD: "); if ((info->cpu_type & B_CPU_x86_VENDOR_MASK) == B_CPU_AMD_x86 || (info->cpu_type & B_CPU_x86_VENDOR_MASK) == B_CPU_INTEL_x86) {