diff --git a/k/idt.c b/k/idt.c new file mode 100644 index 0000000..510a626 --- /dev/null +++ b/k/idt.c @@ -0,0 +1,20 @@ +#include "idt.h" + +static struct idt idt = { 0 }; + +static void load_idt() +{ + struct idt_r idtr; + idtr.addr = (uint32_t)&idt; + idtr.limit = IDT_SIZE - 1; + + asm volatile("lidt %0\n" + : + : "m" (idtr) + : "memory"); +} + +void init_idt() +{ + load_idt(); +}