Rev 370 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 370 | Rev 607 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | extension_found: |
31 | extension_found: |
32 | lea eax,[edi+9] |
32 | lea eax,[edi+9] |
33 | cmp eax,[structures_buffer] |
33 | cmp eax,[structures_buffer] |
34 | jae out_of_memory |
34 | jae out_of_memory |
35 | cmp [output_format],2 |
35 | cmp [file_extension],0 |
- | 36 | jne extension_specified |
|
- | 37 | cmp [output_format],2 |
|
36 | je exe_extension |
38 | je exe_extension |
37 | jb bin_extension |
39 | jb bin_extension |
38 | cmp [output_format],4 |
40 | cmp [output_format],4 |
39 | je obj_extension |
41 | je obj_extension |
40 | cmp [output_format],5 |
42 | cmp [output_format],5 |
Line 91... | Line 93... | ||
91 | adapt_next: |
93 | adapt_next: |
92 | inc edi |
94 | inc edi |
93 | cmp byte [edi],0 |
95 | cmp byte [edi],0 |
94 | jne adapt_case |
96 | jne adapt_case |
95 | mov esi,edi |
97 | jmp extension_ok |
- | 98 | extension_specified: |
|
- | 99 | mov al,'.' |
|
- | 100 | stos byte [edi] |
|
- | 101 | mov esi,[file_extension] |
|
- | 102 | copy_extension: |
|
- | 103 | lods byte [esi] |
|
- | 104 | stos byte [edi] |
|
- | 105 | test al,al |
|
- | 106 | jnz copy_extension |
|
- | 107 | dec edi |
|
- | 108 | extension_ok: |
|
- | 109 | mov esi,edi |
|
96 | lea ecx,[esi+1] |
110 | lea ecx,[esi+1] |
97 | sub ecx,[free_additional_memory] |
111 | sub ecx,[free_additional_memory] |
98 | mov edi,[structures_buffer] |
112 | mov edi,[structures_buffer] |
99 | dec edi |
113 | dec edi |
100 | std |
114 | std |
Line 176... | Line 190... | ||
176 | cmp al,4 |
190 | cmp al,4 |
177 | je format_coff |
191 | je format_coff |
178 | cmp al,5 |
192 | cmp al,5 |
179 | je format_elf |
193 | je format_elf |
180 | jmp instruction_assembled |
194 | format_defined: |
- | 195 | cmp byte [esi],86h |
|
- | 196 | jne instruction_assembled |
|
- | 197 | cmp word [esi+1],'(' |
|
- | 198 | jne invalid_argument |
|
- | 199 | mov eax,[esi+3] |
|
- | 200 | add esi,3+4 |
|
- | 201 | mov [file_extension],esi |
|
- | 202 | lea esi,[esi+eax+1] |
|
- | 203 | jmp instruction_assembled |
|
181 | format_prefix: |
204 | format_prefix: |
182 | lods byte [esi] |
205 | lods byte [esi] |
183 | mov ah,al |
206 | mov ah,al |
184 | lods byte [esi] |
207 | lods byte [esi] |
185 | cmp al,18h |
208 | cmp al,18h |
Line 375... | Line 398... | ||
375 | pop edi |
398 | pop edi |
376 | mov word [edx+0Ch],0FFFFh |
399 | mov word [edx+0Ch],0FFFFh |
377 | mov word [edx+10h],1000h |
400 | mov word [edx+10h],1000h |
378 | mov [code_type],16 |
401 | mov [code_type],16 |
379 | jmp instruction_assembled |
402 | jmp format_defined |
380 | mark_mz_relocation: |
403 | mark_mz_relocation: |
381 | push eax ebx |
404 | push eax ebx |
382 | inc [number_of_relocations] |
405 | inc [number_of_relocations] |
383 | mov ebx,[free_additional_memory] |
406 | mov ebx,[free_additional_memory] |
384 | mov eax,edi |
407 | mov eax,edi |
385 | sub eax,[code_start] |
408 | sub eax,[code_start] |
Line 1021... | Line 1044... | ||
1021 | bt [format_flags],9 |
1044 | bt [format_flags],9 |
1022 | jnc wdm_flag_ok |
1045 | jnc wdm_flag_ok |
1023 | or word [edx+5Eh],2000h |
1046 | or word [edx+5Eh],2000h |
1024 | wdm_flag_ok: |
1047 | wdm_flag_ok: |
1025 | jmp instruction_assembled |
1048 | jmp format_defined |
1026 | pe_section: |
1049 | pe_section: |
1027 | call close_pe_section |
1050 | call close_pe_section |
1028 | bts [format_flags],5 |
1051 | bts [format_flags],5 |
1029 | lea ecx,[ebx+28h] |
1052 | lea ecx,[ebx+28h] |
1030 | add edx,[edx+54h] |
1053 | add edx,[edx+54h] |
1031 | sub edx,[stub_size] |
1054 | sub edx,[stub_size] |
Line 1346... | Line 1369... | ||
1346 | mov [ecx+6Ch],edx |
1369 | mov [ecx+6Ch],edx |
1347 | cmp edx,[ecx+64h] |
1370 | cmp edx,[ecx+64h] |
1348 | ja value_out_of_range |
1371 | ja value_out_of_range |
1349 | jb instruction_assembled |
1372 | jb instruction_assembled |
1350 | cmp eax,[edx+60h] |
1373 | cmp eax,[ecx+60h] |
1351 | ja value_out_of_range |
1374 | ja value_out_of_range |
1352 | jmp instruction_assembled |
1375 | jmp instruction_assembled |
1353 | default_pe64_stack_commit: |
1376 | default_pe64_stack_commit: |
1354 | mov dword [edx+68h],1000h |
1377 | mov dword [ecx+68h],1000h |
1355 | cmp dword [edx+64h],0 |
1378 | cmp dword [ecx+64h],0 |
1356 | jne instruction_assembled |
1379 | jne instruction_assembled |
1357 | mov eax,[edx+60h] |
1380 | mov eax,[ecx+60h] |
1358 | cmp eax,1000h |
1381 | cmp eax,1000h |
1359 | ja instruction_assembled |
1382 | ja instruction_assembled |
1360 | mov dword [edx+68h],eax |
1383 | mov dword [ecx+68h],eax |
1361 | jmp instruction_assembled |
1384 | jmp instruction_assembled |
1362 | pe_heap: |
1385 | pe_heap: |
1363 | lods byte [esi] |
1386 | lods byte [esi] |
1364 | cmp al,'(' |
1387 | cmp al,'(' |
1365 | jne invalid_argument |
1388 | jne invalid_argument |
1366 | cmp byte [esi],'.' |
1389 | cmp byte [esi],'.' |
Line 1492... | Line 1515... | ||
1492 | stos dword [edi] |
1515 | stos dword [edi] |
1493 | store_fixup: |
1516 | store_fixup: |
1494 | jecxz fixups_done |
1517 | jecxz fixups_done |
1495 | add dword [ebx],2 |
1518 | add dword [ebx],2 |
1496 | mov eax,[esi] |
1519 | mov ah,[esi+1] |
1497 | and ax,0FFFh |
1520 | and ah,0Fh |
1498 | mov dl,[esi+4] |
1521 | mov al,[esi+4] |
1499 | shl dx,12 |
1522 | shl al,4 |
1500 | or ax,dx |
1523 | or ah,al |
1501 | stos word [edi] |
1524 | mov al,[esi] |
- | 1525 | stos word [edi] |
|
1502 | add esi,5 |
1526 | add esi,5 |
1503 | loop make_fixups |
1527 | loop make_fixups |
1504 | fixups_done: |
1528 | fixups_done: |
1505 | pop esi |
1529 | pop esi |
1506 | ret |
1530 | ret |
Line 2172... | Line 2196... | ||
2172 | mov [org_symbol],ebx |
2196 | mov [org_symbol],ebx |
2173 | mov [labels_type],2 |
2197 | mov [labels_type],2 |
2174 | mov [code_type],32 |
2198 | mov [code_type],32 |
2175 | test [format_flags],8 |
2199 | test [format_flags],8 |
2176 | jz instruction_assembled |
2200 | jz format_defined |
2177 | mov [labels_type],4 |
2201 | mov [labels_type],4 |
2178 | mov [code_type],64 |
2202 | mov [code_type],64 |
2179 | jmp instruction_assembled |
2203 | jmp format_defined |
2180 | coff_section: |
2204 | coff_section: |
2181 | call close_coff_section |
2205 | call close_coff_section |
2182 | mov ebx,[free_additional_memory] |
2206 | mov ebx,[free_additional_memory] |
2183 | lea eax,[ebx+20h] |
2207 | lea eax,[ebx+20h] |
2184 | cmp eax,[structures_buffer] |
2208 | cmp eax,[structures_buffer] |
2185 | jae out_of_memory |
2209 | jae out_of_memory |
Line 2772... | Line 2796... | ||
2772 | mov [ebx+14h],eax |
2796 | mov [ebx+14h],eax |
2773 | mov al,4 |
2797 | mov al,4 |
2774 | mov [ebx+10h],eax |
2798 | mov [ebx+10h],eax |
2775 | test [format_flags],8 |
2799 | test [format_flags],8 |
2776 | jz instruction_assembled |
2800 | jz format_defined |
2777 | mov byte [ebx+10h],8 |
2801 | mov byte [ebx+10h],8 |
2778 | jmp instruction_assembled |
2802 | jmp format_defined |
2779 | format_elf64: |
2803 | format_elf64: |
2780 | mov edx,edi |
2804 | mov edx,edi |
2781 | mov ecx,40h shr 2 |
2805 | mov ecx,40h shr 2 |
2782 | lea eax,[edi+ecx*4] |
2806 | lea eax,[edi+ecx*4] |
2783 | cmp eax,[display_buffer] |
2807 | cmp eax,[display_buffer] |
2784 | jae out_of_memory |
2808 | jae out_of_memory |
Line 3511... | Line 3535... | ||
3511 | mov dword [org_origin+4],edx |
3535 | mov dword [org_origin+4],edx |
3512 | mov [org_registers],0 |
3536 | mov [org_registers],0 |
3513 | mov [org_start],edi |
3537 | mov [org_start],edi |
3514 | mov [symbols_stream],edi |
3538 | mov [symbols_stream],edi |
3515 | jmp instruction_assembled |
3539 | jmp format_defined |
3516 | format_elf64_exe: |
3540 | format_elf64_exe: |
3517 | add esi,2 |
3541 | add esi,2 |
3518 | or [format_flags],1 |
3542 | or [format_flags],1 |
3519 | mov [image_base],400000h |
3543 | mov [image_base],400000h |
3520 | mov [image_base_high],0 |
3544 | mov [image_base_high],0 |
3521 | cmp byte [esi],80h |
3545 | cmp byte [esi],80h |
Line 3571... | Line 3595... | ||
3571 | mov dword [org_origin+4],edx |
3595 | mov dword [org_origin+4],edx |
3572 | mov [org_registers],0 |
3596 | mov [org_registers],0 |
3573 | mov [org_start],edi |
3597 | mov [org_start],edi |
3574 | mov [symbols_stream],edi |
3598 | mov [symbols_stream],edi |
3575 | jmp instruction_assembled |
3599 | jmp format_defined |
3576 | elf_entry: |
3600 | elf_entry: |
3577 | lods byte [esi] |
3601 | lods byte [esi] |
3578 | cmp al,'(' |
3602 | cmp al,'(' |
3579 | jne invalid_argument |
3603 | jne invalid_argument |
3580 | cmp byte [esi],'.' |
3604 | cmp byte [esi],'.' |
3581 | je invalid_value |
3605 | je invalid_value |