aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/mmu.cpp
blob: e15d94eac96cbeb3f5be6249c83fbea87cd7ddf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "x86_64/memory/mmu.hpp"

#include "kapi/memory.hpp"

#include "x86_64/cpu/registers.hpp"

namespace teachos::memory::x86_64
{
  namespace cpu = cpu::x86_64;

  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 paging_root = cpu::cr3::read();
    cpu::cr3::write(paging_root);
  }
}  // namespace teachos::memory::x86_64