From 94b514b981ff47092345f81dfb562ed98d83b91a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 18 Nov 2022 22:07:07 +0100 Subject: [PATCH] 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. :^) --- Kernel/Arch/aarch64/Processor.h | 2 ++ Kernel/Arch/x86/Processor.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) 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(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; + +constexpr size_t MAX_CPU_COUNT = 64; +using ProcessorContainer = Array; class Processor { friend class ProcessorInfo;