aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/kernel/cpu/jmp.cpp
blob: 009981b8e518eb716d6e98ae059ad223dc5cacdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "arch/kernel/cpu/jmp.hpp"

namespace teachos::arch::kernel::cpu
{
  auto jmp(uint64_t address) -> void
  {
    asm volatile("jmp *%[input]" : /* no output from call */ : [input] "r"(address));
  }

  auto jmp(uint64_t segment, uint64_t offset) -> void
  {
    far_pointer far_pointer = {offset, static_cast<uint16_t>(segment)};
    asm volatile("jmp *%0" : : "m"(far_pointer));
  }

}  // namespace teachos::arch::kernel::cpu