aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/memory/paging/active_page_table.hpp31
-rw-r--r--arch/x86_64/include/arch/memory/paging/page_mapper.hpp1
2 files changed, 31 insertions, 1 deletions
diff --git a/arch/x86_64/include/arch/memory/paging/active_page_table.hpp b/arch/x86_64/include/arch/memory/paging/active_page_table.hpp
new file mode 100644
index 0000000..4a94b40
--- /dev/null
+++ b/arch/x86_64/include/arch/memory/paging/active_page_table.hpp
@@ -0,0 +1,31 @@
+#ifndef TEACHOS_ARCH_X86_64_MEMORY_PAGING_VIRTUAL_PAGE_HPP
+#define TEACHOS_ARCH_X86_64_MEMORY_PAGING_VIRTUAL_PAGE_HPP
+
+#include "arch/memory/paging/page_table.hpp"
+
+namespace teachos::arch::memory::paging
+{
+
+ struct active_page_table
+ {
+ /**
+ * @brief Ensures only one instance of active_page_table exists.
+ *
+ * @param level4_page_table A pointer to the level 4 page table.
+ * @return The only instance of active_page_table.
+ */
+ auto create(page_table * level4_page_table) -> active_page_table *;
+
+ private:
+ /**
+ * @brief Construct a new active page table object.
+ *
+ * @param level4_page_table A pointer to the level 4 page table.
+ */
+ active_page_table(page_table * level4_page_table);
+
+ bool instantiated = false; ///< Indicates wether an instance already exists.
+ page_table * level4_page_table; ///< The active level4 page table.
+ };
+} // namespace teachos::arch::memory::paging
+#endif \ No newline at end of file
diff --git a/arch/x86_64/include/arch/memory/paging/page_mapper.hpp b/arch/x86_64/include/arch/memory/paging/page_mapper.hpp
index 5bdd82a..ae3502e 100644
--- a/arch/x86_64/include/arch/memory/paging/page_mapper.hpp
+++ b/arch/x86_64/include/arch/memory/paging/page_mapper.hpp
@@ -48,7 +48,6 @@ namespace teachos::arch::memory::paging
template<allocator::FrameAllocator T>
auto map_page_to_frame(T & allocator, virtual_page page, allocator::physical_frame frame,
std::bitset<64U> flags) -> void
-
{
page_table page_table{};
bool table_exists = false;