diff options
Diffstat (limited to 'src/kernel/arch/amd64/interrupts/isr.c')
-rw-r--r-- | src/kernel/arch/amd64/interrupts/isr.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/kernel/arch/amd64/interrupts/isr.c b/src/kernel/arch/amd64/interrupts/isr.c index ff00f2f..dd97fd4 100644 --- a/src/kernel/arch/amd64/interrupts/isr.c +++ b/src/kernel/arch/amd64/interrupts/isr.c @@ -1,11 +1,18 @@ #include <kernel/arch/amd64/interrupts.h> #include <kernel/arch/amd64/port_io.h> #include <kernel/arch/generic.h> +#include <kernel/malloc.h> #include <kernel/panic.h> #include <kernel/proc.h> #include <stdbool.h> #include <stdint.h> +enum { + NMI = 0x02, + GP_FAULT = 0x0d, + PAGE_FAULT = 0x0e, +}; + void (*irq_fn[16])(void) = {0}; static void log_interrupt(int interrupt, uint64_t *stackframe) { @@ -15,7 +22,7 @@ static void log_interrupt(int interrupt, uint64_t *stackframe) { uint64_t *stack = (void*)stackframe[3]; kprintf("kernel rip = %p, *rip = %p\n", stack, *stack); } - if (interrupt == 0xe) { + if (interrupt == PAGE_FAULT) { uint64_t addr = 0x69; asm("mov %%cr2, %0" : "=r"(addr)); kprintf("addr 0x%x\n", addr); @@ -32,7 +39,13 @@ void isr_stage3(uint8_t interrupt, uint64_t *stackframe) { } } - if (interrupt == 0xe || interrupt == 0xd) { + if (interrupt == NMI) { /* print some debugging information */ + log_interrupt(interrupt, stackframe); + mem_debugprint(); + return; + } + + if (interrupt == PAGE_FAULT || interrupt == GP_FAULT) { stackframe++; } |