aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/kernel/cpu/idtr.cpp
diff options
context:
space:
mode:
authorFabian Imhof <fabian.imhof@ost.ch>2025-03-20 15:30:18 +0000
committerFabian Imhof <fabian.imhof@ost.ch>2025-03-20 15:30:18 +0000
commitb6ee8bec7ed23fd0c544f67f735e96b2bfe67682 (patch)
tree1c738088d75bd7e1299d3b695e74e96d68878fc4 /arch/x86_64/src/kernel/cpu/idtr.cpp
parent7a98b1dcb1f4436664a8f1a5d6e71ab2c65378f0 (diff)
downloadteachos-b6ee8bec7ed23fd0c544f67f735e96b2bfe67682.tar.xz
teachos-b6ee8bec7ed23fd0c544f67f735e96b2bfe67682.zip
begin implementation of IDT
Diffstat (limited to 'arch/x86_64/src/kernel/cpu/idtr.cpp')
-rw-r--r--arch/x86_64/src/kernel/cpu/idtr.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86_64/src/kernel/cpu/idtr.cpp b/arch/x86_64/src/kernel/cpu/idtr.cpp
new file mode 100644
index 0000000..bbf34cb
--- /dev/null
+++ b/arch/x86_64/src/kernel/cpu/idtr.cpp
@@ -0,0 +1,19 @@
+#include "arch/kernel/cpu/idtr.hpp"
+
+#include "arch/context_switching/descriptor_table/interrupt_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::interrupt_descriptor_table_pointer current_value{};
+ asm("sidt %[output]" : [output] "=m"(current_value));
+ return current_value;
+ }
+
+ auto load_interrupt_descriptor_table(
+ context_switching::descriptor_table::interrupt_descriptor_table_pointer const & idt_pointer) -> void
+ {
+ asm volatile("lidt %[input]" : /* no output from call */ : [input] "m"(idt_pointer));
+ }
+} // namespace teachos::arch::kernel::cpu