diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-11-01 13:02:14 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-11-01 13:02:14 +0000 |
| commit | b0d917bc8ad95e282f25949c489dfc1c06b91b83 (patch) | |
| tree | 7ed161960277acc397f43fd02f07e0bb75b863d9 /arch/x86_64/src/memory | |
| parent | defb727b2d0ac902e10e9736440779495b8b51a9 (diff) | |
| download | teachos-b0d917bc8ad95e282f25949c489dfc1c06b91b83.tar.xz teachos-b0d917bc8ad95e282f25949c489dfc1c06b91b83.zip | |
Adjust temporary page to changes
Diffstat (limited to 'arch/x86_64/src/memory')
| -rw-r--r-- | arch/x86_64/src/memory/paging/temporary_page.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/arch/x86_64/src/memory/paging/temporary_page.cpp b/arch/x86_64/src/memory/paging/temporary_page.cpp index 433f0ce..4a8f4da 100644 --- a/arch/x86_64/src/memory/paging/temporary_page.cpp +++ b/arch/x86_64/src/memory/paging/temporary_page.cpp @@ -1,35 +1,38 @@ #include "arch/memory/paging/temporary_page.hpp" #include "arch/memory/paging/page_entry.hpp" -#include "arch/memory/paging/page_mapper.hpp" namespace teachos::arch::memory::paging { - auto temporary_page::map_to_frame(allocator::physical_frame frame) -> virtual_address + auto temporary_page::map_to_frame(allocator::physical_frame frame, + active_page_table & active_table) -> virtual_address { - exception_handling::assert(!translate_page(page).has_value(), "[Temporary page] Page is already mapped"); + exception_handling::assert(!active_table.translate_page(page).has_value(), + "[Temporary page] Page is already mapped"); - map_page_to_frame(allocator, page, frame, entry::WRITABLE); + active_table.map_page_to_frame(allocator, page, frame, entry::WRITABLE); return page.start_address(); } - auto temporary_page::unmap() -> void { unmap_page(allocator, page); } + auto temporary_page::unmap(active_page_table & active_table) -> void { active_table.unmap_page(allocator, page); } - auto temporary_page::map_table_frame(allocator::physical_frame frame) -> page_table_handle + auto temporary_page::map_table_frame(allocator::physical_frame frame, + active_page_table & active_table) -> page_table_handle { - page_table_handle handle{reinterpret_cast<page_table *>(map_to_frame(frame)), page_table_handle::LEVEL1}; + page_table_handle handle{reinterpret_cast<page_table *>(map_to_frame(frame, active_table)), + page_table_handle::LEVEL1}; return handle; } - auto temporary_page::zero_entries() -> void + auto temporary_page::zero_entries(active_page_table & active_table) -> void { auto frame = allocator.allocate_frame(); exception_handling::assert(!frame.has_value(), "[Temporary Page] Tiny allocator could not allocate a frame"); - page_table_handle handle = map_table_frame(frame.value()); + page_table_handle handle = map_table_frame(frame.value(), active_table); handle.zero_entries(); handle[511].set_entry(frame.value(), entry::PRESENT | entry::WRITABLE); - unmap(); + unmap(active_table); } -} // namespace teachos::arch::memory::paging
\ No newline at end of file +} // namespace teachos::arch::memory::paging |
