Make spinlock disable interrupts
This commit is contained in:
@ -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"); */
|
||||||
|
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user