From 5dbeca342145cfc8e1ad852291dea44dd58f1d1d Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 30 Mar 2026 08:57:42 +0200 Subject: [FEAT] boot: Add `prop/smp_max` property in BootZ. brief: The feature introduces how many cores are allowed to be used by NeKernel. Signed-off-by: Amlal El Mahrouss --- src/boot/src/HEL/AMD64/BootEFI.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/boot/src/HEL/AMD64/BootEFI.cpp b/src/boot/src/HEL/AMD64/BootEFI.cpp index d552e325..d3492843 100644 --- a/src/boot/src/HEL/AMD64/BootEFI.cpp +++ b/src/boot/src/HEL/AMD64/BootEFI.cpp @@ -217,6 +217,17 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa ST->RuntimeServices->GetVariable(L"/props/kern_ver", kEfiGlobalNamespaceVarGUID, nullptr, &sz_ver, &ver); + UInt32 sz_smp_max = sizeof(UInt64); + UInt64 smp_max = 0; + + ST->RuntimeServices->GetVariable(L"/props/smp_max", kEfiGlobalNamespaceVarGUID, nullptr, + &sz_smp_max, &smp_max); + + /// This variable makes sure we enable the core we want to actually use. + if (smp_max > 0 && smp_max < kHandoverHeader->f_NumberOfProcessors) { + kHandoverHeader->f_NumberOfProcessors = smp_max; + } + if (ver < KERNEL_VERSION_BCD) { ver = KERNEL_VERSION_BCD; -- cgit v1.2.3