diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2025-03-16 12:41:09 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2025-03-16 12:41:09 +0000 |
| commit | 36758071881088b27a52cee4e5653f6cf6a79a78 (patch) | |
| tree | d427218710530eab7e007f6adca9fe4e1710250c /arch/x86_64/src/kernel/cpu/gdtr.cpp | |
| parent | 48578314c1e6af15f8cc1ce48df93e352a5a18ba (diff) | |
| download | teachos-36758071881088b27a52cee4e5653f6cf6a79a78.tar.xz teachos-36758071881088b27a52cee4e5653f6cf6a79a78.zip | |
start implementing TSS
Diffstat (limited to 'arch/x86_64/src/kernel/cpu/gdtr.cpp')
| -rw-r--r-- | arch/x86_64/src/kernel/cpu/gdtr.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86_64/src/kernel/cpu/gdtr.cpp b/arch/x86_64/src/kernel/cpu/gdtr.cpp new file mode 100644 index 0000000..2fe3a99 --- /dev/null +++ b/arch/x86_64/src/kernel/cpu/gdtr.cpp @@ -0,0 +1,20 @@ +#include "arch/kernel/cpu/gdtr.hpp" + +#include "arch/context_switching/descriptor_table/global_descriptor_table_pointer.hpp" + +namespace teachos::arch::kernel::cpu +{ + auto store_global_descriptor_table() -> context_switching::descriptor_table::global_descriptor_table_pointer + { + context_switching::descriptor_table::global_descriptor_table_pointer current_value{}; + asm("sgdt %[output]" : [output] "=m"(current_value)); + return current_value; + } + + auto + load_global_descriptor_table(context_switching::descriptor_table::global_descriptor_table_pointer const & gdt_pointer) + -> void + { + asm volatile("lgdt %[input]" : /* no output from call */ : [input] "m"(gdt_pointer)); + } +} // namespace teachos::arch::kernel::cpu |
