diff options
author | Anton Kling <anton@kling.gg> | 2023-11-01 21:41:54 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-13 14:55:09 +0100 |
commit | 027b5e0fb4be55a314d2168c92e99772cc80f442 (patch) | |
tree | cb8dd74b16067c7025c96a8fe7bbf5ebce01bac7 /kernel/cpu | |
parent | 249d7f4ab0bff181534b0d17f3387f59b7c5feba (diff) |
Exceptions: Output CR2 on page fault
Diffstat (limited to 'kernel/cpu')
-rw-r--r-- | kernel/cpu/idt.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/cpu/idt.c b/kernel/cpu/idt.c index bf0061f..0a5cc77 100644 --- a/kernel/cpu/idt.c +++ b/kernel/cpu/idt.c @@ -84,6 +84,10 @@ __attribute__((interrupt)) void page_fault(registers_t *regs) { kprintf("Error Code: %x\n", regs->error_code); kprintf("Instruction Pointer: %x\n", regs->eip); + volatile uint32_t cr2; + asm volatile("mov %%cr2, %0" : "=r"(cr2)); + kprintf("CR2: %x\n", cr2); + if (regs->error_code & (1 << 0)) kprintf("page-protection violation\n"); else |