-
Notifications
You must be signed in to change notification settings - Fork 0
/
interrupt.s
231 lines (231 loc) · 3.42 KB
/
interrupt.s
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
.file "interrupt.c"
.section .rodata
.align 8
.LC0:
.string "kernel panic, run away interrupt on the loose"
.text
.globl def_int
.type def_int, @function
def_int:
.LFB2:
pushq %rbp
.LCFI0:
movq %rsp, %rbp
.LCFI1:
movl $.LC0, %edi
movl $0, %eax
call panic
leave
ret
.LFE2:
.size def_int, .-def_int
.globl isr_init
.type isr_init, @function
isr_init:
.LFB3:
pushq %rbp
.LCFI2:
movq %rsp, %rbp
.LCFI3:
movl $0, %eax
call idt_inst
#APP
int $0x80
#NO_APP
leave
ret
.LFE3:
.size isr_init, .-isr_init
.globl idt_inst
.type idt_inst, @function
idt_inst:
.LFB4:
pushq %rbp
.LCFI4:
movq %rsp, %rbp
.LCFI5:
movq $0, -16(%rbp)
movl $isr_start, %eax
movq %rax, -8(%rbp)
jmp .L6
.L7:
movq -16(%rbp), %rcx
movq -8(%rbp), %rax
movl %eax, %edx
movq %rcx, %rax
salq $4, %rax
movw %dx, idt(%rax)
movq -16(%rbp), %rax
salq $4, %rax
movw $24, idt+2(%rax)
movq -16(%rbp), %rax
salq $4, %rax
movb $0, idt+4(%rax)
movq -16(%rbp), %rax
salq $4, %rax
movb $-114, idt+5(%rax)
movq -16(%rbp), %rcx
movq -8(%rbp), %rax
shrq $16, %rax
movl %eax, %edx
movq %rcx, %rax
salq $4, %rax
movw %dx, idt+6(%rax)
movq -16(%rbp), %rcx
movq -8(%rbp), %rax
shrq $32, %rax
movl %eax, %edx
movq %rcx, %rax
salq $4, %rax
movl %edx, idt+8(%rax)
movq -16(%rbp), %rax
salq $4, %rax
movl $0, idt+12(%rax)
incq -16(%rbp)
movq isr_entry_size(%rip), %rax
addq %rax, -8(%rbp)
.L6:
cmpq $255, -16(%rbp)
jbe .L7
movw $4095, idtd(%rip)
movl $idt, %eax
movq %rax, idtd+2(%rip)
#APP
lidt idtd
#NO_APP
leave
ret
.LFE4:
.size idt_inst, .-idt_inst
.section .rodata
.LC1:
.string "Interrupt "
.LC2:
.string " called\n"
.text
.globl int_rcv
.type int_rcv, @function
int_rcv:
.LFB5:
pushq %rbp
.LCFI6:
movq %rsp, %rbp
.LCFI7:
subq $16, %rsp
.LCFI8:
movq %rdi, -8(%rbp)
movq %rsi, -16(%rbp)
movl $.LC1, %edi
movl $0, %eax
call cons_writes
movq -8(%rbp), %rdi
movl $0, %eax
call write_numd
movl $.LC2, %edi
movl $0, %eax
call cons_writes
#APP
hlt
#NO_APP
leave
ret
.LFE5:
.size int_rcv, .-int_rcv
.comm idt,4096,32
.section .eh_frame,"a",@progbits
.Lframe1:
.long .LECIE1-.LSCIE1
.LSCIE1:
.long 0x0
.byte 0x1
.string "zR"
.uleb128 0x1
.sleb128 -8
.byte 0x10
.uleb128 0x1
.byte 0x3
.byte 0xc
.uleb128 0x7
.uleb128 0x8
.byte 0x90
.uleb128 0x1
.align 8
.LECIE1:
.LSFDE1:
.long .LEFDE1-.LASFDE1
.LASFDE1:
.long .LASFDE1-.Lframe1
.long .LFB2
.long .LFE2-.LFB2
.uleb128 0x0
.byte 0x4
.long .LCFI0-.LFB2
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI1-.LCFI0
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE1:
.LSFDE3:
.long .LEFDE3-.LASFDE3
.LASFDE3:
.long .LASFDE3-.Lframe1
.long .LFB3
.long .LFE3-.LFB3
.uleb128 0x0
.byte 0x4
.long .LCFI2-.LFB3
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI3-.LCFI2
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE3:
.LSFDE5:
.long .LEFDE5-.LASFDE5
.LASFDE5:
.long .LASFDE5-.Lframe1
.long .LFB4
.long .LFE4-.LFB4
.uleb128 0x0
.byte 0x4
.long .LCFI4-.LFB4
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI5-.LCFI4
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE5:
.LSFDE7:
.long .LEFDE7-.LASFDE7
.LASFDE7:
.long .LASFDE7-.Lframe1
.long .LFB5
.long .LFE5-.LFB5
.uleb128 0x0
.byte 0x4
.long .LCFI6-.LFB5
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI7-.LCFI6
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE7:
.ident "GCC: (GNU) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)"
.section .note.GNU-stack,"",@progbits