Make spinlock disable interrupts

This commit is contained in:
2025-08-22 12:42:04 +02:00
parent 182c6e2956
commit 8cf1bde879
2 changed files with 5 additions and 1 deletions

View File

@ -63,10 +63,11 @@ void kmain(void) {
paging_init(); paging_init();
dlmalloc_check(); dlmalloc_check();
hal_init_withmalloc(); hal_init_withmalloc();
/* hal_intr_disable(); */ hal_intr_disable();
storedev_init(); storedev_init();
baseimg_init(); baseimg_init();
vfs_init(); vfs_init();
hal_intr_enable();
/* kprintf(BANNER_TEXT "\n"); */ /* kprintf(BANNER_TEXT "\n"); */

View File

@ -1,6 +1,7 @@
#include <stdatomic.h> #include <stdatomic.h>
#include <stdint.h> #include <stdint.h>
#include "spinlock.h" #include "spinlock.h"
#include "hal/hal.h"
void spinlock_init(SpinLock *sl) { void spinlock_init(SpinLock *sl) {
atomic_store(&sl->lock, false); atomic_store(&sl->lock, false);
@ -12,9 +13,11 @@ void spinlock_acquire(SpinLock *sl) {
unlocked = false; unlocked = false;
SPINLOCK_HINT(); SPINLOCK_HINT();
} }
hal_intr_disable();
} }
void spinlock_release(SpinLock *sl) { void spinlock_release(SpinLock *sl) {
atomic_store(&sl->lock, false); atomic_store(&sl->lock, false);
hal_intr_enable();
} }