From d10bc808b29b0b647cbbb6c92d253fbb8c5cf431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Tue, 12 Nov 2024 10:59:50 +0000 Subject: Fix next table overwriting old page handle --- arch/x86_64/include/arch/memory/paging/page_table.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'arch/x86_64/include') diff --git a/arch/x86_64/include/arch/memory/paging/page_table.hpp b/arch/x86_64/include/arch/memory/paging/page_table.hpp index 9449ef2..7a15875 100644 --- a/arch/x86_64/include/arch/memory/paging/page_table.hpp +++ b/arch/x86_64/include/arch/memory/paging/page_table.hpp @@ -72,7 +72,7 @@ namespace teachos::arch::memory::paging * * @param table_index Index of this page table in the page table one level lower. */ - auto next_table(std::size_t table_index) -> std::optional; + auto next_table(std::size_t table_index) const -> std::optional; /** * @brief Call next_table and then checks if the table already exists, if it does not it will use the given @@ -120,8 +120,8 @@ namespace teachos::arch::memory::paging auto operator[](std::size_t index) const -> entry const &; /** - * @brief Decrements the page table level enum by one, is defined so we can use it as a replacement for an - * int index in a range based for loop. + * @brief Pre decrement operator on the page table level enum, is defined so we can use it as a replacement + * for an int index in a range based for loop. * * @note Will halt execution if called with page_table_handle::LEVEL1, because there is no level below. Has to be * defined as either a friend function or inline header method, because we define an operator of another type. In @@ -132,12 +132,13 @@ namespace teachos::arch::memory::paging * header file. * * @param value Value we want to decrement on - * @return level New level value decrement by one, meaning the level is also decrement by one Level4 --> Level3, ... + * @return New level value decrement by one, meaning the level is also decrement by one Level4 --> Level3, ... */ friend auto operator--(level & value) -> level &; private: - page_table * table; ///< Handle to underlying page table, can never be null (invariant ensured by constructor) + page_table * table; ///< Handle to underlying page table, can never be null (invariant ensured by + ///< constructor) level table_level; ///< Level page table is currently on, depends on how often next_level was ///< called successfully. }; -- cgit v1.2.3