| 34 | } // namespace |
| 35 | |
| 36 | Interrupt::Interrupt() { |
| 37 | // 注册默认中断处理函数 |
| 38 | for (auto& i : interrupt_handlers_) { |
| 39 | i = InterruptDelegate::create<DefaultInterruptHandler>(); |
| 40 | } |
| 41 | // 注册默认异常处理函数 |
| 42 | for (auto& i : exception_handlers_) { |
| 43 | i = InterruptDelegate::create<DefaultExceptionHandler>(); |
| 44 | } |
| 45 | klog::Info("Interrupt init."); |
| 46 | } |
| 47 | |
| 48 | auto Interrupt::Do(uint64_t cause, cpu_io::TrapContext* context) -> void { |
| 49 | auto interrupt = cpu_io::Scause::Interrupt::Get(cause); |