diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 3ea32c83b..fd6aea1b4 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -30,8 +30,6 @@ #![feature(trait_upcasting)] #![register_tool(component_access_control)] -use core::sync::atomic::Ordering; - use ostd::{ arch::qemu::{exit_qemu, QemuExitCode}, boot, @@ -79,7 +77,6 @@ pub fn main() { ostd::early_println!("[kernel] OSTD initialized. Preparing components."); component::init_all(component::parse_metadata!()).unwrap(); init(); - ostd::IN_BOOTSTRAP_CONTEXT.store(false, Ordering::Relaxed); // Spawn all AP idle threads. ostd::boot::smp::register_ap_entry(ap_init); diff --git a/ostd/src/lib.rs b/ostd/src/lib.rs index d9cf26a8d..1d8df5a8f 100644 --- a/ostd/src/lib.rs +++ b/ostd/src/lib.rs @@ -46,7 +46,7 @@ pub mod timer; pub mod trap; pub mod user; -use core::sync::atomic::AtomicBool; +use core::sync::atomic::{AtomicBool, Ordering}; pub use ostd_macros::{main, panic_handler}; pub use ostd_pod::Pod; @@ -100,10 +100,12 @@ unsafe fn init() { arch::irq::enable_local(); invoke_ffi_init_funcs(); + + IN_BOOTSTRAP_CONTEXT.store(false, Ordering::Relaxed); } /// Indicates whether the kernel is in bootstrap context. -pub static IN_BOOTSTRAP_CONTEXT: AtomicBool = AtomicBool::new(true); +pub(crate) static IN_BOOTSTRAP_CONTEXT: AtomicBool = AtomicBool::new(true); /// Invoke the initialization functions defined in the FFI. /// The component system uses this function to call the initialization functions of