From 295ee614d60e904e4aa0c164090bdef6f9e94aa7 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 19 Nov 2025 17:46:15 -0500 Subject: kern/amd64: cpu: Add cpu_count() function Signed-off-by: Ian Moffett --- sys/arch/amd64/cpu/mp.c | 6 ++++++ sys/inc/mu/cpu.h | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'sys') diff --git a/sys/arch/amd64/cpu/mp.c b/sys/arch/amd64/cpu/mp.c index df4798d..a84648b 100644 --- a/sys/arch/amd64/cpu/mp.c +++ b/sys/arch/amd64/cpu/mp.c @@ -373,6 +373,12 @@ cpu_get(uint32_t index) return cpu_list[index]; } +size_t +cpu_count(void) +{ + return ap_count + 1; +} + void cpu_start_aps(struct cpu_info *ci) { diff --git a/sys/inc/mu/cpu.h b/sys/inc/mu/cpu.h index 05637f5..d123f43 100644 --- a/sys/inc/mu/cpu.h +++ b/sys/inc/mu/cpu.h @@ -55,6 +55,11 @@ struct cpu_info *cpu_self(void); */ struct cpu_info *cpu_get(uint32_t index); +/* + * Get the number of processors + */ +size_t cpu_count(void); + /* * Configure a processor core */ -- cgit v1.2.3