Linux内核中断之中断向量表IDT的初始化


Linux内核中断之中断向量表IDT的初始化:

  1. void __init trap_init(void)  
  2. {  
  3.     int i;  
  4.   
  5. #ifdef CONFIG_EISA   
  6.     void __iomem *p = early_ioremap(0x0FFFD9, 4);  
  7.   
  8.     if (readl(p) == 'E' + ('I'<<8) + ('S'<<16) + ('A'<<24))  
  9.         EISA_bus = 1;  
  10.     early_iounmap(p, 4);  
  11. #endif   
  12.   
  13.     set_intr_gate(0, ÷_error);  
  14.     set_intr_gate_ist(2, &nmi, NMI_STACK);  
  15.     /* int4 can be called from all */  
  16.     set_system_intr_gate(4, &overflow);  
  17.     set_intr_gate(5, &bounds);  
  18.     set_intr_gate(6, &invalid_op);  
  19.     set_intr_gate(7, &device_not_available);  
  20. #ifdef CONFIG_X86_32   
  21.     set_task_gate(8, GDT_ENTRY_DOUBLEFAULT_TSS);  
  22. #else   
  23.     set_intr_gate_ist(8, &double_fault, DOUBLEFAULT_STACK);  
  24. #endif   
  25.     set_intr_gate(9, &coprocessor_segment_overrun);  
  26.     set_intr_gate(10, &invalid_TSS);  
  27.     set_intr_gate(11, &segment_not_present);  
  28.     set_intr_gate_ist(12, &stack_segment, STACKFAULT_STACK);  
  29.     set_intr_gate(13, &general_protection);  
  30.     set_intr_gate(15, &spurious_interrupt_bug);  
  31.     set_intr_gate(16, &coprocessor_error);  
  32.     set_intr_gate(17, &alignment_check);  
  33. #ifdef CONFIG_X86_MCE   
  34.     set_intr_gate_ist(18, &machine_check, MCE_STACK);  
  35. #endif   
  36.     set_intr_gate(19, &simd_coprocessor_error);  
  37.   
  38.     /* Reserve all the builtin and the syscall vector: */  
  39.     for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)  
  40.         set_bit(i, used_vectors);  
  41.   
  42. #ifdef CONFIG_IA32_EMULATION   
  43.     set_system_intr_gate(IA32_SYSCALL_VECTOR, ia32_syscall);  
  44.     set_bit(IA32_SYSCALL_VECTOR, used_vectors);  
  45. #endif   
  46.   
  47. #ifdef CONFIG_X86_32   
  48.     set_system_trap_gate(SYSCALL_VECTOR, &system_call);  
  49.     set_bit(SYSCALL_VECTOR, used_vectors);  
  50. #endif   
  51.   
  52.     /* 
  53.      * Should be a barrier for any external CPU state: 
  54.      */  
  55.     cpu_init();  
  56.   
  57.     x86_init.irqs.trap_init();  //这个是什么意思呢?   
  58. }  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 下一页

相关内容