ReactOS 0.4.17-dev-470-gf9e3448
processor.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Portable processor related routines
5 * COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
6 */
7
8/* INCLUDES ******************************************************************/
9
10#include <ntoskrnl.h>
11#define NDEBUG
12#include <debug.h>
13
14/* GLOBALS *******************************************************************/
15
17
18/* Number of processors */
20
21#ifdef CONFIG_SMP
22
23/* Theoretical maximum number of processors that can be handled.
24 * Set once at run-time. Returned by KeQueryMaximumProcessorCount(). */
25ULONG KeMaximumProcessors = MAXIMUM_PROCESSORS;
26
27/* Maximum number of logical processors that can be started
28 * (including dynamically) at run-time. If 0: do not perform checks. */
29ULONG KeNumprocSpecified = 0;
30
31/* Maximum number of logical processors that can be started
32 * at boot-time. If 0: do not perform checks. */
33ULONG KeBootprocSpecified = 0;
34
35#endif // CONFIG_SMP
36
37/* FUNCTIONS *****************************************************************/
38
42{
43 return KeActiveProcessors;
44}
45
56 _Out_ PPROCESSOR_NUMBER ProcessorNumber)
57{
59 {
60 ProbeForWrite(ProcessorNumber, sizeof(PROCESSOR_NUMBER), __alignof(PROCESSOR_NUMBER));
61 ProcessorNumber->Group = 0; // TODO: Support processor groups
62 ProcessorNumber->Number = (UCHAR)KeGetCurrentProcessorNumber();
63 ProcessorNumber->Reserved = 0;
64 }
66 {
68 }
70
71 return STATUS_SUCCESS;
72}
LONG NTSTATUS
Definition: precomp.h:26
ULONG_PTR KAFFINITY
Definition: compat.h:85
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define MAXIMUM_PROCESSORS
Definition: rwlock.h:5
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define _Out_
Definition: no_sal2.h:160
* PPROCESSOR_NUMBER
Definition: ntbasedef.h:654
PROCESSOR_NUMBER
Definition: ntbasedef.h:654
CCHAR KeNumberProcessors
Definition: processor.c:19
NTSTATUS NTAPI NtGetCurrentProcessorNumberEx(_Out_ PPROCESSOR_NUMBER ProcessorNumber)
Definition: processor.c:55
KAFFINITY KeActiveProcessors
Definition: processor.c:16
KAFFINITY NTAPI KeQueryActiveProcessors(VOID)
Definition: processor.c:41
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:341
#define STATUS_SUCCESS
Definition: shellext.h:65
unsigned char UCHAR
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG
Definition: typedefs.h:59
char CCHAR
Definition: typedefs.h:51