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

Function EbreakHandler

src/arch/riscv64/interrupt_main.cpp:36–51  ·  view source on GitHub ↗

ebreak 中断处理

Source from the content-addressed store, hash-verified

34
35// ebreak 中断处理
36auto EbreakHandler(uint64_t exception_code, cpu_io::TrapContext* context)
37 -> uint64_t {
38 // 读取 sepc 处的指令
39 auto instruction = *reinterpret_cast<uint8_t*>(context->sepc);
40
41 // 判断是否为压缩指令 (低 2 位不为 11)
42 if ((instruction & 0x3) != 0x3) {
43 // 2 字节指令
44 context->sepc += 2;
45 } else {
46 // 4 字节指令
47 context->sepc += 4;
48 }
49 klog::Info("Handle {}", cpu_io::ScauseInfo::kExceptionNames[exception_code]);
50 return 0;
51}
52
53auto PageFaultHandler(uint64_t exception_code, cpu_io::TrapContext* context)
54 -> uint64_t {

Callers

nothing calls this directly

Calls 1

InfoFunction · 0.85

Tested by

no test coverage detected