]>
Commit | Line | Data |
---|---|---|
ccec4c39 | 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 | |
ccec4c39 | 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 | #* efi32.asm\r | |
13 | #* \r | |
14 | #* Abstract:\r | |
15 | #*\r | |
16 | #------------------------------------------------------------------------------\r | |
17 | \r | |
18 | ##############################################################################\r | |
19 | # Now in 32-bit protected mode.\r | |
20 | ##############################################################################\r | |
21 | \r | |
f3eb2131 | 22 | .org 0x21000\r |
23 | \r | |
24 | .global _start\r | |
25 | _start:\r | |
ccec4c39 | 26 | \r |
27 | .equ DEFAULT_HANDLER_SIZE, INT1 - INT0\r | |
28 | \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 | |
3bd0ef80 | 36 | .long commonIdtEntry - . - 4 # offset to jump to \r |
ccec4c39 | 37 | .endm\r |
38 | \r | |
39 | Start: \r | |
40 | movw %ax, %ds\r | |
41 | movw %ax, %es\r | |
42 | movw %ax, %fs\r | |
43 | movw %ax, %gs\r | |
44 | movw %ax, %ss\r | |
45 | movl $0x001ffff0, %esp\r | |
46 | \r | |
47 | call ClearScreen\r | |
48 | \r | |
49 | # Populate IDT with meaningful offsets for exception handlers...\r | |
50 | sidt Idtr \r | |
51 | \r | |
52 | movl Halt, %eax\r | |
53 | movl %eax, %ebx # use bx to copy 15..0 to descriptors\r | |
54 | shrl $16, %eax # use ax to copy 31..16 to descriptors \r | |
55 | movl $0x78, %ecx # 78h IDT entries to initialize with unique entry points (exceptions)\r | |
56 | movl (Idtr + 2), %esi\r | |
57 | movl (%esi), %edi\r | |
58 | \r | |
3bd0ef80 | 59 | LOOP_1: # loop through all IDT entries exception handlers and initialize to default handler\r |
ccec4c39 | 60 | movw %bx, (%edi) # write bits 15..0 of offset\r |
61 | movw $0x20, 2(%edi) # SYS_CODE_SEL from GDT\r | |
b29a823d | 62 | movw $(0x0e00 | 0x8000), 4(%edi) # type = 386 interrupt gate, present\r |
ccec4c39 | 63 | movw %ax, 6(%edi) # write bits 31..16 of offset\r |
64 | addl $8, %edi # move up to next descriptor\r | |
65 | addw DEFAULT_HANDLER_SIZE, %bx # move to next entry point\r | |
66 | loopl LOOP_1 # loop back through again until all descriptors are initialized\r | |
67 | \r | |
68 | ## at this point edi contains the offset of the descriptor for INT 20\r | |
69 | ## and bx contains the low 16 bits of the offset of the default handler\r | |
70 | ## so initialize all the rest of the descriptors with these two values...\r | |
71 | # mov ecx, 101 ; there are 100 descriptors left (INT 20 (14h) - INT 119 (77h)\r | |
72 | #@@: ; loop through all IDT entries exception handlers and initialize to default handler\r | |
73 | # mov word ptr [edi], bx ; write bits 15..0 of offset\r | |
74 | # mov word ptr [edi+2], 20h ; SYS_CODE_SEL from GDT\r | |
75 | # mov word ptr [edi+4], 0e00h OR 8000h ; type = 386 interrupt gate, present\r | |
76 | # mov word ptr [edi+6], ax ; write bits 31..16 of offset\r | |
77 | # add edi, 8 ; move up to next descriptor\r | |
78 | # loop @b ; loop back through again until all descriptors are initialized\r | |
79 | \r | |
80 | \r | |
81 | ## DUMP location of IDT and several of the descriptors\r | |
82 | # mov ecx, 8\r | |
83 | # mov eax, [offset Idtr + 2]\r | |
84 | # mov eax, [eax]\r | |
85 | # mov edi, 0b8000h\r | |
86 | # call PrintDword\r | |
87 | # mov esi, eax\r | |
88 | # mov edi, 0b80a0h\r | |
89 | # jmp OuterLoop\r | |
90 | \r | |
91 | ## \r | |
92 | ## just for fun, let's do a software interrupt to see if we correctly land in the exception handler...\r | |
93 | # mov eax, 011111111h\r | |
94 | # mov ebx, 022222222h\r | |
95 | # mov ecx, 033333333h\r | |
96 | # mov edx, 044444444h\r | |
97 | # mov ebp, 055555555h\r | |
98 | # mov esi, 066666666h\r | |
99 | # mov edi, 077777777h\r | |
100 | # push 011111111h\r | |
101 | # push 022222222h\r | |
102 | # push 033333333h\r | |
103 | # int 119\r | |
104 | \r | |
105 | \r | |
106 | movl $0x22000, %esi # esi = 22000\r | |
107 | movl 0x14(%esi), %eax # eax = [22014]\r | |
108 | addl %eax, %esi # esi = 22000 + [22014] = Base of EFILDR.C\r | |
109 | movl 0x3c(%esi), %ebp # ebp = [22000 + [22014] + 3c] = NT Image Header for EFILDR.C\r | |
110 | addl %esi, %ebp\r | |
111 | movl 0x34(%ebp), %edi # edi = [[22000 + [22014] + 3c] + 30] = ImageBase\r | |
112 | movl 0x28(%ebp), %eax # eax = [[22000 + [22014] + 3c] + 24] = EntryPoint\r | |
113 | addl %edi, %eax # eax = ImageBase + EntryPoint\r | |
114 | movl %eax, EfiLdrOffset # Modify far jump instruction for correct entry point\r | |
115 | \r | |
116 | movw 6(%ebp), %bx # bx = Number of sections\r | |
117 | xorl %eax, %eax\r | |
118 | movw 0x14(%ebp), %ax # ax = Optional Header Size\r | |
119 | addl %eax, %ebp\r | |
120 | addl $0x18, %ebp # ebp = Start of 1st Section\r | |
121 | \r | |
122 | SectionLoop: \r | |
123 | pushl %esi # Save Base of EFILDR.C\r | |
124 | pushl %edi # Save ImageBase\r | |
125 | addl 0x14(%ebp), %esi # esi = Base of EFILDR.C + PointerToRawData\r | |
126 | addl 0x0c(%ebp), %edi # edi = ImageBase + VirtualAddress\r | |
127 | movl 0x10(%ebp), %ecx # ecs = SizeOfRawData\r | |
128 | \r | |
129 | cld\r | |
130 | shrl $2, %ecx\r | |
131 | rep\r | |
132 | movsl\r | |
133 | \r | |
134 | popl %edi # Restore ImageBase\r | |
135 | popl %esi # Restore Base of EFILDR.C\r | |
136 | \r | |
137 | addw $0x28, %bp # ebp = ebp + 028h = Pointer to next section record\r | |
138 | decw %bx\r | |
139 | cmpw $0, %bx\r | |
140 | jne SectionLoop\r | |
141 | \r | |
3bd0ef80 | 142 | movzwl (Idtr), %eax # get size of IDT\r |
ccec4c39 | 143 | incl %eax\r |
3bd0ef80 | 144 | addl (Idtr + 2), %eax # add to base of IDT to get location of memory map... \r |
ccec4c39 | 145 | pushl %eax # push memory map location on stack for call to EFILDR...\r |
146 | \r | |
147 | pushl %eax # push return address (useless, just for stack balance)\r | |
148 | .byte 0xb8\r | |
149 | EfiLdrOffset: \r | |
150 | .long 0x00401000 # Offset of EFILDR\r | |
151 | # mov eax, 401000h\r | |
152 | pushl %eax\r | |
153 | ret\r | |
154 | \r | |
155 | # db "**** DEFAULT IDT ENTRY ***",0\r | |
9811c392 | 156 | .p2align 1\r |
ccec4c39 | 157 | Halt: \r |
158 | INT0: \r | |
159 | pushl $0x0 # push error code place holder on the stack\r | |
160 | pushl $0x0\r | |
161 | jmpCommonIdtEntry \r | |
162 | # db 0e9h ; jmp 16 bit reletive \r | |
163 | # dd commonIdtEntry - $ - 4 ; offset to jump to\r | |
164 | \r | |
165 | INT1: \r | |
166 | pushl $0x0 # push error code place holder on the stack\r | |
167 | pushl $0x1\r | |
168 | jmpCommonIdtEntry \r | |
169 | \r | |
170 | INT2: \r | |
171 | pushl $0x0 # push error code place holder on the stack\r | |
172 | pushl $0x2\r | |
173 | jmpCommonIdtEntry \r | |
174 | \r | |
175 | INT3: \r | |
176 | pushl $0x0 # push error code place holder on the stack\r | |
177 | pushl $0x3\r | |
178 | jmpCommonIdtEntry \r | |
179 | \r | |
180 | INT4: \r | |
181 | pushl $0x0 # push error code place holder on the stack\r | |
182 | pushl $0x4\r | |
183 | jmpCommonIdtEntry \r | |
184 | \r | |
185 | INT5: \r | |
186 | pushl $0x0 # push error code place holder on the stack\r | |
187 | pushl $0x5\r | |
188 | jmpCommonIdtEntry \r | |
189 | \r | |
190 | INT6: \r | |
191 | pushl $0x0 # push error code place holder on the stack\r | |
192 | pushl $0x6\r | |
193 | jmpCommonIdtEntry \r | |
194 | \r | |
195 | INT7: \r | |
196 | pushl $0x0 # push error code place holder on the stack\r | |
197 | pushl $0x7\r | |
198 | jmpCommonIdtEntry \r | |
199 | \r | |
200 | INT8: \r | |
201 | # Double fault causes an error code to be pushed so no phony push necessary\r | |
202 | nop\r | |
203 | nop\r | |
204 | pushl $0x8\r | |
205 | jmpCommonIdtEntry \r | |
206 | \r | |
207 | INT9: \r | |
208 | pushl $0x0 # push error code place holder on the stack\r | |
209 | pushl $0x9\r | |
210 | jmpCommonIdtEntry \r | |
211 | \r | |
212 | INT10: \r | |
213 | # Invalid TSS causes an error code to be pushed so no phony push necessary\r | |
214 | nop\r | |
215 | nop\r | |
216 | pushl $10\r | |
217 | jmpCommonIdtEntry \r | |
218 | \r | |
219 | INT11: \r | |
220 | # Segment Not Present causes an error code to be pushed so no phony push necessary\r | |
221 | nop\r | |
222 | nop\r | |
223 | pushl $11\r | |
224 | jmpCommonIdtEntry \r | |
225 | \r | |
226 | INT12: \r | |
227 | # Stack fault causes an error code to be pushed so no phony push necessary\r | |
228 | nop\r | |
229 | nop\r | |
230 | pushl $12\r | |
231 | jmpCommonIdtEntry \r | |
232 | \r | |
233 | INT13: \r | |
234 | # GP fault causes an error code to be pushed so no phony push necessary\r | |
235 | nop\r | |
236 | nop\r | |
237 | pushl $13\r | |
238 | jmpCommonIdtEntry \r | |
239 | \r | |
240 | INT14: \r | |
241 | # Page fault causes an error code to be pushed so no phony push necessary\r | |
242 | nop\r | |
243 | nop\r | |
244 | pushl $14\r | |
245 | jmpCommonIdtEntry \r | |
246 | \r | |
247 | INT15: \r | |
248 | pushl $0x0 # push error code place holder on the stack\r | |
249 | pushl $15\r | |
250 | jmpCommonIdtEntry \r | |
251 | \r | |
252 | INT16: \r | |
253 | pushl $0x0 # push error code place holder on the stack\r | |
254 | pushl $16\r | |
255 | jmpCommonIdtEntry \r | |
256 | \r | |
257 | INT17: \r | |
258 | # Alignment check causes an error code to be pushed so no phony push necessary\r | |
259 | nop\r | |
260 | nop\r | |
261 | pushl $17\r | |
262 | jmpCommonIdtEntry \r | |
263 | \r | |
264 | INT18: \r | |
265 | pushl $0x0 # push error code place holder on the stack\r | |
266 | pushl $18\r | |
267 | jmpCommonIdtEntry \r | |
268 | \r | |
269 | INT19: \r | |
270 | pushl $0x0 # push error code place holder on the stack\r | |
271 | pushl $19\r | |
272 | jmpCommonIdtEntry \r | |
273 | \r | |
274 | INTUnknown: \r | |
208628f8 | 275 | # The following segment repeats (0x78 - 20) times:\r |
276 | # No. 1\r | |
ccec4c39 | 277 | pushl $0x0 # push error code place holder on the stack\r |
278 | # push $0xxx # push vector number\r | |
279 | .byte 0x6a\r | |
280 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
281 | jmpCommonIdtEntry \r | |
208628f8 | 282 | # No. 2\r |
283 | pushl $0x0 # push error code place holder on the stack\r | |
284 | # push $0xxx # push vector number\r | |
285 | .byte 0x6a\r | |
286 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
287 | jmpCommonIdtEntry \r | |
288 | # No. 3\r | |
289 | pushl $0x0 # push error code place holder on the stack\r | |
290 | # push $0xxx # push vector number\r | |
291 | .byte 0x6a\r | |
292 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
293 | jmpCommonIdtEntry \r | |
294 | # No. 4\r | |
295 | pushl $0x0 # push error code place holder on the stack\r | |
296 | # push $0xxx # push vector number\r | |
297 | .byte 0x6a\r | |
298 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
299 | jmpCommonIdtEntry \r | |
300 | # No. 5\r | |
301 | pushl $0x0 # push error code place holder on the stack\r | |
302 | # push $0xxx # push vector number\r | |
303 | .byte 0x6a\r | |
304 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
305 | jmpCommonIdtEntry \r | |
306 | # No. 6\r | |
307 | pushl $0x0 # push error code place holder on the stack\r | |
308 | # push $0xxx # push vector number\r | |
309 | .byte 0x6a\r | |
310 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
311 | jmpCommonIdtEntry \r | |
312 | # No. 7\r | |
313 | pushl $0x0 # push error code place holder on the stack\r | |
314 | # push $0xxx # push vector number\r | |
315 | .byte 0x6a\r | |
316 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
317 | jmpCommonIdtEntry \r | |
318 | # No. 8\r | |
319 | pushl $0x0 # push error code place holder on the stack\r | |
320 | # push $0xxx # push vector number\r | |
321 | .byte 0x6a\r | |
322 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
323 | jmpCommonIdtEntry \r | |
324 | # No. 9\r | |
325 | pushl $0x0 # push error code place holder on the stack\r | |
326 | # push $0xxx # push vector number\r | |
327 | .byte 0x6a\r | |
328 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
329 | jmpCommonIdtEntry \r | |
330 | # No. 10\r | |
331 | pushl $0x0 # push error code place holder on the stack\r | |
332 | # push $0xxx # push vector number\r | |
333 | .byte 0x6a\r | |
334 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
335 | jmpCommonIdtEntry \r | |
336 | # No. 11\r | |
337 | pushl $0x0 # push error code place holder on the stack\r | |
338 | # push $0xxx # push vector number\r | |
339 | .byte 0x6a\r | |
340 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
341 | jmpCommonIdtEntry \r | |
342 | # No. 12\r | |
343 | pushl $0x0 # push error code place holder on the stack\r | |
344 | # push $0xxx # push vector number\r | |
345 | .byte 0x6a\r | |
346 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
347 | jmpCommonIdtEntry \r | |
348 | # No. 13\r | |
349 | pushl $0x0 # push error code place holder on the stack\r | |
350 | # push $0xxx # push vector number\r | |
351 | .byte 0x6a\r | |
352 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
353 | jmpCommonIdtEntry \r | |
354 | # No. 14\r | |
355 | pushl $0x0 # push error code place holder on the stack\r | |
356 | # push $0xxx # push vector number\r | |
357 | .byte 0x6a\r | |
358 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
359 | jmpCommonIdtEntry \r | |
360 | # No. 15\r | |
361 | pushl $0x0 # push error code place holder on the stack\r | |
362 | # push $0xxx # push vector number\r | |
363 | .byte 0x6a\r | |
364 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
365 | jmpCommonIdtEntry \r | |
366 | # No. 16\r | |
367 | pushl $0x0 # push error code place holder on the stack\r | |
368 | # push $0xxx # push vector number\r | |
369 | .byte 0x6a\r | |
370 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
371 | jmpCommonIdtEntry \r | |
372 | # No. 17\r | |
373 | pushl $0x0 # push error code place holder on the stack\r | |
374 | # push $0xxx # push vector number\r | |
375 | .byte 0x6a\r | |
376 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
377 | jmpCommonIdtEntry \r | |
378 | # No. 18\r | |
379 | pushl $0x0 # push error code place holder on the stack\r | |
380 | # push $0xxx # push vector number\r | |
381 | .byte 0x6a\r | |
382 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
383 | jmpCommonIdtEntry \r | |
384 | # No. 19\r | |
385 | pushl $0x0 # push error code place holder on the stack\r | |
386 | # push $0xxx # push vector number\r | |
387 | .byte 0x6a\r | |
388 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
389 | jmpCommonIdtEntry \r | |
390 | # No. 20\r | |
391 | pushl $0x0 # push error code place holder on the stack\r | |
392 | # push $0xxx # push vector number\r | |
393 | .byte 0x6a\r | |
394 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
395 | jmpCommonIdtEntry \r | |
396 | # No. 21\r | |
397 | pushl $0x0 # push error code place holder on the stack\r | |
398 | # push $0xxx # push vector number\r | |
399 | .byte 0x6a\r | |
400 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
401 | jmpCommonIdtEntry \r | |
402 | # No. 22\r | |
403 | pushl $0x0 # push error code place holder on the stack\r | |
404 | # push $0xxx # push vector number\r | |
405 | .byte 0x6a\r | |
406 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
407 | jmpCommonIdtEntry \r | |
408 | # No. 23\r | |
409 | pushl $0x0 # push error code place holder on the stack\r | |
410 | # push $0xxx # push vector number\r | |
411 | .byte 0x6a\r | |
412 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
413 | jmpCommonIdtEntry \r | |
414 | # No. 24\r | |
415 | pushl $0x0 # push error code place holder on the stack\r | |
416 | # push $0xxx # push vector number\r | |
417 | .byte 0x6a\r | |
418 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
419 | jmpCommonIdtEntry \r | |
420 | # No. 25\r | |
421 | pushl $0x0 # push error code place holder on the stack\r | |
422 | # push $0xxx # push vector number\r | |
423 | .byte 0x6a\r | |
424 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
425 | jmpCommonIdtEntry \r | |
426 | # No. 26\r | |
427 | pushl $0x0 # push error code place holder on the stack\r | |
428 | # push $0xxx # push vector number\r | |
429 | .byte 0x6a\r | |
430 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
431 | jmpCommonIdtEntry \r | |
432 | # No. 27\r | |
433 | pushl $0x0 # push error code place holder on the stack\r | |
434 | # push $0xxx # push vector number\r | |
435 | .byte 0x6a\r | |
436 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
437 | jmpCommonIdtEntry \r | |
438 | # No. 28\r | |
439 | pushl $0x0 # push error code place holder on the stack\r | |
440 | # push $0xxx # push vector number\r | |
441 | .byte 0x6a\r | |
442 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
443 | jmpCommonIdtEntry \r | |
444 | # No. 29\r | |
445 | pushl $0x0 # push error code place holder on the stack\r | |
446 | # push $0xxx # push vector number\r | |
447 | .byte 0x6a\r | |
448 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
449 | jmpCommonIdtEntry \r | |
450 | # No. 30\r | |
451 | pushl $0x0 # push error code place holder on the stack\r | |
452 | # push $0xxx # push vector number\r | |
453 | .byte 0x6a\r | |
454 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
455 | jmpCommonIdtEntry \r | |
456 | # No. 31\r | |
457 | pushl $0x0 # push error code place holder on the stack\r | |
458 | # push $0xxx # push vector number\r | |
459 | .byte 0x6a\r | |
460 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
461 | jmpCommonIdtEntry \r | |
462 | # No. 32\r | |
463 | pushl $0x0 # push error code place holder on the stack\r | |
464 | # push $0xxx # push vector number\r | |
465 | .byte 0x6a\r | |
466 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
467 | jmpCommonIdtEntry \r | |
468 | # No. 33\r | |
469 | pushl $0x0 # push error code place holder on the stack\r | |
470 | # push $0xxx # push vector number\r | |
471 | .byte 0x6a\r | |
472 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
473 | jmpCommonIdtEntry \r | |
474 | # No. 34\r | |
475 | pushl $0x0 # push error code place holder on the stack\r | |
476 | # push $0xxx # push vector number\r | |
477 | .byte 0x6a\r | |
478 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
479 | jmpCommonIdtEntry \r | |
480 | # No. 35\r | |
481 | pushl $0x0 # push error code place holder on the stack\r | |
482 | # push $0xxx # push vector number\r | |
483 | .byte 0x6a\r | |
484 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
485 | jmpCommonIdtEntry \r | |
486 | # No. 36\r | |
487 | pushl $0x0 # push error code place holder on the stack\r | |
488 | # push $0xxx # push vector number\r | |
489 | .byte 0x6a\r | |
490 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
491 | jmpCommonIdtEntry \r | |
492 | # No. 37\r | |
493 | pushl $0x0 # push error code place holder on the stack\r | |
494 | # push $0xxx # push vector number\r | |
495 | .byte 0x6a\r | |
496 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
497 | jmpCommonIdtEntry \r | |
498 | # No. 38\r | |
499 | pushl $0x0 # push error code place holder on the stack\r | |
500 | # push $0xxx # push vector number\r | |
501 | .byte 0x6a\r | |
502 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
503 | jmpCommonIdtEntry \r | |
504 | # No. 39\r | |
505 | pushl $0x0 # push error code place holder on the stack\r | |
506 | # push $0xxx # push vector number\r | |
507 | .byte 0x6a\r | |
508 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
509 | jmpCommonIdtEntry \r | |
510 | # No. 40\r | |
511 | pushl $0x0 # push error code place holder on the stack\r | |
512 | # push $0xxx # push vector number\r | |
513 | .byte 0x6a\r | |
514 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
515 | jmpCommonIdtEntry \r | |
516 | # No. 41\r | |
517 | pushl $0x0 # push error code place holder on the stack\r | |
518 | # push $0xxx # push vector number\r | |
519 | .byte 0x6a\r | |
520 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
521 | jmpCommonIdtEntry \r | |
522 | # No. 42\r | |
523 | pushl $0x0 # push error code place holder on the stack\r | |
524 | # push $0xxx # push vector number\r | |
525 | .byte 0x6a\r | |
526 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
527 | jmpCommonIdtEntry \r | |
528 | # No. 43\r | |
529 | pushl $0x0 # push error code place holder on the stack\r | |
530 | # push $0xxx # push vector number\r | |
531 | .byte 0x6a\r | |
532 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
533 | jmpCommonIdtEntry \r | |
534 | # No. 44\r | |
535 | pushl $0x0 # push error code place holder on the stack\r | |
536 | # push $0xxx # push vector number\r | |
537 | .byte 0x6a\r | |
538 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
539 | jmpCommonIdtEntry \r | |
540 | # No. 45\r | |
541 | pushl $0x0 # push error code place holder on the stack\r | |
542 | # push $0xxx # push vector number\r | |
543 | .byte 0x6a\r | |
544 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
545 | jmpCommonIdtEntry \r | |
546 | # No. 46\r | |
547 | pushl $0x0 # push error code place holder on the stack\r | |
548 | # push $0xxx # push vector number\r | |
549 | .byte 0x6a\r | |
550 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
551 | jmpCommonIdtEntry \r | |
552 | # No. 47\r | |
553 | pushl $0x0 # push error code place holder on the stack\r | |
554 | # push $0xxx # push vector number\r | |
555 | .byte 0x6a\r | |
556 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
557 | jmpCommonIdtEntry \r | |
558 | # No. 48\r | |
559 | pushl $0x0 # push error code place holder on the stack\r | |
560 | # push $0xxx # push vector number\r | |
561 | .byte 0x6a\r | |
562 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
563 | jmpCommonIdtEntry \r | |
564 | # No. 49\r | |
565 | pushl $0x0 # push error code place holder on the stack\r | |
566 | # push $0xxx # push vector number\r | |
567 | .byte 0x6a\r | |
568 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
569 | jmpCommonIdtEntry \r | |
570 | # No. 50\r | |
571 | pushl $0x0 # push error code place holder on the stack\r | |
572 | # push $0xxx # push vector number\r | |
573 | .byte 0x6a\r | |
574 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
575 | jmpCommonIdtEntry \r | |
576 | # No. 51\r | |
577 | pushl $0x0 # push error code place holder on the stack\r | |
578 | # push $0xxx # push vector number\r | |
579 | .byte 0x6a\r | |
580 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
581 | jmpCommonIdtEntry \r | |
582 | # No. 52\r | |
583 | pushl $0x0 # push error code place holder on the stack\r | |
584 | # push $0xxx # push vector number\r | |
585 | .byte 0x6a\r | |
586 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
587 | jmpCommonIdtEntry \r | |
588 | # No. 53\r | |
589 | pushl $0x0 # push error code place holder on the stack\r | |
590 | # push $0xxx # push vector number\r | |
591 | .byte 0x6a\r | |
592 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
593 | jmpCommonIdtEntry \r | |
594 | # No. 54\r | |
595 | pushl $0x0 # push error code place holder on the stack\r | |
596 | # push $0xxx # push vector number\r | |
597 | .byte 0x6a\r | |
598 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
599 | jmpCommonIdtEntry \r | |
600 | # No. 55\r | |
601 | pushl $0x0 # push error code place holder on the stack\r | |
602 | # push $0xxx # push vector number\r | |
603 | .byte 0x6a\r | |
604 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
605 | jmpCommonIdtEntry \r | |
606 | # No. 56\r | |
607 | pushl $0x0 # push error code place holder on the stack\r | |
608 | # push $0xxx # push vector number\r | |
609 | .byte 0x6a\r | |
610 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
611 | jmpCommonIdtEntry \r | |
612 | # No. 57\r | |
613 | pushl $0x0 # push error code place holder on the stack\r | |
614 | # push $0xxx # push vector number\r | |
615 | .byte 0x6a\r | |
616 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
617 | jmpCommonIdtEntry \r | |
618 | # No. 58\r | |
619 | pushl $0x0 # push error code place holder on the stack\r | |
620 | # push $0xxx # push vector number\r | |
621 | .byte 0x6a\r | |
622 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
623 | jmpCommonIdtEntry \r | |
624 | # No. 59\r | |
625 | pushl $0x0 # push error code place holder on the stack\r | |
626 | # push $0xxx # push vector number\r | |
627 | .byte 0x6a\r | |
628 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
629 | jmpCommonIdtEntry \r | |
630 | # No. 60\r | |
631 | pushl $0x0 # push error code place holder on the stack\r | |
632 | # push $0xxx # push vector number\r | |
633 | .byte 0x6a\r | |
634 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
635 | jmpCommonIdtEntry \r | |
636 | # No. 61\r | |
637 | pushl $0x0 # push error code place holder on the stack\r | |
638 | # push $0xxx # push vector number\r | |
639 | .byte 0x6a\r | |
640 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
641 | jmpCommonIdtEntry \r | |
642 | # No. 62\r | |
643 | pushl $0x0 # push error code place holder on the stack\r | |
644 | # push $0xxx # push vector number\r | |
645 | .byte 0x6a\r | |
646 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
647 | jmpCommonIdtEntry \r | |
648 | # No. 63\r | |
649 | pushl $0x0 # push error code place holder on the stack\r | |
650 | # push $0xxx # push vector number\r | |
651 | .byte 0x6a\r | |
652 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
653 | jmpCommonIdtEntry \r | |
654 | # No. 64\r | |
655 | pushl $0x0 # push error code place holder on the stack\r | |
656 | # push $0xxx # push vector number\r | |
657 | .byte 0x6a\r | |
658 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
659 | jmpCommonIdtEntry \r | |
660 | # No. 65\r | |
661 | pushl $0x0 # push error code place holder on the stack\r | |
662 | # push $0xxx # push vector number\r | |
663 | .byte 0x6a\r | |
664 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
665 | jmpCommonIdtEntry \r | |
666 | # No. 66\r | |
667 | pushl $0x0 # push error code place holder on the stack\r | |
668 | # push $0xxx # push vector number\r | |
669 | .byte 0x6a\r | |
670 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
671 | jmpCommonIdtEntry \r | |
672 | # No. 67\r | |
673 | pushl $0x0 # push error code place holder on the stack\r | |
674 | # push $0xxx # push vector number\r | |
675 | .byte 0x6a\r | |
676 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
677 | jmpCommonIdtEntry \r | |
678 | # No. 68\r | |
679 | pushl $0x0 # push error code place holder on the stack\r | |
680 | # push $0xxx # push vector number\r | |
681 | .byte 0x6a\r | |
682 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
683 | jmpCommonIdtEntry \r | |
684 | # No. 69\r | |
685 | pushl $0x0 # push error code place holder on the stack\r | |
686 | # push $0xxx # push vector number\r | |
687 | .byte 0x6a\r | |
688 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
689 | jmpCommonIdtEntry \r | |
690 | # No. 70\r | |
691 | pushl $0x0 # push error code place holder on the stack\r | |
692 | # push $0xxx # push vector number\r | |
693 | .byte 0x6a\r | |
694 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
695 | jmpCommonIdtEntry \r | |
696 | # No. 71\r | |
697 | pushl $0x0 # push error code place holder on the stack\r | |
698 | # push $0xxx # push vector number\r | |
699 | .byte 0x6a\r | |
700 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
701 | jmpCommonIdtEntry \r | |
702 | # No. 72\r | |
703 | pushl $0x0 # push error code place holder on the stack\r | |
704 | # push $0xxx # push vector number\r | |
705 | .byte 0x6a\r | |
706 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
707 | jmpCommonIdtEntry \r | |
708 | # No. 73\r | |
709 | pushl $0x0 # push error code place holder on the stack\r | |
710 | # push $0xxx # push vector number\r | |
711 | .byte 0x6a\r | |
712 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
713 | jmpCommonIdtEntry \r | |
714 | # No. 74\r | |
715 | pushl $0x0 # push error code place holder on the stack\r | |
716 | # push $0xxx # push vector number\r | |
717 | .byte 0x6a\r | |
718 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
719 | jmpCommonIdtEntry \r | |
720 | # No. 75\r | |
721 | pushl $0x0 # push error code place holder on the stack\r | |
722 | # push $0xxx # push vector number\r | |
723 | .byte 0x6a\r | |
724 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
725 | jmpCommonIdtEntry \r | |
726 | # No. 76\r | |
727 | pushl $0x0 # push error code place holder on the stack\r | |
728 | # push $0xxx # push vector number\r | |
729 | .byte 0x6a\r | |
730 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
731 | jmpCommonIdtEntry \r | |
732 | # No. 77\r | |
733 | pushl $0x0 # push error code place holder on the stack\r | |
734 | # push $0xxx # push vector number\r | |
735 | .byte 0x6a\r | |
736 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
737 | jmpCommonIdtEntry \r | |
738 | # No. 78\r | |
739 | pushl $0x0 # push error code place holder on the stack\r | |
740 | # push $0xxx # push vector number\r | |
741 | .byte 0x6a\r | |
742 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
743 | jmpCommonIdtEntry \r | |
744 | # No. 79\r | |
745 | pushl $0x0 # push error code place holder on the stack\r | |
746 | # push $0xxx # push vector number\r | |
747 | .byte 0x6a\r | |
748 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
749 | jmpCommonIdtEntry \r | |
750 | # No. 80\r | |
751 | pushl $0x0 # push error code place holder on the stack\r | |
752 | # push $0xxx # push vector number\r | |
753 | .byte 0x6a\r | |
754 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
755 | jmpCommonIdtEntry \r | |
756 | # No. 81\r | |
757 | pushl $0x0 # push error code place holder on the stack\r | |
758 | # push $0xxx # push vector number\r | |
759 | .byte 0x6a\r | |
760 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
761 | jmpCommonIdtEntry \r | |
762 | # No. 82\r | |
763 | pushl $0x0 # push error code place holder on the stack\r | |
764 | # push $0xxx # push vector number\r | |
765 | .byte 0x6a\r | |
766 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
767 | jmpCommonIdtEntry \r | |
768 | # No. 83\r | |
769 | pushl $0x0 # push error code place holder on the stack\r | |
770 | # push $0xxx # push vector number\r | |
771 | .byte 0x6a\r | |
772 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
773 | jmpCommonIdtEntry \r | |
774 | # No. 84\r | |
775 | pushl $0x0 # push error code place holder on the stack\r | |
776 | # push $0xxx # push vector number\r | |
777 | .byte 0x6a\r | |
778 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
779 | jmpCommonIdtEntry \r | |
780 | # No. 85\r | |
781 | pushl $0x0 # push error code place holder on the stack\r | |
782 | # push $0xxx # push vector number\r | |
783 | .byte 0x6a\r | |
784 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
785 | jmpCommonIdtEntry \r | |
786 | # No. 86\r | |
787 | pushl $0x0 # push error code place holder on the stack\r | |
788 | # push $0xxx # push vector number\r | |
789 | .byte 0x6a\r | |
790 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
791 | jmpCommonIdtEntry \r | |
792 | # No. 87\r | |
793 | pushl $0x0 # push error code place holder on the stack\r | |
794 | # push $0xxx # push vector number\r | |
795 | .byte 0x6a\r | |
796 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
797 | jmpCommonIdtEntry \r | |
798 | # No. 88\r | |
799 | pushl $0x0 # push error code place holder on the stack\r | |
800 | # push $0xxx # push vector number\r | |
801 | .byte 0x6a\r | |
802 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
803 | jmpCommonIdtEntry \r | |
804 | # No. 89\r | |
805 | pushl $0x0 # push error code place holder on the stack\r | |
806 | # push $0xxx # push vector number\r | |
807 | .byte 0x6a\r | |
808 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
809 | jmpCommonIdtEntry \r | |
810 | # No. 90\r | |
811 | pushl $0x0 # push error code place holder on the stack\r | |
812 | # push $0xxx # push vector number\r | |
813 | .byte 0x6a\r | |
814 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
815 | jmpCommonIdtEntry \r | |
816 | # No. 91\r | |
817 | pushl $0x0 # push error code place holder on the stack\r | |
818 | # push $0xxx # push vector number\r | |
819 | .byte 0x6a\r | |
820 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
821 | jmpCommonIdtEntry \r | |
822 | # No. 92\r | |
823 | pushl $0x0 # push error code place holder on the stack\r | |
824 | # push $0xxx # push vector number\r | |
825 | .byte 0x6a\r | |
826 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
827 | jmpCommonIdtEntry \r | |
828 | # No. 93\r | |
829 | pushl $0x0 # push error code place holder on the stack\r | |
830 | # push $0xxx # push vector number\r | |
831 | .byte 0x6a\r | |
832 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
833 | jmpCommonIdtEntry \r | |
834 | # No. 94\r | |
835 | pushl $0x0 # push error code place holder on the stack\r | |
836 | # push $0xxx # push vector number\r | |
837 | .byte 0x6a\r | |
838 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
839 | jmpCommonIdtEntry \r | |
840 | # No. 95\r | |
841 | pushl $0x0 # push error code place holder on the stack\r | |
842 | # push $0xxx # push vector number\r | |
843 | .byte 0x6a\r | |
844 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
845 | jmpCommonIdtEntry \r | |
846 | # No. 96\r | |
847 | pushl $0x0 # push error code place holder on the stack\r | |
848 | # push $0xxx # push vector number\r | |
849 | .byte 0x6a\r | |
850 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
851 | jmpCommonIdtEntry \r | |
852 | # No. 97\r | |
853 | pushl $0x0 # push error code place holder on the stack\r | |
854 | # push $0xxx # push vector number\r | |
855 | .byte 0x6a\r | |
856 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
857 | jmpCommonIdtEntry \r | |
858 | # No. 98\r | |
859 | pushl $0x0 # push error code place holder on the stack\r | |
860 | # push $0xxx # push vector number\r | |
861 | .byte 0x6a\r | |
862 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
863 | jmpCommonIdtEntry \r | |
864 | # No. 99\r | |
865 | pushl $0x0 # push error code place holder on the stack\r | |
866 | # push $0xxx # push vector number\r | |
867 | .byte 0x6a\r | |
868 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
869 | jmpCommonIdtEntry \r | |
870 | # No. 100\r | |
871 | pushl $0x0 # push error code place holder on the stack\r | |
872 | # push $0xxx # push vector number\r | |
873 | .byte 0x6a\r | |
874 | .long ( . - INTUnknown - 3 ) / 9 + 20 # vector number\r | |
875 | jmpCommonIdtEntry \r | |
876 | \r | |
ccec4c39 | 877 | \r |
878 | commonIdtEntry: \r | |
879 | pushal\r | |
880 | movl %esp, %ebp\r | |
881 | ##\r | |
882 | ## At this point the stack looks like this:\r | |
883 | ##\r | |
884 | ## eflags\r | |
885 | ## Calling CS\r | |
886 | ## Calling EIP\r | |
887 | ## Error code or 0\r | |
888 | ## Int num or 0ffh for unknown int num\r | |
889 | ## eax\r | |
890 | ## ecx\r | |
891 | ## edx\r | |
892 | ## ebx\r | |
893 | ## esp\r | |
894 | ## ebp\r | |
895 | ## esi\r | |
896 | ## edi <------- ESP, EBP\r | |
897 | ## \r | |
898 | \r | |
899 | call ClearScreen\r | |
900 | movl String1, %esi\r | |
901 | call PrintString\r | |
902 | movl 32(%ebp), %eax ## move Int number into EAX \r | |
903 | cmpl $19, %eax\r | |
904 | ja PrintDefaultString\r | |
905 | PrintExceptionString: \r | |
906 | shll $2, %eax ## multiply by 4 to get offset from StringTable to actual string address\r | |
907 | addl StringTable, %eax\r | |
908 | movl (%eax), %esi\r | |
909 | jmp PrintTheString\r | |
910 | PrintDefaultString: \r | |
911 | movl IntUnknownString, %esi\r | |
912 | # patch Int number\r | |
913 | movl %eax, %edx\r | |
914 | call A2C\r | |
915 | movb %al, 1(%esi)\r | |
916 | movl %edx, %eax\r | |
917 | shrl $4, %eax\r | |
918 | call A2C\r | |
919 | movb %al, (%esi)\r | |
920 | PrintTheString: \r | |
921 | call PrintString\r | |
922 | movl String2, %esi\r | |
923 | call PrintString\r | |
924 | movl 44(%ebp), %eax # CS\r | |
925 | call PrintDword\r | |
926 | movb ':', %al\r | |
927 | movb %al, (%edi)\r | |
928 | addl $2, %edi\r | |
929 | movl 40(%ebp), %eax # EIP\r | |
930 | call PrintDword\r | |
931 | movl String3, %esi\r | |
932 | call PrintString\r | |
933 | \r | |
934 | movl $0xb8140, %edi\r | |
935 | \r | |
936 | movl StringEax, %esi # eax\r | |
937 | call PrintString\r | |
938 | movl 28(%ebp), %eax\r | |
939 | call PrintDword\r | |
940 | \r | |
941 | movl StringEbx, %esi # ebx\r | |
942 | call PrintString\r | |
943 | movl 16(%ebp), %eax\r | |
944 | call PrintDword\r | |
945 | \r | |
946 | movl StringEcx, %esi # ecx\r | |
947 | call PrintString\r | |
948 | movl 24(%ebp), %eax\r | |
949 | call PrintDword\r | |
950 | \r | |
951 | movl StringEdx, %esi # edx\r | |
952 | call PrintString\r | |
953 | movl 20(%ebp), %eax\r | |
954 | call PrintDword\r | |
955 | \r | |
956 | movl StringEcode, %esi # error code\r | |
957 | call PrintString\r | |
958 | movl 36(%ebp), %eax\r | |
959 | call PrintDword\r | |
960 | \r | |
961 | movl $0xb81e0, %edi\r | |
962 | \r | |
963 | movl StringEsp, %esi # esp\r | |
964 | call PrintString\r | |
965 | movl 12(%ebp), %eax\r | |
966 | call PrintDword\r | |
967 | \r | |
968 | movl StringEbp, %esi # ebp\r | |
969 | call PrintString\r | |
970 | movl 8(%ebp), %eax\r | |
971 | call PrintDword\r | |
972 | \r | |
973 | movl StringEsi, %esi # esi\r | |
974 | call PrintString\r | |
975 | movl 4(%ebp), %eax\r | |
976 | call PrintDword\r | |
977 | \r | |
978 | movl StringEdi, %esi # edi\r | |
979 | call PrintString\r | |
980 | movl (%ebp), %eax\r | |
981 | call PrintDword\r | |
982 | \r | |
983 | movl StringEflags, %esi # eflags\r | |
984 | call PrintString\r | |
985 | movl 48(%ebp), %eax\r | |
986 | call PrintDword\r | |
987 | \r | |
988 | movl $0xb8320, %edi\r | |
989 | \r | |
990 | movl %ebp, %esi\r | |
991 | addl $52, %esi\r | |
992 | movl $8, %ecx\r | |
993 | \r | |
994 | \r | |
995 | OuterLoop: \r | |
996 | pushl %ecx\r | |
997 | movl $8, %ecx\r | |
998 | movl %edi, %edx\r | |
999 | \r | |
1000 | InnerLoop: \r | |
1001 | movl (%esi), %eax\r | |
1002 | call PrintDword\r | |
1003 | addl $4, %esi\r | |
1004 | movb ' ', %al \r | |
1005 | movb %al, (%edi)\r | |
1006 | addl $2, %edi\r | |
1007 | loop InnerLoop\r | |
1008 | \r | |
1009 | popl %ecx\r | |
1010 | addl $0xa0, %edx\r | |
1011 | movl %edx, %edi\r | |
1012 | loop OuterLoop\r | |
1013 | \r | |
1014 | \r | |
1015 | movl $0xb8960, %edi\r | |
1016 | \r | |
1017 | movl 40(%ebp), %eax # EIP\r | |
1018 | subl $32*4, %eax\r | |
1019 | movl %eax, %esi # esi = eip - 32 DWORD linear (total 64 DWORD)\r | |
1020 | \r | |
1021 | movl $8, %ecx\r | |
1022 | \r | |
1023 | OuterLoop1: \r | |
1024 | pushl %ecx\r | |
1025 | movl $8, %ecx\r | |
1026 | movl %edi, %edx\r | |
1027 | \r | |
1028 | InnerLoop1: \r | |
1029 | movl (%esi), %eax\r | |
1030 | call PrintDword\r | |
1031 | addl $4, %esi\r | |
1032 | movb ' ', %al \r | |
1033 | movb %al, (%edi)\r | |
1034 | addl $2, %edi\r | |
1035 | loop InnerLoop1\r | |
1036 | \r | |
1037 | popl %ecx\r | |
1038 | addl $0xa0, %edx\r | |
1039 | movl %edx, %edi\r | |
1040 | loop OuterLoop1\r | |
1041 | \r | |
1042 | \r | |
1043 | \r | |
1044 | # wbinvd ; this intruction does not support in early than 486 arch\r | |
1045 | LN_C1: \r | |
1046 | jmp LN_C1\r | |
1047 | #\r | |
1048 | # return\r | |
1049 | #\r | |
1050 | movl %ebp, %esp\r | |
1051 | popal\r | |
1052 | addl $8, %esp # error code and INT number\r | |
1053 | \r | |
1054 | iretl\r | |
1055 | \r | |
1056 | \r | |
1057 | PrintString: \r | |
1058 | pushl %eax\r | |
1059 | LN_C2: \r | |
1060 | movb (%esi), %al\r | |
1061 | cmpb $0, %al\r | |
1062 | je LN_C3\r | |
1063 | movb %al, (%edi)\r | |
1064 | incl %esi\r | |
1065 | addl $2, %edi\r | |
1066 | jmp LN_C2\r | |
1067 | LN_C3: \r | |
1068 | popl %eax\r | |
1069 | ret\r | |
1070 | \r | |
1071 | ## EAX contains dword to print\r | |
1072 | ## EDI contains memory location (screen location) to print it to\r | |
1073 | PrintDword: \r | |
1074 | pushl %ecx\r | |
1075 | pushl %ebx\r | |
1076 | pushl %eax\r | |
1077 | \r | |
1078 | movl $8, %ecx\r | |
1079 | looptop: \r | |
1080 | roll $4, %eax\r | |
1081 | movb %al, %bl\r | |
1082 | andb $0xf, %bl\r | |
1083 | addb '0', %bl\r | |
1084 | cmpb '9', %bl\r | |
1085 | jle LN_C4\r | |
1086 | addb $7, %bl\r | |
1087 | LN_C4: \r | |
1088 | movb %bl, (%edi)\r | |
1089 | addl $2, %edi\r | |
1090 | loop looptop\r | |
1091 | #wbinvd\r | |
1092 | \r | |
1093 | popl %eax\r | |
1094 | popl %ebx\r | |
1095 | popl %ecx\r | |
1096 | ret\r | |
1097 | \r | |
1098 | ClearScreen: \r | |
1099 | pushl %eax\r | |
1100 | pushl %ecx\r | |
1101 | \r | |
d0b0659f | 1102 | movb $0x00, %al\r |
ccec4c39 | 1103 | movb $0xc, %ah\r |
1104 | movl $0xb8000, %edi\r | |
1105 | movl $80*24, %ecx\r | |
1106 | LN_C5: \r | |
1107 | movw %ax, (%edi)\r | |
1108 | addl $2, %edi\r | |
1109 | loop LN_C5\r | |
1110 | movl $0xb8000, %edi\r | |
1111 | \r | |
1112 | popl %ecx\r | |
1113 | popl %eax\r | |
1114 | \r | |
1115 | ret\r | |
1116 | \r | |
1117 | A2C: \r | |
1118 | andb $0xf, %al\r | |
1119 | addb '0', %al\r | |
1120 | cmpb '9', %al\r | |
1121 | jle LN_C6\r | |
1122 | addb $7, %al\r | |
1123 | LN_C6: \r | |
1124 | ret\r | |
1125 | \r | |
1126 | String1: .asciz "*** INT "\r | |
1127 | \r | |
1128 | Int0String: .asciz "00h Divide by 0 -"\r | |
1129 | Int1String: .asciz "01h Debug exception -"\r | |
1130 | Int2String: .asciz "02h NMI -"\r | |
1131 | Int3String: .asciz "03h Breakpoint -"\r | |
1132 | Int4String: .asciz "04h Overflow -"\r | |
1133 | Int5String: .asciz "05h Bound -"\r | |
1134 | Int6String: .asciz "06h Invalid opcode -"\r | |
1135 | Int7String: .asciz "07h Device not available -"\r | |
1136 | Int8String: .asciz "08h Double fault -"\r | |
1137 | Int9String: .asciz "09h Coprocessor seg overrun (reserved) -"\r | |
1138 | Int10String: .asciz "0Ah Invalid TSS -"\r | |
1139 | Int11String: .asciz "0Bh Segment not present -"\r | |
1140 | Int12String: .asciz "0Ch Stack fault -"\r | |
1141 | Int13String: .asciz "0Dh General protection fault -"\r | |
1142 | Int14String: .asciz "0Eh Page fault -"\r | |
1143 | Int15String: .asciz "0Fh (Intel reserved) -"\r | |
1144 | Int16String: .asciz "10h Floating point error -"\r | |
1145 | Int17String: .asciz "11h Alignment check -"\r | |
1146 | Int18String: .asciz "12h Machine check -"\r | |
1147 | Int19String: .asciz "13h SIMD Floating-Point Exception -"\r | |
1148 | IntUnknownString: .asciz "??h Unknown interrupt -"\r | |
1149 | \r | |
1150 | StringTable: .long Int0String, Int1String, Int2String, Int3String, \\r | |
1151 | Int4String, Int5String, Int6String, Int7String, \\r | |
1152 | Int8String, Int9String, Int10String, Int11String, \\r | |
1153 | Int12String, Int13String, Int14String, Int15String,\\r | |
1154 | Int16String, Int17String, Int18String, Int19String\r | |
1155 | \r | |
1156 | String2: .asciz " HALT!! *** ("\r | |
1157 | String3: .asciz ")"\r | |
1158 | StringEax: .asciz "EAX="\r | |
1159 | StringEbx: .asciz "EBX="\r | |
1160 | StringEcx: .asciz "ECX="\r | |
1161 | StringEdx: .asciz "EDX="\r | |
1162 | StringEcode: .asciz "ECODE="\r | |
1163 | StringEsp: .asciz "ESP="\r | |
1164 | StringEbp: .asciz "EBP="\r | |
1165 | StringEsi: .asciz "ESI="\r | |
1166 | StringEdi: .asciz "EDI="\r | |
1167 | StringEflags: .asciz "EFLAGS="\r | |
1168 | \r | |
1169 | Idtr: .float 0\r | |
1170 | \r | |
1171 | .org 0x21ffe\r | |
1172 | BlockSignature: \r | |
1173 | .word 0xaa55\r | |
1174 | \r | |
1175 | \r |