diff options
author | trimill <trimill@trimillxyz.org> | 2024-02-01 16:53:07 -0500 |
---|---|---|
committer | trimill <trimill@trimillxyz.org> | 2024-02-01 17:01:52 -0500 |
commit | c8c8d009f6a32e0f6856ab0f8167563021204de9 (patch) | |
tree | 9594ab04249ebec6e841c7a78d8bab4ceb1aeacf /src/arch/amd64/idt.c | |
parent | follow the corn style guide (diff) | |
download | corn-c8c8d009f6a32e0f6856ab0f8167563021204de9.tar.gz corn-c8c8d009f6a32e0f6856ab0f8167563021204de9.tar.bz2 corn-c8c8d009f6a32e0f6856ab0f8167563021204de9.zip |
debugger
Diffstat (limited to 'src/arch/amd64/idt.c')
-rw-r--r-- | src/arch/amd64/idt.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/arch/amd64/idt.c b/src/arch/amd64/idt.c index 583b8a9..c0ea5a8 100644 --- a/src/arch/amd64/idt.c +++ b/src/arch/amd64/idt.c @@ -1,10 +1,10 @@ #include <stdint.h> #include <stddef.h> -#include <panic.h> #include <lib.h> #include <serial.h> +#include <panic.h> -#include "backtrace.h" +#include "debugger.h" #include "idt.h" #include "pic.h" @@ -108,7 +108,16 @@ char *EXCEPTIONS[] = { "0x1F Reserved", }; -void idt_exception_handler(uint64_t exception, uint64_t code, void *rip, void *rbp) { +void idt_exception_handler(uint64_t exception, uint64_t code, struct isr_regs *state) { + // breakpoint interrupt + if (exception == 0x03) { + debugger(state, DEBUG_INT3); + return; + } else if (exception == 0x01) { + debugger(state, DEBUG_DBG); + return; + } + // TODO don't just panic char buf[24]; char msg[256] = "Exception "; @@ -128,7 +137,7 @@ void idt_exception_handler(uint64_t exception, uint64_t code, void *rip, void *r strcat(msg, buf); } - panic_interrupt(rip, rbp, msg); + panic_interrupt((void *)state->rip, (void *)state->rbp, msg); } void idt_pic_eoi(uint8_t exception) { |