aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Imhof <fabian.imhof@ost.ch>2024-11-12 10:41:28 +0000
committerFabian Imhof <fabian.imhof@ost.ch>2024-11-12 10:41:28 +0000
commit38e5d23fb325c983751f5d3e4f54a60bf1b1e47a (patch)
tree9233dd8d3b28d9365d8722794cc2b74e9cfd197f
parent9507633f04e672b3dadf1385b1562fb3101d0ea3 (diff)
parent7db57d7a47671b4023e34413a2276611e1c65f72 (diff)
downloadteachos-38e5d23fb325c983751f5d3e4f54a60bf1b1e47a.tar.xz
teachos-38e5d23fb325c983751f5d3e4f54a60bf1b1e47a.zip
Merge branch 'feat_memory_manager' of ssh://gitlab.ost.ch:45022/teachos/kernel into feat_memory_manager
-rw-r--r--arch/x86_64/include/arch/memory/paging/active_page_table.hpp9
-rw-r--r--arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp1
-rw-r--r--arch/x86_64/src/memory/paging/inactive_page_table.cpp1
-rw-r--r--arch/x86_64/src/memory/paging/page_entry.cpp1
4 files changed, 3 insertions, 9 deletions
diff --git a/arch/x86_64/include/arch/memory/paging/active_page_table.hpp b/arch/x86_64/include/arch/memory/paging/active_page_table.hpp
index 9931711..a60b3ad 100644
--- a/arch/x86_64/include/arch/memory/paging/active_page_table.hpp
+++ b/arch/x86_64/include/arch/memory/paging/active_page_table.hpp
@@ -164,12 +164,9 @@ namespace teachos::arch::memory::paging
break;
}
}
- // TODO: Flushing only specifc page does not work and cause temporary_page.map_table_frame to return an invalid
- // page table (Memory inside buffer shows nothing)
- // cpu::tlb_flush(page.start_address());
- // This is the case, because we have unmapped the active page and it is completly invalid, if we only flush one
- // page, the other pages which are huge still exist in the cache and can therefore still be accessed. But because
- // they are huge pages the temporary page is not mapped correctly.
+ // Uses flush all instead of cpu::tlb_flush(page.start_address());, because when we unmap the active page and
+ // only flush one page, the rest of the page which is huge still exist in the cache and
+ // can therefore still be accessed. But because they are huge pages the new mapping can not be accessed correctly.
cpu::tlb_flush_all();
}
diff --git a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
index f673da4..bcc3eba 100644
--- a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
+++ b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
@@ -76,7 +76,6 @@ namespace teachos::arch::memory::paging
{
/*auto const backup =
allocator::physical_frame::containing_address(cpu::read_control_register(cpu::control_register::CR3));
- // TODO: This creates invalid page table that points to nothing, is it the frame (current level 4 page table)
auto page_table_level4 = temporary_page.map_table_frame(backup, active_table);
active_table[511].set_entry(inactive_table.page_table_level_4_frame, entry::PRESENT | entry::WRITABLE);*/
diff --git a/arch/x86_64/src/memory/paging/inactive_page_table.cpp b/arch/x86_64/src/memory/paging/inactive_page_table.cpp
index 8ebc8ce..4e0610e 100644
--- a/arch/x86_64/src/memory/paging/inactive_page_table.cpp
+++ b/arch/x86_64/src/memory/paging/inactive_page_table.cpp
@@ -12,7 +12,6 @@ namespace teachos::arch::memory::paging
temporary_page & temporary_page)
: page_table_level_4_frame{frame}
{
- // TODO: Here the exact same mapping code but it actually works?, is it the different frame?
auto table = temporary_page.map_table_frame(page_table_level_4_frame, active_page_table);
table.zero_entries();
table[511].set_entry(page_table_level_4_frame, entry::PRESENT | entry::WRITABLE);
diff --git a/arch/x86_64/src/memory/paging/page_entry.cpp b/arch/x86_64/src/memory/paging/page_entry.cpp
index ba3deb3..5aa0982 100644
--- a/arch/x86_64/src/memory/paging/page_entry.cpp
+++ b/arch/x86_64/src/memory/paging/page_entry.cpp
@@ -51,7 +51,6 @@ namespace teachos::arch::memory::paging
{
exception_handling::assert((frame.start_address() & ~PHYSICAL_ADDRESS_MASK) == 0,
"[Paging Entry] Start address is not aligned with page");
- // TODO: Crash when trying to write invalid value at 0xffffff8657f5d5f0
flags = frame.start_address() | additional_flags.to_ulong();
}