diff --git a/src/cpu/intel/common/hyperthreading.c b/src/cpu/intel/common/hyperthreading.c index 2936770cc3..3297b381b3 100644 --- a/src/cpu/intel/common/hyperthreading.c +++ b/src/cpu/intel/common/hyperthreading.c @@ -19,24 +19,26 @@ bool intel_ht_sibling(void) { struct cpuid_result result; unsigned int core_ids, apic_ids, threads; + unsigned int max_leaf; if (!intel_ht_supported()) return false; - if (cpuid_eax(0) >= 0xb) { + max_leaf = cpuid_get_max_func(); + if (max_leaf >= 0xb) { result = cpuid_ext(0xb, 0); const uint32_t div = 1 << (result.eax & 0x1f); return result.edx % div > 0; } apic_ids = 1; - if (cpuid_eax(0) >= 1) + if (max_leaf >= 1) apic_ids = (cpuid_ebx(1) >> 16) & 0xff; if (apic_ids == 0) apic_ids = 1; core_ids = 1; - if (cpuid_eax(0) >= 4) { + if (max_leaf >= 4) { result = cpuid_ext(4, 0); core_ids += (result.eax >> 26) & 0x3f; }