From dd5dab7fd34c6745a16ac572ecd099e4bc26c1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Sun, 20 Oct 2024 12:35:39 +0000 Subject: Fix set_entry flags usage --- arch/x86_64/include/arch/memory/paging/page_entry.hpp | 6 +++--- arch/x86_64/include/arch/memory/paging/page_mapper.hpp | 2 +- arch/x86_64/src/memory/paging/page_entry.cpp | 2 +- arch/x86_64/src/memory/paging/page_mapper.cpp | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'arch/x86_64') diff --git a/arch/x86_64/include/arch/memory/paging/page_entry.hpp b/arch/x86_64/include/arch/memory/paging/page_entry.hpp index 2d97d77..158af2e 100644 --- a/arch/x86_64/include/arch/memory/paging/page_entry.hpp +++ b/arch/x86_64/include/arch/memory/paging/page_entry.hpp @@ -55,11 +55,11 @@ namespace teachos::arch::memory::paging auto calculate_pointed_to_frame() const -> std::optional; /** - * @brief Copies the address from the given physical frame into the underlying std::bitset so future calls to - * calculate_physical_address() will return the new address instead of the old one. + * @brief Copies the address and flags from the given physical frame into the underlying std::bitset so future calls + * to calculate_physical_address() will return the new address and flags instead of the old one. * * @param frame Physical frame that contains the address we want to copy into our underlying std::bitset. - * @param flags Entry flags which will be set on the entry + * @param flags Entry flags which will be copied into our underlying std::bitset. */ auto set_entry(allocator::physical_frame frame, std::bitset<64U> flags) -> void; 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 699d517..635a848 100644 --- a/arch/x86_64/include/arch/memory/paging/page_mapper.hpp +++ b/arch/x86_64/include/arch/memory/paging/page_mapper.hpp @@ -43,7 +43,7 @@ namespace teachos::arch::memory::paging * @param flags A bitset of flags that configure the page table entry for this mapping. */ auto map_page_to_frame(allocator::area_frame_allocator & allocator, virtual_page page, - allocator::physical_frame frame, entry::bitset flags) -> void; + allocator::physical_frame frame, std::bitset<64U> flags) -> void; } // namespace teachos::arch::memory::paging #endif // TEACHOS_ARCH_X86_64_MEMORY_PAGING_PAGE_MAPPER_HPP diff --git a/arch/x86_64/src/memory/paging/page_entry.cpp b/arch/x86_64/src/memory/paging/page_entry.cpp index 8a7442e..a172ca8 100644 --- a/arch/x86_64/src/memory/paging/page_entry.cpp +++ b/arch/x86_64/src/memory/paging/page_entry.cpp @@ -37,6 +37,6 @@ namespace teachos::arch::memory::paging { exception_handling::assert((frame.start_address() & ~0x000fffff'fffff000) == 0, "[Paging Entry] Start address is not aligned with page"); - flags = std::bitset<64U>(frame.start_address()) | flags; + flags = std::bitset<64U>{frame.start_address()} | flags; } } // namespace teachos::arch::memory::paging diff --git a/arch/x86_64/src/memory/paging/page_mapper.cpp b/arch/x86_64/src/memory/paging/page_mapper.cpp index 1912174..0874230 100644 --- a/arch/x86_64/src/memory/paging/page_mapper.cpp +++ b/arch/x86_64/src/memory/paging/page_mapper.cpp @@ -78,7 +78,7 @@ namespace teachos::arch::memory::paging } auto map_page_to_frame(allocator::area_frame_allocator & allocator, virtual_page page, - allocator::physical_frame frame, entry::bitset flags) -> void + allocator::physical_frame frame, std::bitset<64U> flags) -> void { page_table page_table{}; bool table_exists = false; @@ -101,6 +101,6 @@ namespace teachos::arch::memory::paging 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"); - level1_entry.set_entry(frame, flags | entry::PRESENT); + level1_entry.set_entry(frame, flags | std::bitset<64U>{entry::PRESENT}); } -} // namespace teachos::arch::memory::paging \ No newline at end of file +} // namespace teachos::arch::memory::paging -- cgit v1.2.3