1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

stub: fix i386 syntax for current gas versions, and add some explicit

alignments at the end of the file so that we do not depend on gas defaults.
This commit is contained in:
Markus F.X.J. Oberhumer 2013-09-20 06:15:46 +02:00
parent d9bf8a76d9
commit ce5f9f95ea
14 changed files with 23 additions and 15 deletions

View File

@ -472,7 +472,7 @@ decompr0:
section LXJCC010
lxunf2: // have seen 0x80..0x8f of possible recoded 6-byte Jcc <d32>
movzwl ebp, [edi] // 2 bytes, zero-extended
movzx ebp, word ptr [edi] // 2 bytes, zero-extended
section LXMRU045 // 0!=n_mru
sub ebp, __cto8_0f
@ -644,7 +644,7 @@ section LXMRU040 // 0!=n_mru
section LXUNF030
lxctloop:
movzxw eax, [edi] // 2 bytes, zero extended
movzx eax, word ptr [edi] // 2 bytes, zero extended
add edi, 1
section LXJCC000
cmp al, 0x80 // lo of Jcc <d32>

View File

@ -112,7 +112,7 @@ addaxds:
movsw
cld
section LONGSUB
subb [cs:si + addaxds + 4], 0x10
subb cs:[si + addaxds + 4], 0x10
section SHORTSUB
.byte 0x2e, 0x80, 0x6c, addaxds + 4, 0x10
section JNCDOCOPY
@ -177,7 +177,7 @@ reloc_0:
xor ax, ax
reloc_1:
add di, ax
add [es:di], bp
add es:[di], bp
reloc_2:
lodsb
dec ax
@ -188,9 +188,9 @@ section EXEREL9A
inc di
reloc_4:
inc di
cmpb [es:di], 0x9a
cmpb es:[di], 0x9a
jne reloc_4
cmp [es:di+3], dx
cmp es:[di+3], dx
ja reloc_4
mov al, 3
jmps reloc_1

View File

@ -202,5 +202,6 @@ L32:
pop edi // &auxtab
ret
.balign 4,0
// vi:ts=8:et:nowrap

View File

@ -55,4 +55,6 @@ fold_begin: // enter: %ebx= &Elf32_Ehdr of this program
.extern upx_main
call upx_main // Call the UPX main function
hlt // Crash if somehow upx_main does return
.balign 4,0
// vi:ts=8:et:nowrap

View File

@ -209,8 +209,8 @@ dy_uncpr:
add esp, (5+1)*4 // (5+1) args to decompress
pop edx; pop eax # edx= old dst; eax= old &b_info
movzbl ecx,[1+ b_method + eax]; jecxz dy_uncpr; push ecx # ftid
movzbl ecx,[2+ b_method + eax]; push ecx # cto8
movzx ecx, byte ptr [1+ b_method + eax]; jecxz dy_uncpr; push ecx # ftid
movzx ecx, byte ptr [2+ b_method + eax]; push ecx # cto8
push [sz_unc + eax]
push edx # dst
lea eax,[2+ ebp]; call eax # f_unfilter(dst, dstlen, cto8, ftid)

View File

@ -135,6 +135,7 @@ read: .globl read
0:
ret
.balign 2,144
/*
vi:ts=8:et:nowrap
*/

View File

@ -257,5 +257,6 @@ mmap: .globl mmap
pop ebx
ret
.balign 4,0
// vi:ts=8:et:nowrap

View File

@ -68,4 +68,5 @@ mmap: .globl mmap
pop ebx
ret
.balign 4,0
// vi:ts=8:et:nowrap

View File

@ -125,5 +125,6 @@ mmap: .globl mmap
pop ebx
ret
.balign 4,0
// vi:ts=8:et:nowrap

View File

@ -172,5 +172,6 @@ mmap: .globl mmap
ret
.balign 4,0
// vi:ts=8:et:nowrap

View File

@ -259,7 +259,7 @@ cmd_exp = 80 // allow kernel to expand command line "in place" by this much
cl_nbp202: // use < 2.02 method. in: ebp= real_mode_ptr
mov esi,ebp // absolute worst case default
cmpw [ebp+ BP_cmd_line_magic],0xA33F; jne cl_move // nothing at all
movzwl esi,[ebp+ BP_cmd_line_offset]
movzx esi, word ptr [ebp+ BP_cmd_line_offset]
add esi,ebp
jmp cl_move
cl_bp202: // try >= 2.02 method

View File

@ -201,8 +201,8 @@ p_mprot= -5*4
sub eax,ebx // restore
add edi,ebx
movzbl ecx,[esi+b_method-4+1]; push ecx // ftid
movzbl ecx,[esi+b_method-4+2]; push ecx // cto8
movzx ecx, byte ptr [esi+b_method-4+1]; push ecx // ftid
movzx ecx, byte ptr [esi+b_method-4+2]; push ecx // cto8
push eax; mov ecx,esp // dstlen also for unfilter step 7
push edi // dst param for unfilter step 7
p_unflt= -9*4
@ -248,12 +248,12 @@ supervise:
pop ecx // &dstlen
pop edx // discard method,filter,cto,junk
add eax,[ecx] // dst += dstlen
mov [dword ptr eax],0xc36180cd // "int 0x80; popa; ret"
mov dword ptr [eax],0xc36180cd // "int 0x80; popa; ret"
mov [esp + p_hatch - o_uncpr],eax // hatch at end of .text
//o_uncpr
pop eax // &decompress
//p_unflt
cmp [word ptr esp+3*4],0; je 0f // 0==ftid ==> no filter
cmp word ptr [esp+3*4],0; je 0f // 0==ftid ==> no filter
add eax,2; call eax // unfilter {i386 f_unf==(2+f_unc)}
0:
add esp,4*4

View File

@ -202,5 +202,6 @@ L32:
pop edi // &auxtab
ret
.balign 4,0
// vi:ts=8:et:nowrap

View File

@ -11,8 +11,7 @@ TARGET(elf32-i386)
.text 0x0000000000c01080 0x68c
*(.text)
.text 0x0000000000c01080 0xc2 tmp/i386-bsd.elf-fold.o
*fill* 0x0000000000c01142 0x2 00
.text 0x0000000000c01080 0xc4 tmp/i386-bsd.elf-fold.o
.text 0x0000000000c01144 0x558 tmp/i386-bsd.elf-main.o
0x0000000000c01564 upx_main
.text 0x0000000000c0169c 0x6d tmp/i386-bsd.syscall.o