aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86_64/CMakeLists.txt1
-rw-r--r--arch/x86_64/include/arch/memory/paging/active_page_table.hpp4
-rw-r--r--arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp14
-rw-r--r--arch/x86_64/include/arch/memory/paging/temporary_page.hpp1
-rw-r--r--arch/x86_64/src/kernel/main.cpp1
-rw-r--r--arch/x86_64/src/memory/paging/active_page_table.cpp10
-rw-r--r--arch/x86_64/src/memory/paging/kernel_mapper.cpp13
7 files changed, 28 insertions, 16 deletions
diff --git a/arch/x86_64/CMakeLists.txt b/arch/x86_64/CMakeLists.txt
index a97abaa..22f9ad4 100644
--- a/arch/x86_64/CMakeLists.txt
+++ b/arch/x86_64/CMakeLists.txt
@@ -52,6 +52,7 @@ target_sources("_memory" PRIVATE
"src/memory/paging/virtual_page.cpp"
"src/memory/paging/active_page_table.cpp"
"src/memory/paging/inactive_page_table.cpp"
+ "src/memory/paging/kernel_mapper.cpp"
)
#[============================================================================[
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
index 3fb2e65..e876798 100644
--- a/arch/x86_64/include/arch/memory/paging/active_page_table.hpp
+++ b/arch/x86_64/include/arch/memory/paging/active_page_table.hpp
@@ -3,8 +3,6 @@
#include "arch/exception_handling/assert.hpp"
#include "arch/memory/allocator/concept.hpp"
-#include "arch/memory/paging/inactive_page_table.hpp"
-#include "arch/memory/paging/temporary_page.hpp"
#include "arch/memory/paging/virtual_page.hpp"
#include <array>
@@ -163,8 +161,6 @@ namespace teachos::arch::memory::paging
invalidate_page_cache(page.start_address());
}
- auto with(inactive_page_table inactive_page_table, temporary_page temporary_page, function f) -> void;
-
private:
/**
* @brief Private constructor should only be used by create or get method, which ensures to create only ever one
diff --git a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
new file mode 100644
index 0000000..085344a
--- /dev/null
+++ b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
@@ -0,0 +1,14 @@
+#ifndef TEACHOS_ARCH_X86_64_MEMORY_PAGING_KERNEL_MAPPER_HPP
+#define TEACHOS_ARCH_X86_64_MEMORY_PAGING_KERNEL_MAPPER_HPP
+
+#include "arch/memory/paging/active_page_table.hpp"
+#include "arch/memory/paging/inactive_page_table.hpp"
+#include "arch/memory/paging/temporary_page.hpp"
+
+namespace teachos::arch::memory::paging
+{
+ auto with(inactive_page_table inactive_page_table, temporary_page temporary_page, active_page_table::function f,
+ active_page_table & active_page_table) -> void;
+} // namespace teachos::arch::memory::paging
+
+#endif // TEACHOS_ARCH_X86_64_MEMORY_PAGING_KERNEL_MAPPER_HPP
diff --git a/arch/x86_64/include/arch/memory/paging/temporary_page.hpp b/arch/x86_64/include/arch/memory/paging/temporary_page.hpp
index a7552dd..0cadc29 100644
--- a/arch/x86_64/include/arch/memory/paging/temporary_page.hpp
+++ b/arch/x86_64/include/arch/memory/paging/temporary_page.hpp
@@ -4,7 +4,6 @@
#include "arch/memory/allocator/physical_frame.hpp"
#include "arch/memory/allocator/tiny_frame_allocator.hpp"
#include "arch/memory/paging/active_page_table.hpp"
-#include "arch/memory/paging/page_table.hpp"
#include "arch/memory/paging/virtual_page.hpp"
namespace teachos::arch::memory::paging
diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp
index f1d6496..c89ae44 100644
--- a/arch/x86_64/src/kernel/main.cpp
+++ b/arch/x86_64/src/kernel/main.cpp
@@ -3,7 +3,6 @@
#include "arch/exception_handling/assert.hpp"
#include "arch/memory/allocator/area_frame_allocator.hpp"
#include "arch/memory/multiboot/reader.hpp"
-#include "arch/memory/paging/active_page_table.hpp"
#include "arch/memory/paging/temporary_page.hpp"
#include "arch/video/vga/text.hpp"
diff --git a/arch/x86_64/src/memory/paging/active_page_table.cpp b/arch/x86_64/src/memory/paging/active_page_table.cpp
index 5f31f75..38696f8 100644
--- a/arch/x86_64/src/memory/paging/active_page_table.cpp
+++ b/arch/x86_64/src/memory/paging/active_page_table.cpp
@@ -93,14 +93,4 @@ namespace teachos::arch::memory::paging
{
// Nothing to do
}
-
- auto active_page_table::with(inactive_page_table inactive_page_table, temporary_page temporary_page,
- active_page_table::function f) -> void
- {
- active_handle[511].set_entry(inactive_page_table.page_table_level_4_frame, entry::PRESENT | entry::WRITABLE);
- invalidate_page_cache(PAGE_TABLE_LEVEL_4_ADDRESS);
-
- f(*mapper);
- }
-
} // namespace teachos::arch::memory::paging
diff --git a/arch/x86_64/src/memory/paging/kernel_mapper.cpp b/arch/x86_64/src/memory/paging/kernel_mapper.cpp
new file mode 100644
index 0000000..9dfc5ad
--- /dev/null
+++ b/arch/x86_64/src/memory/paging/kernel_mapper.cpp
@@ -0,0 +1,13 @@
+#include "arch/memory/paging/kernel_mapper.hpp"
+
+namespace teachos::arch::memory::paging
+{
+ auto with(inactive_page_table inactive_page_table, temporary_page temporary_page,
+ active_page_table::function f) -> void
+ {
+ /*active_handle[511].set_entry(inactive_page_table.page_table_level_4_frame, entry::PRESENT | entry::WRITABLE);
+ invalidate_page_cache(PAGE_TABLE_LEVEL_4_ADDRESS);
+
+ f(*this);*/
+ }
+} // namespace teachos::arch::memory::paging