aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/kernel/cpu/jmp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/kernel/cpu/jmp.cpp')
-rw-r--r--arch/x86_64/src/kernel/cpu/jmp.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86_64/src/kernel/cpu/jmp.cpp b/arch/x86_64/src/kernel/cpu/jmp.cpp
new file mode 100644
index 0000000..009981b
--- /dev/null
+++ b/arch/x86_64/src/kernel/cpu/jmp.cpp
@@ -0,0 +1,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