From 205d174c8ab4254fedd07eb2b5474940982bb974 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Mon, 5 Feb 2024 23:44:59 +0100 Subject: [PATCH] pagefault_handler print error code before killing thread --- arch/x86/exception.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/exception.c b/arch/x86/exception.c index ec8c0ef..a12a211 100644 --- a/arch/x86/exception.c +++ b/arch/x86/exception.c @@ -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) uint32_t error_code = cpu_context_get_EX_err(frame); - - if (!uAddrSpaceSolvePageFault(as, faultAddr, error_code & 0x2)) + int ret = uAddrSpaceSolvePageFault(as, faultAddr, error_code & 0x2); + if (!ret){ return; + } printf( - "page fault while in thread [%s] at 0x%p when trying to access 0x%p err_code 0x%x\n", - current->name, (void *)cpu_context_get_PC(frame), (void *)faultAddr, error_code); + "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, + ret); printf("Killing User Thread\n"); threadExit(); return;