diff --git a/include/kdtables.h b/include/kdtables.h index 92edd20..93a7506 100644 --- a/include/kdtables.h +++ b/include/kdtables.h @@ -40,11 +40,25 @@ typedef struct tss_s { extern tss_t tss; -void clear_tss(); +//IDT -// GDT +typedef struct InterruptDescriptor_s { + uint16_t offset_1; + uint16_t selector; + uint8_t reserved; + uint8_t attributes; + uint16_t offset_2; +} InterruptDescriptor_t; +typedef struct IDTR_s { + uint16_t size; + InterruptDescriptor_t* IDT; +} IDTR_t; +extern IDTR_t idtr; +void setup_idt(); +void write_descriptors(); +void load_idt(); #endif diff --git a/linker.ld b/linker.ld index 76942a4..2978099 100644 --- a/linker.ld +++ b/linker.ld @@ -21,6 +21,7 @@ SECTIONS { *(.rodata*) *(.gdt_sect) + *(.idtr) } /*initialized rw data. */ @@ -34,5 +35,6 @@ SECTIONS { *(COMMON) *(.bss) + *(.idt) } } diff --git a/src/idt.s b/src/idt.s new file mode 100644 index 0000000..80a27b1 --- /dev/null +++ b/src/idt.s @@ -0,0 +1,15 @@ +global idtr +section .idtr + idtr: + dw idt_end - idt_start + dd idt_start + +section .idt nobits + idt_start: + resb 256 * 8 ;idt technically has 256 entries by the spec, so i'm reserving that much space... even if i dont implement that many. + idt_end: + + +;Sigh... ISRs essentially MUST be insanely verbose. + + diff --git a/src/kdtables.c b/src/kdtables.c index 046bcf2..6d3e0de 100644 --- a/src/kdtables.c +++ b/src/kdtables.c @@ -1,7 +1,20 @@ /* kdtables.c * Kernel Descriptor Tables * -* Contains GDT, LDT, and any relevant functions and structs pertaining to them +* Contains GDT, IDT, and any relevant functions and structs pertaining to them */ +#include "kdtables.h" +void setup_idt() { + write_descriptors(); + load_idt(); +} + +void write_descriptors() { + +} + +void load_idt() { + +}