mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-29 04:13:24 +00:00
Fix SoftIRQ initialization requirements for SMP
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
d499c1592d
commit
aeba7bec52
@ -15,7 +15,6 @@ use crate::{
|
||||
page::{self, meta::KernelMeta, ContPages},
|
||||
PAGE_SIZE,
|
||||
},
|
||||
trap,
|
||||
};
|
||||
|
||||
pub(crate) static AP_BOOT_INFO: Once<ApBootInfo> = Once::new();
|
||||
@ -120,7 +119,10 @@ fn ap_early_entry(local_apic_id: u32) -> ! {
|
||||
cpu::set_this_cpu_id(local_apic_id);
|
||||
}
|
||||
|
||||
trap::init();
|
||||
// SAFETY: this function is only called once on this AP.
|
||||
unsafe {
|
||||
trapframe::init();
|
||||
}
|
||||
crate::arch::irq::enable_local();
|
||||
|
||||
// Mark the AP as started.
|
||||
|
@ -86,7 +86,9 @@ pub unsafe fn init() {
|
||||
mm::kspace::init_kernel_page_table(mm::init_page_meta());
|
||||
mm::misc_init();
|
||||
|
||||
trap::init();
|
||||
trapframe::init();
|
||||
// SAFETY: This function is called only once in the entire system.
|
||||
unsafe { trap::softirq::init() };
|
||||
arch::init_on_bsp();
|
||||
|
||||
bus::init();
|
||||
|
@ -12,10 +12,3 @@ pub use trapframe::TrapFrame;
|
||||
|
||||
pub(crate) use self::handler::call_irq_callback_functions;
|
||||
pub use self::irq::{disable_local, DisabledLocalIrqGuard, IrqCallbackFunction, IrqLine};
|
||||
|
||||
pub(crate) fn init() {
|
||||
unsafe {
|
||||
trapframe::init();
|
||||
}
|
||||
softirq::init();
|
||||
}
|
||||
|
@ -95,9 +95,14 @@ impl SoftIrqLine {
|
||||
/// A slice that stores the [`SoftIrqLine`]s, whose ID is equal to its offset in the slice.
|
||||
static LINES: Once<[SoftIrqLine; SoftIrqLine::NR_LINES as usize]> = Once::new();
|
||||
|
||||
pub(super) fn init() {
|
||||
/// Initializes the softirq lines.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function must be called only once.
|
||||
pub unsafe fn init() {
|
||||
let lines: [SoftIrqLine; SoftIrqLine::NR_LINES as usize] =
|
||||
array_init::array_init(|i| SoftIrqLine::new(i as u8));
|
||||
core::array::from_fn(|i| SoftIrqLine::new(i as u8));
|
||||
LINES.call_once(|| lines);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user