| 51 | } |
| 52 | |
| 53 | auto PageFaultHandler(uint64_t exception_code, cpu_io::TrapContext* context) |
| 54 | -> uint64_t { |
| 55 | auto addr = cpu_io::Stval::Read(); |
| 56 | klog::Err("PageFault: {}({:#x}), addr: {:#x}", |
| 57 | cpu_io::ScauseInfo::kExceptionNames[exception_code], exception_code, |
| 58 | addr); |
| 59 | klog::Err("sepc: {:#x}", context->sepc); |
| 60 | DumpStack(); |
| 61 | while (true) { |
| 62 | cpu_io::Pause(); |
| 63 | } |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | // 系统调用处理 |
| 68 | auto SyscallHandler(uint64_t /*cause*/, cpu_io::TrapContext* context) |