歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux內核 >> Linux內核中斷之中斷向量表IDT的初始化

Linux內核中斷之中斷向量表IDT的初始化

日期:2017/3/1 11:07:58   编辑:Linux內核

Linux內核中斷之中斷向量表IDT的初始化:

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