]>
Commit | Line | Data |
---|---|---|
99032c45 | 1 | #------------------------------------------------------------------------------\r |
2 | #*\r | |
fee4cb81 | 3 | #* Copyright 2006 - 2010, Intel Corporation \r |
99032c45 | 4 | #* All rights reserved. This program and the accompanying materials \r |
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 | |
99032c45 | 28 | ASM_PFX(mExceptionCodeSize): .long 9\r |
29 | \r | |
b29a823d | 30 | .text\r |
31 | ASM_GLOBAL ASM_PFX(InitDescriptor)\r | |
99032c45 | 32 | \r |
33 | ASM_PFX(InitDescriptor):\r | |
34 | movq $GDT_BASE,%rax # EAX=PHYSICAL address of gdt\r | |
35 | movq %rax, gdtr + 2 # Put address of gdt into the gdtr\r | |
36 | lgdt gdtr\r | |
37 | movq $0x18, %rax\r | |
38 | movq %rax, %gs\r | |
39 | movq %rax, %fs\r | |
40 | movq $IDT_BASE,%rax # EAX=PHYSICAL address of idt\r | |
41 | movq %rax, idtr + 2 # Put address of idt into the idtr\r | |
42 | lidt idtr\r | |
43 | ret\r | |
44 | \r | |
45 | # VOID\r | |
46 | # InstallInterruptHandler (\r | |
47 | # UINTN Vector,\r | |
48 | # VOID (*Handler)(VOID)\r | |
49 | # )\r | |
b29a823d | 50 | ASM_GLOBAL ASM_PFX(InstallInterruptHandler)\r |
99032c45 | 51 | ASM_PFX(InstallInterruptHandler):\r |
52 | # Vector:DWORD @ 4(%esp)\r | |
53 | # Handler:DWORD @ 8(%esp)\r | |
54 | push %rbx\r | |
55 | pushfq # save eflags\r | |
56 | cli # turn off interrupts\r | |
57 | subq $0x10, %rsp # open some space on the stack\r | |
58 | movq %rsp, %rbx\r | |
59 | \r | |
60 | sidt (%rbx) # get fword address of IDT\r | |
61 | movq 2(%rbx), %rbx # move offset of IDT into RBX\r | |
62 | addq $0x10, %rsp # correct stack\r | |
63 | movq %rcx, %rax # Get vector number\r | |
64 | shlq $4, %rax # multiply by 16 to get offset\r | |
65 | addq %rax, %rbx # add to IDT base to get entry\r | |
66 | movq %rdx, %rax # load new address into IDT entry\r | |
67 | movw %ax, (%rbx) # write bits 15..0 of offset\r | |
68 | shrq $16, %rax # use ax to copy 31..16 to descriptors\r | |
69 | movw %ax, 6(%rbx) # write bits 31..16 of offset\r | |
70 | shrq $16, %rax # use eax to copy 63..32 to descriptors\r | |
71 | movl %eax, 8(%rbx) # write bits 63..32 of offset\r | |
72 | popfq # restore flags (possible enabling interrupts)\r | |
73 | pop %rbx\r | |
74 | ret\r | |
75 | \r | |
b29a823d | 76 | .macro JmpCommonIdtEntry\r |
99032c45 | 77 | # jmp commonIdtEntry - this must be hand coded to keep the assembler from\r |
78 | # using a 8 bit reletive jump when the entries are\r | |
79 | # within 255 bytes of the common entry. This must\r | |
80 | # be done to maintain the consistency of the size\r | |
81 | # of entry points...\r | |
82 | .byte 0xe9 # jmp 16 bit reletive \r | |
83 | .long commonIdtEntry - . - 4 # offset to jump to\r | |
b29a823d | 84 | .endm\r |
99032c45 | 85 | \r |
9811c392 | 86 | .p2align 1\r |
b29a823d | 87 | ASM_GLOBAL ASM_PFX(SystemExceptionHandler)\r |
99032c45 | 88 | ASM_PFX(SystemExceptionHandler):\r |
89 | INT0:\r | |
90 | push $0x0 # push error code place holder on the stack\r | |
91 | push $0x0 \r | |
92 | JmpCommonIdtEntry\r | |
93 | # db 0e9h # jmp 16 bit reletive \r | |
94 | # dd commonIdtEntry - $ - 4 # offset to jump to\r | |
95 | \r | |
96 | INT1:\r | |
97 | push $0x0 # push error code place holder on the stack\r | |
98 | push $0x1 \r | |
99 | JmpCommonIdtEntry\r | |
100 | \r | |
101 | INT2:\r | |
102 | push $0x0 # push error code place holder on the stack\r | |
103 | push $0x2 \r | |
104 | JmpCommonIdtEntry\r | |
105 | \r | |
106 | INT3:\r | |
107 | push $0x0 # push error code place holder on the stack\r | |
108 | push $0x3 \r | |
109 | JmpCommonIdtEntry\r | |
110 | \r | |
111 | INT4:\r | |
112 | push $0x0 # push error code place holder on the stack\r | |
113 | push $0x4 \r | |
114 | JmpCommonIdtEntry\r | |
115 | \r | |
116 | INT5:\r | |
117 | push $0x0 # push error code place holder on the stack\r | |
118 | push $0x5 \r | |
119 | JmpCommonIdtEntry\r | |
120 | \r | |
121 | INT6:\r | |
122 | push $0x0 # push error code place holder on the stack\r | |
123 | push $0x6 \r | |
124 | JmpCommonIdtEntry\r | |
125 | \r | |
126 | INT7:\r | |
127 | push $0x0 # push error code place holder on the stack\r | |
128 | push $0x7 \r | |
129 | JmpCommonIdtEntry\r | |
130 | \r | |
131 | INT8:\r | |
132 | # Double fault causes an error code to be pushed so no phony push necessary\r | |
133 | nop\r | |
134 | nop\r | |
135 | push $0x8 \r | |
136 | JmpCommonIdtEntry\r | |
137 | \r | |
138 | INT9:\r | |
139 | push $0x0 # push error code place holder on the stack\r | |
140 | push $0x9 \r | |
141 | JmpCommonIdtEntry\r | |
142 | \r | |
143 | INT10:\r | |
144 | # Invalid TSS causes an error code to be pushed so no phony push necessary\r | |
145 | nop\r | |
146 | nop\r | |
147 | push $10\r | |
148 | JmpCommonIdtEntry\r | |
149 | \r | |
150 | INT11:\r | |
151 | # Segment Not Present causes an error code to be pushed so no phony push necessary\r | |
152 | nop\r | |
153 | nop\r | |
154 | push $11\r | |
155 | JmpCommonIdtEntry\r | |
156 | \r | |
157 | INT12:\r | |
158 | # Stack fault causes an error code to be pushed so no phony push necessary\r | |
159 | nop\r | |
160 | nop\r | |
161 | push $12\r | |
162 | JmpCommonIdtEntry\r | |
163 | \r | |
164 | INT13:\r | |
165 | # GP fault causes an error code to be pushed so no phony push necessary\r | |
166 | nop\r | |
167 | nop\r | |
168 | push $13\r | |
169 | JmpCommonIdtEntry\r | |
170 | \r | |
171 | INT14:\r | |
172 | # Page fault causes an error code to be pushed so no phony push necessary\r | |
173 | nop\r | |
174 | nop\r | |
175 | push $14\r | |
176 | JmpCommonIdtEntry\r | |
177 | \r | |
178 | INT15:\r | |
179 | push $0x0 # push error code place holder on the stack\r | |
180 | push $15\r | |
181 | JmpCommonIdtEntry\r | |
182 | \r | |
183 | INT16:\r | |
184 | push $0x0 # push error code place holder on the stack\r | |
185 | push $16\r | |
186 | JmpCommonIdtEntry\r | |
187 | \r | |
188 | INT17:\r | |
189 | # Alignment check causes an error code to be pushed so no phony push necessary\r | |
190 | nop\r | |
191 | nop\r | |
192 | push $17\r | |
193 | JmpCommonIdtEntry\r | |
194 | \r | |
195 | INT18:\r | |
196 | push $0x0 # push error code place holder on the stack\r | |
197 | push $18\r | |
198 | JmpCommonIdtEntry\r | |
199 | \r | |
200 | INT19:\r | |
201 | push $0x0 # push error code place holder on the stack\r | |
202 | push $19\r | |
203 | JmpCommonIdtEntry\r | |
204 | \r | |
205 | INTUnknown:\r | |
208628f8 | 206 | # The following segment repeats (32 - 20) times:\r |
fee4cb81 | 207 | # macro .rept isn't used here because Apple GAS compiler doesn't support it.\r |
208628f8 | 208 | # No. 1\r |
99032c45 | 209 | push $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 | |
208628f8 | 214 | # No. 2\r |
215 | push $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. 3\r | |
221 | push $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. 4\r | |
227 | push $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. 5\r | |
233 | push $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. 6\r | |
239 | push $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. 7\r | |
245 | push $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. 8\r | |
251 | push $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. 9\r | |
257 | push $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. 10\r | |
263 | push $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. 11\r | |
269 | push $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 | # No. 12\r | |
275 | push $0x0 # push error code place holder on the stack\r | |
276 | # push xxh # push vector number\r | |
277 | .byte 0x6a\r | |
278 | .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
279 | JmpCommonIdtEntry\r | |
280 | \r | |
99032c45 | 281 | \r |
b29a823d | 282 | ASM_GLOBAL ASM_PFX(SystemTimerHandler)\r |
99032c45 | 283 | ASM_PFX(SystemTimerHandler):\r |
284 | push $0\r | |
285 | push $ASM_PFX(mTimerVector)\r | |
286 | JmpCommonIdtEntry\r | |
287 | \r | |
288 | commonIdtEntry:\r | |
289 | # +---------------------+\r | |
290 | # + EFlags +\r | |
291 | # +---------------------+\r | |
292 | # + CS +\r | |
293 | # +---------------------+\r | |
294 | # + EIP +\r | |
295 | # +---------------------+\r | |
296 | # + Error Code +\r | |
297 | # +---------------------+\r | |
298 | # + Vector Number +\r | |
299 | # +---------------------+\r | |
300 | # + EBP +\r | |
301 | # +---------------------+ <-- EBP\r | |
302 | \r | |
303 | cli\r | |
304 | push %rbp\r | |
305 | movq %rsp,%rbp\r | |
306 | \r | |
307 | #\r | |
308 | # Since here the stack pointer is 16-byte aligned, so\r | |
309 | # EFI_FX_SAVE_STATE_X64 of EFI_SYSTEM_CONTEXT_x64\r | |
310 | # is 16-byte aligned\r | |
311 | # \r | |
312 | \r | |
313 | ## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax#\r | |
314 | ## UINT64 R8, R9, R10, R11, R12, R13, R14, R15#\r | |
315 | push %r15\r | |
316 | push %r14\r | |
317 | push %r13\r | |
318 | push %r12\r | |
319 | push %r11\r | |
320 | push %r10\r | |
321 | push %r9\r | |
322 | push %r8\r | |
323 | push %rax\r | |
324 | push %rcx\r | |
325 | push %rdx\r | |
326 | push %rbx\r | |
327 | push 6*8(%rbp)\r | |
328 | push (%rbp)\r | |
329 | push %rsi\r | |
330 | push %rdi\r | |
331 | \r | |
332 | ## UINT64 Gs, Fs, Es, Ds, Cs, Ss# insure high 16 bits of each is zero\r | |
333 | movzx 7*8(%rbp), %rax\r | |
334 | push %rax # for ss\r | |
335 | movzx 4*8(%rbp), %rax\r | |
336 | push %rax # for cs\r | |
337 | movq %ds, %rax\r | |
338 | push %rax\r | |
339 | movq %es, %rax\r | |
340 | push %rax\r | |
341 | movq %fs, %rax\r | |
342 | push %rax\r | |
343 | movq %gs, %rax\r | |
344 | push %rax\r | |
345 | \r | |
346 | ## UINT64 Rip#\r | |
347 | push 3*8(%rbp)\r | |
348 | \r | |
349 | ## UINT64 Gdtr[2], Idtr[2]#\r | |
350 | subq $16, %rsp\r | |
351 | sidt (%rsp)\r | |
352 | subq $16, %rsp\r | |
353 | sgdt (%rsp)\r | |
354 | \r | |
355 | ## UINT64 Ldtr, Tr#\r | |
356 | xorq %rax, %rax\r | |
357 | str %ax\r | |
358 | push %rax\r | |
359 | sldt %ax\r | |
360 | push %rax\r | |
361 | \r | |
362 | ## UINT64 RFlags#\r | |
363 | push 5*8(%rbp)\r | |
364 | \r | |
365 | ## UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8#\r | |
366 | movq %cr8, %rax\r | |
367 | push %rax\r | |
368 | movq %cr4, %rax\r | |
369 | orq $0x208, %rax\r | |
370 | movq %rax, %cr4\r | |
371 | push %rax\r | |
372 | movq %cr3, %rax\r | |
373 | push %rax\r | |
374 | movq %cr2, %rax\r | |
375 | push %rax\r | |
376 | xorq %rax, %rax\r | |
377 | push %rax\r | |
378 | movq %cr0, %rax\r | |
379 | push %rax\r | |
380 | \r | |
381 | ## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7#\r | |
382 | movq %dr7, %rax\r | |
383 | push %rax\r | |
384 | \r | |
385 | ## clear Dr7 while executing debugger itself\r | |
386 | xorq %rax, %rax\r | |
387 | movq %rax, %dr7\r | |
388 | \r | |
389 | movq %dr6, %rax\r | |
390 | push %rax\r | |
391 | \r | |
392 | ## insure all status bits in dr6 are clear...\r | |
393 | xorq %rax, %rax\r | |
394 | movq %rax, %dr6\r | |
395 | \r | |
396 | movq %dr3, %rax\r | |
397 | push %rax\r | |
398 | movq %dr2, %rax\r | |
399 | push %rax\r | |
400 | movq %dr1, %rax\r | |
401 | push %rax\r | |
402 | movq %dr0, %rax\r | |
403 | push %rax\r | |
404 | \r | |
405 | \r | |
406 | ## FX_SAVE_STATE_X64 FxSaveState#\r | |
407 | subq $512, %rsp\r | |
408 | movq %rsp, %rdi\r | |
409 | fxsave (%rdi)\r | |
410 | \r | |
411 | ## UINT64 ExceptionData#\r | |
412 | push 2*8 (%rbp) \r | |
413 | \r | |
414 | ## call into exception handler\r | |
415 | ## Prepare parameter and call\r | |
416 | movq 1*8(%rbp), %rcx\r | |
417 | movq %rsp, %rdx\r | |
418 | #\r | |
419 | # Per X64 calling convention, allocate maximum parameter stack space\r | |
420 | # and make sure RSP is 16-byte aligned\r | |
421 | #\r | |
422 | subq $(4*8+8), %rsp\r | |
423 | cmpq $32, %rcx\r | |
424 | jb CallException\r | |
425 | call ASM_PFX(TimerHandler)\r | |
426 | jmp ExceptionDone\r | |
427 | CallException:\r | |
428 | call ASM_PFX(ExceptionHandler)\r | |
429 | ExceptionDone:\r | |
430 | addq $(4*8+8), %rsp\r | |
431 | \r | |
432 | cli\r | |
99032c45 | 433 | ## UINT64 ExceptionData#\r |
434 | addq $8, %rsp\r | |
435 | \r | |
436 | ## FX_SAVE_STATE_X64 FxSaveState#\r | |
437 | movq %rsp, %rsi\r | |
438 | fxrstor (%esi)\r | |
439 | addq $512, %rsp\r | |
440 | \r | |
441 | \r | |
442 | ## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7#\r | |
443 | pop %rax\r | |
444 | movq %rax, %dr0\r | |
445 | pop %rax\r | |
446 | movq %rax, %dr1\r | |
447 | pop %rax\r | |
448 | movq %rax, %dr2\r | |
449 | pop %rax\r | |
450 | movq %rax, %dr3\r | |
451 | ## skip restore of dr6. We cleared dr6 during the context save.\r | |
452 | addq $8, %rsp\r | |
453 | pop %rax\r | |
454 | movq %rax, %dr7\r | |
455 | \r | |
456 | ## UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8#\r | |
457 | pop %rax\r | |
458 | movq %rax, %cr0\r | |
459 | addq $8, %rsp # not for Cr1\r | |
460 | pop %rax\r | |
461 | movq %rax, %cr2\r | |
462 | pop %rax\r | |
463 | movq %rax, %cr3\r | |
464 | pop %rax\r | |
465 | movq %rax, %cr4\r | |
466 | pop %rax\r | |
467 | mov %rax, %cr8\r | |
468 | \r | |
469 | ## UINT64 RFlags#\r | |
470 | pop 5*8(%rbp) \r | |
471 | \r | |
472 | ## UINT64 Ldtr, Tr#\r | |
473 | ## UINT64 Gdtr[2], Idtr[2]#\r | |
474 | ## Best not let anyone mess with these particular registers...\r | |
475 | addq $48, %rsp\r | |
476 | \r | |
477 | ## UINT64 Rip#\r | |
478 | pop 3*8(%rbp)\r | |
479 | \r | |
480 | ## UINT64 Gs, Fs, Es, Ds, Cs, Ss#\r | |
481 | pop %rax\r | |
482 | # mov gs, rax # not for gs\r | |
483 | pop %rax\r | |
484 | # mov fs, rax # not for fs\r | |
485 | # (X64 will not use fs and gs, so we do not restore it)\r | |
486 | pop %rax\r | |
487 | movq %rax, %es\r | |
488 | pop %rax\r | |
489 | movq %rax, %ds\r | |
490 | pop 4*8(%rbp) # for cs\r | |
491 | pop 7*8(%rbp) # for ss\r | |
492 | \r | |
493 | ## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax#\r | |
494 | ## UINT64 R8, R9, R10, R11, R12, R13, R14, R15#\r | |
495 | pop %rdi\r | |
496 | pop %rsi\r | |
497 | addq $8, %rsp # not for rbp\r | |
498 | pop 6*8(%rbp) # for rsp\r | |
499 | pop %rbx\r | |
500 | pop %rdx\r | |
501 | pop %rcx\r | |
502 | pop %rax\r | |
503 | pop %r8\r | |
504 | pop %r9\r | |
505 | pop %r10\r | |
506 | pop %r11\r | |
507 | pop %r12\r | |
508 | pop %r13\r | |
509 | pop %r14\r | |
510 | pop %r15\r | |
511 | \r | |
512 | movq %rbp, %rsp\r | |
513 | pop %rbp\r | |
514 | addq $16, %rsp\r | |
515 | iretq\r | |
516 | \r | |
517 | \r | |
518 | ##############################################################################\r | |
519 | # data\r | |
520 | ##############################################################################\r | |
521 | \r | |
b29a823d | 522 | .data\r |
99032c45 | 523 | \r |
b29a823d | 524 | gdtr: .short GDT_END - GDT_BASE - 1 # GDT limit\r |
fee4cb81 | 525 | .quad 0 # (GDT base gets set above)\r |
99032c45 | 526 | ##############################################################################\r |
527 | # global descriptor table (GDT)\r | |
528 | ##############################################################################\r | |
529 | \r | |
fee4cb81 | 530 | .p2align 4 # make GDT 16-byte align\r |
99032c45 | 531 | \r |
532 | GDT_BASE:\r | |
533 | # null descriptor\r | |
fee4cb81 RN |
534 | NULL_SEL = .-GDT_BASE # Selector [0x0]\r |
535 | .short 0 # limit 15:0\r | |
536 | .short 0 # base 15:0\r | |
537 | .byte 0 # base 23:16\r | |
538 | .byte 0 # type\r | |
539 | .byte 0 # limit 19:16, flags\r | |
540 | .byte 0 # base 31:24\r | |
99032c45 | 541 | \r |
542 | # linear data segment descriptor\r | |
fee4cb81 | 543 | LINEAR_SEL = .-GDT_BASE # Selector [0x8]\r |
99032c45 | 544 | .short 0x0FFFF # limit 0xFFFFF\r |
545 | .short 0 # base 0\r | |
546 | .byte 0\r | |
547 | .byte 0x092 # present, ring 0, data, expand-up, writable\r | |
548 | .byte 0x0CF # page-granular, 32-bit\r | |
549 | .byte 0\r | |
550 | \r | |
551 | # linear code segment descriptor\r | |
fee4cb81 | 552 | LINEAR_CODE_SEL = .-GDT_BASE # Selector [0x10]\r |
99032c45 | 553 | .short 0x0FFFF # limit 0xFFFFF\r |
554 | .short 0 # base 0\r | |
555 | .byte 0\r | |
fee4cb81 | 556 | .byte 0x09A # present, ring 0, code, expand-up, writable\r |
99032c45 | 557 | .byte 0x0CF # page-granular, 32-bit\r |
558 | .byte 0\r | |
559 | \r | |
560 | # system data segment descriptor\r | |
fee4cb81 | 561 | SYS_DATA_SEL = .-GDT_BASE # Selector [0x18]\r |
99032c45 | 562 | .short 0x0FFFF # limit 0xFFFFF\r |
563 | .short 0 # base 0\r | |
564 | .byte 0\r | |
565 | .byte 0x092 # present, ring 0, data, expand-up, writable\r | |
566 | .byte 0x0CF # page-granular, 32-bit\r | |
567 | .byte 0\r | |
568 | \r | |
569 | # system code segment descriptor\r | |
fee4cb81 | 570 | SYS_CODE_SEL = .-GDT_BASE # Selector [0x20]\r |
99032c45 | 571 | .short 0x0FFFF # limit 0xFFFFF\r |
572 | .short 0 # base 0\r | |
573 | .byte 0\r | |
fee4cb81 | 574 | .byte 0x09A # present, ring 0, code, expand-up, writable\r |
99032c45 | 575 | .byte 0x0CF # page-granular, 32-bit\r |
576 | .byte 0\r | |
577 | \r | |
578 | # spare segment descriptor\r | |
fee4cb81 RN |
579 | SPARE3_SEL = .-GDT_BASE # Selector [0x28]\r |
580 | .short 0\r | |
581 | .short 0\r | |
582 | .byte 0\r | |
583 | .byte 0\r | |
584 | .byte 0\r | |
585 | .byte 0\r | |
586 | \r | |
587 | # system data segment descriptor\r | |
588 | SYS_DATA64_SEL = .-GDT_BASE # Selector [0x30]\r | |
589 | .short 0x0FFFF # limit 0xFFFFF\r | |
99032c45 | 590 | .short 0 # base 0\r |
591 | .byte 0\r | |
fee4cb81 RN |
592 | .byte 0x092 # present, ring 0, data, expand-up, writable\r |
593 | .byte 0x0CF # page-granular, 32-bit\r | |
99032c45 | 594 | .byte 0\r |
595 | \r | |
fee4cb81 RN |
596 | # system code segment descriptor\r |
597 | SYS_CODE64_SEL = .-GDT_BASE # Selector [0x38]\r | |
598 | .short 0x0FFFF # limit 0xFFFFF\r | |
99032c45 | 599 | .short 0 # base 0\r |
600 | .byte 0\r | |
fee4cb81 RN |
601 | .byte 0x09A # present, ring 0, code, expand-up, writable\r |
602 | .byte 0x0AF # page-granular, 64-bit\r | |
99032c45 | 603 | .byte 0\r |
604 | \r | |
605 | # spare segment descriptor\r | |
fee4cb81 RN |
606 | SPARE4_SEL = .-GDT_BASE # Selector [0x40]\r |
607 | .short 0\r | |
608 | .short 0\r | |
609 | .byte 0\r | |
610 | .byte 0\r | |
99032c45 | 611 | .byte 0\r |
99032c45 | 612 | .byte 0\r |
613 | \r | |
614 | GDT_END:\r | |
615 | \r | |
b29a823d | 616 | idtr: .short IDT_END - IDT_BASE - 1 # IDT limit\r |
fee4cb81 | 617 | .quad 0 # (IDT base gets set above)\r |
99032c45 | 618 | ##############################################################################\r |
619 | # interrupt descriptor table (IDT)\r | |
620 | #\r | |
621 | # Note: The hardware IRQ's specified in this table are the normal PC/AT IRQ\r | |
622 | # mappings. This implementation only uses the system timer and all other\r | |
623 | # IRQs will remain masked. The descriptors for vectors 33+ are provided\r | |
624 | # for convenience.\r | |
625 | ##############################################################################\r | |
626 | \r | |
fee4cb81 | 627 | .p2align 3 # make IDT 8-byte align\r |
99032c45 | 628 | \r |
629 | IDT_BASE:\r | |
630 | # divide by zero (INT 0)\r | |
631 | DIV_ZERO_SEL = .-IDT_BASE\r | |
632 | .short 0 # offset 15:0\r | |
fee4cb81 | 633 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 634 | .byte 0 # 0 for interrupt gate\r |
635 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
636 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
637 | .long 0 # offset 63:32\r |
638 | .long 0 # for reserved\r | |
99032c45 | 639 | \r |
640 | # debug exception (INT 1)\r | |
641 | DEBUG_EXCEPT_SEL = .-IDT_BASE\r | |
642 | .short 0 # offset 15:0\r | |
fee4cb81 | 643 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 644 | .byte 0 # 0 for interrupt gate\r |
645 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
646 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
647 | .long 0 # offset 63:32\r |
648 | .long 0 # for reserved\r | |
99032c45 | 649 | \r |
650 | # NMI (INT 2)\r | |
651 | NMI_SEL = .-IDT_BASE\r | |
652 | .short 0 # offset 15:0\r | |
fee4cb81 | 653 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 654 | .byte 0 # 0 for interrupt gate\r |
655 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
656 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
657 | .long 0 # offset 63:32\r |
658 | .long 0 # for reserved\r | |
99032c45 | 659 | \r |
660 | # soft breakpoint (INT 3)\r | |
661 | BREAKPOINT_SEL = .-IDT_BASE\r | |
662 | .short 0 # offset 15:0\r | |
fee4cb81 | 663 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 664 | .byte 0 # 0 for interrupt gate\r |
665 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
666 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
667 | .long 0 # offset 63:32\r |
668 | .long 0 # for reserved\r | |
99032c45 | 669 | \r |
670 | # overflow (INT 4)\r | |
671 | OVERFLOW_SEL = .-IDT_BASE\r | |
672 | .short 0 # offset 15:0\r | |
fee4cb81 | 673 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 674 | .byte 0 # 0 for interrupt gate\r |
675 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
676 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
677 | .long 0 # offset 63:32\r |
678 | .long 0 # for reserved\r | |
99032c45 | 679 | \r |
680 | # bounds check (INT 5)\r | |
681 | BOUNDS_CHECK_SEL = .-IDT_BASE\r | |
682 | .short 0 # offset 15:0\r | |
fee4cb81 | 683 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 684 | .byte 0 # 0 for interrupt gate\r |
685 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
686 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
687 | .long 0 # offset 63:32\r |
688 | .long 0 # for reserved\r | |
99032c45 | 689 | \r |
690 | # invalid opcode (INT 6)\r | |
691 | INVALID_OPCODE_SEL = .-IDT_BASE\r | |
692 | .short 0 # offset 15:0\r | |
fee4cb81 | 693 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 694 | .byte 0 # 0 for interrupt gate\r |
695 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
696 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
697 | .long 0 # offset 63:32\r |
698 | .long 0 # for reserved\r | |
99032c45 | 699 | \r |
700 | # device not available (INT 7)\r | |
701 | DEV_NOT_AVAIL_SEL = .-IDT_BASE\r | |
702 | .short 0 # offset 15:0\r | |
fee4cb81 | 703 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 704 | .byte 0 # 0 for interrupt gate\r |
705 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
706 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
707 | .long 0 # offset 63:32\r |
708 | .long 0 # for reserved\r | |
99032c45 | 709 | \r |
710 | # double fault (INT 8)\r | |
711 | DOUBLE_FAULT_SEL = .-IDT_BASE\r | |
712 | .short 0 # offset 15:0\r | |
fee4cb81 | 713 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 714 | .byte 0 # 0 for interrupt gate\r |
715 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
716 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
717 | .long 0 # offset 63:32\r |
718 | .long 0 # for reserved\r | |
99032c45 | 719 | \r |
720 | # Coprocessor segment overrun - reserved (INT 9)\r | |
721 | RSVD_INTR_SEL1 = .-IDT_BASE\r | |
722 | .short 0 # offset 15:0\r | |
fee4cb81 | 723 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 724 | .byte 0 # 0 for interrupt gate\r |
725 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
726 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
727 | .long 0 # offset 63:32\r |
728 | .long 0 # for reserved\r | |
99032c45 | 729 | \r |
730 | # invalid TSS (INT 0ah)\r | |
731 | INVALID_TSS_SEL = .-IDT_BASE\r | |
732 | .short 0 # offset 15:0\r | |
fee4cb81 | 733 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 734 | .byte 0 # 0 for interrupt gate\r |
735 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
736 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
737 | .long 0 # offset 63:32\r |
738 | .long 0 # for reserved\r | |
99032c45 | 739 | \r |
740 | # segment not present (INT 0bh)\r | |
741 | SEG_NOT_PRESENT_SEL = .-IDT_BASE\r | |
742 | .short 0 # offset 15:0\r | |
fee4cb81 | 743 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 744 | .byte 0 # 0 for interrupt gate\r |
745 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
746 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
747 | .long 0 # offset 63:32\r |
748 | .long 0 # for reserved\r | |
99032c45 | 749 | \r |
750 | # stack fault (INT 0ch)\r | |
751 | STACK_FAULT_SEL = .-IDT_BASE\r | |
752 | .short 0 # offset 15:0\r | |
fee4cb81 | 753 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 754 | .byte 0 # 0 for interrupt gate\r |
755 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
756 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
757 | .long 0 # offset 63:32\r |
758 | .long 0 # for reserved\r | |
99032c45 | 759 | \r |
760 | # general protection (INT 0dh)\r | |
761 | GP_FAULT_SEL = .-IDT_BASE\r | |
762 | .short 0 # offset 15:0\r | |
fee4cb81 | 763 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 764 | .byte 0 # 0 for interrupt gate\r |
765 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
766 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
767 | .long 0 # offset 63:32\r |
768 | .long 0 # for reserved\r | |
99032c45 | 769 | \r |
770 | # page fault (INT 0eh)\r | |
771 | PAGE_FAULT_SEL = .-IDT_BASE\r | |
772 | .short 0 # offset 15:0\r | |
fee4cb81 | 773 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 774 | .byte 0 # 0 for interrupt gate\r |
775 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
776 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
777 | .long 0 # offset 63:32\r |
778 | .long 0 # for reserved\r | |
99032c45 | 779 | \r |
780 | # Intel reserved - do not use (INT 0fh)\r | |
781 | RSVD_INTR_SEL2 = .-IDT_BASE\r | |
782 | .short 0 # offset 15:0\r | |
fee4cb81 | 783 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 784 | .byte 0 # 0 for interrupt gate\r |
785 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
786 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
787 | .long 0 # offset 63:32\r |
788 | .long 0 # for reserved\r | |
99032c45 | 789 | \r |
790 | # floating point error (INT 0x10)\r | |
791 | FLT_POINT_ERR_SEL = .-IDT_BASE\r | |
792 | .short 0 # offset 15:0\r | |
fee4cb81 | 793 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 794 | .byte 0 # 0 for interrupt gate\r |
795 | .byte 0x0e | 0x80 # type = 386 interrupt gate, present\r | |
796 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
797 | .long 0 # offset 63:32\r |
798 | .long 0 # for reserved\r | |
99032c45 | 799 | \r |
800 | # alignment check (INT 0x11)\r | |
801 | ALIGNMENT_CHECK_SEL = .-IDT_BASE\r | |
802 | .short 0 # offset 15:0\r | |
fee4cb81 | 803 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 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 | |
fee4cb81 RN |
807 | .long 0 # offset 63:32\r |
808 | .long 0 # for reserved\r | |
99032c45 | 809 | \r |
810 | # machine check (INT 0x12)\r | |
811 | MACHINE_CHECK_SEL = .-IDT_BASE\r | |
812 | .short 0 # offset 15:0\r | |
fee4cb81 | 813 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 814 | .byte 0 # 0 for interrupt gate\r |
815 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
816 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
817 | .long 0 # offset 63:32\r |
818 | .long 0 # for reserved\r | |
99032c45 | 819 | \r |
820 | # SIMD floating-point exception (INT 0x13)\r | |
821 | SIMD_EXCEPTION_SEL = .-IDT_BASE\r | |
822 | .short 0 # offset 15:0\r | |
fee4cb81 | 823 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 824 | .byte 0 # 0 for interrupt gate\r |
825 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
826 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
827 | .long 0 # offset 63:32\r |
828 | .long 0 # for reserved\r | |
99032c45 | 829 | \r |
208628f8 | 830 | # The following segment repeats (32 - 20) times:\r |
fee4cb81 | 831 | # macro .rept isn't used here because Apple GAS compiler doesn't support it.\r |
208628f8 | 832 | # No. 1\r |
99032c45 | 833 | .short 0 # offset 15:0\r |
834 | .short SYS_CODE_SEL # selector 15:0\r | |
835 | .byte 0 # 0 for interrupt gate\r | |
836 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
837 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
838 | .long 0 # offset 63:32\r |
839 | .long 0 # for reserved\r | |
208628f8 | 840 | # No. 2\r |
841 | .short 0 # offset 15:0\r | |
842 | .short SYS_CODE_SEL # selector 15:0\r | |
843 | .byte 0 # 0 for interrupt gate\r | |
844 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
845 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
846 | .long 0 # offset 63:32\r |
847 | .long 0 # for reserved\r | |
208628f8 | 848 | # No. 3\r |
849 | .short 0 # offset 15:0\r | |
850 | .short SYS_CODE_SEL # selector 15:0\r | |
851 | .byte 0 # 0 for interrupt gate\r | |
852 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
853 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
854 | .long 0 # offset 63:32\r |
855 | .long 0 # for reserved\r | |
208628f8 | 856 | # No. 4\r |
857 | .short 0 # offset 15:0\r | |
858 | .short SYS_CODE_SEL # selector 15:0\r | |
859 | .byte 0 # 0 for interrupt gate\r | |
860 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
861 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
862 | .long 0 # offset 63:32\r |
863 | .long 0 # for reserved\r | |
208628f8 | 864 | # No. 5\r |
865 | .short 0 # offset 15:0\r | |
866 | .short SYS_CODE_SEL # selector 15:0\r | |
867 | .byte 0 # 0 for interrupt gate\r | |
868 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
869 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
870 | .long 0 # offset 63:32\r |
871 | .long 0 # for reserved\r | |
208628f8 | 872 | # No. 6\r |
873 | .short 0 # offset 15:0\r | |
874 | .short SYS_CODE_SEL # selector 15:0\r | |
875 | .byte 0 # 0 for interrupt gate\r | |
876 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
877 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
878 | .long 0 # offset 63:32\r |
879 | .long 0 # for reserved\r | |
208628f8 | 880 | # No. 7\r |
881 | .short 0 # offset 15:0\r | |
882 | .short SYS_CODE_SEL # selector 15:0\r | |
883 | .byte 0 # 0 for interrupt gate\r | |
884 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
885 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
886 | .long 0 # offset 63:32\r |
887 | .long 0 # for reserved\r | |
208628f8 | 888 | # No. 8\r |
889 | .short 0 # offset 15:0\r | |
890 | .short SYS_CODE_SEL # selector 15:0\r | |
891 | .byte 0 # 0 for interrupt gate\r | |
892 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
893 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
894 | .long 0 # offset 63:32\r |
895 | .long 0 # for reserved\r | |
208628f8 | 896 | # No. 9\r |
897 | .short 0 # offset 15:0\r | |
898 | .short SYS_CODE_SEL # selector 15:0\r | |
899 | .byte 0 # 0 for interrupt gate\r | |
900 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
901 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
902 | .long 0 # offset 63:32\r |
903 | .long 0 # for reserved\r | |
208628f8 | 904 | # No. 10\r |
905 | .short 0 # offset 15:0\r | |
906 | .short SYS_CODE_SEL # selector 15:0\r | |
907 | .byte 0 # 0 for interrupt gate\r | |
908 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
909 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
910 | .long 0 # offset 63:32\r |
911 | .long 0 # for reserved\r | |
208628f8 | 912 | # No. 11\r |
913 | .short 0 # offset 15:0\r | |
914 | .short SYS_CODE_SEL # selector 15:0\r | |
915 | .byte 0 # 0 for interrupt gate\r | |
916 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
917 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
918 | .long 0 # offset 63:32\r |
919 | .long 0 # for reserved\r | |
208628f8 | 920 | # No. 12\r |
921 | .short 0 # offset 15:0\r | |
922 | .short SYS_CODE_SEL # selector 15:0\r | |
923 | .byte 0 # 0 for interrupt gate\r | |
924 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
925 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
926 | .long 0 # offset 63:32\r |
927 | .long 0 # for reserved\r | |
208628f8 | 928 | \r |
99032c45 | 929 | \r |
930 | # 72 unspecified descriptors\r | |
fee4cb81 | 931 | .fill 72 * 16, 1, 0\r |
99032c45 | 932 | \r |
933 | # IRQ 0 (System timer) - (INT 0x68)\r | |
934 | IRQ0_SEL = .-IDT_BASE\r | |
935 | .short 0 # offset 15:0\r | |
fee4cb81 | 936 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 937 | .byte 0 # 0 for interrupt gate\r |
938 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
939 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
940 | .long 0 # offset 63:32\r |
941 | .long 0 # 0 for reserved\r | |
99032c45 | 942 | \r |
943 | # IRQ 1 (8042 Keyboard controller) - (INT 0x69)\r | |
944 | IRQ1_SEL = .-IDT_BASE\r | |
945 | .short 0 # offset 15:0\r | |
fee4cb81 | 946 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 947 | .byte 0 # 0 for interrupt gate\r |
948 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
949 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
950 | .long 0 # offset 63:32\r |
951 | .long 0 # for reserved\r | |
99032c45 | 952 | \r |
953 | # Reserved - IRQ 2 redirect (IRQ 2) - DO NOT USE!!! - (INT 6ah)\r | |
954 | IRQ2_SEL = .-IDT_BASE\r | |
955 | .short 0 # offset 15:0\r | |
fee4cb81 | 956 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 957 | .byte 0 # 0 for interrupt gate\r |
958 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
959 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
960 | .long 0 # offset 63:32\r |
961 | .long 0 # for reserved\r | |
99032c45 | 962 | \r |
963 | # IRQ 3 (COM 2) - (INT 6bh)\r | |
964 | IRQ3_SEL = .-IDT_BASE\r | |
965 | .short 0 # offset 15:0\r | |
fee4cb81 | 966 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 967 | .byte 0 # 0 for interrupt gate\r |
968 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
969 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
970 | .long 0 # offset 63:32\r |
971 | .long 0 # for reserved\r | |
99032c45 | 972 | \r |
973 | # IRQ 4 (COM 1) - (INT 6ch)\r | |
974 | IRQ4_SEL = .-IDT_BASE\r | |
975 | .short 0 # offset 15:0\r | |
fee4cb81 | 976 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 977 | .byte 0 # 0 for interrupt gate\r |
978 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
979 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
980 | .long 0 # offset 63:32\r |
981 | .long 0 # for reserved\r | |
99032c45 | 982 | \r |
983 | # IRQ 5 (LPT 2) - (INT 6dh)\r | |
984 | IRQ5_SEL = .-IDT_BASE\r | |
985 | .short 0 # offset 15:0\r | |
fee4cb81 | 986 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 987 | .byte 0 # 0 for interrupt gate\r |
988 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
989 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
990 | .long 0 # offset 63:32\r |
991 | .long 0 # for reserved\r | |
99032c45 | 992 | \r |
993 | # IRQ 6 (Floppy controller) - (INT 6eh)\r | |
994 | IRQ6_SEL = .-IDT_BASE\r | |
995 | .short 0 # offset 15:0\r | |
fee4cb81 | 996 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 997 | .byte 0 # 0 for interrupt gate\r |
998 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
999 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1000 | .long 0 # offset 63:32\r |
1001 | .long 0 # for reserved\r | |
99032c45 | 1002 | \r |
1003 | # IRQ 7 (LPT 1) - (INT 6fh)\r | |
1004 | IRQ7_SEL = .-IDT_BASE\r | |
1005 | .short 0 # offset 15:0\r | |
fee4cb81 | 1006 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 1007 | .byte 0 # 0 for interrupt gate\r |
1008 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
1009 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1010 | .long 0 # offset 63:32\r |
1011 | .long 0 # for reserved\r | |
99032c45 | 1012 | \r |
1013 | # IRQ 8 (RTC Alarm) - (INT 0x70)\r | |
1014 | IRQ8_SEL = .-IDT_BASE\r | |
1015 | .short 0 # offset 15:0\r | |
fee4cb81 | 1016 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 1017 | .byte 0 # 0 for interrupt gate\r |
1018 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
1019 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1020 | .long 0 # offset 63:32\r |
1021 | .long 0 # for reserved\r | |
99032c45 | 1022 | \r |
1023 | # IRQ 9 - (INT 0x71)\r | |
1024 | IRQ9_SEL = .-IDT_BASE\r | |
1025 | .short 0 # offset 15:0\r | |
fee4cb81 | 1026 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 1027 | .byte 0 # 0 for interrupt gate\r |
1028 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
1029 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1030 | .long 0 # offset 63:32\r |
1031 | .long 0 # for reserved\r | |
99032c45 | 1032 | \r |
1033 | # IRQ 10 - (INT 0x72)\r | |
1034 | IRQ10_SEL = .-IDT_BASE\r | |
1035 | .short 0 # offset 15:0\r | |
fee4cb81 | 1036 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 1037 | .byte 0 # 0 for interrupt gate\r |
1038 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
1039 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1040 | .long 0 # offset 63:32\r |
1041 | .long 0 # for reserved\r | |
99032c45 | 1042 | \r |
1043 | # IRQ 11 - (INT 0x73)\r | |
1044 | IRQ11_SEL = .-IDT_BASE\r | |
1045 | .short 0 # offset 15:0\r | |
fee4cb81 | 1046 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 1047 | .byte 0 # 0 for interrupt gate\r |
1048 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
1049 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1050 | .long 0 # offset 63:32\r |
1051 | .long 0 # for reserved\r | |
99032c45 | 1052 | \r |
1053 | # IRQ 12 (PS/2 mouse) - (INT 0x74)\r | |
1054 | IRQ12_SEL = .-IDT_BASE\r | |
1055 | .short 0 # offset 15:0\r | |
fee4cb81 | 1056 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 1057 | .byte 0 # 0 for interrupt gate\r |
1058 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
1059 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1060 | .long 0 # offset 63:32\r |
1061 | .long 0 # for reserved\r | |
99032c45 | 1062 | \r |
1063 | # IRQ 13 (Floating point error) - (INT 0x75)\r | |
1064 | IRQ13_SEL = .-IDT_BASE\r | |
1065 | .short 0 # offset 15:0\r | |
fee4cb81 | 1066 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 1067 | .byte 0 # 0 for interrupt gate\r |
1068 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
1069 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1070 | .long 0 # offset 63:32\r |
1071 | .long 0 # for reserved\r | |
99032c45 | 1072 | \r |
1073 | # IRQ 14 (Secondary IDE) - (INT 0x76)\r | |
1074 | IRQ14_SEL = .-IDT_BASE\r | |
1075 | .short 0 # offset 15:0\r | |
fee4cb81 | 1076 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 1077 | .byte 0 # 0 for interrupt gate\r |
1078 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
1079 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1080 | .long 0 # offset 63:32\r |
1081 | .long 0 # for reserved\r | |
99032c45 | 1082 | \r |
1083 | # IRQ 15 (Primary IDE) - (INT 0x77)\r | |
1084 | IRQ15_SEL = .-IDT_BASE\r | |
1085 | .short 0 # offset 15:0\r | |
fee4cb81 | 1086 | .short SYS_CODE64_SEL # selector 15:0\r |
99032c45 | 1087 | .byte 0 # 0 for interrupt gate\r |
1088 | .byte 0x0e | 0x80 # (10001110)type = 386 interrupt gate, present\r | |
1089 | .short 0 # offset 31:16\r | |
fee4cb81 RN |
1090 | .long 0 # offset 63:32\r |
1091 | .long 0 # for reserved\r | |
99032c45 | 1092 | \r |
b29a823d | 1093 | .fill 16, 1, 0\r |
99032c45 | 1094 | \r |
1095 | IDT_END:\r | |
1096 | \r |