Debian Codegraph @

kernel/boot/interruptions.c

raw
1 /*
2 * libcaca Colour ASCII-Art library
3 * Copyright (c) 2006 Sam Hocevar <[email protected]>
4 * 2009 Jean-Yves Lamoureux <[email protected]>
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://www.wtfpl.net/ for more details.
12 */
13
14
15 #include "kernel.h"
16 #include "klibc.h"
17 #include "drivers/timer.h"
18
19
20 void idt_default_int(void)
21 {
22 print("!! Unknown interrupt\n");
23 }
24
25 void idt_int0(void)
26 {
27 print("!! Divide by 0\n ");
28 }
29
30 void idt_int1(void)
31 {
32 print("!! Debug exception ");
33 }
34
35 void idt_int2(void)
36 {
37 print("!! NMI ");
38 }
39
40 void idt_int3(void)
41 {
42 print("!! Breakpoint ");
43 }
44
45 void idt_int4(void)
46 {
47 print("!! Overflow ");
48 }
49
50 void idt_int5(void)
51 {
52 print("!! BoundCheck ");
53 }
54
55 void idt_int6(void)
56 {
57 print("!! Invalid Opcode ");
58 }
59
60 void idt_int7(void)
61 {
62 print("!! Coprocessor not available ");
63 }
64
65 void idt_int8(void)
66 {
67 print("!! Double Fault ");
68 }
69
70 void idt_int9(void)
71 {
72 print("!! Coprocessor segment overrun ");
73 }
74
75 void idt_int10(void)
76 {
77 print("!! Invalid TSS ");
78 }
79
80 void idt_int11(void)
81 {
82 print("!! Segment not present ");
83 }
84
85 void idt_int12(void)
86 {
87 print("!! Stack exception ");
88 }
89
90 void idt_int13(void)
91 {
92 print("!! General protection exception ");
93 }
94
95 void idt_int14(void)
96 {
97 print("!! Page fault ");
98 }
99
100 void idt_int15(void)
101 {
102 print("!! Intel reserved int ");
103 }
104
105 void idt_int16(void)
106 {
107 print("!! Coprocessor error ");
108 }
109
110 void idt_int17(void)
111 {
112 print("!! Intel reserved (2) ");
113 }
114
115 void idt_int18(void)
116 {
117 print("i18 ");
118 }
119
120
121 /* Used by Channel0 timer */
122 void idt_irq0(void)
123 {
124 ticks++;
125 }
126
127 void idt_irq2(void)
128 {
129 print("IRQ 2");
130 }
131
132 void idt_irq3(void)
133 {
134 print("IRQ 3");
135 }
136
137 void idt_irq4(void)
138 {
139 print("IRQ 4");
140 }
141
142 void idt_irq5(void)
143 {
144 print("IRQ 5");
145 }
146
147 void idt_irq6(void)
148 {
149 print("IRQ 6");
150 }
151
152 void idt_irq7(void)
153 {
154 print("IRQ 7");
155 }
156
157 void idt_irq8(void)
158 {
159 print("IRQ 8");
160 }
161
162
163 extern unsigned char kbdmap[];
164
165 /* Keyboard irq is 1 */
166 void kbd_int(void)
167 {
168 unsigned char i;
169 do
170 {
171 i = inb(0x64);
172 }
173 while ((i & 0x01) == 0);
174
175 i = inb(0x60);
176 i--;
177
178 if (i < 0x80)
179 {
180 putcar(kbdmap[i * 4]);
181 }
182 }