You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

186 lines
2.5 KiB

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