aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-11-12 10:59:50 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-11-12 10:59:50 +0000
commitd10bc808b29b0b647cbbb6c92d253fbb8c5cf431 (patch)
treebf6b97248f521e163053484bc75ab4a54da89e9c /arch/x86_64/include
parent38e5d23fb325c983751f5d3e4f54a60bf1b1e47a (diff)
downloadteachos-d10bc808b29b0b647cbbb6c92d253fbb8c5cf431.tar.xz
teachos-d10bc808b29b0b647cbbb6c92d253fbb8c5cf431.zip
Fix next table overwriting old page handle
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/memory/paging/page_table.hpp11
1 files changed, 6 insertions, 5 deletions
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<page_table_handle>;
+ auto next_table(std::size_t table_index) const -> std::optional<page_table_handle>;
/**
* @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.
};