diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2025-07-24 16:33:10 +0000 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2025-07-24 16:33:10 +0000 |
| commit | 1b65136a11453fe7e89320dfe6170a0cd75e60dd (patch) | |
| tree | b031192e5af29866e75a2c842d01e22f16877bcc /arch/x86_64/src/memory/mmu.cpp | |
| parent | 3b9bbbb4be529f2365b8bc2e43c1c8e9a65b1a07 (diff) | |
| download | teachos-1b65136a11453fe7e89320dfe6170a0cd75e60dd.tar.xz teachos-1b65136a11453fe7e89320dfe6170a0cd75e60dd.zip | |
x86_64: clean up hw details
Diffstat (limited to 'arch/x86_64/src/memory/mmu.cpp')
| -rw-r--r-- | arch/x86_64/src/memory/mmu.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86_64/src/memory/mmu.cpp b/arch/x86_64/src/memory/mmu.cpp new file mode 100644 index 0000000..31783fe --- /dev/null +++ b/arch/x86_64/src/memory/mmu.cpp @@ -0,0 +1,17 @@ +#include "x86_64/memory/mmu.hpp" + +#include "x86_64/cpu/registers.hpp" + +namespace teachos::x86_64::memory +{ + auto tlb_flush(linear_address address) -> void + { + asm volatile("invlpg (%[input])" : /* no output from call */ : [input] "r"(address) : "memory"); + } + + auto tlb_flush_all() -> void + { + auto current_value = cpu::read_control_register(cpu::control_register::cr3); + cpu::write_control_register(cpu::control_register::cr3, current_value); + } +} // namespace teachos::x86_64::memory |
