Repository navigation
Expand file tree
/
Copy pathinterrupt-handler.c
More file actions
54 lines (41 loc) · 1.57 KB
/
Copy pathinterrupt-handler.c
File metadata and controls
54 lines (41 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "interrupt-handler.h"
#include "pic.h"
#include "utility.h"
#include "keyboard.h"
#include "console.h"
void kCommonExceptionHandler(int iVectorNumber, int qwErrorCode) {
char vcBuffer[3] = { 0 };
vcBuffer[0] = '0' + (iVectorNumber / 10);
vcBuffer[1] = '0' + (iVectorNumber % 10);
kPrintStringXY(0, 0, "==================================================");
kPrintStringXY(0, 1, "Exception Occur.");
kPrintStringXY(0, 2, "Vector: ");
kPrintStringXY(27, 2, vcBuffer);
kPrintStringXY(0, 3, "==================================================");
while(1);
}
void kCommonInterruptHandler(int iVectorNumber) {
char vcBuffer[] = "[INT: , ]";
static int g_iCommonInterruptCount = 0;
vcBuffer[5] = '0' + iVectorNumber / 10;
vcBuffer[6] = '0' + iVectorNumber % 10;
vcBuffer[8] = '0' + g_iCommonInterruptCount;
g_iCommonInterruptCount = (g_iCommonInterruptCount + 1) % 10;
kPrintStringXY(70, 0, vcBuffer);
kSendEOIToPIC(iVectorNumber - PIC_IRQSTARTVECTOR);
}
void kKeyboardHandler(int iVectorNumber) {
char vcBuffer[] = "[INT: , ]";
static int g_iKeyboardInterruptCount = 0;
BYTE bTemp;
vcBuffer[5] = '0' + iVectorNumber / 10;
vcBuffer[6] = '0' + iVectorNumber % 10;
vcBuffer[8] = '0' + g_iKeyboardInterruptCount;
g_iKeyboardInterruptCount = (g_iKeyboardInterruptCount + 1) % 10;
kPrintStringXY(0, 0, vcBuffer);
if (kIsOutputBufferFull()) {
bTemp = kGetKeyboardScanCode();
kConvertScanCodeAndPutQueue(bTemp);
}
kSendEOIToPIC(iVectorNumber - PIC_IRQSTARTVECTOR);
}