#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; }; void interrupt_handler(struct cpu_reg_state, struct stack_state, u32);