aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/paging
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/memory/paging')
-rw-r--r--arch/x86_64/src/memory/paging/page_table.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86_64/src/memory/paging/page_table.cpp b/arch/x86_64/src/memory/paging/page_table.cpp
index a39c235..eb11810 100644
--- a/arch/x86_64/src/memory/paging/page_table.cpp
+++ b/arch/x86_64/src/memory/paging/page_table.cpp
@@ -100,14 +100,15 @@ namespace teachos::arch::memory::paging
auto page_table_handle::is_empty() const -> bool { return table->is_empty(); }
- auto page_table_handle::next_table(std::size_t table_index) -> std::optional<page_table_handle>
+ auto page_table_handle::next_table(std::size_t table_index) const -> std::optional<page_table_handle>
{
exception_handling::assert(table_level != page_table_handle::LEVEL1,
"[Page Table] Attempted to call next_table on level 1 page table");
auto const next_table = table->next_table(table_index);
if (next_table.has_value())
{
- return page_table_handle{next_table.value(), --table_level};
+ auto const new_level = static_cast<page_table_handle::level>(table_level - 1);
+ return page_table_handle{next_table.value(), new_level};
}
return std::nullopt;
}