blob: 3838048910028b2060197dd6e4cb93e98085670c (
plain)
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
55
56
57
58
59
60
61
62
63
|
.set IRQ_BASE, 0x20
.section .text
.extern handle_int
.global int_ignore
.macro handle_exception num
.global handle_exception\num
handle_exception\num:
movb $\num, (int_number)
movl $exch_\num, (int_handler)
jmp int_bottom
.endm
.macro handle_irq num
.global handle_irq\num
handle_irq\num:
movb $\num + IRQ_BASE, (int_number)
movl $irqh_\num, (int_handler)
jmp int_bottom
.endm
handle_irq 0x00
handle_irq 0x01
handle_exception 0x00
handle_exception 0x01
handle_exception 0x02
handle_exception 0x03
handle_exception 0x06
handle_exception 0x07
handle_exception 0x08
handle_exception 0x0D
int_ignore:
movb $0xFF, (int_number)
movl $0x00, (int_handler)
int_bottom:
cli
pushl %esp
push (int_number)
pushl (int_handler)
call handle_int
movl %eax, %esp // Set the stack pointer to the return value of handle_int
pop %eax
pop %eax
pop %eax
pop %eax
sti
hlt
.data
int_number: .byte 0
int_handler: .int 0
|