Kernel: Create CriticalScope and fix kmalloc

This disables interrupts for the current scope and restores them
after the scope. This is used in kmalloc, since scheduler might
call into kmalloc/kfree, but deadlock if some thread is currently
trying to allocate. This allows us to use kmalloc in Scheduler.
This commit is contained in:
2023-03-08 13:51:09 +02:00
parent a068d828fe
commit d90aba0963
8 changed files with 42 additions and 40 deletions

View File

@@ -18,6 +18,4 @@ public:
static InterruptController& get();
};
uintptr_t disable_interrupts_and_get_flags();
void restore_flags(uintptr_t);
bool interrupts_enabled();