From 0a79c17307d633bb6970502e1d2569879c132848 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 10 May 2021 11:34:14 -0600 Subject: [PATCH] Show meaning of CODE on page fault --- src/arch/x86_64/interrupt/exception.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/arch/x86_64/interrupt/exception.rs b/src/arch/x86_64/interrupt/exception.rs index 621379f..48c0353 100644 --- a/src/arch/x86_64/interrupt/exception.rs +++ b/src/arch/x86_64/interrupt/exception.rs @@ -134,6 +134,11 @@ interrupt_error!(page, |stack| { let cr2: usize; asm!("mov {}, cr2", out(reg) cr2); println!("Page fault: {:>016X}", cr2); + println!(" Present: {}", stack.code & 1 << 0 != 0); + println!(" Write: {}", stack.code & 1 << 1 != 0); + println!(" User: {}", stack.code & 1 << 2 != 0); + println!(" Reserved write: {}", stack.code & 1 << 3 != 0); + println!(" Instruction fetch: {}", stack.code & 1 << 4 != 0); stack.dump(); stack_trace(); ksignal(SIGSEGV);