update ch4:add some exception support in trap_handler function, add two *_fault.rs apps

This commit is contained in:
Yu Chen 2022-03-11 19:11:40 +08:00
parent 3731e84460
commit 90cf5659aa
3 changed files with 38 additions and 1 deletions

View file

@ -48,7 +48,8 @@ pub fn trap_handler() -> ! {
cx.sepc += 4;
cx.x[10] = syscall(cx.x[17], [cx.x[10], cx.x[11], cx.x[12]]) as usize;
}
Trap::Exception(Exception::StoreFault) | Trap::Exception(Exception::StorePageFault) => {
Trap::Exception(Exception::StoreFault) | Trap::Exception(Exception::StorePageFault) |
Trap::Exception(Exception::LoadFault) | Trap::Exception(Exception::LoadPageFault) => {
println!("[kernel] PageFault in application, bad addr = {:#x}, bad instruction = {:#x}, kernel killed it.", stval, cx.sepc);
exit_current_and_run_next();
}