| 46 | } |
| 47 | |
| 48 | auto Interrupt::Do(uint64_t cause, cpu_io::TrapContext* context) -> void { |
| 49 | auto interrupt = cpu_io::Scause::Interrupt::Get(cause); |
| 50 | auto exception_code = cpu_io::Scause::ExceptionCode::Get(cause); |
| 51 | |
| 52 | if (interrupt) { |
| 53 | // 中断 |
| 54 | if (exception_code < cpu_io::ScauseInfo::kInterruptMaxCount) { |
| 55 | interrupt_handlers_[exception_code](exception_code, context); |
| 56 | } |
| 57 | } else { |
| 58 | // 异常 |
| 59 | if (exception_code < cpu_io::ScauseInfo::kExceptionMaxCount) { |
| 60 | exception_handlers_[exception_code](exception_code, context); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | auto Interrupt::RegisterInterruptFunc(uint64_t cause, InterruptDelegate func) |
| 66 | -> void { |
no outgoing calls
no test coverage detected