]>
Commit | Line | Data |
---|---|---|
5ffcd257 | 1 | #------------------------------------------------------------------------------\r |
2 | #*\r | |
b1f700a8 HT |
3 | #* Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r |
4 | #* This program and the accompanying materials \r | |
5ffcd257 | 5 | #* are licensed and made available under the terms and conditions of the BSD License \r |
6 | #* which accompanies this distribution. The full text of the license may be found at \r | |
7 | #* http://opensource.org/licenses/bsd-license.php \r | |
8 | #* \r | |
9 | #* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | #* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | #* \r | |
12 | #* CpuInterrupt.S\r | |
13 | #* \r | |
14 | #* Abstract:\r | |
15 | #*\r | |
16 | #------------------------------------------------------------------------------\r | |
17 | \r | |
18 | #PUBLIC SystemTimerHandler\r | |
19 | #PUBLIC SystemExceptionHandler\r | |
20 | #EXTERNDEF mExceptionCodeSize:DWORD\r | |
21 | \r | |
22 | #EXTERN TimerHandler: NEAR\r | |
23 | #EXTERN ExceptionHandler: NEAR\r | |
24 | #EXTERN mTimerVector: DWORD\r | |
25 | \r | |
b29a823d | 26 | .data\r |
27 | ASM_GLOBAL ASM_PFX(mExceptionCodeSize)\r | |
5ffcd257 | 28 | ASM_PFX(mExceptionCodeSize): .long 9\r |
29 | \r | |
b29a823d | 30 | .text\r |
31 | ASM_GLOBAL ASM_PFX(InitDescriptor)\r | |
5ffcd257 | 32 | \r |
6794a1b9 | 33 | ASM_PFX(InitDescriptor):\r |
5ffcd257 | 34 | movl $GDT_BASE,%eax # EAX=PHYSICAL address of gdt\r |
35 | movl %eax, gdtr + 2 # Put address of gdt into the gdtr\r | |
6794a1b9 | 36 | lgdt gdtr\r |
5ffcd257 | 37 | movl $IDT_BASE,%eax # EAX=PHYSICAL address of idt\r |
38 | movl %eax, idtr + 2 # Put address of idt into the idtr\r | |
6794a1b9 | 39 | lidt idtr\r |
40 | ret\r | |
41 | \r | |
5ffcd257 | 42 | # VOID\r |
43 | # InstallInterruptHandler (\r | |
44 | # UINTN Vector,\r | |
45 | # VOID (*Handler)(VOID)\r | |
46 | # )\r | |
b29a823d | 47 | ASM_GLOBAL ASM_PFX(InstallInterruptHandler)\r |
6794a1b9 | 48 | ASM_PFX(InstallInterruptHandler):\r |
5ffcd257 | 49 | # Vector:DWORD @ 4(%esp)\r |
50 | # Handler:DWORD @ 8(%esp)\r | |
51 | \r | |
52 | push %edi\r | |
53 | pushf # save eflags\r | |
6794a1b9 | 54 | cli # turn off interrupts\r |
5ffcd257 | 55 | subl $6,%esp # open some space on the stack\r |
56 | movl %esp,%edi\r | |
57 | sidt (%edi) # get fword address of IDT\r | |
58 | movl 2(%edi), %edi # move offset of IDT into EDI\r | |
59 | addl $6,%esp # correct stack\r | |
60 | movl 12(%esp),%eax # Get vector number\r | |
61 | shl $3,%eax # multiply by 8 to get offset\r | |
62 | addl %eax,%edi # add to IDT base to get entry\r | |
63 | movl 16(%esp),%eax # load new address into IDT entry\r | |
64 | movw %ax,(%edi) # write bits 15..0 of offset\r | |
65 | shrl $16,%eax # use ax to copy 31..16 to descriptors\r | |
66 | movw %ax,6(%edi) # write bits 31..16 of offset\r | |
67 | popf # restore flags (possible enabling interrupts)\r | |
6794a1b9 | 68 | pop %edi\r |
69 | ret\r | |
70 | \r | |
b29a823d | 71 | .macro JmpCommonIdtEntry\r |
5ffcd257 | 72 | # jmp commonIdtEntry - this must be hand coded to keep the assembler from\r |
73 | # using a 8 bit reletive jump when the entries are\r | |
74 | # within 255 bytes of the common entry. This must\r | |
75 | # be done to maintain the consistency of the size\r | |
76 | # of entry points...\r | |
77 | .byte 0xe9 # jmp 16 bit reletive \r | |
78 | .long commonIdtEntry - . - 4 # offset to jump to\r | |
b29a823d | 79 | .endm\r |
5ffcd257 | 80 | \r |
9811c392 | 81 | .p2align 1\r |
b29a823d | 82 | ASM_GLOBAL ASM_PFX(SystemExceptionHandler)\r |
6794a1b9 | 83 | ASM_PFX(SystemExceptionHandler):\r |
84 | INT0:\r | |
5ffcd257 | 85 | pushl $0x0 # push error code place holder on the stack\r |
86 | pushl $0x0 \r | |
87 | JmpCommonIdtEntry\r | |
88 | # db 0e9h # jmp 16 bit reletive \r | |
89 | # dd commonIdtEntry - $ - 4 # offset to jump to\r | |
90 | \r | |
6794a1b9 | 91 | INT1:\r |
5ffcd257 | 92 | pushl $0x0 # push error code place holder on the stack\r |
93 | pushl $0x1 \r | |
94 | JmpCommonIdtEntry\r | |
95 | \r | |
6794a1b9 | 96 | INT2:\r |
5ffcd257 | 97 | pushl $0x0 # push error code place holder on the stack\r |
98 | pushl $0x2 \r | |
99 | JmpCommonIdtEntry\r | |
100 | \r | |
6794a1b9 | 101 | INT3:\r |
5ffcd257 | 102 | pushl $0x0 # push error code place holder on the stack\r |
103 | pushl $0x3 \r | |
104 | JmpCommonIdtEntry\r | |
105 | \r | |
6794a1b9 | 106 | INT4:\r |
5ffcd257 | 107 | pushl $0x0 # push error code place holder on the stack\r |
108 | pushl $0x4 \r | |
109 | JmpCommonIdtEntry\r | |
110 | \r | |
6794a1b9 | 111 | INT5:\r |
5ffcd257 | 112 | pushl $0x0 # push error code place holder on the stack\r |
113 | pushl $0x5 \r | |
114 | JmpCommonIdtEntry\r | |
115 | \r | |
6794a1b9 | 116 | INT6:\r |
5ffcd257 | 117 | pushl $0x0 # push error code place holder on the stack\r |
118 | pushl $0x6 \r | |
119 | JmpCommonIdtEntry\r | |
120 | \r | |
6794a1b9 | 121 | INT7:\r |
5ffcd257 | 122 | pushl $0x0 # push error code place holder on the stack\r |
123 | pushl $0x7 \r | |
124 | JmpCommonIdtEntry\r | |
125 | \r | |
6794a1b9 | 126 | INT8:\r |
5ffcd257 | 127 | # Double fault causes an error code to be pushed so no phony push necessary\r |
6794a1b9 | 128 | nop\r |
129 | nop\r | |
5ffcd257 | 130 | pushl $0x8 \r |
131 | JmpCommonIdtEntry\r | |
132 | \r | |
6794a1b9 | 133 | INT9:\r |
5ffcd257 | 134 | pushl $0x0 # push error code place holder on the stack\r |
135 | pushl $0x9 \r | |
136 | JmpCommonIdtEntry\r | |
137 | \r | |
6794a1b9 | 138 | INT10:\r |
5ffcd257 | 139 | # Invalid TSS causes an error code to be pushed so no phony push necessary\r |
6794a1b9 | 140 | nop\r |
141 | nop\r | |
142 | pushl $10\r | |
5ffcd257 | 143 | JmpCommonIdtEntry\r |
144 | \r | |
6794a1b9 | 145 | INT11:\r |
5ffcd257 | 146 | # Segment Not Present causes an error code to be pushed so no phony push necessary\r |
6794a1b9 | 147 | nop\r |
148 | nop\r | |
149 | pushl $11\r | |
5ffcd257 | 150 | JmpCommonIdtEntry\r |
151 | \r | |
6794a1b9 | 152 | INT12:\r |
5ffcd257 | 153 | # Stack fault causes an error code to be pushed so no phony push necessary\r |
6794a1b9 | 154 | nop\r |
155 | nop\r | |
156 | pushl $12\r | |
5ffcd257 | 157 | JmpCommonIdtEntry\r |
158 | \r | |
6794a1b9 | 159 | INT13:\r |
5ffcd257 | 160 | # GP fault causes an error code to be pushed so no phony push necessary\r |
6794a1b9 | 161 | nop\r |
162 | nop\r | |
163 | pushl $13\r | |
5ffcd257 | 164 | JmpCommonIdtEntry\r |
165 | \r | |
6794a1b9 | 166 | INT14:\r |
5ffcd257 | 167 | # Page fault causes an error code to be pushed so no phony push necessary\r |
6794a1b9 | 168 | nop\r |
169 | nop\r | |
170 | pushl $14\r | |
5ffcd257 | 171 | JmpCommonIdtEntry\r |
172 | \r | |
6794a1b9 | 173 | INT15:\r |
5ffcd257 | 174 | pushl $0x0 # push error code place holder on the stack\r |
175 | pushl $15\r | |
176 | JmpCommonIdtEntry\r | |
177 | \r | |
6794a1b9 | 178 | INT16:\r |
5ffcd257 | 179 | pushl $0x0 # push error code place holder on the stack\r |
180 | pushl $16\r | |
181 | JmpCommonIdtEntry\r | |
182 | \r | |
6794a1b9 | 183 | INT17:\r |
5ffcd257 | 184 | # Alignment check causes an error code to be pushed so no phony push necessary\r |
6794a1b9 | 185 | nop\r |
186 | nop\r | |
187 | pushl $17\r | |
5ffcd257 | 188 | JmpCommonIdtEntry\r |
189 | \r | |
6794a1b9 | 190 | INT18:\r |
5ffcd257 | 191 | pushl $0x0 # push error code place holder on the stack\r |
192 | pushl $18\r | |
193 | JmpCommonIdtEntry\r | |
194 | \r | |
6794a1b9 | 195 | INT19:\r |
5ffcd257 | 196 | pushl $0x0 # push error code place holder on the stack\r |
197 | pushl $19\r | |
198 | JmpCommonIdtEntry\r | |
6794a1b9 | 199 | \r |
5ffcd257 | 200 | INTUnknown:\r |
208628f8 | 201 | # The following segment repeats (32 - 20) times:\r |
202 | # No. 1\r | |
5ffcd257 | 203 | pushl $0x0 # push error code place holder on the stack\r |
204 | # push xxh # push vector number\r | |
205 | .byte 0x6a\r | |
206 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
207 | JmpCommonIdtEntry\r | |
208628f8 | 208 | # No. 2\r |
209 | pushl $0x0 # push error code place holder on the stack\r | |
210 | # push xxh # push vector number\r | |
211 | .byte 0x6a\r | |
212 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
213 | JmpCommonIdtEntry\r | |
214 | # No. 3\r | |
215 | pushl $0x0 # push error code place holder on the stack\r | |
216 | # push xxh # push vector number\r | |
217 | .byte 0x6a\r | |
218 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
219 | JmpCommonIdtEntry\r | |
220 | # No. 4\r | |
221 | pushl $0x0 # push error code place holder on the stack\r | |
222 | # push xxh # push vector number\r | |
223 | .byte 0x6a\r | |
224 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
225 | JmpCommonIdtEntry\r | |
226 | # No. 5\r | |
227 | pushl $0x0 # push error code place holder on the stack\r | |
228 | # push xxh # push vector number\r | |
229 | .byte 0x6a\r | |
230 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
231 | JmpCommonIdtEntry\r | |
232 | # No. 6\r | |
233 | pushl $0x0 # push error code place holder on the stack\r | |
234 | # push xxh # push vector number\r | |
235 | .byte 0x6a\r | |
236 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
237 | JmpCommonIdtEntry\r | |
238 | # No. 7\r | |
239 | pushl $0x0 # push error code place holder on the stack\r | |
240 | # push xxh # push vector number\r | |
241 | .byte 0x6a\r | |
242 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
243 | JmpCommonIdtEntry\r | |
244 | # No. 8\r | |
245 | pushl $0x0 # push error code place holder on the stack\r | |
246 | # push xxh # push vector number\r | |
247 | .byte 0x6a\r | |
248 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
249 | JmpCommonIdtEntry\r | |
250 | # No. 9\r | |
251 | pushl $0x0 # push error code place holder on the stack\r | |
252 | # push xxh # push vector number\r | |
253 | .byte 0x6a\r | |
254 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
255 | JmpCommonIdtEntry\r | |
256 | # No. 10\r | |
257 | pushl $0x0 # push error code place holder on the stack\r | |
258 | # push xxh # push vector number\r | |
259 | .byte 0x6a\r | |
260 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
261 | JmpCommonIdtEntry\r | |
262 | # No. 11\r | |
263 | pushl $0x0 # push error code place holder on the stack\r | |
264 | # push xxh # push vector number\r | |
265 | .byte 0x6a\r | |
266 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
267 | JmpCommonIdtEntry\r | |
268 | # No. 12\r | |
269 | pushl $0x0 # push error code place holder on the stack\r | |
270 | # push xxh # push vector number\r | |
271 | .byte 0x6a\r | |
272 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
273 | JmpCommonIdtEntry\r | |
274 | \r | |
5ffcd257 | 275 | \r |
b29a823d | 276 | ASM_GLOBAL ASM_PFX(SystemTimerHandler)\r |
6794a1b9 | 277 | ASM_PFX(SystemTimerHandler):\r |
5ffcd257 | 278 | pushl $0\r |
01f1138a | 279 | pushl $ASM_PFX(mTimerVector)\r |
5ffcd257 | 280 | JmpCommonIdtEntry\r |
6794a1b9 | 281 | \r |
282 | commonIdtEntry:\r | |
283 | # +---------------------+\r | |
284 | # + EFlags +\r | |
285 | # +---------------------+\r | |
286 | # + CS +\r | |
287 | # +---------------------+\r | |
288 | # + EIP +\r | |
289 | # +---------------------+\r | |
290 | # + Error Code +\r | |
291 | # +---------------------+\r | |
292 | # + Vector Number +\r | |
293 | # +---------------------+\r | |
294 | # + EBP +\r | |
295 | # +---------------------+ <-- EBP\r | |
296 | \r | |
297 | cli\r | |
5ffcd257 | 298 | push %ebp\r |
299 | movl %esp,%ebp\r | |
6794a1b9 | 300 | \r |
301 | #\r | |
302 | # Align stack to make sure that EFI_FX_SAVE_STATE_IA32 of EFI_SYSTEM_CONTEXT_IA32\r | |
303 | # is 16-byte aligned\r | |
304 | #\r | |
5ffcd257 | 305 | andl $0xfffffff0,%esp\r |
306 | subl $12,%esp\r | |
6794a1b9 | 307 | \r |
308 | ## UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax#\r | |
5ffcd257 | 309 | push %eax\r |
310 | push %ecx\r | |
311 | push %edx\r | |
312 | push %ebx\r | |
313 | leal 6*4(%ebp),%ecx\r | |
314 | push %ecx # ESP\r | |
315 | push (%ebp) # EBP\r | |
316 | push %esi\r | |
317 | push %edi\r | |
6794a1b9 | 318 | \r |
319 | ## UINT32 Gs, Fs, Es, Ds, Cs, Ss#\r | |
5ffcd257 | 320 | movw %ss,%ax\r |
321 | push %eax\r | |
322 | movzx 4*4(%ebp),%eax\r | |
323 | push %eax\r | |
324 | movw %ds,%ax\r | |
325 | push %eax\r | |
326 | movw %es,%ax\r | |
327 | push %eax\r | |
328 | movw %fs,%ax\r | |
329 | push %eax\r | |
330 | movw %gs,%ax\r | |
331 | push %eax\r | |
6794a1b9 | 332 | \r |
333 | ## UINT32 Eip#\r | |
5ffcd257 | 334 | pushl 3*4(%ebp)\r |
6794a1b9 | 335 | \r |
336 | ## UINT32 Gdtr[2], Idtr[2]#\r | |
5ffcd257 | 337 | subl $8,%esp\r |
338 | sidt (%esp)\r | |
339 | subl $8,%esp\r | |
340 | sgdt (%esp)\r | |
6794a1b9 | 341 | \r |
342 | ## UINT32 Ldtr, Tr#\r | |
5ffcd257 | 343 | xorl %eax, %eax\r |
344 | str %ax\r | |
345 | push %eax\r | |
346 | sldt %eax\r | |
347 | push %eax\r | |
6794a1b9 | 348 | \r |
349 | ## UINT32 EFlags#\r | |
5ffcd257 | 350 | pushl 5*4(%ebp)\r |
6794a1b9 | 351 | \r |
352 | ## UINT32 Cr0, Cr1, Cr2, Cr3, Cr4#\r | |
5ffcd257 | 353 | mov %cr4,%eax\r |
354 | orl $0x208,%eax\r | |
355 | mov %eax,%cr4\r | |
356 | push %eax\r | |
357 | mov %cr3,%eax\r | |
358 | push %eax\r | |
359 | mov %cr2,%eax\r | |
360 | push %eax\r | |
361 | xor %eax, %eax\r | |
362 | push %eax\r | |
363 | mov %cr0,%eax\r | |
364 | push %eax\r | |
6794a1b9 | 365 | \r |
366 | ## UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7#\r | |
5ffcd257 | 367 | mov %dr7,%eax\r |
368 | push %eax\r | |
6794a1b9 | 369 | ## clear Dr7 while executing debugger itself\r |
5ffcd257 | 370 | xor %eax, %eax\r |
371 | mov %eax,%dr7\r | |
6794a1b9 | 372 | \r |
5ffcd257 | 373 | mov %dr6,%eax\r |
374 | push %eax\r | |
6794a1b9 | 375 | ## insure all status bits in dr6 are clear...\r |
5ffcd257 | 376 | xor %eax, %eax\r |
377 | mov %eax,%dr6\r | |
378 | \r | |
379 | mov %dr3,%eax\r | |
380 | push %eax\r | |
381 | mov %dr2,%eax\r | |
382 | push %eax\r | |
383 | mov %dr1,%eax\r | |
384 | push %eax\r | |
385 | mov %dr0,%eax\r | |
386 | push %eax\r | |
387 | \r | |
388 | ## FX_SAVE_STATE_IA32 FxSaveState;\r | |
389 | sub $512,%esp\r | |
390 | mov %esp,%edi\r | |
6794a1b9 | 391 | fxsave (%edi)\r |
5ffcd257 | 392 | \r |
393 | ## UINT32 ExceptionData;\r | |
6794a1b9 | 394 | pushl 2*4(%ebp)\r |
395 | \r | |
396 | ## Prepare parameter and call\r | |
5ffcd257 | 397 | mov %esp,%edx\r |
398 | push %edx\r | |
399 | mov 1*4(%ebp),%eax\r | |
400 | push %eax\r | |
401 | cmpl $32,%eax\r | |
6794a1b9 | 402 | jb CallException\r |
01f1138a | 403 | call ASM_PFX(TimerHandler)\r |
6794a1b9 | 404 | jmp ExceptionDone\r |
405 | CallException:\r | |
01f1138a | 406 | call ASM_PFX(ExceptionHandler)\r |
6794a1b9 | 407 | ExceptionDone:\r |
5ffcd257 | 408 | addl $8,%esp\r |
6794a1b9 | 409 | \r |
410 | cli\r | |
5ffcd257 | 411 | ## UINT32 ExceptionData;\r |
412 | addl $4,%esp\r | |
413 | \r | |
414 | ## FX_SAVE_STATE_IA32 FxSaveState;\r | |
415 | mov %esp,%esi\r | |
416 | fxrstor (%esi)\r | |
417 | addl $512,%esp\r | |
418 | \r | |
419 | #; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r | |
420 | pop %eax\r | |
421 | mov %eax,%dr0\r | |
422 | pop %eax\r | |
423 | mov %eax,%dr1\r | |
424 | pop %eax\r | |
425 | mov %eax,%dr2\r | |
426 | pop %eax\r | |
427 | mov %eax,%dr3\r | |
6794a1b9 | 428 | ## skip restore of dr6. We cleared dr6 during the context save.\r |
5ffcd257 | 429 | addl $4,%esp\r |
430 | pop %eax\r | |
431 | mov %eax,%dr7\r | |
432 | \r | |
433 | ## UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;\r | |
434 | pop %eax\r | |
435 | mov %eax,%cr0\r | |
436 | addl $4,%esp # not for Cr1\r | |
437 | pop %eax\r | |
438 | mov %eax,%cr2\r | |
439 | pop %eax\r | |
440 | mov %eax,%cr3\r | |
441 | pop %eax\r | |
442 | mov %eax,%cr4\r | |
443 | \r | |
444 | ## UINT32 EFlags;\r | |
445 | popl 5*4(%ebp)\r | |
446 | \r | |
447 | ## UINT32 Ldtr, Tr;\r | |
448 | ## UINT32 Gdtr[2], Idtr[2];\r | |
6794a1b9 | 449 | ## Best not let anyone mess with these particular registers...\r |
5ffcd257 | 450 | addl $24,%esp\r |
6794a1b9 | 451 | \r |
5ffcd257 | 452 | ## UINT32 Eip;\r |
453 | popl 3*4(%ebp)\r | |
6794a1b9 | 454 | \r |
5ffcd257 | 455 | ## UINT32 Gs, Fs, Es, Ds, Cs, Ss;\r |
6794a1b9 | 456 | ## NOTE - modified segment registers could hang the debugger... We\r |
457 | ## could attempt to insulate ourselves against this possibility,\r | |
458 | ## but that poses risks as well.\r | |
459 | ##\r | |
5ffcd257 | 460 | pop %gs\r |
461 | pop %fs\r | |
462 | pop %es\r | |
463 | pop %ds\r | |
6794a1b9 | 464 | popl 4*4(%ebp)\r |
5ffcd257 | 465 | pop %ss\r |
6794a1b9 | 466 | \r |
5ffcd257 | 467 | ## UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;\r |
468 | pop %edi\r | |
469 | pop %esi\r | |
470 | addl $4,%esp # not for ebp\r | |
471 | addl $4,%esp # not for esp\r | |
472 | pop %ebx\r | |
473 | pop %edx\r | |
474 | pop %ecx\r | |
475 | pop %eax\r | |
476 | \r | |
477 | mov %ebp,%esp\r | |
478 | pop %ebp\r | |
479 | addl $8,%esp\r | |
480 | iret\r | |
481 | \r | |
482 | \r | |
483 | #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r | |
6794a1b9 | 484 | # data\r |
5ffcd257 | 485 | #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r |
6794a1b9 | 486 | \r |
b29a823d | 487 | .data\r |
9811c392 | 488 | .p2align 2\r |
5ffcd257 | 489 | \r |
b29a823d | 490 | gdtr: .short GDT_END - GDT_BASE - 1 # GDT limit\r |
5ffcd257 | 491 | .long 0 # (GDT base gets set above)\r |
492 | #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r | |
6794a1b9 | 493 | # global descriptor table (GDT)\r |
5ffcd257 | 494 | #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r |
6794a1b9 | 495 | \r |
9811c392 | 496 | .p2align 2\r |
6794a1b9 | 497 | \r |
6794a1b9 | 498 | GDT_BASE:\r |
5ffcd257 | 499 | # null descriptor\r |
500 | NULL_SEL = .-GDT_BASE\r | |
501 | .short 0 # limit 15:0\r | |
502 | .short 0 # base 15:0\r | |
01f1138a | 503 | .byte 0 # base 23:16\r |
504 | .byte 0 # type\r | |
505 | .byte 0 # limit 19:16, flags\r | |
506 | .byte 0 # base 31:24\r | |
5ffcd257 | 507 | \r |
508 | # linear data segment descriptor\r | |
509 | LINEAR_SEL = .-GDT_BASE\r | |
510 | .short 0x0FFFF # limit 0xFFFFF\r | |
01f1138a | 511 | .short 0 # base 0\r |
5ffcd257 | 512 | .byte 0\r |
01f1138a | 513 | .byte 0x092 # present, ring 0, data, expand-up, writable\r |
514 | .byte 0x0CF # page-granular, 32-bit\r | |
5ffcd257 | 515 | .byte 0\r |
516 | \r | |
517 | # linear code segment descriptor\r | |
518 | LINEAR_CODE_SEL = .-GDT_BASE\r | |
519 | .short 0x0FFFF # limit 0xFFFFF\r | |
01f1138a | 520 | .short 0 # base 0\r |
5ffcd257 | 521 | .byte 0\r |
01f1138a | 522 | .byte 0x09A # present, ring 0, data, expand-up, writable\r |
523 | .byte 0x0CF # page-granular, 32-bit\r | |
5ffcd257 | 524 | .byte 0\r |
525 | \r | |
526 | # system data segment descriptor\r | |
527 | SYS_DATA_SEL = .-GDT_BASE\r | |
528 | .short 0x0FFFF # limit 0xFFFFF\r | |
01f1138a | 529 | .short 0 # base 0\r |
5ffcd257 | 530 | .byte 0\r |
01f1138a | 531 | .byte 0x092 # present, ring 0, data, expand-up, writable\r |
532 | .byte 0x0CF # page-granular, 32-bit\r | |
5ffcd257 | 533 | .byte 0\r |
534 | \r | |
535 | # system code segment descriptor\r | |
536 | SYS_CODE_SEL = .-GDT_BASE\r | |
537 | .short 0x0FFFF # limit 0xFFFFF\r | |
01f1138a | 538 | .short 0 # base 0\r |
5ffcd257 | 539 | .byte 0\r |
01f1138a | 540 | .byte 0x09A # present, ring 0, data, expand-up, writable\r |
541 | .byte 0x0CF # page-granular, 32-bit\r | |
5ffcd257 | 542 | .byte 0\r |
543 | \r | |
544 | # spare segment descriptor\r | |
545 | SPARE3_SEL = .-GDT_BASE\r | |
546 | .short 0 # limit 0xFFFFF\r | |
547 | .short 0 # base 0\r | |
548 | .byte 0\r | |
01f1138a | 549 | .byte 0 # present, ring 0, data, expand-up, writable\r |
550 | .byte 0 # page-granular, 32-bit\r | |
5ffcd257 | 551 | .byte 0\r |
552 | \r | |
553 | # spare segment descriptor\r | |
554 | SPARE4_SEL = .-GDT_BASE\r | |
555 | .short 0 # limit 0xFFFFF\r | |
556 | .short 0 # base 0\r | |
557 | .byte 0\r | |
01f1138a | 558 | .byte 0 # present, ring 0, data, expand-up, writable\r |
559 | .byte 0 # page-granular, 32-bit\r | |
5ffcd257 | 560 | .byte 0\r |
561 | \r | |
562 | # spare segment descriptor\r | |
563 | SPARE5_SEL = .-GDT_BASE\r | |
564 | .short 0 # limit 0xFFFFF\r | |
565 | .short 0 # base 0\r | |
566 | .byte 0\r | |
01f1138a | 567 | .byte 0 # present, ring 0, data, expand-up, writable\r |
568 | .byte 0 # page-granular, 32-bit\r | |
5ffcd257 | 569 | .byte 0\r |
570 | \r | |
571 | GDT_END:\r | |
572 | \r | |
9811c392 | 573 | .p2align 2\r |
5ffcd257 | 574 | \r |
575 | \r | |
576 | \r | |
b29a823d | 577 | idtr: .short IDT_END - IDT_BASE - 1 # IDT limit\r |
01f1138a | 578 | .long 0 # (IDT base gets set above)\r |
5ffcd257 | 579 | #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r |
6794a1b9 | 580 | # interrupt descriptor table (IDT)\r |
581 | #\r | |
582 | # Note: The hardware IRQ's specified in this table are the normal PC/AT IRQ\r | |
583 | # mappings. This implementation only uses the system timer and all other\r | |
584 | # IRQs will remain masked. The descriptors for vectors 33+ are provided\r | |
585 | # for convenience.\r | |
5ffcd257 | 586 | #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r |
6794a1b9 | 587 | \r |
5ffcd257 | 588 | #idt_tag .byte "IDT",0 \r |
9811c392 | 589 | .p2align 2\r |
6794a1b9 | 590 | \r |
591 | IDT_BASE:\r | |
6794a1b9 | 592 | # divide by zero (INT 0)\r |
5ffcd257 | 593 | DIV_ZERO_SEL = .-IDT_BASE\r |
594 | .short 0 # offset 15:0\r | |
595 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 596 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 597 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
598 | .short 0 # offset 31:16\r | |
6794a1b9 | 599 | \r |
600 | # debug exception (INT 1)\r | |
5ffcd257 | 601 | DEBUG_EXCEPT_SEL = .-IDT_BASE\r |
602 | .short 0 # offset 15:0\r | |
603 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 604 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 605 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
606 | .short 0 # offset 31:16\r | |
6794a1b9 | 607 | \r |
608 | # NMI (INT 2)\r | |
5ffcd257 | 609 | NMI_SEL = .-IDT_BASE\r |
610 | .short 0 # offset 15:0\r | |
611 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 612 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 613 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
614 | .short 0 # offset 31:16\r | |
6794a1b9 | 615 | \r |
616 | # soft breakpoint (INT 3)\r | |
5ffcd257 | 617 | BREAKPOINT_SEL = .-IDT_BASE\r |
618 | .short 0 # offset 15:0\r | |
619 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 620 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 621 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
622 | .short 0 # offset 31:16\r | |
6794a1b9 | 623 | \r |
624 | # overflow (INT 4)\r | |
5ffcd257 | 625 | OVERFLOW_SEL = .-IDT_BASE\r |
626 | .short 0 # offset 15:0\r | |
627 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 628 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 629 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
630 | .short 0 # offset 31:16\r | |
6794a1b9 | 631 | \r |
632 | # bounds check (INT 5)\r | |
5ffcd257 | 633 | BOUNDS_CHECK_SEL = .-IDT_BASE\r |
634 | .short 0 # offset 15:0\r | |
635 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 636 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 637 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
638 | .short 0 # offset 31:16\r | |
6794a1b9 | 639 | \r |
640 | # invalid opcode (INT 6)\r | |
5ffcd257 | 641 | INVALID_OPCODE_SEL = .-IDT_BASE\r |
642 | .short 0 # offset 15:0\r | |
643 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 644 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 645 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
646 | .short 0 # offset 31:16\r | |
6794a1b9 | 647 | \r |
648 | # device not available (INT 7)\r | |
5ffcd257 | 649 | DEV_NOT_AVAIL_SEL = .-IDT_BASE\r |
650 | .short 0 # offset 15:0\r | |
651 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 652 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 653 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
654 | .short 0 # offset 31:16\r | |
6794a1b9 | 655 | \r |
656 | # double fault (INT 8)\r | |
5ffcd257 | 657 | DOUBLE_FAULT_SEL = .-IDT_BASE\r |
658 | .short 0 # offset 15:0\r | |
659 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 660 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 661 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
662 | .short 0 # offset 31:16\r | |
6794a1b9 | 663 | \r |
664 | # Coprocessor segment overrun - reserved (INT 9)\r | |
5ffcd257 | 665 | RSVD_INTR_SEL1 = .-IDT_BASE\r |
666 | .short 0 # offset 15:0\r | |
667 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 668 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 669 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
670 | .short 0 # offset 31:16\r | |
6794a1b9 | 671 | \r |
672 | # invalid TSS (INT 0ah)\r | |
5ffcd257 | 673 | INVALID_TSS_SEL = .-IDT_BASE\r |
674 | .short 0 # offset 15:0\r | |
675 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 676 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 677 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
678 | .short 0 # offset 31:16\r | |
6794a1b9 | 679 | \r |
680 | # segment not present (INT 0bh)\r | |
5ffcd257 | 681 | SEG_NOT_PRESENT_SEL = .-IDT_BASE\r |
682 | .short 0 # offset 15:0\r | |
683 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 684 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 685 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
686 | .short 0 # offset 31:16\r | |
6794a1b9 | 687 | \r |
688 | # stack fault (INT 0ch)\r | |
5ffcd257 | 689 | STACK_FAULT_SEL = .-IDT_BASE\r |
690 | .short 0 # offset 15:0\r | |
691 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 692 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 693 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
694 | .short 0 # offset 31:16\r | |
6794a1b9 | 695 | \r |
696 | # general protection (INT 0dh)\r | |
5ffcd257 | 697 | GP_FAULT_SEL = .-IDT_BASE\r |
698 | .short 0 # offset 15:0\r | |
699 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 700 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 701 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
702 | .short 0 # offset 31:16\r | |
6794a1b9 | 703 | \r |
704 | # page fault (INT 0eh)\r | |
5ffcd257 | 705 | PAGE_FAULT_SEL = .-IDT_BASE\r |
706 | .short 0 # offset 15:0\r | |
707 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 708 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 709 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
710 | .short 0 # offset 31:16\r | |
6794a1b9 | 711 | \r |
712 | # Intel reserved - do not use (INT 0fh)\r | |
5ffcd257 | 713 | RSVD_INTR_SEL2 = .-IDT_BASE\r |
714 | .short 0 # offset 15:0\r | |
715 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 716 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 717 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
718 | .short 0 # offset 31:16\r | |
719 | \r | |
720 | # floating point error (INT 0x10)\r | |
721 | FLT_POINT_ERR_SEL = .-IDT_BASE\r | |
722 | .short 0 # offset 15:0\r | |
723 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 724 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 725 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r |
726 | .short 0 # offset 31:16\r | |
727 | \r | |
728 | # alignment check (INT 0x11)\r | |
729 | ALIGNMENT_CHECK_SEL = .-IDT_BASE\r | |
730 | .short 0 # offset 15:0\r | |
731 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 732 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 733 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
734 | .short 0 # offset 31:16\r | |
735 | \r | |
736 | # machine check (INT 0x12)\r | |
737 | MACHINE_CHECK_SEL = .-IDT_BASE\r | |
738 | .short 0 # offset 15:0\r | |
739 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 740 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 741 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
742 | .short 0 # offset 31:16\r | |
743 | \r | |
744 | # SIMD floating-point exception (INT 0x13)\r | |
745 | SIMD_EXCEPTION_SEL = .-IDT_BASE\r | |
746 | .short 0 # offset 15:0\r | |
747 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 748 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 749 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
750 | .short 0 # offset 31:16\r | |
751 | \r | |
208628f8 | 752 | # The following segment repeats (32 - 20) times:\r |
753 | # No. 1\r | |
5ffcd257 | 754 | .short 0 # offset 15:0\r |
755 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 756 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 757 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
758 | .short 0 # offset 31:16\r | |
208628f8 | 759 | # No. 2\r |
760 | .short 0 # offset 15:0\r | |
761 | .short SYS_CODE_SEL # selector 15:0\r | |
762 | .byte 0 # 0 for interrupt gate\r | |
763 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
764 | .short 0 # offset 31:16\r | |
765 | # No. 3\r | |
766 | .short 0 # offset 15:0\r | |
767 | .short SYS_CODE_SEL # selector 15:0\r | |
768 | .byte 0 # 0 for interrupt gate\r | |
769 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
770 | .short 0 # offset 31:16\r | |
771 | # No. 4\r | |
772 | .short 0 # offset 15:0\r | |
773 | .short SYS_CODE_SEL # selector 15:0\r | |
774 | .byte 0 # 0 for interrupt gate\r | |
775 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
776 | .short 0 # offset 31:16\r | |
777 | # No. 5\r | |
778 | .short 0 # offset 15:0\r | |
779 | .short SYS_CODE_SEL # selector 15:0\r | |
780 | .byte 0 # 0 for interrupt gate\r | |
781 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
782 | .short 0 # offset 31:16\r | |
783 | # No. 6\r | |
784 | .short 0 # offset 15:0\r | |
785 | .short SYS_CODE_SEL # selector 15:0\r | |
786 | .byte 0 # 0 for interrupt gate\r | |
787 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
788 | .short 0 # offset 31:16\r | |
789 | # No. 7\r | |
790 | .short 0 # offset 15:0\r | |
791 | .short SYS_CODE_SEL # selector 15:0\r | |
792 | .byte 0 # 0 for interrupt gate\r | |
793 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
794 | .short 0 # offset 31:16\r | |
795 | # No. 8\r | |
796 | .short 0 # offset 15:0\r | |
797 | .short SYS_CODE_SEL # selector 15:0\r | |
798 | .byte 0 # 0 for interrupt gate\r | |
799 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
800 | .short 0 # offset 31:16\r | |
801 | # No. 9\r | |
802 | .short 0 # offset 15:0\r | |
803 | .short SYS_CODE_SEL # selector 15:0\r | |
804 | .byte 0 # 0 for interrupt gate\r | |
805 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
806 | .short 0 # offset 31:16\r | |
807 | # No. 10\r | |
808 | .short 0 # offset 15:0\r | |
809 | .short SYS_CODE_SEL # selector 15:0\r | |
810 | .byte 0 # 0 for interrupt gate\r | |
811 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
812 | .short 0 # offset 31:16\r | |
813 | # No. 11\r | |
814 | .short 0 # offset 15:0\r | |
815 | .short SYS_CODE_SEL # selector 15:0\r | |
816 | .byte 0 # 0 for interrupt gate\r | |
817 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
818 | .short 0 # offset 31:16\r | |
819 | # No. 12\r | |
820 | .short 0 # offset 15:0\r | |
821 | .short SYS_CODE_SEL # selector 15:0\r | |
822 | .byte 0 # 0 for interrupt gate\r | |
823 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
824 | .short 0 # offset 31:16\r | |
825 | \r | |
6794a1b9 | 826 | \r |
827 | # 72 unspecified descriptors\r | |
b29a823d | 828 | .fill 72 * 8, 1, 0\r |
6794a1b9 | 829 | \r |
5ffcd257 | 830 | # IRQ 0 (System timer) - (INT 0x68)\r |
831 | IRQ0_SEL = .-IDT_BASE\r | |
832 | .short 0 # offset 15:0\r | |
833 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 834 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 835 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
836 | .short 0 # offset 31:16\r | |
837 | \r | |
838 | # IRQ 1 (8042 Keyboard controller) - (INT 0x69)\r | |
839 | IRQ1_SEL = .-IDT_BASE\r | |
840 | .short 0 # offset 15:0\r | |
841 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 842 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 843 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
844 | .short 0 # offset 31:16\r | |
6794a1b9 | 845 | \r |
846 | # Reserved - IRQ 2 redirect (IRQ 2) - DO NOT USE!!! - (INT 6ah)\r | |
5ffcd257 | 847 | IRQ2_SEL = .-IDT_BASE\r |
848 | .short 0 # offset 15:0\r | |
849 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 850 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 851 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
852 | .short 0 # offset 31:16\r | |
6794a1b9 | 853 | \r |
854 | # IRQ 3 (COM 2) - (INT 6bh)\r | |
5ffcd257 | 855 | IRQ3_SEL = .-IDT_BASE\r |
856 | .short 0 # offset 15:0\r | |
857 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 858 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 859 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
860 | .short 0 # offset 31:16\r | |
6794a1b9 | 861 | \r |
862 | # IRQ 4 (COM 1) - (INT 6ch)\r | |
5ffcd257 | 863 | IRQ4_SEL = .-IDT_BASE\r |
864 | .short 0 # offset 15:0\r | |
865 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 866 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 867 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
868 | .short 0 # offset 31:16\r | |
6794a1b9 | 869 | \r |
870 | # IRQ 5 (LPT 2) - (INT 6dh)\r | |
5ffcd257 | 871 | IRQ5_SEL = .-IDT_BASE\r |
872 | .short 0 # offset 15:0\r | |
873 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 874 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 875 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
876 | .short 0 # offset 31:16\r | |
6794a1b9 | 877 | \r |
878 | # IRQ 6 (Floppy controller) - (INT 6eh)\r | |
5ffcd257 | 879 | IRQ6_SEL = .-IDT_BASE\r |
880 | .short 0 # offset 15:0\r | |
881 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 882 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 883 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
884 | .short 0 # offset 31:16\r | |
6794a1b9 | 885 | \r |
886 | # IRQ 7 (LPT 1) - (INT 6fh)\r | |
5ffcd257 | 887 | IRQ7_SEL = .-IDT_BASE\r |
888 | .short 0 # offset 15:0\r | |
889 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 890 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 891 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
892 | .short 0 # offset 31:16\r | |
893 | \r | |
894 | # IRQ 8 (RTC Alarm) - (INT 0x70)\r | |
895 | IRQ8_SEL = .-IDT_BASE\r | |
896 | .short 0 # offset 15:0\r | |
897 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 898 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 899 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
900 | .short 0 # offset 31:16\r | |
901 | \r | |
902 | # IRQ 9 - (INT 0x71)\r | |
903 | IRQ9_SEL = .-IDT_BASE\r | |
904 | .short 0 # offset 15:0\r | |
905 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 906 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 907 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
908 | .short 0 # offset 31:16\r | |
909 | \r | |
910 | # IRQ 10 - (INT 0x72)\r | |
911 | IRQ10_SEL = .-IDT_BASE\r | |
912 | .short 0 # offset 15:0\r | |
913 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 914 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 915 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
916 | .short 0 # offset 31:16\r | |
917 | \r | |
918 | # IRQ 11 - (INT 0x73)\r | |
919 | IRQ11_SEL = .-IDT_BASE\r | |
920 | .short 0 # offset 15:0\r | |
921 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 922 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 923 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
924 | .short 0 # offset 31:16\r | |
925 | \r | |
926 | # IRQ 12 (PS/2 mouse) - (INT 0x74)\r | |
927 | IRQ12_SEL = .-IDT_BASE\r | |
928 | .short 0 # offset 15:0\r | |
929 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 930 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 931 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
932 | .short 0 # offset 31:16\r | |
933 | \r | |
934 | # IRQ 13 (Floating point error) - (INT 0x75)\r | |
935 | IRQ13_SEL = .-IDT_BASE\r | |
936 | .short 0 # offset 15:0\r | |
937 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 938 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 939 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
940 | .short 0 # offset 31:16\r | |
941 | \r | |
942 | # IRQ 14 (Secondary IDE) - (INT 0x76)\r | |
943 | IRQ14_SEL = .-IDT_BASE\r | |
944 | .short 0 # offset 15:0\r | |
945 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 946 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 947 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
948 | .short 0 # offset 31:16\r | |
949 | \r | |
950 | # IRQ 15 (Primary IDE) - (INT 0x77)\r | |
951 | IRQ15_SEL = .-IDT_BASE\r | |
952 | .short 0 # offset 15:0\r | |
953 | .short SYS_CODE_SEL # selector 15:0\r | |
01f1138a | 954 | .byte 0 # 0 for interrupt gate\r |
5ffcd257 | 955 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r |
956 | .short 0 # offset 31:16\r | |
957 | \r | |
b29a823d | 958 | .fill 1 * 8, 1, 0\r |
5ffcd257 | 959 | \r |
6794a1b9 | 960 | IDT_END:\r |
5ffcd257 | 961 | \r |