#ifndef __INTERRUPT_H #define __INTERRUPT_H #include #include #include "vga.h" #include "port.h" struct gate_desc { uint16_t handler_low; // the low bits of the address of the handler uint16_t gdt_code_seg; // the address of the code segment descriptor uint8_t reserved; // we don't use this apparently uint8_t access; // access rights uint16_t handler_high; // the high bits of the address of the handler } __attribute__((packed)); struct gate_desc idt[256]; struct idt_pointer { uint16_t size; uint32_t base; } __attribute__((packed)); void set_int_desc_entry(uint8_t int_number, uint16_t gdt_code_seg, void (*handler)(), uint8_t privlege_level, uint8_t desc_type); void interrupt_init(); void start_interrupts(); void clear_interrupts(); void handle_irq0x00(); void handle_irq0x01(); void handle_exception0x00(); void handle_exception0x01(); void handle_exception0x02(); void handle_exception0x03(); void handle_exception0x06(); void handle_exception0x07(); void handle_exception0x08(); void handle_exception0x0D(); void int_ignore(); struct port pic_master_command; struct port pic_master_data; struct port pic_slave_command; struct port pic_slave_data; typedef void irqh_t(); #define INT_MASK 0x00 #define PIC_EOI 0x20 #endif