Fix a bug of time int handler
//! Interrupts management.
-
+use alloc::format;
+use crate::drivers;
use riscv::{asm, register::sstatus};
hal_fn_impl! {
@@ -17,7 +18,10 @@ hal_fn_impl! {
fn handle_irq(cause: usize) {
trace!("Handle irq cause: {}", cause);
- crate::drivers::all_irq().first_unwrap().handle_irq(cause)
+ let irq = drivers::all_irq()
+ .find(format!("riscv-intc-cpu{}", crate::cpu::cpu_id()).as_str())
+ .expect("IRQ device 'riscv-intc' not initialized!");
+ irq.handle_irq(cause)
}
fn intr_on() {
