diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-10-29 06:55:36 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-10-29 06:55:36 +0000 |
| commit | 0d16592c8dce876d8e621c73dea41c33339f3173 (patch) | |
| tree | 819e6e1231ed0d2bf2fecaa9a67aca3a8b0da112 /arch/x86_64/include | |
| parent | f9f047f519d0100c40b914d3ce777ac2f8430b38 (diff) | |
| download | teachos-0d16592c8dce876d8e621c73dea41c33339f3173.tar.xz teachos-0d16592c8dce876d8e621c73dea41c33339f3173.zip | |
Use more virtual and physical address typedef where useful
Diffstat (limited to 'arch/x86_64/include')
3 files changed, 11 insertions, 7 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. |
