From 2ce0f8af51dae9e7d591ff5fd038f89d6ca9dbbe Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Sat, 24 Feb 2024 14:44:38 -0600 Subject: arch: i386: cleanup everything and reorganize Clean up everything in the i386 arch directory. This code has been in dire need of refactoring for a long while. All the inline assembly functions and the data structures related to the architecture should be placed into their own header file. Now the scheduler can access registers and ISRs without having to deal with arch-specific code. Signed-off-by: Danny Holman --- kernel/panic.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'kernel') diff --git a/kernel/panic.c b/kernel/panic.c index be7cffb..b92ee4d 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -1,11 +1,29 @@ #include #include +#include +#include static int panicked = 0; void panic(const char *str) { - kprintf("KERNEL PANIC\n"); - kprintf("ERROR: %s\n", str); + kprintf("KERNEL PANIC: %s\n", str); panicked = 1; while (1); } + +void dump_reg(struct regs *regs) { + kprintf("Registers at interrupt:\n"); + kprintf("\tEAX = %x\n", regs->eax); + kprintf("\tEBX = %x\n", regs->ebx); + kprintf("\tECX = %x\n", regs->ecx); + kprintf("\tEDX = %x\n", regs->edx); + kprintf("\tESI = %x\n", regs->esi); + kprintf("\tEDI = %x\n", regs->edi); + kprintf("\tEIP = %x\n", regs->eip); + kprintf("Current code selector: %x\n", regs->cs); +} + +void dump_stack(struct regs *regs, size_t len) { + //for (uint32_t i = 0; i < len; i++) + // kprintf("%x:\t%x\n", esp+i, *(uint32_t*)(esp+i)); +} -- cgit v1.2.3