/** * @file idt.h * @brief Interrupt Descriptor Table * @author Jake "lordtet" Holtham * @date 2025 * IDT related structures, globals and functions */ #ifndef IDT_H #define IDT_H #include /** * @brief IDT Entry */ typedef struct InterruptDescriptor_s { uint16_t offset_lo; /**< Lower 16 bits of ISR ptr */ uint16_t selector; /**< */ uint8_t reserved; /**< Nothing */ uint8_t attributes; /**< */ uint16_t offset_hi; /**< Upper 16 bits of ISR ptr */ } InterruptDescriptor_t; /** * @brief */ typedef struct IDTR_s { uint16_t size; /**< IDT Length */ InterruptDescriptor_t* IDT; /**< Pointer to the IDT Entry array */ } __attribute__((packed)) IDTR_t; /** * @brief The IDTR in memory. */ extern IDTR_t idtr; /** * @brief First IDT Entry */ extern InterruptDescriptor_t idt_start; /** * @brief Amount of ISRs implemented */ extern unsigned char num_interrupts; /** * @brief Call setup and write to construct and load the IDT. */ void setup_idt(); /** * @brief Write the IDT and IDTR */ void write_descriptors(); /** * @brief LIDT call */ extern void load_idt(); #endif