summaryrefslogtreecommitdiff
path: root/arch/i386/boot/isr.s
blob: b5f8be5effb5062d91dba43465ac6070ccb387eb (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
.section .text

.macro isr_err_stub num
.global isr_stub_\num
.type isr_stub_\num, @function
isr_stub_\num:
        pushl $\num
        jmp isr_frame_asm
.endm
.macro isr_no_err_stub num
.global isr_stub_\num
.type isr_stub_\num, @function
isr_stub_\num:
        pushl $0
        pushl $\num
        jmp isr_frame_asm
.endm

isr_frame_asm:
        pushl %ebp
        movl %esp, %ebp
        pushl %eax
        pushl %ebx
        pushl %ecx
        pushl %ecx
        pushl %edx
        pushl %esi
        pushl %edi

        movl %cr0, %eax
        pushl %eax
        movl %cr2, %eax
        pushl %eax
        movl %cr3, %eax
        pushl %eax
        movl %cr4, %eax
        pushl %eax

        movw %ds, %ax
        pushl %eax
        pushl $0
        movw $0x10, %ax
        movw %ax, %ds
        movw %ax, %es
        movw %ax, %ss

        lea 0xC(%esp), %edi
        pushl %edi
        call exception_handler

        popl %eax
        popl %eax
        movw %ax, %ds
        movw %ax, %es

        popl %eax
        movl %eax, %cr4
        popl %eax
        movl %eax, %cr3
        popl %eax
        movl %eax, %cr2
        popl %eax
        movl %eax, %cr0

        popl %edi
        popl %esi
        popl %edx
        popl %ecx
        popl %ebx
        popl %eax

        popl %ebp
        add $0x10, %esp
        iret

isr_no_err_stub 0
isr_no_err_stub 1
isr_no_err_stub 2
isr_no_err_stub 3
isr_no_err_stub 4
isr_no_err_stub 5
isr_no_err_stub 6
isr_no_err_stub 7
isr_err_stub    8
isr_no_err_stub 9
isr_err_stub    10
isr_err_stub    11
isr_err_stub    12
isr_err_stub    13
isr_err_stub    14
isr_no_err_stub 15
isr_no_err_stub 16
isr_err_stub    17
isr_no_err_stub 18
isr_no_err_stub 19
isr_no_err_stub 20
isr_no_err_stub 21
isr_no_err_stub 22
isr_no_err_stub 23
isr_no_err_stub 24
isr_no_err_stub 25
isr_no_err_stub 26
isr_no_err_stub 27
isr_no_err_stub 28
isr_no_err_stub 29
isr_err_stub    30
isr_no_err_stub 31