aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-21 12:37:36 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-21 12:37:36 +0000
commit4b6e66f686a0341613a303b45e16e5bc744c32dd (patch)
treec9e2a3a710de0eb661d599e328e97237fb9ac455 /arch/x86_64/src/memory
parent72cb015567cb65527e9105e653c001be3c04eab5 (diff)
downloadteachos-4b6e66f686a0341613a303b45e16e5bc744c32dd.tar.xz
teachos-4b6e66f686a0341613a303b45e16e5bc744c32dd.zip
Fix weird linker error
Diffstat (limited to 'arch/x86_64/src/memory')
-rw-r--r--arch/x86_64/src/memory/paging/page_mapper.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86_64/src/memory/paging/page_mapper.cpp b/arch/x86_64/src/memory/paging/page_mapper.cpp
index 01c39ca..28e248b 100644
--- a/arch/x86_64/src/memory/paging/page_mapper.cpp
+++ b/arch/x86_64/src/memory/paging/page_mapper.cpp
@@ -9,10 +9,9 @@ namespace teachos::arch::memory::paging
auto create_or_get() -> page_table_handle
{
- static page_table_handle active_page{reinterpret_cast<page_table *>(PAGE_TABLE_LEVEL_4_ADDRESS),
- page_table::LEVEL4};
-
- return active_page;
+ static page_table * const active_page{reinterpret_cast<page_table *>(PAGE_TABLE_LEVEL_4_ADDRESS)};
+ // 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{active_page, page_table::LEVEL4};
}
auto translate_page(virtual_page page) -> std::optional<allocator::physical_frame>