start converting PackLinuxElf32x86 to ElfLinker
This commit is contained in:
+2
-2
@@ -504,8 +504,8 @@ void ElfLinker::init(const void *pdata, int plen, int)
|
|||||||
|
|
||||||
void ElfLinker::setLoaderAlignOffset(int phase)
|
void ElfLinker::setLoaderAlignOffset(int phase)
|
||||||
{
|
{
|
||||||
// FIXME: do not use this yet
|
//assert(phase & 0);
|
||||||
assert(phase & 0);
|
printf("\nFIXME: ElfLinker::setLoaderAlignOffset %d\n", phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ElfLinker::addSection(const char *sname)
|
int ElfLinker::addSection(const char *sname)
|
||||||
|
|||||||
+5
-3
@@ -462,9 +462,11 @@ tc.i386-linux.elf.objdump = $(call tc,m-objdump)
|
|||||||
tc.i386-linux.elf.objstrip = $(call tc,objcopy) -R .comment -R .note
|
tc.i386-linux.elf.objstrip = $(call tc,objcopy) -R .comment -R .note
|
||||||
|
|
||||||
i386-linux.elf-entry.h : $(srcdir)/src/$$T.asm
|
i386-linux.elf-entry.h : $(srcdir)/src/$$T.asm
|
||||||
$(call tc,pp-nasm) $< -o tmp/$T.tmp1
|
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||||
$(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2
|
$(call tc,m-objcopy) --strip-unneeded tmp/$T.bin
|
||||||
$(call tc,nasm) -f bin -l tmp/$T.bin.lst tmp/$T.tmp2 -o tmp/$T.bin
|
$(call tc,m-objcopy) -R .text -R .data -R .bss tmp/$T.bin
|
||||||
|
$(call tc,m-objcopy) -R .note -R .comment tmp/$T.bin
|
||||||
|
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
|
||||||
$(call tc,bin2h) --ident=linux_i386elf_loader tmp/$T.bin $@
|
$(call tc,bin2h) --ident=linux_i386elf_loader tmp/$T.bin $@
|
||||||
|
|
||||||
i386-linux.elf-fold.h : tmp/$$T.o tmp/i386-linux.elf-main.o $(srcdir)/src/$$T.lds
|
i386-linux.elf-fold.h : tmp/$$T.o tmp/i386-linux.elf-main.o $(srcdir)/src/$$T.lds
|
||||||
|
|||||||
+2507
-691
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,193 @@
|
|||||||
|
/*
|
||||||
|
; n2b_d32.ash -- ucl_nrv2b_decompress_le32 in 32-bit assembly
|
||||||
|
;
|
||||||
|
; This file is part of the UCL data compression library.
|
||||||
|
;
|
||||||
|
; Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
; All Rights Reserved.
|
||||||
|
;
|
||||||
|
; The UCL library is free software; you can redistribute it and/or
|
||||||
|
; modify it under the terms of the GNU General Public License as
|
||||||
|
; published by the Free Software Foundation; either version 2 of
|
||||||
|
; the License, or (at your option) any later version.
|
||||||
|
;
|
||||||
|
; The UCL library is distributed in the hope that it will be useful,
|
||||||
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
; GNU General Public License for more details.
|
||||||
|
;
|
||||||
|
; You should have received a copy of the GNU General Public License
|
||||||
|
; along with the UCL library; see the file COPYING.
|
||||||
|
; If not, write to the Free Software Foundation, Inc.,
|
||||||
|
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
;
|
||||||
|
; Markus F.X.J. Oberhumer
|
||||||
|
; <markus@oberhumer.com>
|
||||||
|
; http://www.oberhumer.com/opensource/ucl/
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
; ------------- DECOMPRESSION -------------
|
||||||
|
|
||||||
|
; Input:
|
||||||
|
; esi - source
|
||||||
|
; edi - dest
|
||||||
|
; ebp - -1
|
||||||
|
; cld
|
||||||
|
|
||||||
|
; Output:
|
||||||
|
; eax - 0
|
||||||
|
; ecx - 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// CPU 386
|
||||||
|
|
||||||
|
|
||||||
|
.macro getbit_n2b one
|
||||||
|
.ifc \one, 1
|
||||||
|
add ebx, ebx
|
||||||
|
jnz 1f
|
||||||
|
.endif
|
||||||
|
mov ebx, [esi]
|
||||||
|
sub esi, -4
|
||||||
|
adc ebx, ebx
|
||||||
|
1:
|
||||||
|
.endm
|
||||||
|
#undef getbit
|
||||||
|
#define getbit getbit_n2b
|
||||||
|
|
||||||
|
|
||||||
|
section N2BSMA10
|
||||||
|
jmps dcl1_n2b
|
||||||
|
decompr_literals_n2b:
|
||||||
|
movsb
|
||||||
|
section N2BFAS10
|
||||||
|
jmps dcl1_n2b
|
||||||
|
.balign 8
|
||||||
|
section N2BFAS11
|
||||||
|
decompr_literalb_n2b:
|
||||||
|
mov al, [esi]
|
||||||
|
inc esi
|
||||||
|
mov [edi], al
|
||||||
|
inc edi
|
||||||
|
section N2BDEC10
|
||||||
|
|
||||||
|
|
||||||
|
decompr_loop_n2b:
|
||||||
|
add ebx, ebx
|
||||||
|
jnz dcl2_n2b
|
||||||
|
dcl1_n2b:
|
||||||
|
getbit 32
|
||||||
|
dcl2_n2b:
|
||||||
|
section N2BSMA20
|
||||||
|
jcs decompr_literals_n2b
|
||||||
|
xor eax, eax
|
||||||
|
inc eax
|
||||||
|
section N2BFAS20
|
||||||
|
#ifndef UPX102
|
||||||
|
mov al, [edi] // force data cache allocate (PentiumPlain or MMX)
|
||||||
|
#endif
|
||||||
|
jcs decompr_literalb_n2b
|
||||||
|
mov eax, 1
|
||||||
|
section N2BDEC20
|
||||||
|
loop1_n2b:
|
||||||
|
getbit 1
|
||||||
|
adc eax, eax
|
||||||
|
section N2BSMA30
|
||||||
|
getbit 1
|
||||||
|
jncs loop1_n2b
|
||||||
|
section N2BFAS30
|
||||||
|
add ebx, ebx
|
||||||
|
jncs loop1_n2b
|
||||||
|
jnzs loopend1_n2b
|
||||||
|
getbit 32
|
||||||
|
jncs loop1_n2b
|
||||||
|
loopend1_n2b:
|
||||||
|
section N2BDEC30
|
||||||
|
xor ecx, ecx
|
||||||
|
sub eax, 3
|
||||||
|
jcs decompr_ebpeax_n2b
|
||||||
|
shl eax, 8
|
||||||
|
mov al, [esi]
|
||||||
|
inc esi
|
||||||
|
xor eax, -1
|
||||||
|
jzs decompr_end_n2b
|
||||||
|
mov ebp, eax
|
||||||
|
decompr_ebpeax_n2b:
|
||||||
|
getbit 1
|
||||||
|
adc ecx, ecx
|
||||||
|
getbit 1
|
||||||
|
adc ecx, ecx
|
||||||
|
jnz decompr_got_mlen_n2b
|
||||||
|
inc ecx
|
||||||
|
loop2_n2b:
|
||||||
|
getbit 1
|
||||||
|
adc ecx, ecx
|
||||||
|
section N2BSMA40
|
||||||
|
getbit 1
|
||||||
|
jncs loop2_n2b
|
||||||
|
section N2BFAS40
|
||||||
|
add ebx, ebx
|
||||||
|
jnc loop2_n2b
|
||||||
|
jnz loopend2_n2b
|
||||||
|
getbit 32
|
||||||
|
jncs loop2_n2b
|
||||||
|
loopend2_n2b:
|
||||||
|
section N2BDUMM1
|
||||||
|
section N2BSMA50
|
||||||
|
inc ecx
|
||||||
|
inc ecx
|
||||||
|
section N2BFAS50
|
||||||
|
add ecx, 2
|
||||||
|
section N2BDEC50
|
||||||
|
decompr_got_mlen_n2b:
|
||||||
|
cmp ebp, -0xd00
|
||||||
|
adc ecx, 1
|
||||||
|
section N2BSMA60
|
||||||
|
#ifndef UPX102
|
||||||
|
push esi
|
||||||
|
#else
|
||||||
|
mov edx, esi
|
||||||
|
#endif
|
||||||
|
lea esi, [edi+ebp]
|
||||||
|
rep
|
||||||
|
movsb
|
||||||
|
#ifndef UPX102
|
||||||
|
pop esi
|
||||||
|
#else
|
||||||
|
mov esi, edx
|
||||||
|
#endif
|
||||||
|
jmp decompr_loop_n2b
|
||||||
|
section N2BFAS60
|
||||||
|
lea edx, [edi+ebp]
|
||||||
|
cmp ebp, -4
|
||||||
|
#ifndef UPX102
|
||||||
|
mov al, [edi+ecx] // force data cache allocate (PentiumPlain or MMX)
|
||||||
|
#endif
|
||||||
|
jbes decompr_copy4_n2b
|
||||||
|
loop3_n2b:
|
||||||
|
mov al, [edx]
|
||||||
|
inc edx
|
||||||
|
mov [edi], al
|
||||||
|
inc edi
|
||||||
|
dec ecx
|
||||||
|
jnzs loop3_n2b
|
||||||
|
jmp decompr_loop_n2b
|
||||||
|
section N2BFAS61
|
||||||
|
.balign 4
|
||||||
|
decompr_copy4_n2b:
|
||||||
|
mov eax, [edx]
|
||||||
|
add edx, 4
|
||||||
|
mov [edi], eax
|
||||||
|
add edi, 4
|
||||||
|
sub ecx, 4
|
||||||
|
jas decompr_copy4_n2b
|
||||||
|
add edi, ecx
|
||||||
|
jmp decompr_loop_n2b
|
||||||
|
section N2BDEC60
|
||||||
|
decompr_end_n2b:
|
||||||
|
section NRV2BEND
|
||||||
|
|
||||||
|
// vi:ts=8:et
|
||||||
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/*
|
||||||
; l_lx_elf86.asm -- Linux program entry point & decompressor (Elf binary)
|
; l_lx_elf86.asm -- Linux program entry point & decompressor (Elf binary)
|
||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
@@ -28,24 +29,20 @@
|
|||||||
; John F. Reiser
|
; John F. Reiser
|
||||||
; <jreiser@users.sourceforge.net>
|
; <jreiser@users.sourceforge.net>
|
||||||
;
|
;
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "arch/i386/macros2.ash"
|
||||||
BITS 32
|
|
||||||
SECTION .text
|
|
||||||
CPU 386
|
|
||||||
|
|
||||||
%define jmps jmp short
|
|
||||||
%define jmpn jmp near
|
|
||||||
|
|
||||||
; /*************************************************************************
|
; /*************************************************************************
|
||||||
; // program entry point
|
; // program entry point
|
||||||
; // see glibc/sysdeps/i386/elf/start.S
|
; // see glibc/sysdeps/i386/elf/start.S
|
||||||
; **************************************************************************/
|
; **************************************************************************/
|
||||||
|
|
||||||
GLOBAL _start
|
.globl _start
|
||||||
;__LEXEC000__
|
section LEXEC000
|
||||||
_start:
|
_start:
|
||||||
;;;; int3
|
int3
|
||||||
|
/*
|
||||||
;; How to debug this code: Uncomment the 'int3' breakpoint instruction above.
|
;; How to debug this code: Uncomment the 'int3' breakpoint instruction above.
|
||||||
;; Build the stubs and upx. Compress a testcase, such as a copy of /bin/date.
|
;; Build the stubs and upx. Compress a testcase, such as a copy of /bin/date.
|
||||||
;; Invoke gdb, and give a 'run' command. Define a single-step macro such as
|
;; Invoke gdb, and give a 'run' command. Define a single-step macro such as
|
||||||
@@ -62,51 +59,52 @@ _start:
|
|||||||
;; end
|
;; end
|
||||||
;; Step through the code; remember that <Enter> repeats the previous command.
|
;; Step through the code; remember that <Enter> repeats the previous command.
|
||||||
;;
|
;;
|
||||||
call main ; push address of decompress subroutine
|
*/
|
||||||
|
call main // push address of decompress subroutine
|
||||||
decompress:
|
decompress:
|
||||||
|
|
||||||
; /*************************************************************************
|
//
|
||||||
; // C callable decompressor
|
// C callable decompressor
|
||||||
; **************************************************************************/
|
//
|
||||||
|
|
||||||
; /* Offsets to parameters, allowing for {push + pusha + call} */
|
/* Offsets to parameters, allowing for {push + pusha + call} */
|
||||||
%define O_INP (4+ 8*4 +1*4)
|
#define O_INP (4+ 8*4 +1*4)
|
||||||
%define O_INS (4+ 8*4 +2*4)
|
#define O_INS (4+ 8*4 +2*4)
|
||||||
%define O_OUTP (4+ 8*4 +3*4)
|
#define O_OUTP (4+ 8*4 +3*4)
|
||||||
%define O_OUTS (4+ 8*4 +4*4)
|
#define O_OUTS (4+ 8*4 +4*4)
|
||||||
%define O_PARAM (4+ 8*4 +5*4)
|
#define O_PARAM (4+ 8*4 +5*4)
|
||||||
|
|
||||||
%define INP dword [esp+O_INP]
|
#define INP dword [esp+O_INP]
|
||||||
%define INS dword [esp+O_INS]
|
#define INS dword [esp+O_INS]
|
||||||
%define OUTP dword [esp+O_OUTP]
|
#define OUTP dword [esp+O_OUTP]
|
||||||
%define OUTS dword [esp+O_OUTS]
|
#define OUTS dword [esp+O_OUTS]
|
||||||
%define PARM dword [esp+O_PARAM]
|
#define PARM dword [esp+O_PARAM]
|
||||||
|
|
||||||
;__LEXEC009__
|
section LEXEC009
|
||||||
;; empty section for commonality with l_lx_exec86.asm
|
//; empty section for commonality with l_lx_exec86.asm
|
||||||
;__LEXEC010__
|
section LEXEC010
|
||||||
pusha
|
pusha
|
||||||
push byte '?' ; cto8 (sign extension does not matter)
|
push /*byte*/ '?' // cto8 (sign extension does not matter)
|
||||||
; cld
|
// cld
|
||||||
|
|
||||||
mov esi, INP
|
mov esi, INP
|
||||||
mov edi, OUTP
|
mov edi, OUTP
|
||||||
|
|
||||||
or ebp, byte -1
|
or ebp, byte -1
|
||||||
;;; align 8
|
// align 8
|
||||||
|
|
||||||
%include "arch/i386/nrv2b_d32.ash"
|
#include "arch/i386/nrv2b_d32_2.ash"
|
||||||
%include "arch/i386/nrv2d_d32.ash"
|
//#include "arch/i386/nrv2d_d32.ash"
|
||||||
%include "arch/i386/nrv2e_d32.ash"
|
#include "arch/i386/nrv2e_d32_2.ash"
|
||||||
%include "arch/i386/lzma_d.ash"
|
//#include "arch/i386/lzma_d.ash"
|
||||||
%include "arch/i386/macros.ash"
|
//#include "arch/i386/macros.ash"
|
||||||
cjt32 0
|
cjt32 0
|
||||||
|
|
||||||
;__LEXEC015__
|
section LEXEC015
|
||||||
; eax is 0 from decompressor code
|
// eax is 0 from decompressor code
|
||||||
;xor eax, eax ; return code
|
//xor eax, eax ; return code
|
||||||
|
|
||||||
; check compressed size
|
// check compressed size
|
||||||
mov edx, INP
|
mov edx, INP
|
||||||
add edx, INS
|
add edx, INS
|
||||||
cmp esi, edx
|
cmp esi, edx
|
||||||
@@ -114,12 +112,12 @@ decompress:
|
|||||||
dec eax
|
dec eax
|
||||||
.ok:
|
.ok:
|
||||||
|
|
||||||
; write back the uncompressed size
|
// write back the uncompressed size
|
||||||
sub edi, OUTP
|
sub edi, OUTP
|
||||||
mov edx, OUTS
|
mov edx, OUTS
|
||||||
mov [edx], edi
|
mov [edx], edi
|
||||||
|
|
||||||
pop edx ; cto8
|
pop edx // cto8
|
||||||
|
|
||||||
mov [7*4 + esp], eax
|
mov [7*4 + esp], eax
|
||||||
popa
|
popa
|
||||||
@@ -127,107 +125,103 @@ decompress:
|
|||||||
|
|
||||||
ctojr32
|
ctojr32
|
||||||
ckt32 edi, dl
|
ckt32 edi, dl
|
||||||
;__LEXEC017__
|
section LEXEC017
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;__LEXEC020__
|
section LEXEC020
|
||||||
|
|
||||||
%define PAGE_SIZE ( 1<<12)
|
#define PAGE_SIZE ( 1<<12)
|
||||||
|
|
||||||
%define MAP_FIXED 0x10
|
#define MAP_FIXED 0x10
|
||||||
%define MAP_PRIVATE 0x02
|
#define MAP_PRIVATE 0x02
|
||||||
%define MAP_ANONYMOUS 0x20
|
#define MAP_ANONYMOUS 0x20
|
||||||
%define PROT_READ 1
|
#define PROT_READ 1
|
||||||
%define PROT_WRITE 2
|
#define PROT_WRITE 2
|
||||||
%define PROT_EXEC 4
|
#define PROT_EXEC 4
|
||||||
%define __NR_mmap 90
|
#define __NR_mmap 90
|
||||||
%define szElf32_Ehdr 0x34
|
#define szElf32_Ehdr 0x34
|
||||||
%define p_memsz 5*4
|
#define p_memsz 5*4
|
||||||
|
|
||||||
%define __NR_write 4
|
#define __NR_write 4
|
||||||
%define __NR_exit 1
|
#define __NR_exit 1
|
||||||
|
|
||||||
msg_SELinux:
|
msg_SELinux:
|
||||||
push byte L71 - L70
|
push /*byte*/ L71 - L70
|
||||||
pop edx ; length
|
pop edx // length
|
||||||
call L71
|
call L71
|
||||||
L70:
|
L70:
|
||||||
db "PROT_EXEC|PROT_WRITE failed.",10
|
.ascii "PROT_EXEC|PROT_WRITE failed.\n"
|
||||||
L71:
|
L71:
|
||||||
pop ecx ; message text
|
pop ecx // message text
|
||||||
push byte 2 ; fd stderr
|
push /*byte*/ 2 // fd stderr
|
||||||
pop ebx
|
pop ebx
|
||||||
push byte __NR_write
|
push /*byte*/ __NR_write
|
||||||
pop eax
|
pop eax
|
||||||
int 0x80
|
int 0x80
|
||||||
die:
|
die:
|
||||||
mov bl, byte 127 ; only low 7 bits matter!
|
mov bl, /*byte*/ 127 // only low 7 bits matter!
|
||||||
push byte __NR_exit
|
push /*byte*/ __NR_exit
|
||||||
pop eax ; write to stderr could fail, leaving eax as -EBADF etc.
|
pop eax // write to stderr could fail, leaving eax as -EBADF etc.
|
||||||
int 0x80
|
int 0x80
|
||||||
|
|
||||||
; Decompress the rest of this loader, and jump to it
|
// Decompress the rest of this loader, and jump to it
|
||||||
unfold:
|
unfold:
|
||||||
pop esi ; &{ b_info:{sz_unc, sz_cpr, 4{byte}}, compressed_data...}
|
pop esi // &{ b_info:{sz_unc, sz_cpr, 4{byte}}, compressed_data...}
|
||||||
|
|
||||||
lea eax, [ebp - (4+ decompress - _start)] ; 4: sizeof(int)
|
lea eax, [ebp - (4+ decompress - _start)] // 4: sizeof(int)
|
||||||
sub eax, [eax] ; %eax= &Elf32_Ehdr of this program
|
sub eax, [eax] // %eax= &Elf32_Ehdr of this program
|
||||||
mov edx, eax ; %edx= &Elf32_Ehdr of this program
|
mov edx, eax // %edx= &Elf32_Ehdr of this program
|
||||||
|
|
||||||
; Linux requires PF_W in order to create .bss (implied by .p_filesz!=.p_memsz),
|
// Linux requires PF_W in order to create .bss (implied by .p_filesz!=.p_memsz),
|
||||||
; but strict SELinux (or PaX, grSecurity) forbids PF_W with PF_X.
|
// but strict SELinux (or PaX, grSecurity) forbids PF_W with PF_X.
|
||||||
; So first PT_LOAD must be PF_R|PF_X only, and .p_memsz==.p_filesz.
|
// So first PT_LOAD must be PF_R|PF_X only, and .p_memsz==.p_filesz.
|
||||||
; So we must round up here, instead of pre-rounding .p_memsz.
|
// So we must round up here, instead of pre-rounding .p_memsz.
|
||||||
add eax, [p_memsz + szElf32_Ehdr + eax] ; address after .text
|
add eax, [p_memsz + szElf32_Ehdr + eax] // address after .text
|
||||||
add eax, PAGE_SIZE -1
|
add eax, PAGE_SIZE -1
|
||||||
and eax, -PAGE_SIZE
|
and eax, 0-PAGE_SIZE
|
||||||
|
|
||||||
push eax ; destination for 'ret'
|
push eax // destination for 'ret'
|
||||||
|
|
||||||
; mmap a page to hold the decompressed fold_elf86
|
// mmap a page to hold the decompressed fold_elf86
|
||||||
xor ecx, ecx ; %ecx= 0
|
xor ecx, ecx // %ecx= 0
|
||||||
; MAP_ANONYMOUS ==>offset is ignored, so do not push!
|
// MAP_ANONYMOUS ==>offset is ignored, so do not push!
|
||||||
; push ecx ; offset
|
// push ecx ; offset
|
||||||
push byte -1 ; *BSD demands -1==fd for mmap(,,,MAP_ANON,,)
|
push /*byte*/ -1 // *BSD demands -1==fd for mmap(,,,MAP_ANON,,)
|
||||||
push byte MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS
|
push /*byte*/ MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS
|
||||||
mov ch, PAGE_SIZE >> 8 ; %ecx= PAGE_SIZE
|
mov ch, PAGE_SIZE >> 8 // %ecx= PAGE_SIZE
|
||||||
push byte PROT_READ | PROT_WRITE | PROT_EXEC
|
push /*byte*/ PROT_READ | PROT_WRITE | PROT_EXEC
|
||||||
push ecx ; length
|
push ecx // length
|
||||||
push eax ; destination
|
push eax // destination
|
||||||
mov ebx, esp ; address of parameter vector for __NR_mmap
|
mov ebx, esp // address of parameter vector for __NR_mmap
|
||||||
push byte __NR_mmap
|
push /*byte*/ __NR_mmap
|
||||||
pop eax
|
pop eax
|
||||||
int 0x80 ; changes only %eax; %edx is live
|
int 0x80 // changes only %eax; %edx is live
|
||||||
test eax,eax
|
test eax,eax
|
||||||
js msg_SELinux
|
js msg_SELinux
|
||||||
xchg eax, edx ; %edx= page after .text; %eax= &Elf32_Ehdr of this program
|
xchg eax, edx // %edx= page after .text; %eax= &Elf32_Ehdr of this program
|
||||||
xchg eax, ebx ; %ebx= &Elf32_Ehdr of this program
|
xchg eax, ebx // %ebx= &Elf32_Ehdr of this program
|
||||||
|
|
||||||
cld
|
cld
|
||||||
lodsd
|
lodsd
|
||||||
push eax ; sz_uncompressed (maximum dstlen for lzma)
|
push eax // sz_uncompressed (maximum dstlen for lzma)
|
||||||
mov ecx,esp ; save &dstlen
|
mov ecx,esp // save &dstlen
|
||||||
push eax ; space for 5th param
|
push eax // space for 5th param
|
||||||
push ecx ; &dstlen
|
push ecx // &dstlen
|
||||||
push edx ; &dst
|
push edx // &dst
|
||||||
lodsd
|
lodsd
|
||||||
push eax ; sz_compressed (srclen)
|
push eax // sz_compressed (srclen)
|
||||||
lodsd ; last 4 bytes of b_info
|
lodsd // last 4 bytes of b_info
|
||||||
mov [4*3 + esp],eax
|
mov [4*3 + esp],eax
|
||||||
push esi ; &compressed_data
|
push esi // &compressed_data
|
||||||
call ebp ; decompress(&src, srclen, &dst, &dstlen, b_info.misc)
|
call ebp // decompress(&src, srclen, &dst, &dstlen, b_info.misc)
|
||||||
add esp, byte (5+1 + 6-1)*4 ; (5+1) args to decompress, (6-1) args to mmap
|
add esp, /*byte*/ (5+1 + 6-1)*4 // (5+1) args to decompress, (6-1) args to mmap
|
||||||
ret ; &destination
|
ret // &destination
|
||||||
main:
|
main:
|
||||||
pop ebp ; &decompress
|
pop ebp // &decompress
|
||||||
call unfold
|
call unfold
|
||||||
; compressed fold_elf86 follows
|
// compressed fold_elf86 follows
|
||||||
eof:
|
eof:
|
||||||
; __XTHEENDX__
|
|
||||||
section .data
|
|
||||||
dd -1
|
|
||||||
dw eof
|
|
||||||
|
|
||||||
; vi:ts=8:et:nowrap
|
// vi:ts=8:et:nowrap
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user