From a1d3154381e1bfdbca59bcdf9d4d719b0316fcda Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 11 Dec 2023 14:28:32 -0500 Subject: kernel/amd64: Update arch(9) This commit cleans up arch(9) as a few things were noticed. First, it would make sense to identify cores (described by the cpu_info structure) in every arch ported, thus the lapic_id has been changed to id so it can be shared. Some annotations have also been added for the sake of clarity. The manpage for arch(9) has also been cleaned up. Signed-off-by: Ian Moffett --- sys/arch/amd64/lapic.c | 4 ++-- sys/include/arch/amd64/cpu.h | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'sys') diff --git a/sys/arch/amd64/lapic.c b/sys/arch/amd64/lapic.c index 1ea80c4..8058e3f 100644 --- a/sys/arch/amd64/lapic.c +++ b/sys/arch/amd64/lapic.c @@ -285,8 +285,8 @@ lapic_init(void) cur_cpu->lapic_tmr_freq = tmr_freq; /* Set the Local APIC ID */ - cur_cpu->lapic_id = lapic_get_id(); + cur_cpu->id = lapic_get_id(); - BSP_KINFO("BSP Local APIC ID: %d\n", cur_cpu->lapic_id); + BSP_KINFO("BSP Local APIC ID: %d\n", cur_cpu->id); CPU_INFO_UNLOCK(cur_cpu); } diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h index 59d1dcd..e93e8a2 100644 --- a/sys/include/arch/amd64/cpu.h +++ b/sys/include/arch/amd64/cpu.h @@ -46,10 +46,13 @@ * acquire the spinlock themselves! */ struct cpu_info { + /* Per-arch fields */ void *pmap; /* Current pmap */ - uint32_t lapic_id; - volatile size_t lapic_tmr_freq; + uint32_t id; struct spinlock lock; + + /* AMD64 */ + volatile size_t lapic_tmr_freq; }; struct cpu_info *amd64_this_cpu(void); -- cgit v1.2.3