mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
Kernel: Let PageDirectory own the associated RangeAllocator.
Since we transition to a new PageDirectory on exec(), we need a matching RangeAllocator to go with the new directory. Instead of juggling this in Process and MemoryManager, simply attach the RangeAllocator to the PageDirectory instead. Fixes #61.
This commit is contained in:
parent
d65114afd7
commit
bcc6ddfb6b
6 changed files with 16 additions and 16 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
#include <Kernel/VM/RangeAllocator.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
|
@ -8,7 +9,7 @@
|
|||
class PageDirectory : public Retainable<PageDirectory> {
|
||||
friend class MemoryManager;
|
||||
public:
|
||||
static Retained<PageDirectory> create() { return adopt(*new PageDirectory); }
|
||||
static Retained<PageDirectory> create_for_userspace() { return adopt(*new PageDirectory); }
|
||||
static Retained<PageDirectory> create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); }
|
||||
~PageDirectory();
|
||||
|
||||
|
@ -17,10 +18,13 @@ public:
|
|||
|
||||
void flush(LinearAddress);
|
||||
|
||||
RangeAllocator& range_allocator() { return m_range_allocator; }
|
||||
|
||||
private:
|
||||
PageDirectory();
|
||||
explicit PageDirectory(PhysicalAddress);
|
||||
|
||||
RangeAllocator m_range_allocator;
|
||||
RetainPtr<PhysicalPage> m_directory_page;
|
||||
HashMap<unsigned, RetainPtr<PhysicalPage>> m_physical_pages;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue