diff options
author | Freya Murphy <freya@freyacat.org> | 2024-02-02 12:21:06 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-02-02 12:21:06 -0500 |
commit | 7e62c50138c43af8f41578c0148762a7bb19a599 (patch) | |
tree | 76036d732c69c82f55b50b75527f67be07cd46dc /src/arch/amd64/idt.c | |
parent | better print and mem (diff) | |
download | corn-7e62c50138c43af8f41578c0148762a7bb19a599.tar.gz corn-7e62c50138c43af8f41578c0148762a7bb19a599.tar.bz2 corn-7e62c50138c43af8f41578c0148762a7bb19a599.zip |
better fb (wip), format panic, and pci
Diffstat (limited to 'src/arch/amd64/idt.c')
-rw-r--r-- | src/arch/amd64/idt.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/arch/amd64/idt.c b/src/arch/amd64/idt.c index c0ea5a8..a2ee2a7 100644 --- a/src/arch/amd64/idt.c +++ b/src/arch/amd64/idt.c @@ -118,26 +118,25 @@ void idt_exception_handler(uint64_t exception, uint64_t code, struct isr_regs *s return; } - // TODO don't just panic - char buf[24]; - char msg[256] = "Exception "; - - strcat(msg, EXCEPTIONS[exception]); - - strcat(msg, "\nError code 0x"); - ultoa(code, buf, 16); - strcat(msg, buf); + char custom[64]; + *custom = '\0'; // page faults store the offending address in cr2 if (exception == 0x0E) { - strcat(msg, "\nPage fault address: 0x"); + strcat(custom, "\nPage fault address: 0x"); void *addr; __asm__ volatile ("mov %%cr2, %0" : "=r"(addr)); - ultoa((size_t)addr, buf, 16); - strcat(msg, buf); + ultoa((size_t)addr, custom + 23, 16); } - panic_interrupt((void *)state->rip, (void *)state->rbp, msg); + _panic_interrupt( + (void *)state->rip, + (void *)state->rbp, + "Exception %s\nError code 0x%lu%s", + EXCEPTIONS[exception], + code, + custom + ); } void idt_pic_eoi(uint8_t exception) { |