14
|
1 ; The default interrupt handlers.
|
|
2 ; from 20 - 31 are reserved vectors.
|
|
3 ; below are the custom ones!
|
|
4
|
|
5 section .text
|
|
6 align 4
|
|
7
|
|
8 ; Port helpers:
|
|
9 global outb
|
|
10 outb:
|
|
11 mov eax, [esp + 8]
|
|
12 mov edx, [esp + 4]
|
|
13 out dx, al
|
|
14 ret
|
|
15
|
|
16 global inb
|
|
17 inb:
|
|
18 xor eax, eax
|
|
19 mov edx, [esp + 4]
|
|
20 in al, dx
|
|
21 ret
|
|
22
|
|
23 ; Helper functions:
|
|
24 global enableinterrupts
|
|
25 enableinterrupts:
|
|
26 sti
|
|
27 ret
|
|
28
|
|
29 global halt
|
|
30 halt:
|
|
31 cli
|
|
32 hlt
|
|
33
|
|
34 global loadIDT
|
|
35 loadIDT:
|
|
36 ret
|
|
37
|
|
38 ; Define macro with two arguments:
|
|
39 %macro INTX 2
|
|
40 global %1
|
|
41 %1:
|
|
42 ; Do some saving:
|
|
43 extern %2
|
|
44 call %2
|
|
45 ; Do restoration
|
|
46 iret
|
|
47
|
|
48 %endmacro
|
|
49
|
|
50 ; Exception handlers:
|
|
51 INTX INTDEF, INTDEF_handler
|
|
52 INTX INT0, INT0handler
|
|
53 INTX INT1, INT1handler
|
|
54 INTX INT2, INT2handler
|
|
55 INTX INT3, INT3handler
|
|
56 INTX INT4, INT4handler
|
|
57 INTX INT5, INT5handler
|
|
58 INTX INT6, INT6handler
|
|
59 INTX INT7, INT7handler
|
|
60 INTX INT8, INT8handler
|
|
61 INTX INT9, INT9handler
|
|
62 INTX INT10, INT10handler
|
|
63 INTX INT11, INT11handler
|
|
64 INTX INT12, INT12handler
|
|
65 INTX INT13, INT13handler
|
|
66 INTX INT14, INT14handler
|
|
67 INTX INT15, INT15handler
|
|
68 INTX INT16, INT16handler
|
|
69 INTX INT17, INT17handler
|
|
70 INTX INT18, INT18handler
|
|
71 INTX INT19, INT19handler
|
|
72
|
|
73 INTX INT32, INT32handler
|
|
74 INTX INT33, INT33handler
|
|
75 INTX INT34, INT34handler
|
|
76
|