aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/cpu
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-11-09 16:25:11 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-11-09 16:25:11 +0000
commit4c030cbaee174a9f7f42d4f5ca7ddf6debbbe048 (patch)
treec022b72aa6baedf40e0a654126b7be4d4ddb8368 /arch/x86_64/src/memory/cpu
parent022e2555c233c13f990026ea86d164f56a9cd7be (diff)
downloadteachos-4c030cbaee174a9f7f42d4f5ca7ddf6debbbe048.tar.xz
teachos-4c030cbaee174a9f7f42d4f5ca7ddf6debbbe048.zip
Fix flush all method and move crash.
Diffstat (limited to 'arch/x86_64/src/memory/cpu')
-rw-r--r--arch/x86_64/src/memory/cpu/tlb.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86_64/src/memory/cpu/tlb.cpp b/arch/x86_64/src/memory/cpu/tlb.cpp
index bac46b7..1663e80 100644
--- a/arch/x86_64/src/memory/cpu/tlb.cpp
+++ b/arch/x86_64/src/memory/cpu/tlb.cpp
@@ -1,8 +1,13 @@
#include "arch/memory/cpu/tlb.hpp"
+#include "arch/memory/cpu/cr3.hpp"
+
namespace teachos::arch::memory::cpu
{
- auto tlb_flush(paging::virtual_address address) -> void { asm volatile("invlpg (%0)" ::"r"(address) : "memory"); }
+ auto tlb_flush(paging::virtual_address address) -> void
+ {
+ asm volatile("invlpg (%[input])" : /* no output from call */ : [input] "r"(address) : "memory");
+ }
- auto tlb_flush_all() -> void { tlb_flush(PAGE_TABLE_LEVEL_4_ADDRESS); }
+ auto tlb_flush_all() -> void { write_cr3_register(read_cr3_register()); }
} // namespace teachos::arch::memory::cpu