From 58680f7d84ca5771be31c0037e8caf5791d79b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Mon, 28 Oct 2024 12:29:39 +0000 Subject: Fix invalid assertion --- arch/x86_64/include/arch/memory/paging/page_mapper.hpp | 2 +- arch/x86_64/include/arch/memory/paging/page_table.hpp | 1 - arch/x86_64/src/memory/paging/page_table.cpp | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86_64/include/arch/memory/paging/page_mapper.hpp b/arch/x86_64/include/arch/memory/paging/page_mapper.hpp index 5b74bd2..c07c73c 100644 --- a/arch/x86_64/include/arch/memory/paging/page_mapper.hpp +++ b/arch/x86_64/include/arch/memory/paging/page_mapper.hpp @@ -82,7 +82,7 @@ namespace teachos::arch::memory::paging auto level1_entry = current_handle[page.get_level_index(page_table_handle::LEVEL1)]; arch::exception_handling::assert(!level1_entry.contains_flags(entry::HUGE_PAGE), "[Page Mapper] Unable to map huge pages"); - arch::exception_handling::assert(!level1_entry.is_unused(), "[Page Mapper] Page table entry is already used"); + arch::exception_handling::assert(level1_entry.is_unused(), "[Page Mapper] Page table entry is already used"); level1_entry.set_entry(frame, flags | std::bitset<64U>{entry::PRESENT}); } 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 8fcde9f..765e9bb 100644 --- a/arch/x86_64/include/arch/memory/paging/page_table.hpp +++ b/arch/x86_64/include/arch/memory/paging/page_table.hpp @@ -91,7 +91,6 @@ namespace teachos::arch::memory::paging // There should now be an entry at the previously not existent index, therefore we can simply access it again. next_handle = next_table(table_index); exception_handling::assert(next_handle.has_value(), "[Page mapper] Unable to create new entry into page table"); - // TODO: Crashes when trying to access underlying entries array. next_handle.value().zero_entries(); } return next_handle.value(); diff --git a/arch/x86_64/src/memory/paging/page_table.cpp b/arch/x86_64/src/memory/paging/page_table.cpp index f1df31d..e919a1e 100644 --- a/arch/x86_64/src/memory/paging/page_table.cpp +++ b/arch/x86_64/src/memory/paging/page_table.cpp @@ -84,7 +84,6 @@ namespace teachos::arch::memory::paging // C array is not bounds checked, therefore we have to check ourselves, to ensure no out of bounds reads, which // could be incredibly hard to debug later. exception_handling::assert(index < PAGE_TABLE_ENTRY_COUNT, "[Page Table] Index out of bounds"); - // TODO: This section seems to return completly invalid entry, debugger doesn't even show a value? Revert once fixed return entries[index]; } -- cgit v1.2.3