From 89ad7a0b60ce74c70fc3865e0967c601a6050674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Sun, 20 Oct 2024 08:13:31 +0000 Subject: Make next table return boolean --- arch/x86_64/src/memory/paging/page_table.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'arch/x86_64') diff --git a/arch/x86_64/src/memory/paging/page_table.cpp b/arch/x86_64/src/memory/paging/page_table.cpp index 3c4f6d8..ab7331a 100644 --- a/arch/x86_64/src/memory/paging/page_table.cpp +++ b/arch/x86_64/src/memory/paging/page_table.cpp @@ -26,8 +26,13 @@ namespace teachos::arch::memory::paging exception_handling::assert(current_level != LEVEL1, "[Page Table] Attempted to call next_table on level 1 page table"); auto address = next_table_address(table_index); - current_table = reinterpret_cast(address.value()); - current_level = static_cast(current_level - 1U); + bool const success = address.has_value(); + if (success) + { + current_table = reinterpret_cast(address.value()); + current_level = static_cast(current_level - 1U); + } + return success; } auto page_table::operator[](std::size_t index) -> entry & @@ -47,7 +52,6 @@ namespace teachos::arch::memory::paging std::size_t const table_address = reinterpret_cast(current_table); return ((table_address << 9) | (table_index << 12)); } - // TODO: Implement behaviour for huge pages currently not done return std::nullopt; } } // namespace teachos::arch::memory::paging -- cgit v1.2.3