mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 08:53:29 +00:00
Make CPU-local and early ACPI initialization heap-less
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
7496b24da1
commit
92bc8cbbf7
@ -47,7 +47,7 @@ mod util;
|
||||
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
pub use ostd_macros::{main, panic_handler};
|
||||
pub use ostd_macros::{global_frame_allocator, main, panic_handler};
|
||||
pub use ostd_pod::Pod;
|
||||
|
||||
pub use self::{error::Error, prelude::Result};
|
||||
@ -74,19 +74,33 @@ unsafe fn init() {
|
||||
|
||||
logger::init();
|
||||
|
||||
// SAFETY: This function is called only once and only on the BSP.
|
||||
unsafe { cpu::local::early_init_bsp_local_base() };
|
||||
// SAFETY: They are only called once on BSP and ACPI has been initialized.
|
||||
// No CPU local objects have been accessed by this far.
|
||||
unsafe {
|
||||
cpu::init_num_cpus();
|
||||
cpu::local::init_on_bsp();
|
||||
cpu::set_this_cpu_id(0);
|
||||
}
|
||||
|
||||
// SAFETY: We are on the BSP and APs are not yet started.
|
||||
let meta_pages = unsafe { mm::frame::meta::init() };
|
||||
// The frame allocator should be initialized immediately after the metadata
|
||||
// is initialized. Otherwise the boot page table can't allocate frames.
|
||||
// SAFETY: This function is called only once.
|
||||
unsafe { mm::frame::allocator::init() };
|
||||
|
||||
mm::kspace::init_kernel_page_table(meta_pages);
|
||||
|
||||
// SAFETY: This function is called only once and only on the BSP.
|
||||
unsafe { mm::heap_allocator::init() };
|
||||
|
||||
crate::sync::init();
|
||||
|
||||
boot::init_after_heap();
|
||||
|
||||
mm::frame::allocator::init();
|
||||
mm::kspace::init_kernel_page_table(mm::init_page_meta());
|
||||
mm::dma::init();
|
||||
|
||||
arch::init_on_bsp();
|
||||
unsafe { arch::late_init_on_bsp() };
|
||||
|
||||
smp::init();
|
||||
|
||||
|
Reference in New Issue
Block a user