summaryrefslogtreecommitdiff
path: root/kernel/core
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2025-01-12 01:17:36 -0600
committerDanny Holman <dholman@gymli.org>2025-01-12 01:19:11 -0600
commit95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf (patch)
treec8c35347b50477929727fa5be9f5d0f55cbe18fd /kernel/core
parentarch: i386: kmalloc: fix last element being ignored (diff)
downloadbox-95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf.tar.gz
box-95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf.tar.zst
box-95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf.zip
PROJECT RESTRUCTURING
Move the entire kernel into its own directory. Create new directories for system commands, libraries and other required essentials for a complete Unix-like operating system. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to '')
-rw-r--r--kernel/core/interrupt.c (renamed from kernel/interrupt.c)1
-rw-r--r--kernel/core/panic.c (renamed from kernel/panic.c)7
-rw-r--r--kernel/core/sched.c (renamed from kernel/sched.c)0
3 files changed, 7 insertions, 1 deletions
diff --git a/kernel/interrupt.c b/kernel/core/interrupt.c
index 9639aea..6d9e69d 100644
--- a/kernel/interrupt.c
+++ b/kernel/core/interrupt.c
@@ -1,4 +1,5 @@
#include <kernel/interrupt.h>
+#include <kernel/panic.h>
#include <kernel/asm.h>
static void (*isr_handlers[MAX_ISR])(struct isr_frame *frame);
diff --git a/kernel/panic.c b/kernel/core/panic.c
index 65279f0..a44a73c 100644
--- a/kernel/panic.c
+++ b/kernel/core/panic.c
@@ -1,8 +1,10 @@
#include <kernel/panic.h>
+#include <kernel/spinlock.h>
#include <libk/io.h>
#include <stdint.h>
#include <stddef.h>
+static struct spinlock panic_lock = {0};
static int panicked = 0;
void walk_stack(uintptr_t *addrs, size_t n);
@@ -19,8 +21,11 @@ void stack_trace(void) {
}
void panic(const char *str) {
+ disable_ints();
+ spin_lock(&panic_lock);
panicked = 1;
- kprintf("KERNEL PANIC: %s\n", str);
+ spin_unlock(&panic_lock);
+ kprintf("KERNEL PANIC - NOT SYNCING: %s\n", str);
stack_trace();
while (1);
}
diff --git a/kernel/sched.c b/kernel/core/sched.c
index b6096da..b6096da 100644
--- a/kernel/sched.c
+++ b/kernel/core/sched.c