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. :^)
This commit is contained in:
Andreas Kling 2022-11-18 22:07:07 +01:00
parent 9b3db63e14
commit 94b514b981
2 changed files with 5 additions and 1 deletions

View file

@ -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)];

View file

@ -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;