summaryrefslogtreecommitdiff
path: root/src/arch/amd64/cpu
diff options
context:
space:
mode:
authortrimill <trimill@trimillxyz.org>2024-02-03 00:58:27 -0500
committertrimill <trimill@trimillxyz.org>2024-02-03 00:58:27 -0500
commit5bec5d9fbdaed3a599c1cd0231f2093933828217 (patch)
treeda8afdd5244697e83dc4b6e9085d3c24e5c7d5a0 /src/arch/amd64/cpu
parentrefactor, new arch dirs, (wip) page alloc on write, hsv screen (convert to us... (diff)
downloadcorn-5bec5d9fbdaed3a599c1cd0231f2093933828217.tar.gz
corn-5bec5d9fbdaed3a599c1cd0231f2093933828217.tar.bz2
corn-5bec5d9fbdaed3a599c1cd0231f2093933828217.zip
refactor exception panic
Diffstat (limited to 'src/arch/amd64/cpu')
-rw-r--r--src/arch/amd64/cpu/idt.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/arch/amd64/cpu/idt.c b/src/arch/amd64/cpu/idt.c
index 053f614..c286199 100644
--- a/src/arch/amd64/cpu/idt.c
+++ b/src/arch/amd64/cpu/idt.c
@@ -1,10 +1,11 @@
#include <stdint.h>
#include <stddef.h>
#include <lib.h>
-#include <panic.h>
+
#include "idt.h"
+#include "backtrace.h"
#include "debugger.h"
-#include "../paging.h"
+#include "../bindings.h"
#include "../drivers/pic.h"
#define IDT_SIZE 256
@@ -117,25 +118,25 @@ void idt_exception_handler(uint64_t exception, uint64_t code, struct isr_regs *s
return;
}
- char custom[64];
- *custom = '\0';
+ kputs("\n\n!!! EXCEPTION !!!\n");
+ kprintf("0x%02lX %s\n", exception, EXCEPTIONS[exception]);
+ kprintf("Error code 0x%lX\n", code);
+
// page faults store the offending address in cr2
if (exception == 0x0E) {
- strcat(custom, "\nPage fault address: 0x");
uint64_t cr2;
__asm__ volatile ("mov %%cr2, %0" : "=r"(cr2));
- ultoa((size_t)cr2, custom + 23, 16);
+ kprintf("Page fault address: 0x%lX\n", cr2);
}
+
+ kputs("\n");
- panic_interrupt(
- (void *)state->rip,
- (void *)state->rbp,
- "Exception %s\nError code 0x%lu%s",
- EXCEPTIONS[exception],
- code,
- custom
- );
+ log_backtrace_ex((void *)state->rip, (void *)state->rbp);
+
+ while (1) {
+ halt();
+ }
}
void idt_pic_eoi(uint8_t exception) {