转:http://blog.csdn.net/nerdx/article/details/13612645
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
1.1 struct desc_struct idt_table[256] __attribute__((__section__(".data.idt"))) = { {0, 0}, };
-
-
-
-
-
-
-
-
-
-
-
-
1.2 void __init trap_init(void)
-
{
-
-
init_apic_mappings();
-
-
set_trap_gate(0,÷_error);
-
set_intr_gate(1,&debug);
-
-
set_intr_gate(2,&nmi);
-
-
set_system_intr_gate(3, &int3);
-
-
set_system_gate(4,&overflow);
-
set_system_gate(5,&bounds);
-
-
set_trap_gate(6,&invalid_op);
-
set_trap_gate(7,&device_not_available);
-
set_task_gate(8,GDT_ENTRY_DOUBLEFAULT_TSS);
-
set_trap_gate(9,&coprocessor_segment_overrun);
-
set_trap_gate(10,&invalid_TSS);
-
set_trap_gate(11,&segment_not_present);
-
set_trap_gate(12,&stack_segment);
-
set_trap_gate(13,&general_protection);
-
-
set_intr_gate(14,&page_fault);
-
set_trap_gate(15,&spurious_interrupt_bug);
-
set_trap_gate(16,&coprocessor_error);
-
set_trap_gate(17,&alignment_check);
-
set_trap_gate(19,&simd_coprocessor_error);
-
-
set_system_gate(SYSCALL_VECTOR,&system_call);
-
-
cpu_init();
-
}
-
-
-
-
-
-
-
-
-
-
-
-
1.3 void set_intr_gate(unsigned int n, void *addr)
-
{
-
_set_gate(idt_table+n,14,0,addr,__KERNEL_CS);
-
}
-
-
-
-
#define FIRST_EXTERNAL_VECTOR 0x20
-
-
#define SYSCALL_VECTOR 0x80
-
-
-
-
-
-
-
-
-
-
2.1 void __init init_IRQ(void)
-
{
-
int i;
-
-
-
pre_intr_init_hook();
-
-
-
for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
-
-
int vector = FIRST_EXTERNAL_VECTOR + i;
-
if (i >= NR_IRQS)
-
break;
-
-
if (vector != SYSCALL_VECTOR)
-
set_intr_gate(vector, interrupt[i]);
-
}
-
-
intr_init_hook();
-
-
setup_pit_timer();
-
-
irq_ctx_init(smp_processor_id());
-
}
-
-
-
2.2 struct irqdesc irq_desc[NR_IRQS];
-
-
-
-
-
-
-
-
2.3 void __init init_ISA_irqs (void)
-
{
-
int i;
-
-
init_bsp_APIC();
-
-
init_8259A(0);
-
-
for (i = 0; i < NR_IRQS; i++) {
-
-
irq_desc[i].status = IRQ_DISABLED;
-
-
irq_desc[i].action = NULL;
-
-
irq_desc[i].depth = 1;
-
-
if (i < 16) {
-
irq_desc[i].handler = &i8259A_irq_type;
-
} else {
-
-
irq_desc[i].handler = &no_irq_type;
-
}
-
}
-
}
-
阅读(1456) | 评论(0) | 转发(0) |