From 264c986155287ce68e5afdf3bd8ff7ba7c1814cc Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 14 Sep 2025 17:35:04 -0400 Subject: kern/amd64: cpu: Add routine to get current core Signed-off-by: Ian Moffett --- src/sys/include/sys/cpuvar.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/sys/include') diff --git a/src/sys/include/sys/cpuvar.h b/src/sys/include/sys/cpuvar.h index f208f82..b5ff31b 100644 --- a/src/sys/include/sys/cpuvar.h +++ b/src/sys/include/sys/cpuvar.h @@ -42,12 +42,14 @@ * * @id: Monotonic logical ID * @md: Machine dependent processor information + * @self: Chain pointer to self */ struct pcore { uint32_t id; #if defined(_KERNEL) struct mdcore md; #endif /* _KERNEL */ + struct pcore *self; }; #if defined(_KERNEL) @@ -59,5 +61,13 @@ struct pcore { * @pcore: Core to configure */ void cpu_conf(struct pcore *pcore); + +/* + * Get the current processing element (core) as + * a 'pcore' descriptor. + * + * Returns NULL on failure. + */ +struct pcore *this_core(void); #endif /* _KERNEL */ #endif /* !_SYS_CPUVAR_H_ */ -- cgit v1.2.3