MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / Do

Method Do

src/arch/riscv64/interrupt.cpp:48–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48auto 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
65auto Interrupt::RegisterInterruptFunc(uint64_t cause, InterruptDelegate func)
66 -> void {

Callers 2

ExternalInterruptHandlerFunction · 0.45
HandleTrapFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected