Finish bootstrap once finishing the initialization of OSTD

This commit is contained in:
Chen Chengjun
2024-10-29 10:49:19 +08:00
committed by Tate, Hongliang Tian
parent 878f3f3760
commit b17cbb2408
2 changed files with 4 additions and 5 deletions

View File

@ -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);

View File

@ -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