vbos/init/idt.c
Michael Shaw 92396db851 stdio: Added LOG_ specifiers to all prints
Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
2023-02-28 20:32:39 -05:00

27 lines
592 B
C

#include <kernel/idt.h>
#include <stdio.h>
void idt_load();
void idt_insert(uint16_t gate, uint8_t type, uint8_t ist, uint16_t segment,
void *func)
{
uintptr_t f = (uintptr_t)(func);
struct irqdesc *irqdesc = (__idt + gate);
irqdesc->offset_low = f & 0xFFFF;
irqdesc->offset_mid = ((f >> 0x10) & 0xFFFF);
irqdesc->offset_high = ((f >> 0x20) & 0xFFFFFFFF);
irqdesc->segment = segment;
irqdesc->ist = ist;
irqdesc->attrs = type;
}
void idt_init()
{
__idtr.size = (IDT_SIZE - 1);
__idtr.offset = (uint64_t)__idt;
idt_load();
printf(LOG_SUCCESS "IDT successfully loaded\n");
}