diff options
author | Andrew Waterman <andrew@sifive.com> | 2021-05-18 18:33:26 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2021-05-18 18:33:26 -0700 |
commit | 09521e8550750172e7f137d1ed2845c95eefc0b6 (patch) | |
tree | 46bce4a42fd15238769d3d200609645f5948780c /pk/handlers.c | |
parent | e8e6b3aaee44d43b48164fbd377864c3a682dbd3 (diff) | |
download | pk-09521e8550750172e7f137d1ed2845c95eefc0b6.zip pk-09521e8550750172e7f137d1ed2845c95eefc0b6.tar.gz pk-09521e8550750172e7f137d1ed2845c95eefc0b6.tar.bz2 |
Add 2-stage translation (for debugging purposes only)remap
Diffstat (limited to 'pk/handlers.c')
-rw-r--r-- | pk/handlers.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pk/handlers.c b/pk/handlers.c index 4b4abaf..0a7fd23 100644 --- a/pk/handlers.c +++ b/pk/handlers.c @@ -78,6 +78,12 @@ static void handle_fault_store(trapframe_t* tf) segfault(tf, tf->badvaddr, "store"); } +static void handle_guest_fault(trapframe_t* tf) +{ + if (handle_guest_page_fault(tf->badvaddr) != 0) + panic("Unexpected guest fault @ %p!\n", tf->badvaddr); +} + static void handle_syscall(trapframe_t* tf) { tf->gpr[10] = do_syscall(tf->gpr[10], tf->gpr[11], tf->gpr[12], tf->gpr[13], @@ -110,6 +116,9 @@ void handle_trap(trapframe_t* tf) [CAUSE_MISALIGNED_STORE] = handle_misaligned_store, [CAUSE_LOAD_PAGE_FAULT] = handle_fault_load, [CAUSE_STORE_PAGE_FAULT] = handle_fault_store, + [CAUSE_FETCH_GUEST_PAGE_FAULT] = handle_guest_fault, + [CAUSE_LOAD_GUEST_PAGE_FAULT] = handle_guest_fault, + [CAUSE_STORE_GUEST_PAGE_FAULT] = handle_guest_fault, }; kassert(tf->cause < ARRAY_SIZE(trap_handlers) && trap_handlers[tf->cause]); |