chore: kernel: trap: print trace when page fault happens

This commit is contained in:
Paul Pan 2024-06-17 00:47:40 +08:00
parent d69e95721c
commit 0300ac3c5d
2 changed files with 8 additions and 0 deletions

View File

@ -16,5 +16,9 @@
"**/.rustup/**": true,
"**/.cargo/registry/**": true,
"**/.cargo/git/**": true,
},
"[riscv]": {
"editor.indentSize": "tabSize",
"editor.tabSize": 8
}
}

View File

@ -93,6 +93,10 @@ impl TrapContextOps for TrapContext {
if from_kernel {
panic_fatal!("Page Fault in Kernel");
}
let stval = riscv::register::stval::read();
trace!("Page Fault: sepc: {:#x}, stval: {:#x}", self.sepc, stval);
// TODO: handle page fault
},
_ => panic_fatal!("Unhandled Trap"),