#include "types.h" struct cpu_reg_state { u32 eax; u32 ebx; u32 ecx; u32 edx; u16 cs; u16 ds; u16 es; u16 fs; u16 gs; u16 ss; u32 esi; u32 edi; u32 ebp; u32 eip; u32 esp; u32 eflags; }__attribute__((packed)); // Populated by the interrupt handler itself struct stack_state { u32 error_code; // 8 10 11 12 13 14 17 <= ony interrupts that actually use the error code u32 eip; u16 cs; u32 eflags; }; struct IDT_Entry { u16 offset_low; // offset bits 0..15 u16 selector; // code segment in either gdt or ldt u8 zero; // not used always 0 /* 7 0 * +---+---+---+---+---+---+---+---+ * | P | DPL | S | GateType | * +---+---+---+---+---+---+---+---+ */ u8 type_attrs; // format specified above u16 offset_high;// offset bits 16..31 }__attribute__((packed)); struct IDT_PTR { u16 limit; u32 address; }__attribute__((packed)); struct IDT_Entry IDT[255]; struct IDT_PTR idt_ptr; //void interrupt_handler(struct cpu_reg_state, struct stack_state, u32); void load_idt();