aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/memory')
-rw-r--r--arch/x86_64/src/memory/paging/active_page_table.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/x86_64/src/memory/paging/active_page_table.cpp b/arch/x86_64/src/memory/paging/active_page_table.cpp
new file mode 100644
index 0000000..eb85c34
--- /dev/null
+++ b/arch/x86_64/src/memory/paging/active_page_table.cpp
@@ -0,0 +1,31 @@
+#include "arch/memory/paging/active_page_table.hpp"
+
+namespace teachos::arch::memory::paging
+{
+ struct active_page_table
+ {
+ auto create(page_table * level4_page_table) -> active_page_table *
+ {
+ if (instantiated)
+ {
+ return this;
+ }
+
+ instantiated = true;
+ return &active_page_table(level4_page_table);
+ }
+
+ active_page_table(const active_page_table &) = delete;
+ active_page_table & operator=(const active_page_table &) = delete;
+
+ private:
+ active_page_table(page_table * level4_page_table)
+ : level4_page_table(level4_page_table)
+ {
+ // Nothing to do
+ }
+
+ bool instantiated = false;
+ page_table * level4_page_table;
+ };
+} // namespace teachos::arch::memory::paging \ No newline at end of file