Enable IRQs before leaving the OSTD boot routine

This commit is contained in:
Zhang Junyang
2024-08-12 13:01:01 +00:00
committed by Tate, Hongliang Tian
parent 20d5212910
commit 491e4325fa
7 changed files with 42 additions and 55 deletions

View File

@ -119,6 +119,7 @@ fn ap_early_entry(local_apic_id: u32) -> ! {
}
trap::init();
crate::arch::irq::enable_local();
// Mark the AP as started.
let ap_boot_info = AP_BOOT_INFO.get().unwrap();

View File

@ -86,6 +86,8 @@ pub fn init() {
mm::kspace::activate_kernel_page_table();
arch::irq::enable_local();
invoke_ffi_init_funcs();
}

View File

@ -172,18 +172,3 @@ impl Drop for DisabledLocalIrqGuard {
}
}
}
/// Enables all IRQs on the current CPU.
///
/// FIXME: The reason we need to add this API is that currently IRQs
/// are enabled when the CPU enters the user space for the first time,
/// which is too late. During the OS initialization phase,
/// we need to get the block device working and mount the filesystems,
/// thus requiring the IRQs should be enabled as early as possible.
///
/// FIXME: this method may be unsound.
pub fn enable_local() {
if !crate::arch::irq::is_local_enabled() {
crate::arch::irq::enable_local();
}
}

View File

@ -11,9 +11,7 @@ pub use softirq::SoftIrqLine;
pub use trapframe::TrapFrame;
pub(crate) use self::handler::call_irq_callback_functions;
pub use self::irq::{
disable_local, enable_local, DisabledLocalIrqGuard, IrqCallbackFunction, IrqLine,
};
pub use self::irq::{disable_local, DisabledLocalIrqGuard, IrqCallbackFunction, IrqLine};
pub(crate) fn init() {
unsafe {