reactos/ntoskrnl/ke/processor.c
Hermès Bélusca-Maïto 3022d74beb
[NTOS:EX/KE][HALX86] Add support for NUMPROC, BOOTPROC, MAXPROC, ONECPU boot switches (#6024)
These SMP-specific switches allow to test and control configurations
with various number of CPUs on multiprocessor systems.

- NUMPROC: maximum number of logical processors that can be started
  (including dynamically, not currently supported by ReactOS) at run-time.

- BOOTPROC: maximum number of logical processors that can be started at
  boot-time.

- MAXPROC: forces the OS to report the maximum possible number of CPUs
  as existing on the system.

- ONECPU (MP HAL-only boot switch): causes the HAL to only use one
  (the boot) CPU on a multiprocessor system. Attempting to start other
  processors will fail.

For more information, see:
https://www.geoffchappell.com/notes/windows/boot/bcd/osloader/numproc.htm
https://www.geoffchappell.com/notes/windows/license/processors.htm
https://rmscrypt.wordpress.com/2011/02/
https://codeinsecurity.wordpress.com/2022/04/07/cpu-socket-and-core-count-limits-in-windows-10-and-how-to-remove-them/

Generic references about BOOT.INI switches:
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/boot-options-in-a-boot-ini-file
https://www.itprotoday.com/cloud-computing/what-switches-can-be-used-bootini
http://franck.kiechel.free.fr/dbr_eng/BootIni.htm

References about BCD options:
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/bcdedit--set
http://www.mistyprojects.co.uk/documents/BCDEdit/files/commands.6.1.7601.htm#TYPES%20OSLOADER
2025-04-04 12:51:49 +02:00

44 lines
1.2 KiB
C

/*
* PROJECT: ReactOS Kernel
* LICENSE: MIT (https://spdx.org/licenses/MIT)
* PURPOSE: Portable processor related routines
* COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
KAFFINITY KeActiveProcessors = 0;
/* Number of processors */
CCHAR KeNumberProcessors = 0;
#ifdef CONFIG_SMP
/* Theoretical maximum number of processors that can be handled.
* Set once at run-time. Returned by KeQueryMaximumProcessorCount(). */
ULONG KeMaximumProcessors = MAXIMUM_PROCESSORS;
/* Maximum number of logical processors that can be started
* (including dynamically) at run-time. If 0: do not perform checks. */
ULONG KeNumprocSpecified = 0;
/* Maximum number of logical processors that can be started
* at boot-time. If 0: do not perform checks. */
ULONG KeBootprocSpecified = 0;
#endif // CONFIG_SMP
/* FUNCTIONS *****************************************************************/
KAFFINITY
NTAPI
KeQueryActiveProcessors(VOID)
{
return KeActiveProcessors;
}