From 8cf1bde879cc8c124057ddcd04ac6ec771de15b9 Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Fri, 22 Aug 2025 12:42:04 +0200 Subject: [PATCH] Make spinlock disable interrupts --- kernel/kmain.c | 3 ++- kernel/spinlock/spinlock.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/kmain.c b/kernel/kmain.c index cc73c2a..1f6620d 100644 --- a/kernel/kmain.c +++ b/kernel/kmain.c @@ -63,10 +63,11 @@ void kmain(void) { paging_init(); dlmalloc_check(); hal_init_withmalloc(); - /* hal_intr_disable(); */ + hal_intr_disable(); storedev_init(); baseimg_init(); vfs_init(); + hal_intr_enable(); /* kprintf(BANNER_TEXT "\n"); */ diff --git a/kernel/spinlock/spinlock.c b/kernel/spinlock/spinlock.c index 390c41d..fecc526 100644 --- a/kernel/spinlock/spinlock.c +++ b/kernel/spinlock/spinlock.c @@ -1,6 +1,7 @@ #include #include #include "spinlock.h" +#include "hal/hal.h" void spinlock_init(SpinLock *sl) { atomic_store(&sl->lock, false); @@ -12,9 +13,11 @@ void spinlock_acquire(SpinLock *sl) { unlocked = false; SPINLOCK_HINT(); } + hal_intr_disable(); } void spinlock_release(SpinLock *sl) { atomic_store(&sl->lock, false); + hal_intr_enable(); }