aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/memory/allocator/physical_frame.hpp2
-rw-r--r--arch/x86_64/include/arch/memory/paging/page_mapper.hpp14
-rw-r--r--arch/x86_64/include/arch/memory/paging/virtual_page.hpp2
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.