blob: 7aa20c10989894964f9dadd5c8bd4d4a247cb7c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include "arch/kernel/cpu/idtr.hpp"
namespace teachos::arch::kernel::cpu
{
auto store_interrupt_descriptor_table()
-> context_switching::interrupt_descriptor_table::interrupt_descriptor_table_pointer
{
context_switching::interrupt_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::interrupt_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
|