1 #------------------------------------------------------------------------------
\r
3 #* Copyright 2006, Intel Corporation
\r
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
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
16 #------------------------------------------------------------------------------
\r
18 ##############################################################################
\r
19 # Now in 64-bit long mode.
\r
20 ##############################################################################
\r
27 .equ DEFAULT_HANDLER_SIZE, INT1 - INT0
\r
29 .macro jmpCommonIdtEntry
\r
30 # jmp commonIdtEntry - this must be hand coded to keep the assembler from
\r
31 # using a 8 bit reletive jump when the entries are
\r
32 # within 255 bytes of the common entry. This must
\r
33 # be done to maintain the consistency of the size
\r
34 # of entry points...
\r
35 .byte 0xe9 # jmp 16 bit relative
\r
36 .long commonIdtEntry - . - 4 # offset to jump to
\r
42 movl $0x001fffe8,%esp # make final stack aligned
\r
44 # set OSFXSR and OSXMMEXCPT because some code will use XMM register
\r
58 # Populate IDT with meaningful offsets for exception handlers...
\r
63 movl %eax,%ebx # use bx to copy 15..0 to descriptors
\r
64 shrl $16,%eax # use ax to copy 31..16 to descriptors
\r
65 # 63..32 of descriptors is 0
\r
66 movl $0x78,%ecx # 78h IDT entries to initialize with unique entry points (exceptions)
\r
67 movl (Idtr + 2), %esi
\r
70 LOOP_1: # loop through all IDT entries exception handlers and initialize to default handler
\r
71 movw %bx, (%edi) # write bits 15..0 of offset
\r
72 movw $0x38, 2(%edi) # SYS_CODE_SEL64 from GDT
\r
73 movw $(0x0e00 | 0x8000), 4(%edi) # type = 386 interrupt gate, present
\r
74 movw %ax, 6(%edi) # write bits 31..16 of offset
\r
75 movl $0, 8(%edi) # write bits 31..16 of offset
\r
76 addl $16, %edi # move up to next descriptor
\r
77 addw DEFAULT_HANDLER_SIZE, %bx # move to next entry point
\r
78 loopl LOOP_1 # loop back through again until all descriptors are initialized
\r
80 ## at this point edi contains the offset of the descriptor for INT 20
\r
81 ## and bx contains the low 16 bits of the offset of the default handler
\r
82 ## so initialize all the rest of the descriptors with these two values...
\r
83 # mov ecx, 101 ; there are 100 descriptors left (INT 20 (14h) - INT 119 (77h)
\r
84 #@@: ; loop through all IDT entries exception handlers and initialize to default handler
\r
85 # mov word ptr [edi], bx ; write bits 15..0 of offset
\r
86 # mov word ptr [edi+2], 38h ; SYS_CODE64_SEL from GDT
\r
87 # mov word ptr [edi+4], 0e00h OR 8000h ; type = 386 interrupt gate, present
\r
88 # mov word ptr [edi+6], ax ; write bits 31..16 of offset
\r
89 # mov dword ptr [edi+8], 0 ; write bits 63..32 of offset
\r
90 # add edi, 16 ; move up to next descriptor
\r
91 # loop @b ; loop back through again until all descriptors are initialized
\r
94 ## DUMP location of IDT and several of the descriptors
\r
96 # mov eax, [offset Idtr + 2]
\r
105 ## just for fun, let's do a software interrupt to see if we correctly land in the exception handler...
\r
106 # mov eax, 011111111h
\r
107 # mov ebx, 022222222h
\r
108 # mov ecx, 033333333h
\r
109 # mov edx, 044444444h
\r
110 # mov ebp, 055555555h
\r
111 # mov esi, 066666666h
\r
112 # mov edi, 077777777h
\r
118 movl $0x22000,%esi # esi = 22000
\r
119 movl 0x14(%esi),%eax # eax = [22014]
\r
120 addl %eax,%esi # esi = 22000 + [22014] = Base of EFILDR.C
\r
121 movl 0x3c(%esi),%ebp # ebp = [22000 + [22014] + 3c] = NT Image Header for EFILDR.C
\r
123 movl 0x30(%ebp),%edi # edi = [[22000 + [22014] + 3c] + 2c] = ImageBase (63..32 is zero, ignore)
\r
124 movl 0x28(%ebp),%eax # eax = [[22000 + [22014] + 3c] + 24] = EntryPoint
\r
125 addl %edi,%eax # eax = ImageBase + EntryPoint
\r
126 movl %ebx, EfiLdrOffset
\r
127 movl %eax, (%ebx) # Modify far jump instruction for correct entry point
\r
129 movw 6(%ebp), %bx # bx = Number of sections
\r
131 movw 0x14(%ebp), %ax # ax = Optional Header Size
\r
133 addl $0x18,%ebp # ebp = Start of 1st Section
\r
136 pushl %esi # Save Base of EFILDR.C
\r
137 pushl %edi # Save ImageBase
\r
138 addl 0x14(%ebp),%esi # esi = Base of EFILDR.C + PointerToRawData
\r
139 addl 0x0c(%ebp),%edi # edi = ImageBase + VirtualAddress
\r
140 movl 0x10(%ebp),%ecx # ecs = SizeOfRawData
\r
147 popl %edi # Restore ImageBase
\r
148 popl %esi # Restore Base of EFILDR.C
\r
150 addw $0x28,%bp # ebp = ebp + 028h = Pointer to next section record
\r
158 movl (Idtr), %eax # get size of IDT
\r
163 addl 2(%edx), %eax # add to base of IDT to get location of memory map...
\r
165 movl %eax,%ecx # put argument to RCX
\r
171 .long 0x00401000 # Offset of EFILDR
\r
179 # db "**** DEFAULT IDT ENTRY ***",0
\r
183 pushl $0x0 # push error code place holder on the stack
\r
186 # db 0e9h ; jmp 16 bit reletive
\r
187 # dd commonIdtEntry - $ - 4 ; offset to jump to
\r
190 pushl $0x0 # push error code place holder on the stack
\r
195 pushl $0x0 # push error code place holder on the stack
\r
200 pushl $0x0 # push error code place holder on the stack
\r
205 pushl $0x0 # push error code place holder on the stack
\r
210 pushl $0x0 # push error code place holder on the stack
\r
215 pushl $0x0 # push error code place holder on the stack
\r
220 pushl $0x0 # push error code place holder on the stack
\r
225 # Double fault causes an error code to be pushed so no phony push necessary
\r
232 pushl $0x0 # push error code place holder on the stack
\r
237 # Invalid TSS causes an error code to be pushed so no phony push necessary
\r
244 # Segment Not Present causes an error code to be pushed so no phony push necessary
\r
251 # Stack fault causes an error code to be pushed so no phony push necessary
\r
258 # GP fault causes an error code to be pushed so no phony push necessary
\r
265 # Page fault causes an error code to be pushed so no phony push necessary
\r
272 pushl $0x0 # push error code place holder on the stack
\r
277 pushl $0x0 # push error code place holder on the stack
\r
282 # Alignment check causes an error code to be pushed so no phony push necessary
\r
289 pushl $0x0 # push error code place holder on the stack
\r
294 pushl $0x0 # push error code place holder on the stack
\r
299 # The following segment repeats (0x78 - 20) times:
\r
301 pushl $0x0 # push error code place holder on the stack
\r
302 # push xxh ; push vector number
\r
304 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
307 pushl $0x0 # push error code place holder on the stack
\r
308 # push xxh ; push vector number
\r
310 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
313 pushl $0x0 # push error code place holder on the stack
\r
314 # push xxh ; push vector number
\r
316 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
319 pushl $0x0 # push error code place holder on the stack
\r
320 # push xxh ; push vector number
\r
322 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
325 pushl $0x0 # push error code place holder on the stack
\r
326 # push xxh ; push vector number
\r
328 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
331 pushl $0x0 # push error code place holder on the stack
\r
332 # push xxh ; push vector number
\r
334 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
337 pushl $0x0 # push error code place holder on the stack
\r
338 # push xxh ; push vector number
\r
340 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
343 pushl $0x0 # push error code place holder on the stack
\r
344 # push xxh ; push vector number
\r
346 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
349 pushl $0x0 # push error code place holder on the stack
\r
350 # push xxh ; push vector number
\r
352 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
355 pushl $0x0 # push error code place holder on the stack
\r
356 # push xxh ; push vector number
\r
358 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
361 pushl $0x0 # push error code place holder on the stack
\r
362 # push xxh ; push vector number
\r
364 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
367 pushl $0x0 # push error code place holder on the stack
\r
368 # push xxh ; push vector number
\r
370 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
373 pushl $0x0 # push error code place holder on the stack
\r
374 # push xxh ; push vector number
\r
376 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
379 pushl $0x0 # push error code place holder on the stack
\r
380 # push xxh ; push vector number
\r
382 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
385 pushl $0x0 # push error code place holder on the stack
\r
386 # push xxh ; push vector number
\r
388 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
391 pushl $0x0 # push error code place holder on the stack
\r
392 # push xxh ; push vector number
\r
394 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
397 pushl $0x0 # push error code place holder on the stack
\r
398 # push xxh ; push vector number
\r
400 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
403 pushl $0x0 # push error code place holder on the stack
\r
404 # push xxh ; push vector number
\r
406 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
409 pushl $0x0 # push error code place holder on the stack
\r
410 # push xxh ; push vector number
\r
412 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
415 pushl $0x0 # push error code place holder on the stack
\r
416 # push xxh ; push vector number
\r
418 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
421 pushl $0x0 # push error code place holder on the stack
\r
422 # push xxh ; push vector number
\r
424 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
427 pushl $0x0 # push error code place holder on the stack
\r
428 # push xxh ; push vector number
\r
430 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
433 pushl $0x0 # push error code place holder on the stack
\r
434 # push xxh ; push vector number
\r
436 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
439 pushl $0x0 # push error code place holder on the stack
\r
440 # push xxh ; push vector number
\r
442 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
445 pushl $0x0 # push error code place holder on the stack
\r
446 # push xxh ; push vector number
\r
448 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
451 pushl $0x0 # push error code place holder on the stack
\r
452 # push xxh ; push vector number
\r
454 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
457 pushl $0x0 # push error code place holder on the stack
\r
458 # push xxh ; push vector number
\r
460 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
463 pushl $0x0 # push error code place holder on the stack
\r
464 # push xxh ; push vector number
\r
466 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
469 pushl $0x0 # push error code place holder on the stack
\r
470 # push xxh ; push vector number
\r
472 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
475 pushl $0x0 # push error code place holder on the stack
\r
476 # push xxh ; push vector number
\r
478 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
481 pushl $0x0 # push error code place holder on the stack
\r
482 # push xxh ; push vector number
\r
484 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
487 pushl $0x0 # push error code place holder on the stack
\r
488 # push xxh ; push vector number
\r
490 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
493 pushl $0x0 # push error code place holder on the stack
\r
494 # push xxh ; push vector number
\r
496 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
499 pushl $0x0 # push error code place holder on the stack
\r
500 # push xxh ; push vector number
\r
502 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
505 pushl $0x0 # push error code place holder on the stack
\r
506 # push xxh ; push vector number
\r
508 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
511 pushl $0x0 # push error code place holder on the stack
\r
512 # push xxh ; push vector number
\r
514 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
517 pushl $0x0 # push error code place holder on the stack
\r
518 # push xxh ; push vector number
\r
520 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
523 pushl $0x0 # push error code place holder on the stack
\r
524 # push xxh ; push vector number
\r
526 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
529 pushl $0x0 # push error code place holder on the stack
\r
530 # push xxh ; push vector number
\r
532 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
535 pushl $0x0 # push error code place holder on the stack
\r
536 # push xxh ; push vector number
\r
538 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
541 pushl $0x0 # push error code place holder on the stack
\r
542 # push xxh ; push vector number
\r
544 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
547 pushl $0x0 # push error code place holder on the stack
\r
548 # push xxh ; push vector number
\r
550 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
553 pushl $0x0 # push error code place holder on the stack
\r
554 # push xxh ; push vector number
\r
556 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
559 pushl $0x0 # push error code place holder on the stack
\r
560 # push xxh ; push vector number
\r
562 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
565 pushl $0x0 # push error code place holder on the stack
\r
566 # push xxh ; push vector number
\r
568 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
571 pushl $0x0 # push error code place holder on the stack
\r
572 # push xxh ; push vector number
\r
574 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
577 pushl $0x0 # push error code place holder on the stack
\r
578 # push xxh ; push vector number
\r
580 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
583 pushl $0x0 # push error code place holder on the stack
\r
584 # push xxh ; push vector number
\r
586 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
589 pushl $0x0 # push error code place holder on the stack
\r
590 # push xxh ; push vector number
\r
592 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
595 pushl $0x0 # push error code place holder on the stack
\r
596 # push xxh ; push vector number
\r
598 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
601 pushl $0x0 # push error code place holder on the stack
\r
602 # push xxh ; push vector number
\r
604 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
607 pushl $0x0 # push error code place holder on the stack
\r
608 # push xxh ; push vector number
\r
610 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
613 pushl $0x0 # push error code place holder on the stack
\r
614 # push xxh ; push vector number
\r
616 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
619 pushl $0x0 # push error code place holder on the stack
\r
620 # push xxh ; push vector number
\r
622 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
625 pushl $0x0 # push error code place holder on the stack
\r
626 # push xxh ; push vector number
\r
628 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
631 pushl $0x0 # push error code place holder on the stack
\r
632 # push xxh ; push vector number
\r
634 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
637 pushl $0x0 # push error code place holder on the stack
\r
638 # push xxh ; push vector number
\r
640 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
643 pushl $0x0 # push error code place holder on the stack
\r
644 # push xxh ; push vector number
\r
646 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
649 pushl $0x0 # push error code place holder on the stack
\r
650 # push xxh ; push vector number
\r
652 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
655 pushl $0x0 # push error code place holder on the stack
\r
656 # push xxh ; push vector number
\r
658 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
661 pushl $0x0 # push error code place holder on the stack
\r
662 # push xxh ; push vector number
\r
664 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
667 pushl $0x0 # push error code place holder on the stack
\r
668 # push xxh ; push vector number
\r
670 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
673 pushl $0x0 # push error code place holder on the stack
\r
674 # push xxh ; push vector number
\r
676 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
679 pushl $0x0 # push error code place holder on the stack
\r
680 # push xxh ; push vector number
\r
682 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
685 pushl $0x0 # push error code place holder on the stack
\r
686 # push xxh ; push vector number
\r
688 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
691 pushl $0x0 # push error code place holder on the stack
\r
692 # push xxh ; push vector number
\r
694 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
697 pushl $0x0 # push error code place holder on the stack
\r
698 # push xxh ; push vector number
\r
700 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
703 pushl $0x0 # push error code place holder on the stack
\r
704 # push xxh ; push vector number
\r
706 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
709 pushl $0x0 # push error code place holder on the stack
\r
710 # push xxh ; push vector number
\r
712 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
715 pushl $0x0 # push error code place holder on the stack
\r
716 # push xxh ; push vector number
\r
718 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
721 pushl $0x0 # push error code place holder on the stack
\r
722 # push xxh ; push vector number
\r
724 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
727 pushl $0x0 # push error code place holder on the stack
\r
728 # push xxh ; push vector number
\r
730 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
733 pushl $0x0 # push error code place holder on the stack
\r
734 # push xxh ; push vector number
\r
736 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
739 pushl $0x0 # push error code place holder on the stack
\r
740 # push xxh ; push vector number
\r
742 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
745 pushl $0x0 # push error code place holder on the stack
\r
746 # push xxh ; push vector number
\r
748 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
751 pushl $0x0 # push error code place holder on the stack
\r
752 # push xxh ; push vector number
\r
754 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
757 pushl $0x0 # push error code place holder on the stack
\r
758 # push xxh ; push vector number
\r
760 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
763 pushl $0x0 # push error code place holder on the stack
\r
764 # push xxh ; push vector number
\r
766 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
769 pushl $0x0 # push error code place holder on the stack
\r
770 # push xxh ; push vector number
\r
772 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
775 pushl $0x0 # push error code place holder on the stack
\r
776 # push xxh ; push vector number
\r
778 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
781 pushl $0x0 # push error code place holder on the stack
\r
782 # push xxh ; push vector number
\r
784 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
787 pushl $0x0 # push error code place holder on the stack
\r
788 # push xxh ; push vector number
\r
790 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
793 pushl $0x0 # push error code place holder on the stack
\r
794 # push xxh ; push vector number
\r
796 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
799 pushl $0x0 # push error code place holder on the stack
\r
800 # push xxh ; push vector number
\r
802 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
805 pushl $0x0 # push error code place holder on the stack
\r
806 # push xxh ; push vector number
\r
808 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
811 pushl $0x0 # push error code place holder on the stack
\r
812 # push xxh ; push vector number
\r
814 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
817 pushl $0x0 # push error code place holder on the stack
\r
818 # push xxh ; push vector number
\r
820 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
823 pushl $0x0 # push error code place holder on the stack
\r
824 # push xxh ; push vector number
\r
826 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
829 pushl $0x0 # push error code place holder on the stack
\r
830 # push xxh ; push vector number
\r
832 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
835 pushl $0x0 # push error code place holder on the stack
\r
836 # push xxh ; push vector number
\r
838 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
841 pushl $0x0 # push error code place holder on the stack
\r
842 # push xxh ; push vector number
\r
844 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
847 pushl $0x0 # push error code place holder on the stack
\r
848 # push xxh ; push vector number
\r
850 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
853 pushl $0x0 # push error code place holder on the stack
\r
854 # push xxh ; push vector number
\r
856 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
859 pushl $0x0 # push error code place holder on the stack
\r
860 # push xxh ; push vector number
\r
862 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
865 pushl $0x0 # push error code place holder on the stack
\r
866 # push xxh ; push vector number
\r
868 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
871 pushl $0x0 # push error code place holder on the stack
\r
872 # push xxh ; push vector number
\r
874 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
877 pushl $0x0 # push error code place holder on the stack
\r
878 # push xxh ; push vector number
\r
880 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
883 pushl $0x0 # push error code place holder on the stack
\r
884 # push xxh ; push vector number
\r
886 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
889 pushl $0x0 # push error code place holder on the stack
\r
890 # push xxh ; push vector number
\r
892 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
895 pushl $0x0 # push error code place holder on the stack
\r
896 # push xxh ; push vector number
\r
898 .byte ( . - INTUnknown - 3 ) / 9 + 20 # vector number
\r
940 ## At this point the stack looks like this:
\r
948 ## Int num or 0ffh for unknown int num
\r
964 ## r15 <------- RSP, RBP
\r
971 movl 16*8(%ebp),%eax ## move Int number into RAX
\r
974 ja PrintDefaultString
\r
975 PrintExceptionString:
\r
976 shll $3,%eax ## multiply by 8 to get offset from StringTable to actual string address
\r
977 addl StringTable, %eax
\r
980 PrintDefaultString:
\r
981 movl IntUnknownString, %esi
\r
995 movl 19*8(%ebp),%eax # CS
\r
1001 movl 18*8(%ebp),%eax # RIP
\r
1003 movl String3, %esi
\r
1006 movl $0xb8140,%edi
\r
1008 movl StringRax, %esi
\r
1011 movl 15*8(%ebp),%eax
\r
1014 movl StringRcx, %esi
\r
1017 movl 14*8(%ebp),%eax
\r
1020 movl StringRdx, %esi
\r
1023 movl 13*8(%ebp),%eax
\r
1026 movl $0xb81e0,%edi
\r
1028 movl StringRbx, %esi
\r
1031 movl 12*8(%ebp),%eax
\r
1034 movl StringRsp, %esi
\r
1037 movl 21*8(%ebp),%eax
\r
1040 movl StringRbp, %esi
\r
1043 movl 10*8(%ebp),%eax
\r
1046 movl $0xb8280,%edi
\r
1048 movl StringRsi, %esi
\r
1051 movl 9*8(%ebp),%eax
\r
1054 movl StringRdi, %esi
\r
1057 movl 8*8(%ebp),%eax
\r
1060 movl StringEcode, %esi
\r
1063 movl 17*8(%ebp),%eax
\r
1066 movl $0xb8320,%edi
\r
1068 movl StringR8, %esi
\r
1071 movl 7*8(%ebp),%eax
\r
1074 movl StringR9, %esi
\r
1077 movl 6*8(%ebp),%eax
\r
1080 movl StringR10, %esi
\r
1083 movl 5*8(%ebp),%eax
\r
1086 movl $0xb83c0,%edi
\r
1088 movl StringR11, %esi
\r
1091 movl 4*8(%ebp),%eax
\r
1094 movl StringR12, %esi
\r
1097 movl 3*8(%ebp),%eax
\r
1100 movl StringR13, %esi
\r
1103 movl 2*8(%ebp),%eax
\r
1106 movl $0xb8460,%edi
\r
1108 movl StringR14, %esi
\r
1111 movl 1*8(%ebp),%eax
\r
1114 movl StringR15, %esi
\r
1117 movl 0*8(%ebp),%eax
\r
1120 movl StringSs, %esi
\r
1123 movl 22*8(%ebp),%eax
\r
1126 movl $0xb8500,%edi
\r
1128 movl StringRflags, %esi
\r
1131 movl 20*8(%ebp),%eax
\r
1134 movl $0xb8640,%edi
\r
1163 movl $0xb8960,%edi
\r
1166 movl 18*8(%ebp),%eax # RIP
\r
1169 movl %eax,%esi # esi = rip - 8 QWORD linear (total 16 QWORD)
\r
1241 # add esp, 16 ; error code and INT number
\r
1263 ## RAX contains qword to print
\r
1264 ## RDI contains memory location (screen location) to print it to
\r
1301 movl $0xb8000,%edi
\r
1307 movl $0xb8000,%edi
\r
1323 String1: .asciz "*** INT "
\r
1325 Int0String: .asciz "00h Divide by 0 -"
\r
1326 Int1String: .asciz "01h Debug exception -"
\r
1327 Int2String: .asciz "02h NMI -"
\r
1328 Int3String: .asciz "03h Breakpoint -"
\r
1329 Int4String: .asciz "04h Overflow -"
\r
1330 Int5String: .asciz "05h Bound -"
\r
1331 Int6String: .asciz "06h Invalid opcode -"
\r
1332 Int7String: .asciz "07h Device not available -"
\r
1333 Int8String: .asciz "08h Double fault -"
\r
1334 Int9String: .asciz "09h Coprocessor seg overrun (reserved) -"
\r
1335 Int10String: .asciz "0Ah Invalid TSS -"
\r
1336 Int11String: .asciz "0Bh Segment not present -"
\r
1337 Int12String: .asciz "0Ch Stack fault -"
\r
1338 Int13String: .asciz "0Dh General protection fault -"
\r
1339 Int14String: .asciz "0Eh Page fault -"
\r
1340 Int15String: .asciz "0Fh (Intel reserved) -"
\r
1341 Int16String: .asciz "10h Floating point error -"
\r
1342 Int17String: .asciz "11h Alignment check -"
\r
1343 Int18String: .asciz "12h Machine check -"
\r
1344 Int19String: .asciz "13h SIMD Floating-Point Exception -"
\r
1345 IntUnknownString: .asciz "??h Unknown interrupt -"
\r
1347 StringTable: .long Int0String, Int1String, Int2String, Int3String, \
\r
1348 Int4String, Int5String, Int6String, Int7String, \
\r
1349 Int8String, Int9String, Int10String, Int11String, \
\r
1350 Int12String, Int13String, Int14String, Int15String,\
\r
1351 Int16String, Int17String, Int18String, Int19String
\r
1353 String2: .asciz " HALT!! *** ("
\r
1354 String3: .asciz ")"
\r
1355 StringRax: .asciz "RAX="
\r
1356 StringRcx: .asciz " RCX="
\r
1357 StringRdx: .asciz " RDX="
\r
1358 StringRbx: .asciz "RBX="
\r
1359 StringRsp: .asciz " RSP="
\r
1360 StringRbp: .asciz " RBP="
\r
1361 StringRsi: .asciz "RSI="
\r
1362 StringRdi: .asciz " RDI="
\r
1363 StringEcode: .asciz " ECODE="
\r
1364 StringR8: .asciz "R8 ="
\r
1365 StringR9: .asciz " R9 ="
\r
1366 StringR10: .asciz " R10="
\r
1367 StringR11: .asciz "R11="
\r
1368 StringR12: .asciz " R12="
\r
1369 StringR13: .asciz " R13="
\r
1370 StringR14: .asciz "R14="
\r
1371 StringR15: .asciz " R15="
\r
1372 StringSs: .asciz " SS ="
\r
1373 StringRflags: .asciz "RFLAGS="
\r