diff options
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.cpp | 17 |
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 |
