From 4b6e66f686a0341613a303b45e16e5bc744c32dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Mon, 21 Oct 2024 12:37:36 +0000 Subject: Fix weird linker error --- arch/x86_64/src/memory/paging/page_mapper.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'arch/x86_64/src/memory') 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_LEVEL_4_ADDRESS), - page_table::LEVEL4}; - - return active_page; + static page_table * const active_page{reinterpret_cast(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 -- cgit v1.2.3