From fafeda52eacdec6babbb789ad214a91d6387d38e Mon Sep 17 00:00:00 2001 From: Pawel Dziepak Date: Wed, 2 Oct 2013 01:49:10 +0200 Subject: [PATCH] x86[_64]: Do not return too soon from detectCPUTopology() --- src/system/kernel/arch/x86/arch_cpu.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/system/kernel/arch/x86/arch_cpu.cpp b/src/system/kernel/arch/x86/arch_cpu.cpp index 23b6979634..7b7992d31d 100644 --- a/src/system/kernel/arch/x86/arch_cpu.cpp +++ b/src/system/kernel/arch/x86/arch_cpu.cpp @@ -610,7 +610,7 @@ getIntelCPULegacyInitialAPICID(int currentCPU) } -static inline void +static inline status_t detectIntelCPUTopologyLegacy(int maxBasicLeaf) { getCPUTopologyID = getIntelCPULegacyInitialAPICID; @@ -640,6 +640,8 @@ detectIntelCPUTopologyLegacy(int maxBasicLeaf) | sHierarchyMask[CPU_TOPOLOGY_CORE]; sHierarchyMask[CPU_TOPOLOGY_PACKAGE] = ~kSinglePackageMask; sHierarchyShift[CPU_TOPOLOGY_PACKAGE] = countSetBits(kSinglePackageMask); + + return B_OK; } @@ -662,23 +664,25 @@ static void detectCPUTopology(int currentCPU, cpu_ent* cpu, int maxBasicLeaf) { if (currentCPU == 0) { + status_t result = B_UNSUPPORTED; if (x86_check_feature(IA32_FEATURE_HTT, FEATURE_COMMON)) { if (cpu->arch.vendor == VENDOR_INTEL) { - status_t result = detectIntelCPUTopologyx2APIC(maxBasicLeaf); + result = detectIntelCPUTopologyx2APIC(maxBasicLeaf); if (result != B_OK) - detectIntelCPUTopologyLegacy(maxBasicLeaf); - return; + result = detectIntelCPUTopologyLegacy(maxBasicLeaf); } } - dprintf("No CPU topology information available.\n"); + if (result != B_OK) { + dprintf("No CPU topology information available.\n"); - getCPUTopologyID = getSimpleCPUTopologyID; + getCPUTopologyID = getSimpleCPUTopologyID; - memset(sHierarchyMask, 0, sizeof(sHierarchyMask)); - sHierarchyMask[CPU_TOPOLOGY_PACKAGE] = ~uint32(0); + memset(sHierarchyMask, 0, sizeof(sHierarchyMask)); + sHierarchyMask[CPU_TOPOLOGY_PACKAGE] = ~uint32(0); - memset(sHierarchyShift, 0, sizeof(sHierarchyShift)); + memset(sHierarchyShift, 0, sizeof(sHierarchyShift)); + } } ASSERT(getCPUTopologyID != NULL);