summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-02-24 14:44:38 -0600
committerDanny Holman <dholman@gymli.org>2024-02-24 14:44:38 -0600
commit2ce0f8af51dae9e7d591ff5fd038f89d6ca9dbbe (patch)
tree314f6105fc2996923070ed7f82c3acc8d5b2b20c /kernel
parent5d06824289868c5a345fbcfa8ed4d1e63af84fdb (diff)
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 <dholman@gymli.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/panic.c22
1 files changed, 20 insertions, 2 deletions
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 <kernel/panic.h>
#include <kernel/io.h>
+#include <stdint.h>
+#include <stddef.h>
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));
+}