Guest User

Untitled

a guest
May 14th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  37. // IRQs
  38. intr_stub 32
  39. intr_stub 33
  40. /*intr_stub 34
  41. intr_stub 35
  42. intr_stub 36
  43. intr_stub 37
  44. intr_stub 38
  45. intr_stub 39
  46. intr_stub 40
  47. intr_stub 41
  48. intr_stub 42
  49. intr_stub 43
  50. intr_stub 44
  51. intr_stub 45
  52. intr_stub 46
  53. intr_stub 47*/
  54.  
  55. // Syscall
  56. intr_stub 48
  57.  
  58. .extern handle_interrupt
  59. intr_common_handler:
  60.     push %ebp
  61.     push %edi
  62.     push %esi
  63.     push %edx
  64.     push %ecx
  65.     push %ebx
  66.     push %eax
  67.  
  68.     push %esp
  69.     call handle_interrupt
  70.     add $4, %esp
  71.  
  72.     pop %eax
  73.     pop %ebx
  74.     pop %ecx
  75.     pop %edx
  76.     pop %esi
  77.     pop %edi
  78.     pop %ebp
  79.  
  80.     add $8, %esp
  81.  
  82.     iret
Advertisement
Add Comment
Please, Sign In to add comment