From e6f471fb01a3f49660840ed9801fd30057c3f2ec Mon Sep 17 00:00:00 2001 From: sigsegv7 Date: Wed, 4 Oct 2023 19:28:31 -0400 Subject: kernel/amd64: Add spinlock to cpu_info Signed-off-by: sigsegv7 --- sys/include/arch/amd64/cpu.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sys/include/arch') diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h index b63d6e9..dfc4054 100644 --- a/sys/include/arch/amd64/cpu.h +++ b/sys/include/arch/amd64/cpu.h @@ -31,14 +31,25 @@ #define _AMD64_CPU_H_ #include +#include #define this_cpu() amd64_this_cpu() #define get_bsp() amd64_get_bsp() +#define CPU_INFO_LOCK(info) spinlock_acquire(&(info->lock)) +#define CPU_INFO_UNLOCK(info) spinlock_release(&(info->lock)) +/* + * Info about a specific processor. + * + * XXX: Spinlock must be acquired outside of this module! + * None of these module's internal functions should + * acquire the spinlock themselves! + */ struct cpu_info { void *pmap; /* Current pmap */ uint32_t lapic_id; volatile size_t lapic_tmr_freq; + struct spinlock lock; }; struct cpu_info *amd64_this_cpu(void); -- cgit v1.2.3