diff --git a/ntoskrnl/ke/amd64/cpu.c b/ntoskrnl/ke/amd64/cpu.c index 24a17d24458..90519e56181 100644 --- a/ntoskrnl/ke/amd64/cpu.c +++ b/ntoskrnl/ke/amd64/cpu.c @@ -667,16 +667,6 @@ KeFlushEntireTb(IN BOOLEAN Invalid, } -KAFFINITY -NTAPI -KeQueryActiveProcessors(VOID) -{ - PAGED_CODE(); - - /* Simply return the number of active processors */ - return KeActiveProcessors; -} - NTSTATUS NTAPI KxSaveFloatingPointState(OUT PKFLOATING_SAVE FloatingState) diff --git a/ntoskrnl/ke/arm/cpu.c b/ntoskrnl/ke/arm/cpu.c index 756b9ab9f1c..f86a9595292 100644 --- a/ntoskrnl/ke/arm/cpu.c +++ b/ntoskrnl/ke/arm/cpu.c @@ -153,21 +153,6 @@ KeSetDmaIoCoherency(IN ULONG Coherency) KiDmaIoCoherency = Coherency; } -/* - * @implemented - */ -KAFFINITY -NTAPI -KeQueryActiveProcessors(VOID) -{ - PAGED_CODE(); - - // - // Simply return the number of active processors - // - return KeActiveProcessors; -} - /* * @implemented */ diff --git a/ntoskrnl/ke/i386/cpu.c b/ntoskrnl/ke/i386/cpu.c index a39d27a2139..598a21d9de1 100644 --- a/ntoskrnl/ke/i386/cpu.c +++ b/ntoskrnl/ke/i386/cpu.c @@ -1649,19 +1649,6 @@ KeSetDmaIoCoherency(IN ULONG Coherency) KiDmaIoCoherency = Coherency; } -/* - * @implemented - */ -KAFFINITY -NTAPI -KeQueryActiveProcessors(VOID) -{ - PAGED_CODE(); - - /* Simply return the number of active processors */ - return KeActiveProcessors; -} - /* * @implemented */ diff --git a/ntoskrnl/ke/krnlinit.c b/ntoskrnl/ke/krnlinit.c index 66299e3d57c..4ffdb0bd104 100644 --- a/ntoskrnl/ke/krnlinit.c +++ b/ntoskrnl/ke/krnlinit.c @@ -20,7 +20,6 @@ USHORT KeProcessorArchitecture; USHORT KeProcessorLevel; USHORT KeProcessorRevision; ULONG KeFeatureBits; -KAFFINITY KeActiveProcessors = 1; /* System call count */ ULONG KiServiceLimit = NUMBER_OF_SYSCALLS; @@ -31,9 +30,6 @@ PLOADER_PARAMETER_BLOCK KeLoaderBlock; /* PRCB Array */ PKPRCB KiProcessorBlock[MAXIMUM_PROCESSORS]; -/* Number of processors */ -CCHAR KeNumberProcessors = 0; - /* NUMA Node Support */ KNODE KiNode0; PKNODE KeNodeBlock[1] = { &KiNode0 }; diff --git a/ntoskrnl/ke/processor.c b/ntoskrnl/ke/processor.c new file mode 100644 index 00000000000..157bd34ab77 --- /dev/null +++ b/ntoskrnl/ke/processor.c @@ -0,0 +1,26 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: MIT (https://spdx.org/licenses/MIT) + * PURPOSE: Portable processor related routines + * COPYRIGHT: Copyright 2025 Timo Kreuzer + */ + +/* INCLUDES ******************************************************************/ + +#include +#define NDEBUG +#include + +/* GLOBALS *******************************************************************/ + +CCHAR KeNumberProcessors = 0; +KAFFINITY KeActiveProcessors = 0; + +/* FUNCTIONS *****************************************************************/ + +KAFFINITY +NTAPI +KeQueryActiveProcessors(VOID) +{ + return KeActiveProcessors; +} diff --git a/ntoskrnl/ntos.cmake b/ntoskrnl/ntos.cmake index 082f61216c5..8fb755fcdcf 100644 --- a/ntoskrnl/ntos.cmake +++ b/ntoskrnl/ntos.cmake @@ -186,6 +186,7 @@ list(APPEND SOURCE ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/ipi.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/krnlinit.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/mutex.c + ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/processor.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/procobj.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/profobj.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/queue.c