Guest User

arbu

a guest
Mar 1st, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. .macro intr_stub nr
  2. .global intr_stub_\nr
  3. intr_stub_\nr:
  4. pushl $0
  5. pushl $\nr
  6. jmp intr_common_handler
  7. .endm
  8.  
  9. .macro intr_stub_error_code nr
  10. .global intr_stub_\nr
  11. intr_stub_\nr:
  12. pushl $\nr
  13. jmp intr_common_handler
  14. .endm
  15.  
  16. // Exceptions
  17. intr_stub 0
  18. intr_stub 1
  19. intr_stub 2
  20. intr_stub 3
  21. intr_stub 4
  22. intr_stub 5
  23. intr_stub 6
  24. intr_stub 7
  25. intr_stub_error_code 8
  26. intr_stub 9
  27. intr_stub_error_code 10
  28. intr_stub_error_code 11
  29. intr_stub_error_code 12
  30. intr_stub_error_code 13
  31. intr_stub_error_code 14
  32. intr_stub 15
  33. intr_stub 16
  34. intr_stub_error_code 17
  35. intr_stub 18
  36. intr_stub 19
  37.  
  38. // IRQs
  39. intr_stub 32
  40. intr_stub 33
  41. intr_stub 34
  42. intr_stub 35
  43. intr_stub 36
  44. intr_stub 37
  45. intr_stub 38
  46. intr_stub 39
  47. intr_stub 40
  48. intr_stub 41
  49. intr_stub 42
  50. intr_stub 43
  51. intr_stub 44
  52. intr_stub 45
  53. intr_stub 46
  54. intr_stub 47
  55.  
  56. // Syscall
  57. intr_stub 48
  58.  
  59. .extern handle_interrupt
  60. intr_common_handler:
  61. // CPU-Zustand sichern
  62. push %ebp
  63. push %edi
  64. push %esi
  65. push %edx
  66. push %ecx
  67. push %ebx
  68. push %eax
  69.  
  70. // Handler aufrufen
  71. push %esp
  72. call handle_interrupt
  73. add $4, %esp
  74.  
  75. // CPU-Zustand wiederherstellen
  76. pop %eax
  77. pop %ebx
  78. pop %ecx
  79. pop %edx
  80. pop %esi
  81. pop %edi
  82. pop %ebp
  83.  
  84. // Fehlercode und Interruptnummer vom Stack nehmen
  85. add $8, %esp
  86.  
  87. // Ruecksprung zum unterbrochenen Code
  88. iret
Advertisement
Add Comment
Please, Sign In to add comment