add UPX_F_VMLINUX_AMD64, UPX_F_VMLINUX_ARM

This commit is contained in:
John Reiser
2006-12-16 08:13:34 -08:00
parent d7837d9179
commit 112eff2509
18 changed files with 5723 additions and 7 deletions
+48
View File
@@ -46,8 +46,13 @@ endif
ifndef STUBS
STUBS += amd64-linux.elf-entry.h
STUBS += amd64-linux.elf-fold.h
STUBS += amd64-linux.kernel.vmlinux.h
STUBS += amd64-linux.kernel.vmlinux-head.h
STUBS += amd64-linux.kernel.vmlinuz.h
STUBS += arm-linux.elf-entry.h
STUBS += arm-linux.elf-fold.h
STUBS += arm-linux.kernel.vmlinux.h
STUBS += arm-linux.kernel.vmlinux-head.h
STUBS += armeb-linux.elf-entry.h
STUBS += armeb-linux.elf-fold.h
STUBS += arm.v4a-wince.pe.h
@@ -640,6 +645,49 @@ i386-linux.kernel.vmlinux-head.h : $(srcdir)/src/$$T.S
$(call tc,bin2h) tmp/$T.bin $@
# /***********************************************************************
# // amd64-linux.kernel.vmlinux
# // amd64-linux.kernel.vmlinuz
# // amd64-linux.kernel.vmlinux-head
# ************************************************************************/
amd64-linux.kernel.vmlinu%.h : tc_list = arch-i386 default
amd64-linux.kernel.vmlinu%.h : $(srcdir)/src/$$T.S
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
$(call tc,f-embed_objinfo,tmp/$T.bin)
$(call tc,bin2h-c) tmp/$T.bin $@
amd64-linux.kernel.vmlinux-head.h : $(srcdir)/src/$$T.S
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.o
$(call tc,objcopy) --output-target binary --only-section .text tmp/$T.o tmp/$T.bin
$(call tc,bin2h) tmp/$T.bin $@
# /***********************************************************************
# // arm-linux.kernel.vmlinux
# // arm-linux.kernel.vmlinuz
# // arm-linux.kernel.vmlinux-head
# ************************************************************************/
tc.arm-linux.kernel.gcc = arm-linux-gcc-4.1.0 -march=armv5 -nostdinc -MMD -MT $@
tc.arm-linux.kernel.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
tc.arm-linux.kernel.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
arm-linux.kernel.vmlinu%.h : tc_bfdname = elf32-littlearm
arm-linux.kernel.vmlinu%.h : tc_list = arm-linux.kernel default
arm-linux.kernel.vmlinu%.h : $(srcdir)/src/$$T.S
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
$(call tc,f-embed_objinfo,tmp/$T.bin)
$(call tc,bin2h-c) tmp/$T.bin $@
arm-linux.kernel.vmlinux-head.h : $(srcdir)/src/$$T.S
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.o
$(call tc,objcopy) --output-target binary --only-section .text tmp/$T.o tmp/$T.bin
$(call tc,bin2h) tmp/$T.bin $@
# /***********************************************************************
# // i386-win32.pe
# ************************************************************************/
@@ -0,0 +1,39 @@
/* amd64-linux.kernel.vmlinux-head.h
created from amd64-linux.kernel.vmlinux-head.bin, 39 (0x27) bytes
This file is part of the UPX executable compressor.
Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2006 Laszlo Molnar
Copyright (C) 2000-2006 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them 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.
This program 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 this program; 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 Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
*/
#define STUB_AMD64_LINUX_KERNEL_VMLINUX_HEAD_SIZE 39
#define STUB_AMD64_LINUX_KERNEL_VMLINUX_HEAD_ADLER32 0x7a591357
#define STUB_AMD64_LINUX_KERNEL_VMLINUX_HEAD_CRC32 0xf4f6740a
unsigned char stub_amd64_linux_kernel_vmlinux_head[39] = {
140,200,131,192, 8,142,216,142,192,141,142, 0,144, 0, 0,137, /* 0x 0 */
73,248,137, 65,252, 15,178, 97,248,106, 0,157, 14,184, 0, 0, /* 0x 10 */
0, 0,232,252,255,255,255 /* 0x 20 */
};
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+38
View File
@@ -0,0 +1,38 @@
/* arm-linux.kernel.vmlinux-head.h
created from arm-linux.kernel.vmlinux-head.bin, 20 (0x14) bytes
This file is part of the UPX executable compressor.
Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2006 Laszlo Molnar
Copyright (C) 2000-2006 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them 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.
This program 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 this program; 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 Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
*/
#define STUB_ARM_LINUX_KERNEL_VMLINUX_HEAD_SIZE 20
#define STUB_ARM_LINUX_KERNEL_VMLINUX_HEAD_ADLER32 0x621b0b3f
#define STUB_ARM_LINUX_KERNEL_VMLINUX_HEAD_CRC32 0x87e74167
unsigned char stub_arm_linux_kernel_vmlinux_head[20] = {
112, 0, 32,225, 1, 96, 34,233, 2,208,160,225,254,255,255,235, /* 0x 0 */
2,160,157,232 /* 0x 10 */
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
#include "i386-linux.kernel.vmlinux-head.S"
@@ -0,0 +1 @@
#include "i386-linux.kernel.vmlinux.S"
@@ -0,0 +1 @@
#include "i386-linux.kernel.vmlinuz.S"
+2
View File
@@ -72,8 +72,10 @@
#define CHECK_BYTE /*empty*/
#endif /*}*/
#undef GETBIT
#define GETBIT ADD2S(bits,bits); bleq get8_n2e
#undef getnextb
#define getnextb(reg) GETBIT; ADC2(reg,reg) /* Out: condition code not changed */
#define jnextb0 GETBIT; bcc
#define jnextb1 GETBIT; bcs
@@ -0,0 +1,40 @@
/*
; arm-linux.kernel.vmlinux-head.S -- set up stack for vmlinux/arm format
;
; This file is part of the UPX executable compressor.
;
; Copyright (C) 2006 John Reiser
; All Rights Reserved.
;
; UPX and the UCL library are free software; you can redistribute them
; and/or modify them 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.
;
; This program 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 this program; see the file COPYING.
; If not, write to the Free Software Foundation, Inc.,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
; John Reiser
; <jreiser@users.sourceforge.net>
*/
/* Calling sequence of equivalent code in arch/arm/boot/compressed/misc.c:
decompress_kernel: # (char *out, char *tmp, char *end_tmp, int arch_id)
*/
bkpt
stmdb r2!,{r0,sp,lr}
mov sp,r2
// PackVmlinuxARM::pack knows the format of the next instruction.
bl COMPRESSED_LENGTH
ldmia sp,{r1,sp,pc}
// Compressed data appears >here<, then decompressor.
// vi:ts=8:et:nowrap
+115
View File
@@ -0,0 +1,115 @@
/*
; i386-linux.kernel.vmlinux.S -- loader & decompressor for the vmlinux/i386 format
;
; This file is part of the UPX executable compressor.
;
; Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 1996-2006 Laszlo Molnar
; Copyright (C) 2004-2006 John Reiser
; All Rights Reserved.
;
; UPX and the UCL library are free software; you can redistribute them
; and/or modify them 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.
;
; This program 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 this program; 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 Laszlo Molnar
; <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
;
; John Reiser
; <jreiser@users.sourceforge.net>
*/
#include "arch/arm/v5a/macros.S"
/*
; =============
; ============= ENTRY POINT
; =============
; In:
; r0= outptr; r1= &tmp; r3= arch_id; lr= retaddr, inptr - N
How to debug: run under qemu (http://fabrice.bellard.free.fr/qemu/)
after un-commenting the bkpt opcode below. That opcode forces qemu
to stop in gdb. You'll have to "set $pc+=4" by hand.
*/
section LINUX000
bkpt // qemu breakpoint
ldr r1,[lr,#-4] // 'bl' instruction
str r3,[sp,$-4]! // push arch_id
bic r1,r1,#~0<<24 // word count
sub sp,sp,#4 // space for outsize
mov r1,r1,lsl #2 // byte count
mov r3,sp // &outsize
.long 0xe2411000 + BYTE_ADJ // sub r1,r1,#BYTE_ADJ // insize
mov r2,r0 // outptr
.long 0xe28e0000 + WORD_ADJ // add r0,lr,#WORD_ADJ // inptr
/*
r0= inptr
r1= insize
r2= outptr
r3= &outsize
*/
section LXCALLT1
mvn ip,#1
bkpt
section LXCKLLT1
mvn ip,#2
bkpt
.long filter_cto,filter_length
section LXMOVEUP
mvn ip,#3
bkpt
// =============
// ============= DECOMPRESSION
// =============
#include "arch/arm/v5a/nrv2b_d8.S"
#include "arch/arm/v5a/nrv2d_d8.S"
#include "arch/arm/v5a/nrv2e_d8.S"
#include "arch/arm/v5a/lzma_d.S"
// =============
// ============= UNFILTER
// =============
section LXCKLLT9
mvn ip,#4
bkpt
section LXCALLT9
mvn ip,#5
bkpt
section LINUX990
mvn ip,#6
bkpt
mov pc,lr
section LINUX991
mvn ip,#7
bkpt
#if 0 /*{*/
or ebp, -1 // decompressor assumption
#endif /*}*/
section LINUX992
mvn ip,#8
bkpt
#include "include/header.S"
// vi:ts=8:et:nowrap