aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/kernel/cpu
diff options
context:
space:
mode:
authorFabian Imhof <fabian.imhof@ost.ch>2025-03-16 12:41:09 +0000
committerFabian Imhof <fabian.imhof@ost.ch>2025-03-16 12:41:09 +0000
commit36758071881088b27a52cee4e5653f6cf6a79a78 (patch)
treed427218710530eab7e007f6adca9fe4e1710250c /arch/x86_64/src/kernel/cpu
parent48578314c1e6af15f8cc1ce48df93e352a5a18ba (diff)
downloadteachos-36758071881088b27a52cee4e5653f6cf6a79a78.tar.xz
teachos-36758071881088b27a52cee4e5653f6cf6a79a78.zip
start implementing TSS
Diffstat (limited to 'arch/x86_64/src/kernel/cpu')
-rw-r--r--arch/x86_64/src/kernel/cpu/gdtr.cpp (renamed from arch/x86_64/src/kernel/cpu/lgdt.cpp)2
-rw-r--r--arch/x86_64/src/kernel/cpu/tr.cpp17
2 files changed, 18 insertions, 1 deletions
diff --git a/arch/x86_64/src/kernel/cpu/lgdt.cpp b/arch/x86_64/src/kernel/cpu/gdtr.cpp
index 386914f..2fe3a99 100644
--- a/arch/x86_64/src/kernel/cpu/lgdt.cpp
+++ b/arch/x86_64/src/kernel/cpu/gdtr.cpp
@@ -1,4 +1,4 @@
-#include "arch/kernel/cpu/lgdt.hpp"
+#include "arch/kernel/cpu/gdtr.hpp"
#include "arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp"
diff --git a/arch/x86_64/src/kernel/cpu/tr.cpp b/arch/x86_64/src/kernel/cpu/tr.cpp
new file mode 100644
index 0000000..a28b9fc
--- /dev/null
+++ b/arch/x86_64/src/kernel/cpu/tr.cpp
@@ -0,0 +1,17 @@
+#include "arch/kernel/cpu/tr.hpp"
+
+namespace teachos::arch::kernel::cpu
+{
+ auto store_task_register() -> uint16_t
+ {
+ uint16_t current_value{};
+ asm("str %[output]" : [output] "=m"(current_value));
+ return current_value;
+ }
+
+ // TODO: Is this really correct?
+ auto load_task_register(uint16_t gdt_offset) -> void
+ {
+ asm volatile("ltr %[input]" : /* no output from call */ : [input] "m"(gdt_offset));
+ }
+} // namespace teachos::arch::kernel::cpu