void irq_init() { uint8 pic0_icw4, pic1_icw4; pic0_icw4 = inb(IRQ_PIC0_DATA); pic1_icw4 = inb(IRQ_PIC1_DATA); outb(IRQ_PIC0_COMMAND, IRQ_PIC_INIT); outb(IRQ_PIC1_COMMAND, IRQ_PIC_INIT); outb(IRQ_PIC0_DATA, irq0_offset); outb(IRQ_PIC1_DATA, irq1_offset); outb(IRQ_PIC0_DATA, 0x04); outb(IRQ_PIC1_DATA, 0x02); outb(IRQ_PIC0_DATA, IRQ_PIC_8086_MODE); outb(IRQ_PIC1_DATA, IRQ_PIC_8086_MODE); outb(IRQ_PIC0_DATA, pic0_icw4); outb(IRQ_PIC1_DATA, pic1_icw4); idt_fill_entry(irq0_offset, (uint32) irq0, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq0_offset + 1, (uint32) irq1, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq0_offset + 2, (uint32) irq2, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq0_offset + 3, (uint32) irq3, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq0_offset + 4, (uint32) irq4, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq0_offset + 5, (uint32) irq5, IDT_RING_0, IDT_TRAP_GATE_32); idt_fill_entry(irq0_offset + 6, (uint32) irq6, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq0_offset + 7, (uint32) irq7, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq1_offset + 8, (uint32) irq8, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq1_offset + 9, (uint32) irq9, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq1_offset + 10, (uint32) irq10, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq1_offset + 11, (uint32) irq11, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq1_offset + 12, (uint32) irq12, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq1_offset + 13, (uint32) irq13, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq1_offset + 14, (uint32) irq14, IDT_RING_0, IDT_INT_GATE_32); idt_fill_entry(irq1_offset + 15, (uint32) irq15, IDT_RING_0, IDT_INT_GATE_32); }
/** * Inits IRQ-support */ void irq_init() { pic_remap(); idt_fill_entry(32, (uint32)irq0, 0x8, 0x8E); idt_fill_entry(33, (uint32)irq1, 0x8, 0x8E); idt_fill_entry(34, (uint32)irq2, 0x8, 0x8E); idt_fill_entry(35, (uint32)irq3, 0x8, 0x8E); idt_fill_entry(36, (uint32)irq4, 0x8, 0x8E); idt_fill_entry(37, (uint32)irq5, 0x8, 0x8E); idt_fill_entry(38, (uint32)irq6, 0x8, 0x8E); idt_fill_entry(39, (uint32)irq7, 0x8, 0x8E); idt_fill_entry(40, (uint32)irq8, 0x8, 0x8E); idt_fill_entry(41, (uint32)irq9, 0x8, 0x8E); idt_fill_entry(42, (uint32)irq10, 0x8, 0x8E); idt_fill_entry(43, (uint32)irq11, 0x8, 0x8E); idt_fill_entry(44, (uint32)irq12, 0x8, 0x8E); idt_fill_entry(45, (uint32)irq13, 0x8, 0x8E); idt_fill_entry(46, (uint32)irq14, 0x8, 0x8E); idt_fill_entry(47, (uint32)irq15, 0x8, 0x8E); }