diff options
Diffstat (limited to 'arch')
5 files changed, 13 insertions, 9 deletions
diff --git a/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp b/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp index 39406af..146e557 100644 --- a/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp +++ b/arch/x86_64/include/arch/memory/allocator/physical_frame.hpp @@ -36,7 +36,7 @@ namespace teachos::arch::memory::allocator * * @return Start address of the physical frame. */ - auto start_address() const -> uint64_t; + auto start_address() const -> physical_address; /** * @brief Defaulted equals operator. 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 6a0c989..0ef552a 100644 --- a/arch/x86_64/include/arch/memory/paging/page_mapper.hpp +++ b/arch/x86_64/include/arch/memory/paging/page_mapper.hpp @@ -12,12 +12,16 @@ namespace teachos::arch::memory::paging namespace { /** - * @brief Invalidates any translation lookaside buffer (TLB) entries into the page table the given entry is cotained - * in. See https://www.felixcloutier.com/x86/invlpg for more information int he used x86 instruction. + * @brief Invalidates any translation lookaside buffer (TLB) entry for the page table the given address is cotained + * in. See https://www.felixcloutier.com/x86/invlpg for more information on the used x86 instruction. * - * @param entry Any entry into the page table we want to invalidate all cached entries in. + * @param address Memory address, which will be used to determine the contained page and flush the TLB entry for + * that page. */ - auto invalidate_page_cache(entry * entry) -> void { asm volatile("invlpg (%0)" ::"r"(entry) : "memory"); } + auto invalidate_page_cache(virtual_address address) -> void + { + asm volatile("invlpg (%0)" ::"r"(address) : "memory"); + } } // namespace /** @@ -149,7 +153,7 @@ namespace teachos::arch::memory::paging // TODO: Deallocate and unmap level 1, 2, 3 page table entry if this was the last page in them. // TODO: Fix deallocate because it is not yet implemented. allocator.deallocate_frame(level1_frame.value()); - invalidate_page_cache(&level1_entry); + invalidate_page_cache(page.start_address()); } } // namespace teachos::arch::memory::paging diff --git a/arch/x86_64/include/arch/memory/paging/virtual_page.hpp b/arch/x86_64/include/arch/memory/paging/virtual_page.hpp index 934ecf2..8c5613d 100644 --- a/arch/x86_64/include/arch/memory/paging/virtual_page.hpp +++ b/arch/x86_64/include/arch/memory/paging/virtual_page.hpp @@ -37,7 +37,7 @@ namespace teachos::arch::memory::paging * * @return Start address of the virtual page. */ - auto start_address() const -> size_t; + auto start_address() const -> virtual_address; /** * @brief Calculates the index into the page table with the given level, which leads to this virtual page. diff --git a/arch/x86_64/src/memory/allocator/physical_frame.cpp b/arch/x86_64/src/memory/allocator/physical_frame.cpp index b05254b..bef9322 100644 --- a/arch/x86_64/src/memory/allocator/physical_frame.cpp +++ b/arch/x86_64/src/memory/allocator/physical_frame.cpp @@ -13,5 +13,5 @@ namespace teachos::arch::memory::allocator return physical_frame{address / PAGE_FRAME_SIZE}; } - auto physical_frame::start_address() const -> uint64_t { return frame_number * PAGE_FRAME_SIZE; } + auto physical_frame::start_address() const -> physical_address { return frame_number * PAGE_FRAME_SIZE; } } // namespace teachos::arch::memory::allocator diff --git a/arch/x86_64/src/memory/paging/virtual_page.cpp b/arch/x86_64/src/memory/paging/virtual_page.cpp index 4221335..c0ec88d 100644 --- a/arch/x86_64/src/memory/paging/virtual_page.cpp +++ b/arch/x86_64/src/memory/paging/virtual_page.cpp @@ -17,7 +17,7 @@ namespace teachos::arch::memory::paging return virtual_page{address / allocator::PAGE_FRAME_SIZE}; } - auto virtual_page::start_address() const -> size_t { return page_number * allocator::PAGE_FRAME_SIZE; } + auto virtual_page::start_address() const -> virtual_address { return page_number * allocator::PAGE_FRAME_SIZE; } auto virtual_page::get_level_index(page_table_handle::level level) const -> size_t { |
