summaryrefslogtreecommitdiff
path: root/Kernel/VM/PageDirectory.h
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/VM/PageDirectory.h')
-rw-r--r--Kernel/VM/PageDirectory.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/Kernel/VM/PageDirectory.h b/Kernel/VM/PageDirectory.h
new file mode 100644
index 0000000000..ba655178b2
--- /dev/null
+++ b/Kernel/VM/PageDirectory.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <Kernel/VM/PhysicalPage.h>
+#include <AK/HashMap.h>
+#include <AK/Retainable.h>
+#include <AK/RetainPtr.h>
+
+class PageDirectory : public Retainable<PageDirectory> {
+ friend class MemoryManager;
+public:
+ static Retained<PageDirectory> create() { return adopt(*new PageDirectory); }
+ static Retained<PageDirectory> create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); }
+ ~PageDirectory();
+
+ dword cr3() const { return m_directory_page->paddr().get(); }
+ dword* entries() { return reinterpret_cast<dword*>(cr3()); }
+
+ void flush(LinearAddress);
+
+private:
+ PageDirectory();
+ explicit PageDirectory(PhysicalAddress);
+
+ RetainPtr<PhysicalPage> m_directory_page;
+ HashMap<unsigned, RetainPtr<PhysicalPage>> m_physical_pages;
+};