Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

183 строки
2.4 KiB

  1. /*
  2. * libcaca Colour ASCII-Art library
  3. * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net>
  4. * 2009 Jean-Yves Lamoureux <jylam@lnxscene.org>
  5. * All Rights Reserved
  6. *
  7. * This library is free software. It comes without any warranty, to
  8. * the extent permitted by applicable law. You can redistribute it
  9. * and/or modify it under the terms of the Do What The Fuck You Want
  10. * To Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #include "kernel.h"
  14. #include "klibc.h"
  15. #include "drivers/timer.h"
  16. void idt_default_int(void)
  17. {
  18. print("!! Unknown interrupt\n");
  19. }
  20. void idt_int0(void)
  21. {
  22. print("!! Divide by 0\n ");
  23. }
  24. void idt_int1(void)
  25. {
  26. print("!! Debug exception ");
  27. }
  28. void idt_int2(void)
  29. {
  30. print("!! NMI ");
  31. }
  32. void idt_int3(void)
  33. {
  34. print("!! Breakpoint ");
  35. }
  36. void idt_int4(void)
  37. {
  38. print("!! Overflow ");
  39. }
  40. void idt_int5(void)
  41. {
  42. print("!! BoundCheck ");
  43. }
  44. void idt_int6(void)
  45. {
  46. print("!! Invalid Opcode ");
  47. }
  48. void idt_int7(void)
  49. {
  50. print("!! Coprocessor not available ");
  51. }
  52. void idt_int8(void)
  53. {
  54. print("!! Double Fault ");
  55. }
  56. void idt_int9(void)
  57. {
  58. print("!! Coprocessor segment overrun ");
  59. }
  60. void idt_int10(void)
  61. {
  62. print("!! Invalid TSS ");
  63. }
  64. void idt_int11(void)
  65. {
  66. print("!! Segment not present ");
  67. }
  68. void idt_int12(void)
  69. {
  70. print("!! Stack exception ");
  71. }
  72. void idt_int13(void)
  73. {
  74. print("!! General protection exception ");
  75. }
  76. void idt_int14(void)
  77. {
  78. print("!! Page fault ");
  79. }
  80. void idt_int15(void)
  81. {
  82. print("!! Intel reserved int ");
  83. }
  84. void idt_int16(void)
  85. {
  86. print("!! Coprocessor error ");
  87. }
  88. void idt_int17(void)
  89. {
  90. print("!! Intel reserved (2) ");
  91. }
  92. void idt_int18(void)
  93. {
  94. print("i18 ");
  95. }
  96. /* Used by Channel0 timer */
  97. void idt_irq0(void)
  98. {
  99. ticks++;
  100. }
  101. void idt_irq2(void)
  102. {
  103. print("IRQ 2");
  104. }
  105. void idt_irq3(void)
  106. {
  107. print("IRQ 3");
  108. }
  109. void idt_irq4(void)
  110. {
  111. print("IRQ 4");
  112. }
  113. void idt_irq5(void)
  114. {
  115. print("IRQ 5");
  116. }
  117. void idt_irq6(void)
  118. {
  119. print("IRQ 6");
  120. }
  121. void idt_irq7(void)
  122. {
  123. print("IRQ 7");
  124. }
  125. void idt_irq8(void)
  126. {
  127. print("IRQ 8");
  128. }
  129. extern unsigned char kbdmap[];
  130. /* Keyboard irq is 1 */
  131. void kbd_int(void)
  132. {
  133. unsigned char i;
  134. do
  135. {
  136. i = inb(0x64);
  137. }
  138. while ((i & 0x01) == 0);
  139. i = inb(0x60);
  140. i--;
  141. if (i < 0x80)
  142. {
  143. putcar(kbdmap[i * 4]);
  144. }
  145. }