aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/mmu.cpp
blob: 31783fe38e4df0b1414959bd4f883829673197f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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