From cf156adc4a0066751536c9d1a5eeef463c314eac Mon Sep 17 00:00:00 2001 From: Sam Demeulemeester Date: Sat, 23 Jul 2022 23:47:06 +0200 Subject: [PATCH] Solve an issue with Core 2 Duo/Quad and same gen CPUs, where HTT flag is enabled in CPUID while the CPU does not support SMT. (#125 #129) Now compare the number of physical core with the number of reserved APIC to check if SMT is really available or not --- system/cpuid.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/cpuid.c b/system/cpuid.c index 0466993..58aa72b 100644 --- a/system/cpuid.c +++ b/system/cpuid.c @@ -215,7 +215,11 @@ void cpuid_init(void) cpuid_info.topology.thread_count = cpuid_info.topology.core_count; if (cpuid_info.flags.htt){ - cpuid_info.topology.thread_count *= 2; + if (((cpuid_info.proc_info.raw >> 16) & 0xFF) > (uint32_t)cpuid_info.topology.core_count) { + cpuid_info.topology.thread_count *= 2; + } else { + cpuid_info.flags.htt = !cpuid_info.flags.htt; + } } } else if (cpuid_info.max_cpuid >= 0x2) { if(cpuid_info.flags.htt){