summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-11-18 22:07:07 +0100
committerAndreas Kling <kling@serenityos.org>2022-11-19 15:39:30 +0100
commit94b514b981ff47092345f81dfb562ed98d83b91a (patch)
tree65b19568bdb29aed6dffa212639102af24d35f5a
parent9b3db63e142ebbd26281a9e7173af3821c3fad19 (diff)
downloadserenity-94b514b981ff47092345f81dfb562ed98d83b91a.zip
Kernel: Add MAX_CPU_COUNT global constant
Instead of just hard-coding the x86 Processor array to size 64, we now use a named constant that you can also reference elsewhere. :^)
-rw-r--r--Kernel/Arch/aarch64/Processor.h2
-rw-r--r--Kernel/Arch/x86/Processor.h4
2 files changed, 5 insertions, 1 deletions
diff --git a/Kernel/Arch/aarch64/Processor.h b/Kernel/Arch/aarch64/Processor.h
index 5a3d974a6e..1974798bfd 100644
--- a/Kernel/Arch/aarch64/Processor.h
+++ b/Kernel/Arch/aarch64/Processor.h
@@ -35,6 +35,8 @@ struct [[gnu::aligned(16)]] FPUState
// FIXME: Remove this once we support SMP in aarch64
extern Processor* g_current_processor;
+constexpr size_t MAX_CPU_COUNT = 1;
+
class Processor {
void* m_processor_specific_data[static_cast<size_t>(ProcessorSpecificDataID::__Count)];
diff --git a/Kernel/Arch/x86/Processor.h b/Kernel/Arch/x86/Processor.h
index 64209ffbad..e2c7db936e 100644
--- a/Kernel/Arch/x86/Processor.h
+++ b/Kernel/Arch/x86/Processor.h
@@ -61,7 +61,9 @@ struct [[gnu::aligned(64), gnu::packed]] FPUState
class Processor;
// Note: We only support 64 processors at most at the moment,
// so allocate 64 slots of inline capacity in the container.
-using ProcessorContainer = Array<Processor*, 64>;
+
+constexpr size_t MAX_CPU_COUNT = 64;
+using ProcessorContainer = Array<Processor*, MAX_CPU_COUNT>;
class Processor {
friend class ProcessorInfo;