From d098b398c22fab4936d2237cc64ded888c3bf7ee Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 22 Feb 2024 22:34:51 -0500 Subject: kernel/amd64: machdep: Isolate BSP-only calls Some routines are to be called on the BSP only during processor startup, this commit isolates them for the BSP onto in pre_init() Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/machdep.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'sys') diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 6d8648d..4efae64 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -105,21 +105,29 @@ chips_init(void) } /* - * Things set up before processor_init() call... + * These are critical things that need to be set up as soon as possible + * way before the processor_init() call. */ void pre_init(void) { + struct cpu_info *ci; + static bool is_bsp = true; + /* - * These are critical things that need to be set up as soon as possible - * way before the processor_init() call. + * Certain things like serial ports, virtual memory, + * etc, need to be set up only once! These things + * are to be done on the BSP only... */ - uart8250_try_init(); + if (is_bsp) { + is_bsp = false; + + uart8250_try_init(); + vm_physseg_init(); + vm_init(); + } interrupts_init(); gdt_load(&g_gdtr); - - vm_physseg_init(); - vm_init(); } void -- cgit v1.2.3