-
Notifications
You must be signed in to change notification settings - Fork 0
/
idt.asm
298 lines (280 loc) · 4.38 KB
/
idt.asm
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
extern interrupt_handler
isr_0:
cli
push 0
jmp isr_basic
isr_1:
cli
push 1
jmp isr_basic
isr_2:
cli
push 2
jmp isr_basic
isr_3:
cli
push 3
jmp isr_basic
isr_4:
cli
push 4
jmp isr_basic
isr_5:
cli
push 5
jmp isr_basic
isr_6:
cli
push 6
jmp isr_basic
isr_7:
cli
push 7
jmp isr_basic
isr_8:
cli
push 8
jmp isr_basic
isr_9:
cli
push 9
jmp isr_basic
isr_10:
cli
push 10
jmp isr_basic
isr_11:
cli
push 11
jmp isr_basic
isr_12:
cli
push 12
jmp isr_basic
isr_13:
cli
push 13
jmp isr_basic
isr_14:
cli
push 14
jmp isr_basic
isr_15:
cli
push 15
jmp isr_basic
isr_16:
cli
push 16
jmp isr_basic
isr_17:
cli
push 17
jmp isr_basic
isr_18:
cli
push 18
jmp isr_basic
isr_19:
cli
push 19
jmp isr_basic
isr_20:
cli
push 20
jmp isr_basic
isr_21:
cli
push 21
jmp isr_basic
isr_22:
cli
push 22
jmp isr_basic
isr_23:
cli
push 23
jmp isr_basic
isr_24:
cli
push 24
jmp isr_basic
isr_25:
cli
push 25
jmp isr_basic
isr_26:
cli
push 26
jmp isr_basic
isr_27:
cli
push 27
jmp isr_basic
isr_28:
cli
push 28
jmp isr_basic
isr_29:
cli
push 29
jmp isr_basic
isr_30:
cli
push 30
jmp isr_basic
isr_31:
cli
push 31
jmp isr_basic
isr_32:
; Part 1
cli ; step 1
pusha ; step 2
; step 3
mov eax, [esp + 32]
push eax
call scheduler ; step 4
;...;
; Part 2
; step 5
mov al, 0x20
out 0x20, al
; step 6
add esp, 40d
push run_next_process
iret ; step 7
isr_33:
cli
push 33
jmp irq_basic
isr_34:
cli
push 34
jmp irq_basic
isr_35:
cli
push 35
jmp irq_basic
isr_36:
cli
push 36
jmp irq_basic
isr_37:
cli
push 37
jmp irq_basic
isr_38:
cli
push 38
jmp irq_basic
isr_39:
cli
push 39
jmp irq_basic
isr_40:
cli
push 40
jmp irq_basic
isr_41:
cli
push 41
jmp irq_basic
isr_42:
cli
push 42
jmp irq_basic
isr_43:
cli
push 43
jmp irq_basic
isr_44:
cli
push 44
jmp irq_basic
isr_45:
cli
push 45
jmp irq_basic
isr_46:
cli
push 46
jmp irq_basic
isr_47:
cli
push 47
jmp irq_basic
isr_48:
cli
push 48
jmp irq_basic
isr_basic:
call interrupt_handler
pop eax
sti
iret
irq_basic:
call interrupt_handler
mov al, 0x20
out 0x20, al
cmp byte [esp], 40d
jnge irq_basic_end
mov al, 0xa0
out 0x20, al
irq_basic_end:
pop eax
sti
iret
idt:
dw isr_0, 8, 0x8e00, 0x0000
dw isr_1, 8, 0x8e00, 0x0000
dw isr_2, 8, 0x8e00, 0x0000
dw isr_3, 8, 0x8e00, 0x0000
dw isr_4, 8, 0x8e00, 0x0000
dw isr_5, 8, 0x8e00, 0x0000
dw isr_6, 8, 0x8e00, 0x0000
dw isr_7, 8, 0x8e00, 0x0000
dw isr_8, 8, 0x8e00, 0x0000
dw isr_9, 8, 0x8e00, 0x0000
dw isr_10, 8, 0x8e00, 0x0000
dw isr_11, 8, 0x8e00, 0x0000
dw isr_12, 8, 0x8e00, 0x0000
dw isr_13, 8, 0x8e00, 0x0000
dw isr_14, 8, 0x8e00, 0x0000
dw isr_15, 8, 0x8e00, 0x0000
dw isr_16, 8, 0x8e00, 0x0000
dw isr_17, 8, 0x8e00, 0x0000
dw isr_18, 8, 0x8e00, 0x0000
dw isr_19, 8, 0x8e00, 0x0000
dw isr_20, 8, 0x8e00, 0x0000
dw isr_21, 8, 0x8e00, 0x0000
dw isr_22, 8, 0x8e00, 0x0000
dw isr_23, 8, 0x8e00, 0x0000
dw isr_24, 8, 0x8e00, 0x0000
dw isr_25, 8, 0x8e00, 0x0000
dw isr_26, 8, 0x8e00, 0x0000
dw isr_27, 8, 0x8e00, 0x0000
dw isr_28, 8, 0x8e00, 0x0000
dw isr_29, 8, 0x8e00, 0x0000
dw isr_30, 8, 0x8e00, 0x0000
dw isr_31, 8, 0x8e00, 0x0000
dw isr_32, 8, 0x8e00, 0x0000
dw isr_33, 8, 0x8e00, 0x0000
dw isr_34, 8, 0x8e00, 0x0000
dw isr_35, 8, 0x8e00, 0x0000
dw isr_36, 8, 0x8e00, 0x0000
dw isr_37, 8, 0x8e00, 0x0000
dw isr_38, 8, 0x8e00, 0x0000
dw isr_39, 8, 0x8e00, 0x0000
dw isr_40, 8, 0x8e00, 0x0000
dw isr_41, 8, 0x8e00, 0x0000
dw isr_42, 8, 0x8e00, 0x0000
dw isr_43, 8, 0x8e00, 0x0000
dw isr_44, 8, 0x8e00, 0x0000
dw isr_45, 8, 0x8e00, 0x0000
dw isr_46, 8, 0x8e00, 0x0000
dw isr_47, 8, 0x8e00, 0x0000
dw isr_48, 8, 0x8e00, 0x0000
idtr:
idt_size_in_bytes : dw idtr - idt
idt_base_adderess : dd idt