Kernel: MMU::get() is now MMU::kernel

MMU is can now be locked with RecursiveSpinLock.

Scheduler now has get_current_tid() that works before the Scheduler
is initialized. This allows RecursiveSpinLock usage early on.
This commit is contained in:
Bananymous
2023-05-28 16:18:18 +03:00
parent a2ee543fa1
commit 869de7283f
11 changed files with 100 additions and 63 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <kernel/Memory/Heap.h>
#include <kernel/Memory/Types.h>
#include <kernel/SpinLock.h>
namespace Kernel
{
@@ -18,7 +19,7 @@ namespace Kernel
public:
static void initialize();
static MMU& get();
static MMU& kernel();
static MMU& current();
@@ -44,12 +45,16 @@ namespace Kernel
void load();
void lock() const { m_lock.lock(); }
void unlock() const { m_lock.unlock(); }
private:
uint64_t get_page_data(vaddr_t) const;
void initialize_kernel();
private:
uint64_t* m_highest_paging_struct;
uint64_t* m_highest_paging_struct { nullptr };
mutable RecursiveSpinLock m_lock;
};
}