pagefault_handler print error code before killing thread

This commit is contained in:
Mathieu Maret 2024-02-05 23:44:59 +01:00 committed by Mathieu Maret
parent d9051ea59c
commit 205d174c8a

View File

@ -65,13 +65,15 @@ void pagefault_handler(struct cpu_state *frame, ulong intr)
// PAGE_FAULT is a interrupt with an error code (see exception_wrapper.S) // PAGE_FAULT is a interrupt with an error code (see exception_wrapper.S)
uint32_t error_code = cpu_context_get_EX_err(frame); uint32_t error_code = cpu_context_get_EX_err(frame);
int ret = uAddrSpaceSolvePageFault(as, faultAddr, error_code & 0x2);
if (!uAddrSpaceSolvePageFault(as, faultAddr, error_code & 0x2)) if (!ret){
return; return;
}
printf( printf(
"page fault while in thread [%s] at 0x%p when trying to access 0x%p err_code 0x%x\n", "page fault while in thread [%s] at 0x%p when trying to access 0x%p err_code 0x%x ressource ret %d\n",
current->name, (void *)cpu_context_get_PC(frame), (void *)faultAddr, error_code); current->name, (void *)cpu_context_get_PC(frame), (void *)faultAddr, error_code,
ret);
printf("Killing User Thread\n"); printf("Killing User Thread\n");
threadExit(); threadExit();
return; return;