handle.rs 679 B

123456789101112131415161718192021222324252627
  1. use alloc::sync::Arc;
  2. use crate::arch::CurrentIrqArch;
  3. use super::{
  4. irqdesc::{IrqDesc, IrqFlowHandler},
  5. InterruptArch,
  6. };
  7. /// 获取用于处理错误的中断的处理程序
  8. #[inline(always)]
  9. pub fn bad_irq_handler() -> &'static dyn IrqFlowHandler {
  10. &HandleBadIrq
  11. }
  12. /// handle spurious and unhandled irqs
  13. #[derive(Debug)]
  14. struct HandleBadIrq;
  15. impl IrqFlowHandler for HandleBadIrq {
  16. /// 参考: https://code.dragonos.org.cn/xref/linux-6.1.9/kernel/irq/handle.c?fi=handle_bad_irq#33
  17. fn handle(&self, irq_desc: &Arc<IrqDesc>) {
  18. // todo: print_irq_desc
  19. // todo: 增加kstat计数
  20. CurrentIrqArch::ack_bad_irq(irq_desc.irq());
  21. }
  22. }