1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:57:44 +00:00

Kernel: Store a pointer to the owner process in PageDirectory

This replaces the previous owning address space pointer. This commit
should not change any of the existing functionality, but it lays down
the groundwork needed to let us properly access the region table under
the address space spinlock during page fault handling.
This commit is contained in:
Idan Horowitz 2023-04-04 21:06:14 +03:00
parent 65641187ff
commit 003989e1b0
9 changed files with 33 additions and 32 deletions

View file

@ -162,7 +162,7 @@ class PageDirectory final : public AtomicRefCounted<PageDirectory> {
friend class MemoryManager;
public:
static ErrorOr<NonnullLockRefPtr<PageDirectory>> try_create_for_userspace();
static ErrorOr<NonnullLockRefPtr<PageDirectory>> try_create_for_userspace(Process& process);
static NonnullLockRefPtr<PageDirectory> must_create_kernel_page_directory();
static LockRefPtr<PageDirectory> find_current();
@ -180,10 +180,7 @@ public:
return m_pml4t;
}
AddressSpace* address_space() { return m_space; }
AddressSpace const* address_space() const { return m_space; }
void set_space(Badge<AddressSpace>, AddressSpace& space) { m_space = &space; }
Process* process() { return m_process; }
RecursiveSpinlock<LockRank::None>& get_lock() { return m_lock; }
@ -195,7 +192,7 @@ private:
static void register_page_directory(PageDirectory* directory);
static void deregister_page_directory(PageDirectory* directory);
AddressSpace* m_space { nullptr };
Process* m_process { nullptr };
RefPtr<PhysicalPage> m_pml4t;
RefPtr<PhysicalPage> m_directory_table;
RefPtr<PhysicalPage> m_directory_pages[512];