aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/paging
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-23 13:55:23 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-23 13:55:23 +0000
commitcf52909d11fba4e81e77f264abe1f7055399793a (patch)
tree40490d3aee47b4370e149d32024b347bcc2408e9 /arch/x86_64/src/memory/paging
parent355993d16fcdb2d020d6f1ff02adfa191f8f4d48 (diff)
downloadteachos-cf52909d11fba4e81e77f264abe1f7055399793a.tar.xz
teachos-cf52909d11fba4e81e77f264abe1f7055399793a.zip
Revert "Initalize page table on first call"
This reverts commit 355993d16fcdb2d020d6f1ff02adfa191f8f4d48.
Diffstat (limited to 'arch/x86_64/src/memory/paging')
-rw-r--r--arch/x86_64/src/memory/paging/page_mapper.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86_64/src/memory/paging/page_mapper.cpp b/arch/x86_64/src/memory/paging/page_mapper.cpp
index 39b5e64..995f2c3 100644
--- a/arch/x86_64/src/memory/paging/page_mapper.cpp
+++ b/arch/x86_64/src/memory/paging/page_mapper.cpp
@@ -4,11 +4,15 @@
namespace teachos::arch::memory::paging
{
+ namespace
+ {
+ static page_table * PAGE_TABLE_LEVEL_4_ADDRESS = boot::page_map_level_4;
+ } // namespace
+
auto create_or_get() -> page_table_handle
{
- static page_table * table = boot::page_map_level_4;
// We can not save page_table_handle as a static variable directly, if we do the program will fail to link.
- return page_table_handle{table, page_table_handle::LEVEL4};
+ return page_table_handle{PAGE_TABLE_LEVEL_4_ADDRESS, page_table_handle::LEVEL4};
}
auto translate_page(virtual_page page) -> std::optional<allocator::physical_frame>