diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2024-11-01 10:08:50 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2024-11-01 10:08:50 +0000 |
| commit | 29c51a2cc30060bd904b06cbe6913755352c48c7 (patch) | |
| tree | 451d38ad10c41e5a310345d1925cbfbc9f811851 /arch/x86_64/src/kernel/main.cpp | |
| parent | 98edc76893b2e22ccdbd81a4a3f1e1113c712cba (diff) | |
| download | teachos-29c51a2cc30060bd904b06cbe6913755352c48c7.tar.xz teachos-29c51a2cc30060bd904b06cbe6913755352c48c7.zip | |
create temporary page implementation
Diffstat (limited to 'arch/x86_64/src/kernel/main.cpp')
| -rw-r--r-- | arch/x86_64/src/kernel/main.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp index 5c55213..a27631f 100644 --- a/arch/x86_64/src/kernel/main.cpp +++ b/arch/x86_64/src/kernel/main.cpp @@ -4,6 +4,7 @@ #include "arch/memory/allocator/area_frame_allocator.hpp" #include "arch/memory/multiboot/reader.hpp" #include "arch/memory/paging/page_mapper.hpp" +#include "arch/memory/paging/temporary_page.hpp" #include "arch/video/vga/text.hpp" #include <algorithm> @@ -22,22 +23,26 @@ namespace teachos::arch::kernel size_t address = 42 * memory::paging::PAGE_TABLE_ENTRY_COUNT * memory::paging::PAGE_TABLE_ENTRY_COUNT * memory::allocator::PAGE_FRAME_SIZE; // 42th P3 entry auto const page = memory::paging::virtual_page::containing_address(address); - memory::paging::map_next_free_page_to_frame(allocator, page, 0U); - auto optional_frame = memory::paging::translate_page(page); - video::vga::text::newline(); - video::vga::text::write("Mapped physical frame: ", video::vga::text::common_attributes::green_on_black); - video::vga::text::write_number(optional_frame.value().frame_number, - video::vga::text::common_attributes::green_on_black); - video::vga::text::write(" to virtual page: ", video::vga::text::common_attributes::green_on_black); - video::vga::text::write_number(page.page_number, video::vga::text::common_attributes::green_on_black); - memory::paging::unmap_page(allocator, page); - video::vga::text::newline(); - video::vga::text::write("Unapped virtual page from physical frame: ", - video::vga::text::common_attributes::green_on_black); - optional_frame = memory::paging::translate_page(page); - exception_handling::assert(!optional_frame.has_value(), "[Main] Ummapping failed"); - video::vga::text::write_number(page.page_number, video::vga::text::common_attributes::green_on_black); + memory::paging::temporary_page temp_page{page, allocator}; + temp_page.zero_entries(); + + // memory::paging::map_next_free_page_to_frame(allocator, page, 0U); + // auto optional_frame = memory::paging::translate_page(page); + // video::vga::text::newline(); + // video::vga::text::write("Mapped physical frame: ", video::vga::text::common_attributes::green_on_black); + // video::vga::text::write_number(optional_frame.value().frame_number, + // video::vga::text::common_attributes::green_on_black); + // video::vga::text::write(" to virtual page: ", video::vga::text::common_attributes::green_on_black); + // video::vga::text::write_number(page.page_number, video::vga::text::common_attributes::green_on_black); + + // memory::paging::unmap_page(allocator, page); + // video::vga::text::newline(); + // video::vga::text::write("Unapped virtual page from physical frame: ", + // video::vga::text::common_attributes::green_on_black); + // optional_frame = memory::paging::translate_page(page); + // exception_handling::assert(!optional_frame.has_value(), "[Main] Ummapping failed"); + // video::vga::text::write_number(page.page_number, video::vga::text::common_attributes::green_on_black); auto last_allocated = allocator.allocate_frame(); auto allocated = last_allocated; |
