From 460202d500d26f00e9d65c7eaf73a110bded9347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Sun, 20 Oct 2024 15:57:22 +0200 Subject: [PATCH] fix(entry): only set boot info globals on first CPU core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- src/arch/aarch64/kernel/start.rs | 9 ++++----- src/arch/x86_64/kernel/mod.rs | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/arch/aarch64/kernel/start.rs b/src/arch/aarch64/kernel/start.rs index f6cdf3e469..bb60ed9742 100644 --- a/src/arch/aarch64/kernel/start.rs +++ b/src/arch/aarch64/kernel/start.rs @@ -45,11 +45,6 @@ pub unsafe extern "C" fn _start(boot_info: &'static RawBootInfo, cpu_id: u32) -> #[inline(never)] #[no_mangle] unsafe extern "C" fn pre_init(boot_info: &'static RawBootInfo, cpu_id: u32) -> ! { - unsafe { - RAW_BOOT_INFO = Some(boot_info); - BOOT_INFO = Some(BootInfo::from(*boot_info)); - } - // set exception table unsafe { asm!( @@ -66,6 +61,10 @@ unsafe extern "C" fn pre_init(boot_info: &'static RawBootInfo, cpu_id: u32) -> ! } if cpu_id == 0 { + unsafe { + RAW_BOOT_INFO = Some(boot_info); + BOOT_INFO = Some(BootInfo::from(*boot_info)); + } crate::boot_processor_main() } else { #[cfg(not(feature = "smp"))] diff --git a/src/arch/x86_64/kernel/mod.rs b/src/arch/x86_64/kernel/mod.rs index cbad9cf04b..7ee65fb804 100644 --- a/src/arch/x86_64/kernel/mod.rs +++ b/src/arch/x86_64/kernel/mod.rs @@ -261,12 +261,12 @@ unsafe extern "C" fn pre_init(boot_info: &'static RawBootInfo, cpu_id: u32) -> ! cr0_write(cr0); } - unsafe { - RAW_BOOT_INFO = Some(boot_info); - BOOT_INFO = Some(BootInfo::from(*boot_info)); - } - if cpu_id == 0 { + unsafe { + RAW_BOOT_INFO = Some(boot_info); + BOOT_INFO = Some(BootInfo::from(*boot_info)); + } + crate::boot_processor_main() } else { #[cfg(not(feature = "smp"))]