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:
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Kernel
|
||||
|
||||
static Process& current() { return Thread::current().process(); }
|
||||
|
||||
MMU& mmu() { return m_mmu ? *m_mmu : MMU::get(); }
|
||||
MMU& mmu() { return m_mmu ? *m_mmu : MMU::kernel(); }
|
||||
|
||||
private:
|
||||
Process(pid_t);
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Kernel
|
||||
void unblock_threads(Semaphore*);
|
||||
|
||||
Thread& current_thread();
|
||||
static pid_t current_tid();
|
||||
|
||||
private:
|
||||
Scheduler() = default;
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace Kernel
|
||||
uintptr_t interrupt_stack_size() const { return m_interrupt_stack_size; }
|
||||
|
||||
static Thread& current() ;
|
||||
static pid_t current_tid();
|
||||
|
||||
Process& process();
|
||||
bool has_process() const { return m_process; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user