#include <kernel/int.h>
void
idt (void)
{
//
// Imposta i dati necessari al registro IDTR.
//
os.idtr.limit = (sizeof (os.idt) - 1);
os.idtr.base = (uint32_t) &os.idt[0];
//
// Azzera le voci previste dell'array «os.idt[]».
//
int i;
for (i = 0; i < ((sizeof (os.idt)) / 8); i++)
{
idt_desc_int (i, 0, 0, 0, 0, 0);
}
//
// Associa le interruzioni hardware da IRQ 0 a IRQ 7
// a partire dal descrittore 32 e quelle da IRQ 8 a
// IRQ 15, a partire dal descrittore 40.
//
irq_remap (32, 40);
//
// Associa le routine ISR ai descrittori della tabella
// IDT.
//
idt_desc_int ( 0, (uint32_t) isr_0, 0x0008, 1, 0xE, 0);
idt_desc_int ( 1, (uint32_t) isr_1, 0x0008, 1, 0xE, 0);
idt_desc_int ( 2, (uint32_t) isr_2, 0x0008, 1, 0xE, 0);
idt_desc_int ( 3, (uint32_t) isr_3, 0x0008, 1, 0xE, 0);
idt_desc_int ( 4, (uint32_t) isr_4, 0x0008, 1, 0xE, 0);
idt_desc_int ( 5, (uint32_t) isr_5, 0x0008, 1, 0xE, 0);
idt_desc_int ( 6, (uint32_t) isr_6, 0x0008, 1, 0xE, 0);
idt_desc_int ( 7, (uint32_t) isr_7, 0x0008, 1, 0xE, 0);
idt_desc_int ( 8, (uint32_t) isr_8, 0x0008, 1, 0xE, 0);
idt_desc_int ( 9, (uint32_t) isr_9, 0x0008, 1, 0xE, 0);
idt_desc_int (10, (uint32_t) isr_10, 0x0008, 1, 0xE, 0);
idt_desc_int (11, (uint32_t) isr_11, 0x0008, 1, 0xE, 0);
idt_desc_int (12, (uint32_t) isr_12, 0x0008, 1, 0xE, 0);
idt_desc_int (13, (uint32_t) isr_13, 0x0008, 1, 0xE, 0);
idt_desc_int (14, (uint32_t) isr_14, 0x0008, 1, 0xE, 0);
idt_desc_int (15, (uint32_t) isr_15, 0x0008, 1, 0xE, 0);
idt_desc_int (16, (uint32_t) isr_16, 0x0008, 1, 0xE, 0);
idt_desc_int (17, (uint32_t) isr_17, 0x0008, 1, 0xE, 0);
idt_desc_int (18, (uint32_t) isr_18, 0x0008, 1, 0xE, 0);
idt_desc_int (19, (uint32_t) isr_19, 0x0008, 1, 0xE, 0);
idt_desc_int (20, (uint32_t) isr_20, 0x0008, 1, 0xE, 0);
idt_desc_int (21, (uint32_t) isr_21, 0x0008, 1, 0xE, 0);
idt_desc_int (22, (uint32_t) isr_22, 0x0008, 1, 0xE, 0);
idt_desc_int (23, (uint32_t) isr_23, 0x0008, 1, 0xE, 0);
idt_desc_int (24, (uint32_t) isr_24, 0x0008, 1, 0xE, 0);
idt_desc_int (25, (uint32_t) isr_25, 0x0008, 1, 0xE, 0);
idt_desc_int (26, (uint32_t) isr_26, 0x0008, 1, 0xE, 0);
idt_desc_int (27, (uint32_t) isr_27, 0x0008, 1, 0xE, 0);
idt_desc_int (28, (uint32_t) isr_28, 0x0008, 1, 0xE, 0);
idt_desc_int (29, (uint32_t) isr_29, 0x0008, 1, 0xE, 0);
idt_desc_int (30, (uint32_t) isr_10, 0x0008, 1, 0xE, 0);
idt_desc_int (31, (uint32_t) isr_31, 0x0008, 1, 0xE, 0);
idt_desc_int (32, (uint32_t) isr_32, 0x0008, 1, 0xE, 0);
idt_desc_int (33, (uint32_t) isr_33, 0x0008, 1, 0xE, 0);
idt_desc_int (34, (uint32_t) isr_34, 0x0008, 1, 0xE, 0);
idt_desc_int (35, (uint32_t) isr_35, 0x0008, 1, 0xE, 0);
idt_desc_int (36, (uint32_t) isr_36, 0x0008, 1, 0xE, 0);
idt_desc_int (37, (uint32_t) isr_37, 0x0008, 1, 0xE, 0);
idt_desc_int (38, (uint32_t) isr_38, 0x0008, 1, 0xE, 0);
idt_desc_int (39, (uint32_t) isr_39, 0x0008, 1, 0xE, 0);
idt_desc_int (40, (uint32_t) isr_40, 0x0008, 1, 0xE, 0);
idt_desc_int (41, (uint32_t) isr_41, 0x0008, 1, 0xE, 0);
idt_desc_int (42, (uint32_t) isr_42, 0x0008, 1, 0xE, 0);
idt_desc_int (43, (uint32_t) isr_43, 0x0008, 1, 0xE, 0);
idt_desc_int (44, (uint32_t) isr_44, 0x0008, 1, 0xE, 0);
idt_desc_int (45, (uint32_t) isr_45, 0x0008, 1, 0xE, 0);
idt_desc_int (46, (uint32_t) isr_46, 0x0008, 1, 0xE, 0);
idt_desc_int (47, (uint32_t) isr_47, 0x0008, 1, 0xE, 0);
//
// Questo è per le chiamate di sistema.
//
idt_desc_int (128, (uint32_t) isr_128, 0x0008, 1, 0xE,
0);
//
// Rende operativa la tabella con le eccezioni e gli
// IRQ.
//
idt_load (&os.idtr);
//
// Abilita le interruzioni hardware (IRQ).
//
sti ();
}
|