Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

interruptions.c 1.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #include "kernel.h"
  2. #include "klibc.h"
  3. #include "drivers/timer.h"
  4. void idt_default_int(void) {
  5. print("!! Unknown interrupt\n");
  6. }
  7. void idt_int0(void) {
  8. print("!! Divide by 0\n ");
  9. }
  10. void idt_int1(void) {
  11. print("!! Debug exception ");
  12. }
  13. void idt_int2(void) {
  14. print("!! NMI ");
  15. }
  16. void idt_int3(void) {
  17. print("!! Breakpoint ");
  18. }
  19. void idt_int4(void) {
  20. print("!! Overflow ");
  21. }
  22. void idt_int5(void) {
  23. print("!! BoundCheck ");
  24. }
  25. void idt_int6(void) {
  26. print("!! Invalid Opcode ");
  27. }
  28. void idt_int7(void) {
  29. print("!! Coprocessor not available ");
  30. }
  31. void idt_int8(void) {
  32. print("!! Double Fault ");
  33. }
  34. void idt_int9(void) {
  35. print("!! Coprocessor segment overrun ");
  36. }
  37. void idt_int10(void) {
  38. print("!! Invalid TSS ");
  39. }
  40. void idt_int11(void) {
  41. print("!! Segment not present ");
  42. }
  43. void idt_int12(void) {
  44. print("!! Stack exception ");
  45. }
  46. void idt_int13(void) {
  47. print("!! General protection exception ");
  48. }
  49. void idt_int14(void) {
  50. print("!! Page fault ");
  51. }
  52. void idt_int15(void) {
  53. print("!! Intel reserved int ");
  54. }
  55. void idt_int16(void) {
  56. print("!! Coprocessor error ");
  57. }
  58. void idt_int17(void) {
  59. print("!! Intel reserved (2) ");
  60. }
  61. void idt_int18(void) {
  62. print("i18 ");
  63. }
  64. /* Used by Channel0 timer */
  65. void idt_irq0(void) {
  66. ticks++;
  67. }
  68. void idt_irq2(void) {
  69. print("IRQ 2");
  70. }
  71. void idt_irq3(void) {
  72. print("IRQ 3");
  73. }
  74. void idt_irq4(void) {
  75. print("IRQ 4");
  76. }
  77. void idt_irq5(void) {
  78. print("IRQ 5");
  79. }
  80. void idt_irq6(void) {
  81. print("IRQ 6");
  82. }
  83. void idt_irq7(void) {
  84. print("IRQ 7");
  85. }
  86. void idt_irq8(void) {
  87. print("IRQ 8");
  88. }
  89. extern unsigned char kbdmap[];
  90. /* Keyboard irq is 1 */
  91. void kbd_int(void) {
  92. unsigned char i;
  93. do {
  94. i=inb(0x64);
  95. } while((i & 0x01) == 0);
  96. i=inb(0x60);
  97. i--;
  98. if(i<0x80){
  99. putcar(kbdmap[i*4]);
  100. }
  101. }