diff --git a/.hgignore b/.hgignore index 7d4cbcb1..67017746 100644 --- a/.hgignore +++ b/.hgignore @@ -29,16 +29,11 @@ src/compress_nrv* src/*.rc stub/MMakefile -stub/l_t_*.i -stub/stamp-h -stub/*.ash -stub/*.asx -stub/*.asy -stub/*.bin -stub/*.lst +stub/tmp* +stub/.*stamp -stub/util/armpe/armpe_tester +stub/tools/armpe/armpe_tester -stub/util/sstrip/amd64-linux-sstrip -stub/util/sstrip/i386-linux-sstrip -stub/util/sstrip/sstrip +stub/tools/sstrip/amd64-linux-sstrip +stub/tools/sstrip/i386-linux-sstrip +stub/tools/sstrip/sstrip diff --git a/README.SRC b/README.SRC index 5cfc19dc..085284fa 100644 --- a/README.SRC +++ b/README.SRC @@ -69,29 +69,30 @@ Tools needed to build/modify the UPX sources - A C++ compiler supporting inner classes, templates, exceptions and RTTI. - - GNU make 3.80 or better + - GNU make 3.80 or better (GNU make 3.81 recommened). To compile the packer sources ----------------------------- - set the environment variable UCLDIR to point to your UCL installation, e.g. + set the environment variable UPX_UCLDIR to point to your UCL installation, e.g. - set UCLDIR=c:\src\ucl-1.03 (DOS / Windows) - export UCLDIR=$HOME/local/src/ucl-1.03 (Unix) + set UPX_UCLDIR=c:\src\ucl-1.03 (DOS / Windows) + export UPX_UCLDIR=$HOME/local/src/ucl-1.03 (Unix) then type - make target=linux # linux - make target=djgpp2 # dos32 - djgpp2 - make target=cygwin # win32 - cygwin 1.3.x - make target=mingw32 # win32 - mingw32 - make target=no-cygwin # win32 - mingw32 as included in cygwin + make If you want to modify the stub sources you'll also need ------------------------------------------------------- + - GNU make 3.81 or better + http://savannah.gnu.org/projects/make/ + + - Perl & Python + - A68K - a 68000 macro assembler http://upx.sourceforge.net/download/tools/ @@ -102,20 +103,44 @@ If you want to modify the stub sources you'll also need http://upx.sourceforge.net/download/tools/ - nasm 0.98.39 - the Netwide Assembler - http://upx.sourceforge.net/download/tools/ http://sourceforge.net/projects/nasm/ - - Perl & Python - - Certain versions of some i386-linux tools: - gcc-2.95.3 - gcc-3.4.6 - binutils-2.16.1 - - Other cross compilers targeted at the following architectures: + - Other cross compilers targeted at the following architectures. - arm-9tdmi-linux-gnu - powerpc-750-linux-gnu - x86_64-unknown-linux-gnu + See http://upx.sourceforge.net/download/tools/ for pre-compiled + toolchains. + + - SUMMARY: + + You will need GNU make 3.81 and the following files/symlinks in your + ~/local/bin/bin-upx/ directory (this directory will get added to + your $PATH automatically by src/stub/Makefile): + + bin-upx/a68k + bin-upx/arm-9tdmi-linux-gnu-gcc-3.4.5 + bin-upx/arm-9tdmi-linux-gnu-ld + bin-upx/arm-9tdmi-linux-gnu-objcopy + bin-upx/asm5900 + bin-upx/djasm + bin-upx/i386-linux-gcc-2.95.3 + bin-upx/i386-linux-gcc-3.4.6 + bin-upx/i386-linux-ld-2.16.1 + bin-upx/i386-linux-objcopy-2.16.1 + bin-upx/nasm + bin-upx/powerpc-750-linux-gnu-gcc-3.4.4 + bin-upx/powerpc-750-linux-gnu-ld + bin-upx/powerpc-750-linux-gnu-objcopy + bin-upx/sstrip [ from src/stub/util ] + bin-upx/x86_64-unknown-linux-gnu-gcc-3.4.4 + bin-upx/x86_64-unknown-linux-gnu-ld + bin-upx/x86_64-unknown-linux-gnu-objcopy Misc. notes @@ -130,8 +155,6 @@ Misc. notes stream. - Use gcc extensions and other compiler specific stuff only through macros. - - Keep in mind that it should be possible to build UPX on braindead - case insensitive file systems (FAT). *** @@ -156,3 +179,5 @@ Patches/Contributions diff -uNr olddirectory newdirectory + +# vi:ts=4:et diff --git a/src/p_armpe.cpp b/src/p_armpe.cpp index 6356c835..89541903 100644 --- a/src/p_armpe.cpp +++ b/src/p_armpe.cpp @@ -34,9 +34,9 @@ #include "linker.h" static const -#include "stub/l_armpea.h" +#include "stub/arm.v4a-wince.pe.h" static const -#include "stub/l_armpet.h" +#include "stub/arm.v4t-wince.pe.h" #define IDSIZE(x) ih.ddirs[x].size #define IDADDR(x) ih.ddirs[x].vaddr diff --git a/src/p_com.cpp b/src/p_com.cpp index 57c73903..4389f4f0 100644 --- a/src/p_com.cpp +++ b/src/p_com.cpp @@ -33,7 +33,7 @@ #include "p_com.h" static const -#include "stub/l_com.h" +#include "stub/i086-dos16.com.h" //#define TESTING diff --git a/src/p_djgpp2.cpp b/src/p_djgpp2.cpp index f32b77d2..a7cc6b37 100644 --- a/src/p_djgpp2.cpp +++ b/src/p_djgpp2.cpp @@ -33,9 +33,9 @@ #include "p_djgpp2.h" static const -#include "stub/l_djgpp2.h" +#include "stub/i386-dos32.djgpp2.h" static const -#include "stub/stubify.h" +#include "stub/i386-dos32.djgpp2-stubify.h" /************************************************************************* diff --git a/src/p_exe.cpp b/src/p_exe.cpp index 09fc790f..0978d0f1 100644 --- a/src/p_exe.cpp +++ b/src/p_exe.cpp @@ -33,7 +33,7 @@ #include "p_exe.h" static const -#include "stub/l_exe.h" +#include "stub/i086-dos16.exe.h" #define RSFCRI 4096 // Reserved Space For Compressed Relocation Info #define MAXMATCH 0x2000 diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 138c43c0..1cb42688 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -531,9 +531,9 @@ PackLinuxElf64::buildLinuxLoader( } static const -#include "stub/l_lx_elf86.h" +#include "stub/i386-linux.elf-entry.h" static const -#include "stub/fold_elf86.h" +#include "stub/i386-linux.elf-fold.h" int PackLinuxElf32x86::buildLoader(const Filter *ft) @@ -559,9 +559,9 @@ PackLinuxElf32x86::buildLoader(const Filter *ft) } static const -#include "stub/l_lx_elf32arm.h" +#include "stub/arm-linux.elf-entry.h" static const -#include "stub/fold_elf32arm.h" +#include "stub/arm-linux.elf-fold.h" #include "mem.h" @@ -675,9 +675,9 @@ PackLinuxElf32armLe::buildLoader(Filter const *ft) } static const -#include "stub/l_lx_elfppc32.h" +#include "stub/powerpc-linux.elf-entry.h" static const -#include "stub/fold_elfppc32.h" +#include "stub/powerpc-linux.elf-fold.h" int PackLinuxElf32ppc::buildLoader(const Filter *ft) @@ -688,9 +688,9 @@ PackLinuxElf32ppc::buildLoader(const Filter *ft) } static const -#include "stub/l_lx_elf64amd.h" +#include "stub/amd64-linux.elf-entry.h" static const -#include "stub/fold_elf64amd.h" +#include "stub/amd64-linux.elf-fold.h" int PackLinuxElf64amd::buildLoader(const Filter *ft) diff --git a/src/p_lx_exc.cpp b/src/p_lx_exc.cpp index a2a0d8c9..7e00b7db 100644 --- a/src/p_lx_exc.cpp +++ b/src/p_lx_exc.cpp @@ -55,9 +55,9 @@ **************************************************************************/ static const -#include "stub/l_lx_exec86.h" +#include "stub/i386-linux.elf.execve-entry.h" static const -#include "stub/fold_exec86.h" +#include "stub/i386-linux.elf.execve-fold.h" const int *PackLinuxI386::getCompressionMethods(int method, int level) const diff --git a/src/p_lx_interp.cpp b/src/p_lx_interp.cpp index 6d468e24..dca942ea 100644 --- a/src/p_lx_interp.cpp +++ b/src/p_lx_interp.cpp @@ -51,9 +51,9 @@ **************************************************************************/ static const -#include "stub/l_lx_pti86.h" +#include "stub/i386-linux.elf.interp-entry.h" static const -#include "stub/fold_pti86.h" +#include "stub/i386-linux.elf.interp-fold.h" PackLinuxElf32x86interp::PackLinuxElf32x86interp(InputFile *f) : super(f) diff --git a/src/p_lx_sep.cpp b/src/p_lx_sep.cpp deleted file mode 100644 index 1b4ebfa2..00000000 --- a/src/p_lx_sep.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* p_lx_sep.cpp -- - - 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 - - - John F. Reiser - - */ - - -#include "conf.h" - -#include "file.h" -#include "packer.h" -#include "p_elf.h" -#include "p_unix.h" -#include "p_lx_exc.h" -#include "p_lx_elf.h" -#include "p_lx_sep.h" - - -/************************************************************************* -// -**************************************************************************/ - -//#define SCRIPT_SIZE (opt->o_unix.SCRIPT_MAX + sizeof(l_info)) -#define SCRIPT_SIZE (32 + sizeof(l_info)) - -const upx_byte *PackLinuxI386sep::getLoader() const -{ - static char script[SCRIPT_SIZE]; - - memset(script, 0, sizeof(script)); - char const *name = opt->o_unix.script_name; - if (0==name) { - name = "/usr/local/lib/upxX"; - } - upx_snprintf(script, sizeof(script), "#!%s\n", name); - if (M_IS_NRV2B(ph.method)) { - script[strlen(script)-2] = 'b'; - return (upx_byte const *)script; - } - if (M_IS_NRV2D(ph.method)) { - script[strlen(script)-2] = 'd'; - return (upx_byte const *)script; - } - return NULL; -} - -int PackLinuxI386sep::getLoaderSize() const -{ - if (M_IS_NRV2B(ph.method)) - return SCRIPT_SIZE; - if (M_IS_NRV2D(ph.method)) - return SCRIPT_SIZE; - return 0; -} - -int PackLinuxI386sep::getLoaderPrefixSize() const -{ - return opt->o_unix.SCRIPT_MAX; -} - -void PackLinuxI386sep::patchLoader() -{ - patchLoaderChecksum(); -} - -/* -vi:ts=4:et -*/ - diff --git a/src/p_lx_sh.cpp b/src/p_lx_sh.cpp index f447e3e2..b6dd73ff 100644 --- a/src/p_lx_sh.cpp +++ b/src/p_lx_sh.cpp @@ -48,9 +48,9 @@ **************************************************************************/ static const -#include "stub/l_lx_sh86.h" +#include "stub/i386-linux.elf.shell-entry.h" static const -#include "stub/fold_sh86.h" +#include "stub/i386-linux.elf.shell-fold.h" PackLinuxI386sh::PackLinuxI386sh(InputFile *f) : diff --git a/src/p_mach.cpp b/src/p_mach.cpp index 3cbec7e7..af43497c 100644 --- a/src/p_mach.cpp +++ b/src/p_mach.cpp @@ -34,10 +34,9 @@ #include "p_mach.h" static const -#include "stub/l_mac_ppc32.h" - +#include "stub/powerpc-darwin.macho-entry.h" static const -#include "stub/fold_machppc32.h" +#include "stub/powerpc-darwin.macho-fold.h" PackMachPPC32::PackMachPPC32(InputFile *f) : super(f), n_segment(0), rawmseg(0), msegcmd(0) diff --git a/src/p_ps1.cpp b/src/p_ps1.cpp index d6da7c09..d244e8a0 100644 --- a/src/p_ps1.cpp +++ b/src/p_ps1.cpp @@ -37,9 +37,9 @@ #include "p_ps1.h" static const -#include "stub/l_ps1b.h" +#include "stub/mipsel.r3000-ps1-boot.h" static const -#include "stub/l_ps1c.h" +#include "stub/mipsel.r3000-ps1-console.h" #define MIPS_HI(a) ((a) >> 16) diff --git a/src/p_sys.cpp b/src/p_sys.cpp index cc369eab..a014cbae 100644 --- a/src/p_sys.cpp +++ b/src/p_sys.cpp @@ -34,7 +34,7 @@ #include "p_sys.h" static const -#include "stub/l_sys.h" +#include "stub/i086-dos16.sys.h" /************************************************************************* diff --git a/src/p_tmt.cpp b/src/p_tmt.cpp index fbecbbac..ee70af9b 100644 --- a/src/p_tmt.cpp +++ b/src/p_tmt.cpp @@ -33,7 +33,7 @@ #include "p_tmt.h" static const -#include "stub/l_tmt.h" +#include "stub/i386-dos32.tmt.h" #define EXTRA_INFO 4 // original entry point diff --git a/src/p_tos.cpp b/src/p_tos.cpp index e0ef90e3..2b245dbe 100644 --- a/src/p_tos.cpp +++ b/src/p_tos.cpp @@ -34,17 +34,17 @@ #include "p_tos.h" static const -#include "stub/l_t_n2b.h" +#include "stub/m68k-atari.tos-nrv2b.h" static const -#include "stub/l_t_n2bs.h" +#include "stub/m68k-atari.tos-nrv2b.small.h" static const -#include "stub/l_t_n2d.h" +#include "stub/m68k-atari.tos-nrv2d.h" static const -#include "stub/l_t_n2ds.h" +#include "stub/m68k-atari.tos-nrv2d.small.h" static const -#include "stub/l_t_n2e.h" +#include "stub/m68k-atari.tos-nrv2e.h" static const -#include "stub/l_t_n2es.h" +#include "stub/m68k-atari.tos-nrv2e.small.h" // #define TESTING diff --git a/src/p_vmlinx.cpp b/src/p_vmlinx.cpp index 409c06f4..8b973715 100644 --- a/src/p_vmlinx.cpp +++ b/src/p_vmlinx.cpp @@ -38,7 +38,7 @@ #include "p_vmlinx.h" static const -#include "stub/l_vmlinx.h" +#include "stub/i386-linux.kernel.vmlinux.h" /************************************************************************* // diff --git a/src/p_vmlinz.cpp b/src/p_vmlinz.cpp index 859f1a0c..77e4dc13 100644 --- a/src/p_vmlinz.cpp +++ b/src/p_vmlinz.cpp @@ -35,7 +35,7 @@ #include static const -#include "stub/l_vmlinz.h" +#include "stub/i386-linux.kernel.vmlinuz.h" static const unsigned kernel_entry = 0x100000; static const unsigned stack_offset_during_uncompression = 0x9000; diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index a47b8ede..b8178ac0 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -33,7 +33,7 @@ #include "p_w32pe.h" static const -#include "stub/l_w32pe.h" +#include "stub/i386-win32.pe.h" #define IDSIZE(x) ih.ddirs[x].size #define IDADDR(x) ih.ddirs[x].vaddr diff --git a/src/p_wcle.cpp b/src/p_wcle.cpp index 7bb31ac2..d359027c 100644 --- a/src/p_wcle.cpp +++ b/src/p_wcle.cpp @@ -34,7 +34,7 @@ #include "p_wcle.h" static const -#include "stub/l_wcle.h" +#include "stub/i386-dos32.watcom.le.h" #define LEOF_READ (1<<0) #define LEOF_WRITE (1<<1) diff --git a/src/packmast.cpp b/src/packmast.cpp index 14e6c0aa..c14dee38 100644 --- a/src/packmast.cpp +++ b/src/packmast.cpp @@ -39,7 +39,7 @@ #include "p_unix.h" #include "p_lx_exc.h" #include "p_lx_elf.h" -#include "p_lx_sep.h" +//#include "p_lx_sep.h" #include "p_lx_sh.h" #include "p_lx_interp.h" #include "p_sys.h" diff --git a/src/stub/Makefile b/src/stub/Makefile index e7953c4f..2e91eb54 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -1,633 +1,632 @@ # -# UPX stub Makefile (GNU make) +# UPX stub Makefile - needs GNU make 3.81 or better # # see http://upx.sourceforge.net/download/tools/ # for required build tools # +# also please read README.SRC +# MAKEFLAGS += -rR -SHELL = /bin/sh +.SUFFIXES: +export SHELL = /bin/sh -ifeq ($(strip $(UPX_UCLDIR)),) -# change this to reflect where the UCL library is -UPX_UCLDIR = $(HOME)/local/src/ucl-1.03 -endif -ifeq ($(wildcard $(UPX_UCLDIR)/upx),) -$(error Please set UPX_UCLDIR in Makefile or environment) -endif +# GNU make 3.81 +.SECONDEXPANSION: -# update path for our special stub build tools +# update $PATH for our special stub build tools ifneq ($(wildcard $(HOME)/local/bin/bin-upx),) export PATH := $(HOME)/local/bin/bin-upx:$(PATH) endif -# ------------------------------------------------------- -# You should not have to change anything below this line. -# ------------------------------------------------------- +# /*********************************************************************** +# // +# ************************************************************************/ srcdir = . top_srcdir = ../.. +STUBS += amd64-linux.elf-entry.h +STUBS += amd64-linux.elf-fold.h +STUBS += arm-linux.elf-entry.h +STUBS += arm-linux.elf-fold.h +STUBS += arm.v4a-wince.pe.h +STUBS += arm.v4t-wince.pe.h +STUBS += i086-dos16.com.h +STUBS += i086-dos16.exe.h +STUBS += i086-dos16.sys.h +STUBS += i386-dos32.djgpp2.h +STUBS += i386-dos32.djgpp2-stubify.h +STUBS += i386-dos32.tmt.h +STUBS += i386-dos32.watcom.le.h +STUBS += i386-linux.elf-entry.h +STUBS += i386-linux.elf-fold.h +STUBS += i386-linux.elf.execve-entry.h +STUBS += i386-linux.elf.execve-fold.h +STUBS += i386-linux.elf.interp-entry.h +STUBS += i386-linux.elf.interp-fold.h +STUBS += i386-linux.elf.shell-entry.h +STUBS += i386-linux.elf.shell-fold.h +STUBS += i386-linux.kernel.vmlinux.h +STUBS += i386-linux.kernel.vmlinuz.h +STUBS += i386-win32.pe.h +STUBS += m68k-atari.tos-nrv2b.h +STUBS += m68k-atari.tos-nrv2b.small.h +STUBS += m68k-atari.tos-nrv2d.h +STUBS += m68k-atari.tos-nrv2d.small.h +STUBS += m68k-atari.tos-nrv2e.h +STUBS += m68k-atari.tos-nrv2e.small.h +STUBS += mipsel.r3000-ps1-boot.h +STUBS += mipsel.r3000-ps1-console.h +STUBS += powerpc-darwin.macho-entry.h +STUBS += powerpc-darwin.macho-fold.h +STUBS += powerpc-linux.elf-entry.h +STUBS += powerpc-linux.elf-fold.h -# These are the files we want to create. -STUBS = \ - l_armpea.h l_armpet.h \ - l_com.h \ - l_djgpp2.h stubify.h \ - l_exe.h \ - l_ps1b.h l_ps1c.h \ - l_sys.h \ - l_t_n2b.h l_t_n2bs.h l_t_n2d.h l_t_n2ds.h l_t_n2e.h l_t_n2es.h \ - l_tmt.h \ - l_wcle.h \ - l_w32pe.h \ - l_lx_exec86.h fold_exec86.h \ - l_lx_elf86.h fold_elf86.h \ - l_lx_sh86.h fold_sh86.h \ - l_lx_pti86.h fold_pti86.h \ - l_lx_elfppc32.h fold_elfppc32.h \ - l_lx_elf64amd.h fold_elf64amd.h \ - l_lx_elf32arm.h fold_elf32arm.h \ - l_mac_ppc32.h fold_machppc32.h \ - l_vmlinz.h l_vmlinx.h -# experimental: -ifneq ($(strip $(wildcard $(srcdir)/l_ext2.asm)),) -STUBS += l_ext2.h +ifeq ($(wildcard .all-stamp),) +default: + @echo "UPX info: type 'make all' if you have all the required build tools." +else +default: all endif +all: tmp/.tmp-stamp .all-stamp +tmp/.tmp-stamp: + @mkdir -p tmp + @echo "timestamp" > $@ +.all-stamp: $(STUBS) + @echo "timestamp" > $@ + +ifeq ($(wildcard .all-stamp),) +mostlyclean clean: distclean +else +mostlyclean clean: maintainer-clean +endif +distclean: + rm -f .*-stamp + rm -rf tmp +maintainer-clean: + rm -f *.h + rm -rf tmp + +.PHONY: default all mostlyclean clean distclean maintainer-clean + # util var for use in the rules - basename of the current target -override T = $(basename $@) - -MAKEFILE_DEPS = $(MAKEFILE_LIST) +override T = $(basename $(notdir $@)) # /*********************************************************************** -# // source directories +# // setup toolchain globals # ************************************************************************/ -UCL_UPX = $(UPX_UCLDIR)/upx -UCL_I386 = $(UPX_UCLDIR)/upx/i386 -UCL_M68K = $(UPX_UCLDIR)/upx/m68k -UCL_MR3K = $(UPX_UCLDIR)/upx/mr3k +# default settings for $(tc_list) +tc.default.bin2h = python $(srcdir)/scripts/bin2h.py +tc.default.brandelf = perl -w $(srcdir)/scripts/brandelf.pl +tc.default.djasm = djasm +tc.default.gpp_inc = python $(srcdir)/scripts/gpp_inc.py +tc.default.o2bin = perl $(srcdir)/scripts/o2bin.pl +tc.default.nasm = nasm +tc.default.nasm += -I$(srcdir)/ -I$(srcdir)/src/ +tc.default.nasm += -O99 -w+macro-params -w+macro-selfref -w+number-overflow -w+orphan-labels +tc.default.pp-asm = i386-linux-gcc-2.95.3 -E -nostdinc -x assembler-with-cpp -Wall -Wp,-P,-C,-traditional +tc.default.pp-nasm = $(tc.default.gpp_inc) --mode=nasm -I$(srcdir)/ -I$(srcdir)/src/ +tc.default.stripelf = sstrip -.SUFFIXES: -.SUFFIXES: .asm .ash .asx .asy .bin .c .h .s +# some common settings for $(tc_list) +tc.i086.app-nasm = perl -w $(srcdir)/src/arch/i086/app-nasm.pl +tc.i386.app-nasm = perl -w $(srcdir)/src/arch/i386/app-nasm.pl -vpath %.ash $(UCL_I386) -vpath %.ash $(UCL_M68K) -vpath %.ash $(UCL_MR3K) + +# slightly tricky make stuff follows + +# error sentinel for missing commands +__tc_FALSE = false tc_FALSE: '$@' '$<' +# enumerate all variables that will get tested (from basename and $tc_list) +__tc_varlist = tc.$(basename $(notdir $@)).$1 $(foreach __tc_tmp,$(tc_list),tc.$(__tc_tmp).$1) +# return the _name_ of the first variable that is not empty +__tc_varname = $(firstword $(foreach __tc_vn,$2,$(if $($(__tc_vn)),$(__tc_vn),)) __tc_FALSE) +# expand the first variable that is not empty +tc = $($(call __tc_varname,$1,$(call __tc_varlist,$1))) + + +# clear some vars, just in case +CPPFLAGS = +CPLAGS = +PP_FLAGS = +IDENT_NAME = +IDENT_PREFIX = +IDENT_SUFFIX = # /*********************************************************************** -# // tools +# // amd64-linux.elf # ************************************************************************/ -NASM = nasm -O99 -w+macro-params -w+macro-selfref -w+number-overflow -w+orphan-labels -NASM += -I$(srcdir)/ +amd64-linux.elf% : tc_list = amd64-linux.elf default -APP_I386 = perl -w $(srcdir)/scripts/app_i386.pl -BIN2H = perl -w $(srcdir)/scripts/bin2h.pl -##BIN2H = python $(srcdir)/scripts/bin2h.py -BRANDELF = perl -w $(srcdir)/scripts/brandelf.pl -O2BIN = perl -w $(srcdir)/scripts/o2bin.pl -##STRIPELF = perl -w $(srcdir)/scripts/stripelf.pl +tc.amd64-linux.elf.gcc = x86_64-unknown-linux-gnu-gcc-3.4.4 -m64 -nostdinc -MMD +tc.amd64-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror +tc.amd64-linux.elf.ld = x86_64-unknown-linux-gnu-ld -m elf_x86_64 +tc.amd64-linux.elf.objcopy = x86_64-unknown-linux-gnu-objcopy +tc.amd64-linux.elf.objstrip = $(tc.amd64-linux.elf.objcopy) -R .comment -R .note +amd64-linux.elf-entry.h : $(srcdir)/src/$$T.S + $(call tc,gcc) -c $< -o tmp/$T.o + $(call tc,objstrip) tmp/$T.o + $(call tc,ld) --oformat binary tmp/$T.o -o tmp/$T.bin + $(call tc,bin2h) --ident=linux_elf64amd_loader tmp/$T.bin $@ -### -### i386-linux -### +amd64-linux.elf-fold.h : tmp/$$T.o tmp/amd64-linux.elf-main.o + $(call tc,ld) -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^) + $(call tc,stripelf) tmp/$T.bin + $(call tc,bin2h) --ident=linux_elf64amd_fold tmp/$T.bin $@ -LD_LINUX_I386 = i386-linux-ld-2.16.1 -m elf_i386 -OBJCOPY_LINUX_I386 = i386-linux-objcopy-2.16.1 -F elf32-i386 -OBJSTRIP_LINUX_I386 = $(OBJCOPY_LINUX_I386) -R .comment -R .note -STRIPELF_LINUX_I386 = ./util/sstrip/i386-linux-sstrip +tmp/amd64-linux.elf-fold.o : $(srcdir)/src/$$T.S + $(call tc,gcc) -c $< -o $@ + $(call tc,objstrip) $@ -# gcc 2.7.2.3 -CC_LINUX_I386_GCC272 = i386-linux-gcc-2.72 -m386 -O2 -MMD -CC_LINUX_I386_GCC272 += -malign-functions=0 -malign-jumps=0 -malign-loops=0 - -# gcc 2.95.3 -CC_LINUX_I386_GCC295 = i386-linux-gcc-2.95.3 -march=i386 -mcpu=k6 -fno-exceptions -MMD -CC_LINUX_I386_GCC295 += -Os -fno-omit-frame-pointer -CC_LINUX_I386_GCC295 += -malign-functions=0 -malign-jumps=0 -malign-loops=0 -CC_LINUX_I386_GCC295 += -Werror - -# gcc 3.4.6 (fold_*86.bin: 1622 / 899 / 1531 / 1201) -CC_LINUX_I386_GCC34 = i386-linux-gcc-3.4.6 -CC_LINUX_I386_GCC34 += -m32 -march=i386 -mtune=k6 -fno-exceptions -MMD -CC_LINUX_I386_GCC34 += -Os -fno-omit-frame-pointer -CC_LINUX_I386_GCC34 += -momit-leaf-frame-pointer -CC_LINUX_I386_GCC34 += -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops -CC_LINUX_I386_GCC34 += -mpreferred-stack-boundary=2 -CC_LINUX_I386_GCC34 += -fweb -CC_LINUX_I386_GCC34 += -Werror - -# gcc 4.1.1 (fold_*86.bin: 1651 / 931 / 1633 / 1215) -# gcc 4.0.3 (fold_*86.bin: 1699 / 963 / 1631 / 1208) -CC_LINUX_I386_GCC41 = i386-linux-gcc-4.1.1 -CC_LINUX_I386_GCC41 += -m32 -march=i386 -mtune=k6 -fno-exceptions -MMD -CC_LINUX_I386_GCC41 += -Os -fno-omit-frame-pointer -CC_LINUX_I386_GCC41 += -momit-leaf-frame-pointer -CC_LINUX_I386_GCC41 += -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops -CC_LINUX_I386_GCC41 += -mpreferred-stack-boundary=2 -CC_LINUX_I386_GCC41 += -fweb -CC_LINUX_I386_GCC41 += -Werror - -CC_LINUX_I386 = $(CC_LINUX_I386_GCC272) -CC_LINUX_I386 = $(CC_LINUX_I386_GCC295) -CC_LINUX_I386 = $(CC_LINUX_I386_GCC41) -CC_LINUX_I386 = $(CC_LINUX_I386_GCC34) -CC_LINUX_I386 += -nostdinc -CC_LINUX_I386 += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -CC_LINUX_I386 += -funsigned-char - - -### -### MIPS R3000 -### - -CPP_MR3K = i386-linux-gcc-2.95.3 -nostdinc -I$(UCL_UPX) -I$(srcdir) -E -x assembler-with-cpp -Wall -Wp,-P,-C,-traditional -APP_MR3K = perl -w $(srcdir)/scripts/app_mr3k.pl -ASM_MR3K = asm5900 --nologo -q - - -### -### Motorola 68000 -### - -CPP_M68K = $(CPP_MR3K) -APP_M68K = perl -w $(srcdir)/scripts/app_m68k.pl -ifeq (1,1) - # a68k 68000-assembler - CPP_M68K += -D__A68K__ - ASM_M68K = a68k -q -x -else - # asl 68000-assembler - CPP_M68K += -D__ASL__ - ASM_M68K = sh $(srcdir)/scripts/asl_m68k.sh -endif - - -### -### PowerPC 32 -### - -GCC_PPC32 := false -LD_PPC32 := false -OBJCOPY_PPC32 := false -OBJSTRIP_PPC32 = $(OBJCOPY_PPC32) -R .comment -R .note - -d = /home2/crosstool/powerpc-750-linux-gnu/gcc-3.4.1-glibc-20040827/bin -ifneq ($(wildcard $d),) - GCC_PPC32 := $d/powerpc-750-linux-gnu-gcc -m32 -nostdinc -MMD - LD_PPC32 := $d/powerpc-750-linux-gnu-ld - OBJCOPY_PPC32 := $d/powerpc-750-linux-gnu-objcopy -endif -d = /opt/cc-i386-linux/crosstool/powerpc-750-linux-gnu/gcc-3.4.3.20050210-glibc-2.2.5/bin -ifneq ($(wildcard $d),) - GCC_PPC32 := $d/powerpc-750-linux-gnu-gcc -m32 -nostdinc -MMD -fno-exceptions -fno-asynchronous-unwind-tables - LD_PPC32 := $d/powerpc-750-linux-gnu-ld - OBJCOPY_PPC32 := $d/powerpc-750-linux-gnu-objcopy -endif -GCC_PPC32 += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror - - -### -### AMD x86_64 -### - -GCC_AMD64 := false -LD_AMD64 := false -OBJCOPY_AMD64 := false -OBJSTRIP_AMD64 = $(OBJCOPY_AMD64) -R .comment -R .note - -d = /home2/crosstool/gcc-4.0.1-glibc-2.3.5/x86_64-unknown-linux-gnu/bin -ifneq ($(wildcard $d),) - GCC_AMD64 := $d/x86_64-unknown-linux-gnu-gcc -m64 -nostdinc -MMD - LD_AMD64 := $d/x86_64-unknown-linux-gnu-ld -m elf_x86_64 - OBJCOPY_AMD64 := $d/x86_64-unknown-linux-gnu-objcopy -F elf64-x86-64 -endif -d = /opt/cc-i386-linux/crosstool/x86_64-unknown-linux-gnu/gcc-3.4.3.20050507-glibc-2.3.5/bin -ifneq ($(wildcard $d),) - GCC_AMD64 := $d/x86_64-unknown-linux-gnu-gcc -m64 -nostdinc -MMD - LD_AMD64 := $d/x86_64-unknown-linux-gnu-ld -m elf_x86_64 - OBJCOPY_AMD64 := $d/x86_64-unknown-linux-gnu-objcopy -F elf64-x86-64 -endif -GCC_AMD64 += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror - - -### -### ARM-PE-WINCE -### - -GCC_ARM := arm-9tdmi-linux-gnu-gcc -march=armv4 -nostdinc -MMD -GCC_ARM += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror -GCC_ARM_T := $(GCC_ARM) -march=armv4t -LD_ARM := arm-9tdmi-linux-gnu-ld -OBJCOPY_LINUX_ARM := arm-9tdmi-linux-gnu-objcopy -OBJSTRIP_LINUX_ARM := $(OBJCOPY_LINUX_ARM) -R .comment -R .note +tmp/amd64-linux.elf-main.o : $(srcdir)/src/$$T.c + $(call tc,gcc) -c -Os -fno-exceptions -fno-asynchronous-unwind-tables $< -o $@ + $(call tc,objstrip) $@ # /*********************************************************************** -# // main targets +# // arm-linux.elf # ************************************************************************/ -.PHONY: default all stubs mostlyclean clean distclean maintainer-clean ident strings +arm-linux.elf% : tc_list = arm-linux.elf default -default: - @echo "UPX info: type 'make all' if you have all the required build tools." +tc.arm-linux.elf.gcc = arm-9tdmi-linux-gnu-gcc-3.4.5 -march=armv4 -nostdinc -MMD +tc.arm-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror +tc.arm-linux.elf.ld = arm-9tdmi-linux-gnu-ld +tc.arm-linux.elf.objcopy = arm-9tdmi-linux-gnu-objcopy +tc.arm-linux.elf.objstrip = $(tc.arm-linux.elf.objcopy) -R .comment -R .note -all: stubs ## upxb upxd - @echo "timestamp" > stamp-h +arm-linux.elf-entry.h : $(srcdir)/src/$$T.S + $(call tc,gcc) -nostdlib $< -o tmp/$T.out + $(call tc,objcopy) --only-section .text -O binary tmp/$T.out tmp/$T.bin + $(call tc,bin2h) --ident=linux_elf32arm_loader tmp/$T.bin $@ -stubs: $(STUBS) +arm-linux.elf-fold.h : tmp/$$T.o tmp/arm-linux.elf-main.o + $(call tc,ld) -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^) + $(call tc,stripelf) tmp/$T.bin + $(call tc,bin2h) --ident=linux_elf32arm_fold tmp/$T.bin $@ +tmp/arm-linux.elf-fold.o : $(srcdir)/src/$$T.S + $(call tc,gcc) -c $< -o $@ + $(call tc,objstrip) $@ -mostlyclean: - -rm -f *.bin *.bkp *.d *.i *.lst *.map stubify.exe - -rm -f *.ah *.asx *.asy *.o *.out - -clean: mostlyclean -ifneq ($(strip $(wildcard stamp-h)),) - -rm -f l_*.h $(STUBS) -endif - -distclean: mostlyclean - @-rm -f stamp-h - -maintainer-clean: mostlyclean - -rm -f l_*.h $(STUBS) - @-rm -f stamp-h - - -ident: all - ident *.bin - -strings: all - strings *.bin +tmp/arm-linux.elf-main.o : $(srcdir)/src/$$T.c + $(call tc,gcc) -c -Os -fno-exceptions -fno-asynchronous-unwind-tables $< -o $@ + $(call tc,objstrip) $@ # /*********************************************************************** -# // rules +# // arm.v4a-wince.pe +# // arm.v4t-wince.pe # ************************************************************************/ -%.asx : %.asm $(srcdir)/scripts/app_i386.pl - $(APP_I386) $< $@ +arm.v4a-wince.pe% : tc_list = arm.v4a-wince.pe arm-wince.pe default +arm.v4t-wince.pe% : tc_list = arm.v4t-wince.pe arm-wince.pe default -%.asy : %.ash $(srcdir)/scripts/app_i386.pl - $(APP_I386) $< $@ +tc.arm-wince.pe.gcc = arm-9tdmi-linux-gnu-gcc-3.4.5 -nostdinc -MMD +tc.arm-wince.pe.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror +tc.arm-wince.pe.objcopy = arm-9tdmi-linux-gnu-objcopy +arm.v4a-wince.pe.h : $(srcdir)/src/$$T.S + $(call tc,gcc) -march=armv4 -nostdlib $< -o tmp/$T.out + $(call tc,objcopy) --only-section .text -O binary tmp/$T.out tmp/$T.bin + $(call tc,bin2h) --ident=nrv_loader_arm tmp/$T.bin $@ -stubify.h: stub.asm - djasm --gmtime=1070220810 --iname=stub.asm --oname=stub.h $< stubify.exe - $(BIN2H) stubify.exe stubify_stub $@ -q - -l_com.h: l_com.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv2b_loader $@ - -l_djgpp2.h: l_djgpp2.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv_loader $@ - -l_exe.h: l_exe.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv_loader $@ - -l_sys.h: l_sys.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv2b_loader $@ - -l_tmt.h: l_tmt.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv_loader $@ - -l_ext2.h: l_ext2.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv_loader $@ - -l_vmlinz.h: l_vmlinz.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv_loader $@ - -l_vmlinx.h: l_vmlinx.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv_loader $@ - -l_vxd.h: l_vxd.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv_loader $@ - -l_wcle.h: l_wcle.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv_loader $@ - -l_w32pe.h: l_w32pe.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin nrv_loader $@ +arm.v4t-wince.pe.h : $(srcdir)/src/$$T.S + $(call tc,gcc) -march=armv4t -nostdlib $< -o tmp/$T.out + $(call tc,objcopy) --only-section .text -O binary tmp/$T.out tmp/$T.bin + $(call tc,bin2h) --ident=nrv_loader_thumb tmp/$T.bin $@ # /*********************************************************************** -# // atari/tos rules +# // i086-dos16.com # ************************************************************************/ -l_t_n2b.h: l_tos.s - $(CPP_M68K) -DNRV2B -o $T.i $< - $(ASM_M68K) $T.i - $(O2BIN) $T.o $T.bin 'UPX1' 'UPX9' - $(BIN2H) $T.bin nrv2b_loader $@ +i086-dos16.com% : tc_list = i086 default -l_t_n2bs.h: l_tos.s - $(CPP_M68K) -DNRV2B -DSMALL -o $T.i $< - $(ASM_M68K) $T.i - $(O2BIN) $T.o $T.bin 'UPX1' 'UPX9' - $(BIN2H) $T.bin nrv2b_loader_small $@ - -l_t_n2d.h: l_tos.s - $(CPP_M68K) -DNRV2D -o $T.i $< - $(ASM_M68K) $T.i - $(O2BIN) $T.o $T.bin 'UPX1' 'UPX9' - $(BIN2H) $T.bin nrv2d_loader $@ - -l_t_n2ds.h: l_tos.s - $(CPP_M68K) -DNRV2D -DSMALL -o $T.i $< - $(ASM_M68K) $T.i - $(O2BIN) $T.o $T.bin 'UPX1' 'UPX9' - $(BIN2H) $T.bin nrv2d_loader_small $@ - -l_t_n2e.h: l_tos.s - $(CPP_M68K) -DNRV2E -o $T.i $< - $(ASM_M68K) $T.i - $(O2BIN) $T.o $T.bin 'UPX1' 'UPX9' - $(BIN2H) $T.bin nrv2e_loader $@ - -l_t_n2es.h: l_tos.s - $(CPP_M68K) -DNRV2E -DSMALL -o $T.i $< - $(ASM_M68K) $T.i - $(O2BIN) $T.o $T.bin 'UPX1' 'UPX9' - $(BIN2H) $T.bin nrv2e_loader_small $@ +i086-dos16.com.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=nrv2b_loader tmp/$T.bin $@ # /*********************************************************************** -# // ps1/exe +# // i086-dos16.exe # ************************************************************************/ -l_ps1b.h: l_ps1.asm - $(CPP_MR3K) -DCDBOOT -o $T.asx $< - $(APP_MR3K) $T.asx $T.asy - $(ASM_MR3K) $T.asy -o$T.bin -l$T.lst - $(BIN2H) $T.bin nrv_boot_loader $@ +i086-dos16.exe% : tc_list = i086 default -l_ps1c.h: l_ps1.asm - $(CPP_MR3K) -o $T.asx $< - $(APP_MR3K) $T.asx $T.asy - $(ASM_MR3K) $T.asy -o$T.bin -l$T.lst - $(BIN2H) $T.bin nrv_con_loader $@ +i086-dos16.exe.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=nrv_loader tmp/$T.bin $@ # /*********************************************************************** -# // linux rules (exec, elf, sh, sep) +# // i086-dos16.sys # ************************************************************************/ -upx_itoa.o: upx_itoa.asm - $(NASM) -f elf -o $@ $< - $(OBJSTRIP_LINUX_I386) $@ +i086-dos16.sys% : tc_list = i086 default -l_lx_elf86.h: l_lx_elf86.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin linux_i386elf_loader $@ +i086-dos16.sys.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=nrv2b_loader tmp/$T.bin $@ -l_lx_exec86.h: l_lx_exec86.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin linux_i386exec_loader $@ -l_lx_sh86.h: l_lx_sh86.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin linux_i386sh_loader $@ +# /*********************************************************************** +# // i386-dos32.djgpp2 +# ************************************************************************/ -l_lx_pti86.h: l_lx_pti86.asx - $(NASM) -f bin -o $T.bin $< - $(BIN2H) $T.bin linux_i386pti_loader $@ +i386-dos32.djgpp2% : tc_list = i386 default -l_mac_ppc32.h: l_mac_ppc32.S ppc_d_nrv2e.S - $(GCC_PPC32) -c $< - $(OBJSTRIP_PPC32) $T.o - $(LD_PPC32) -o $T.bin --oformat binary $T.o - $(BIN2H) $T.bin l_mac_ppc32_loader $@ +i386-dos32.djgpp2.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=nrv_loader tmp/$T.bin $@ -l_lx_elfppc32.h: l_lx_elfppc32.S ppc_d_nrv2e.S - $(GCC_PPC32) -c $< - $(OBJSTRIP_PPC32) $T.o - $(LD_PPC32) -o $T.bin --oformat binary $T.o - $(BIN2H) $T.bin linux_elfppc32_loader $@ +i386-dos32.djgpp2-stubify.h : $(srcdir)/src/$$T.asm + $(call tc,djasm) --outtype=exe --gmtime=1070220810 --inname=stub.asm --outname=stub.h $< tmp/$T.bin + $(call tc,bin2h) --ident=stubify_stub -q tmp/$T.bin $@ -l_lx_elf64amd.h: l_lx_elf64amd.S amd_d_nrv2e.S - $(GCC_AMD64) -c $< - $(OBJSTRIP_AMD64) $T.o - $(LD_AMD64) -o $T.bin --oformat binary $T.o - $(BIN2H) $T.bin linux_elf64amd_loader $@ -l_lx_elf32arm.h: l_lx_elf32arm.S arm_nrv2e_d32.S - $(GCC_ARM) -c $< - $(OBJSTRIP_LINUX_ARM) $T.o - $(LD_ARM) -o $T.out $T.o - $(OBJCOPY_LINUX_ARM) --only-section .text -O binary $T.out $T.bin - $(BIN2H) $T.bin linux_elf32arm_loader $@ +# /*********************************************************************** +# // i386-dos32.tmt +# ************************************************************************/ -l_lx_elf.o: l_lx_elf.c linux.hh $(MAKEFILE_DEPS) - $(CC_LINUX_I386) -c $< - $(OBJSTRIP_LINUX_I386) $@ +i386-dos32.tmt% : tc_list = i386 default -l_lx_exec.o: l_lx_exec.c linux.hh $(MAKEFILE_DEPS) - $(CC_LINUX_I386) -c $< - $(OBJSTRIP_LINUX_I386) $@ +i386-dos32.tmt.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=nrv_loader tmp/$T.bin $@ -l_lx_sep.o: l_lx_sep.c linux.hh $(MAKEFILE_DEPS) - $(CC_LINUX_I386) -c $< - $(OBJSTRIP_LINUX_I386) $@ -l_lx_sh.o: l_lx_sh.c linux.hh $(MAKEFILE_DEPS) - $(CC_LINUX_I386) -c $< - $(OBJSTRIP_LINUX_I386) $@ +# /*********************************************************************** +# // i386-dos32.watcom.le +# ************************************************************************/ -l_lx_pti.o: l_lx_pti.c linux.hh $(MAKEFILE_DEPS) - $(CC_LINUX_I386) -c $< - $(OBJSTRIP_LINUX_I386) $@ +i386-dos32.watcom.le% : tc_list = i386 default -fold_elf86.o: fold_elf86.asm - $(NASM) -f elf -o $@ $< - $(OBJSTRIP_LINUX_I386) $@ +i386-dos32.watcom.le.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=nrv_loader tmp/$T.bin $@ -fold_elf86.h: l_lx_elf.o fold_elf86.o l_lx_elf86.lds - $(LD_LINUX_I386) -T $(srcdir)/l_lx_elf86.lds -Map $T.map -o $T.bin $T.o l_lx_elf.o - chmod a-x $T.bin - $(OBJSTRIP_LINUX_I386) $T.bin - $(STRIPELF_LINUX_I386) $T.bin - $(BRANDELF) $T.bin - $(BIN2H) $T.bin linux_i386elf_fold $@ -m_lx_elfppc32.o: m_lx_elfppc32.c $(MAKEFILE_DEPS) - $(GCC_PPC32) -c -Os $< - $(OBJSTRIP_PPC32) $@ +# /*********************************************************************** +# // i386-linux.elf +# ************************************************************************/ -a_lx_elf64amd.o: a_lx_elf64.c $(MAKEFILE_DEPS) - $(GCC_AMD64) -c -Os -fno-exceptions -fno-asynchronous-unwind-tables -o $@ $< - $(OBJSTRIP_AMD64) $@ +i386-linux.elf% : tc_list = i386-linux.elf i386 default -a_lx_elf32arm.o: l_lx_elf.c $(MAKEFILE_DEPS) - $(GCC_ARM) -c -Os -fno-exceptions -fno-asynchronous-unwind-tables -o $@ $< - $(OBJSTRIP_LINUX_ARM) $@ +tc.i386-linux.elf.gcc = i386-linux-gcc-3.4.6 -m32 -nostdinc -MMD +tc.i386-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror +tc.i386-linux.elf.gcc += -march=i386 -mtune=k6 +tc.i386-linux.elf.gcc += -Os -fno-omit-frame-pointer +tc.i386-linux.elf.gcc += -momit-leaf-frame-pointer +tc.i386-linux.elf.gcc += -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops +tc.i386-linux.elf.gcc += -mpreferred-stack-boundary=2 +tc.i386-linux.elf.gcc += -fweb +tc.i386-linux.elf.ld = i386-linux-ld-2.16.1 +tc.i386-linux.elf.objcopy = i386-linux-objcopy-2.16.1 +tc.i386-linux.elf.objstrip = $(tc.i386-linux.elf.objcopy) -R .comment -R .note -fold_elfppc32.o: fold_elfppc32.S ppc_bxx.S $(MAKEFILE_DEPS) - $(GCC_PPC32) -c $< - $(OBJSTRIP_PPC32) $@ +i386-linux.elf-entry.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=linux_i386elf_loader tmp/$T.bin $@ -fold_elf64amd.o: fold_elf64amd.S amd_bxx.S $(MAKEFILE_DEPS) - $(GCC_AMD64) -c $< - $(OBJSTRIP_AMD64) $@ +i386-linux.elf-fold.h : tmp/$$T.o tmp/i386-linux.elf-main.o + $(call tc,ld) -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^) + $(call tc,objstrip) tmp/$T.bin + $(call tc,stripelf) tmp/$T.bin + $(call tc,brandelf) tmp/$T.bin + $(call tc,bin2h) --ident=linux_i386elf_fold tmp/$T.bin $@ -fold_elf32arm.o: fold_elf32arm.S $(MAKEFILE_DEPS) - $(GCC_ARM) -c $< - $(OBJSTRIP_LINUX_ARM) $@ +tmp/i386-linux.elf-fold.o : $(srcdir)/src/$$T.asm + $(call tc,nasm) -f elf $< -o $@ + $(call tc,objstrip) $@ -fold_elfppc32.h: m_lx_elfppc32.o fold_elfppc32.o l_lx_elfppc32.lds - $(LD_PPC32) -T $(srcdir)/l_lx_elfppc32.lds -Map $T.map -o $T.bin --strip-all \ - fold_elfppc32.o m_lx_elfppc32.o - $(BIN2H) $T.bin linux_elfppc32_fold $@ +tmp/i386-linux.elf-main.o : $(srcdir)/src/$$T.c + $(call tc,gcc) -c $< -o $@ + $(call tc,objstrip) $@ -fold_elf64amd.h: a_lx_elf64amd.o fold_elf64amd.o l_lx_elf64amd.lds amd_bxx.S - $(LD_AMD64) -T $(srcdir)/l_lx_elf64amd.lds -Map $T.map -o $T.bin --strip-all \ - fold_elf64amd.o a_lx_elf64amd.o - $(STRIPELF_LINUX_I386) $T.bin - $(BIN2H) $T.bin linux_elf64amd_fold $@ -fold_elf32arm.h: a_lx_elf32arm.o fold_elf32arm.o l_lx_elf32arm.lds amd_bxx.S - $(LD_ARM) -T $(srcdir)/l_lx_elf32arm.lds -Map $T.map -o $T.bin --strip-all \ - fold_elf32arm.o a_lx_elf32arm.o - $(STRIPELF_LINUX_I386) $T.bin - $(BIN2H) $T.bin linux_elf32arm_fold $@ +# /*********************************************************************** +# // i386-linux.elf.execve +# ************************************************************************/ -fold_exec86.o: fold_exec86.asm - $(NASM) -f elf -o $@ $< - $(OBJSTRIP_LINUX_I386) $@ +# tc settings are shared with i386-linux.elf -fold_exec86.h: l_lx_exec.o upx_itoa.o fold_exec86.o l_lx_exec86.lds - $(LD_LINUX_I386) -T $(srcdir)/l_lx_exec86.lds -Map $T.map -o $T.bin $T.o l_lx_exec.o upx_itoa.o - chmod a-x $T.bin - $(OBJSTRIP_LINUX_I386) $T.bin - $(STRIPELF_LINUX_I386) $T.bin - $(BRANDELF) $T.bin - $(BIN2H) $T.bin linux_i386exec_fold $@ +i386-linux.elf.execve-entry.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=linux_i386exec_loader tmp/$T.bin $@ -fold_sh86.o: fold_sh86.asm - $(NASM) -f elf -o $@ $< - $(OBJSTRIP_LINUX_I386) $@ +i386-linux.elf.execve-fold.h : tmp/$$T.o tmp/i386-linux.elf.execve-main.o tmp/i386-linux.elf.execve-upx_itoa.o + $(call tc,ld) -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^) + $(call tc,objstrip) tmp/$T.bin + $(call tc,stripelf) tmp/$T.bin + $(call tc,brandelf) tmp/$T.bin + $(call tc,bin2h) --ident=linux_i386exec_fold tmp/$T.bin $@ -fold_sh86.h: l_lx_sh.o fold_sh86.o l_lx_sh86.lds - $(LD_LINUX_I386) -T $(srcdir)/l_lx_sh86.lds -Map $T.map -o $T.bin $T.o l_lx_sh.o - chmod a-x $T.bin - $(OBJSTRIP_LINUX_I386) $T.bin - $(STRIPELF_LINUX_I386) $T.bin - $(BRANDELF) $T.bin - $(BIN2H) $T.bin linux_i386sh_fold $@ +tmp/i386-linux.elf.execve-fold.o : $(srcdir)/src/$$T.asm + $(call tc,nasm) -f elf $< -o $@ + $(call tc,objstrip) $@ -fold_pti86.o: fold_pti86.asm - $(NASM) -f elf -i$(UCL_I386)/ -o $@ $< - $(OBJSTRIP_LINUX_I386) $@ +tmp/i386-linux.elf.execve-main.o : $(srcdir)/src/$$T.c + $(call tc,gcc) -c $< -o $@ + $(call tc,objstrip) $@ -fold_pti86.h: l_lx_pti.o fold_pti86.o l_lx_pti86.lds - $(LD_LINUX_I386) -T $(srcdir)/l_lx_pti86.lds -Map $T.map -o $T.bin $T.o l_lx_pti.o - chmod a-x $T.bin - $(OBJSTRIP_LINUX_I386) $T.bin - $(STRIPELF_LINUX_I386) $T.bin - $(BRANDELF) $T.bin - $(BIN2H) $T.bin linux_i386pti_fold $@ +tmp/i386-linux.elf.execve-upx_itoa.o: $(srcdir)/src/$$T.asm + $(call tc,nasm) -f elf $< -o $@ + $(call tc,objstrip) $@ -fold_machppc32.h: m_mac_mach32.o fold_machppc32.o - $(LD_PPC32) -Map $T.map -o $T.bin --oformat binary fold_machppc32.o m_mac_mach32.o - chmod a-x $T.bin - $(BIN2H) $T.bin fold_machppc32 $@ -m_mac_mach32.o: m_mac_mach32.c $(MAKEFILE_DEPS) - $(GCC_PPC32) -Os -c $< - $(OBJSTRIP_PPC32) $@ +# /*********************************************************************** +# // i386-linux.elf.interp +# ************************************************************************/ -fold_machppc32.o: fold_machppc32.S ppc_bxx.S $(MAKEFILE_DEPS) - $(GCC_PPC32) -c $< - $(OBJSTRIP_PPC32) $@ +# tc settings are shared with i386-linux.elf -upxb: l_lx_sep.o l_lx_sep86.asm - $(NASM) -f elf -i$(UCL_I386)/ -dNRV2B -o $T.o l_lx_sep86.asm - $(OBJSTRIP_LINUX_I386) $T.o - $(LD_LINUX_I386) -T $(srcdir)/l_lx_sep86.lds -Map $T.map -o $@ $T.o l_lx_sep.o - $(OBJSTRIP_LINUX_I386) $@ - $(STRIPELF_LINUX_I386) $@ - $(BRANDELF) $@ +i386-linux.elf.interp-entry.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=linux_i386pti_loader tmp/$T.bin $@ -upxd: l_lx_sep.o l_lx_sep86.asm - $(NASM) -f elf -i$(UCL_I386)/ -dNRV2D -o $T.o l_lx_sep86.asm - $(OBJSTRIP_LINUX_I386) $T.o - $(LD_LINUX_I386) -T $(srcdir)/l_lx_sep86.lds -Map $T.map -o $@ $T.o l_lx_sep.o - $(OBJSTRIP_LINUX_I386) $@ - $(STRIPELF_LINUX_I386) $@ - $(BRANDELF) $@ +i386-linux.elf.interp-fold.h : tmp/$$T.o tmp/i386-linux.elf.interp-main.o + $(call tc,ld) -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^) + $(call tc,objstrip) tmp/$T.bin + $(call tc,stripelf) tmp/$T.bin + $(call tc,brandelf) tmp/$T.bin + $(call tc,bin2h) --ident=linux_i386pti_fold tmp/$T.bin $@ -l_armpea.h: l_armpea.S armv4_n2e_d8.S $(MAKEFILE_DEPS) - $(GCC_ARM) $T.S -o $T.out -nostdlib - $(OBJCOPY_LINUX_ARM) --only-section .text -O binary $T.out $T.bin - $(BIN2H) $T.bin nrv_loader_arm $@ +tmp/i386-linux.elf.interp-fold.o : $(srcdir)/src/$$T.asm + $(call tc,nasm) -f elf $< -o $@ + $(call tc,objstrip) $@ -l_armpet.h: l_armpet.S arm_nrv2e_d8.S arm_nrv2b_d8.S $(MAKEFILE_DEPS) - $(GCC_ARM_T) $T.S -o $T.out -nostdlib - $(OBJCOPY_LINUX_ARM) --only-section .text -O binary $T.out $T.bin - $(BIN2H) $T.bin nrv_loader_thumb $@ +tmp/i386-linux.elf.interp-main.o : $(srcdir)/src/$$T.c + $(call tc,gcc) -c $< -o $@ + $(call tc,objstrip) $@ + + +# /*********************************************************************** +# // i386-linux.elf.shell +# ************************************************************************/ + +# tc settings are shared with i386-linux.elf + +i386-linux.elf.shell-entry.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=linux_i386sh_loader tmp/$T.bin $@ + +i386-linux.elf.shell-fold.h : tmp/$$T.o tmp/i386-linux.elf.shell-main.o + $(call tc,ld) -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^) + $(call tc,objstrip) tmp/$T.bin + $(call tc,stripelf) tmp/$T.bin + $(call tc,brandelf) tmp/$T.bin + $(call tc,bin2h) --ident=linux_i386sh_fold tmp/$T.bin $@ + +tmp/i386-linux.elf.shell-fold.o : $(srcdir)/src/$$T.asm + $(call tc,nasm) -f elf $< -o $@ + $(call tc,objstrip) $@ + +tmp/i386-linux.elf.shell-main.o : $(srcdir)/src/$$T.c + $(call tc,gcc) -c $< -o $@ + $(call tc,objstrip) $@ + + +# /*********************************************************************** +# // i386-linux.kernel.vmlinux +# // i386-linux.kernel.vmlinuz +# ************************************************************************/ + +i386-linux.kernel.vmlin% : tc_list = i386 default + +i386-linux.kernel%.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=nrv_loader tmp/$T.bin $@ + + +# /*********************************************************************** +# // i386-win32.pe +# ************************************************************************/ + +i386-win32.pe% : tc_list = i386 default + +i386-win32.pe.h : $(srcdir)/src/$$T.asm + $(call tc,pp-nasm) --MMD=$@ $< -o tmp/$T.tmp1 + $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,nasm) -f bin tmp/$T.tmp2 -o tmp/$T.bin + $(call tc,bin2h) --ident=nrv_loader tmp/$T.bin $@ + + +# /*********************************************************************** +# // m68k-atari.tos +# ************************************************************************/ + +m68k-atari.tos-%.h : tc_list = m68k-atari.tos default + +tc.m68k-atari.tos.app-a68k = perl -w $(srcdir)/src/arch/m68k/app-a68k.pl +tc.m68k-atari.tos.asm-a68k = a68k + +m68k-atari.tos-nrv%.h : $(srcdir)/src/m68k-atari.tos.asm + # call gpp_inc to generate .d file + $(call tc,gpp_inc) --MMD=$@ --MF=tmp/$T.i.d $< -o /dev/null + $(call tc,pp-asm) -D__A68K__ $(PP_FLAGS) $< -o tmp/$T.i + $(call tc,asm-a68k) -q -ltmp/$T.o.lst tmp/$T.i -otmp/$T.o + $(call tc,o2bin) tmp/$T.o tmp/$T.bin 'UPX1' 'UPX9' + $(call tc,bin2h) --ident=$(IDENT_PREFIX)loader$(IDENT_SUFFIX) tmp/$T.bin $@ + +m68k-atari.tos-nrv2b% : PP_FLAGS = -DNRV2B +m68k-atari.tos-nrv2d% : PP_FLAGS = -DNRV2D +m68k-atari.tos-nrv2e% : PP_FLAGS = -DNRV2E +m68k-atari.tos-nrv2%.small.h : PP_FLAGS += -DSMALL +m68k-atari.tos-nrv2b% : IDENT_PREFIX = nrv2b_ +m68k-atari.tos-nrv2d% : IDENT_PREFIX = nrv2d_ +m68k-atari.tos-nrv2e% : IDENT_PREFIX = nrv2e_ +m68k-atari.tos-nrv2%.small.h : IDENT_SUFFIX = _small + + +# /*********************************************************************** +# // mipsel.r3000-ps1-boot +# // mipsel.r3000-ps1-console +# ************************************************************************/ + +mipsel.r3000-ps1-%.h : tc_list = mipsel.r3000-ps1 default + +tc.mipsel.r3000-ps1.app-asm5900 = perl -w $(srcdir)/src/arch/mips/mipsel.r3000/app-asm5900.pl +tc.mipsel.r3000-ps1.asm5900 = asm5900 + +mipsel.r3000-ps1-%.h : $(srcdir)/src/mipsel.r3000-ps1.asm + # call gpp_inc to generate .d file + $(call tc,gpp_inc) --MMD=$@ --MF=tmp/$T.tmp1.d $< -o /dev/null + $(call tc,pp-asm) $(PP_FLAGS) $< -o tmp/$T.tmp1 + $(call tc,app-asm5900) tmp/$T.tmp1 tmp/$T.tmp2 + $(call tc,asm5900) --nologo -q -ltmp/$T.bin.lst tmp/$T.tmp2 -otmp/$T.bin + $(call tc,bin2h) --ident=$(IDENT_NAME) tmp/$T.bin $@ + +mipsel.r3000-ps1-boot.h: PP_FLAGS += -DCDBOOT +mipsel.r3000-ps1-boot.h: IDENT_NAME = nrv_boot_loader +mipsel.r3000-ps1-console.h: IDENT_NAME = nrv_con_loader + + +# /*********************************************************************** +# // powerpc-linux.elf +# ************************************************************************/ + +powerpc-linux.elf% : tc_list = powerpc-linux.elf default + +tc.powerpc-linux.elf.gcc = powerpc-750-linux-gnu-gcc-3.4.4 -nostdinc -MMD +tc.powerpc-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror +tc.powerpc-linux.elf.ld = powerpc-750-linux-gnu-ld +tc.powerpc-linux.elf.objcopy = powerpc-750-linux-gnu-objcopy +tc.powerpc-linux.elf.objstrip = $(tc.powerpc-linux.elf.objcopy) -R .comment -R .note + +powerpc-linux.elf-entry.h : $(srcdir)/src/$$T.S + $(call tc,gcc) -c $< -o tmp/$T.o + $(call tc,objstrip) tmp/$T.o + $(call tc,ld) --oformat binary tmp/$T.o -o tmp/$T.bin + $(call tc,bin2h) --ident=linux_elfppc32_loader tmp/$T.bin $@ + +powerpc-linux.elf-fold.h : tmp/$$T.o tmp/powerpc-linux.elf-main.o + $(call tc,ld) -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^) +## $(call tc,stripelf) tmp/$T.bin ## FIXME / TODO + $(call tc,bin2h) --ident=linux_elfppc32_fold tmp/$T.bin $@ + +tmp/powerpc-linux.elf-fold.o : $(srcdir)/src/$$T.S + $(call tc,gcc) -c $< -o $@ + $(call tc,objstrip) $@ + +tmp/powerpc-linux.elf-main.o : $(srcdir)/src/$$T.c + $(call tc,gcc) -c -Os -fno-exceptions -fno-asynchronous-unwind-tables $< -o $@ + $(call tc,objstrip) $@ + + +# /*********************************************************************** +# // powerpc-darwin.macho +# ************************************************************************/ + +powerpc-darwin.macho% : tc_list = powerpc-linux.elf default + +powerpc-darwin.macho-entry.h : $(srcdir)/src/$$T.S + $(call tc,gcc) -c $< -o tmp/$T.o + $(call tc,objstrip) tmp/$T.o + $(call tc,ld) --oformat binary tmp/$T.o -o tmp/$T.bin + $(call tc,bin2h) --ident=l_mac_ppc32_loader tmp/$T.bin $@ + +powerpc-darwin.macho-fold.h : tmp/$$T.o tmp/powerpc-darwin.macho-main.o + $(call tc,ld) --oformat binary -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^) +## $(call tc,stripelf) tmp/$T.bin ## FIXME / TODO + $(call tc,bin2h) --ident=fold_machppc32 tmp/$T.bin $@ + +tmp/powerpc-darwin.macho-fold.o : $(srcdir)/src/$$T.S + $(call tc,gcc) -c $< -o $@ + $(call tc,objstrip) $@ + +tmp/powerpc-darwin.macho-main.o : $(srcdir)/src/$$T.c + $(call tc,gcc) -c -Os -fno-exceptions -fno-asynchronous-unwind-tables $< -o $@ + $(call tc,objstrip) $@ # /*********************************************************************** # // dependencies # ************************************************************************/ --include *.d - -DEPS1 = header.ash macros.ash ident.ash ident_n.ash ident_s.ash -DEPS2 = header.asy macros.asy -DEPS3 = n2b_d32.asy n2d_d32.asy n2e_d32.asy cl1_d32.asy - -$(STUBS): $(srcdir)/scripts/bin2h.pl - -l_armpe.h: $(DEPS2) $(DEPS3) -l_com.h: n2b_d16.asy $(DEPS2) -l_djgpp2.h: $(DEPS2) $(DEPS3) -l_exe.h: n2b_d8e.asy n2d_d8e.asy n2e_d8e.asy $(DEPS2) -l_sys.h: n2b_d16.asy $(DEPS2) -l_t_n2b.h: n2b_d.ash bits.ash $(DEPS1) ../version.h -l_t_n2bs.h: n2b_d.ash bits.ash $(DEPS1) ../version.h -l_t_n2d.h: n2d_d.ash bits.ash $(DEPS1) ../version.h -l_t_n2ds.h: n2d_d.ash bits.ash $(DEPS1) ../version.h -l_t_n2e.h: n2e_d.ash bits.ash $(DEPS1) ../version.h -l_t_n2es.h: n2e_d.ash bits.ash $(DEPS1) ../version.h -l_tmt.h: $(DEPS2) $(DEPS3) -l_vmlinz.h: $(DEPS2) $(DEPS3) -l_vmlinx.h: $(DEPS2) $(DEPS3) -l_vxd.h: $(DEPS2) $(DEPS3) -l_wcle.h: $(DEPS2) $(DEPS3) -l_w32pe.h: $(DEPS2) $(DEPS3) - -l_lx_elf86.h: l_lx_elf86.asm macros.ash macros.asy $(DEPS3) -l_lx_exec86.h: l_lx_exec86.asm macros.ash macros.asy $(DEPS3) -l_lx_pti86.h: l_lx_pti86.asm macros.ash macros.asy $(DEPS3) -l_lx_sh86.h: l_lx_sh86.asm macros.ash macros.asy $(DEPS3) +# FIXME: we want a dependency-only-prerequisite here +##$(STUBS): | tmp/.tmp-stamp +##$(STUBS): $(MAKEFILE_LIST) +-include tmp/*.d -# FIXME: what is this ??? -upxrun: start-interp.o interp.o - gcc -nostartfiles -nostdlib -o $@ -Ttext=0x10000 $^ -start-interp.o: start-interp.S - gcc -c $< -interp.o: interp.c - gcc -c -g $< +# /*********************************************************************** +# // debug +# ************************************************************************/ + +define debug-diff + -diff $(HOME)/p/compress/upx/680c27309177-upx.hg/src/stub/$2 $1 +endef + +debug-diff: $(STUBS) + $(call debug-diff,amd64-linux.elf-entry.h,l_lx_elf64amd.h) + $(call debug-diff,amd64-linux.elf-fold.h,fold_elf64amd.h) + $(call debug-diff,arm-linux.elf-entry.h,l_lx_elf32arm.h) + $(call debug-diff,arm-linux.elf-fold.h,fold_elf32arm.h) + $(call debug-diff,arm.v4a-wince.pe.h,l_armpea.h) + $(call debug-diff,arm.v4t-wince.pe.h,l_armpet.h) + $(call debug-diff,i086-dos16.com.h,l_com.h) + $(call debug-diff,i086-dos16.exe.h,l_exe.h) + $(call debug-diff,i086-dos16.sys.h,l_sys.h) + $(call debug-diff,i386-dos32.djgpp2.h,l_djgpp2.h) + $(call debug-diff,i386-dos32.djgpp2-stubify.h,stubify.h) + $(call debug-diff,i386-dos32.tmt.h,l_tmt.h) + $(call debug-diff,i386-dos32.watcom.le.h,l_wcle.h) + $(call debug-diff,i386-linux.elf-entry.h,l_lx_elf86.h) + $(call debug-diff,i386-linux.elf-fold.h,fold_elf86.h) + $(call debug-diff,i386-linux.elf.execve-entry.h,l_lx_exec86.h) + $(call debug-diff,i386-linux.elf.execve-fold.h,fold_exec86.h) + $(call debug-diff,i386-linux.elf.interp-entry.h,l_lx_pti86.h) + $(call debug-diff,i386-linux.elf.interp-fold.h,fold_pti86.h) + $(call debug-diff,i386-linux.elf.shell-entry.h,l_lx_sh86.h) + $(call debug-diff,i386-linux.elf.shell-fold.h,fold_sh86.h) + $(call debug-diff,i386-linux.kernel.vmlinux.h,l_vmlinx.h) + $(call debug-diff,i386-linux.kernel.vmlinuz.h,l_vmlinz.h) + $(call debug-diff,i386-win32.pe.h,l_w32pe.h) + $(call debug-diff,m68k-atari.tos-nrv2b.h,l_t_n2b.h) + $(call debug-diff,m68k-atari.tos-nrv2b.small.h,l_t_n2bs.h) + $(call debug-diff,m68k-atari.tos-nrv2d.h,l_t_n2d.h) + $(call debug-diff,m68k-atari.tos-nrv2d.small.h,l_t_n2ds.h) + $(call debug-diff,m68k-atari.tos-nrv2e.h,l_t_n2e.h) + $(call debug-diff,m68k-atari.tos-nrv2e.small.h,l_t_n2es.h) + $(call debug-diff,mipsel.r3000-ps1-boot.h,l_ps1b.h) + $(call debug-diff,mipsel.r3000-ps1-console.h,l_ps1c.h) + $(call debug-diff,powerpc-darwin.macho-entry.h,l_mac_ppc32.h) + $(call debug-diff,powerpc-darwin.macho-fold.h,fold_machppc32.h) + $(call debug-diff,powerpc-linux.elf-entry.h,l_lx_elfppc32.h) + $(call debug-diff,powerpc-linux.elf-fold.h,fold_elfppc32.h) + # vi:nowrap diff --git a/src/stub/amd64-linux.elf-entry.h b/src/stub/amd64-linux.elf-entry.h new file mode 100644 index 00000000..921c66f6 --- /dev/null +++ b/src/stub/amd64-linux.elf-entry.h @@ -0,0 +1,79 @@ +/* amd64-linux.elf-entry.h -- created from amd64-linux.elf-entry.bin, 701 (0x2bd) 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 + + */ + + +#define LINUX_ELF64AMD_LOADER_SIZE 701 +#define LINUX_ELF64AMD_LOADER_ADLER32 0xf7af3eba +#define LINUX_ELF64AMD_LOADER_CRC32 0x8ec9e668 + +unsigned char linux_elf64amd_loader[701] = { +232,178, 2, 0, 0, 85, 83, 81, 82, 72, 1,254, 86, 72,137,254, /* 0x 0 */ + 72,137,215, 49,219, 49,201, 72,131,205,255,232,129, 1, 0, 0, /* 0x 10 */ + 1,219,116, 2,243,195,139, 30, 72,131,238,252, 17,219,138, 22, /* 0x 20 */ +243,195, 72,141, 4, 47,131,249, 5,138, 16,118, 33, 72,131,253, /* 0x 30 */ +252,119, 27,131,233, 4,139, 16, 72,131,192, 4,131,233, 4,137, /* 0x 40 */ + 23, 72,141,127, 4,115,239,131,193, 4,138, 16,116, 16, 72,255, /* 0x 50 */ +192,136, 23,131,233, 1,138, 16, 72,141,127, 1,117,240,243,195, /* 0x 60 */ + 72,255,198,136, 23, 72,255,199,138, 22, 1,219,117, 10,139, 30, /* 0x 70 */ + 72,131,238,252, 17,219,138, 22,114,230,141, 65, 1,235, 7,255, /* 0x 80 */ +200, 65,255,211, 17,192, 65,255,211, 17,192, 1,219,117, 10,139, /* 0x 90 */ + 30, 72,131,238,252, 17,219,138, 22,115,228,131,232, 3,114, 29, /* 0x a0 */ +193,224, 8, 15,182,210, 9,208, 72,255,198,131,240,255, 15,132, /* 0x b0 */ +244, 0, 0, 0,209,248, 72, 99,232,114, 56,235, 14, 1,219,117, /* 0x c0 */ + 8,139, 30, 72,131,238,252, 17,219,114, 40,255,193, 1,219,117, /* 0x d0 */ + 8,139, 30, 72,131,238,252, 17,219,114, 24, 65,255,211, 17,201, /* 0x e0 */ + 1,219,117, 8,139, 30, 72,131,238,252, 17,219,115,237,131,193, /* 0x f0 */ + 2,235, 5, 65,255,211, 17,201, 72,129,253, 0,251,255,255,131, /* 0x 100 */ +209, 2,232, 27,255,255,255,233, 92,255,255,255,102,102,102,144, /* 0x 110 */ + 72,255,198,136, 23, 72,255,199,138, 22, 1,219,117, 10,139, 30, /* 0x 120 */ + 72,131,238,252, 17,219,138, 22,114,230,141, 65, 1, 65,255,211, /* 0x 130 */ + 17,192, 1,219,117, 10,139, 30, 72,131,238,252, 17,219,138, 22, /* 0x 140 */ +115,235,131,232, 3,114, 19,193,224, 8, 15,182,210, 9,208, 72, /* 0x 150 */ +255,198,131,240,255,116, 81, 72, 99,232,141, 65, 1, 65,255,211, /* 0x 160 */ + 17,201, 65,255,211, 17,201,117, 24,137,193,131,192, 2, 65,255, /* 0x 170 */ +211, 17,201, 1,219,117, 8,139, 30, 72,131,238,252, 17,219,115, /* 0x 180 */ +237, 72,129,253, 0,243,255,255, 17,193,232,147,254,255,255,235, /* 0x 190 */ +135,252, 65, 91, 65,131,248, 8, 15,132,202,254,255,255, 65,131, /* 0x 1a0 */ +248, 2, 15,132,112,255,255,255, 89, 72,137,240, 72, 41,200, 90, /* 0x 1b0 */ + 72, 41,215, 89,137, 57, 91, 93,195, 10, 36, 73,100, 58, 32, 85, /* 0x 1c0 */ + 80, 88, 32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 50, 48, 48, 54, /* 0x 1d0 */ + 32,116,104,101, 32, 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65, /* 0x 1e0 */ +108,108, 32, 82,105,103,104,116,115, 32, 82,101,115,101,114,118, /* 0x 1f0 */ +101,100, 46, 32,104,116,116,112, 58, 47, 47,117,112,120, 46,115, /* 0x 200 */ +102, 46,110,101,116, 32, 36, 10, 0,104, 30, 0, 0, 0, 90,232, /* 0x 210 */ + 30, 0, 0, 0, 80, 82, 79, 84, 95, 69, 88, 69, 67,124, 80, 82, /* 0x 220 */ + 79, 84, 95, 87, 82, 73, 84, 69, 32,102, 97,105,108,101,100, 46, /* 0x 230 */ + 10, 0, 94,106, 2, 95,106, 1, 88, 15, 5,106,127, 95,106, 60, /* 0x 240 */ + 88, 15, 5, 91,191, 65, 68, 82, 77,106, 7, 90,190, 76, 69, 78, /* 0x 250 */ + 77,106, 50, 65, 90, 69, 41,192,106, 9, 88, 15, 5, 57,199,117, /* 0x 260 */ +168,104, 74, 77, 80, 85,104, 65, 68, 82, 85,190, 65, 68, 82, 67, /* 0x 270 */ +104, 76, 69, 78, 85,185, 67, 78, 84, 67,104, 65, 68, 82, 88,104, /* 0x 280 */ + 76, 69, 78, 88,137,250, 41,242, 1,213, 1,211,252,243, 72,165, /* 0x 290 */ +151,137,222, 80,146,173, 80, 72,137,225,173,151,173, 68, 15,182, /* 0x 2a0 */ +192,135,254,255,213, 89,195, 93,232,150,255,255,255 /* 0x 2b0 */ +}; diff --git a/src/stub/amd64-linux.elf-fold.h b/src/stub/amd64-linux.elf-fold.h new file mode 100644 index 00000000..cc46145f --- /dev/null +++ b/src/stub/amd64-linux.elf-fold.h @@ -0,0 +1,141 @@ +/* amd64-linux.elf-fold.h -- created from amd64-linux.elf-fold.bin, 1696 (0x6a0) 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 + + */ + + +#define LINUX_ELF64AMD_FOLD_SIZE 1696 +#define LINUX_ELF64AMD_FOLD_ADLER32 0x8e868b92 +#define LINUX_ELF64AMD_FOLD_CRC32 0xfc2cafa4 + +unsigned char linux_elf64amd_fold[1696] = { +127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */ + 2, 0, 62, 0, 1, 0, 0, 0,188, 0, 16, 0, 0, 0, 0, 0, /* 0x 10 */ + 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 20 */ + 0, 0, 0, 0, 64, 0, 56, 0, 2, 0, 0, 0, 0, 0, 0, 0, /* 0x 30 */ + 1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 40 */ + 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, /* 0x 50 */ +160, 6, 0, 0, 0, 0, 0, 0,160, 6, 0, 0, 0, 0, 0, 0, /* 0x 60 */ + 0, 0, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, /* 0x 70 */ +160, 6, 0, 0, 0, 0, 0, 0,160, 6, 16, 0, 0, 0, 0, 0, /* 0x 80 */ +160, 6, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 90 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, /* 0x a0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,232, 80, 0, 0, /* 0x b0 */ + 0,131,249, 73,117, 74, 72,137,241, 72,137,254,235, 44,138, 7, /* 0x c0 */ + 72,131,199, 1, 60,128,114, 10, 60,143,119, 6,128,127,254, 15, /* 0x d0 */ +116, 6, 44,232, 60, 1,119, 35, 56, 23,117, 31,139, 7, 37, 0, /* 0x e0 */ +255,255,255, 15,200, 41,248, 1,240,171, 72,131,233, 4,138, 7, /* 0x f0 */ + 72,131,199, 1, 72,255,201,117,217,235, 5, 72,255,201,117,190, /* 0x 100 */ +195, 72,141,116, 36, 56, 72,173, 72,133,192,117,249, 72,173, 72, /* 0x 110 */ +133,192,117,249, 65, 89, 72,137,241, 94, 95, 72,129,236, 0, 8, /* 0x 120 */ + 0, 0, 72,137,226, 73,137,232,232, 65, 4, 0, 0, 72,129,196, /* 0x 130 */ + 0, 8, 0, 0, 94, 95, 89, 80,106, 11, 88,255,225,176, 11,235, /* 0x 140 */ + 13,176, 10,235, 9,176, 12,235, 5,176, 9, 73,137,202, 15,182, /* 0x 150 */ +192, 15, 5, 72, 61, 0,240,255,255,114, 4, 72,131,200,255,195, /* 0x 160 */ +176, 0,235,234,176, 2,235,230,176, 3,235,226,176, 60,235,222, /* 0x 170 */ + 81, 72, 57, 23, 76,139, 71, 8, 72,141, 74,255,115, 10,191,127, /* 0x 180 */ + 0, 0, 0,232,228,255,255,255, 72,131,249,255,116, 17, 65, 15, /* 0x 190 */ +182, 0, 72,255,201, 73,255,192,136, 6, 72,255,198,235,233, 72, /* 0x 1a0 */ + 1, 87, 8, 72, 41, 23, 88,195, 65, 85, 73,137,213, 65, 84, 73, /* 0x 1b0 */ +137,204, 85, 72,137,253, 83, 72,137,243, 72,131,236, 40, 72,131, /* 0x 1c0 */ + 62, 0, 15,132,223, 0, 0, 0, 72,141,116, 36, 16,186, 12, 0, /* 0x 1d0 */ + 0, 0, 72,137,239,232,150,255,255,255,139, 84, 36, 16,139,116, /* 0x 1e0 */ + 36, 20,133,210,117, 21,129,254, 85, 80, 88, 33,117, 17, 72,131, /* 0x 1f0 */ +125, 0, 0, 15,132,174, 0, 0, 0,235, 4,133,246,117, 10,191, /* 0x 200 */ +127, 0, 0, 0,232, 99,255,255,255, 57,214,119,242,137,208, 72, /* 0x 210 */ + 59, 3,119,235, 57,214, 72,139, 67, 8,115,101, 68, 15,182, 68, /* 0x 220 */ + 36, 24, 72,139,125, 8, 72,141, 76, 36, 12, 72,137,194, 65,255, /* 0x 230 */ +213,133,192,117,202,139,116, 36, 12, 59,116, 36, 16,117,192, 15, /* 0x 240 */ +182, 76, 36, 25,132,201, 15,149,194, 49,192, 77,133,228, 15,149, /* 0x 250 */ +192,133,194,116, 30,129,254, 0, 2, 0, 0,119, 7,137,240, 72, /* 0x 260 */ + 57, 3,117, 15, 15,182, 84, 36, 26, 15,182,201, 72,139,123, 8, /* 0x 270 */ + 65,255,212,139, 68, 36, 20, 72, 1, 69, 8, 72, 41, 69, 0,235, /* 0x 280 */ + 13,137,242, 72,137,239, 72,137,198,232,226,254,255,255,139, 84, /* 0x 290 */ + 36, 16, 72,139, 3, 72, 1, 83, 8, 72, 41,208, 72,133,192, 72, /* 0x 2a0 */ +137, 3,233, 27,255,255,255, 72,131,196, 40, 91, 93, 65, 92, 65, /* 0x 2b0 */ + 93,195, 72,133,255, 73,137,208,116, 41, 72,139, 7,137,241, 72, /* 0x 2c0 */ + 57,200,116, 17, 72,255,200, 15,148,194, 49,192,133,246, 15,149, /* 0x 2d0 */ +192,133,194,116, 8, 72,137, 15, 76,137, 71, 8,195, 72,131,199, /* 0x 2e0 */ + 16,235,215,195, 65, 87,184, 0, 0, 0, 0, 73,137,255, 65, 86, /* 0x 2f0 */ + 65, 85, 65, 84, 73,137,252, 85, 83, 72,131,236,104, 76, 3,103, /* 0x 300 */ + 32,102,131,127, 16, 3,137, 84, 36, 60, 15,183, 87, 56, 72,137, /* 0x 310 */ + 76, 36, 48,185, 16, 0, 0, 0, 72,137,116, 36, 64, 76,137, 68, /* 0x 320 */ + 36, 40, 76,137, 76, 36, 32, 15, 68,200, 76,137,230, 72,131,205, /* 0x 330 */ +255, 49,219,131,193, 34,255,202,120, 33,131, 62, 1,117, 22, 72, /* 0x 340 */ +139, 70, 16, 72, 57,232, 72, 15, 66,232, 72, 3, 70, 40, 72, 57, /* 0x 350 */ +195, 72, 15, 66,216, 72,131,198, 56,235,219, 72,129,229, 0,240, /* 0x 360 */ +255,255, 49,210, 69, 49,201, 72, 41,235, 65,131,200,255, 72,137, /* 0x 370 */ +239, 72,129,195,255, 15, 0, 0, 72,129,227, 0,240,255,255, 72, /* 0x 380 */ +137,222,232,194,253,255,255, 72,141, 20, 24, 72, 41,232,102, 65, /* 0x 390 */ +131,127, 56, 0, 72,137, 68, 36, 24,199, 68, 36, 20, 0, 0, 0, /* 0x 3a0 */ + 0, 72,137, 84, 36, 72, 15,132,139, 1, 0, 0, 72,131,124, 36, /* 0x 3b0 */ + 64, 0,116, 37, 65,131, 60, 36, 6,117, 30, 72,139, 84, 36, 24, /* 0x 3c0 */ + 73, 3, 84, 36, 16,190, 3, 0, 0, 0, 72,139,124, 36, 48,232, /* 0x 3d0 */ +222,254,255,255,233, 71, 1, 0, 0, 65,131, 60, 36, 1, 15,133, /* 0x 3e0 */ + 60, 1, 0, 0, 72,139, 68, 36, 24, 73, 3, 68, 36, 16, 65,190, /* 0x 3f0 */ + 64, 98, 81,115, 65,139, 76, 36, 4, 65,131,200,255, 73,139, 84, /* 0x 400 */ + 36, 32, 72,137,197, 72,137, 68, 36, 88, 73,139, 68, 36, 40,131, /* 0x 410 */ +225, 7, 72,137,235, 72,137, 84, 36, 80,193,225, 2,129,227,255, /* 0x 420 */ + 15, 0, 0, 72, 1,232, 65,211,238, 72, 41,221, 72,137, 68, 36, /* 0x 430 */ + 8, 73,139, 68, 36, 8, 65,131,230, 7, 76,141, 44, 26,185, 50, /* 0x 440 */ + 0, 0, 0, 72, 41,216, 72,131,124, 36, 64, 0,117, 7, 68,139, /* 0x 450 */ + 68, 36, 60,177, 18, 68,137,242, 73,137,193, 76,137,238,131,202, /* 0x 460 */ + 2, 72,131,124, 36, 64, 0, 72,137,239, 65, 15, 68,214,232,214, /* 0x 470 */ +252,255,255, 72, 57,197,117,105, 72,131,124, 36, 64, 0,116, 25, /* 0x 480 */ + 72,139, 76, 36, 32, 72,139, 84, 36, 40, 72,141,116, 36, 80, 72, /* 0x 490 */ +139,124, 36, 64,232, 15,253,255,255, 76,137,235, 72,247,219,129, /* 0x 4a0 */ +227,255, 15, 0, 0, 65,246,198, 2,116, 13, 74,141,124, 45, 0, /* 0x 4b0 */ + 49,192, 72,137,217,252,243,170, 72,131,124, 36, 64, 0,116, 43, /* 0x 4c0 */ + 73,131,124, 36, 8, 0,117, 7,199, 69, 12, 15, 5,195,144, 68, /* 0x 4d0 */ +137,242, 76,137,238, 72,137,239,232,100,252,255,255,133,192,116, /* 0x 4e0 */ + 10,191,127, 0, 0, 0,232,129,252,255,255, 73,141, 68, 29, 0, /* 0x 4f0 */ + 72, 1,197, 72, 59,108, 36, 8,115, 38, 72, 41,108, 36, 8, 69, /* 0x 500 */ + 49,201, 65,131,200,255, 72,139,116, 36, 8,185, 50, 0, 0, 0, /* 0x 510 */ + 68,137,242, 72,137,239,232, 46,252,255,255, 72, 57,197,117,193, /* 0x 520 */ +255, 68, 36, 20, 65, 15,183, 71, 56, 73,131,196, 56, 57, 68, 36, /* 0x 530 */ + 20, 15,140,117,254,255,255, 72,131,124, 36, 64, 0,116, 18,102, /* 0x 540 */ + 65,131,127, 16, 3,116, 10, 72,139,124, 36, 72,232,244,251,255, /* 0x 550 */ +255, 73,139, 71, 24, 72, 1, 68, 36, 24, 72,139, 68, 36, 24, 72, /* 0x 560 */ +131,196,104, 91, 93, 65, 92, 65, 93, 65, 94, 65, 95,195, 65, 86, /* 0x 570 */ + 76,141,114, 64, 65, 85, 77,137,205, 65, 84, 77,137,196, 85, 72, /* 0x 580 */ +137,213, 83, 72,137,203, 49,201, 72,131,236, 48,139, 7, 72,137, /* 0x 590 */ + 52, 36, 72,137,116, 36, 16, 72,141,116, 36, 32, 72,137, 84, 36, /* 0x 5a0 */ + 40, 72,137,124, 36, 8, 76,137,194, 72,137,124, 36, 24, 72,137, /* 0x 5b0 */ +231, 72,137, 68, 36, 32,232,237,251,255,255, 73,139, 86, 16,190, /* 0x 5c0 */ + 3, 0, 0, 0, 72,137,223, 72,131,194, 64,232,226,252,255,255, /* 0x 5d0 */ + 72, 15,183, 85, 56,190, 5, 0, 0, 0, 72,137,223,232,208,252, /* 0x 5e0 */ +255,255, 72,139, 85, 24,190, 9, 0, 0, 0, 72,137,223,232,191, /* 0x 5f0 */ +252,255,255, 72,141,116, 36, 16, 77,137,233, 77,137,224, 49,210, /* 0x 600 */ + 72,137,217, 72,137,239,232,217,252,255,255, 69, 49,237,102,131, /* 0x 610 */ +125, 56, 0, 73,137,196,116,104, 65,131, 62, 3,117, 82, 73,139, /* 0x 620 */ +126, 16, 49,210, 49,246,232, 57,251,255,255,133,192,137,195,120, /* 0x 630 */ + 23,186, 0, 4, 0, 0, 72,137,238,137,199,232, 32,251,255,255, /* 0x 640 */ + 72, 61, 0, 4, 0, 0,116, 10,191,127, 0, 0, 0,232, 26,251, /* 0x 650 */ +255,255, 72,137,239, 69, 49,201, 69, 49,192, 49,201,137,218, 49, /* 0x 660 */ +246,232,126,252,255,255,137,223, 73,137,196,232,248,250,255,255, /* 0x 670 */ + 15,183, 69, 56, 65,255,197, 73,131,198, 56, 65, 57,197,124,152, /* 0x 680 */ + 72,131,196, 48, 76,137,224, 91, 93, 65, 92, 65, 93, 65, 94,195 /* 0x 690 */ +}; diff --git a/src/stub/arm-linux.elf-entry.h b/src/stub/arm-linux.elf-entry.h new file mode 100644 index 00000000..0f7de9d8 --- /dev/null +++ b/src/stub/arm-linux.elf-entry.h @@ -0,0 +1,72 @@ +/* arm-linux.elf-entry.h -- created from arm-linux.elf-entry.bin, 584 (0x248) 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 + + */ + + +#define LINUX_ELF32ARM_LOADER_SIZE 584 +#define LINUX_ELF32ARM_LOADER_ADLER32 0xeb17f976 +#define LINUX_ELF32ARM_LOADER_CRC32 0xe6d5a92e + +unsigned char linux_elf32arm_loader[584] = { +112,192,143,226, 3, 5,188,232, 7, 0, 45,233, 7, 32,160,227, /* 0x 0 */ + 50, 48,160,227, 0, 64,224,227,192, 0,144,239, 1, 10,112,227, /* 0x 10 */ +101, 0, 0, 42, 0,144,160,225,255, 0,184,232, 1,160, 90,226, /* 0x 20 */ +255, 0,169,232,251,255,255, 26, 9,224,160,225, 8,176, 73,224, /* 0x 30 */ + 0, 6,188,232, 11, 80,140,224, 5, 0,160,225, 90, 31,143,226, /* 0x 40 */ + 12, 16, 65,224, 0, 16,129,224, 0, 32,160,227, 2, 0,159,239, /* 0x 50 */ +232, 65,223,229, 8, 48,141,226, 14, 32,160,225,216, 17,159,229, /* 0x 60 */ +119, 15,143,226, 5,240,160,225, 65, 68, 82, 77, 76, 69, 78, 77, /* 0x 70 */ + 65, 68, 82, 67, 67, 78, 84, 67, 76, 69, 78, 88, 65, 68, 82, 88, /* 0x 80 */ +252, 64, 45,233, 0,112,129,224, 0, 80,224,227, 2, 65,160,227, /* 0x 90 */ + 16, 0, 0,234, 24, 0,189,232, 7, 0, 64,224, 3, 32, 66,224, /* 0x a0 */ + 0, 32,132,229, 0, 64,160,225, 3, 0,160,225, 2, 16,131,224, /* 0x b0 */ + 0, 32,160,227, 2, 0,159,239, 4, 0,160,225,240,128,189,232, /* 0x c0 */ + 1, 64,208,228, 4, 64,164,224, 4, 76,176,225, 14,240,160,225, /* 0x d0 */ + 1, 48,208,228, 1, 48,194,228, 4, 64,148,224,247,255,255, 11, /* 0x e0 */ +250,255,255, 42, 1, 16,160,227, 3, 0, 0,234, 1, 16, 65,226, /* 0x f0 */ + 4, 64,148,224,241,255,255, 11, 1, 16,161,224, 4, 64,148,224, /* 0x 100 */ +238,255,255, 11, 1, 16,161,224, 4, 64,148,224,235,255,255, 11, /* 0x 110 */ +245,255,255, 58, 3, 48, 81,226, 0, 16,160,227, 6, 0, 0, 58, /* 0x 120 */ + 1, 80,208,228, 3, 84,133,225, 5, 80,240,225,216,255,255, 10, /* 0x 130 */ +197, 80,176,225, 15, 0, 0, 42, 2, 0, 0,234, 4, 64,148,224, /* 0x 140 */ +222,255,255, 11, 11, 0, 0, 42, 1, 16,160,227, 4, 64,148,224, /* 0x 150 */ +218,255,255, 11, 7, 0, 0, 42, 4, 64,148,224,215,255,255, 11, /* 0x 160 */ + 1, 16,161,224, 4, 64,148,224,212,255,255, 11,249,255,255, 58, /* 0x 170 */ + 4, 16,129,226, 3, 0, 0,234, 4, 64,148,224,207,255,255, 11, /* 0x 180 */ + 1, 16,161,224, 2, 16,129,226, 5, 12,117,227, 0, 0, 0, 42, /* 0x 190 */ + 1, 16,129,226, 0, 48,210,229, 5, 48,210,231, 1, 48,194,228, /* 0x 1a0 */ + 1, 16, 81,226,251,255,255, 26,202,255,255,234, 30, 32,160,227, /* 0x 1b0 */ + 96, 16,143,226, 2, 0,160,227, 4, 0,144,239,127, 0,160,227, /* 0x 1c0 */ + 1, 0,144,239,252,255,255,234, 10, 36, 73,100, 58, 32, 85, 80, /* 0x 1d0 */ + 88, 32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 50, 48, 48, 54, 32, /* 0x 1e0 */ +116,104,101, 32, 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108, /* 0x 1f0 */ +108, 32, 82,105,103,104,116,115, 32, 82,101,115,101,114,118,101, /* 0x 200 */ +100, 46, 32,104,116,116,112, 58, 47, 47,117,112,120, 46,115,102, /* 0x 210 */ + 46,110,101,116, 32, 36, 10, 0, 80, 82, 79, 84, 95, 69, 88, 69, /* 0x 220 */ + 67,124, 80, 82, 79, 84, 95, 87, 82, 73, 84, 69, 32,102, 97,105, /* 0x 230 */ +108,101,100, 46, 10, 0, 0, 0 /* 0x 240 */ +}; diff --git a/src/stub/arm-linux.elf-fold.h b/src/stub/arm-linux.elf-fold.h new file mode 100644 index 00000000..661c2292 --- /dev/null +++ b/src/stub/arm-linux.elf-fold.h @@ -0,0 +1,165 @@ +/* arm-linux.elf-fold.h -- created from arm-linux.elf-fold.bin, 2080 (0x820) 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 + + */ + + +#define LINUX_ELF32ARM_FOLD_SIZE 2080 +#define LINUX_ELF32ARM_FOLD_ADLER32 0x885d5313 +#define LINUX_ELF32ARM_FOLD_CRC32 0x744eec3f + +unsigned char linux_elf32arm_fold[2080] = { +127, 69, 76, 70, 1, 1, 1, 97, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */ + 2, 0, 40, 0, 1, 0, 0, 0,128,128, 0, 0, 52, 0, 0, 0, /* 0x 10 */ + 0, 0, 0, 0, 2, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */ + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0, /* 0x 30 */ + 0,128, 0, 0, 32, 8, 0, 0, 32, 8, 0, 0, 5, 0, 0, 0, /* 0x 40 */ + 0,128, 0, 0, 1, 0, 0, 0, 32, 8, 0, 0, 32,136, 0, 0, /* 0x 50 */ + 32,136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, /* 0x 60 */ + 0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */ + 12, 48,157,229, 3, 49,141,224, 20, 48,131,226, 4, 0,147,228, /* 0x 80 */ + 0, 0, 80,227,252,255,255, 26, 3, 32,160,225, 8, 0,146,228, /* 0x 90 */ + 0, 0, 80,227,252,255,255, 26, 8, 32,141,229, 10,220, 77,226, /* 0x a0 */ + 9, 64,160,225, 4,144,154,229, 13,128,160,225, 0,112,154,229, /* 0x b0 */ + 36, 96,143,226, 12,144,137,226, 0,176,160,227,248, 15, 45,233, /* 0x c0 */ + 15, 0,189,232,123, 1, 0,235, 0,224,160,225, 20,208,141,226, /* 0x d0 */ + 10,220,141,226, 7, 0,189,232, 4,240, 18,229,255, 48, 3,226, /* 0x e0 */ + 80, 0, 83,227, 14,240,160, 17, 33, 17,176,225, 0, 0, 80, 19, /* 0x f0 */ + 14,240,160, 1, 1, 16, 65,226, 1, 33,144,231, 15, 52, 2,226, /* 0x 100 */ + 11, 4, 83,227, 4, 0, 0, 26,255, 52, 2,226, 1, 32, 66,224, /* 0x 110 */ +255, 36,194,227, 3, 32,130,225, 1, 33,128,231, 0, 0, 81,227, /* 0x 120 */ +243,255,255, 26, 14,240,160,225, 1, 0,144,239, 3, 0,144,239, /* 0x 130 */ + 14,240,160,225, 4, 0,144,239, 14,240,160,225, 5, 0,144,239, /* 0x 140 */ + 14,240,160,225, 6, 0,144,239, 14,240,160,225, 45, 0,144,239, /* 0x 150 */ + 14,240,160,225, 91, 0,144,239, 14,240,160,225,125, 0,144,239, /* 0x 160 */ + 14,240,160,225, 4, 80, 45,229, 8, 80,157,229, 4, 64, 45,229, /* 0x 170 */ + 8, 64,157,229, 37, 86,160,225,192, 0,144,239, 4, 64,157,228, /* 0x 180 */ + 4, 80,157,228, 14,240,160,225, 4,224, 45,229, 0, 48,144,229, /* 0x 190 */ + 2, 0, 83,225, 2,192,160,225, 4,224,144,229,127, 0,160, 51, /* 0x 1a0 */ +224,255,255, 59, 1, 32, 66,226, 1, 0,114,227, 4, 0, 0, 10, /* 0x 1b0 */ + 1, 48,222,228, 1, 32, 66,226, 1, 48,193,228, 1, 0,114,227, /* 0x 1c0 */ +249,255,255,234, 4, 32,144,229, 0, 48,144,229, 12, 32,130,224, /* 0x 1d0 */ + 3, 48,108,224, 0, 48,128,229, 4, 32,128,229, 4,240,157,228, /* 0x 1e0 */ +240, 64, 45,233, 1, 64,160,225, 0, 16,145,229, 20,208, 77,226, /* 0x 1f0 */ + 0, 0, 81,227, 0, 80,160,225, 2,112,160,225, 3, 96,160,225, /* 0x 200 */ + 70, 0, 0, 10, 8, 16,141,226, 12, 32,160,227, 5, 0,160,225, /* 0x 210 */ +220,255,255,235, 8, 16,157,229, 0, 0, 81,227, 12, 32,157,229, /* 0x 220 */ + 6, 0, 0, 26,252, 48,159,229, 3, 0, 82,225, 5, 0, 0, 26, /* 0x 230 */ + 0, 48,149,229, 0, 0, 83,227, 56, 0, 0, 10, 1, 0, 0,234, /* 0x 240 */ + 0, 0, 82,227, 1, 0, 0, 26,127, 0,160,227,181,255,255,235, /* 0x 250 */ + 1, 0, 82,225,251,255,255,138, 0, 48,148,229, 3, 0, 81,225, /* 0x 260 */ +248,255,255,138, 1, 0, 82,225, 4, 48,148,229, 33, 0, 0, 42, /* 0x 270 */ + 16,192,221,229, 4, 0,149,229, 2, 16,160,225, 0,192,141,229, /* 0x 280 */ + 3, 32,160,225, 4, 48,141,226, 15,224,160,225, 7,240,160,225, /* 0x 290 */ + 0, 0, 80,227,235,255,255, 26, 10, 0,157,233, 3, 0, 81,225, /* 0x 2a0 */ +232,255,255, 26, 17, 32,221,229, 0, 0, 82,227, 0, 0, 86, 19, /* 0x 2b0 */ + 9, 0, 0, 10, 2, 12, 81,227, 2, 0, 0,138, 0, 48,148,229, /* 0x 2c0 */ + 1, 0, 83,225, 4, 0, 0, 26, 2, 48,160,225, 4, 0,148,229, /* 0x 2d0 */ + 18, 32,221,229, 15,224,160,225, 6,240,160,225, 4, 48,149,229, /* 0x 2e0 */ + 12, 16,157,229, 0, 32,149,229, 1, 48,131,224, 2, 32, 97,224, /* 0x 2f0 */ + 12, 0,133,232, 2, 0, 0,234, 3, 16,160,225, 5, 0,160,225, /* 0x 300 */ +160,255,255,235, 8, 16,157,229, 12, 0,148,232, 2, 32, 97,224, /* 0x 310 */ + 1, 48,131,224, 0, 0, 82,227, 12, 0,132,232,183,255,255,234, /* 0x 320 */ + 20,208,141,226,240,128,189,232, 85, 80, 88, 33, 0, 0, 80,227, /* 0x 330 */ + 14,240,160, 1, 0, 48,144,229, 1, 0, 83,225, 6, 0, 0, 10, /* 0x 340 */ + 1, 0, 83,227, 0, 48,160, 19, 1, 48,160, 3, 0, 0, 81,227, /* 0x 350 */ + 0, 48,160, 3, 0, 0, 83,227, 1, 0, 0, 10, 6, 0,128,232, /* 0x 360 */ + 14,240,160,225, 8, 0,128,226,241,255,255,234,240, 79, 45,233, /* 0x 370 */ + 40,208, 77,226, 1,144,160,225, 28,192,145,229, 2,176,160,225, /* 0x 380 */ +176, 17,209,225, 80, 32,157,229,188,226,217,225, 2, 0, 81,227, /* 0x 390 */ + 12,112,137,224, 24, 0,141,229, 20, 48,141,229, 16, 32,141,229, /* 0x 3a0 */ + 50,128,160, 3, 34,128,160, 19, 7, 16,160,225, 1,224, 94,226, /* 0x 3b0 */ + 0, 96,224,227, 0, 80,160,227, 12, 0, 0, 74, 0, 48,145,229, /* 0x 3c0 */ + 1, 0, 83,227, 6, 0, 0, 26, 8, 32,145,229, 20, 48,145,229, /* 0x 3d0 */ + 2, 48,131,224, 3, 0, 85,225, 3, 80,160, 49, 2, 0, 86,225, /* 0x 3e0 */ + 2, 96,160, 33, 1,224, 94,226, 32, 16,129,226,241,255,255,234, /* 0x 3f0 */ +255,110,198,227, 15, 96,198,227, 5, 48,102,224,255, 62,131,226, /* 0x 400 */ + 15, 48,131,226,255, 94,195,227, 0, 64,160,227, 15, 80,197,227, /* 0x 410 */ + 8, 48,160,225, 6, 0,160,225, 0,192,224,227, 5, 16,160,225, /* 0x 420 */ + 4, 32,160,225, 0,192,141,229, 4, 64,141,229, 76,255,255,235, /* 0x 430 */ +188, 50,217,225, 3, 0, 84,225, 5, 48,128,224, 12, 64,141,229, /* 0x 440 */ + 36, 48,141,229, 0, 96,102,224,133, 0, 0,170, 0, 48,151,229, /* 0x 450 */ + 6, 0, 83,227, 5, 0, 0, 26, 8, 32,151,229, 20, 0,157,229, /* 0x 460 */ + 6, 32,130,224, 3, 16,160,227,175,255,255,235,117, 0, 0,234, /* 0x 470 */ + 1, 0, 83,227,115, 0, 0, 26, 24, 48,151,229, 8, 16,151,229, /* 0x 480 */ + 7, 48, 3,226, 32, 34,159,229, 6, 16,129,224, 3, 49,160,225, /* 0x 490 */ + 16, 0,151,229, 50, 35,160,225, 1, 74,160,225, 20, 48,151,229, /* 0x 4a0 */ + 0, 0, 91,227, 4,192,151,229, 36, 74,160,225, 3, 48,129,224, /* 0x 4b0 */ + 1, 80,100,224, 24,224,157, 5, 7,128, 2,226, 4,160,128,224, /* 0x 4c0 */ + 2, 32,160, 19, 0, 32,160, 3, 8, 48,141,229, 0,224,224, 19, /* 0x 4d0 */ + 28, 0,141,229, 32, 16,141,229, 18, 48,160, 3, 50, 48,160, 19, /* 0x 4e0 */ + 12,192,100,224, 8, 32,130,225, 5, 0,160,225, 10, 16,160,225, /* 0x 4f0 */ + 0,224,141,229, 4,192,141,229, 25,255,255,235, 0, 0, 85,225, /* 0x 500 */ + 62, 0, 0, 26, 0, 0, 91,227, 6, 0, 0, 10, 16, 32,157,229, /* 0x 510 */ + 4, 48, 24,226, 2, 48,160, 17, 28, 16,141,226, 11, 0,160,225, /* 0x 520 */ + 24, 32,157,229, 45,255,255,235, 0, 48,106,226, 3, 74,160,225, /* 0x 530 */ + 2, 0, 24,227, 36, 74,160,225, 7, 0, 0, 10, 0, 0, 84,227, /* 0x 540 */ + 10, 16,133,224, 4, 32,160,225, 3, 0, 0, 10, 0, 48,160,227, /* 0x 550 */ + 1, 32, 82,226, 1, 48,193,228,251,255,255, 26, 0, 0, 91,227, /* 0x 560 */ + 40, 0, 0, 10, 0, 48,151,229, 1, 0, 83,227, 29, 0, 0, 26, /* 0x 570 */ + 24, 48,151,229, 1, 0, 19,227, 26, 0, 0, 10, 16, 32,135,226, /* 0x 580 */ + 12, 0,146,232, 8, 16,151,229, 2, 0, 83,225, 1, 48,131,224, /* 0x 590 */ + 6, 32,131,224, 4, 0, 0, 26, 0, 48, 98,226, 3, 58,160,225, /* 0x 5a0 */ + 35, 58,160,225, 7, 0, 83,227, 6, 0, 0,138, 4, 32,151,229, /* 0x 5b0 */ +134, 48,134,224, 3, 49,134,224, 3, 49,129,224, 0, 0, 82,227, /* 0x 5c0 */ + 8, 32,131,226, 3, 0, 0, 26,224, 48,159,229, 0, 48,130,229, /* 0x 5d0 */ +220, 48,159,229, 4, 48,130,229, 0, 0, 82,227, 20, 0,157, 21, /* 0x 5e0 */ + 0, 16,160, 19, 80,255,255, 27, 5, 0,160,225, 10, 16,160,225, /* 0x 5f0 */ + 8, 32,160,225,216,254,255,235, 0, 0, 80,227, 1, 0, 0, 10, /* 0x 600 */ +127, 0,160,227,199,254,255,235, 4, 48,138,224, 3, 80,133,224, /* 0x 610 */ + 8, 48,157,229, 3, 0, 85,225, 10, 0, 0, 42, 0,192,224,227, /* 0x 620 */ + 3, 16,101,224, 0,192,141,229, 8, 32,160,225, 1,192,140,226, /* 0x 630 */ + 5, 0,160,225, 50, 48,160,227, 4,192,141,229,200,254,255,235, /* 0x 640 */ + 0, 0, 85,225,237,255,255, 26, 12, 32,157,229,188, 50,217,225, /* 0x 650 */ + 1, 32,130,226, 3, 0, 82,225, 32,112,135,226, 12, 32,141,229, /* 0x 660 */ +120,255,255,234, 0, 0, 91,227, 4, 0, 0, 26, 24, 0,157,229, /* 0x 670 */ +179,254,255,235, 0, 0, 80,227, 4, 0, 0, 10,223,255,255,234, /* 0x 680 */ +176, 49,217,225, 3, 0, 83,227, 36, 0,157, 21,174,254,255, 27, /* 0x 690 */ + 76, 48,157,229, 0, 0, 83,227, 0, 96,131, 21, 24, 0,153,229, /* 0x 6a0 */ + 6, 0,128,224, 40,208,141,226,240,143,189,232, 64, 98, 81,115, /* 0x 6b0 */ + 91, 0,144,239, 14,240,160,225,240, 71, 45,233, 12,208, 77,226, /* 0x 6c0 */ + 44,192,141,226, 52,112,141,226, 0, 80,160,225, 1, 96,160,225, /* 0x 6d0 */ + 3,160,160,225, 12, 16,160,225, 0, 48,160,227, 7, 0,160,225, /* 0x 6e0 */ + 4,144,156,229, 2,128,160,225, 52, 64,157,229,187,254,255,235, /* 0x 6f0 */ + 56, 48,157,229, 5, 0,160,225, 3, 48,100,224, 5, 16,160,227, /* 0x 700 */ +188, 34,217,225, 56, 48,141,229, 52, 96,141,229, 6,255,255,235, /* 0x 710 */ + 52, 96,137,226, 5, 0,160,225, 4, 16,160,227,186, 34,217,225, /* 0x 720 */ + 1,255,255,235, 8, 48,150,229, 60, 32,157,229, 3, 32,130,224, /* 0x 730 */ + 52, 32,130,226, 5, 0,160,225, 3, 16,160,227,250,254,255,235, /* 0x 740 */ + 8,192,141,226, 7, 32,160,225, 9, 16,160,225, 5, 48,160,225, /* 0x 750 */ + 8, 0,160,225, 0,192,141,229, 4,160,141,229, 2,255,255,235, /* 0x 760 */ + 0, 64,160,225, 9, 16,160,227, 4, 32,160,225, 5, 0,160,225, /* 0x 770 */ +237,254,255,235,188, 18,217,225, 0, 32,160,227, 1, 0, 82,225, /* 0x 780 */ + 31, 0, 0,170, 0, 48,150,229, 3, 0, 83,227, 1, 32,130,226, /* 0x 790 */ + 24, 0, 0, 26, 8, 48,150,229, 8, 0,157,229, 0, 16,160,227, /* 0x 7a0 */ + 0, 0,131,224, 1, 32,160,225, 99,254,255,235, 0, 64, 80,226, /* 0x 7b0 */ + 4, 0, 0,186, 9, 16,160,225, 2, 44,160,227, 90,254,255,235, /* 0x 7c0 */ + 2, 12, 80,227, 1, 0, 0, 10,127, 0,160,227, 85,254,255,235, /* 0x 7d0 */ + 0,192,160,227, 4, 0,160,225, 12, 32,160,225, 9, 16,160,225, /* 0x 7e0 */ + 12, 48,160,225, 0,192,141,229, 4,192,141,229,222,254,255,235, /* 0x 7f0 */ + 0, 64,160,225, 2, 0, 0,234, 1, 0, 82,225, 32, 96,134,226, /* 0x 800 */ +222,255,255,234, 4, 0,160,225, 12,208,141,226,240,135,189,232 /* 0x 810 */ +}; diff --git a/src/stub/arm.v4a-wince.pe.h b/src/stub/arm.v4a-wince.pe.h new file mode 100644 index 00000000..5ce5108f --- /dev/null +++ b/src/stub/arm.v4a-wince.pe.h @@ -0,0 +1,95 @@ +/* arm.v4a-wince.pe.h -- created from arm.v4a-wince.pe.bin, 952 (0x3b8) 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 + + */ + + +#define NRV_LOADER_ARM_SIZE 952 +#define NRV_LOADER_ARM_ADLER32 0xd6f275cf +#define NRV_LOADER_ARM_CRC32 0x3a603f09 + +unsigned char nrv_loader_arm[952] = { + 1, 0, 81,227, 8, 0, 0, 26,255, 79, 45,233, 32, 48,143,226, /* 0x 0 */ + 7, 0,179,232, 16, 12,147,232, 2,144,160,225, 13, 0, 0,235, /* 0x 10 */ + 4, 0,160,227, 1, 0, 0,235,255, 79,189,232, 32,240,159,229, /* 0x 20 */ + 20,240,159,229, 83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, /* 0x 30 */ + 68, 83, 84, 76, 73, 65, 84, 84, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 40 */ + 0, 0, 0, 0, 69, 78, 84, 82, 0, 64, 45,233, 0,128,189,232, /* 0x 50 */ + 60, 0,159,229, 0, 32,160,227, 56,192,159,229, 12, 0, 80,225, /* 0x 60 */ + 13, 0, 0, 10, 0, 48,144,229, 15, 20, 3,226, 11, 4, 81,227, /* 0x 70 */ + 4, 0, 0, 26,255, 20, 3,226, 2, 48, 67,224,255, 52,195,227, /* 0x 80 */ + 1, 48,131,225, 0, 48,128,229, 4, 0,128,226, 1, 32,130,226, /* 0x 90 */ +241,255,255,234, 70, 73, 66, 83, 70, 73, 66, 69, 84, 16,159,229, /* 0x a0 */ + 4, 0, 73,226, 1, 48,209,228, 0, 0, 83,227, 18, 0, 0, 10, /* 0x b0 */ +240, 0, 83,227,240,192,195, 35, 1, 48,209, 37, 12,196,131, 32, /* 0x c0 */ + 2, 48,209, 36, 12, 52,131, 32, 3, 0,128,224, 0, 48,208,229, /* 0x d0 */ + 12,196,131,224, 1, 48,208,229, 12,196,131,224, 2, 48,208,229, /* 0x e0 */ + 12,196,131,224, 3, 48,208,229, 12,196,131,224, 9,192,140,224, /* 0x f0 */ + 0,192,128,229,234,255,255,234, 66, 82, 69, 76, 2,219, 77,226, /* 0x 100 */ +164, 64,159,229, 4, 0,160,225, 30, 0, 0,235, 40, 0, 0, 10, /* 0x 110 */ +152, 16,159,229, 1, 0,128,224, 13, 16,160,225, 1, 32,208,228, /* 0x 120 */ +178, 32,193,224, 0, 0, 82,227,251,255,255, 26, 13, 0,160,225, /* 0x 130 */ + 27, 0, 0,235, 0, 96,160,225, 4, 0,132,226, 17, 0, 0,235, /* 0x 140 */ + 0, 80,137,224, 8, 64,132,226, 1, 0,212,228, 1, 0, 80,227, /* 0x 150 */ +235,255,255, 74, 4, 0, 0, 26, 4, 16,160,225, 1, 0,212,228, /* 0x 160 */ + 0, 0, 80,227,252,255,255, 26, 2, 0, 0,234, 1, 0,212,228, /* 0x 170 */ + 1, 16,212,228, 1, 20,128,224, 6, 0,160,225, 9, 0, 0,235, /* 0x 180 */ + 4, 0,133,228,239,255,255,234, 3, 32,160,227, 2, 48,208,231, /* 0x 190 */ + 1, 32, 82,226, 1, 20,131,224,251,255,255, 90, 1, 0,176,225, /* 0x 1a0 */ + 14,240,160,225, 10,240,160,225, 11,240,160,225, 66, 73, 77, 80, /* 0x 1b0 */ + 79, 78, 65, 77, 2,219,141,226,252, 64, 45,233, 0,112,129,224, /* 0x 1c0 */ + 0, 80,224,227, 2, 65,160,227, 10, 0, 0,234, 24, 0,189,232, /* 0x 1d0 */ + 7, 0, 64,224, 3, 32, 66,224, 0, 32,132,229,240,128,189,232, /* 0x 1e0 */ + 1, 64,208,228, 4, 64,164,224, 4, 76,176,225, 14,240,160,225, /* 0x 1f0 */ + 1, 48,208,228, 1, 48,194,228, 4, 64,148,224,247,255,255, 11, /* 0x 200 */ +250,255,255, 42, 1, 16,160,227, 3, 0, 0,234, 1, 16, 65,226, /* 0x 210 */ + 4, 64,148,224,241,255,255, 11, 1, 16,161,224, 4, 64,148,224, /* 0x 220 */ +238,255,255, 11, 1, 16,161,224, 4, 64,148,224,235,255,255, 11, /* 0x 230 */ +245,255,255, 58, 3, 48, 81,226, 0, 16,160,227, 6, 0, 0, 58, /* 0x 240 */ + 1, 80,208,228, 3, 84,133,225, 5, 80,240,225,222,255,255, 10, /* 0x 250 */ +197, 80,176,225, 15, 0, 0, 42, 2, 0, 0,234, 4, 64,148,224, /* 0x 260 */ +222,255,255, 11, 11, 0, 0, 42, 1, 16,160,227, 4, 64,148,224, /* 0x 270 */ +218,255,255, 11, 7, 0, 0, 42, 4, 64,148,224,215,255,255, 11, /* 0x 280 */ + 1, 16,161,224, 4, 64,148,224,212,255,255, 11,249,255,255, 58, /* 0x 290 */ + 4, 16,129,226, 3, 0, 0,234, 4, 64,148,224,207,255,255, 11, /* 0x 2a0 */ + 1, 16,161,224, 2, 16,129,226, 5, 12,117,227, 0, 0, 0, 42, /* 0x 2b0 */ + 1, 16,129,226, 0, 48,210,229, 5, 48,210,231, 1, 48,194,228, /* 0x 2c0 */ + 1, 16, 81,226,251,255,255, 26,202,255,255,234, 0, 0, 0,235, /* 0x 2d0 */ + 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 2e0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, /* 0x 2f0 */ + 68,108,108, 83,116, 97,114,116, 0, 0, 0, 0, 0, 69,120,101, /* 0x 300 */ + 83,116, 97,114,116, 0, 8, 0, 0, 0, 80,114,111, 99,101,115, /* 0x 310 */ +115, 69,110,100, 0, 92, 0, 0, 0, 85,110,102,105,108,116,101, /* 0x 320 */ +114, 95, 48,120, 53, 48, 0, 96, 0, 0, 0, 82,101,108,111, 99, /* 0x 330 */ +115, 0,172, 0, 0, 0, 73,109,112,111,114,116,115, 0, 12, 1, /* 0x 340 */ + 0, 0,117, 99,108, 95,110,114,118, 50,101, 95,100,101, 99,111, /* 0x 350 */ +109,112,114,101,115,115, 95, 56, 0,200, 1, 0, 0, 67, 97,108, /* 0x 360 */ +108, 50, 69, 0,220, 2, 0, 0, 0, 0, 0, 0,223, 2, 0, 0, /* 0x 370 */ +117, 99,108, 95,110,114,118, 50,101, 95,100,101, 99,111,109,112, /* 0x 380 */ +114,101,115,115, 95, 56, 0, 0, 0, 0, 0, 85, 80, 88, 49, 72, /* 0x 390 */ + 69, 65, 68, 0,224, 2, 0, 0,101,111,102, 0, 0, 3, 0, 0, /* 0x 3a0 */ +255,255,255,255, 0, 3, 0, 0 /* 0x 3b0 */ +}; diff --git a/src/stub/arm.v4t-wince.pe.h b/src/stub/arm.v4t-wince.pe.h new file mode 100644 index 00000000..a7f7a38d --- /dev/null +++ b/src/stub/arm.v4t-wince.pe.h @@ -0,0 +1,98 @@ +/* arm.v4t-wince.pe.h -- created from arm.v4t-wince.pe.bin, 1000 (0x3e8) 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 + + */ + + +#define NRV_LOADER_THUMB_SIZE 1000 +#define NRV_LOADER_THUMB_ADLER32 0x4f344c3e +#define NRV_LOADER_THUMB_CRC32 0xe1803a67 + +unsigned char nrv_loader_thumb[1000] = { + 1, 0, 81,227, 11, 0, 0, 26,255, 79, 45,233, 44, 48,143,226, /* 0x 0 */ +224, 30,147,232, 1, 90,143,226, 0, 96,151,229, 1,122,135,226, /* 0x 10 */ + 5, 0, 87,225,251,255,255,154, 53, 64,143,226, 15,224,160,225, /* 0x 20 */ + 20,255, 47,225,255, 79,189,232, 32,192,159,229, 28,255, 47,225, /* 0x 30 */ + 83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, /* 0x 40 */ + 73, 65, 84, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 50 */ + 69, 78, 84, 82, 7,203,145, 70,100, 70, 16,181, 11, 72, 0, 34, /* 0x 60 */ + 11, 76, 15, 37,255, 38, 54, 6,247, 67,160, 66, 18,208, 3,104, /* 0x 70 */ + 25, 14, 41, 64, 11, 41, 5,209, 25, 28, 49, 64,155, 26, 59, 64, /* 0x 80 */ + 11, 67, 3, 96, 4, 48, 1, 50,239,231, 0, 0, 70, 73, 66, 83, /* 0x 90 */ + 70, 73, 66, 69, 14, 72, 74, 70, 17, 31, 3,120, 1, 48, 0, 43, /* 0x a0 */ + 24,208,240, 43, 8,211, 15, 36, 28, 64, 67,120, 36, 2,228, 24, /* 0x b0 */ + 3,120, 2, 48, 36, 2, 27, 25,201, 24, 0, 37, 75, 93, 36, 2, /* 0x c0 */ +228, 24, 1, 53, 4, 45,249,209,164, 24, 12, 96,229,231, 0, 0, /* 0x d0 */ + 66, 82, 69, 76,111, 70,255,176,255,176,255,176,255,176, 27, 76, /* 0x e0 */ + 32, 28, 0,240, 41,248, 53,208, 25, 73, 64, 24,105, 70, 2,120, /* 0x f0 */ + 1, 48, 10,128, 2, 49, 0, 42,249,209,104, 70, 0,240, 36,248, /* 0x 100 */ + 6, 28, 32, 29, 0,240, 24,248, 77, 70, 45, 24, 8, 52, 32,120, /* 0x 110 */ + 1, 52, 1, 40,228,212, 5,209, 33, 28, 32,120, 1, 52, 0, 40, /* 0x 120 */ +251,209, 4,224, 32,120, 97,120, 2, 52, 9, 2, 9, 24, 48, 28, /* 0x 130 */ + 0,240, 11,248, 1,197,234,231, 3, 33, 67, 92, 18, 2,210, 24, /* 0x 140 */ + 1, 57,250,213, 16, 28,112, 71, 80, 71, 88, 71, 66, 73, 77, 80, /* 0x 150 */ + 79, 78, 65, 77,189, 70, 6,188, 4, 32,150, 70, 8, 71, 0, 0, /* 0x 160 */ + 1,192,143,226, 28,255, 47,225, 9, 24,254,181, 1, 36,101, 66, /* 0x 170 */ +228, 7, 13, 39, 63, 2, 15,224, 26,188, 64, 26,210, 26, 34, 96, /* 0x 180 */ +240,188, 2,188, 8, 71, 4,120,100, 65, 1, 48, 36, 6,247, 70, /* 0x 190 */ + 3,120, 1, 48, 19,112, 1, 50, 36, 25,254, 70,243,208,247,210, /* 0x 1a0 */ + 1, 33, 36, 25,254, 70,238,208, 73, 65, 36, 25,254, 70,234,208, /* 0x 1b0 */ +247,211,203, 30, 0, 33, 5,211, 27, 2, 5,120, 1, 48, 29, 67, /* 0x 1c0 */ +237, 67,217,208, 36, 25,254, 70,221,208, 73, 65, 36, 25,254, 70, /* 0x 1d0 */ +217,208, 73, 65, 9,209, 1, 33, 36, 25,254, 70,211,208, 73, 65, /* 0x 1e0 */ + 36, 25,254, 70,207,208,247,211, 2, 49, 1, 49,253, 66, 0,210, /* 0x 1f0 */ + 1, 49, 19,120, 83, 93, 19,112, 1, 50, 1, 57,250,209,203,231, /* 0x 200 */ + 0, 0, 0,248, 1,192,143,226, 28,255, 47,225,252,181, 15, 24, /* 0x 210 */ + 1, 36,101, 66,228, 7, 5, 38, 54, 2, 15,224, 24,188,192, 27, /* 0x 220 */ +210, 26, 34, 96,240,188, 2,188, 8, 71, 4,120,100, 65, 1, 48, /* 0x 230 */ + 36, 6,247, 70, 3,120, 1, 48, 19,112, 1, 50, 36, 25,254, 70, /* 0x 240 */ +243,208,247,210, 1, 33, 4,224, 1, 57, 36, 25,254, 70,236,208, /* 0x 250 */ + 73, 65, 36, 25,254, 70,232,208, 73, 65, 36, 25,254, 70,228,208, /* 0x 260 */ +242,211,203, 30, 0, 33, 8,211, 27, 2, 5,120, 1, 48, 29, 67, /* 0x 270 */ +237, 67,211,208,109, 16, 19,210, 3,224, 36, 25,254, 70,212,208, /* 0x 280 */ + 14,210, 1, 33, 36, 25,254, 70,207,208, 9,210, 36, 25,254, 70, /* 0x 290 */ +203,208, 73, 65, 36, 25,254, 70,199,208,247,211, 4, 49, 4,224, /* 0x 2a0 */ + 36, 25,254, 70,193,208, 73, 65, 2, 49,238, 66, 0,210, 1, 49, /* 0x 2b0 */ + 19,120, 83, 93, 19,112, 1, 50, 1, 57,250,209,190,231, 0, 0, /* 0x 2c0 */ + 0,248, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, 0, 0, /* 0x 2d0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 2e0 */ + 0, 45, 0, 0, 68,108,108, 83,116, 97,114,116, 0, 0, 0, 0, /* 0x 2f0 */ + 0, 69,120,101, 83,116, 97,114,116, 0, 8, 0, 0, 0, 85,110, /* 0x 300 */ +102,105,108,116,101,114, 95, 48,120, 53, 48, 0,108, 0, 0, 0, /* 0x 310 */ + 82,101,108,111, 99,115, 0,164, 0, 0, 0, 73,109,112,111,114, /* 0x 320 */ +116,115, 0,228, 0, 0, 0, 80,114,111, 99,101,115,115, 69,110, /* 0x 330 */ +100, 0,102, 1, 0, 0,100,117,109,109,121, 48, 0,110, 1, 0, /* 0x 340 */ + 0,103,111, 95,116,104,117,109, 98, 95,110, 50, 98, 0,120, 1, /* 0x 350 */ + 0, 0, 67, 97,108,108, 50, 66, 0, 16, 2, 0, 0, 0, 0, 0, /* 0x 360 */ + 0, 19, 2, 0, 0,103,111, 95,116,104,117,109, 98, 95,110, 50, /* 0x 370 */ + 98, 0, 0, 0, 0, 0,100,117,109,109,121, 49, 0, 20, 2, 0, /* 0x 380 */ + 0,116,104,117,109, 98, 95,110,114,118, 50,101, 95,100, 56, 0, /* 0x 390 */ + 28, 2, 0, 0, 67, 97,108,108, 50, 69, 0,206, 2, 0, 0, 0, /* 0x 3a0 */ + 0, 0, 0,209, 2, 0, 0,116,104,117,109, 98, 95,110,114,118, /* 0x 3b0 */ + 50,101, 95,100, 56, 0, 0, 0, 0, 0, 85, 80, 88, 49, 72, 69, /* 0x 3c0 */ + 65, 68, 0,210, 2, 0, 0,101,111,102, 0,244, 2, 0, 0,255, /* 0x 3d0 */ +255,255,255,244, 2, 0, 0, 0 /* 0x 3e0 */ +}; diff --git a/src/stub/i086-dos16.com.h b/src/stub/i086-dos16.com.h new file mode 100644 index 00000000..1d91aaeb --- /dev/null +++ b/src/stub/i086-dos16.com.h @@ -0,0 +1,92 @@ +/* i086-dos16.com.h -- created from i086-dos16.com.bin, 906 (0x38a) 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 + + */ + + +#define NRV2B_LOADER_SIZE 906 +#define NRV2B_LOADER_ADLER32 0x1e09d469 +#define NRV2B_LOADER_CRC32 0x7de34e70 + +unsigned char nrv2b_loader[906] = { +129,252, 83, 80,119, 2,205, 32,185, 67, 88,190, 83, 73,191, 68, /* 0x 0 */ + 73,187, 0,128,253,243,164,252,135,247,131,238,198, 25,237, 87, /* 0x 10 */ + 87,233, 74, 77, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, /* 0x 20 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,164,232, 0, 0,114,250, /* 0x 30 */ + 65,232, 0, 0,227, 0,227, 0,115, 0,131,233, 3,114, 6,136, /* 0x 40 */ +204,172,247,208,149, 49,201,232, 0, 0, 17,201,117, 8, 65,232, /* 0x 50 */ + 0, 0,115,251, 65, 65, 65,129,253, 0,243,131,209, 1,141, 3, /* 0x 60 */ +150,243,164,150,235, 0,232, 2, 0, 17,201, 1,219,117, 4,173, /* 0x 70 */ + 17,192,147,195, 94,185, 67, 84,172, 44,232, 60, 1,119,249,193, /* 0x 80 */ + 4, 8, 41, 52,139, 28,134,223, 41,243,137, 28,173,226, 0,176, /* 0x 90 */ +232,176,233, 95,185, 67, 84,242,174,117, 0,117, 0,193, 5, 8, /* 0x a0 */ + 41, 61,139, 29,134,223, 41,251,137, 29,175,235, 0,195, 0, 0, /* 0x b0 */ + 67, 79, 77, 77, 65, 73, 78, 49, 0, 0, 0, 0, 0, 67, 79, 77, /* 0x c0 */ + 83, 85, 66, 83, 73, 0, 29, 0, 0, 0, 67, 79, 77, 83, 66, 66, /* 0x d0 */ + 66, 80, 0, 29, 0, 0, 0, 67, 79, 77, 80, 83, 72, 68, 73, 0, /* 0x e0 */ + 31, 0, 0, 0, 67, 79, 77, 67, 65, 76, 76, 84, 0, 32, 0, 0, /* 0x f0 */ + 0, 67, 79, 77, 77, 65, 73, 78, 50, 0, 33, 0, 0, 0, 85, 80, /* 0x 100 */ + 88, 49, 72, 69, 65, 68, 0, 36, 0, 0, 0, 67, 79, 77, 67, 85, /* 0x 110 */ + 84, 80, 79, 0, 58, 0, 0, 0, 78, 82, 86, 50, 66, 49, 54, 48, /* 0x 120 */ + 0, 58, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 78, 82, 86, /* 0x 130 */ + 68, 69, 67, 79, 50, 0, 13, 0, 0, 0, 0, 0, 0, 0, 68, 0, /* 0x 140 */ + 0, 0, 78, 82, 86, 68, 69, 67, 79, 50, 0, 8, 0, 0, 0, 78, /* 0x 150 */ + 82, 86, 68, 68, 79, 78, 69, 0, 68, 0, 0, 0, 0, 0, 0, 0, /* 0x 160 */ + 70, 0, 0, 0, 78, 82, 86, 68, 69, 67, 79, 50, 0, 22, 0, 0, /* 0x 170 */ + 0, 78, 82, 86, 68, 82, 69, 84, 85, 0, 70, 0, 0, 0, 0, 0, /* 0x 180 */ + 0, 0, 72, 0, 0, 0, 78, 82, 86, 68, 69, 67, 79, 50, 0, 21, /* 0x 190 */ + 0, 0, 0, 78, 82, 86, 68, 69, 67, 79, 49, 0, 72, 0, 0, 0, /* 0x 1a0 */ + 0, 0, 0, 0, 74, 0, 0, 0, 78, 82, 86, 50, 66, 49, 54, 48, /* 0x 1b0 */ + 0, 7, 0, 0, 0, 0, 0, 0, 0, 90, 0, 0, 0, 78, 82, 86, /* 0x 1c0 */ + 68, 69, 67, 79, 50, 0, 8, 0, 0, 0, 0, 0, 0, 0, 98, 0, /* 0x 1d0 */ + 0, 0, 78, 82, 86, 68, 69, 67, 79, 50, 0, 8, 0, 0, 0, 78, /* 0x 1e0 */ + 82, 86, 76, 69, 68, 48, 48, 0,102, 0, 0, 0, 78, 82, 86, 71, /* 0x 1f0 */ + 84, 68, 48, 48, 0,103, 0, 0, 0, 78, 82, 86, 68, 69, 67, 79, /* 0x 200 */ + 50, 0,110, 0, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 78, 82, /* 0x 210 */ + 86, 50, 66, 49, 54, 48, 0, 1, 0, 0, 0, 78, 82, 86, 50, 66, /* 0x 220 */ + 49, 54, 57, 0,132, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 54, /* 0x 230 */ + 0,132, 0, 0, 0, 67, 84, 49, 54, 73, 50, 56, 54, 0,143, 0, /* 0x 240 */ + 0, 0, 67, 84, 49, 54, 83, 85, 66, 48, 0,146, 0, 0, 0, 67, /* 0x 250 */ + 84, 49, 54, 73, 48, 56, 54, 0,148, 0, 0, 0, 67, 65, 76, 76, /* 0x 260 */ + 84, 82, 73, 50, 0,156, 0, 0, 0, 0, 0, 0, 0,159, 0, 0, /* 0x 270 */ + 0, 67, 65, 76, 76, 84, 82, 49, 54, 0, 4, 0, 0, 0, 67, 84, /* 0x 280 */ + 49, 54, 68, 85, 77, 49, 0,159, 0, 0, 0, 67, 84, 49, 54, 69, /* 0x 290 */ + 56, 48, 48, 0,159, 0, 0, 0, 67, 84, 49, 54, 69, 57, 48, 48, /* 0x 2a0 */ + 0,161, 0, 0, 0, 67, 65, 76, 76, 84, 82, 73, 53, 0,163, 0, /* 0x 2b0 */ + 0, 0, 67, 84, 49, 54, 74, 69, 78, 68, 0,169, 0, 0, 0, 0, /* 0x 2c0 */ + 0, 0, 0,171, 0, 0, 0, 78, 82, 86, 68, 69, 67, 79, 50, 0, /* 0x 2d0 */ + 21, 0, 0, 0, 67, 84, 49, 54, 74, 85, 76, 50, 0,171, 0, 0, /* 0x 2e0 */ + 0, 0, 0, 0, 0,173, 0, 0, 0, 67, 65, 76, 76, 84, 82, 73, /* 0x 2f0 */ + 54, 0, 3, 0, 0, 0, 67, 84, 49, 54, 68, 85, 77, 50, 0,173, /* 0x 300 */ + 0, 0, 0, 67, 84, 49, 54, 73, 50, 56, 55, 0,173, 0, 0, 0, /* 0x 310 */ + 67, 84, 49, 54, 83, 85, 66, 49, 0,176, 0, 0, 0, 67, 84, 49, /* 0x 320 */ + 54, 73, 48, 56, 55, 0,178, 0, 0, 0, 67, 65, 76, 76, 84, 82, /* 0x 330 */ + 73, 54, 0,186, 0, 0, 0, 0, 0, 0, 0,189, 0, 0, 0, 67, /* 0x 340 */ + 65, 76, 76, 84, 82, 73, 53, 0, 4, 0, 0, 0, 67, 84, 49, 54, /* 0x 350 */ + 68, 85, 77, 77, 51, 0,189, 0, 0, 0, 67, 79, 82, 69, 84, 85, /* 0x 360 */ + 82, 78, 0,189, 0, 0, 0, 67, 79, 77, 84, 72, 69, 78, 68, 0, /* 0x 370 */ +190, 0, 0, 0,255,255,255,255,190, 0 /* 0x 380 */ +}; diff --git a/src/stub/i086-dos16.exe.h b/src/stub/i086-dos16.exe.h new file mode 100644 index 00000000..e7167924 --- /dev/null +++ b/src/stub/i086-dos16.exe.h @@ -0,0 +1,184 @@ +/* i086-dos16.exe.h -- created from i086-dos16.exe.bin, 2377 (0x949) 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 + + */ + + +#define NRV_LOADER_SIZE 2377 +#define NRV_LOADER_ADLER32 0xe8176e1e +#define NRV_LOADER_CRC32 0x723ae5c1 + +unsigned char nrv_loader[2377] = { +255,255,255,255, 0, 0, 12, 0, 0, 0, 83, 84, 14, 46,255, 54, /* 0x 0 */ + 10, 0, 80, 83, 81, 82,140,200, 5, 79, 83,187, 79, 80,140,209, /* 0x 10 */ +137,226,142,208,137,220, 81, 82, 86, 87, 85, 30, 6,114,249,156, /* 0x 20 */ +185, 67, 88,190, 83, 73,137,247, 30,169,181,128,140,200, 5, 68, /* 0x 30 */ + 83,142,216, 5, 69, 83,142,192,253,243,165,252, 46,128,108, 66, /* 0x 40 */ + 16, 46,128,108, 18, 16,115, 0,146,175,173, 14, 14, 14, 6, 31, /* 0x 50 */ + 7, 22,189, 66, 80,187, 66, 88, 85,203, 85, 80, 88, 33,161,216, /* 0x 60 */ +208,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */ + 0, 0, 0, 0, 45,164, 0,255,117, 3,232, 0, 0,114,246, 65, /* 0x 80 */ +140,192, 1,255,115, 5,128,196, 8,142,192,209,239,232, 0, 0, /* 0x 90 */ +227, 0,115,249, 73, 73,116, 0, 1,201, 1,201, 1,201, 1,201, /* 0x a0 */ +193,225, 4,137,205,138, 28, 70,246,211, 49,201,232, 0, 0, 17, /* 0x b0 */ +201,117, 8, 65,232, 0, 0,115,251, 65, 65,129,253,209, 0,131, /* 0x c0 */ +217,254, 41,232,114, 14,142,216,141, 1, 40,252,150,243,164,150, /* 0x d0 */ +142,218,235, 0,209,224,209,224,209,224,209,224, 80, 49,192,142, /* 0x e0 */ +216, 88,193,224, 4,106, 0, 31, 1,216, 1,248,235, 0, 0,255, /* 0x f0 */ +117, 3,232, 6, 0, 17,201, 0,255,117, 0,138, 60, 17,246,115, /* 0x 100 */ + 5,128,198, 8,142,218,209,238, 70, 16,255,195,164, 0,255,117, /* 0x 110 */ + 3,232, 0, 0,114,246, 65,140,192, 1,255,115, 5,128,196, 8, /* 0x 120 */ +142,192,209,239,232, 0, 0,114, 10, 73,232, 0, 0, 17,201,121, /* 0x 130 */ +243,235, 0, 73, 73,116, 0, 1,201, 1,201, 1,201,193,225, 3, /* 0x 140 */ +137,205,138, 28, 70,246,211, 49,201,208,235,235, 3,232, 0, 0, /* 0x 150 */ + 17,201,232, 0, 0, 17,201,117, 8, 65,232, 0, 0,115,251, 65, /* 0x 160 */ + 65,131,253, 81,131,217,254, 41,232,114, 14,142,216,141, 1, 40, /* 0x 170 */ +252,150,243,164,150,142,218,235, 0,209,224,209,224,209,224,209, /* 0x 180 */ +224, 80, 49,192,142,216, 88,193,224, 4,106, 0, 31, 1,216, 1, /* 0x 190 */ +248,235, 0, 0,255,117, 3,232, 6, 0, 17,201, 0,255,117, 0, /* 0x 1a0 */ +138, 60, 17,246,115, 5,128,198, 8,142,218,209,238, 70, 16,255, /* 0x 1b0 */ +195,164, 0,255,117, 3,232, 0, 0,114,246, 65,140,192, 1,255, /* 0x 1c0 */ +115, 5,128,196, 8,142,192,209,239,232, 0, 0,114, 10, 73,232, /* 0x 1d0 */ + 0, 0, 17,201,121,243,235, 0, 73, 73,116, 0, 1,201, 1,201, /* 0x 1e0 */ + 1,201,193,225, 3,137,205,138, 28, 70,246,211, 49,201,208,235, /* 0x 1f0 */ +115, 12,232, 0, 0, 17,201,235, 18,232, 0, 0,114,244, 65,232, /* 0x 200 */ + 0, 0,114,238,232, 0, 0,115,251, 65, 65,131,253, 81,131,217, /* 0x 210 */ +253, 41,232,114, 14,142,216,141, 1, 40,252,150,243,164,150,142, /* 0x 220 */ +218,235, 0,209,224,209,224,209,224,209,224, 80, 49,192,142,216, /* 0x 230 */ + 88,193,224, 4,106, 0, 31, 1,216, 1,248,235, 0, 0,255,117, /* 0x 240 */ + 3,232, 6, 0, 17,201, 0,255,117, 0,138, 60, 17,246,115, 5, /* 0x 250 */ +128,198, 8,142,218,209,238, 70, 16,255,195, 93,140,192,128,236, /* 0x 260 */ + 6,142,216, 6, 31,141,181, 82, 83,173, 91,145,173,146,173,151, /* 0x 270 */ +173, 1,195,142,195, 49,192, 1,199, 38, 1, 45,172, 72,116, 0, /* 0x 280 */ + 64,117,244, 71, 71, 38,128, 61,154,117,249, 38, 57, 85, 3,119, /* 0x 290 */ +243,176, 3,235, 0,129,199,254, 0,114, 0,226, 0, 7, 6, 31, /* 0x 2a0 */ +157,114, 16, 7, 31, 93, 95, 94, 91, 88,142,208,137,220, 90, 89, /* 0x 2b0 */ + 91, 88,203,141,134, 83, 83,142,208,188, 83, 80,234, 73, 80, 67, /* 0x 2c0 */ + 83,129,197, 67, 83, 85,184, 73, 80, 80,203, 0, 68, 69, 86, 73, /* 0x 2d0 */ + 67, 69, 69, 78, 84, 82, 89, 0, 0, 0, 0, 0, 69, 88, 69, 69, /* 0x 2e0 */ + 78, 84, 82, 89, 0, 48, 0, 0, 0, 68, 69, 86, 73, 67, 69, 83, /* 0x 2f0 */ + 85, 66, 0, 76, 0, 0, 0, 69, 88, 69, 83, 85, 66, 0, 81, 0, /* 0x 300 */ + 0, 0, 74, 78, 67, 68, 79, 67, 79, 80, 89, 0, 86, 0, 0, 0, /* 0x 310 */ + 0, 0, 0, 0, 88, 0, 0, 0, 69, 88, 69, 69, 78, 84, 82, 89, /* 0x 320 */ + 0, 10, 0, 0, 0, 69, 88, 69, 82, 69, 76, 80, 85, 0, 91, 0, /* 0x 330 */ + 0, 0, 69, 88, 69, 77, 65, 73, 78, 52, 0, 92, 0, 0, 0, 85, /* 0x 340 */ + 80, 88, 49, 72, 69, 65, 68, 0,106, 0, 0, 0, 69, 88, 69, 67, /* 0x 350 */ + 85, 84, 80, 79, 0,133, 0, 0, 0, 78, 82, 86, 50, 66, 49, 54, /* 0x 360 */ + 83, 0,133, 0, 0, 0, 0, 0, 0, 0,141, 0, 0, 0, 78, 82, /* 0x 370 */ + 86, 50, 66, 69, 88, 51, 0, 19, 0, 0, 0, 78, 50, 66, 54, 52, /* 0x 380 */ + 75, 48, 49, 0,146, 0, 0, 0, 78, 82, 86, 50, 66, 69, 88, 49, /* 0x 390 */ + 0,157, 0, 0, 0, 0, 0, 0, 0,160, 0, 0, 0, 78, 82, 86, /* 0x 3a0 */ + 50, 66, 69, 88, 51, 0, 6, 0, 0, 0, 0, 0, 0, 0,162, 0, /* 0x 3b0 */ + 0, 0, 78, 82, 86, 50, 66, 69, 88, 57, 0, 4, 0, 0, 0, 0, /* 0x 3c0 */ + 0, 0, 0,168, 0, 0, 0, 78, 82, 86, 50, 66, 69, 88, 50, 0, /* 0x 3d0 */ + 9, 0, 0, 0, 78, 50, 66, 88, 56, 54, 48, 49, 0,168, 0, 0, /* 0x 3e0 */ + 0, 78, 50, 66, 50, 56, 54, 48, 49, 0,176, 0, 0, 0, 78, 82, /* 0x 3f0 */ + 86, 50, 66, 69, 88, 50, 0,179, 0, 0, 0, 0, 0, 0, 0,191, /* 0x 400 */ + 0, 0, 0, 78, 82, 86, 50, 66, 69, 88, 51, 0, 6, 0, 0, 0, /* 0x 410 */ + 0, 0, 0, 0,199, 0, 0, 0, 78, 82, 86, 50, 66, 69, 88, 51, /* 0x 420 */ + 0, 6, 0, 0, 0, 0, 0, 0, 0,228, 0, 0, 0, 78, 82, 86, /* 0x 430 */ + 50, 66, 49, 54, 83, 0, 1, 0, 0, 0, 78, 50, 66, 88, 56, 54, /* 0x 440 */ + 48, 50, 0,228, 0, 0, 0, 78, 50, 66, 50, 56, 54, 48, 50, 0, /* 0x 450 */ +242, 0, 0, 0, 78, 82, 86, 50, 66, 69, 88, 51, 0,248, 0, 0, /* 0x 460 */ + 0, 0, 0, 0, 0,254, 0, 0, 0, 78, 82, 86, 50, 66, 69, 88, /* 0x 470 */ + 50, 0, 39, 0, 0, 0, 0, 0, 0, 0, 11, 1, 0, 0, 78, 82, /* 0x 480 */ + 86, 50, 66, 69, 88, 57, 0, 3, 0, 0, 0, 78, 50, 66, 54, 52, /* 0x 490 */ + 75, 48, 50, 0, 13, 1, 0, 0, 78, 82, 86, 50, 66, 69, 88, 57, /* 0x 4a0 */ + 0, 24, 1, 0, 0, 78, 82, 86, 50, 66, 49, 54, 69, 0, 28, 1, /* 0x 4b0 */ + 0, 0, 78, 82, 86, 50, 68, 49, 54, 83, 0, 28, 1, 0, 0, 0, /* 0x 4c0 */ + 0, 0, 0, 36, 1, 0, 0, 78, 82, 86, 50, 68, 69, 88, 51, 0, /* 0x 4d0 */ + 19, 0, 0, 0, 78, 50, 68, 54, 52, 75, 48, 49, 0, 41, 1, 0, /* 0x 4e0 */ + 0, 78, 82, 86, 50, 68, 69, 88, 49, 0, 52, 1, 0, 0, 0, 0, /* 0x 4f0 */ + 0, 0, 55, 1, 0, 0, 78, 82, 86, 50, 68, 69, 88, 51, 0, 6, /* 0x 500 */ + 0, 0, 0, 0, 0, 0, 0, 61, 1, 0, 0, 78, 82, 86, 50, 68, /* 0x 510 */ + 69, 88, 51, 0, 15, 0, 0, 0, 0, 0, 0, 0, 67, 1, 0, 0, /* 0x 520 */ + 78, 82, 86, 50, 68, 69, 88, 57, 0, 4, 0, 0, 0, 0, 0, 0, /* 0x 530 */ + 0, 71, 1, 0, 0, 78, 82, 86, 50, 68, 69, 88, 50, 0, 13, 0, /* 0x 540 */ + 0, 0, 78, 50, 68, 88, 56, 54, 48, 49, 0, 71, 1, 0, 0, 78, /* 0x 550 */ + 50, 68, 50, 56, 54, 48, 49, 0, 77, 1, 0, 0, 78, 82, 86, 50, /* 0x 560 */ + 68, 69, 88, 50, 0, 80, 1, 0, 0, 0, 0, 0, 0, 96, 1, 0, /* 0x 570 */ + 0, 78, 82, 86, 50, 68, 69, 88, 51, 0, 15, 0, 0, 0, 0, 0, /* 0x 580 */ + 0, 0,101, 1, 0, 0, 78, 82, 86, 50, 68, 69, 88, 51, 0, 15, /* 0x 590 */ + 0, 0, 0, 0, 0, 0, 0,109, 1, 0, 0, 78, 82, 86, 50, 68, /* 0x 5a0 */ + 69, 88, 51, 0, 6, 0, 0, 0, 0, 0, 0, 0,137, 1, 0, 0, /* 0x 5b0 */ + 78, 82, 86, 50, 68, 49, 54, 83, 0, 1, 0, 0, 0, 78, 50, 68, /* 0x 5c0 */ + 88, 56, 54, 48, 50, 0,137, 1, 0, 0, 78, 50, 68, 50, 56, 54, /* 0x 5d0 */ + 48, 50, 0,151, 1, 0, 0, 78, 82, 86, 50, 68, 69, 88, 51, 0, /* 0x 5e0 */ +157, 1, 0, 0, 0, 0, 0, 0,163, 1, 0, 0, 78, 82, 86, 50, /* 0x 5f0 */ + 68, 69, 88, 50, 0, 47, 0, 0, 0, 0, 0, 0, 0,176, 1, 0, /* 0x 600 */ + 0, 78, 82, 86, 50, 68, 69, 88, 57, 0, 3, 0, 0, 0, 78, 50, /* 0x 610 */ + 68, 54, 52, 75, 48, 50, 0,178, 1, 0, 0, 78, 82, 86, 50, 68, /* 0x 620 */ + 69, 88, 57, 0,189, 1, 0, 0, 78, 82, 86, 50, 68, 49, 54, 69, /* 0x 630 */ + 0,193, 1, 0, 0, 78, 82, 86, 50, 69, 49, 54, 83, 0,193, 1, /* 0x 640 */ + 0, 0, 0, 0, 0, 0,201, 1, 0, 0, 78, 82, 86, 50, 69, 69, /* 0x 650 */ + 88, 51, 0, 19, 0, 0, 0, 78, 50, 69, 54, 52, 75, 48, 49, 0, /* 0x 660 */ +206, 1, 0, 0, 78, 82, 86, 50, 69, 69, 88, 49, 0,217, 1, 0, /* 0x 670 */ + 0, 0, 0, 0, 0,220, 1, 0, 0, 78, 82, 86, 50, 69, 69, 88, /* 0x 680 */ + 51, 0, 6, 0, 0, 0, 0, 0, 0, 0,226, 1, 0, 0, 78, 82, /* 0x 690 */ + 86, 50, 69, 69, 88, 51, 0, 15, 0, 0, 0, 0, 0, 0, 0,232, /* 0x 6a0 */ + 1, 0, 0, 78, 82, 86, 50, 69, 69, 88, 57, 0, 4, 0, 0, 0, /* 0x 6b0 */ + 0, 0, 0, 0,236, 1, 0, 0, 78, 82, 86, 50, 69, 69, 88, 50, /* 0x 6c0 */ + 0, 20, 0, 0, 0, 78, 50, 69, 88, 56, 54, 48, 49, 0,236, 1, /* 0x 6d0 */ + 0, 0, 78, 50, 69, 50, 56, 54, 48, 49, 0,242, 1, 0, 0, 78, /* 0x 6e0 */ + 82, 86, 50, 69, 69, 88, 50, 0,245, 1, 0, 0, 0, 0, 0, 0, /* 0x 6f0 */ + 5, 2, 0, 0, 78, 82, 86, 50, 69, 69, 88, 51, 0, 15, 0, 0, /* 0x 700 */ + 0, 0, 0, 0, 0, 12, 2, 0, 0, 78, 82, 86, 50, 69, 69, 88, /* 0x 710 */ + 51, 0, 15, 0, 0, 0, 0, 0, 0, 0, 18, 2, 0, 0, 78, 82, /* 0x 720 */ + 86, 50, 69, 69, 88, 51, 0, 15, 0, 0, 0, 0, 0, 0, 0, 23, /* 0x 730 */ + 2, 0, 0, 78, 82, 86, 50, 69, 69, 88, 51, 0, 6, 0, 0, 0, /* 0x 740 */ + 0, 0, 0, 0, 51, 2, 0, 0, 78, 82, 86, 50, 69, 49, 54, 83, /* 0x 750 */ + 0, 1, 0, 0, 0, 78, 50, 69, 88, 56, 54, 48, 50, 0, 51, 2, /* 0x 760 */ + 0, 0, 78, 50, 69, 50, 56, 54, 48, 50, 0, 65, 2, 0, 0, 78, /* 0x 770 */ + 82, 86, 50, 69, 69, 88, 51, 0, 71, 2, 0, 0, 0, 0, 0, 0, /* 0x 780 */ + 77, 2, 0, 0, 78, 82, 86, 50, 69, 69, 88, 50, 0, 52, 0, 0, /* 0x 790 */ + 0, 0, 0, 0, 0, 90, 2, 0, 0, 78, 82, 86, 50, 69, 69, 88, /* 0x 7a0 */ + 57, 0, 3, 0, 0, 0, 78, 50, 69, 54, 52, 75, 48, 50, 0, 92, /* 0x 7b0 */ + 2, 0, 0, 78, 82, 86, 50, 69, 69, 88, 57, 0,103, 2, 0, 0, /* 0x 7c0 */ + 78, 82, 86, 50, 69, 49, 54, 69, 0,107, 2, 0, 0, 69, 88, 69, /* 0x 7d0 */ + 77, 65, 73, 78, 53, 0,107, 2, 0, 0, 69, 88, 69, 82, 69, 76, /* 0x 7e0 */ + 79, 67, 0,108, 2, 0, 0, 69, 88, 69, 65, 68, 74, 85, 83, 0, /* 0x 7f0 */ +108, 2, 0, 0, 69, 88, 69, 78, 79, 65, 68, 74, 0,115, 2, 0, /* 0x 800 */ + 0, 69, 88, 69, 82, 69, 76, 79, 49, 0,117, 2, 0, 0, 0, 0, /* 0x 810 */ + 0, 0,144, 2, 0, 0, 69, 88, 69, 82, 69, 76, 79, 50, 0, 0, /* 0x 820 */ + 0, 0, 0, 69, 88, 69, 82, 69, 76, 57, 65, 0,147, 2, 0, 0, /* 0x 830 */ + 0, 0, 0, 0,165, 2, 0, 0, 69, 88, 69, 82, 69, 76, 79, 49, /* 0x 840 */ + 0, 18, 0, 0, 0, 69, 88, 69, 82, 69, 76, 79, 50, 0,165, 2, /* 0x 850 */ + 0, 0, 69, 88, 69, 82, 69, 66, 73, 71, 0,169, 2, 0, 0, 0, /* 0x 860 */ + 0, 0, 0,171, 2, 0, 0, 69, 88, 69, 82, 69, 76, 79, 49, 0, /* 0x 870 */ + 9, 0, 0, 0, 69, 88, 69, 82, 69, 76, 79, 51, 0,171, 2, 0, /* 0x 880 */ + 0, 0, 0, 0, 0,173, 2, 0, 0, 69, 88, 69, 82, 69, 76, 79, /* 0x 890 */ + 49, 0, 23, 0, 0, 0, 69, 88, 69, 77, 65, 73, 78, 56, 0,173, /* 0x 8a0 */ + 2, 0, 0, 68, 69, 86, 73, 67, 69, 69, 78, 68, 0,176, 2, 0, /* 0x 8b0 */ + 0, 69, 88, 69, 83, 84, 65, 67, 75, 0,195, 2, 0, 0, 69, 88, /* 0x 8c0 */ + 69, 68, 85, 77, 77, 83, 0,201, 2, 0, 0, 69, 88, 69, 83, 84, /* 0x 8d0 */ + 65, 83, 80, 0,201, 2, 0, 0, 69, 88, 69, 68, 85, 77, 77, 80, /* 0x 8e0 */ + 0,204, 2, 0, 0, 69, 88, 69, 74, 85, 77, 80, 70, 0,204, 2, /* 0x 8f0 */ + 0, 0, 69, 88, 69, 82, 69, 84, 85, 82, 0,209, 2, 0, 0, 69, /* 0x 900 */ + 88, 69, 82, 67, 83, 80, 79, 0,209, 2, 0, 0, 69, 88, 69, 82, /* 0x 910 */ + 69, 84, 73, 80, 0,213, 2, 0, 0, 69, 88, 69, 68, 85, 77, 77, /* 0x 920 */ + 90, 0,219, 2, 0, 0, 69, 88, 69, 84, 72, 69, 78, 68, 0,219, /* 0x 930 */ + 2, 0, 0,255,255,255,255,219, 2 /* 0x 940 */ +}; diff --git a/src/stub/i086-dos16.sys.h b/src/stub/i086-dos16.sys.h new file mode 100644 index 00000000..6893fa6d --- /dev/null +++ b/src/stub/i086-dos16.sys.h @@ -0,0 +1,97 @@ +/* i086-dos16.sys.h -- created from i086-dos16.sys.bin, 991 (0x3df) 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 + + */ + + +#define NRV2B_LOADER_SIZE 991 +#define NRV2B_LOADER_ADLER32 0xf335eb3a +#define NRV2B_LOADER_CRC32 0x21f25aa3 + +unsigned char nrv2b_loader[991] = { +255,255,255,255, 0, 0, 10, 0, 0, 0, 96, 80, 83, 81, 82, 86, /* 0x 0 */ + 87, 85,190, 83, 73,191, 68, 73,137,241, 6, 30, 7,253,243,164, /* 0x 10 */ +252,187, 0,128,135,247,131,238,187, 25,237, 87,233, 74, 77, 85, /* 0x 20 */ + 80, 88, 33,161,216,208,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 30 */ + 0, 0, 0, 0, 45,164,232, 0, 0,114,250, 65,232, 0, 0,227, /* 0x 40 */ + 0,227, 0,115, 0,131,233, 3,114, 6,136,204,172,247,208,149, /* 0x 50 */ + 49,201,232, 0, 0, 17,201,117, 8, 65,232, 0, 0,115,251, 65, /* 0x 60 */ + 65, 65,129,253, 0,243,131,209, 1,141, 3,150,243,164,150,235, /* 0x 70 */ + 0,232, 2, 0, 17,201, 1,219,117, 4,173, 17,192,147,195, 94, /* 0x 80 */ +185, 67, 84,172, 44,232, 60, 1,119,249,193, 4, 8, 41, 52,139, /* 0x 90 */ + 28,134,223, 41,243,137, 28,173,226, 0,176,232,176,233, 95,185, /* 0x a0 */ + 67, 84,242,174,117, 0,117, 0,193, 5, 8, 41, 61,139, 29,134, /* 0x b0 */ +223, 41,251,137, 29,175,235, 0, 7, 97, 93, 95, 94, 90, 89, 91, /* 0x c0 */ + 88,233, 74, 79, 83, 89, 83, 77, 65, 73, 78, 49, 0, 0, 0, 0, /* 0x d0 */ + 0, 83, 89, 83, 73, 50, 56, 54, 49, 0, 10, 0, 0, 0, 83, 89, /* 0x e0 */ + 83, 73, 48, 56, 54, 49, 0, 11, 0, 0, 0, 83, 89, 83, 77, 65, /* 0x f0 */ + 73, 78, 50, 0, 18, 0, 0, 0, 83, 89, 83, 83, 85, 66, 83, 73, /* 0x 100 */ + 0, 41, 0, 0, 0, 83, 89, 83, 83, 66, 66, 66, 80, 0, 41, 0, /* 0x 110 */ + 0, 0, 83, 89, 83, 67, 65, 76, 76, 84, 0, 43, 0, 0, 0, 83, /* 0x 120 */ + 89, 83, 77, 65, 73, 78, 51, 0, 44, 0, 0, 0, 85, 80, 88, 49, /* 0x 130 */ + 72, 69, 65, 68, 0, 47, 0, 0, 0, 83, 89, 83, 67, 85, 84, 80, /* 0x 140 */ + 79, 0, 69, 0, 0, 0, 78, 82, 86, 50, 66, 49, 54, 48, 0, 69, /* 0x 150 */ + 0, 0, 0, 0, 0, 0, 0, 73, 0, 0, 0, 78, 82, 86, 68, 69, /* 0x 160 */ + 67, 79, 50, 0, 13, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, /* 0x 170 */ + 78, 82, 86, 68, 69, 67, 79, 50, 0, 8, 0, 0, 0, 78, 82, 86, /* 0x 180 */ + 68, 68, 79, 78, 69, 0, 79, 0, 0, 0, 0, 0, 0, 0, 81, 0, /* 0x 190 */ + 0, 0, 78, 82, 86, 68, 69, 67, 79, 50, 0, 22, 0, 0, 0, 78, /* 0x 1a0 */ + 82, 86, 68, 82, 69, 84, 85, 0, 81, 0, 0, 0, 0, 0, 0, 0, /* 0x 1b0 */ + 83, 0, 0, 0, 78, 82, 86, 68, 69, 67, 79, 50, 0, 21, 0, 0, /* 0x 1c0 */ + 0, 78, 82, 86, 68, 69, 67, 79, 49, 0, 83, 0, 0, 0, 0, 0, /* 0x 1d0 */ + 0, 0, 85, 0, 0, 0, 78, 82, 86, 50, 66, 49, 54, 48, 0, 7, /* 0x 1e0 */ + 0, 0, 0, 0, 0, 0, 0,101, 0, 0, 0, 78, 82, 86, 68, 69, /* 0x 1f0 */ + 67, 79, 50, 0, 8, 0, 0, 0, 0, 0, 0, 0,109, 0, 0, 0, /* 0x 200 */ + 78, 82, 86, 68, 69, 67, 79, 50, 0, 8, 0, 0, 0, 78, 82, 86, /* 0x 210 */ + 76, 69, 68, 48, 48, 0,113, 0, 0, 0, 78, 82, 86, 71, 84, 68, /* 0x 220 */ + 48, 48, 0,114, 0, 0, 0, 78, 82, 86, 68, 69, 67, 79, 50, 0, /* 0x 230 */ +121, 0, 0, 0, 0, 0, 0, 0,129, 0, 0, 0, 78, 82, 86, 50, /* 0x 240 */ + 66, 49, 54, 48, 0, 1, 0, 0, 0, 78, 82, 86, 50, 66, 49, 54, /* 0x 250 */ + 57, 0,143, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 54, 0,143, /* 0x 260 */ + 0, 0, 0, 67, 84, 49, 54, 73, 50, 56, 54, 0,154, 0, 0, 0, /* 0x 270 */ + 67, 84, 49, 54, 83, 85, 66, 48, 0,157, 0, 0, 0, 67, 84, 49, /* 0x 280 */ + 54, 73, 48, 56, 54, 0,159, 0, 0, 0, 67, 65, 76, 76, 84, 82, /* 0x 290 */ + 73, 50, 0,167, 0, 0, 0, 0, 0, 0, 0,170, 0, 0, 0, 67, /* 0x 2a0 */ + 65, 76, 76, 84, 82, 49, 54, 0, 4, 0, 0, 0, 67, 84, 49, 54, /* 0x 2b0 */ + 68, 85, 77, 49, 0,170, 0, 0, 0, 67, 84, 49, 54, 69, 56, 48, /* 0x 2c0 */ + 48, 0,170, 0, 0, 0, 67, 84, 49, 54, 69, 57, 48, 48, 0,172, /* 0x 2d0 */ + 0, 0, 0, 67, 65, 76, 76, 84, 82, 73, 53, 0,174, 0, 0, 0, /* 0x 2e0 */ + 67, 84, 49, 54, 74, 69, 78, 68, 0,180, 0, 0, 0, 0, 0, 0, /* 0x 2f0 */ + 0,182, 0, 0, 0, 78, 82, 86, 68, 69, 67, 79, 50, 0, 21, 0, /* 0x 300 */ + 0, 0, 67, 84, 49, 54, 74, 85, 76, 50, 0,182, 0, 0, 0, 0, /* 0x 310 */ + 0, 0, 0,184, 0, 0, 0, 67, 65, 76, 76, 84, 82, 73, 54, 0, /* 0x 320 */ + 3, 0, 0, 0, 67, 84, 49, 54, 68, 85, 77, 50, 0,184, 0, 0, /* 0x 330 */ + 0, 67, 84, 49, 54, 73, 50, 56, 55, 0,184, 0, 0, 0, 67, 84, /* 0x 340 */ + 49, 54, 83, 85, 66, 49, 0,187, 0, 0, 0, 67, 84, 49, 54, 73, /* 0x 350 */ + 48, 56, 55, 0,189, 0, 0, 0, 67, 65, 76, 76, 84, 82, 73, 54, /* 0x 360 */ + 0,197, 0, 0, 0, 0, 0, 0, 0,200, 0, 0, 0, 67, 65, 76, /* 0x 370 */ + 76, 84, 82, 73, 53, 0, 4, 0, 0, 0, 67, 84, 49, 54, 68, 85, /* 0x 380 */ + 77, 77, 51, 0,200, 0, 0, 0, 83, 89, 83, 77, 65, 73, 78, 53, /* 0x 390 */ + 0,200, 0, 0, 0, 83, 89, 83, 73, 50, 56, 54, 50, 0,201, 0, /* 0x 3a0 */ + 0, 0, 83, 89, 83, 73, 48, 56, 54, 50, 0,202, 0, 0, 0, 83, /* 0x 3b0 */ + 89, 83, 74, 85, 77, 80, 49, 0,209, 0, 0, 0, 83, 89, 83, 84, /* 0x 3c0 */ + 72, 69, 78, 68, 0,212, 0, 0, 0,255,255,255,255,212, 0 /* 0x 3d0 */ +}; diff --git a/src/stub/i386-dos32.djgpp2-stubify.h b/src/stub/i386-dos32.djgpp2-stubify.h new file mode 100644 index 00000000..3b904853 --- /dev/null +++ b/src/stub/i386-dos32.djgpp2-stubify.h @@ -0,0 +1,134 @@ +#define STUBIFY_STUB_SIZE 2048 +#define STUBIFY_STUB_ADLER32 0xbf689ba8 +#define STUBIFY_STUB_CRC32 0x2ae982b2 + +unsigned char stubify_stub[2048] = { + 77, 90, 0, 0, 4, 0, 0, 0, 32, 0, 39, 0,255,255, 0, 0, /* 0x 0 */ + 96, 7, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 10 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 20 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 30 */ + 13, 10,115,116,117, 98, 46,104, 32,103,101,110,101,114, 97,116, /* 0x 40 */ +101,100, 32,102,114,111,109, 32,115,116,117, 98, 46, 97,115,109, /* 0x 50 */ + 32, 98,121, 32,100,106, 97,115,109, 44, 32,111,110, 32, 83,117, /* 0x 60 */ +110, 32, 78,111,118, 32, 51, 48, 32, 49, 57, 58, 51, 51, 58, 51, /* 0x 70 */ + 48, 32, 50, 48, 48, 51, 13, 10, 84,104,101, 32, 83, 84, 85, 66, /* 0x 80 */ + 46, 69, 88, 69, 32,115,116,117, 98, 32,108,111, 97,100,101,114, /* 0x 90 */ + 32,105,115, 32, 67,111,112,121,114,105,103,104,116, 32, 40, 67, /* 0x a0 */ + 41, 32, 49, 57, 57, 51, 45, 49, 57, 57, 53, 32, 68, 74, 32, 68, /* 0x b0 */ +101,108,111,114,105,101, 46, 32, 13, 10, 80,101,114,109,105,115, /* 0x c0 */ +115,105,111,110, 32,103,114, 97,110,116,101,100, 32,116,111, 32, /* 0x d0 */ +117,115,101, 32,102,111,114, 32, 97,110,121, 32,112,117,114,112, /* 0x e0 */ +111,115,101, 32,112,114,111,118,105,100,101,100, 32,116,104,105, /* 0x f0 */ +115, 32, 99,111,112,121,114,105,103,104,116, 32, 13, 10,114,101, /* 0x 100 */ +109, 97,105,110,115, 32,112,114,101,115,101,110,116, 32, 97,110, /* 0x 110 */ +100, 32,117,110,109,111,100,105,102,105,101,100, 46, 32, 13, 10, /* 0x 120 */ + 84,104,105,115, 32,111,110,108,121, 32, 97,112,112,108,105,101, /* 0x 130 */ +115, 32,116,111, 32,116,104,101, 32,115,116,117, 98, 44, 32, 97, /* 0x 140 */ +110,100, 32,110,111,116, 32,110,101, 99,101,115,115, 97,114,105, /* 0x 150 */ +108,121, 32,116,104,101, 32,119,104,111,108,101, 32,112,114,111, /* 0x 160 */ +103,114, 97,109, 46, 10, 13, 10, 36, 73,100, 58, 32,115,116,117, /* 0x 170 */ + 98, 46, 97,115,109, 32, 98,117,105,108,116, 32, 50, 48, 48, 51, /* 0x 180 */ + 45, 49, 49, 45, 51, 48, 32, 49, 57, 58, 51, 51, 58, 51, 48, 32, /* 0x 190 */ + 98,121, 32,100,106, 97,115,109, 32, 36, 10, 13, 10, 64, 40, 35, /* 0x 1a0 */ + 41, 32,115,116,117, 98, 46, 97,115,109, 32, 98,117,105,108,116, /* 0x 1b0 */ + 32, 50, 48, 48, 51, 45, 49, 49, 45, 51, 48, 32, 49, 57, 58, 51, /* 0x 1c0 */ + 51, 58, 51, 48, 32, 98,121, 32,100,106, 97,115,109, 10, 13, 10, /* 0x 1d0 */ + 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 1e0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 1f0 */ +103,111, 51, 50,115,116,117, 98, 44, 32,118, 32, 50, 46, 48, 52, /* 0x 200 */ + 84, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 210 */ + 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 220 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 230 */ + 0, 0, 0, 0, 67, 87, 83, 68, 80, 77, 73, 46, 69, 88, 69, 0, /* 0x 240 */ + 0, 0, 0, 0, 14, 31,140, 30, 36, 0,140, 6, 96, 7,252,180, /* 0x 250 */ + 48,205, 33, 60, 3,115, 8,176,109,186,169, 5,233,209, 3,162, /* 0x 260 */ +105, 8,190, 32, 0,139, 4, 9,192,117, 2,180,254,187,112, 8, /* 0x 270 */ + 57,195,115, 2,137,195,137, 28,254,199,185, 4,255,211,235,180, /* 0x 280 */ + 74,205, 33,115, 8,211,227,254,207,137, 28,235,216, 38,142, 6, /* 0x 290 */ + 44, 0, 49,255, 48,192,169,242,174, 38,129, 61, 80, 65,117, 21, /* 0x 2a0 */ +175, 38,129, 61, 84, 72,117, 13,175, 38,128, 61, 61,117, 6, 71, /* 0x 2b0 */ +137, 62,137, 4, 79,174,117,223,175,180, 62,187, 19, 0,205, 33, /* 0x 2c0 */ +180, 62,187, 18, 0,205, 33, 6, 87, 49,201,116, 18,176,110,186, /* 0x 2d0 */ +128, 5,233, 91, 3, 9,201,117,244, 65,232,158, 3,114,238,184, /* 0x 2e0 */ +135, 22,205, 47, 9,192,117,237,128,227, 1,116,232,137, 62, 0, /* 0x 2f0 */ + 6,140, 6, 2, 6,137, 54, 4, 6, 95, 7,232,208, 2,137, 62, /* 0x 300 */ + 42, 0,137, 54, 98, 7,128, 62, 44, 0, 0,116, 35,185, 8, 0, /* 0x 310 */ +191, 44, 0,138, 5, 71, 8,192,116, 5,136, 7, 67,226,244,102, /* 0x 320 */ +199, 7, 46, 69, 88, 69,131,195, 4,198, 7, 0,137, 30, 98, 7, /* 0x 330 */ +184, 0, 61,186,100, 7,205, 33, 15,130,176, 2,163, 6, 6,137, /* 0x 340 */ +195,185, 6, 0,186,181, 7,180, 63,205, 33, 49,210, 49,201,161, /* 0x 350 */ +181, 7, 61, 76, 1,116, 27, 61, 77, 90, 15,133,149, 2,139, 22, /* 0x 360 */ +185, 7,193,226, 9,139, 30,183, 7, 9,219,116, 5,128,238, 2, /* 0x 370 */ + 1,218,137, 22,187, 7,137, 14,189, 7,184, 0, 66,139, 30, 6, /* 0x 380 */ + 6,205, 33,185,168, 0,186,191, 7,180, 63,205, 33, 61,168, 0, /* 0x 390 */ +117, 6,129, 62,191, 7, 76, 1, 15,133, 94, 2,102,161,227, 7, /* 0x 3a0 */ +102,163, 16, 6,102,139, 14,187, 7,102,161, 3, 8,102, 1,200, /* 0x 3b0 */ +102,163, 8, 6,102, 3, 14, 43, 8,102,137, 14, 12, 6,102,139, /* 0x 3c0 */ + 30, 75, 8,102, 3, 30, 79, 8,102,184, 1, 0, 1, 0,102, 57, /* 0x 3d0 */ +195,115, 3,102,137,195,102,129,195,255,255, 0, 0, 49,219,102, /* 0x 3e0 */ +137, 30, 28, 0,232,250, 2,139, 30, 4, 6, 9,219,116, 10,180, /* 0x 3f0 */ + 72,205, 33, 15,130, 21, 2,142,192,232, 13, 3,184, 1, 0,255, /* 0x 400 */ + 30, 0, 6, 15,130, 15, 2,140, 6, 38, 0,140, 14, 40, 0,140, /* 0x 410 */ +216,163, 34, 0,142,192, 49,192,185, 1, 0,205, 49,114, 7,163, /* 0x 420 */ + 20, 6, 49,192,205, 49, 15,130,243, 1,163, 22, 6,102,139, 14, /* 0x 430 */ + 28, 0,184, 1, 5,139, 30, 30, 0,205, 49, 15,130,229, 1,137, /* 0x 440 */ + 30, 26, 6,137, 14, 24, 6,137, 54, 26, 0,137, 62, 24, 0,184, /* 0x 450 */ + 7, 0,139, 30, 20, 6,139, 14, 26, 6,139, 22, 24, 6,205, 49, /* 0x 460 */ +184, 9, 0,140,201,131,225, 3,193,225, 5, 81,129,201,155,192, /* 0x 470 */ +205, 49,184, 8, 0,139, 14, 30, 0, 73,186,255,255,205, 49,184, /* 0x 480 */ + 7, 0,139, 30, 22, 6,139, 14, 26, 6,139, 22, 24, 6,205, 49, /* 0x 490 */ +184, 9, 0, 89,129,201,147,192,205, 49,184, 8, 0,139, 14, 30, /* 0x 4a0 */ + 0, 73,186,255,255,205, 49,184, 0, 1,187, 0, 15,205, 49,115, /* 0x 4b0 */ + 16, 61, 8, 0, 15,133,115, 1,184, 0, 1,205, 49, 15,130,106, /* 0x 4c0 */ + 1,163, 28, 6,137, 22, 30, 6,193,227, 4,137, 30, 32, 6,102, /* 0x 4d0 */ +139, 54, 8, 6,102,139, 62,251, 7,102,139, 14,255, 7,232, 73, /* 0x 4e0 */ + 0,102,139, 54, 12, 6,102,139, 62, 35, 8,102,139, 14, 39, 8, /* 0x 4f0 */ +232, 55, 0,142, 6, 22, 6,102,139, 62, 75, 8,102,139, 14, 79, /* 0x 500 */ + 8,102, 49,192,102,193,233, 2,103,243,102,171,180, 62,139, 30, /* 0x 510 */ + 6, 6,205, 33,184, 1, 1,139, 22, 30, 6,205, 49, 30, 15,161, /* 0x 520 */ +142, 30, 22, 6,102,100,255, 46, 16, 6,102,137,240,102, 37,255, /* 0x 530 */ + 1, 0, 0,102, 1,193, 41,198,102, 41,199,102,137, 14, 38, 6, /* 0x 540 */ +102,137, 62, 34, 6,232, 15, 1,137, 54, 62, 6,102,193,238, 16, /* 0x 550 */ +137, 54, 66, 6,139, 30, 6, 6,137, 30, 58, 6,199, 6, 70, 6, /* 0x 560 */ + 0, 66,232, 3, 1,161, 28, 6,163, 78, 6,199, 6, 62, 6, 0, /* 0x 570 */ + 0,198, 6, 71, 6, 63,161, 40, 6, 9,192,117, 9,161, 38, 6, /* 0x 580 */ + 59, 6, 32, 6,118, 3,161, 32, 6,163, 66, 6,232,217, 0,102, /* 0x 590 */ + 49,201,139, 14, 70, 6,102,139, 62, 34, 6,102, 1, 14, 34, 6, /* 0x 5a0 */ +102, 41, 14, 38, 6,102, 49,246,193,233, 2, 30, 6,142, 6, 22, /* 0x 5b0 */ + 6,142, 30, 30, 6,103,243,102,165, 7, 31,102, 3, 14, 38, 6, /* 0x 5c0 */ +117,175,195, 60, 58,116, 6, 60, 47,116, 2, 60, 92,195,190,100, /* 0x 5d0 */ + 7,137,243, 38,138, 5, 71,136, 4, 56,224,116, 14, 8,192,116, /* 0x 5e0 */ + 10, 70,232,222,255,117,236,137,243,116,232,195,176,102,186, 74, /* 0x 5f0 */ + 5,235, 12,176,103,186, 87, 5,235, 5,176,104,186, 97, 5, 82, /* 0x 600 */ +139, 30, 98, 7,198, 7, 36,187,100, 7,235, 40,232,250, 0,176, /* 0x 610 */ +105,186,155, 5,235, 26,176,106,186,180, 5,235, 19,176,107,186, /* 0x 620 */ +198, 5,235, 12,176,108,186,216, 5,235, 5,176,105,186,155, 5, /* 0x 630 */ + 82,187, 61, 5,232, 21, 0, 91,232, 17, 0,187,100, 4,232, 11, /* 0x 640 */ + 0,180, 76,205, 33, 67, 80,180, 2,205, 33, 88,138, 23,128,250, /* 0x 650 */ + 36,117,242,195, 13, 10, 36, 80, 81, 87, 49,192,191, 42, 6,185, /* 0x 660 */ + 25, 0,243,171, 95, 89, 88,195,184, 0, 3,187, 33, 0, 49,201, /* 0x 670 */ +102,191, 42, 6, 0, 0,205, 49,195, 0, 0, 48,228,232, 78,255, /* 0x 680 */ +137,222,139, 62,137, 4,235, 28,180, 59,232, 65,255, 8,192,117, /* 0x 690 */ + 1, 79,129,254,100, 7,116, 18,138, 68,255,232, 37,255,116, 4, /* 0x 6a0 */ +198, 4, 92, 70,232, 3, 0,114,223,195,232, 52, 0,187, 68, 0, /* 0x 6b0 */ +138, 7,136, 4, 67, 70, 8,192,117,246, 6, 87, 30, 7,232,150, /* 0x 6c0 */ +255,187, 42, 6,140, 95, 4,137, 95, 2,186,100, 7,184, 0, 75, /* 0x 6d0 */ +205, 33, 95, 7,114, 9,180, 77,205, 33, 45, 0, 3,247,216,235, /* 0x 6e0 */ + 40,128, 62,105, 8, 5,114, 32,184, 0, 88,205, 33,162,103, 8, /* 0x 6f0 */ +184, 2, 88,205, 33,162,104, 8,184, 1, 88,187,128, 0,205, 33, /* 0x 700 */ +184, 3, 88,187, 1, 0,205, 33,195,156,128, 62,105, 8, 5,114, /* 0x 710 */ + 26, 80, 83,184, 3, 88,138, 30,104, 8, 48,255,205, 33,184, 1, /* 0x 720 */ + 88,138, 30,103, 8, 48,255,205, 33, 91, 88,157,195, 76,111, 97, /* 0x 730 */ +100, 32,101,114,114,111,114, 58, 32, 36, 58, 32, 99, 97,110, 39, /* 0x 740 */ +116, 32,111,112,101,110, 36, 58, 32,110,111,116, 32, 69, 88, 69, /* 0x 750 */ + 36, 58, 32,110,111,116, 32, 67, 79, 70, 70, 32, 40, 67,104,101, /* 0x 760 */ + 99,107, 32,102,111,114, 32,118,105,114,117,115,101,115, 41, 36, /* 0x 770 */ +110,111, 32, 68, 80, 77, 73, 32, 45, 32, 71,101,116, 32, 99,115, /* 0x 780 */ +100,112,109,105, 42, 98, 46,122,105,112, 36,110,111, 32, 68, 79, /* 0x 790 */ + 83, 32,109,101,109,111,114,121, 36,110,101,101,100, 32, 68, 79, /* 0x 7a0 */ + 83, 32, 51, 36, 99, 97,110, 39,116, 32,115,119,105,116, 99,104, /* 0x 7b0 */ + 32,109,111,100,101, 36,110,111, 32, 68, 80, 77, 73, 32,115,101, /* 0x 7c0 */ +108,101, 99,116,111,114,115, 36,110,111, 32, 68, 80, 77, 73, 32, /* 0x 7d0 */ +109,101,109,111,114,121, 36,144,144,144,144,144,144,144,144,144, /* 0x 7e0 */ +144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144 /* 0x 7f0 */ +}; diff --git a/src/stub/i386-dos32.djgpp2.h b/src/stub/i386-dos32.djgpp2.h new file mode 100644 index 00000000..6340956f --- /dev/null +++ b/src/stub/i386-dos32.djgpp2.h @@ -0,0 +1,239 @@ +/* i386-dos32.djgpp2.h -- created from i386-dos32.djgpp2.bin, 3264 (0xcc0) 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 + + */ + + +#define NRV_LOADER_SIZE 3264 +#define NRV_LOADER_ADLER32 0xe891ee39 +#define NRV_LOADER_CRC32 0x660f0858 + +unsigned char nrv_loader[3264] = { + 30, 7,190, 73, 78, 80, 80,191, 79, 85, 84, 80, 87,131,205,255, /* 0x 0 */ +235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, /* 0x 10 */ + 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, /* 0x 20 */ + 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 30 */ +192, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219, /* 0x 40 */ +115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 49,201,131, /* 0x 50 */ +232, 3,114, 13,193,224, 8,138, 6, 70,131,240,255,116, 0,137, /* 0x 60 */ +197, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219, /* 0x 70 */ +117, 7,139, 30,131,238,252, 17,219, 17,201,117, 0, 65, 1,219, /* 0x 80 */ +117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, 7,139, /* 0x 90 */ + 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, 9,139, 30, /* 0x a0 */ +131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129,253, 0,243, /* 0x b0 */ +255,255,131,209, 1, 86,141, 52, 47,243,164, 94,233, 0, 0, 0, /* 0x c0 */ + 0,141, 20, 47,131,253,252,138, 4, 15,118, 0,138, 2, 66,136, /* 0x d0 */ + 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, 4,137, /* 0x e0 */ + 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, 0, 0, 0, /* 0x f0 */ +235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, /* 0x 100 */ + 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, /* 0x 110 */ + 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 120 */ +192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 1,219, /* 0x 130 */ +115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, 72, 1,219, /* 0x 140 */ +117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, 49,201,131, /* 0x 150 */ +232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, 0,209, /* 0x 160 */ +248,137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 170 */ + 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, /* 0x 180 */ + 0, 65, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1, /* 0x 190 */ +219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0, /* 0x 1a0 */ +117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2, /* 0x 1b0 */ +129,253, 0,251,255,255,131,209, 1, 86,141, 52, 47,243,164, 94, /* 0x 1c0 */ +233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0, /* 0x 1d0 */ +138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2, /* 0x 1e0 */ +131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, /* 0x 1f0 */ + 0, 0, 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1, /* 0x 200 */ +219,117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, /* 0x 210 */ + 7,114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238, /* 0x 220 */ +252, 17,219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 230 */ +114, 0, 1,219,115, 11,117, 0,139, 30,131,238,252, 17,219,114, /* 0x 240 */ + 0, 72, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192,235, /* 0x 250 */ + 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,235, 0, /* 0x 260 */ + 49,201,131,232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255, /* 0x 270 */ +116, 0,209,248,137,197,235, 11, 1,219,117, 7,139, 30,131,238, /* 0x 280 */ +252, 17,219,114,204, 65, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 290 */ +219,114,190, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, /* 0x 2a0 */ + 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, /* 0x 2b0 */ + 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, /* 0x 2c0 */ + 2,129,253, 0,251,255,255,131,209, 2, 86,141, 52, 47,243,164, /* 0x 2d0 */ + 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, /* 0x 2e0 */ + 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, /* 0x 2f0 */ + 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207, /* 0x 300 */ +233, 0, 0, 0, 0,185, 66, 83, 83, 76,243,171, 95,185, 84, 69, /* 0x 310 */ + 88, 76,138, 7, 71, 44,232, 60, 1,119,247,128, 63, 63,117, 0, /* 0x 320 */ +139, 7,138, 95, 4,102,193,232, 8,134,196,193,192, 16,134,196, /* 0x 330 */ + 41,248,128,235,232,137, 7,131,199, 5,136,216,226, 0,185, 84, /* 0x 340 */ + 69, 88, 76,176,232,176,233,242,174,117, 0,128, 63, 63,117, 0, /* 0x 350 */ +139, 7,102,193,232, 8,134,196,193,192, 16,134,196, 41,248,171, /* 0x 360 */ +235, 0,104, 69, 78, 84, 82,195, 85, 80, 88, 33,161,216,208,213, /* 0x 370 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 380 */ + 0, 0, 0, 0, 0, 0, 0, 45, 68, 74, 50, 77, 65, 73, 78, 49, /* 0x 390 */ + 0, 0, 0, 0, 0, 68, 74, 67, 65, 76, 76, 84, 49, 0, 12, 0, /* 0x 3a0 */ + 0, 0, 68, 74, 50, 77, 65, 73, 78, 50, 0, 13, 0, 0, 0, 78, /* 0x 3b0 */ + 50, 66, 83, 77, 65, 49, 48, 0, 16, 0, 0, 0, 0, 0, 0, 0, /* 0x 3c0 */ + 18, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, /* 0x 3d0 */ + 0, 78, 50, 66, 70, 65, 83, 49, 48, 0, 19, 0, 0, 0, 0, 0, /* 0x 3e0 */ + 0, 0, 21, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, /* 0x 3f0 */ + 0, 0, 0, 78, 50, 66, 70, 65, 83, 49, 49, 0, 21, 0, 0, 0, /* 0x 400 */ + 78, 50, 66, 68, 69, 67, 49, 48, 0, 27, 0, 0, 0, 78, 50, 66, /* 0x 410 */ + 83, 77, 65, 50, 48, 0, 38, 0, 0, 0, 0, 0, 0, 0, 40, 0, /* 0x 420 */ + 0, 0, 78, 50, 66, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, /* 0x 430 */ + 50, 66, 70, 65, 83, 50, 48, 0, 43, 0, 0, 0, 0, 0, 0, 0, /* 0x 440 */ + 47, 0, 0, 0, 78, 50, 66, 70, 65, 83, 49, 49, 0, 0, 0, 0, /* 0x 450 */ + 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 52, 0, 0, 0, 78, 50, /* 0x 460 */ + 66, 83, 77, 65, 51, 48, 0, 65, 0, 0, 0, 0, 0, 0, 0, 78, /* 0x 470 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, /* 0x 480 */ + 78, 50, 66, 70, 65, 83, 51, 48, 0, 78, 0, 0, 0, 0, 0, 0, /* 0x 490 */ + 0, 82, 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, /* 0x 4a0 */ + 0, 0, 0, 0, 0, 0, 93, 0, 0, 0, 78, 50, 66, 68, 69, 67, /* 0x 4b0 */ + 50, 48, 0, 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, /* 0x 4c0 */ + 93, 0, 0, 0, 0, 0, 0, 0,111, 0, 0, 0, 78, 50, 66, 68, /* 0x 4d0 */ + 69, 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,141, 0, 0, /* 0x 4e0 */ + 0, 78, 50, 66, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, /* 0x 4f0 */ + 66, 83, 77, 65, 52, 48, 0,155, 0, 0, 0, 0, 0, 0, 0,168, /* 0x 500 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, /* 0x 510 */ + 78, 50, 66, 70, 65, 83, 52, 48, 0,168, 0, 0, 0, 0, 0, 0, /* 0x 520 */ + 0,172, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, /* 0x 530 */ + 0, 0, 0, 0, 0, 0,183, 0, 0, 0, 78, 50, 66, 68, 69, 67, /* 0x 540 */ + 51, 48, 0, 49, 0, 0, 0, 78, 50, 66, 68, 85, 77, 77, 49, 0, /* 0x 550 */ +183, 0, 0, 0, 78, 50, 66, 83, 77, 65, 53, 48, 0,183, 0, 0, /* 0x 560 */ + 0, 78, 50, 66, 70, 65, 83, 53, 48, 0,185, 0, 0, 0, 78, 50, /* 0x 570 */ + 66, 68, 69, 67, 53, 48, 0,188, 0, 0, 0, 78, 50, 66, 83, 77, /* 0x 580 */ + 65, 54, 48, 0,197, 0, 0, 0, 0, 0, 0, 0,209, 0, 0, 0, /* 0x 590 */ + 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, /* 0x 5a0 */ + 70, 65, 83, 54, 48, 0,209, 0, 0, 0, 0, 0, 0, 0,220, 0, /* 0x 5b0 */ + 0, 0, 78, 50, 66, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, /* 0x 5c0 */ + 0, 0, 0,234, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, /* 0x 5d0 */ + 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 54, 49, 0,234, 0, 0, /* 0x 5e0 */ + 0, 0, 0, 0, 0, 0, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, /* 0x 5f0 */ + 48, 0, 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 0, /* 0x 600 */ + 1, 0, 0, 78, 82, 86, 50, 66, 69, 78, 68, 0, 0, 1, 0, 0, /* 0x 610 */ + 78, 50, 68, 83, 77, 65, 49, 48, 0, 0, 1, 0, 0, 0, 0, 0, /* 0x 620 */ + 0, 2, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, /* 0x 630 */ + 0, 0, 78, 50, 68, 70, 65, 83, 49, 48, 0, 3, 1, 0, 0, 0, /* 0x 640 */ + 0, 0, 0, 5, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, /* 0x 650 */ + 4, 0, 0, 0, 78, 50, 68, 70, 65, 83, 49, 49, 0, 5, 1, 0, /* 0x 660 */ + 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 11, 1, 0, 0, 78, 50, /* 0x 670 */ + 68, 83, 77, 65, 50, 48, 0, 22, 1, 0, 0, 0, 0, 0, 0, 24, /* 0x 680 */ + 1, 0, 0, 78, 50, 68, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, /* 0x 690 */ + 78, 50, 68, 70, 65, 83, 50, 48, 0, 27, 1, 0, 0, 0, 0, 0, /* 0x 6a0 */ + 0, 31, 1, 0, 0, 78, 50, 68, 70, 65, 83, 49, 49, 0, 0, 0, /* 0x 6b0 */ + 0, 0, 78, 50, 68, 68, 69, 67, 50, 48, 0, 36, 1, 0, 0, 78, /* 0x 6c0 */ + 50, 68, 83, 77, 65, 51, 48, 0, 49, 1, 0, 0, 0, 0, 0, 0, /* 0x 6d0 */ + 62, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, /* 0x 6e0 */ + 0, 78, 50, 68, 70, 65, 83, 51, 48, 0, 62, 1, 0, 0, 0, 0, /* 0x 6f0 */ + 0, 0, 68, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, /* 0x 700 */ + 0, 0, 0, 0, 0, 0, 0, 77, 1, 0, 0, 78, 50, 68, 68, 69, /* 0x 710 */ + 67, 51, 48, 0, 16, 0, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x 720 */ + 0, 77, 1, 0, 0, 0, 0, 0, 0, 93, 1, 0, 0, 78, 50, 68, /* 0x 730 */ + 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,111, 1, /* 0x 740 */ + 0, 0, 78, 50, 68, 68, 69, 67, 54, 48, 0, 0, 0, 0, 0, 0, /* 0x 750 */ + 0, 0, 0,145, 1, 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, 0, /* 0x 760 */ + 0, 0, 0, 0, 78, 50, 68, 83, 77, 65, 52, 48, 0,159, 1, 0, /* 0x 770 */ + 0, 0, 0, 0, 0,172, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, /* 0x 780 */ + 48, 0, 69, 0, 0, 0, 78, 50, 68, 70, 65, 83, 52, 48, 0,172, /* 0x 790 */ + 1, 0, 0, 0, 0, 0, 0,176, 1, 0, 0, 78, 50, 68, 68, 69, /* 0x 7a0 */ + 67, 51, 48, 0, 69, 0, 0, 0, 0, 0, 0, 0,187, 1, 0, 0, /* 0x 7b0 */ + 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, 78, 50, 68, /* 0x 7c0 */ + 68, 85, 77, 77, 49, 0,187, 1, 0, 0, 78, 50, 68, 83, 77, 65, /* 0x 7d0 */ + 53, 48, 0,187, 1, 0, 0, 78, 50, 68, 70, 65, 83, 53, 48, 0, /* 0x 7e0 */ +189, 1, 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, 0,192, 1, 0, /* 0x 7f0 */ + 0, 78, 50, 68, 83, 77, 65, 54, 48, 0,201, 1, 0, 0, 0, 0, /* 0x 800 */ + 0, 0,213, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, /* 0x 810 */ + 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 48, 0,213, 1, 0, 0, /* 0x 820 */ + 0, 0, 0, 0,224, 1, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, /* 0x 830 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0,238, 1, 0, 0, 78, 50, 68, /* 0x 840 */ + 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 70, 65, 83, /* 0x 850 */ + 54, 49, 0,238, 1, 0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 78, /* 0x 860 */ + 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 68, /* 0x 870 */ + 69, 67, 54, 48, 0, 4, 2, 0, 0, 78, 82, 86, 50, 68, 69, 78, /* 0x 880 */ + 68, 0, 4, 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 4, /* 0x 890 */ + 2, 0, 0, 0, 0, 0, 0, 6, 2, 0, 0, 78, 50, 69, 68, 69, /* 0x 8a0 */ + 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 48, /* 0x 8b0 */ + 0, 7, 2, 0, 0, 0, 0, 0, 0, 9, 2, 0, 0, 78, 50, 69, /* 0x 8c0 */ + 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, /* 0x 8d0 */ + 49, 49, 0, 9, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, /* 0x 8e0 */ + 15, 2, 0, 0, 78, 50, 69, 83, 77, 65, 50, 48, 0, 26, 2, 0, /* 0x 8f0 */ + 0, 0, 0, 0, 0, 28, 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, /* 0x 900 */ + 48, 0, 2, 0, 0, 0, 78, 50, 69, 70, 65, 83, 50, 48, 0, 31, /* 0x 910 */ + 2, 0, 0, 0, 0, 0, 0, 35, 2, 0, 0, 78, 50, 69, 70, 65, /* 0x 920 */ + 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 69, 68, 69, 67, 50, 48, /* 0x 930 */ + 0, 40, 2, 0, 0, 78, 50, 69, 83, 77, 65, 51, 48, 0, 53, 2, /* 0x 940 */ + 0, 0, 0, 0, 0, 0, 66, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x 950 */ + 51, 48, 0, 31, 0, 0, 0, 78, 50, 69, 70, 65, 83, 51, 48, 0, /* 0x 960 */ + 66, 2, 0, 0, 0, 0, 0, 0, 72, 2, 0, 0, 78, 50, 69, 68, /* 0x 970 */ + 69, 67, 51, 48, 0, 31, 0, 0, 0, 0, 0, 0, 0, 81, 2, 0, /* 0x 980 */ + 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, 0, 78, 50, /* 0x 990 */ + 69, 68, 69, 67, 51, 48, 0, 81, 2, 0, 0, 0, 0, 0, 0, 97, /* 0x 9a0 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, /* 0x 9b0 */ + 0, 0, 0, 0,112, 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, /* 0x 9c0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0,130, 2, 0, 0, 78, 50, 69, /* 0x 9d0 */ + 68, 69, 67, 54, 48, 0, 0, 0, 0, 0, 78, 50, 69, 83, 77, 65, /* 0x 9e0 */ + 52, 48, 0,176, 2, 0, 0, 0, 0, 0, 0,189, 2, 0, 0, 78, /* 0x 9f0 */ + 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 70, /* 0x a00 */ + 65, 83, 52, 48, 0,189, 2, 0, 0, 0, 0, 0, 0,193, 2, 0, /* 0x a10 */ + 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 0, 0, /* 0x a20 */ + 0, 0,204, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 82, /* 0x a30 */ + 0, 0, 0, 78, 50, 69, 68, 85, 77, 77, 49, 0,204, 2, 0, 0, /* 0x a40 */ + 78, 50, 69, 83, 77, 65, 53, 48, 0,204, 2, 0, 0, 78, 50, 69, /* 0x a50 */ + 70, 65, 83, 53, 48, 0,206, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x a60 */ + 53, 48, 0,209, 2, 0, 0, 78, 50, 69, 83, 77, 65, 54, 48, 0, /* 0x a70 */ +218, 2, 0, 0, 0, 0, 0, 0,230, 2, 0, 0, 78, 50, 69, 68, /* 0x a80 */ + 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, /* 0x a90 */ + 48, 0,230, 2, 0, 0, 0, 0, 0, 0,241, 2, 0, 0, 78, 50, /* 0x aa0 */ + 69, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, /* 0x ab0 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, /* 0x ac0 */ + 78, 50, 69, 70, 65, 83, 54, 49, 0,255, 2, 0, 0, 0, 0, 0, /* 0x ad0 */ + 0, 21, 3, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, /* 0x ae0 */ + 0, 0, 78, 50, 69, 68, 69, 67, 54, 48, 0, 21, 3, 0, 0, 78, /* 0x af0 */ + 82, 86, 50, 69, 69, 78, 68, 0, 21, 3, 0, 0, 68, 74, 50, 66, /* 0x b00 */ + 83, 83, 48, 48, 0, 21, 3, 0, 0, 68, 74, 67, 65, 76, 76, 84, /* 0x b10 */ + 50, 0, 28, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, 29, /* 0x b20 */ + 3, 0, 0, 67, 84, 67, 76, 69, 86, 69, 49, 0, 43, 3, 0, 0, /* 0x b30 */ + 0, 0, 0, 0, 48, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, /* 0x b40 */ + 0, 5, 0, 0, 0, 67, 65, 76, 76, 84, 82, 48, 49, 0, 48, 3, /* 0x b50 */ + 0, 0, 67, 84, 68, 85, 77, 77, 89, 49, 0, 53, 3, 0, 0, 67, /* 0x b60 */ + 84, 66, 83, 72, 82, 48, 49, 0, 53, 3, 0, 0, 67, 84, 66, 82, /* 0x b70 */ + 79, 82, 48, 49, 0, 57, 3, 0, 0, 67, 84, 66, 83, 87, 65, 48, /* 0x b80 */ + 49, 0, 59, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 50, 0, 64, /* 0x b90 */ + 3, 0, 0, 0, 0, 0, 0, 78, 3, 0, 0, 67, 65, 76, 76, 84, /* 0x ba0 */ + 82, 48, 48, 0, 10, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, /* 0x bb0 */ + 0, 78, 3, 0, 0, 67, 65, 76, 76, 84, 82, 69, 56, 0, 83, 3, /* 0x bc0 */ + 0, 0, 67, 65, 76, 76, 84, 82, 69, 57, 0, 85, 3, 0, 0, 67, /* 0x bd0 */ + 65, 76, 76, 84, 82, 49, 49, 0, 87, 3, 0, 0, 0, 0, 0, 0, /* 0x be0 */ + 91, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, 5, 0, 0, /* 0x bf0 */ + 0, 67, 84, 67, 76, 69, 86, 69, 50, 0, 91, 3, 0, 0, 0, 0, /* 0x c00 */ + 0, 0, 96, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, 0, 0, /* 0x c10 */ + 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 50, 0, 96, 3, 0, 0, /* 0x c20 */ + 67, 84, 68, 85, 77, 77, 89, 50, 0, 98, 3, 0, 0, 67, 84, 66, /* 0x c30 */ + 83, 72, 82, 49, 49, 0, 98, 3, 0, 0, 67, 84, 66, 82, 79, 82, /* 0x c40 */ + 49, 49, 0,102, 3, 0, 0, 67, 84, 66, 83, 87, 65, 49, 49, 0, /* 0x c50 */ +104, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0,109, 3, 0, /* 0x c60 */ + 0, 0, 0, 0, 0,114, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, /* 0x c70 */ + 48, 0, 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, 68, 0,114, /* 0x c80 */ + 3, 0, 0, 68, 74, 82, 69, 84, 85, 82, 78, 0,114, 3, 0, 0, /* 0x c90 */ + 85, 80, 88, 49, 72, 69, 65, 68, 0,120, 3, 0, 0, 68, 74, 84, /* 0x ca0 */ + 72, 69, 69, 78, 68, 0,152, 3, 0, 0,255,255,255,255,152, 3 /* 0x cb0 */ +}; diff --git a/src/stub/i386-dos32.tmt.h b/src/stub/i386-dos32.tmt.h new file mode 100644 index 00000000..5d2b6ac6 --- /dev/null +++ b/src/stub/i386-dos32.tmt.h @@ -0,0 +1,254 @@ +/* i386-dos32.tmt.h -- created from i386-dos32.tmt.bin, 3489 (0xda1) 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 + + */ + + +#define NRV_LOADER_SIZE 3489 +#define NRV_LOADER_ADLER32 0x674637ee +#define NRV_LOADER_CRC32 0x92862cce + +unsigned char nrv_loader[3489] = { +191, 0, 0, 0, 0, 87,141,183, 69, 83, 73, 48,141,191, 69, 68, /* 0x 0 */ + 73, 48,185, 69, 67, 88, 48,253,243,164,252,141,119, 1, 95,131, /* 0x 10 */ +205,255, 87, 87,233, 74, 77, 80, 68, 85, 80, 88, 33,161,216,208, /* 0x 20 */ +213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 30 */ + 0, 0, 0, 0, 0, 0, 0, 0, 45,235, 0,164,235, 0,138, 6, /* 0x 40 */ + 70,136, 7, 71, 1,219,117, 7,139, 30,131,238,252, 17,219,114, /* 0x 50 */ + 0, 49,192, 64,138, 7,114, 0,184, 1, 0, 0, 0, 1,219,117, /* 0x 60 */ + 7,139, 30,131,238,252, 17,219, 17,192, 1,219,117, 7,139, 30, /* 0x 70 */ +131,238,252, 17,219,115, 0, 1,219,115, 0,117, 9,139, 30,131, /* 0x 80 */ +238,252, 17,219,115, 0, 49,201,131,232, 3,114, 13,193,224, 8, /* 0x 90 */ +138, 6, 70,131,240,255,116, 0,137,197, 1,219,117, 7,139, 30, /* 0x a0 */ +131,238,252, 17,219, 17,201, 1,219,117, 7,139, 30,131,238,252, /* 0x b0 */ + 17,219, 17,201,117, 0, 65, 1,219,117, 7,139, 30,131,238,252, /* 0x c0 */ + 17,219, 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219,115, /* 0x d0 */ + 0, 1,219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, /* 0x e0 */ + 65, 65,131,193, 2,129,253, 0,243,255,255,131,209, 1, 86,141, /* 0x f0 */ + 52, 47,243,164, 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252, /* 0x 100 */ +138, 4, 15,118, 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, /* 0x 110 */ + 0, 0, 0,139, 2,131,194, 4,137, 7,131,199, 4,131,233, 4, /* 0x 120 */ +119,241, 1,207,233, 0, 0, 0, 0,235, 0,164,235, 0,138, 6, /* 0x 130 */ + 70,136, 7, 71, 1,219,117, 7,139, 30,131,238,252, 17,219,114, /* 0x 140 */ + 0, 49,192, 64,138, 7,114, 0,184, 1, 0, 0, 0, 1,219,117, /* 0x 150 */ + 7,139, 30,131,238,252, 17,219, 17,192, 1,219,117, 7,139, 30, /* 0x 160 */ +131,238,252, 17,219,114, 0, 1,219,115, 11,117, 0,139, 30,131, /* 0x 170 */ +238,252, 17,219,114, 0, 72, 1,219,117, 7,139, 30,131,238,252, /* 0x 180 */ + 17,219, 17,192,235, 0, 49,201,131,232, 3,114, 17,193,224, 8, /* 0x 190 */ +138, 6, 70,131,240,255,116, 0,209,248,137,197,235, 11, 1,219, /* 0x 1a0 */ +117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, 7,139, /* 0x 1b0 */ + 30,131,238,252, 17,219, 17,201,117, 0, 65, 1,219,117, 7,139, /* 0x 1c0 */ + 30,131,238,252, 17,219, 17,201, 1,219,117, 7,139, 30,131,238, /* 0x 1d0 */ +252, 17,219,115, 0, 1,219,115, 0,117, 9,139, 30,131,238,252, /* 0x 1e0 */ + 17,219,115, 0, 65, 65,131,193, 2,129,253, 0,251,255,255,131, /* 0x 1f0 */ +209, 1, 86,141, 52, 47,243,164, 94,233, 0, 0, 0, 0,141, 20, /* 0x 200 */ + 47,131,253,252,138, 4, 15,118, 0,138, 2, 66,136, 7, 71, 73, /* 0x 210 */ +117,247,233, 0, 0, 0, 0,139, 2,131,194, 4,137, 7,131,199, /* 0x 220 */ + 4,131,233, 4,119,241, 1,207,233, 0, 0, 0, 0,235, 0,164, /* 0x 230 */ +235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, 30,131,238, /* 0x 240 */ +252, 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, 1, 0, 0, /* 0x 250 */ + 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192, 1,219, /* 0x 260 */ +117, 7,139, 30,131,238,252, 17,219,114, 0, 1,219,115, 11,117, /* 0x 270 */ + 0,139, 30,131,238,252, 17,219,114, 0, 72, 1,219,117, 7,139, /* 0x 280 */ + 30,131,238,252, 17,219, 17,192,235, 0, 1,219,117, 7,139, 30, /* 0x 290 */ +131,238,252, 17,219, 17,201,235, 0, 49,201,131,232, 3,114, 17, /* 0x 2a0 */ +193,224, 8,138, 6, 70,131,240,255,116, 0,209,248,137,197,235, /* 0x 2b0 */ + 11, 1,219,117, 7,139, 30,131,238,252, 17,219,114,204, 65, 1, /* 0x 2c0 */ +219,117, 7,139, 30,131,238,252, 17,219,114,190, 1,219,117, 7, /* 0x 2d0 */ +139, 30,131,238,252, 17,219, 17,201, 1,219,117, 7,139, 30,131, /* 0x 2e0 */ +238,252, 17,219,115, 0, 1,219,115, 0,117, 9,139, 30,131,238, /* 0x 2f0 */ +252, 17,219,115, 0, 65, 65,131,193, 2,129,253, 0,251,255,255, /* 0x 300 */ +131,209, 2, 86,141, 52, 47,243,164, 94,233, 0, 0, 0, 0,141, /* 0x 310 */ + 20, 47,131,253,252,138, 4, 15,118, 0,138, 2, 66,136, 7, 71, /* 0x 320 */ + 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, 4,137, 7,131, /* 0x 330 */ +199, 4,131,233, 4,119,241, 1,207,233, 0, 0, 0, 0, 93,137, /* 0x 340 */ +254, 43,119,252, 95,185, 84, 69, 88, 76,138, 7, 71, 44,232, 60, /* 0x 350 */ + 1,119,247,128, 63, 63,117, 0,139, 7,138, 95, 4,102,193,232, /* 0x 360 */ + 8,134,196,193,192, 16,134,196, 41,248,128,235,232, 1,232,137, /* 0x 370 */ + 7,131,199, 5,136,216,226, 0,185, 84, 69, 88, 76,176,232,176, /* 0x 380 */ +233,242,174,117, 0,128, 63, 63,117, 0,139, 7,102,193,232, 8, /* 0x 390 */ +134,196,193,192, 16,134,196, 41,248, 1,232,171,235, 0,141,125, /* 0x 3a0 */ +252, 49,192,138, 6, 70, 9,192,116, 0, 60,239,119, 17, 1,199, /* 0x 3b0 */ +139, 7,134,196,193,192, 16,134,196, 1,232,137, 7,235,226, 36, /* 0x 3c0 */ + 15,193,224, 16,102,139, 6,131,198, 2, 9,192,117, 0,139, 6, /* 0x 3d0 */ +131,198, 4,235, 0,233, 74, 77, 80, 79, 0, 0, 84, 77, 84, 77, /* 0x 3e0 */ + 65, 73, 78, 49, 0, 0, 0, 0, 0, 84, 77, 84, 67, 65, 76, 84, /* 0x 3f0 */ + 49, 0, 35, 0, 0, 0, 84, 77, 84, 77, 65, 73, 78, 50, 0, 36, /* 0x 400 */ + 0, 0, 0, 85, 80, 88, 49, 72, 69, 65, 68, 0, 41, 0, 0, 0, /* 0x 410 */ + 84, 77, 84, 67, 85, 84, 80, 79, 0, 73, 0, 0, 0, 78, 50, 66, /* 0x 420 */ + 83, 77, 65, 49, 48, 0, 73, 0, 0, 0, 0, 0, 0, 0, 75, 0, /* 0x 430 */ + 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, /* 0x 440 */ + 50, 66, 70, 65, 83, 49, 48, 0, 76, 0, 0, 0, 0, 0, 0, 0, /* 0x 450 */ + 78, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, /* 0x 460 */ + 0, 78, 50, 66, 70, 65, 83, 49, 49, 0, 78, 0, 0, 0, 78, 50, /* 0x 470 */ + 66, 68, 69, 67, 49, 48, 0, 84, 0, 0, 0, 78, 50, 66, 83, 77, /* 0x 480 */ + 65, 50, 48, 0, 95, 0, 0, 0, 0, 0, 0, 0, 97, 0, 0, 0, /* 0x 490 */ + 78, 50, 66, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 66, /* 0x 4a0 */ + 70, 65, 83, 50, 48, 0,100, 0, 0, 0, 0, 0, 0, 0,104, 0, /* 0x 4b0 */ + 0, 0, 78, 50, 66, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, /* 0x 4c0 */ + 50, 66, 68, 69, 67, 50, 48, 0,109, 0, 0, 0, 78, 50, 66, 83, /* 0x 4d0 */ + 77, 65, 51, 48, 0,122, 0, 0, 0, 0, 0, 0, 0,135, 0, 0, /* 0x 4e0 */ + 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 78, 50, /* 0x 4f0 */ + 66, 70, 65, 83, 51, 48, 0,135, 0, 0, 0, 0, 0, 0, 0,139, /* 0x 500 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, /* 0x 510 */ + 0, 0, 0, 0,150, 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, /* 0x 520 */ + 0, 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0,150, 0, /* 0x 530 */ + 0, 0, 0, 0, 0, 0,168, 0, 0, 0, 78, 50, 66, 68, 69, 67, /* 0x 540 */ + 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,198, 0, 0, 0, 78, /* 0x 550 */ + 50, 66, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, 66, 83, /* 0x 560 */ + 77, 65, 52, 48, 0,212, 0, 0, 0, 0, 0, 0, 0,225, 0, 0, /* 0x 570 */ + 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 78, 50, /* 0x 580 */ + 66, 70, 65, 83, 52, 48, 0,225, 0, 0, 0, 0, 0, 0, 0,229, /* 0x 590 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, /* 0x 5a0 */ + 0, 0, 0, 0,240, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, /* 0x 5b0 */ + 0, 49, 0, 0, 0, 78, 50, 66, 68, 85, 77, 77, 49, 0,240, 0, /* 0x 5c0 */ + 0, 0, 78, 50, 66, 83, 77, 65, 53, 48, 0,240, 0, 0, 0, 78, /* 0x 5d0 */ + 50, 66, 70, 65, 83, 53, 48, 0,242, 0, 0, 0, 78, 50, 66, 68, /* 0x 5e0 */ + 69, 67, 53, 48, 0,245, 0, 0, 0, 78, 50, 66, 83, 77, 65, 54, /* 0x 5f0 */ + 48, 0,254, 0, 0, 0, 0, 0, 0, 0, 10, 1, 0, 0, 78, 50, /* 0x 600 */ + 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, /* 0x 610 */ + 83, 54, 48, 0, 10, 1, 0, 0, 0, 0, 0, 0, 21, 1, 0, 0, /* 0x 620 */ + 78, 50, 66, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 630 */ + 0, 35, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, /* 0x 640 */ + 0, 0, 78, 50, 66, 70, 65, 83, 54, 49, 0, 35, 1, 0, 0, 0, /* 0x 650 */ + 0, 0, 0, 57, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, /* 0x 660 */ + 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 57, 1, 0, /* 0x 670 */ + 0, 78, 82, 86, 50, 66, 69, 78, 68, 0, 57, 1, 0, 0, 78, 50, /* 0x 680 */ + 68, 83, 77, 65, 49, 48, 0, 57, 1, 0, 0, 0, 0, 0, 0, 59, /* 0x 690 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, /* 0x 6a0 */ + 78, 50, 68, 70, 65, 83, 49, 48, 0, 60, 1, 0, 0, 0, 0, 0, /* 0x 6b0 */ + 0, 62, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, /* 0x 6c0 */ + 0, 0, 78, 50, 68, 70, 65, 83, 49, 49, 0, 62, 1, 0, 0, 78, /* 0x 6d0 */ + 50, 68, 68, 69, 67, 49, 48, 0, 68, 1, 0, 0, 78, 50, 68, 83, /* 0x 6e0 */ + 77, 65, 50, 48, 0, 79, 1, 0, 0, 0, 0, 0, 0, 81, 1, 0, /* 0x 6f0 */ + 0, 78, 50, 68, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, /* 0x 700 */ + 68, 70, 65, 83, 50, 48, 0, 84, 1, 0, 0, 0, 0, 0, 0, 88, /* 0x 710 */ + 1, 0, 0, 78, 50, 68, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, /* 0x 720 */ + 78, 50, 68, 68, 69, 67, 50, 48, 0, 93, 1, 0, 0, 78, 50, 68, /* 0x 730 */ + 83, 77, 65, 51, 48, 0,106, 1, 0, 0, 0, 0, 0, 0,119, 1, /* 0x 740 */ + 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 78, /* 0x 750 */ + 50, 68, 70, 65, 83, 51, 48, 0,119, 1, 0, 0, 0, 0, 0, 0, /* 0x 760 */ +125, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, /* 0x 770 */ + 0, 0, 0, 0, 0,134, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, /* 0x 780 */ + 48, 0, 16, 0, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0,134, /* 0x 790 */ + 1, 0, 0, 0, 0, 0, 0,150, 1, 0, 0, 78, 50, 68, 68, 69, /* 0x 7a0 */ + 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,168, 1, 0, 0, /* 0x 7b0 */ + 78, 50, 68, 68, 69, 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 7c0 */ + 0,202, 1, 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, /* 0x 7d0 */ + 0, 0, 78, 50, 68, 83, 77, 65, 52, 48, 0,216, 1, 0, 0, 0, /* 0x 7e0 */ + 0, 0, 0,229, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, /* 0x 7f0 */ + 69, 0, 0, 0, 78, 50, 68, 70, 65, 83, 52, 48, 0,229, 1, 0, /* 0x 800 */ + 0, 0, 0, 0, 0,233, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, /* 0x 810 */ + 48, 0, 69, 0, 0, 0, 0, 0, 0, 0,244, 1, 0, 0, 78, 50, /* 0x 820 */ + 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, 78, 50, 68, 68, 85, /* 0x 830 */ + 77, 77, 49, 0,244, 1, 0, 0, 78, 50, 68, 83, 77, 65, 53, 48, /* 0x 840 */ + 0,244, 1, 0, 0, 78, 50, 68, 70, 65, 83, 53, 48, 0,246, 1, /* 0x 850 */ + 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, 0,249, 1, 0, 0, 78, /* 0x 860 */ + 50, 68, 83, 77, 65, 54, 48, 0, 2, 2, 0, 0, 0, 0, 0, 0, /* 0x 870 */ + 14, 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, /* 0x 880 */ + 0, 78, 50, 68, 70, 65, 83, 54, 48, 0, 14, 2, 0, 0, 0, 0, /* 0x 890 */ + 0, 0, 25, 2, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 0, /* 0x 8a0 */ + 0, 0, 0, 0, 0, 0, 0, 39, 2, 0, 0, 78, 50, 68, 68, 69, /* 0x 8b0 */ + 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, /* 0x 8c0 */ + 0, 39, 2, 0, 0, 0, 0, 0, 0, 61, 2, 0, 0, 78, 50, 68, /* 0x 8d0 */ + 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 8e0 */ + 54, 48, 0, 61, 2, 0, 0, 78, 82, 86, 50, 68, 69, 78, 68, 0, /* 0x 8f0 */ + 61, 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 61, 2, 0, /* 0x 900 */ + 0, 0, 0, 0, 0, 63, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, /* 0x 910 */ + 48, 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 48, 0, 64, /* 0x 920 */ + 2, 0, 0, 0, 0, 0, 0, 66, 2, 0, 0, 78, 50, 69, 68, 69, /* 0x 930 */ + 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, /* 0x 940 */ + 0, 66, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 72, 2, /* 0x 950 */ + 0, 0, 78, 50, 69, 83, 77, 65, 50, 48, 0, 83, 2, 0, 0, 0, /* 0x 960 */ + 0, 0, 0, 85, 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, /* 0x 970 */ + 2, 0, 0, 0, 78, 50, 69, 70, 65, 83, 50, 48, 0, 88, 2, 0, /* 0x 980 */ + 0, 0, 0, 0, 0, 92, 2, 0, 0, 78, 50, 69, 70, 65, 83, 49, /* 0x 990 */ + 49, 0, 0, 0, 0, 0, 78, 50, 69, 68, 69, 67, 50, 48, 0, 97, /* 0x 9a0 */ + 2, 0, 0, 78, 50, 69, 83, 77, 65, 51, 48, 0,110, 2, 0, 0, /* 0x 9b0 */ + 0, 0, 0, 0,123, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, /* 0x 9c0 */ + 0, 31, 0, 0, 0, 78, 50, 69, 70, 65, 83, 51, 48, 0,123, 2, /* 0x 9d0 */ + 0, 0, 0, 0, 0, 0,129, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x 9e0 */ + 51, 48, 0, 31, 0, 0, 0, 0, 0, 0, 0,138, 2, 0, 0, 78, /* 0x 9f0 */ + 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, 0, 78, 50, 69, 68, /* 0x a00 */ + 69, 67, 51, 48, 0,138, 2, 0, 0, 0, 0, 0, 0,154, 2, 0, /* 0x a10 */ + 0, 78, 50, 69, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, /* 0x a20 */ + 0, 0,169, 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, /* 0x a30 */ + 0, 0, 0, 0, 0, 0, 0,187, 2, 0, 0, 78, 50, 69, 68, 69, /* 0x a40 */ + 67, 54, 48, 0, 0, 0, 0, 0, 78, 50, 69, 83, 77, 65, 52, 48, /* 0x a50 */ + 0,233, 2, 0, 0, 0, 0, 0, 0,246, 2, 0, 0, 78, 50, 69, /* 0x a60 */ + 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 70, 65, 83, /* 0x a70 */ + 52, 48, 0,246, 2, 0, 0, 0, 0, 0, 0,250, 2, 0, 0, 78, /* 0x a80 */ + 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 0, 0, 0, 0, /* 0x a90 */ + 5, 3, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, /* 0x aa0 */ + 0, 78, 50, 69, 68, 85, 77, 77, 49, 0, 5, 3, 0, 0, 78, 50, /* 0x ab0 */ + 69, 83, 77, 65, 53, 48, 0, 5, 3, 0, 0, 78, 50, 69, 70, 65, /* 0x ac0 */ + 83, 53, 48, 0, 7, 3, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, /* 0x ad0 */ + 0, 10, 3, 0, 0, 78, 50, 69, 83, 77, 65, 54, 48, 0, 19, 3, /* 0x ae0 */ + 0, 0, 0, 0, 0, 0, 31, 3, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x af0 */ + 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, 48, 0, /* 0x b00 */ + 31, 3, 0, 0, 0, 0, 0, 0, 42, 3, 0, 0, 78, 50, 69, 70, /* 0x b10 */ + 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 3, 0, /* 0x b20 */ + 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, /* 0x b30 */ + 69, 70, 65, 83, 54, 49, 0, 56, 3, 0, 0, 0, 0, 0, 0, 78, /* 0x b40 */ + 3, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, /* 0x b50 */ + 78, 50, 69, 68, 69, 67, 54, 48, 0, 78, 3, 0, 0, 78, 82, 86, /* 0x b60 */ + 50, 69, 69, 78, 68, 0, 78, 3, 0, 0, 84, 77, 84, 77, 65, 73, /* 0x b70 */ + 78, 53, 0, 78, 3, 0, 0, 84, 77, 84, 67, 65, 76, 84, 50, 0, /* 0x b80 */ + 84, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, 85, 3, 0, /* 0x b90 */ + 0, 67, 84, 67, 76, 69, 86, 69, 49, 0, 99, 3, 0, 0, 0, 0, /* 0x ba0 */ + 0, 0,104, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, 5, /* 0x bb0 */ + 0, 0, 0, 67, 65, 76, 76, 84, 82, 48, 49, 0,104, 3, 0, 0, /* 0x bc0 */ + 67, 84, 68, 85, 77, 77, 89, 49, 0,109, 3, 0, 0, 67, 84, 66, /* 0x bd0 */ + 83, 72, 82, 48, 49, 0,109, 3, 0, 0, 67, 84, 66, 82, 79, 82, /* 0x be0 */ + 48, 49, 0,113, 3, 0, 0, 67, 84, 66, 83, 87, 65, 48, 49, 0, /* 0x bf0 */ +115, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 50, 0,120, 3, 0, /* 0x c00 */ + 0, 0, 0, 0, 0,136, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, /* 0x c10 */ + 48, 0, 10, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, 0,136, /* 0x c20 */ + 3, 0, 0, 67, 65, 76, 76, 84, 82, 69, 56, 0,141, 3, 0, 0, /* 0x c30 */ + 67, 65, 76, 76, 84, 82, 69, 57, 0,143, 3, 0, 0, 67, 65, 76, /* 0x c40 */ + 76, 84, 82, 49, 49, 0,145, 3, 0, 0, 0, 0, 0, 0,149, 3, /* 0x c50 */ + 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, 7, 0, 0, 0, 67, /* 0x c60 */ + 84, 67, 76, 69, 86, 69, 50, 0,149, 3, 0, 0, 0, 0, 0, 0, /* 0x c70 */ +154, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, 0, 0, 0, 0, /* 0x c80 */ + 0, 67, 65, 76, 76, 84, 82, 49, 50, 0,154, 3, 0, 0, 67, 84, /* 0x c90 */ + 68, 85, 77, 77, 89, 50, 0,156, 3, 0, 0, 67, 84, 66, 83, 72, /* 0x ca0 */ + 82, 49, 49, 0,156, 3, 0, 0, 67, 84, 66, 82, 79, 82, 49, 49, /* 0x cb0 */ + 0,160, 3, 0, 0, 67, 84, 66, 83, 87, 65, 49, 49, 0,162, 3, /* 0x cc0 */ + 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0,167, 3, 0, 0, 0, /* 0x cd0 */ + 0, 0, 0,174, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, 0, /* 0x ce0 */ + 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, 68, 0,174, 3, 0, /* 0x cf0 */ + 0, 84, 77, 84, 82, 69, 76, 79, 67, 0,174, 3, 0, 0, 82, 69, /* 0x d00 */ + 76, 79, 67, 51, 50, 48, 0,177, 3, 0, 0, 0, 0, 0, 0,186, /* 0x d10 */ + 3, 0, 0, 82, 69, 76, 79, 67, 51, 50, 74, 0, 2, 0, 0, 0, /* 0x d20 */ + 82, 69, 76, 51, 50, 66, 73, 71, 0,218, 3, 0, 0, 0, 0, 0, /* 0x d30 */ + 0,222, 3, 0, 0, 82, 69, 76, 79, 67, 51, 50, 48, 0, 13, 0, /* 0x d40 */ + 0, 0, 82, 69, 76, 79, 67, 51, 50, 74, 0,227, 3, 0, 0, 0, /* 0x d50 */ + 0, 0, 0,229, 3, 0, 0, 82, 69, 76, 79, 67, 51, 50, 48, 0, /* 0x d60 */ + 13, 0, 0, 0, 82, 69, 76, 51, 50, 69, 78, 68, 0,229, 3, 0, /* 0x d70 */ + 0, 84, 77, 84, 74, 85, 77, 80, 49, 0,229, 3, 0, 0, 84, 77, /* 0x d80 */ + 84, 72, 69, 69, 78, 68, 0,234, 3, 0, 0,255,255,255,255,234, /* 0x d90 */ + 3 /* 0x da0 */ +}; diff --git a/src/stub/i386-dos32.watcom.le.h b/src/stub/i386-dos32.watcom.le.h new file mode 100644 index 00000000..9c605e00 --- /dev/null +++ b/src/stub/i386-dos32.watcom.le.h @@ -0,0 +1,259 @@ +/* i386-dos32.watcom.le.h -- created from i386-dos32.watcom.le.bin, 3577 (0xdf9) 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 + + */ + + +#define NRV_LOADER_SIZE 3577 +#define NRV_LOADER_ADLER32 0x7df0575c +#define NRV_LOADER_CRC32 0x76ea1fb5 + +unsigned char nrv_loader[3577] = { +191, 97,108,105, 98,105, 87, 65, 84, 67, 79, 77, 6, 30, 7, 87, /* 0x 0 */ +141,183, 69, 83, 73, 48,141,191, 69, 68, 73, 48,185, 69, 67, 88, /* 0x 10 */ + 48,253,243,165,252,141,119, 4, 95,131,205,255, 87,233, 74, 77, /* 0x 20 */ + 80, 68, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, 0, 0, /* 0x 30 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 40 */ + 0, 45,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, /* 0x 50 */ + 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, /* 0x 60 */ + 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 70 */ +219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, /* 0x 80 */ + 1,219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 49, /* 0x 90 */ +201,131,232, 3,114, 13,193,224, 8,138, 6, 70,131,240,255,116, /* 0x a0 */ + 0,137,197, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, /* 0x b0 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, 0, 65, /* 0x c0 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, /* 0x d0 */ + 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, 9, /* 0x e0 */ +139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129,253, /* 0x f0 */ + 0,243,255,255,131,209, 1, 86,141, 52, 47,243,164, 94,233, 0, /* 0x 100 */ + 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0,138, 2, /* 0x 110 */ + 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, /* 0x 120 */ + 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, 0, /* 0x 130 */ + 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, /* 0x 140 */ + 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, /* 0x 150 */ + 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 160 */ +219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, /* 0x 170 */ + 1,219,115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, 72, /* 0x 180 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, 49, /* 0x 190 */ +201,131,232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, /* 0x 1a0 */ + 0,209,248,137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, /* 0x 1b0 */ + 17,219, 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 1c0 */ +201,117, 0, 65, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 1d0 */ +201, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219, /* 0x 1e0 */ +115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131, /* 0x 1f0 */ +193, 2,129,253, 0,251,255,255,131,209, 1, 86,141, 52, 47,243, /* 0x 200 */ +164, 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15, /* 0x 210 */ +118, 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0, /* 0x 220 */ +139, 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1, /* 0x 230 */ +207,233, 0, 0, 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, /* 0x 240 */ + 71, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, /* 0x 250 */ + 64,138, 7,114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30, /* 0x 260 */ +131,238,252, 17,219, 17,192, 1,219,117, 7,139, 30,131,238,252, /* 0x 270 */ + 17,219,114, 0, 1,219,115, 11,117, 0,139, 30,131,238,252, 17, /* 0x 280 */ +219,114, 0, 72, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 290 */ +192,235, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, /* 0x 2a0 */ +235, 0, 49,201,131,232, 3,114, 17,193,224, 8,138, 6, 70,131, /* 0x 2b0 */ +240,255,116, 0,209,248,137,197,235, 11, 1,219,117, 7,139, 30, /* 0x 2c0 */ +131,238,252, 17,219,114,204, 65, 1,219,117, 7,139, 30,131,238, /* 0x 2d0 */ +252, 17,219,114,190, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 2e0 */ + 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1, /* 0x 2f0 */ +219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65, /* 0x 300 */ +131,193, 2,129,253, 0,251,255,255,131,209, 2, 86,141, 52, 47, /* 0x 310 */ +243,164, 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, /* 0x 320 */ + 15,118, 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, /* 0x 330 */ + 0,139, 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, /* 0x 340 */ + 1,207,233, 0, 0, 0, 0, 93, 86,141,181, 82, 69, 76, 79, 86, /* 0x 350 */ +141,189, 84, 69, 88, 86,137,239,185, 84, 69, 88, 76,138, 7, 71, /* 0x 360 */ + 44,232, 60, 1,119,247,128, 63, 63,117, 0,139, 7,138, 95, 4, /* 0x 370 */ +102,193,232, 8,134,196,193,192, 16,134,196, 41,248,128,235,232, /* 0x 380 */ + 1,232,137, 7,131,199, 5,136,216,226, 0,185, 84, 69, 88, 76, /* 0x 390 */ +176,232,176,233,242,174,117, 0,128, 63, 63,117, 0,139, 7,102, /* 0x 3a0 */ +193,232, 8,134,196,193,192, 16,134,196, 41,248, 1,232,171,235, /* 0x 3b0 */ + 0,141,125,252, 49,192,138, 6, 70, 9,192,116, 0, 60,239,119, /* 0x 3c0 */ + 17, 1,199,139, 7,134,196,193,192, 16,134,196, 1,232,137, 7, /* 0x 3d0 */ +235,226, 36, 15,193,224, 16,102,139, 6,131,198, 2, 9,192,117, /* 0x 3e0 */ + 0,139, 6,131,198, 4,235, 0,255,214, 95, 89, 41,249,193,233, /* 0x 3f0 */ + 2,243,171, 7,141,165, 69, 83, 80, 48,233, 74, 77, 80, 79, 0, /* 0x 400 */ + 87, 67, 76, 69, 77, 65, 73, 78, 0, 0, 0, 0, 0, 85, 80, 88, /* 0x 410 */ + 49, 72, 69, 65, 68, 0, 50, 0, 0, 0, 87, 67, 76, 69, 67, 85, /* 0x 420 */ + 84, 80, 0, 82, 0, 0, 0, 78, 50, 66, 83, 77, 65, 49, 48, 0, /* 0x 430 */ + 82, 0, 0, 0, 0, 0, 0, 0, 84, 0, 0, 0, 78, 50, 66, 68, /* 0x 440 */ + 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, 70, 65, 83, 49, /* 0x 450 */ + 48, 0, 85, 0, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 78, 50, /* 0x 460 */ + 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, 70, 65, /* 0x 470 */ + 83, 49, 49, 0, 87, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, /* 0x 480 */ + 0, 93, 0, 0, 0, 78, 50, 66, 83, 77, 65, 50, 48, 0,104, 0, /* 0x 490 */ + 0, 0, 0, 0, 0, 0,106, 0, 0, 0, 78, 50, 66, 83, 77, 65, /* 0x 4a0 */ + 49, 48, 0, 2, 0, 0, 0, 78, 50, 66, 70, 65, 83, 50, 48, 0, /* 0x 4b0 */ +109, 0, 0, 0, 0, 0, 0, 0,113, 0, 0, 0, 78, 50, 66, 70, /* 0x 4c0 */ + 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, /* 0x 4d0 */ + 48, 0,118, 0, 0, 0, 78, 50, 66, 83, 77, 65, 51, 48, 0,131, /* 0x 4e0 */ + 0, 0, 0, 0, 0, 0, 0,144, 0, 0, 0, 78, 50, 66, 68, 69, /* 0x 4f0 */ + 67, 50, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 51, 48, /* 0x 500 */ + 0,144, 0, 0, 0, 0, 0, 0, 0,148, 0, 0, 0, 78, 50, 66, /* 0x 510 */ + 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,159, 0, /* 0x 520 */ + 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 78, /* 0x 530 */ + 50, 66, 68, 69, 67, 51, 48, 0,159, 0, 0, 0, 0, 0, 0, 0, /* 0x 540 */ +177, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 0, 0, 0, /* 0x 550 */ + 0, 0, 0, 0, 0,207, 0, 0, 0, 78, 50, 66, 68, 69, 67, 53, /* 0x 560 */ + 48, 0, 0, 0, 0, 0, 78, 50, 66, 83, 77, 65, 52, 48, 0,221, /* 0x 570 */ + 0, 0, 0, 0, 0, 0, 0,234, 0, 0, 0, 78, 50, 66, 68, 69, /* 0x 580 */ + 67, 51, 48, 0, 49, 0, 0, 0, 78, 50, 66, 70, 65, 83, 52, 48, /* 0x 590 */ + 0,234, 0, 0, 0, 0, 0, 0, 0,238, 0, 0, 0, 78, 50, 66, /* 0x 5a0 */ + 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 0, 0, 0, 0,249, 0, /* 0x 5b0 */ + 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 78, /* 0x 5c0 */ + 50, 66, 68, 85, 77, 77, 49, 0,249, 0, 0, 0, 78, 50, 66, 83, /* 0x 5d0 */ + 77, 65, 53, 48, 0,249, 0, 0, 0, 78, 50, 66, 70, 65, 83, 53, /* 0x 5e0 */ + 48, 0,251, 0, 0, 0, 78, 50, 66, 68, 69, 67, 53, 48, 0,254, /* 0x 5f0 */ + 0, 0, 0, 78, 50, 66, 83, 77, 65, 54, 48, 0, 7, 1, 0, 0, /* 0x 600 */ + 0, 0, 0, 0, 19, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, /* 0x 610 */ + 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 54, 48, 0, 19, 1, /* 0x 620 */ + 0, 0, 0, 0, 0, 0, 30, 1, 0, 0, 78, 50, 66, 70, 65, 83, /* 0x 630 */ + 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 1, 0, 0, 78, /* 0x 640 */ + 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, /* 0x 650 */ + 65, 83, 54, 49, 0, 44, 1, 0, 0, 0, 0, 0, 0, 66, 1, 0, /* 0x 660 */ + 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, /* 0x 670 */ + 66, 68, 69, 67, 54, 48, 0, 66, 1, 0, 0, 78, 82, 86, 50, 66, /* 0x 680 */ + 69, 78, 68, 0, 66, 1, 0, 0, 78, 50, 68, 83, 77, 65, 49, 48, /* 0x 690 */ + 0, 66, 1, 0, 0, 0, 0, 0, 0, 68, 1, 0, 0, 78, 50, 68, /* 0x 6a0 */ + 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 68, 70, 65, 83, /* 0x 6b0 */ + 49, 48, 0, 69, 1, 0, 0, 0, 0, 0, 0, 71, 1, 0, 0, 78, /* 0x 6c0 */ + 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 68, 70, /* 0x 6d0 */ + 65, 83, 49, 49, 0, 71, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, /* 0x 6e0 */ + 48, 0, 77, 1, 0, 0, 78, 50, 68, 83, 77, 65, 50, 48, 0, 88, /* 0x 6f0 */ + 1, 0, 0, 0, 0, 0, 0, 90, 1, 0, 0, 78, 50, 68, 83, 77, /* 0x 700 */ + 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 68, 70, 65, 83, 50, 48, /* 0x 710 */ + 0, 93, 1, 0, 0, 0, 0, 0, 0, 97, 1, 0, 0, 78, 50, 68, /* 0x 720 */ + 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 730 */ + 50, 48, 0,102, 1, 0, 0, 78, 50, 68, 83, 77, 65, 51, 48, 0, /* 0x 740 */ +115, 1, 0, 0, 0, 0, 0, 0,128, 1, 0, 0, 78, 50, 68, 68, /* 0x 750 */ + 69, 67, 51, 48, 0, 16, 0, 0, 0, 78, 50, 68, 70, 65, 83, 51, /* 0x 760 */ + 48, 0,128, 1, 0, 0, 0, 0, 0, 0,134, 1, 0, 0, 78, 50, /* 0x 770 */ + 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 0, 0, 0, 0,143, /* 0x 780 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, /* 0x 790 */ + 78, 50, 68, 68, 69, 67, 51, 48, 0,143, 1, 0, 0, 0, 0, 0, /* 0x 7a0 */ + 0,159, 1, 0, 0, 78, 50, 68, 68, 69, 67, 50, 48, 0, 0, 0, /* 0x 7b0 */ + 0, 0, 0, 0, 0, 0,177, 1, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 7c0 */ + 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,211, 1, 0, 0, 78, /* 0x 7d0 */ + 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, 68, 83, /* 0x 7e0 */ + 77, 65, 52, 48, 0,225, 1, 0, 0, 0, 0, 0, 0,238, 1, 0, /* 0x 7f0 */ + 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, 78, 50, /* 0x 800 */ + 68, 70, 65, 83, 52, 48, 0,238, 1, 0, 0, 0, 0, 0, 0,242, /* 0x 810 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, /* 0x 820 */ + 0, 0, 0, 0,253, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x 830 */ + 0, 69, 0, 0, 0, 78, 50, 68, 68, 85, 77, 77, 49, 0,253, 1, /* 0x 840 */ + 0, 0, 78, 50, 68, 83, 77, 65, 53, 48, 0,253, 1, 0, 0, 78, /* 0x 850 */ + 50, 68, 70, 65, 83, 53, 48, 0,255, 1, 0, 0, 78, 50, 68, 68, /* 0x 860 */ + 69, 67, 53, 48, 0, 2, 2, 0, 0, 78, 50, 68, 83, 77, 65, 54, /* 0x 870 */ + 48, 0, 11, 2, 0, 0, 0, 0, 0, 0, 23, 2, 0, 0, 78, 50, /* 0x 880 */ + 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 70, 65, /* 0x 890 */ + 83, 54, 48, 0, 23, 2, 0, 0, 0, 0, 0, 0, 34, 2, 0, 0, /* 0x 8a0 */ + 78, 50, 68, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 8b0 */ + 0, 48, 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, /* 0x 8c0 */ + 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 48, 2, 0, 0, 0, /* 0x 8d0 */ + 0, 0, 0, 70, 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, /* 0x 8e0 */ + 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 54, 48, 0, 70, 2, 0, /* 0x 8f0 */ + 0, 78, 82, 86, 50, 68, 69, 78, 68, 0, 70, 2, 0, 0, 78, 50, /* 0x 900 */ + 69, 83, 77, 65, 49, 48, 0, 70, 2, 0, 0, 0, 0, 0, 0, 72, /* 0x 910 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, /* 0x 920 */ + 78, 50, 69, 70, 65, 83, 49, 48, 0, 73, 2, 0, 0, 0, 0, 0, /* 0x 930 */ + 0, 75, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 4, 0, /* 0x 940 */ + 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 75, 2, 0, 0, 78, /* 0x 950 */ + 50, 69, 68, 69, 67, 49, 48, 0, 81, 2, 0, 0, 78, 50, 69, 83, /* 0x 960 */ + 77, 65, 50, 48, 0, 92, 2, 0, 0, 0, 0, 0, 0, 94, 2, 0, /* 0x 970 */ + 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, /* 0x 980 */ + 69, 70, 65, 83, 50, 48, 0, 97, 2, 0, 0, 0, 0, 0, 0,101, /* 0x 990 */ + 2, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, /* 0x 9a0 */ + 78, 50, 69, 68, 69, 67, 50, 48, 0,106, 2, 0, 0, 78, 50, 69, /* 0x 9b0 */ + 83, 77, 65, 51, 48, 0,119, 2, 0, 0, 0, 0, 0, 0,132, 2, /* 0x 9c0 */ + 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, 0, 78, /* 0x 9d0 */ + 50, 69, 70, 65, 83, 51, 48, 0,132, 2, 0, 0, 0, 0, 0, 0, /* 0x 9e0 */ +138, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, /* 0x 9f0 */ + 0, 0, 0, 0, 0,147, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, /* 0x a00 */ + 48, 0, 31, 0, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0,147, /* 0x a10 */ + 2, 0, 0, 0, 0, 0, 0,163, 2, 0, 0, 78, 50, 69, 68, 69, /* 0x a20 */ + 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,178, 2, 0, 0, /* 0x a30 */ + 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x a40 */ + 0,196, 2, 0, 0, 78, 50, 69, 68, 69, 67, 54, 48, 0, 0, 0, /* 0x a50 */ + 0, 0, 78, 50, 69, 83, 77, 65, 52, 48, 0,242, 2, 0, 0, 0, /* 0x a60 */ + 0, 0, 0,255, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, /* 0x a70 */ + 82, 0, 0, 0, 78, 50, 69, 70, 65, 83, 52, 48, 0,255, 2, 0, /* 0x a80 */ + 0, 0, 0, 0, 0, 3, 3, 0, 0, 78, 50, 69, 68, 69, 67, 51, /* 0x a90 */ + 48, 0, 82, 0, 0, 0, 0, 0, 0, 0, 14, 3, 0, 0, 78, 50, /* 0x aa0 */ + 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 68, 85, /* 0x ab0 */ + 77, 77, 49, 0, 14, 3, 0, 0, 78, 50, 69, 83, 77, 65, 53, 48, /* 0x ac0 */ + 0, 14, 3, 0, 0, 78, 50, 69, 70, 65, 83, 53, 48, 0, 16, 3, /* 0x ad0 */ + 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, 19, 3, 0, 0, 78, /* 0x ae0 */ + 50, 69, 83, 77, 65, 54, 48, 0, 28, 3, 0, 0, 0, 0, 0, 0, /* 0x af0 */ + 40, 3, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, /* 0x b00 */ + 0, 78, 50, 69, 70, 65, 83, 54, 48, 0, 40, 3, 0, 0, 0, 0, /* 0x b10 */ + 0, 0, 51, 3, 0, 0, 78, 50, 69, 70, 65, 83, 54, 49, 0, 0, /* 0x b20 */ + 0, 0, 0, 0, 0, 0, 0, 65, 3, 0, 0, 78, 50, 69, 68, 69, /* 0x b30 */ + 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, 49, /* 0x b40 */ + 0, 65, 3, 0, 0, 0, 0, 0, 0, 87, 3, 0, 0, 78, 50, 69, /* 0x b50 */ + 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x b60 */ + 54, 48, 0, 87, 3, 0, 0, 78, 82, 86, 50, 69, 69, 78, 68, 0, /* 0x b70 */ + 87, 3, 0, 0, 87, 67, 76, 69, 77, 65, 73, 50, 0, 87, 3, 0, /* 0x b80 */ + 0, 87, 67, 65, 76, 76, 84, 82, 73, 0, 96, 3, 0, 0, 87, 67, /* 0x b90 */ + 67, 84, 84, 80, 79, 83, 0, 96, 3, 0, 0, 87, 67, 67, 84, 84, /* 0x ba0 */ + 78, 85, 76, 0,102, 3, 0, 0, 87, 67, 65, 76, 76, 84, 82, 49, /* 0x bb0 */ + 0,104, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0,104, 3, /* 0x bc0 */ + 0, 0, 67, 84, 67, 76, 69, 86, 69, 49, 0,118, 3, 0, 0, 0, /* 0x bd0 */ + 0, 0, 0,123, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, /* 0x be0 */ + 5, 0, 0, 0, 67, 65, 76, 76, 84, 82, 48, 49, 0,123, 3, 0, /* 0x bf0 */ + 0, 67, 84, 68, 85, 77, 77, 89, 49, 0,128, 3, 0, 0, 67, 84, /* 0x c00 */ + 66, 83, 72, 82, 48, 49, 0,128, 3, 0, 0, 67, 84, 66, 82, 79, /* 0x c10 */ + 82, 48, 49, 0,132, 3, 0, 0, 67, 84, 66, 83, 87, 65, 48, 49, /* 0x c20 */ + 0,134, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 50, 0,139, 3, /* 0x c30 */ + 0, 0, 0, 0, 0, 0,155, 3, 0, 0, 67, 65, 76, 76, 84, 82, /* 0x c40 */ + 48, 48, 0, 10, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, 0, /* 0x c50 */ +155, 3, 0, 0, 67, 65, 76, 76, 84, 82, 69, 56, 0,160, 3, 0, /* 0x c60 */ + 0, 67, 65, 76, 76, 84, 82, 69, 57, 0,162, 3, 0, 0, 67, 65, /* 0x c70 */ + 76, 76, 84, 82, 49, 49, 0,164, 3, 0, 0, 0, 0, 0, 0,168, /* 0x c80 */ + 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, 7, 0, 0, 0, /* 0x c90 */ + 67, 84, 67, 76, 69, 86, 69, 50, 0,168, 3, 0, 0, 0, 0, 0, /* 0x ca0 */ + 0,173, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, 0, 0, 0, /* 0x cb0 */ + 0, 0, 67, 65, 76, 76, 84, 82, 49, 50, 0,173, 3, 0, 0, 67, /* 0x cc0 */ + 84, 68, 85, 77, 77, 89, 50, 0,175, 3, 0, 0, 67, 84, 66, 83, /* 0x cd0 */ + 72, 82, 49, 49, 0,175, 3, 0, 0, 67, 84, 66, 82, 79, 82, 49, /* 0x ce0 */ + 49, 0,179, 3, 0, 0, 67, 84, 66, 83, 87, 65, 49, 49, 0,181, /* 0x cf0 */ + 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0,186, 3, 0, 0, /* 0x d00 */ + 0, 0, 0, 0,193, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, /* 0x d10 */ + 0, 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, 68, 0,193, 3, /* 0x d20 */ + 0, 0, 87, 67, 68, 85, 77, 77, 89, 49, 0,193, 3, 0, 0, 87, /* 0x d30 */ + 67, 82, 69, 76, 79, 67, 49, 0,193, 3, 0, 0, 82, 69, 76, 79, /* 0x d40 */ + 67, 51, 50, 48, 0,196, 3, 0, 0, 0, 0, 0, 0,205, 3, 0, /* 0x d50 */ + 0, 82, 69, 76, 79, 67, 51, 50, 74, 0, 2, 0, 0, 0, 82, 69, /* 0x d60 */ + 76, 51, 50, 66, 73, 71, 0,237, 3, 0, 0, 0, 0, 0, 0,241, /* 0x d70 */ + 3, 0, 0, 82, 69, 76, 79, 67, 51, 50, 48, 0, 13, 0, 0, 0, /* 0x d80 */ + 82, 69, 76, 79, 67, 51, 50, 74, 0,246, 3, 0, 0, 0, 0, 0, /* 0x d90 */ + 0,248, 3, 0, 0, 82, 69, 76, 79, 67, 51, 50, 48, 0, 13, 0, /* 0x da0 */ + 0, 0, 82, 69, 76, 51, 50, 69, 78, 68, 0,248, 3, 0, 0, 87, /* 0x db0 */ + 67, 68, 85, 77, 77, 89, 50, 0,248, 3, 0, 0, 87, 67, 82, 69, /* 0x dc0 */ + 76, 83, 69, 76, 0,248, 3, 0, 0, 87, 67, 76, 69, 77, 65, 73, /* 0x dd0 */ + 52, 0,250, 3, 0, 0, 87, 67, 84, 72, 69, 69, 78, 68, 0, 15, /* 0x de0 */ + 4, 0, 0,255,255,255,255, 15, 4 /* 0x df0 */ +}; diff --git a/src/stub/i386-linux.elf-entry.h b/src/stub/i386-linux.elf-entry.h new file mode 100644 index 00000000..802b2cbd --- /dev/null +++ b/src/stub/i386-linux.elf-entry.h @@ -0,0 +1,370 @@ +/* i386-linux.elf-entry.h -- created from i386-linux.elf-entry.bin, 5353 (0x14e9) 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 + + */ + + +#define LINUX_I386ELF_LOADER_SIZE 5353 +#define LINUX_I386ELF_LOADER_ADLER32 0x73ead289 +#define LINUX_I386ELF_LOADER_CRC32 0x30e5b9ec + +unsigned char linux_i386elf_loader[5353] = { +232, 0, 0, 0, 0, 96,106, 63,139,116, 36, 40,139,124, 36, 48, /* 0x 0 */ +131,205,255,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219, /* 0x 10 */ +117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7, /* 0x 20 */ +114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, /* 0x 30 */ + 17,219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,115, /* 0x 40 */ + 0, 1,219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, /* 0x 50 */ + 49,201,131,232, 3,114, 13,193,224, 8,138, 6, 70,131,240,255, /* 0x 60 */ +116, 0,137,197, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 70 */ +201, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, 0, /* 0x 80 */ + 65, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219, /* 0x 90 */ +117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, /* 0x a0 */ + 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129, /* 0x b0 */ +253, 0,243,255,255,131,209, 1, 86,141, 52, 47,243,164, 94,233, /* 0x c0 */ + 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0,138, /* 0x d0 */ + 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131, /* 0x e0 */ +194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, /* 0x f0 */ + 0, 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219, /* 0x 100 */ +117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7, /* 0x 110 */ +114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, /* 0x 120 */ + 17,219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, /* 0x 130 */ + 0, 1,219,115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, /* 0x 140 */ + 72, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, /* 0x 150 */ + 49,201,131,232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255, /* 0x 160 */ +116, 0,209,248,137,197,235, 11, 1,219,117, 7,139, 30,131,238, /* 0x 170 */ +252, 17,219, 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 180 */ + 17,201,117, 0, 65, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 190 */ + 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1, /* 0x 1a0 */ +219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65, /* 0x 1b0 */ +131,193, 2,129,253, 0,251,255,255,131,209, 1, 86,141, 52, 47, /* 0x 1c0 */ +243,164, 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, /* 0x 1d0 */ + 15,118, 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, /* 0x 1e0 */ + 0,139, 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, /* 0x 1f0 */ + 1,207,233, 0, 0, 0, 0,235, 0,164,235, 0,138, 6, 70,136, /* 0x 200 */ + 7, 71, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 49, /* 0x 210 */ +192, 64,138, 7,114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, /* 0x 220 */ + 30,131,238,252, 17,219, 17,192, 1,219,117, 7,139, 30,131,238, /* 0x 230 */ +252, 17,219,114, 0, 1,219,115, 11,117, 0,139, 30,131,238,252, /* 0x 240 */ + 17,219,114, 0, 72, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 250 */ + 17,192,235, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 260 */ +201,235, 0, 49,201,131,232, 3,114, 17,193,224, 8,138, 6, 70, /* 0x 270 */ +131,240,255,116, 0,209,248,137,197,235, 11, 1,219,117, 7,139, /* 0x 280 */ + 30,131,238,252, 17,219,114,204, 65, 1,219,117, 7,139, 30,131, /* 0x 290 */ +238,252, 17,219,114,190, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 2a0 */ +219, 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, /* 0x 2b0 */ + 1,219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, /* 0x 2c0 */ + 65,131,193, 2,129,253, 0,251,255,255,131,209, 2, 86,141, 52, /* 0x 2d0 */ + 47,243,164, 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, /* 0x 2e0 */ + 4, 15,118, 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, /* 0x 2f0 */ + 0, 0,139, 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119, /* 0x 300 */ +241, 1,207,233, 0, 0, 0, 0,185, 84, 69, 88, 76,138, 7, 71, /* 0x 310 */ + 44,232, 60, 1,119,247,128, 63, 63,117, 0,139, 7,138, 95, 4, /* 0x 320 */ +102,193,232, 8,134,196,193,192, 16,134,196, 41,248,128,235,232, /* 0x 330 */ +137, 7,131,199, 5,136,216,226, 0,185, 84, 69, 88, 76,176,232, /* 0x 340 */ +176,233,242,174,117, 0,128, 63, 63,117, 0,139, 7,102,193,232, /* 0x 350 */ + 8,134,196,193,192, 16,134,196, 41,248,171,235, 0,139, 84, 36, /* 0x 360 */ + 40, 3, 84, 36, 44, 57,214,116, 1, 72, 43,124, 36, 48,139, 84, /* 0x 370 */ + 36, 52,137, 58, 90,137, 68, 36, 28, 97,195,235, 0, 90, 88, 89, /* 0x 380 */ +151, 96, 49,219,187, 78, 77, 82, 85,106, 15, 88,138,100, 36, 32, /* 0x 390 */ +106, 15, 91,138,124, 36, 32,138, 84, 36, 32,233, 0, 0, 0, 0, /* 0x 3a0 */ + 15,183, 47, 43,110, 12, 41,221,117, 0,131,237, 1,115, 0,136, /* 0x 3b0 */ + 95,255, 73,136, 7, 71,139, 7,156,102,193,232, 8,193,192, 16, /* 0x 3c0 */ +134,196,157,115, 0,176, 0, 15,200,115, 0,209,232,115, 0,254, /* 0x 3d0 */ +203, 75, 35, 30,125, 2, 3, 30,137, 4,156,235, 0,141, 20, 24, /* 0x 3e0 */ + 15,182,210, 35, 22, 59, 22,114, 2, 43, 22,139, 4,148,254,203, /* 0x 3f0 */ + 75, 35, 30,125, 2, 3, 30,139, 44,156,133,237,117, 0, 80,139, /* 0x 400 */ + 70, 4,254,200, 72, 35, 6,125, 2, 3, 6, 49,237,137, 70, 4, /* 0x 410 */ +135,108,132, 4, 88,137, 44,148,137, 4,156, 41,248,131,233, 4, /* 0x 420 */ + 3, 70, 16, 1,240,137, 7,131,199, 4,235, 0,235, 0, 80,176, /* 0x 430 */ +233,176,232, 80,106, 0, 83,137,230, 94,137,218,178,233,178,232, /* 0x 440 */ + 67,106, 0,254,203, 75,117, 0, 15,183, 7,131,199, 1, 60,128, /* 0x 450 */ +114, 4, 60,143,118, 0, 41,208, 43, 70, 8,131,232, 2,116, 0, /* 0x 460 */ +131,232, 1,114, 0,115, 0,122, 0,123, 0,248,235, 0,131,233, /* 0x 470 */ + 1,127, 0,137,231,185, 4, 1, 0, 0,139, 14,131,193, 5,139, /* 0x 480 */ + 14,131,193, 4, 49,192,243,171,137,252, 86, 97,151, 81, 80, 82, /* 0x 490 */ +195,137,254,235, 0,138, 7,131,199, 1, 60,128,114, 10, 60,143, /* 0x 4a0 */ +119, 6,128,127,254, 15,116, 0, 44,232, 60, 1,119, 0, 56, 23, /* 0x 4b0 */ +117, 0,139, 7,102,193,232, 8,193,192, 16,134,196, 41,248, 1, /* 0x 4c0 */ +240,137, 7,131,199, 4,131,233, 4,138, 7,131,199, 1,226, 0, /* 0x 4d0 */ +131,233, 1,127, 0, 97,195,106, 29, 90,232, 29, 0, 0, 0, 80, /* 0x 4e0 */ + 82, 79, 84, 95, 69, 88, 69, 67,124, 80, 82, 79, 84, 95, 87, 82, /* 0x 4f0 */ + 73, 84, 69, 32,102, 97,105,108,101,100, 46, 10, 89,106, 2, 91, /* 0x 500 */ +106, 4, 88,205,128,179,127,106, 1, 88,205,128, 94,141, 69,247, /* 0x 510 */ + 43, 0,137,194, 3, 64, 72, 5,255, 15, 0, 0, 37, 0,240,255, /* 0x 520 */ +255, 80, 49,201,106,255,106, 50,181, 16,106, 7, 81, 80,137,227, /* 0x 530 */ +106, 90, 88,205,128,133,192,120,158,146,147,252,173, 80, 84, 82, /* 0x 540 */ +173, 80,173, 86,255,213,131,196, 40,195, 93,232,188,255,255,255, /* 0x 550 */ + 76, 69, 88, 69, 67, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 560 */ + 0, 5, 0, 0, 0, 76, 69, 88, 69, 67, 48, 50, 48, 0,115, 0, /* 0x 570 */ + 0, 0, 76, 69, 88, 69, 67, 48, 48, 57, 0, 5, 0, 0, 0, 76, /* 0x 580 */ + 69, 88, 69, 67, 48, 49, 48, 0, 5, 0, 0, 0, 78, 50, 66, 83, /* 0x 590 */ + 77, 65, 49, 48, 0, 19, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, /* 0x 5a0 */ + 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, /* 0x 5b0 */ + 66, 70, 65, 83, 49, 48, 0, 22, 0, 0, 0, 0, 0, 0, 0, 24, /* 0x 5c0 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, /* 0x 5d0 */ + 78, 50, 66, 70, 65, 83, 49, 49, 0, 24, 0, 0, 0, 78, 50, 66, /* 0x 5e0 */ + 68, 69, 67, 49, 48, 0, 30, 0, 0, 0, 78, 50, 66, 83, 77, 65, /* 0x 5f0 */ + 50, 48, 0, 41, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 78, /* 0x 600 */ + 50, 66, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 66, 70, /* 0x 610 */ + 65, 83, 50, 48, 0, 46, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, /* 0x 620 */ + 0, 78, 50, 66, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, /* 0x 630 */ + 66, 68, 69, 67, 50, 48, 0, 55, 0, 0, 0, 78, 50, 66, 83, 77, /* 0x 640 */ + 65, 51, 48, 0, 68, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, /* 0x 650 */ + 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 78, 50, 66, /* 0x 660 */ + 70, 65, 83, 51, 48, 0, 81, 0, 0, 0, 0, 0, 0, 0, 85, 0, /* 0x 670 */ + 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, /* 0x 680 */ + 0, 0, 0, 96, 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, /* 0x 690 */ + 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 96, 0, 0, /* 0x 6a0 */ + 0, 0, 0, 0, 0,114, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, /* 0x 6b0 */ + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,144, 0, 0, 0, 78, 50, /* 0x 6c0 */ + 66, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, 66, 83, 77, /* 0x 6d0 */ + 65, 52, 48, 0,158, 0, 0, 0, 0, 0, 0, 0,171, 0, 0, 0, /* 0x 6e0 */ + 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 78, 50, 66, /* 0x 6f0 */ + 70, 65, 83, 52, 48, 0,171, 0, 0, 0, 0, 0, 0, 0,175, 0, /* 0x 700 */ + 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 0, /* 0x 710 */ + 0, 0, 0,186, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, /* 0x 720 */ + 49, 0, 0, 0, 78, 50, 66, 68, 85, 77, 77, 49, 0,186, 0, 0, /* 0x 730 */ + 0, 78, 50, 66, 83, 77, 65, 53, 48, 0,186, 0, 0, 0, 78, 50, /* 0x 740 */ + 66, 70, 65, 83, 53, 48, 0,188, 0, 0, 0, 78, 50, 66, 68, 69, /* 0x 750 */ + 67, 53, 48, 0,191, 0, 0, 0, 78, 50, 66, 83, 77, 65, 54, 48, /* 0x 760 */ + 0,200, 0, 0, 0, 0, 0, 0, 0,212, 0, 0, 0, 78, 50, 66, /* 0x 770 */ + 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, /* 0x 780 */ + 54, 48, 0,212, 0, 0, 0, 0, 0, 0, 0,223, 0, 0, 0, 78, /* 0x 790 */ + 50, 66, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 7a0 */ +237, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, /* 0x 7b0 */ + 0, 78, 50, 66, 70, 65, 83, 54, 49, 0,237, 0, 0, 0, 0, 0, /* 0x 7c0 */ + 0, 0, 3, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, /* 0x 7d0 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 3, 1, 0, 0, /* 0x 7e0 */ + 78, 82, 86, 50, 66, 69, 78, 68, 0, 3, 1, 0, 0, 78, 50, 68, /* 0x 7f0 */ + 83, 77, 65, 49, 48, 0, 3, 1, 0, 0, 0, 0, 0, 0, 5, 1, /* 0x 800 */ + 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, /* 0x 810 */ + 50, 68, 70, 65, 83, 49, 48, 0, 6, 1, 0, 0, 0, 0, 0, 0, /* 0x 820 */ + 8, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, /* 0x 830 */ + 0, 78, 50, 68, 70, 65, 83, 49, 49, 0, 8, 1, 0, 0, 78, 50, /* 0x 840 */ + 68, 68, 69, 67, 49, 48, 0, 14, 1, 0, 0, 78, 50, 68, 83, 77, /* 0x 850 */ + 65, 50, 48, 0, 25, 1, 0, 0, 0, 0, 0, 0, 27, 1, 0, 0, /* 0x 860 */ + 78, 50, 68, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 68, /* 0x 870 */ + 70, 65, 83, 50, 48, 0, 30, 1, 0, 0, 0, 0, 0, 0, 34, 1, /* 0x 880 */ + 0, 0, 78, 50, 68, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, /* 0x 890 */ + 50, 68, 68, 69, 67, 50, 48, 0, 39, 1, 0, 0, 78, 50, 68, 83, /* 0x 8a0 */ + 77, 65, 51, 48, 0, 52, 1, 0, 0, 0, 0, 0, 0, 65, 1, 0, /* 0x 8b0 */ + 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 78, 50, /* 0x 8c0 */ + 68, 70, 65, 83, 51, 48, 0, 65, 1, 0, 0, 0, 0, 0, 0, 71, /* 0x 8d0 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, /* 0x 8e0 */ + 0, 0, 0, 0, 80, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x 8f0 */ + 0, 16, 0, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 80, 1, /* 0x 900 */ + 0, 0, 0, 0, 0, 0, 96, 1, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 910 */ + 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,114, 1, 0, 0, 78, /* 0x 920 */ + 50, 68, 68, 69, 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 930 */ +148, 1, 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, 0, /* 0x 940 */ + 0, 78, 50, 68, 83, 77, 65, 52, 48, 0,162, 1, 0, 0, 0, 0, /* 0x 950 */ + 0, 0,175, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, /* 0x 960 */ + 0, 0, 0, 78, 50, 68, 70, 65, 83, 52, 48, 0,175, 1, 0, 0, /* 0x 970 */ + 0, 0, 0, 0,179, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x 980 */ + 0, 69, 0, 0, 0, 0, 0, 0, 0,190, 1, 0, 0, 78, 50, 68, /* 0x 990 */ + 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, 78, 50, 68, 68, 85, 77, /* 0x 9a0 */ + 77, 49, 0,190, 1, 0, 0, 78, 50, 68, 83, 77, 65, 53, 48, 0, /* 0x 9b0 */ +190, 1, 0, 0, 78, 50, 68, 70, 65, 83, 53, 48, 0,192, 1, 0, /* 0x 9c0 */ + 0, 78, 50, 68, 68, 69, 67, 53, 48, 0,195, 1, 0, 0, 78, 50, /* 0x 9d0 */ + 68, 83, 77, 65, 54, 48, 0,204, 1, 0, 0, 0, 0, 0, 0,216, /* 0x 9e0 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, /* 0x 9f0 */ + 78, 50, 68, 70, 65, 83, 54, 48, 0,216, 1, 0, 0, 0, 0, 0, /* 0x a00 */ + 0,227, 1, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 0, 0, /* 0x a10 */ + 0, 0, 0, 0, 0, 0,241, 1, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x a20 */ + 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, /* 0x a30 */ +241, 1, 0, 0, 0, 0, 0, 0, 7, 2, 0, 0, 78, 50, 68, 68, /* 0x a40 */ + 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 54, /* 0x a50 */ + 48, 0, 7, 2, 0, 0, 78, 82, 86, 50, 68, 69, 78, 68, 0, 7, /* 0x a60 */ + 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 7, 2, 0, 0, /* 0x a70 */ + 0, 0, 0, 0, 9, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, /* 0x a80 */ + 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 48, 0, 10, 2, /* 0x a90 */ + 0, 0, 0, 0, 0, 0, 12, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x aa0 */ + 49, 48, 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, /* 0x ab0 */ + 12, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 18, 2, 0, /* 0x ac0 */ + 0, 78, 50, 69, 83, 77, 65, 50, 48, 0, 29, 2, 0, 0, 0, 0, /* 0x ad0 */ + 0, 0, 31, 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 2, /* 0x ae0 */ + 0, 0, 0, 78, 50, 69, 70, 65, 83, 50, 48, 0, 34, 2, 0, 0, /* 0x af0 */ + 0, 0, 0, 0, 38, 2, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, /* 0x b00 */ + 0, 0, 0, 0, 0, 78, 50, 69, 68, 69, 67, 50, 48, 0, 43, 2, /* 0x b10 */ + 0, 0, 78, 50, 69, 83, 77, 65, 51, 48, 0, 56, 2, 0, 0, 0, /* 0x b20 */ + 0, 0, 0, 69, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, /* 0x b30 */ + 31, 0, 0, 0, 78, 50, 69, 70, 65, 83, 51, 48, 0, 69, 2, 0, /* 0x b40 */ + 0, 0, 0, 0, 0, 75, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, /* 0x b50 */ + 48, 0, 31, 0, 0, 0, 0, 0, 0, 0, 84, 2, 0, 0, 78, 50, /* 0x b60 */ + 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, 0, 78, 50, 69, 68, 69, /* 0x b70 */ + 67, 51, 48, 0, 84, 2, 0, 0, 0, 0, 0, 0,100, 2, 0, 0, /* 0x b80 */ + 78, 50, 69, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x b90 */ + 0,115, 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, 0, /* 0x ba0 */ + 0, 0, 0, 0, 0, 0,133, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x bb0 */ + 54, 48, 0, 0, 0, 0, 0, 78, 50, 69, 83, 77, 65, 52, 48, 0, /* 0x bc0 */ +179, 2, 0, 0, 0, 0, 0, 0,192, 2, 0, 0, 78, 50, 69, 68, /* 0x bd0 */ + 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 70, 65, 83, 52, /* 0x be0 */ + 48, 0,192, 2, 0, 0, 0, 0, 0, 0,196, 2, 0, 0, 78, 50, /* 0x bf0 */ + 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 0, 0, 0, 0,207, /* 0x c00 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, /* 0x c10 */ + 78, 50, 69, 68, 85, 77, 77, 49, 0,207, 2, 0, 0, 78, 50, 69, /* 0x c20 */ + 83, 77, 65, 53, 48, 0,207, 2, 0, 0, 78, 50, 69, 70, 65, 83, /* 0x c30 */ + 53, 48, 0,209, 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, /* 0x c40 */ +212, 2, 0, 0, 78, 50, 69, 83, 77, 65, 54, 48, 0,221, 2, 0, /* 0x c50 */ + 0, 0, 0, 0, 0,233, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, /* 0x c60 */ + 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, 48, 0,233, /* 0x c70 */ + 2, 0, 0, 0, 0, 0, 0,244, 2, 0, 0, 78, 50, 69, 70, 65, /* 0x c80 */ + 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, /* 0x c90 */ + 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, /* 0x ca0 */ + 70, 65, 83, 54, 49, 0, 2, 3, 0, 0, 0, 0, 0, 0, 24, 3, /* 0x cb0 */ + 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, /* 0x cc0 */ + 50, 69, 68, 69, 67, 54, 48, 0, 24, 3, 0, 0, 78, 82, 86, 50, /* 0x cd0 */ + 69, 69, 78, 68, 0, 24, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, /* 0x ce0 */ + 48, 0, 24, 3, 0, 0, 67, 84, 67, 76, 69, 86, 69, 49, 0, 38, /* 0x cf0 */ + 3, 0, 0, 0, 0, 0, 0, 43, 3, 0, 0, 67, 65, 76, 76, 84, /* 0x d00 */ + 82, 48, 48, 0, 5, 0, 0, 0, 67, 65, 76, 76, 84, 82, 48, 49, /* 0x d10 */ + 0, 43, 3, 0, 0, 67, 84, 68, 85, 77, 77, 89, 49, 0, 48, 3, /* 0x d20 */ + 0, 0, 67, 84, 66, 83, 72, 82, 48, 49, 0, 48, 3, 0, 0, 67, /* 0x d30 */ + 84, 66, 82, 79, 82, 48, 49, 0, 52, 3, 0, 0, 67, 84, 66, 83, /* 0x d40 */ + 87, 65, 48, 49, 0, 54, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, /* 0x d50 */ + 50, 0, 59, 3, 0, 0, 0, 0, 0, 0, 73, 3, 0, 0, 67, 65, /* 0x d60 */ + 76, 76, 84, 82, 48, 48, 0, 10, 0, 0, 0, 67, 65, 76, 76, 84, /* 0x d70 */ + 82, 49, 48, 0, 73, 3, 0, 0, 67, 65, 76, 76, 84, 82, 69, 56, /* 0x d80 */ + 0, 78, 3, 0, 0, 67, 65, 76, 76, 84, 82, 69, 57, 0, 80, 3, /* 0x d90 */ + 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, 0, 82, 3, 0, 0, 0, /* 0x da0 */ + 0, 0, 0, 86, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, /* 0x db0 */ + 5, 0, 0, 0, 67, 84, 67, 76, 69, 86, 69, 50, 0, 86, 3, 0, /* 0x dc0 */ + 0, 0, 0, 0, 0, 91, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, /* 0x dd0 */ + 49, 0, 0, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 50, 0, 91, /* 0x de0 */ + 3, 0, 0, 67, 84, 68, 85, 77, 77, 89, 50, 0, 93, 3, 0, 0, /* 0x df0 */ + 67, 84, 66, 83, 72, 82, 49, 49, 0, 93, 3, 0, 0, 67, 84, 66, /* 0x e00 */ + 82, 79, 82, 49, 49, 0, 97, 3, 0, 0, 67, 84, 66, 83, 87, 65, /* 0x e10 */ + 49, 49, 0, 99, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, /* 0x e20 */ +104, 3, 0, 0, 0, 0, 0, 0,109, 3, 0, 0, 67, 65, 76, 76, /* 0x e30 */ + 84, 82, 49, 48, 0, 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, /* 0x e40 */ + 68, 0,109, 3, 0, 0, 76, 69, 88, 69, 67, 48, 49, 53, 0,109, /* 0x e50 */ + 3, 0, 0, 76, 88, 85, 78, 70, 48, 48, 48, 0,139, 3, 0, 0, /* 0x e60 */ + 0, 0, 0, 0,141, 3, 0, 0, 76, 88, 85, 78, 70, 48, 49, 48, /* 0x e70 */ + 0, 5, 0, 0, 0, 76, 88, 85, 78, 70, 48, 48, 50, 0,141, 3, /* 0x e80 */ + 0, 0, 77, 82, 85, 66, 89, 84, 69, 48, 0,146, 3, 0, 0, 76, /* 0x e90 */ + 88, 77, 82, 85, 48, 48, 53, 0,148, 3, 0, 0, 76, 88, 77, 82, /* 0x ea0 */ + 85, 48, 48, 54, 0,153, 3, 0, 0, 76, 88, 77, 82, 85, 48, 48, /* 0x eb0 */ + 55, 0,160, 3, 0, 0, 76, 88, 85, 78, 70, 48, 48, 56, 0,167, /* 0x ec0 */ + 3, 0, 0, 76, 88, 85, 78, 70, 48, 49, 48, 0,171, 3, 0, 0, /* 0x ed0 */ + 0, 0, 0, 0,176, 3, 0, 0, 76, 88, 85, 78, 70, 48, 52, 50, /* 0x ee0 */ + 0, 0, 0, 0, 0, 76, 88, 74, 67, 67, 48, 49, 48, 0,176, 3, /* 0x ef0 */ + 0, 0, 76, 88, 77, 82, 85, 48, 52, 53, 0,179, 3, 0, 0, 76, /* 0x f00 */ + 88, 77, 82, 85, 48, 52, 54, 0,182, 3, 0, 0, 76, 88, 74, 67, /* 0x f10 */ + 67, 48, 50, 48, 0,184, 3, 0, 0, 0, 0, 0, 0,186, 3, 0, /* 0x f20 */ + 0, 76, 88, 85, 78, 70, 48, 51, 52, 0, 0, 0, 0, 0, 76, 88, /* 0x f30 */ + 74, 67, 67, 48, 50, 49, 0,186, 3, 0, 0, 0, 0, 0, 0,191, /* 0x f40 */ + 3, 0, 0, 76, 88, 85, 78, 70, 48, 51, 52, 0, 0, 0, 0, 0, /* 0x f50 */ + 76, 88, 74, 67, 67, 48, 50, 51, 0,191, 3, 0, 0, 76, 88, 85, /* 0x f60 */ + 78, 70, 48, 51, 55, 0,198, 3, 0, 0, 76, 88, 85, 78, 70, 51, /* 0x f70 */ + 56, 54, 0,200, 3, 0, 0, 76, 88, 85, 78, 70, 51, 56, 55, 0, /* 0x f80 */ +201, 3, 0, 0, 76, 88, 85, 78, 70, 51, 56, 56, 0,210, 3, 0, /* 0x f90 */ + 0, 0, 0, 0, 0,213, 3, 0, 0, 76, 88, 85, 78, 70, 48, 52, /* 0x fa0 */ + 48, 0, 0, 0, 0, 0, 76, 88, 85, 78, 70, 52, 56, 54, 0,213, /* 0x fb0 */ + 3, 0, 0, 76, 88, 85, 78, 70, 52, 56, 55, 0,217, 3, 0, 0, /* 0x fc0 */ + 0, 0, 0, 0,219, 3, 0, 0, 76, 88, 85, 78, 70, 48, 52, 48, /* 0x fd0 */ + 0, 0, 0, 0, 0, 76, 88, 77, 82, 85, 48, 54, 53, 0,219, 3, /* 0x fe0 */ + 0, 0, 0, 0, 0, 0,223, 3, 0, 0, 76, 88, 77, 82, 85, 48, /* 0x ff0 */ + 55, 48, 0, 5, 0, 0, 0, 77, 82, 85, 66, 89, 84, 69, 51, 0, /* 0x1000 */ +223, 3, 0, 0, 77, 82, 85, 65, 82, 66, 51, 48, 0,225, 3, 0, /* 0x1010 */ + 0, 77, 82, 85, 66, 73, 84, 83, 51, 0,226, 3, 0, 0, 77, 82, /* 0x1020 */ + 85, 65, 82, 66, 52, 48, 0,228, 3, 0, 0, 76, 88, 77, 82, 85, /* 0x1030 */ + 48, 55, 48, 0,232, 3, 0, 0, 0, 0, 0, 0,237, 3, 0, 0, /* 0x1040 */ + 76, 88, 85, 78, 70, 48, 52, 48, 0, 0, 0, 0, 0, 77, 82, 85, /* 0x1050 */ + 66, 89, 84, 69, 52, 0,240, 3, 0, 0, 77, 82, 85, 66, 73, 84, /* 0x1060 */ + 83, 52, 0,243, 3, 0, 0, 77, 82, 85, 65, 82, 66, 53, 48, 0, /* 0x1070 */ +245, 3, 0, 0, 76, 88, 77, 82, 85, 48, 56, 48, 0,251, 3, 0, /* 0x1080 */ + 0, 77, 82, 85, 66, 89, 84, 69, 53, 0,254, 3, 0, 0, 77, 82, /* 0x1090 */ + 85, 65, 82, 66, 54, 48, 0, 0, 4, 0, 0, 77, 82, 85, 66, 73, /* 0x10a0 */ + 84, 83, 53, 0, 1, 4, 0, 0, 77, 82, 85, 65, 82, 66, 55, 48, /* 0x10b0 */ + 0, 3, 4, 0, 0, 76, 88, 77, 82, 85, 48, 57, 48, 0, 7, 4, /* 0x10c0 */ + 0, 0, 0, 0, 0, 0, 14, 4, 0, 0, 76, 88, 77, 82, 85, 49, /* 0x10d0 */ + 48, 48, 0, 10, 0, 0, 0, 77, 82, 85, 66, 89, 84, 69, 54, 0, /* 0x10e0 */ + 18, 4, 0, 0, 77, 82, 85, 65, 82, 66, 56, 48, 0, 20, 4, 0, /* 0x10f0 */ + 0, 77, 82, 85, 66, 73, 84, 83, 54, 0, 21, 4, 0, 0, 77, 82, /* 0x1100 */ + 85, 65, 82, 66, 57, 48, 0, 23, 4, 0, 0, 76, 88, 77, 82, 85, /* 0x1110 */ + 49, 48, 48, 0, 27, 4, 0, 0, 76, 88, 85, 78, 70, 48, 52, 48, /* 0x1120 */ + 0, 43, 4, 0, 0, 76, 88, 77, 82, 85, 49, 49, 48, 0, 48, 4, /* 0x1130 */ + 0, 0, 76, 88, 77, 82, 85, 49, 49, 49, 0, 51, 4, 0, 0, 76, /* 0x1140 */ + 88, 85, 78, 70, 48, 52, 49, 0, 53, 4, 0, 0, 0, 0, 0, 0, /* 0x1150 */ + 60, 4, 0, 0, 76, 88, 85, 78, 70, 48, 51, 52, 0, 0, 0, 0, /* 0x1160 */ + 0, 76, 88, 85, 78, 70, 48, 52, 50, 0, 60, 4, 0, 0, 76, 69, /* 0x1170 */ + 88, 69, 67, 48, 49, 54, 0, 60, 4, 0, 0, 0, 0, 0, 0, 62, /* 0x1180 */ + 4, 0, 0, 76, 88, 85, 78, 70, 48, 52, 50, 0, 0, 0, 0, 0, /* 0x1190 */ + 76, 88, 77, 82, 85, 48, 49, 48, 0, 62, 4, 0, 0, 76, 88, 74, /* 0x11a0 */ + 77, 80, 65, 48, 48, 0, 63, 4, 0, 0, 76, 88, 67, 65, 76, 76, /* 0x11b0 */ + 66, 48, 0, 65, 4, 0, 0, 76, 88, 85, 78, 70, 48, 50, 49, 0, /* 0x11c0 */ + 67, 4, 0, 0, 76, 88, 77, 82, 85, 48, 50, 50, 0, 73, 4, 0, /* 0x11d0 */ + 0, 76, 88, 74, 77, 80, 65, 48, 49, 0, 76, 4, 0, 0, 76, 88, /* 0x11e0 */ + 67, 65, 76, 76, 66, 49, 0, 78, 4, 0, 0, 77, 82, 85, 66, 73, /* 0x11f0 */ + 84, 83, 49, 0, 80, 4, 0, 0, 76, 88, 77, 82, 85, 48, 51, 48, /* 0x1200 */ + 0, 81, 4, 0, 0, 77, 82, 85, 66, 89, 84, 69, 49, 0, 83, 4, /* 0x1210 */ + 0, 0, 77, 82, 85, 65, 82, 66, 49, 48, 0, 85, 4, 0, 0, 76, /* 0x1220 */ + 88, 77, 82, 85, 48, 52, 48, 0, 86, 4, 0, 0, 0, 0, 0, 0, /* 0x1230 */ + 88, 4, 0, 0, 76, 88, 77, 82, 85, 48, 51, 48, 0, 0, 0, 0, /* 0x1240 */ + 0, 76, 88, 85, 78, 70, 48, 51, 48, 0, 88, 4, 0, 0, 76, 88, /* 0x1250 */ + 74, 67, 67, 48, 48, 48, 0, 94, 4, 0, 0, 0, 0, 0, 0,102, /* 0x1260 */ + 4, 0, 0, 76, 88, 74, 67, 67, 48, 49, 48, 0, 0, 0, 0, 0, /* 0x1270 */ + 76, 88, 67, 74, 48, 77, 82, 85, 0,102, 4, 0, 0, 76, 88, 67, /* 0x1280 */ + 74, 49, 77, 82, 85, 0,104, 4, 0, 0, 76, 88, 67, 65, 76, 74, /* 0x1290 */ + 77, 80, 0,107, 4, 0, 0, 76, 88, 67, 65, 76, 76, 48, 48, 0, /* 0x12a0 */ +110, 4, 0, 0, 0, 0, 0, 0,112, 4, 0, 0, 76, 88, 85, 78, /* 0x12b0 */ + 70, 48, 51, 55, 0, 0, 0, 0, 0, 76, 88, 67, 65, 76, 76, 48, /* 0x12c0 */ + 49, 0,112, 4, 0, 0, 76, 88, 67, 74, 50, 77, 82, 85, 0,115, /* 0x12d0 */ + 4, 0, 0, 0, 0, 0, 0,117, 4, 0, 0, 76, 88, 85, 78, 70, /* 0x12e0 */ + 48, 51, 55, 0, 0, 0, 0, 0, 76, 88, 67, 74, 52, 77, 82, 85, /* 0x12f0 */ + 0,117, 4, 0, 0, 0, 0, 0, 0,119, 4, 0, 0, 76, 88, 85, /* 0x1300 */ + 78, 70, 48, 51, 52, 0, 0, 0, 0, 0, 76, 88, 67, 74, 54, 77, /* 0x1310 */ + 82, 85, 0,119, 4, 0, 0, 0, 0, 0, 0,121, 4, 0, 0, 76, /* 0x1320 */ + 88, 67, 74, 56, 77, 82, 85, 0, 1, 0, 0, 0, 76, 88, 67, 74, /* 0x1330 */ + 55, 77, 82, 85, 0,121, 4, 0, 0, 0, 0, 0, 0,123, 4, 0, /* 0x1340 */ + 0, 76, 88, 67, 74, 56, 77, 82, 85, 0, 1, 0, 0, 0, 76, 88, /* 0x1350 */ + 67, 74, 56, 77, 82, 85, 0,123, 4, 0, 0, 0, 0, 0, 0,126, /* 0x1360 */ + 4, 0, 0, 76, 88, 85, 78, 70, 48, 51, 55, 0, 0, 0, 0, 0, /* 0x1370 */ + 76, 88, 85, 78, 70, 48, 51, 52, 0,126, 4, 0, 0, 0, 0, 0, /* 0x1380 */ + 0,131, 4, 0, 0, 76, 88, 85, 78, 70, 48, 51, 48, 0, 0, 0, /* 0x1390 */ + 0, 0, 76, 88, 77, 82, 85, 48, 53, 53, 0,131, 4, 0, 0, 77, /* 0x13a0 */ + 82, 85, 66, 89, 84, 69, 50, 0,133, 4, 0, 0, 77, 82, 85, 66, /* 0x13b0 */ + 73, 84, 83, 50, 0,138, 4, 0, 0, 77, 82, 85, 65, 82, 66, 50, /* 0x13c0 */ + 48, 0,143, 4, 0, 0, 76, 88, 77, 82, 85, 48, 53, 55, 0,148, /* 0x13d0 */ + 4, 0, 0, 76, 88, 77, 82, 85, 48, 53, 56, 0,154, 4, 0, 0, /* 0x13e0 */ + 76, 88, 85, 78, 70, 48, 51, 53, 0,155, 4, 0, 0, 67, 75, 76, /* 0x13f0 */ + 76, 84, 82, 48, 48, 0,161, 4, 0, 0, 0, 0, 0, 0,165, 4, /* 0x1400 */ + 0, 0, 67, 75, 76, 76, 84, 82, 50, 48, 0, 30, 0, 0, 0, 67, /* 0x1410 */ + 75, 76, 76, 84, 82, 49, 48, 0,170, 4, 0, 0, 0, 0, 0, 0, /* 0x1420 */ +184, 4, 0, 0, 67, 75, 76, 76, 84, 82, 50, 48, 0, 6, 0, 0, /* 0x1430 */ + 0, 67, 75, 76, 76, 84, 82, 50, 48, 0,184, 4, 0, 0, 0, 0, /* 0x1440 */ + 0, 0,190, 4, 0, 0, 67, 75, 76, 76, 84, 82, 52, 48, 0, 0, /* 0x1450 */ + 0, 0, 0, 0, 0, 0, 0,194, 4, 0, 0, 67, 75, 76, 76, 84, /* 0x1460 */ + 82, 52, 48, 0, 0, 0, 0, 0, 67, 75, 76, 76, 84, 82, 51, 48, /* 0x1470 */ + 0,217, 4, 0, 0, 0, 0, 0, 0,224, 4, 0, 0, 67, 75, 76, /* 0x1480 */ + 76, 84, 82, 49, 48, 0, 14, 0, 0, 0, 67, 75, 76, 76, 84, 82, /* 0x1490 */ + 52, 48, 0,224, 4, 0, 0, 0, 0, 0, 0,229, 4, 0, 0, 67, /* 0x14a0 */ + 75, 76, 76, 84, 82, 48, 48, 0, 4, 0, 0, 0, 76, 69, 88, 69, /* 0x14b0 */ + 67, 48, 49, 55, 0,229, 4, 0, 0, 76, 69, 88, 69, 67, 48, 50, /* 0x14c0 */ + 48, 0,231, 4, 0, 0, 88, 84, 72, 69, 69, 78, 68, 88, 0, 96, /* 0x14d0 */ + 5, 0, 0,255,255,255,255, 96, 5 /* 0x14e0 */ +}; diff --git a/src/stub/i386-linux.elf-fold.h b/src/stub/i386-linux.elf-fold.h new file mode 100644 index 00000000..65a59223 --- /dev/null +++ b/src/stub/i386-linux.elf-fold.h @@ -0,0 +1,137 @@ +/* i386-linux.elf-fold.h -- created from i386-linux.elf-fold.bin, 1622 (0x656) 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 + + */ + + +#define LINUX_I386ELF_FOLD_SIZE 1622 +#define LINUX_I386ELF_FOLD_ADLER32 0x0526bd6c +#define LINUX_I386ELF_FOLD_CRC32 0x143cc952 + +unsigned char linux_i386elf_fold[1622] = { +127, 69, 76, 70, 1, 1, 1, 0, 76,105,110,117,120, 0, 0, 0, /* 0x 0 */ + 2, 0, 3, 0, 1, 0, 0, 0,128, 16,192, 0, 52, 0, 0, 0, /* 0x 10 */ + 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */ + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16,192, 0, /* 0x 30 */ + 0, 16,192, 0, 86, 6, 0, 0, 88, 6, 0, 0, 5, 0, 0, 0, /* 0x 40 */ + 0, 16, 0, 0, 1, 0, 0, 0, 86, 6, 0, 0, 88, 22,192, 0, /* 0x 50 */ + 88, 22,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, /* 0x 60 */ + 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */ + 41,201,186,120, 2, 0, 0,137,230,137,231,232,121, 0, 0, 0, /* 0x 80 */ +137,230,209,234, 25,192, 41,193,141, 36,196,133,210,117,243,137, /* 0x 90 */ +231,232, 99, 0, 0, 0,129,236, 0, 10, 0, 0, 83,139, 83, 72, /* 0x a0 */ +141,148, 26,255, 31, 0, 0,129,226, 0,240,255,255, 82, 41,192, /* 0x b0 */ +102,131,123, 16, 3,117, 1,146, 80,139,115, 24,141,131,140, 0, /* 0x c0 */ + 0, 0, 41,198,139, 24,139, 72, 4,131,193, 12,141, 84, 36, 12, /* 0x d0 */ + 96, 71,232, 92, 4, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, /* 0x e0 */ + 0, 0, 80, 79, 41,192, 60,175,175,117,252, 80, 80, 80, 80, 80, /* 0x f0 */ + 80, 80, 80, 41,217,176, 91,255, 39,173,171,133,192,117,250,173, /* 0x 100 */ +171,133,192,117,250, 87,173,171,131,248, 32,115, 3, 15,179,194, /* 0x 110 */ +133,192,173,171,117,240,131,239, 8, 1,201, 64,243,171, 72,171, /* 0x 120 */ +171, 95,195, 83,141, 92, 36, 8,106, 90, 88,205,128, 91,195, 0, /* 0x 130 */ + 87, 86,137,206, 83,137,195, 57, 8,139,120, 4,115, 10,106,127, /* 0x 140 */ + 91,106, 1, 88,205,128,235,254,133,201,116, 8,138, 7, 71,136, /* 0x 150 */ + 2, 66,226,248, 1,115, 4, 41, 51, 91, 94, 95,195, 85,137,229, /* 0x 160 */ + 87, 86,137,198, 83,137,211,131,236, 24,139, 69, 8,139,125, 12, /* 0x 170 */ +137, 69,220,131, 58, 0, 15,132,184, 0, 0, 0,141, 85,228,185, /* 0x 180 */ + 12, 0, 0, 0,137,240,232,165,255,255,255,139, 69,228,139, 77, /* 0x 190 */ +232,133,192,117, 19,129,249, 85, 80, 88, 33,117, 15,131, 62, 0, /* 0x 1a0 */ + 15,132,142, 0, 0, 0,235, 4,133,201,117, 10,106,127, 91,106, /* 0x 1b0 */ + 1, 88,205,128,235,254, 57,193,119,242, 59, 3,119,238, 57,193, /* 0x 1c0 */ +115, 85, 15,182, 69,236, 80,141, 69,224, 80,255,115, 4, 81,255, /* 0x 1d0 */ +118, 4,255, 85,220,131,196, 20,133,192,117,208,139, 85,224, 59, /* 0x 1e0 */ + 85,228,117,200,138, 69,237,132,192,116, 34,133,255,116, 30,129, /* 0x 1f0 */ +250, 0, 2, 0, 0,119, 4, 57, 19,117, 18, 15,182,192, 80, 15, /* 0x 200 */ +182, 69,238, 80, 82,255,115, 4,255,215,131,196, 16,139, 69,232, /* 0x 210 */ + 1, 70, 4, 41, 6,235, 10,139, 83, 4,137,240,232, 15,255,255, /* 0x 220 */ +255,139, 85,228,139, 3, 1, 83, 4, 41,208,133,192,137, 3,233, /* 0x 230 */ + 66,255,255,255,141,101,244, 91, 94, 95,201,195,133,192, 83,137, /* 0x 240 */ +211,116, 29,168, 1,117, 25,139, 16, 57,218,116, 7, 74,117, 11, /* 0x 250 */ +133,219,116, 7,137, 24,137, 72, 4,235, 5,131,192, 8,235,231, /* 0x 260 */ + 91,195, 85,137,229, 87, 86, 83,131,236, 68,137, 69,228,139, 69, /* 0x 270 */ + 8,137, 85,224,139, 93,224,139, 85, 12,137, 69,220,139, 69,224, /* 0x 280 */ +139, 77, 20,137, 85,216, 3, 91, 28,139, 85,224,137, 77,212,102, /* 0x 290 */ +131,120, 16, 2, 15,183, 74, 44,137, 93,208, 15,148,192,131,207, /* 0x 2a0 */ +255, 15,182,192,137,202,193,224, 4, 49,246,131,192, 34, 74,120, /* 0x 2b0 */ + 28,131, 59, 1,117, 18,139, 83, 8, 57,250,115, 2,137,215, 3, /* 0x 2c0 */ + 83, 20, 57,214,115, 2,137,214,131,195, 32,226,228,137,251,106, /* 0x 2d0 */ + 0,129,227, 0,240,255,255,106,255, 41,222, 80,129,198,255, 15, /* 0x 2e0 */ + 0, 0,106, 0,129,230, 0,240,255,255, 86, 83,232, 50,254,255, /* 0x 2f0 */ +255,139, 77,224,141, 52, 48,131,196, 24, 41,216,102,131,121, 44, /* 0x 300 */ + 0,137,117,240,137, 69,204,199, 69,200, 0, 0, 0, 0, 15,132, /* 0x 310 */ +215, 1, 0, 0,139, 93,208,139, 3,131,248, 6,117, 24,139, 77, /* 0x 320 */ +204,186, 3, 0, 0, 0, 3, 75, 8,139, 69,216,232, 11,255,255, /* 0x 330 */ +255,233,158, 1, 0, 0, 72, 15,133,151, 1, 0, 0,139, 69,208, /* 0x 340 */ +199, 69,196, 64, 98, 81,115,139, 85,208,139, 72, 24,139, 90, 20, /* 0x 350 */ +131,225, 7,193,225, 2,211,109,196,139, 72, 16,139, 69,204, 3, /* 0x 360 */ + 66, 8,137, 77,232,131,101,196, 7,137,194, 1,195,129,226,255, /* 0x 370 */ + 15, 0, 0,137,199,141, 52, 17,139, 77,208,137, 69,236, 41,215, /* 0x 380 */ +139, 65, 4,137, 93,192, 41,208,131,125,220, 0, 80,139, 69,228, /* 0x 390 */ +116, 3,131,200,255,131,125,220, 1, 80, 25,192,131,224,224,131, /* 0x 3a0 */ +192, 50,131,125,220, 0, 80,139, 69,196,116, 3,131,200, 2,131, /* 0x 3b0 */ +125,220, 0, 80,137,240,116, 3,141, 70, 3, 80, 87,232, 97,253, /* 0x 3c0 */ +255,255,131,196, 24, 57,199, 15,133,184, 0, 0, 0,131,125,220, /* 0x 3d0 */ + 0,116, 28,246, 69,196, 4,139, 69,212,117, 2, 49,192, 80,139, /* 0x 3e0 */ + 69,220,255,117,228,141, 85,232,232,112,253,255,255, 88, 90,137, /* 0x 3f0 */ +243,247,219,129,227,255, 15, 0, 0,246, 69,196, 2,137, 93,188, /* 0x 400 */ +116, 15,133,219,141, 4, 55,116, 8,137,217,198, 0, 0, 64,226, /* 0x 410 */ +250,131,125,220, 0,116,120,139, 69,208,131, 56, 1,117, 86,246, /* 0x 420 */ + 64, 24, 1,116, 80,139, 80, 20,139, 88, 8,141, 12, 26, 3, 77, /* 0x 430 */ +204, 59, 80, 16,117, 14,137,200,247,216, 37,255, 15, 0, 0,131, /* 0x 440 */ +248, 3,119, 17,139, 85,208,107, 69,204, 52,131,122, 4, 0,141, /* 0x 450 */ + 76, 3, 12,117, 15,139, 1, 61,205,128, 97,195,116, 6,199, 1, /* 0x 460 */ +205,128, 97,195,133,201,116, 13,139, 69,216, 49,210,131,224,254, /* 0x 470 */ +232,199,253,255,255,137,251,137,241,139, 85,196,106,125, 88,205, /* 0x 480 */ +128,133,192,116, 10,106,127, 91,106, 1, 88,205,128,235,254,139, /* 0x 490 */ + 85,188,141, 4, 22,141, 28, 7, 59, 93,192,115, 30,106, 0,106, /* 0x 4a0 */ +255,106, 50,255,117,196, 41, 93,192,255,117,192, 83,232,113,252, /* 0x 4b0 */ +255,255,131,196, 24, 57,195,116, 27,235,202,131,125,220, 0,116, /* 0x 4c0 */ + 19,141, 78, 3,129,225,255, 15, 0, 0,131,249, 3,119, 5,106, /* 0x 4d0 */ + 91, 88,205,128,139, 77,224,255, 69,200, 15,183, 65, 44,131, 69, /* 0x 4e0 */ +208, 32, 57, 69,200, 15,140, 41,254,255,255,131,125,220, 0,117, /* 0x 4f0 */ + 14,139, 93,228,106, 6, 88,205,128,133,192,116, 20,235,134,139, /* 0x 500 */ + 69,224,102,131,120, 16, 3,116, 8,139, 93,240,106, 45, 88,205, /* 0x 510 */ +128,131,125, 16, 0,116, 8,139, 77,204,139, 85, 16,137, 10,139, /* 0x 520 */ + 93,224,139, 91, 24, 1, 93,204,139, 69,204,141,101,244, 91, 94, /* 0x 530 */ + 95,201,195, 85,137,229, 87, 86, 83,131,236, 28,139,125, 28,106, /* 0x 540 */ + 0,139, 69, 16,141, 87, 52,139,117, 8,137, 69,236,131,192, 2, /* 0x 550 */ +255,117,236,137, 85,228,139, 93, 32,137, 69,232,141, 85, 24,141, /* 0x 560 */ + 69, 32,232,246,251,255,255,139, 69, 12, 15,183, 79, 44,186, 5, /* 0x 570 */ + 0, 0, 0,137, 69, 32,137,240, 41, 93, 36,232,188,252,255,255, /* 0x 580 */ + 15,183, 79, 42,186, 4, 0, 0, 0,137,240,232,172,252,255,255, /* 0x 590 */ +139, 93,228,139, 77, 40,186, 3, 0, 0, 0, 3, 75, 8,137,240, /* 0x 5a0 */ +131,193, 52,232,148,252,255,255,141, 69,240,255,117,232,137,250, /* 0x 5b0 */ + 80,141, 69, 32, 86, 80,139, 69,236,232,164,252,255,255,186, 9, /* 0x 5c0 */ + 0, 0, 0,137,193,137,195,137,240,232,110,252,255,255,102,139, /* 0x 5d0 */ + 79, 44,131,196, 24, 49,210,102,133,201,116, 96,139, 69,228,131, /* 0x 5e0 */ + 56, 3,117, 76,139, 93,240, 49,201, 3, 88, 8,137,202,106, 5, /* 0x 5f0 */ + 88,205,128,133,192,137,198,120, 21,186, 0, 2, 0, 0,137,195, /* 0x 600 */ +137,249,106, 3, 88,205,128, 61, 0, 2, 0, 0,116, 10,106,127, /* 0x 610 */ + 91,106, 1, 88,205,128,235,254,106, 0,137,250,106, 0,137,240, /* 0x 620 */ +106, 0,106, 0,232, 57,252,255,255,131,196, 16,137,195,235, 12, /* 0x 630 */ + 66, 15,183,193,131, 69,228, 32, 57,194,124,160,141,101,244,137, /* 0x 640 */ +216, 91, 94, 95,201,195 /* 0x 650 */ +}; diff --git a/src/stub/i386-linux.elf.execve-entry.h b/src/stub/i386-linux.elf.execve-entry.h new file mode 100644 index 00000000..047d4d31 --- /dev/null +++ b/src/stub/i386-linux.elf.execve-entry.h @@ -0,0 +1,365 @@ +/* i386-linux.elf.execve-entry.h -- created from i386-linux.elf.execve-entry.bin, 5279 (0x149f) 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 + + */ + + +#define LINUX_I386EXEC_LOADER_SIZE 5279 +#define LINUX_I386EXEC_LOADER_ADLER32 0xf155b1a6 +#define LINUX_I386EXEC_LOADER_CRC32 0x8ea0096c + +unsigned char linux_i386exec_loader[5279] = { +232, 0, 0, 0, 0,184, 78, 77, 82, 85, 96,106, 63,139,116, 36, /* 0x 0 */ + 40,139,124, 36, 48,131,205,255,235, 0,164,235, 0,138, 6, 70, /* 0x 10 */ +136, 7, 71, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, /* 0x 20 */ + 49,192, 64,138, 7,114, 0,184, 1, 0, 0, 0, 1,219,117, 7, /* 0x 30 */ +139, 30,131,238,252, 17,219, 17,192, 1,219,117, 7,139, 30,131, /* 0x 40 */ +238,252, 17,219,115, 0, 1,219,115, 0,117, 9,139, 30,131,238, /* 0x 50 */ +252, 17,219,115, 0, 49,201,131,232, 3,114, 13,193,224, 8,138, /* 0x 60 */ + 6, 70,131,240,255,116, 0,137,197, 1,219,117, 7,139, 30,131, /* 0x 70 */ +238,252, 17,219, 17,201, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 80 */ +219, 17,201,117, 0, 65, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 90 */ +219, 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, /* 0x a0 */ + 1,219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, /* 0x b0 */ + 65,131,193, 2,129,253, 0,243,255,255,131,209, 1, 86,141, 52, /* 0x c0 */ + 47,243,164, 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, /* 0x d0 */ + 4, 15,118, 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, /* 0x e0 */ + 0, 0,139, 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119, /* 0x f0 */ +241, 1,207,233, 0, 0, 0, 0,235, 0,164,235, 0,138, 6, 70, /* 0x 100 */ +136, 7, 71, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, /* 0x 110 */ + 49,192, 64,138, 7,114, 0,184, 1, 0, 0, 0, 1,219,117, 7, /* 0x 120 */ +139, 30,131,238,252, 17,219, 17,192, 1,219,117, 7,139, 30,131, /* 0x 130 */ +238,252, 17,219,114, 0, 1,219,115, 11,117, 0,139, 30,131,238, /* 0x 140 */ +252, 17,219,114, 0, 72, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 150 */ +219, 17,192,235, 0, 49,201,131,232, 3,114, 17,193,224, 8,138, /* 0x 160 */ + 6, 70,131,240,255,116, 0,209,248,137,197,235, 11, 1,219,117, /* 0x 170 */ + 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, 7,139, 30, /* 0x 180 */ +131,238,252, 17,219, 17,201,117, 0, 65, 1,219,117, 7,139, 30, /* 0x 190 */ +131,238,252, 17,219, 17,201, 1,219,117, 7,139, 30,131,238,252, /* 0x 1a0 */ + 17,219,115, 0, 1,219,115, 0,117, 9,139, 30,131,238,252, 17, /* 0x 1b0 */ +219,115, 0, 65, 65,131,193, 2,129,253, 0,251,255,255,131,209, /* 0x 1c0 */ + 1, 86,141, 52, 47,243,164, 94,233, 0, 0, 0, 0,141, 20, 47, /* 0x 1d0 */ +131,253,252,138, 4, 15,118, 0,138, 2, 66,136, 7, 71, 73,117, /* 0x 1e0 */ +247,233, 0, 0, 0, 0,139, 2,131,194, 4,137, 7,131,199, 4, /* 0x 1f0 */ +131,233, 4,119,241, 1,207,233, 0, 0, 0, 0,235, 0,164,235, /* 0x 200 */ + 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, 30,131,238,252, /* 0x 210 */ + 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, 1, 0, 0, 0, /* 0x 220 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192, 1,219,117, /* 0x 230 */ + 7,139, 30,131,238,252, 17,219,114, 0, 1,219,115, 11,117, 0, /* 0x 240 */ +139, 30,131,238,252, 17,219,114, 0, 72, 1,219,117, 7,139, 30, /* 0x 250 */ +131,238,252, 17,219, 17,192,235, 0, 1,219,117, 7,139, 30,131, /* 0x 260 */ +238,252, 17,219, 17,201,235, 0, 49,201,131,232, 3,114, 17,193, /* 0x 270 */ +224, 8,138, 6, 70,131,240,255,116, 0,209,248,137,197,235, 11, /* 0x 280 */ + 1,219,117, 7,139, 30,131,238,252, 17,219,114,204, 65, 1,219, /* 0x 290 */ +117, 7,139, 30,131,238,252, 17,219,114,190, 1,219,117, 7,139, /* 0x 2a0 */ + 30,131,238,252, 17,219, 17,201, 1,219,117, 7,139, 30,131,238, /* 0x 2b0 */ +252, 17,219,115, 0, 1,219,115, 0,117, 9,139, 30,131,238,252, /* 0x 2c0 */ + 17,219,115, 0, 65, 65,131,193, 2,129,253, 0,251,255,255,131, /* 0x 2d0 */ +209, 2, 86,141, 52, 47,243,164, 94,233, 0, 0, 0, 0,141, 20, /* 0x 2e0 */ + 47,131,253,252,138, 4, 15,118, 0,138, 2, 66,136, 7, 71, 73, /* 0x 2f0 */ +117,247,233, 0, 0, 0, 0,139, 2,131,194, 4,137, 7,131,199, /* 0x 300 */ + 4,131,233, 4,119,241, 1,207,233, 0, 0, 0, 0,185, 84, 69, /* 0x 310 */ + 88, 76,138, 7, 71, 44,232, 60, 1,119,247,128, 63, 63,117, 0, /* 0x 320 */ +139, 7,138, 95, 4,102,193,232, 8,134,196,193,192, 16,134,196, /* 0x 330 */ + 41,248,128,235,232,137, 7,131,199, 5,136,216,226, 0,185, 84, /* 0x 340 */ + 69, 88, 76,176,232,176,233,242,174,117, 0,128, 63, 63,117, 0, /* 0x 350 */ +139, 7,102,193,232, 8,134,196,193,192, 16,134,196, 41,248,171, /* 0x 360 */ +235, 0,139, 84, 36, 40, 3, 84, 36, 44, 57,242,116, 1, 72,135, /* 0x 370 */ + 68, 36, 32,139, 84, 36, 52,137,249,139,124, 36, 48, 41,249,137, /* 0x 380 */ + 10, 90, 87,106, 15, 91,136,215,147,235, 0, 90, 88, 89,151, 96, /* 0x 390 */ + 49,219,187, 78, 77, 82, 85,106, 15, 88,138,100, 36, 32,106, 15, /* 0x 3a0 */ + 91,138,124, 36, 32,138, 84, 36, 32,233, 0, 0, 0, 0, 15,183, /* 0x 3b0 */ + 47, 43,110, 12, 41,221,117, 0,131,237, 1,115, 0,136, 95,255, /* 0x 3c0 */ + 73,136, 7, 71,139, 7,156,102,193,232, 8,193,192, 16,134,196, /* 0x 3d0 */ +157,115, 0,176, 0, 15,200,115, 0,209,232,115, 0,254,203, 75, /* 0x 3e0 */ + 35, 30,125, 2, 3, 30,137, 4,156,235, 0,141, 20, 24, 15,182, /* 0x 3f0 */ +210, 35, 22, 59, 22,114, 2, 43, 22,139, 4,148,254,203, 75, 35, /* 0x 400 */ + 30,125, 2, 3, 30,139, 44,156,133,237,117, 0, 80,139, 70, 4, /* 0x 410 */ +254,200, 72, 35, 6,125, 2, 3, 6, 49,237,137, 70, 4,135,108, /* 0x 420 */ +132, 4, 88,137, 44,148,137, 4,156, 41,248,131,233, 4, 3, 70, /* 0x 430 */ + 16, 1,240,137, 7,131,199, 4,235, 0,235, 0, 80,176,233,176, /* 0x 440 */ +232, 80,106, 0, 83,137,230, 94,137,218,178,233,178,232, 67,106, /* 0x 450 */ + 0,254,203, 75,117, 0, 15,183, 7,131,199, 1, 60,128,114, 4, /* 0x 460 */ + 60,143,118, 0, 41,208, 43, 70, 8,131,232, 2,116, 0,131,232, /* 0x 470 */ + 1,114, 0,115, 0,122, 0,123, 0,248,235, 0,131,233, 1,127, /* 0x 480 */ + 0,137,231,185, 4, 1, 0, 0,139, 14,131,193, 5,139, 14,131, /* 0x 490 */ +193, 4, 49,192,243,171,137,252, 86, 97,151, 81, 80, 82,195,137, /* 0x 4a0 */ +254,235, 0,138, 7,131,199, 1, 60,128,114, 10, 60,143,119, 6, /* 0x 4b0 */ +128,127,254, 15,116, 0, 44,232, 60, 1,119, 0, 56, 23,117, 0, /* 0x 4c0 */ +139, 7,102,193,232, 8,193,192, 16,134,196, 41,248, 1,240,137, /* 0x 4d0 */ + 7,131,199, 4,131,233, 4,138, 7,131,199, 1,226, 0,131,233, /* 0x 4e0 */ + 1,127, 0, 97,195, 93,187, 0, 16, 64, 0, 0, 76, 69, 88, 69, /* 0x 4f0 */ + 67, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, /* 0x 500 */ + 0, 76, 69, 88, 69, 67, 48, 50, 48, 0, 0, 0, 0, 0, 76, 69, /* 0x 510 */ + 88, 69, 67, 48, 48, 57, 0, 5, 0, 0, 0, 76, 69, 88, 69, 67, /* 0x 520 */ + 48, 49, 48, 0, 10, 0, 0, 0, 78, 50, 66, 83, 77, 65, 49, 48, /* 0x 530 */ + 0, 24, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 78, 50, 66, /* 0x 540 */ + 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, 70, 65, 83, /* 0x 550 */ + 49, 48, 0, 27, 0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 78, /* 0x 560 */ + 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, 70, /* 0x 570 */ + 65, 83, 49, 49, 0, 29, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, /* 0x 580 */ + 48, 0, 35, 0, 0, 0, 78, 50, 66, 83, 77, 65, 50, 48, 0, 46, /* 0x 590 */ + 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 78, 50, 66, 83, 77, /* 0x 5a0 */ + 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 66, 70, 65, 83, 50, 48, /* 0x 5b0 */ + 0, 51, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 78, 50, 66, /* 0x 5c0 */ + 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, /* 0x 5d0 */ + 50, 48, 0, 60, 0, 0, 0, 78, 50, 66, 83, 77, 65, 51, 48, 0, /* 0x 5e0 */ + 73, 0, 0, 0, 0, 0, 0, 0, 86, 0, 0, 0, 78, 50, 66, 68, /* 0x 5f0 */ + 69, 67, 50, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 51, /* 0x 600 */ + 48, 0, 86, 0, 0, 0, 0, 0, 0, 0, 90, 0, 0, 0, 78, 50, /* 0x 610 */ + 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,101, /* 0x 620 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, /* 0x 630 */ + 78, 50, 66, 68, 69, 67, 51, 48, 0,101, 0, 0, 0, 0, 0, 0, /* 0x 640 */ + 0,119, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 0, 0, /* 0x 650 */ + 0, 0, 0, 0, 0, 0,149, 0, 0, 0, 78, 50, 66, 68, 69, 67, /* 0x 660 */ + 53, 48, 0, 0, 0, 0, 0, 78, 50, 66, 83, 77, 65, 52, 48, 0, /* 0x 670 */ +163, 0, 0, 0, 0, 0, 0, 0,176, 0, 0, 0, 78, 50, 66, 68, /* 0x 680 */ + 69, 67, 51, 48, 0, 49, 0, 0, 0, 78, 50, 66, 70, 65, 83, 52, /* 0x 690 */ + 48, 0,176, 0, 0, 0, 0, 0, 0, 0,180, 0, 0, 0, 78, 50, /* 0x 6a0 */ + 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 0, 0, 0, 0,191, /* 0x 6b0 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, /* 0x 6c0 */ + 78, 50, 66, 68, 85, 77, 77, 49, 0,191, 0, 0, 0, 78, 50, 66, /* 0x 6d0 */ + 83, 77, 65, 53, 48, 0,191, 0, 0, 0, 78, 50, 66, 70, 65, 83, /* 0x 6e0 */ + 53, 48, 0,193, 0, 0, 0, 78, 50, 66, 68, 69, 67, 53, 48, 0, /* 0x 6f0 */ +196, 0, 0, 0, 78, 50, 66, 83, 77, 65, 54, 48, 0,205, 0, 0, /* 0x 700 */ + 0, 0, 0, 0, 0,217, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, /* 0x 710 */ + 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 54, 48, 0,217, /* 0x 720 */ + 0, 0, 0, 0, 0, 0, 0,228, 0, 0, 0, 78, 50, 66, 70, 65, /* 0x 730 */ + 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0,242, 0, 0, 0, /* 0x 740 */ + 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, /* 0x 750 */ + 70, 65, 83, 54, 49, 0,242, 0, 0, 0, 0, 0, 0, 0, 8, 1, /* 0x 760 */ + 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, /* 0x 770 */ + 50, 66, 68, 69, 67, 54, 48, 0, 8, 1, 0, 0, 78, 82, 86, 50, /* 0x 780 */ + 66, 69, 78, 68, 0, 8, 1, 0, 0, 78, 50, 68, 83, 77, 65, 49, /* 0x 790 */ + 48, 0, 8, 1, 0, 0, 0, 0, 0, 0, 10, 1, 0, 0, 78, 50, /* 0x 7a0 */ + 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 68, 70, 65, /* 0x 7b0 */ + 83, 49, 48, 0, 11, 1, 0, 0, 0, 0, 0, 0, 13, 1, 0, 0, /* 0x 7c0 */ + 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 68, /* 0x 7d0 */ + 70, 65, 83, 49, 49, 0, 13, 1, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 7e0 */ + 49, 48, 0, 19, 1, 0, 0, 78, 50, 68, 83, 77, 65, 50, 48, 0, /* 0x 7f0 */ + 30, 1, 0, 0, 0, 0, 0, 0, 32, 1, 0, 0, 78, 50, 68, 83, /* 0x 800 */ + 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 68, 70, 65, 83, 50, /* 0x 810 */ + 48, 0, 35, 1, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0, 78, 50, /* 0x 820 */ + 68, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, /* 0x 830 */ + 67, 50, 48, 0, 44, 1, 0, 0, 78, 50, 68, 83, 77, 65, 51, 48, /* 0x 840 */ + 0, 57, 1, 0, 0, 0, 0, 0, 0, 70, 1, 0, 0, 78, 50, 68, /* 0x 850 */ + 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 78, 50, 68, 70, 65, 83, /* 0x 860 */ + 51, 48, 0, 70, 1, 0, 0, 0, 0, 0, 0, 76, 1, 0, 0, 78, /* 0x 870 */ + 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 0, 0, 0, 0, /* 0x 880 */ + 85, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, /* 0x 890 */ + 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 85, 1, 0, 0, 0, 0, /* 0x 8a0 */ + 0, 0,101, 1, 0, 0, 78, 50, 68, 68, 69, 67, 50, 48, 0, 0, /* 0x 8b0 */ + 0, 0, 0, 0, 0, 0, 0,119, 1, 0, 0, 78, 50, 68, 68, 69, /* 0x 8c0 */ + 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,153, 1, 0, 0, /* 0x 8d0 */ + 78, 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, 68, /* 0x 8e0 */ + 83, 77, 65, 52, 48, 0,167, 1, 0, 0, 0, 0, 0, 0,180, 1, /* 0x 8f0 */ + 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, 78, /* 0x 900 */ + 50, 68, 70, 65, 83, 52, 48, 0,180, 1, 0, 0, 0, 0, 0, 0, /* 0x 910 */ +184, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, /* 0x 920 */ + 0, 0, 0, 0, 0,195, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, /* 0x 930 */ + 48, 0, 69, 0, 0, 0, 78, 50, 68, 68, 85, 77, 77, 49, 0,195, /* 0x 940 */ + 1, 0, 0, 78, 50, 68, 83, 77, 65, 53, 48, 0,195, 1, 0, 0, /* 0x 950 */ + 78, 50, 68, 70, 65, 83, 53, 48, 0,197, 1, 0, 0, 78, 50, 68, /* 0x 960 */ + 68, 69, 67, 53, 48, 0,200, 1, 0, 0, 78, 50, 68, 83, 77, 65, /* 0x 970 */ + 54, 48, 0,209, 1, 0, 0, 0, 0, 0, 0,221, 1, 0, 0, 78, /* 0x 980 */ + 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 70, /* 0x 990 */ + 65, 83, 54, 48, 0,221, 1, 0, 0, 0, 0, 0, 0,232, 1, 0, /* 0x 9a0 */ + 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, /* 0x 9b0 */ + 0, 0,246, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, /* 0x 9c0 */ + 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0,246, 1, 0, 0, /* 0x 9d0 */ + 0, 0, 0, 0, 12, 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, /* 0x 9e0 */ + 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 54, 48, 0, 12, 2, /* 0x 9f0 */ + 0, 0, 78, 82, 86, 50, 68, 69, 78, 68, 0, 12, 2, 0, 0, 78, /* 0x a00 */ + 50, 69, 83, 77, 65, 49, 48, 0, 12, 2, 0, 0, 0, 0, 0, 0, /* 0x a10 */ + 14, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 4, 0, 0, /* 0x a20 */ + 0, 78, 50, 69, 70, 65, 83, 49, 48, 0, 15, 2, 0, 0, 0, 0, /* 0x a30 */ + 0, 0, 17, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 4, /* 0x a40 */ + 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 17, 2, 0, 0, /* 0x a50 */ + 78, 50, 69, 68, 69, 67, 49, 48, 0, 23, 2, 0, 0, 78, 50, 69, /* 0x a60 */ + 83, 77, 65, 50, 48, 0, 34, 2, 0, 0, 0, 0, 0, 0, 36, 2, /* 0x a70 */ + 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, /* 0x a80 */ + 50, 69, 70, 65, 83, 50, 48, 0, 39, 2, 0, 0, 0, 0, 0, 0, /* 0x a90 */ + 43, 2, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 0, 0, 0, /* 0x aa0 */ + 0, 78, 50, 69, 68, 69, 67, 50, 48, 0, 48, 2, 0, 0, 78, 50, /* 0x ab0 */ + 69, 83, 77, 65, 51, 48, 0, 61, 2, 0, 0, 0, 0, 0, 0, 74, /* 0x ac0 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, 0, /* 0x ad0 */ + 78, 50, 69, 70, 65, 83, 51, 48, 0, 74, 2, 0, 0, 0, 0, 0, /* 0x ae0 */ + 0, 80, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, /* 0x af0 */ + 0, 0, 0, 0, 0, 0, 89, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x b00 */ + 51, 48, 0, 31, 0, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, /* 0x b10 */ + 89, 2, 0, 0, 0, 0, 0, 0,105, 2, 0, 0, 78, 50, 69, 68, /* 0x b20 */ + 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,120, 2, 0, /* 0x b30 */ + 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 0, 0, /* 0x b40 */ + 0, 0,138, 2, 0, 0, 78, 50, 69, 68, 69, 67, 54, 48, 0, 0, /* 0x b50 */ + 0, 0, 0, 78, 50, 69, 83, 77, 65, 52, 48, 0,184, 2, 0, 0, /* 0x b60 */ + 0, 0, 0, 0,197, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, /* 0x b70 */ + 0, 82, 0, 0, 0, 78, 50, 69, 70, 65, 83, 52, 48, 0,197, 2, /* 0x b80 */ + 0, 0, 0, 0, 0, 0,201, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x b90 */ + 51, 48, 0, 82, 0, 0, 0, 0, 0, 0, 0,212, 2, 0, 0, 78, /* 0x ba0 */ + 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 68, /* 0x bb0 */ + 85, 77, 77, 49, 0,212, 2, 0, 0, 78, 50, 69, 83, 77, 65, 53, /* 0x bc0 */ + 48, 0,212, 2, 0, 0, 78, 50, 69, 70, 65, 83, 53, 48, 0,214, /* 0x bd0 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0,217, 2, 0, 0, /* 0x be0 */ + 78, 50, 69, 83, 77, 65, 54, 48, 0,226, 2, 0, 0, 0, 0, 0, /* 0x bf0 */ + 0,238, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, /* 0x c00 */ + 0, 0, 78, 50, 69, 70, 65, 83, 54, 48, 0,238, 2, 0, 0, 0, /* 0x c10 */ + 0, 0, 0,249, 2, 0, 0, 78, 50, 69, 70, 65, 83, 54, 49, 0, /* 0x c20 */ + 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 0, 0, 78, 50, 69, 68, /* 0x c30 */ + 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, /* 0x c40 */ + 49, 0, 7, 3, 0, 0, 0, 0, 0, 0, 29, 3, 0, 0, 78, 50, /* 0x c50 */ + 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 68, 69, /* 0x c60 */ + 67, 54, 48, 0, 29, 3, 0, 0, 78, 82, 86, 50, 69, 69, 78, 68, /* 0x c70 */ + 0, 29, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, 29, 3, /* 0x c80 */ + 0, 0, 67, 84, 67, 76, 69, 86, 69, 49, 0, 43, 3, 0, 0, 0, /* 0x c90 */ + 0, 0, 0, 48, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, /* 0x ca0 */ + 5, 0, 0, 0, 67, 65, 76, 76, 84, 82, 48, 49, 0, 48, 3, 0, /* 0x cb0 */ + 0, 67, 84, 68, 85, 77, 77, 89, 49, 0, 53, 3, 0, 0, 67, 84, /* 0x cc0 */ + 66, 83, 72, 82, 48, 49, 0, 53, 3, 0, 0, 67, 84, 66, 82, 79, /* 0x cd0 */ + 82, 48, 49, 0, 57, 3, 0, 0, 67, 84, 66, 83, 87, 65, 48, 49, /* 0x ce0 */ + 0, 59, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 50, 0, 64, 3, /* 0x cf0 */ + 0, 0, 0, 0, 0, 0, 78, 3, 0, 0, 67, 65, 76, 76, 84, 82, /* 0x d00 */ + 48, 48, 0, 10, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, 0, /* 0x d10 */ + 78, 3, 0, 0, 67, 65, 76, 76, 84, 82, 69, 56, 0, 83, 3, 0, /* 0x d20 */ + 0, 67, 65, 76, 76, 84, 82, 69, 57, 0, 85, 3, 0, 0, 67, 65, /* 0x d30 */ + 76, 76, 84, 82, 49, 49, 0, 87, 3, 0, 0, 0, 0, 0, 0, 91, /* 0x d40 */ + 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, 5, 0, 0, 0, /* 0x d50 */ + 67, 84, 67, 76, 69, 86, 69, 50, 0, 91, 3, 0, 0, 0, 0, 0, /* 0x d60 */ + 0, 96, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, 0, 0, 0, /* 0x d70 */ + 0, 0, 67, 65, 76, 76, 84, 82, 49, 50, 0, 96, 3, 0, 0, 67, /* 0x d80 */ + 84, 68, 85, 77, 77, 89, 50, 0, 98, 3, 0, 0, 67, 84, 66, 83, /* 0x d90 */ + 72, 82, 49, 49, 0, 98, 3, 0, 0, 67, 84, 66, 82, 79, 82, 49, /* 0x da0 */ + 49, 0,102, 3, 0, 0, 67, 84, 66, 83, 87, 65, 49, 49, 0,104, /* 0x db0 */ + 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0,109, 3, 0, 0, /* 0x dc0 */ + 0, 0, 0, 0,114, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, /* 0x dd0 */ + 0, 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, 68, 0,114, 3, /* 0x de0 */ + 0, 0, 76, 69, 88, 69, 67, 48, 49, 53, 0,114, 3, 0, 0, 76, /* 0x df0 */ + 69, 88, 69, 67, 49, 49, 48, 0,146, 3, 0, 0, 76, 69, 88, 69, /* 0x e00 */ + 67, 49, 48, 48, 0,152, 3, 0, 0, 76, 88, 85, 78, 70, 48, 48, /* 0x e10 */ + 48, 0,153, 3, 0, 0, 0, 0, 0, 0,155, 3, 0, 0, 76, 88, /* 0x e20 */ + 85, 78, 70, 48, 49, 48, 0, 5, 0, 0, 0, 76, 88, 85, 78, 70, /* 0x e30 */ + 48, 48, 50, 0,155, 3, 0, 0, 77, 82, 85, 66, 89, 84, 69, 48, /* 0x e40 */ + 0,160, 3, 0, 0, 76, 88, 77, 82, 85, 48, 48, 53, 0,162, 3, /* 0x e50 */ + 0, 0, 76, 88, 77, 82, 85, 48, 48, 54, 0,167, 3, 0, 0, 76, /* 0x e60 */ + 88, 77, 82, 85, 48, 48, 55, 0,174, 3, 0, 0, 76, 88, 85, 78, /* 0x e70 */ + 70, 48, 48, 56, 0,181, 3, 0, 0, 76, 88, 85, 78, 70, 48, 49, /* 0x e80 */ + 48, 0,185, 3, 0, 0, 0, 0, 0, 0,190, 3, 0, 0, 76, 88, /* 0x e90 */ + 85, 78, 70, 48, 52, 50, 0, 0, 0, 0, 0, 76, 88, 74, 67, 67, /* 0x ea0 */ + 48, 49, 48, 0,190, 3, 0, 0, 76, 88, 77, 82, 85, 48, 52, 53, /* 0x eb0 */ + 0,193, 3, 0, 0, 76, 88, 77, 82, 85, 48, 52, 54, 0,196, 3, /* 0x ec0 */ + 0, 0, 76, 88, 74, 67, 67, 48, 50, 48, 0,198, 3, 0, 0, 0, /* 0x ed0 */ + 0, 0, 0,200, 3, 0, 0, 76, 88, 85, 78, 70, 48, 51, 52, 0, /* 0x ee0 */ + 0, 0, 0, 0, 76, 88, 74, 67, 67, 48, 50, 49, 0,200, 3, 0, /* 0x ef0 */ + 0, 0, 0, 0, 0,205, 3, 0, 0, 76, 88, 85, 78, 70, 48, 51, /* 0x f00 */ + 52, 0, 0, 0, 0, 0, 76, 88, 74, 67, 67, 48, 50, 51, 0,205, /* 0x f10 */ + 3, 0, 0, 76, 88, 85, 78, 70, 48, 51, 55, 0,212, 3, 0, 0, /* 0x f20 */ + 76, 88, 85, 78, 70, 51, 56, 54, 0,214, 3, 0, 0, 76, 88, 85, /* 0x f30 */ + 78, 70, 51, 56, 55, 0,215, 3, 0, 0, 76, 88, 85, 78, 70, 51, /* 0x f40 */ + 56, 56, 0,224, 3, 0, 0, 0, 0, 0, 0,227, 3, 0, 0, 76, /* 0x f50 */ + 88, 85, 78, 70, 48, 52, 48, 0, 0, 0, 0, 0, 76, 88, 85, 78, /* 0x f60 */ + 70, 52, 56, 54, 0,227, 3, 0, 0, 76, 88, 85, 78, 70, 52, 56, /* 0x f70 */ + 55, 0,231, 3, 0, 0, 0, 0, 0, 0,233, 3, 0, 0, 76, 88, /* 0x f80 */ + 85, 78, 70, 48, 52, 48, 0, 0, 0, 0, 0, 76, 88, 77, 82, 85, /* 0x f90 */ + 48, 54, 53, 0,233, 3, 0, 0, 0, 0, 0, 0,237, 3, 0, 0, /* 0x fa0 */ + 76, 88, 77, 82, 85, 48, 55, 48, 0, 5, 0, 0, 0, 77, 82, 85, /* 0x fb0 */ + 66, 89, 84, 69, 51, 0,237, 3, 0, 0, 77, 82, 85, 65, 82, 66, /* 0x fc0 */ + 51, 48, 0,239, 3, 0, 0, 77, 82, 85, 66, 73, 84, 83, 51, 0, /* 0x fd0 */ +240, 3, 0, 0, 77, 82, 85, 65, 82, 66, 52, 48, 0,242, 3, 0, /* 0x fe0 */ + 0, 76, 88, 77, 82, 85, 48, 55, 48, 0,246, 3, 0, 0, 0, 0, /* 0x ff0 */ + 0, 0,251, 3, 0, 0, 76, 88, 85, 78, 70, 48, 52, 48, 0, 0, /* 0x1000 */ + 0, 0, 0, 77, 82, 85, 66, 89, 84, 69, 52, 0,254, 3, 0, 0, /* 0x1010 */ + 77, 82, 85, 66, 73, 84, 83, 52, 0, 1, 4, 0, 0, 77, 82, 85, /* 0x1020 */ + 65, 82, 66, 53, 48, 0, 3, 4, 0, 0, 76, 88, 77, 82, 85, 48, /* 0x1030 */ + 56, 48, 0, 9, 4, 0, 0, 77, 82, 85, 66, 89, 84, 69, 53, 0, /* 0x1040 */ + 12, 4, 0, 0, 77, 82, 85, 65, 82, 66, 54, 48, 0, 14, 4, 0, /* 0x1050 */ + 0, 77, 82, 85, 66, 73, 84, 83, 53, 0, 15, 4, 0, 0, 77, 82, /* 0x1060 */ + 85, 65, 82, 66, 55, 48, 0, 17, 4, 0, 0, 76, 88, 77, 82, 85, /* 0x1070 */ + 48, 57, 48, 0, 21, 4, 0, 0, 0, 0, 0, 0, 28, 4, 0, 0, /* 0x1080 */ + 76, 88, 77, 82, 85, 49, 48, 48, 0, 10, 0, 0, 0, 77, 82, 85, /* 0x1090 */ + 66, 89, 84, 69, 54, 0, 32, 4, 0, 0, 77, 82, 85, 65, 82, 66, /* 0x10a0 */ + 56, 48, 0, 34, 4, 0, 0, 77, 82, 85, 66, 73, 84, 83, 54, 0, /* 0x10b0 */ + 35, 4, 0, 0, 77, 82, 85, 65, 82, 66, 57, 48, 0, 37, 4, 0, /* 0x10c0 */ + 0, 76, 88, 77, 82, 85, 49, 48, 48, 0, 41, 4, 0, 0, 76, 88, /* 0x10d0 */ + 85, 78, 70, 48, 52, 48, 0, 57, 4, 0, 0, 76, 88, 77, 82, 85, /* 0x10e0 */ + 49, 49, 48, 0, 62, 4, 0, 0, 76, 88, 77, 82, 85, 49, 49, 49, /* 0x10f0 */ + 0, 65, 4, 0, 0, 76, 88, 85, 78, 70, 48, 52, 49, 0, 67, 4, /* 0x1100 */ + 0, 0, 0, 0, 0, 0, 74, 4, 0, 0, 76, 88, 85, 78, 70, 48, /* 0x1110 */ + 51, 52, 0, 0, 0, 0, 0, 76, 88, 85, 78, 70, 48, 52, 50, 0, /* 0x1120 */ + 74, 4, 0, 0, 76, 69, 88, 69, 67, 48, 49, 54, 0, 74, 4, 0, /* 0x1130 */ + 0, 0, 0, 0, 0, 76, 4, 0, 0, 76, 88, 85, 78, 70, 48, 52, /* 0x1140 */ + 50, 0, 0, 0, 0, 0, 76, 88, 77, 82, 85, 48, 49, 48, 0, 76, /* 0x1150 */ + 4, 0, 0, 76, 88, 74, 77, 80, 65, 48, 48, 0, 77, 4, 0, 0, /* 0x1160 */ + 76, 88, 67, 65, 76, 76, 66, 48, 0, 79, 4, 0, 0, 76, 88, 85, /* 0x1170 */ + 78, 70, 48, 50, 49, 0, 81, 4, 0, 0, 76, 88, 77, 82, 85, 48, /* 0x1180 */ + 50, 50, 0, 87, 4, 0, 0, 76, 88, 74, 77, 80, 65, 48, 49, 0, /* 0x1190 */ + 90, 4, 0, 0, 76, 88, 67, 65, 76, 76, 66, 49, 0, 92, 4, 0, /* 0x11a0 */ + 0, 77, 82, 85, 66, 73, 84, 83, 49, 0, 94, 4, 0, 0, 76, 88, /* 0x11b0 */ + 77, 82, 85, 48, 51, 48, 0, 95, 4, 0, 0, 77, 82, 85, 66, 89, /* 0x11c0 */ + 84, 69, 49, 0, 97, 4, 0, 0, 77, 82, 85, 65, 82, 66, 49, 48, /* 0x11d0 */ + 0, 99, 4, 0, 0, 76, 88, 77, 82, 85, 48, 52, 48, 0,100, 4, /* 0x11e0 */ + 0, 0, 0, 0, 0, 0,102, 4, 0, 0, 76, 88, 77, 82, 85, 48, /* 0x11f0 */ + 51, 48, 0, 0, 0, 0, 0, 76, 88, 85, 78, 70, 48, 51, 48, 0, /* 0x1200 */ +102, 4, 0, 0, 76, 88, 74, 67, 67, 48, 48, 48, 0,108, 4, 0, /* 0x1210 */ + 0, 0, 0, 0, 0,116, 4, 0, 0, 76, 88, 74, 67, 67, 48, 49, /* 0x1220 */ + 48, 0, 0, 0, 0, 0, 76, 88, 67, 74, 48, 77, 82, 85, 0,116, /* 0x1230 */ + 4, 0, 0, 76, 88, 67, 74, 49, 77, 82, 85, 0,118, 4, 0, 0, /* 0x1240 */ + 76, 88, 67, 65, 76, 74, 77, 80, 0,121, 4, 0, 0, 76, 88, 67, /* 0x1250 */ + 65, 76, 76, 48, 48, 0,124, 4, 0, 0, 0, 0, 0, 0,126, 4, /* 0x1260 */ + 0, 0, 76, 88, 85, 78, 70, 48, 51, 55, 0, 0, 0, 0, 0, 76, /* 0x1270 */ + 88, 67, 65, 76, 76, 48, 49, 0,126, 4, 0, 0, 76, 88, 67, 74, /* 0x1280 */ + 50, 77, 82, 85, 0,129, 4, 0, 0, 0, 0, 0, 0,131, 4, 0, /* 0x1290 */ + 0, 76, 88, 85, 78, 70, 48, 51, 55, 0, 0, 0, 0, 0, 76, 88, /* 0x12a0 */ + 67, 74, 52, 77, 82, 85, 0,131, 4, 0, 0, 0, 0, 0, 0,133, /* 0x12b0 */ + 4, 0, 0, 76, 88, 85, 78, 70, 48, 51, 52, 0, 0, 0, 0, 0, /* 0x12c0 */ + 76, 88, 67, 74, 54, 77, 82, 85, 0,133, 4, 0, 0, 0, 0, 0, /* 0x12d0 */ + 0,135, 4, 0, 0, 76, 88, 67, 74, 56, 77, 82, 85, 0, 1, 0, /* 0x12e0 */ + 0, 0, 76, 88, 67, 74, 55, 77, 82, 85, 0,135, 4, 0, 0, 0, /* 0x12f0 */ + 0, 0, 0,137, 4, 0, 0, 76, 88, 67, 74, 56, 77, 82, 85, 0, /* 0x1300 */ + 1, 0, 0, 0, 76, 88, 67, 74, 56, 77, 82, 85, 0,137, 4, 0, /* 0x1310 */ + 0, 0, 0, 0, 0,140, 4, 0, 0, 76, 88, 85, 78, 70, 48, 51, /* 0x1320 */ + 55, 0, 0, 0, 0, 0, 76, 88, 85, 78, 70, 48, 51, 52, 0,140, /* 0x1330 */ + 4, 0, 0, 0, 0, 0, 0,145, 4, 0, 0, 76, 88, 85, 78, 70, /* 0x1340 */ + 48, 51, 48, 0, 0, 0, 0, 0, 76, 88, 77, 82, 85, 48, 53, 53, /* 0x1350 */ + 0,145, 4, 0, 0, 77, 82, 85, 66, 89, 84, 69, 50, 0,147, 4, /* 0x1360 */ + 0, 0, 77, 82, 85, 66, 73, 84, 83, 50, 0,152, 4, 0, 0, 77, /* 0x1370 */ + 82, 85, 65, 82, 66, 50, 48, 0,157, 4, 0, 0, 76, 88, 77, 82, /* 0x1380 */ + 85, 48, 53, 55, 0,162, 4, 0, 0, 76, 88, 77, 82, 85, 48, 53, /* 0x1390 */ + 56, 0,168, 4, 0, 0, 76, 88, 85, 78, 70, 48, 51, 53, 0,169, /* 0x13a0 */ + 4, 0, 0, 67, 75, 76, 76, 84, 82, 48, 48, 0,175, 4, 0, 0, /* 0x13b0 */ + 0, 0, 0, 0,179, 4, 0, 0, 67, 75, 76, 76, 84, 82, 50, 48, /* 0x13c0 */ + 0, 30, 0, 0, 0, 67, 75, 76, 76, 84, 82, 49, 48, 0,184, 4, /* 0x13d0 */ + 0, 0, 0, 0, 0, 0,198, 4, 0, 0, 67, 75, 76, 76, 84, 82, /* 0x13e0 */ + 50, 48, 0, 6, 0, 0, 0, 67, 75, 76, 76, 84, 82, 50, 48, 0, /* 0x13f0 */ +198, 4, 0, 0, 0, 0, 0, 0,204, 4, 0, 0, 67, 75, 76, 76, /* 0x1400 */ + 84, 82, 52, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,208, 4, 0, /* 0x1410 */ + 0, 67, 75, 76, 76, 84, 82, 52, 48, 0, 0, 0, 0, 0, 67, 75, /* 0x1420 */ + 76, 76, 84, 82, 51, 48, 0,231, 4, 0, 0, 0, 0, 0, 0,238, /* 0x1430 */ + 4, 0, 0, 67, 75, 76, 76, 84, 82, 49, 48, 0, 14, 0, 0, 0, /* 0x1440 */ + 67, 75, 76, 76, 84, 82, 52, 48, 0,238, 4, 0, 0, 0, 0, 0, /* 0x1450 */ + 0,243, 4, 0, 0, 67, 75, 76, 76, 84, 82, 48, 48, 0, 4, 0, /* 0x1460 */ + 0, 0, 76, 69, 88, 69, 67, 48, 49, 55, 0,243, 4, 0, 0, 76, /* 0x1470 */ + 69, 88, 69, 67, 48, 50, 48, 0,245, 4, 0, 0, 88, 84, 72, 69, /* 0x1480 */ + 69, 78, 68, 88, 0,251, 4, 0, 0,255,255,255,255,251, 4 /* 0x1490 */ +}; diff --git a/src/stub/i386-linux.elf.execve-fold.h b/src/stub/i386-linux.elf.execve-fold.h new file mode 100644 index 00000000..b6900227 --- /dev/null +++ b/src/stub/i386-linux.elf.execve-fold.h @@ -0,0 +1,92 @@ +/* i386-linux.elf.execve-fold.h -- created from i386-linux.elf.execve-fold.bin, 899 (0x383) 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 + + */ + + +#define LINUX_I386EXEC_FOLD_SIZE 899 +#define LINUX_I386EXEC_FOLD_ADLER32 0x1a1874e1 +#define LINUX_I386EXEC_FOLD_CRC32 0x6ce5306c + +unsigned char linux_i386exec_fold[899] = { +127, 69, 76, 70, 1, 1, 1, 0, 76,105,110,117,120, 0, 0, 0, /* 0x 0 */ + 2, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, /* 0x 10 */ + 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 1, 0, 0, 0, /* 0x 20 */ + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16, 64, 0, /* 0x 30 */ + 0, 16, 64, 0,131, 3, 0, 0,132, 3, 0, 0, 5, 0, 0, 0, /* 0x 40 */ + 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 50 */ + 88,137,225,141, 84,132, 4,139,123, 24,141,115, 96, 41,247,141, /* 0x 60 */ + 93, 2, 96,232,199, 0, 0, 0,244, 83,141, 92, 36, 8,106, 90, /* 0x 70 */ + 88,205,128, 91,195, 0, 0, 0, 83,137,195,139, 76, 36, 8,136, /* 0x 80 */ +208,131,224, 31, 60, 25,118, 3,131,232, 43,131,192, 65, 75,136, /* 0x 90 */ + 3,137,208,193,232, 5,137,194,226,229, 91,195, 85, 49,201,137, /* 0x a0 */ +229, 87, 86,137,202, 83,131,236, 44,139, 93, 8,106, 5, 88,205, /* 0x b0 */ +128,133,192,137,198,120,108,199, 69,212, 47,112,114,111,199, 69, /* 0x c0 */ +216, 99, 47, 0, 0,106, 20, 88,205,128,141, 85,218,141,125,212, /* 0x d0 */ +232,123, 2, 0, 0,141, 80, 4,137,251,199, 0, 47,102,100, 47, /* 0x e0 */ +137,240,232,105, 2, 0, 0,186, 1, 0, 0, 0,106, 33, 88,106, /* 0x f0 */ + 5, 89,205,128, 61, 85, 80, 88, 50,117, 33,139, 93, 8,106, 10, /* 0x 100 */ + 88,205,128,185, 2, 0, 0, 0,137,243,106, 55, 88,205,128,137, /* 0x 110 */ +251,139, 77, 12,139, 85, 16,106, 11, 88,205,128,137,243,106, 6, /* 0x 120 */ + 88,205,128,131,196, 44,137,240, 91, 94, 95,201,194, 12, 0, 85, /* 0x 130 */ +137,229, 87, 86, 83,131,236,124,141,125,228,139, 69, 16,139,117, /* 0x 140 */ + 12,137, 69,156,165,165,165,131,109, 8, 12,129,125,228, 85, 80, /* 0x 150 */ + 88, 51,137,117, 12, 15,133,111, 1, 0, 0,199, 69,196, 47,116, /* 0x 160 */ +109,112,199, 69,200, 47,117,112,120,141, 77,215,106, 20, 88,205, /* 0x 170 */ +128,137,194,106, 4,137,200,141,125,211,232,249,254,255,255,139, /* 0x 180 */ + 85,228,198, 69,215, 0, 49,201, 49,208,141, 93,172,137, 69,132, /* 0x 190 */ +106, 78, 88,205,128,139, 85,172,137,248, 49, 85,132,139, 85,176, /* 0x 1a0 */ +199, 4, 36, 7, 0, 0, 0,141, 93,196,193,226, 12, 51, 85,132, /* 0x 1b0 */ +232,195,254,255,255, 88,106, 10, 88,205,128,131,248,254,116, 8, /* 0x 1c0 */ +133,192, 15,133, 2, 1, 0, 0,185,194, 0, 0, 0,186,192, 1, /* 0x 1d0 */ + 0, 0,141, 93,196,106, 5, 88,205,128,139, 85,232,137, 69,148, /* 0x 1e0 */ +137,195,137,209,106, 93, 88,205,128,133,192, 15,133,209, 0, 0, /* 0x 1f0 */ + 0,106, 0,255,117,148,106, 1,106, 3, 82,106, 0,232,103,254, /* 0x 200 */ +255,255,131,196, 24, 61, 0,240,255,255,137, 69,136, 15,135,175, /* 0x 210 */ + 0, 0, 0,139, 69,232,106, 0,106,255, 5,255, 15, 0, 0,106, /* 0x 220 */ + 50, 37, 0,240,255,255,106, 3, 3, 69,136,104, 0, 16, 0, 0, /* 0x 230 */ + 80,232, 51,254,255,255,131,196, 24,141,125,180,139,117, 12,165, /* 0x 240 */ +165,165,139, 77,180,131,109, 8, 12,133,201,137,117, 12,139, 85, /* 0x 250 */ +184,117, 16,129,250, 85, 80, 88, 33,117,103,131,125,232, 0,116, /* 0x 260 */ +115,235, 95, 57,202,119, 91, 59, 85,236,119, 86, 57,202,115, 36, /* 0x 270 */ + 15,182, 69,188, 80,141, 69,168, 80,255,117,136, 82,255,117, 12, /* 0x 280 */ +255, 85,156,131,196, 20,133,192,117, 56,139, 69,180, 57, 69,168, /* 0x 290 */ +117, 48,235, 8,139,125,136,139,117, 12,243,164,139, 85,180,139, /* 0x 2a0 */ + 93,136,137,209,106, 91, 88,205,128,139, 69,184, 41, 69, 8, 1, /* 0x 2b0 */ + 85,136, 41, 85,232, 1, 69, 12,131,125, 8, 0, 15,137,119,255, /* 0x 2c0 */ +255,255,141, 93,196,106, 10, 88,205,128,106,127, 91,106, 1, 88, /* 0x 2d0 */ +205,128,235,254,139, 93,148,106, 6, 88,205,128,133,192,117,226, /* 0x 2e0 */ +255,117, 28,255,117, 32,141,117,196, 86,232,173,253,255,255,133, /* 0x 2f0 */ +192,120,207,106, 2, 88,205,128,133,192,117, 51,106, 2, 88,205, /* 0x 300 */ +128,133,192,137,193,117, 31,199, 69,160, 85, 80, 88, 52,184,162, /* 0x 310 */ + 0, 0, 0,141, 93,160,199, 69,164, 0, 0, 0, 0,205,128,137, /* 0x 320 */ +243,106, 10, 88,205,128, 49,219,106, 1, 88,205,128,235,254, 49, /* 0x 330 */ +201,131,203,255,137,202,106, 7, 88,205,128,141, 93,196,139, 77, /* 0x 340 */ + 32,139, 85, 28,106, 11, 88,205,128,233,116,255,255,255, 0, 0, /* 0x 350 */ + 87,137,215,106, 10,252, 89,232, 5, 0, 0, 0,136, 39,151, 95, /* 0x 360 */ +195,153,247,241, 82,133,192,116, 5,232,243,255,255,255, 88, 4, /* 0x 370 */ + 48,170,195 /* 0x 380 */ +}; diff --git a/src/stub/i386-linux.elf.interp-entry.h b/src/stub/i386-linux.elf.interp-entry.h new file mode 100644 index 00000000..0ef9d375 --- /dev/null +++ b/src/stub/i386-linux.elf.interp-entry.h @@ -0,0 +1,444 @@ +/* i386-linux.elf.interp-entry.h -- created from i386-linux.elf.interp-entry.bin, 6542 (0x198e) 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 + + */ + + +#define LINUX_I386PTI_LOADER_SIZE 6542 +#define LINUX_I386PTI_LOADER_ADLER32 0xe080d1eb +#define LINUX_I386PTI_LOADER_CRC32 0xa507af83 + +unsigned char linux_i386pti_loader[6542] = { +232, 28, 0, 0, 0,131,248, 70,185,209, 5, 0, 0,116, 15,131, /* 0x 0 */ +248, 73,185,209, 5, 0, 0,116, 5,185, 32, 0, 0, 0,137,200, /* 0x 10 */ +195,232, 0, 0, 0, 0,131,248, 2,185, 83, 0, 0, 0,116,238, /* 0x 20 */ +131,248, 5,185, 83, 0, 0, 0,116,228,131,248, 8,185, 83, 0, /* 0x 30 */ + 0, 0,116,218,131,248, 11,185, 83, 0, 0, 0,116,208,233,198, /* 0x 40 */ +255,255,255, 96,131,205,255,139,116, 36, 36,139,124, 36, 44,235, /* 0x 50 */ + 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, 30, /* 0x 60 */ +131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, 1, /* 0x 70 */ + 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192, /* 0x 80 */ + 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, /* 0x 90 */ + 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 49,201,131,232, /* 0x a0 */ + 3,114, 13,193,224, 8,138, 6, 70,131,240,255,116, 0,137,197, /* 0x b0 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, /* 0x c0 */ + 7,139, 30,131,238,252, 17,219, 17,201,117, 0, 65, 1,219,117, /* 0x d0 */ + 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, 7,139, 30, /* 0x e0 */ +131,238,252, 17,219,115, 0, 1,219,115, 0,117, 9,139, 30,131, /* 0x f0 */ +238,252, 17,219,115, 0, 65, 65,131,193, 2,129,253, 0,243,255, /* 0x 100 */ +255,131,209, 1, 86,141, 52, 47,243,164, 94,233, 0, 0, 0, 0, /* 0x 110 */ +141, 20, 47,131,253,252,138, 4, 15,118, 0,138, 2, 66,136, 7, /* 0x 120 */ + 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, 4,137, 7, /* 0x 130 */ +131,199, 4,131,233, 4,119,241, 1,207,233, 0, 0, 0, 0,235, /* 0x 140 */ + 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, 30, /* 0x 150 */ +131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, 1, /* 0x 160 */ + 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192, /* 0x 170 */ + 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 1,219,115, /* 0x 180 */ + 11,117, 0,139, 30,131,238,252, 17,219,114, 0, 72, 1,219,117, /* 0x 190 */ + 7,139, 30,131,238,252, 17,219, 17,192,235, 0, 49,201,131,232, /* 0x 1a0 */ + 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, 0,209,248, /* 0x 1b0 */ +137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 1c0 */ +201, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, 0, /* 0x 1d0 */ + 65, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219, /* 0x 1e0 */ +117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, /* 0x 1f0 */ + 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129, /* 0x 200 */ +253, 0,251,255,255,131,209, 1, 86,141, 52, 47,243,164, 94,233, /* 0x 210 */ + 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0,138, /* 0x 220 */ + 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131, /* 0x 230 */ +194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, /* 0x 240 */ + 0, 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219, /* 0x 250 */ +117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7, /* 0x 260 */ +114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, /* 0x 270 */ + 17,219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, /* 0x 280 */ + 0, 1,219,115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, /* 0x 290 */ + 72, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, /* 0x 2a0 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,235, 0, 49, /* 0x 2b0 */ +201,131,232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, /* 0x 2c0 */ + 0,209,248,137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, /* 0x 2d0 */ + 17,219,114,204, 65, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 2e0 */ +114,190, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1, /* 0x 2f0 */ +219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0, /* 0x 300 */ +117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2, /* 0x 310 */ +129,253, 0,251,255,255,131,209, 2, 86,141, 52, 47,243,164, 94, /* 0x 320 */ +233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0, /* 0x 330 */ +138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2, /* 0x 340 */ +131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, /* 0x 350 */ + 0, 0, 0, 0,255,210, 1,219,117, 2,255,210,144,232, 0, 0, /* 0x 360 */ + 0, 0, 1,219,116, 0,195,139, 30,131,238,252, 17,219,195, 41, /* 0x 370 */ +201, 17,201,114, 0, 17,201,114, 0, 17,201, 17,192, 72, 17,192, /* 0x 380 */ +131,233, 1,115, 0,141, 72, 15, 61,240,255, 0, 0,114, 0,141, /* 0x 390 */ + 4, 14, 80,233, 0, 0, 0, 0, 17,201, 17,201,131,193, 13,235, /* 0x 3a0 */ + 0,133,201,116, 0, 65,131,193, 8,235, 0, 41,201, 90, 41,219, /* 0x 3b0 */ +141, 65, 1,115, 0,114, 0,114, 0,114, 0,131,193, 2,114, 0, /* 0x 3c0 */ + 65,114, 5,233, 0, 0, 0, 0, 17,201,209,233,115, 1,164,209, /* 0x 3d0 */ +233,115, 2,102,165,243,165,141, 65, 1,235, 3,164,164,164, 17, /* 0x 3e0 */ +192,115, 0,131,232, 3,114, 11,193,224, 8,172,131,240,255,116, /* 0x 3f0 */ + 0,137,197, 17,201, 17,201,117, 0, 65, 17,201,115, 0,131,193, /* 0x 400 */ + 2,129,253, 0,243,255,255,131,209, 1, 86,141, 52, 47,131,253, /* 0x 410 */ +252,119, 19,209,233,115, 1,164,209,233,115, 2,102,165,243,165, /* 0x 420 */ + 94,233, 0, 0, 0, 0,131,253,255,117, 5,172,243,170,235,240, /* 0x 430 */ +243,164,235,236,233, 0, 0, 0, 0,139, 84, 36, 36, 3, 84, 36, /* 0x 440 */ + 40, 57,214,116, 1, 72, 43,124, 36, 44,139, 84, 36, 48,137, 58, /* 0x 450 */ +137, 68, 36, 28, 97,195,185, 84, 69, 88, 76,138, 7, 71, 44,232, /* 0x 460 */ + 60, 1,119,247,128, 63, 63,117, 0,139, 7,138, 95, 4,102,193, /* 0x 470 */ +232, 8,134,196,193,192, 16,134,196, 41,248,128,235,232,137, 7, /* 0x 480 */ +131,199, 5,136,216,226, 0,185, 84, 69, 88, 76,176,232,176,233, /* 0x 490 */ +242,174,117, 0,128, 63, 63,117, 0,139, 7,102,193,232, 8,134, /* 0x 4a0 */ +196,193,192, 16,134,196, 41,248,171,235, 0,235, 0, 90, 88, 89, /* 0x 4b0 */ +151, 96, 49,219,187, 78, 77, 82, 85,106, 15, 88,138,100, 36, 32, /* 0x 4c0 */ +106, 15, 91,138,124, 36, 32,138, 84, 36, 32,233, 0, 0, 0, 0, /* 0x 4d0 */ + 15,183, 47, 43,110, 12, 41,221,117, 0,131,237, 1,115, 0,136, /* 0x 4e0 */ + 95,255, 73,136, 7, 71,139, 7,156,102,193,232, 8,193,192, 16, /* 0x 4f0 */ +134,196,157,115, 0,176, 0, 15,200,115, 0,209,232,115, 0,254, /* 0x 500 */ +203, 75, 35, 30,125, 2, 3, 30,137, 4,156,235, 0,141, 20, 24, /* 0x 510 */ + 15,182,210, 35, 22, 59, 22,114, 2, 43, 22,139, 4,148,254,203, /* 0x 520 */ + 75, 35, 30,125, 2, 3, 30,139, 44,156,133,237,117, 0, 80,139, /* 0x 530 */ + 70, 4,254,200, 72, 35, 6,125, 2, 3, 6, 49,237,137, 70, 4, /* 0x 540 */ +135,108,132, 4, 88,137, 44,148,137, 4,156, 41,248,131,233, 4, /* 0x 550 */ + 3, 70, 16, 1,240,137, 7,131,199, 4,235, 0,235, 0, 80,176, /* 0x 560 */ +233,176,232, 80,106, 0, 83,137,230, 94,137,218,178,233,178,232, /* 0x 570 */ + 67,106, 0,254,203, 75,117, 0, 15,183, 7,131,199, 1, 60,128, /* 0x 580 */ +114, 4, 60,143,118, 0, 41,208, 43, 70, 8,131,232, 2,116, 0, /* 0x 590 */ +131,232, 1,114, 0,115, 0,122, 0,123, 0,248,235, 0,131,233, /* 0x 5a0 */ + 1,127, 0,137,231,185, 4, 1, 0, 0,139, 14,131,193, 5,139, /* 0x 5b0 */ + 14,131,193, 4, 49,192,243,171,137,252, 86, 97,151, 81, 80, 82, /* 0x 5c0 */ +195, 96,139,124, 36, 36,139, 76, 36, 40,139, 84, 36, 44,137,254, /* 0x 5d0 */ +235, 0,138, 7,131,199, 1, 60,128,114, 10, 60,143,119, 6,128, /* 0x 5e0 */ +127,254, 15,116, 0, 44,232, 60, 1,119, 0, 56, 23,117, 0,139, /* 0x 5f0 */ + 7,102,193,232, 8,193,192, 16,134,196, 41,248, 1,240,137, 7, /* 0x 600 */ +131,199, 4,131,233, 4,138, 7,131,199, 1,226, 0,131,233, 1, /* 0x 610 */ +127, 0, 97,195, 76, 88, 80, 84, 73, 48, 48, 48, 0, 0, 0, 0, /* 0x 620 */ + 0, 0, 0, 0, 0, 38, 0, 0, 0, 76, 88, 80, 84, 73, 50, 48, /* 0x 630 */ + 48, 0, 0, 0, 0, 0, 76, 88, 80, 84, 73, 48, 52, 48, 0, 83, /* 0x 640 */ + 0, 0, 0, 76, 88, 80, 84, 73, 48, 52, 49, 0, 83, 0, 0, 0, /* 0x 650 */ + 76, 88, 80, 84, 73, 48, 52, 50, 0, 83, 0, 0, 0, 76, 88, 80, /* 0x 660 */ + 84, 73, 48, 52, 51, 0, 83, 0, 0, 0, 76, 88, 80, 84, 73, 48, /* 0x 670 */ + 53, 48, 0, 83, 0, 0, 0, 78, 50, 66, 83, 77, 65, 49, 48, 0, /* 0x 680 */ + 95, 0, 0, 0, 0, 0, 0, 0, 97, 0, 0, 0, 78, 50, 66, 68, /* 0x 690 */ + 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, 70, 65, 83, 49, /* 0x 6a0 */ + 48, 0, 98, 0, 0, 0, 0, 0, 0, 0,100, 0, 0, 0, 78, 50, /* 0x 6b0 */ + 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, 70, 65, /* 0x 6c0 */ + 83, 49, 49, 0,100, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, /* 0x 6d0 */ + 0,106, 0, 0, 0, 78, 50, 66, 83, 77, 65, 50, 48, 0,117, 0, /* 0x 6e0 */ + 0, 0, 0, 0, 0, 0,119, 0, 0, 0, 78, 50, 66, 83, 77, 65, /* 0x 6f0 */ + 49, 48, 0, 2, 0, 0, 0, 78, 50, 66, 70, 65, 83, 50, 48, 0, /* 0x 700 */ +122, 0, 0, 0, 0, 0, 0, 0,126, 0, 0, 0, 78, 50, 66, 70, /* 0x 710 */ + 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, /* 0x 720 */ + 48, 0,131, 0, 0, 0, 78, 50, 66, 83, 77, 65, 51, 48, 0,144, /* 0x 730 */ + 0, 0, 0, 0, 0, 0, 0,157, 0, 0, 0, 78, 50, 66, 68, 69, /* 0x 740 */ + 67, 50, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 51, 48, /* 0x 750 */ + 0,157, 0, 0, 0, 0, 0, 0, 0,161, 0, 0, 0, 78, 50, 66, /* 0x 760 */ + 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,172, 0, /* 0x 770 */ + 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 78, /* 0x 780 */ + 50, 66, 68, 69, 67, 51, 48, 0,172, 0, 0, 0, 0, 0, 0, 0, /* 0x 790 */ +190, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 0, 0, 0, /* 0x 7a0 */ + 0, 0, 0, 0, 0,220, 0, 0, 0, 78, 50, 66, 68, 69, 67, 53, /* 0x 7b0 */ + 48, 0, 0, 0, 0, 0, 78, 50, 66, 83, 77, 65, 52, 48, 0,234, /* 0x 7c0 */ + 0, 0, 0, 0, 0, 0, 0,247, 0, 0, 0, 78, 50, 66, 68, 69, /* 0x 7d0 */ + 67, 51, 48, 0, 49, 0, 0, 0, 78, 50, 66, 70, 65, 83, 52, 48, /* 0x 7e0 */ + 0,247, 0, 0, 0, 0, 0, 0, 0,251, 0, 0, 0, 78, 50, 66, /* 0x 7f0 */ + 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 0, 0, 0, 0, 6, 1, /* 0x 800 */ + 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 78, /* 0x 810 */ + 50, 66, 68, 85, 77, 77, 49, 0, 6, 1, 0, 0, 78, 50, 66, 83, /* 0x 820 */ + 77, 65, 53, 48, 0, 6, 1, 0, 0, 78, 50, 66, 70, 65, 83, 53, /* 0x 830 */ + 48, 0, 8, 1, 0, 0, 78, 50, 66, 68, 69, 67, 53, 48, 0, 11, /* 0x 840 */ + 1, 0, 0, 78, 50, 66, 83, 77, 65, 54, 48, 0, 20, 1, 0, 0, /* 0x 850 */ + 0, 0, 0, 0, 32, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, /* 0x 860 */ + 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 54, 48, 0, 32, 1, /* 0x 870 */ + 0, 0, 0, 0, 0, 0, 43, 1, 0, 0, 78, 50, 66, 70, 65, 83, /* 0x 880 */ + 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 1, 0, 0, 78, /* 0x 890 */ + 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, /* 0x 8a0 */ + 65, 83, 54, 49, 0, 57, 1, 0, 0, 0, 0, 0, 0, 79, 1, 0, /* 0x 8b0 */ + 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, /* 0x 8c0 */ + 66, 68, 69, 67, 54, 48, 0, 79, 1, 0, 0, 78, 82, 86, 50, 66, /* 0x 8d0 */ + 69, 78, 68, 0, 79, 1, 0, 0, 78, 50, 68, 83, 77, 65, 49, 48, /* 0x 8e0 */ + 0, 79, 1, 0, 0, 0, 0, 0, 0, 81, 1, 0, 0, 78, 50, 68, /* 0x 8f0 */ + 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 68, 70, 65, 83, /* 0x 900 */ + 49, 48, 0, 82, 1, 0, 0, 0, 0, 0, 0, 84, 1, 0, 0, 78, /* 0x 910 */ + 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 68, 70, /* 0x 920 */ + 65, 83, 49, 49, 0, 84, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, /* 0x 930 */ + 48, 0, 90, 1, 0, 0, 78, 50, 68, 83, 77, 65, 50, 48, 0,101, /* 0x 940 */ + 1, 0, 0, 0, 0, 0, 0,103, 1, 0, 0, 78, 50, 68, 83, 77, /* 0x 950 */ + 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 68, 70, 65, 83, 50, 48, /* 0x 960 */ + 0,106, 1, 0, 0, 0, 0, 0, 0,110, 1, 0, 0, 78, 50, 68, /* 0x 970 */ + 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 980 */ + 50, 48, 0,115, 1, 0, 0, 78, 50, 68, 83, 77, 65, 51, 48, 0, /* 0x 990 */ +128, 1, 0, 0, 0, 0, 0, 0,141, 1, 0, 0, 78, 50, 68, 68, /* 0x 9a0 */ + 69, 67, 51, 48, 0, 16, 0, 0, 0, 78, 50, 68, 70, 65, 83, 51, /* 0x 9b0 */ + 48, 0,141, 1, 0, 0, 0, 0, 0, 0,147, 1, 0, 0, 78, 50, /* 0x 9c0 */ + 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 0, 0, 0, 0,156, /* 0x 9d0 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, /* 0x 9e0 */ + 78, 50, 68, 68, 69, 67, 51, 48, 0,156, 1, 0, 0, 0, 0, 0, /* 0x 9f0 */ + 0,172, 1, 0, 0, 78, 50, 68, 68, 69, 67, 50, 48, 0, 0, 0, /* 0x a00 */ + 0, 0, 0, 0, 0, 0,190, 1, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x a10 */ + 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,224, 1, 0, 0, 78, /* 0x a20 */ + 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, 68, 83, /* 0x a30 */ + 77, 65, 52, 48, 0,238, 1, 0, 0, 0, 0, 0, 0,251, 1, 0, /* 0x a40 */ + 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, 78, 50, /* 0x a50 */ + 68, 70, 65, 83, 52, 48, 0,251, 1, 0, 0, 0, 0, 0, 0,255, /* 0x a60 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, /* 0x a70 */ + 0, 0, 0, 0, 10, 2, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x a80 */ + 0, 69, 0, 0, 0, 78, 50, 68, 68, 85, 77, 77, 49, 0, 10, 2, /* 0x a90 */ + 0, 0, 78, 50, 68, 83, 77, 65, 53, 48, 0, 10, 2, 0, 0, 78, /* 0x aa0 */ + 50, 68, 70, 65, 83, 53, 48, 0, 12, 2, 0, 0, 78, 50, 68, 68, /* 0x ab0 */ + 69, 67, 53, 48, 0, 15, 2, 0, 0, 78, 50, 68, 83, 77, 65, 54, /* 0x ac0 */ + 48, 0, 24, 2, 0, 0, 0, 0, 0, 0, 36, 2, 0, 0, 78, 50, /* 0x ad0 */ + 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 70, 65, /* 0x ae0 */ + 83, 54, 48, 0, 36, 2, 0, 0, 0, 0, 0, 0, 47, 2, 0, 0, /* 0x af0 */ + 78, 50, 68, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x b00 */ + 0, 61, 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, /* 0x b10 */ + 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 61, 2, 0, 0, 0, /* 0x b20 */ + 0, 0, 0, 83, 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, /* 0x b30 */ + 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 54, 48, 0, 83, 2, 0, /* 0x b40 */ + 0, 78, 82, 86, 50, 68, 69, 78, 68, 0, 83, 2, 0, 0, 78, 50, /* 0x b50 */ + 69, 83, 77, 65, 49, 48, 0, 83, 2, 0, 0, 0, 0, 0, 0, 85, /* 0x b60 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, /* 0x b70 */ + 78, 50, 69, 70, 65, 83, 49, 48, 0, 86, 2, 0, 0, 0, 0, 0, /* 0x b80 */ + 0, 88, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 4, 0, /* 0x b90 */ + 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 88, 2, 0, 0, 78, /* 0x ba0 */ + 50, 69, 68, 69, 67, 49, 48, 0, 94, 2, 0, 0, 78, 50, 69, 83, /* 0x bb0 */ + 77, 65, 50, 48, 0,105, 2, 0, 0, 0, 0, 0, 0,107, 2, 0, /* 0x bc0 */ + 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, /* 0x bd0 */ + 69, 70, 65, 83, 50, 48, 0,110, 2, 0, 0, 0, 0, 0, 0,114, /* 0x be0 */ + 2, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, /* 0x bf0 */ + 78, 50, 69, 68, 69, 67, 50, 48, 0,119, 2, 0, 0, 78, 50, 69, /* 0x c00 */ + 83, 77, 65, 51, 48, 0,132, 2, 0, 0, 0, 0, 0, 0,145, 2, /* 0x c10 */ + 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, 0, 78, /* 0x c20 */ + 50, 69, 70, 65, 83, 51, 48, 0,145, 2, 0, 0, 0, 0, 0, 0, /* 0x c30 */ +151, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, /* 0x c40 */ + 0, 0, 0, 0, 0,160, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, /* 0x c50 */ + 48, 0, 31, 0, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0,160, /* 0x c60 */ + 2, 0, 0, 0, 0, 0, 0,176, 2, 0, 0, 78, 50, 69, 68, 69, /* 0x c70 */ + 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,191, 2, 0, 0, /* 0x c80 */ + 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x c90 */ + 0,209, 2, 0, 0, 78, 50, 69, 68, 69, 67, 54, 48, 0, 0, 0, /* 0x ca0 */ + 0, 0, 78, 50, 69, 83, 77, 65, 52, 48, 0,255, 2, 0, 0, 0, /* 0x cb0 */ + 0, 0, 0, 12, 3, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, /* 0x cc0 */ + 82, 0, 0, 0, 78, 50, 69, 70, 65, 83, 52, 48, 0, 12, 3, 0, /* 0x cd0 */ + 0, 0, 0, 0, 0, 16, 3, 0, 0, 78, 50, 69, 68, 69, 67, 51, /* 0x ce0 */ + 48, 0, 82, 0, 0, 0, 0, 0, 0, 0, 27, 3, 0, 0, 78, 50, /* 0x cf0 */ + 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 68, 85, /* 0x d00 */ + 77, 77, 49, 0, 27, 3, 0, 0, 78, 50, 69, 83, 77, 65, 53, 48, /* 0x d10 */ + 0, 27, 3, 0, 0, 78, 50, 69, 70, 65, 83, 53, 48, 0, 29, 3, /* 0x d20 */ + 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, 32, 3, 0, 0, 78, /* 0x d30 */ + 50, 69, 83, 77, 65, 54, 48, 0, 41, 3, 0, 0, 0, 0, 0, 0, /* 0x d40 */ + 53, 3, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, /* 0x d50 */ + 0, 78, 50, 69, 70, 65, 83, 54, 48, 0, 53, 3, 0, 0, 0, 0, /* 0x d60 */ + 0, 0, 64, 3, 0, 0, 78, 50, 69, 70, 65, 83, 54, 49, 0, 0, /* 0x d70 */ + 0, 0, 0, 0, 0, 0, 0, 78, 3, 0, 0, 78, 50, 69, 68, 69, /* 0x d80 */ + 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, 49, /* 0x d90 */ + 0, 78, 3, 0, 0, 0, 0, 0, 0,100, 3, 0, 0, 78, 50, 69, /* 0x da0 */ + 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x db0 */ + 54, 48, 0,100, 3, 0, 0, 78, 82, 86, 50, 69, 69, 78, 68, 0, /* 0x dc0 */ +100, 3, 0, 0, 67, 76, 49, 83, 77, 65, 49, 66, 0,100, 3, 0, /* 0x dd0 */ + 0, 67, 76, 49, 70, 65, 83, 49, 66, 0,102, 3, 0, 0, 67, 76, /* 0x de0 */ + 49, 71, 69, 84, 49, 66, 0,108, 3, 0, 0, 67, 76, 49, 69, 78, /* 0x df0 */ + 84, 69, 82, 0,108, 3, 0, 0, 0, 0, 0, 0,114, 3, 0, 0, /* 0x e00 */ + 67, 76, 49, 83, 84, 65, 82, 84, 0, 0, 0, 0, 0, 67, 76, 49, /* 0x e10 */ + 83, 77, 65, 49, 48, 0,114, 3, 0, 0, 0, 0, 0, 0,118, 3, /* 0x e20 */ + 0, 0, 67, 76, 49, 82, 76, 79, 65, 68, 0, 0, 0, 0, 0, 67, /* 0x e30 */ + 76, 49, 82, 76, 79, 65, 68, 0,119, 3, 0, 0, 67, 76, 49, 87, /* 0x e40 */ + 73, 68, 48, 49, 0,127, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, /* 0x e50 */ + 50, 0,129, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 51, 0,131, /* 0x e60 */ + 3, 0, 0, 0, 0, 0, 0,133, 3, 0, 0, 67, 76, 49, 87, 73, /* 0x e70 */ + 68, 49, 48, 0, 12, 0, 0, 0, 67, 76, 49, 87, 73, 68, 48, 52, /* 0x e80 */ + 0,133, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 53, 0,135, 3, /* 0x e90 */ + 0, 0, 0, 0, 0, 0,137, 3, 0, 0, 67, 76, 49, 87, 73, 68, /* 0x ea0 */ + 49, 48, 0, 7, 0, 0, 0, 67, 76, 49, 87, 73, 68, 48, 54, 0, /* 0x eb0 */ +137, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 55, 0,139, 3, 0, /* 0x ec0 */ + 0, 67, 76, 49, 87, 73, 68, 48, 56, 0,142, 3, 0, 0, 0, 0, /* 0x ed0 */ + 0, 0,149, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 54, 0, 2, /* 0x ee0 */ + 0, 0, 0, 0, 0, 0, 0,159, 3, 0, 0, 67, 76, 49, 87, 73, /* 0x ef0 */ + 68, 49, 48, 0, 15, 0, 0, 0, 0, 0, 0, 0,168, 3, 0, 0, /* 0x f00 */ + 67, 76, 49, 67, 79, 80, 89, 48, 0, 18, 0, 0, 0, 67, 76, 49, /* 0x f10 */ + 87, 73, 68, 48, 57, 0,168, 3, 0, 0, 67, 76, 49, 87, 73, 68, /* 0x f20 */ + 49, 48, 0,170, 3, 0, 0, 0, 0, 0, 0,177, 3, 0, 0, 67, /* 0x f30 */ + 76, 49, 84, 79, 80, 48, 55, 0, 2, 0, 0, 0, 0, 0, 0, 0, /* 0x f40 */ +181, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 56, 0, 26, 0, 0, /* 0x f50 */ + 0, 0, 0, 0, 0,187, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, /* 0x f60 */ + 55, 0, 2, 0, 0, 0, 67, 76, 49, 83, 84, 65, 82, 84, 0,187, /* 0x f70 */ + 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 48, 0,192, 3, 0, 0, /* 0x f80 */ + 67, 76, 49, 84, 79, 80, 48, 49, 0,195, 3, 0, 0, 0, 0, 0, /* 0x f90 */ + 0,197, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 55, 0, 23, 0, /* 0x fa0 */ + 0, 0, 67, 76, 49, 84, 79, 80, 48, 50, 0,197, 3, 0, 0, 0, /* 0x fb0 */ + 0, 0, 0,199, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 55, 0, /* 0x fc0 */ + 22, 0, 0, 0, 67, 76, 49, 84, 79, 80, 48, 51, 0,199, 3, 0, /* 0x fd0 */ + 0, 0, 0, 0, 0,201, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, /* 0x fe0 */ + 55, 0, 21, 0, 0, 0, 67, 76, 49, 84, 79, 80, 48, 52, 0,201, /* 0x ff0 */ + 3, 0, 0, 0, 0, 0, 0,203, 3, 0, 0, 67, 76, 49, 84, 79, /* 0x1000 */ + 80, 48, 55, 0, 20, 0, 0, 0, 67, 76, 49, 84, 79, 80, 48, 53, /* 0x1010 */ + 0,206, 3, 0, 0, 0, 0, 0, 0,208, 3, 0, 0, 67, 76, 49, /* 0x1020 */ + 84, 79, 80, 48, 54, 0, 7, 0, 0, 0, 67, 76, 49, 84, 79, 80, /* 0x1030 */ + 48, 54, 0,209, 3, 0, 0, 0, 0, 0, 0,216, 3, 0, 0, 67, /* 0x1040 */ + 76, 49, 87, 73, 68, 48, 49, 0, 0, 0, 0, 0, 67, 76, 49, 84, /* 0x1050 */ + 79, 80, 48, 55, 0,216, 3, 0, 0, 67, 76, 49, 79, 70, 70, 48, /* 0x1060 */ + 49, 0,239, 3, 0, 0, 67, 76, 49, 79, 70, 70, 48, 50, 0,241, /* 0x1070 */ + 3, 0, 0, 0, 0, 0, 0,243, 3, 0, 0, 67, 76, 49, 84, 79, /* 0x1080 */ + 80, 48, 55, 0, 23, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, /* 0x1090 */ + 67, 76, 49, 67, 79, 80, 89, 48, 0, 51, 0, 0, 0, 67, 76, 49, /* 0x10a0 */ + 79, 70, 70, 48, 51, 0, 3, 4, 0, 0, 67, 76, 49, 79, 70, 70, /* 0x10b0 */ + 48, 52, 0, 5, 4, 0, 0, 0, 0, 0, 0, 9, 4, 0, 0, 67, /* 0x10c0 */ + 76, 49, 67, 79, 80, 89, 48, 0, 0, 0, 0, 0, 67, 76, 49, 76, /* 0x10d0 */ + 69, 78, 48, 48, 0, 9, 4, 0, 0, 67, 76, 49, 76, 69, 78, 48, /* 0x10e0 */ + 49, 0, 10, 4, 0, 0, 67, 76, 49, 76, 69, 78, 48, 50, 0, 12, /* 0x10f0 */ + 4, 0, 0, 0, 0, 0, 0, 14, 4, 0, 0, 67, 76, 49, 76, 69, /* 0x1100 */ + 78, 48, 48, 0, 1, 0, 0, 0, 67, 76, 49, 67, 79, 80, 89, 48, /* 0x1110 */ + 0, 17, 4, 0, 0, 0, 0, 0, 0, 54, 4, 0, 0, 67, 76, 49, /* 0x1120 */ + 84, 79, 80, 48, 48, 0, 0, 0, 0, 0, 67, 76, 49, 69, 78, 68, /* 0x1130 */ + 0, 68, 4, 0, 0, 76, 88, 80, 84, 73, 48, 57, 48, 0, 68, 4, /* 0x1140 */ + 0, 0, 0, 0, 0, 0, 73, 4, 0, 0, 76, 88, 80, 84, 73, 48, /* 0x1150 */ + 57, 49, 0, 0, 0, 0, 0, 76, 88, 80, 84, 73, 48, 57, 49, 0, /* 0x1160 */ + 73, 4, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0,102, 4, 0, /* 0x1170 */ + 0, 67, 84, 67, 76, 69, 86, 69, 49, 0,116, 4, 0, 0, 0, 0, /* 0x1180 */ + 0, 0,121, 4, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, 5, /* 0x1190 */ + 0, 0, 0, 67, 65, 76, 76, 84, 82, 48, 49, 0,121, 4, 0, 0, /* 0x11a0 */ + 67, 84, 68, 85, 77, 77, 89, 49, 0,126, 4, 0, 0, 67, 84, 66, /* 0x11b0 */ + 83, 72, 82, 48, 49, 0,126, 4, 0, 0, 67, 84, 66, 82, 79, 82, /* 0x11c0 */ + 48, 49, 0,130, 4, 0, 0, 67, 84, 66, 83, 87, 65, 48, 49, 0, /* 0x11d0 */ +132, 4, 0, 0, 67, 65, 76, 76, 84, 82, 48, 50, 0,137, 4, 0, /* 0x11e0 */ + 0, 0, 0, 0, 0,151, 4, 0, 0, 67, 65, 76, 76, 84, 82, 48, /* 0x11f0 */ + 48, 0, 10, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, 0,151, /* 0x1200 */ + 4, 0, 0, 67, 65, 76, 76, 84, 82, 69, 56, 0,156, 4, 0, 0, /* 0x1210 */ + 67, 65, 76, 76, 84, 82, 69, 57, 0,158, 4, 0, 0, 67, 65, 76, /* 0x1220 */ + 76, 84, 82, 49, 49, 0,160, 4, 0, 0, 0, 0, 0, 0,164, 4, /* 0x1230 */ + 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, 5, 0, 0, 0, 67, /* 0x1240 */ + 84, 67, 76, 69, 86, 69, 50, 0,164, 4, 0, 0, 0, 0, 0, 0, /* 0x1250 */ +169, 4, 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, 0, 0, 0, 0, /* 0x1260 */ + 0, 67, 65, 76, 76, 84, 82, 49, 50, 0,169, 4, 0, 0, 67, 84, /* 0x1270 */ + 68, 85, 77, 77, 89, 50, 0,171, 4, 0, 0, 67, 84, 66, 83, 72, /* 0x1280 */ + 82, 49, 49, 0,171, 4, 0, 0, 67, 84, 66, 82, 79, 82, 49, 49, /* 0x1290 */ + 0,175, 4, 0, 0, 67, 84, 66, 83, 87, 65, 49, 49, 0,177, 4, /* 0x12a0 */ + 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0,182, 4, 0, 0, 0, /* 0x12b0 */ + 0, 0, 0,187, 4, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, 0, /* 0x12c0 */ + 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, 68, 0,187, 4, 0, /* 0x12d0 */ + 0, 76, 88, 85, 78, 70, 48, 48, 48, 0,187, 4, 0, 0, 0, 0, /* 0x12e0 */ + 0, 0,189, 4, 0, 0, 76, 88, 85, 78, 70, 48, 49, 48, 0, 5, /* 0x12f0 */ + 0, 0, 0, 76, 88, 85, 78, 70, 48, 48, 50, 0,189, 4, 0, 0, /* 0x1300 */ + 77, 82, 85, 66, 89, 84, 69, 48, 0,194, 4, 0, 0, 76, 88, 77, /* 0x1310 */ + 82, 85, 48, 48, 53, 0,196, 4, 0, 0, 76, 88, 77, 82, 85, 48, /* 0x1320 */ + 48, 54, 0,201, 4, 0, 0, 76, 88, 77, 82, 85, 48, 48, 55, 0, /* 0x1330 */ +208, 4, 0, 0, 76, 88, 85, 78, 70, 48, 48, 56, 0,215, 4, 0, /* 0x1340 */ + 0, 76, 88, 85, 78, 70, 48, 49, 48, 0,219, 4, 0, 0, 0, 0, /* 0x1350 */ + 0, 0,224, 4, 0, 0, 76, 88, 85, 78, 70, 48, 52, 50, 0, 0, /* 0x1360 */ + 0, 0, 0, 76, 88, 74, 67, 67, 48, 49, 48, 0,224, 4, 0, 0, /* 0x1370 */ + 76, 88, 77, 82, 85, 48, 52, 53, 0,227, 4, 0, 0, 76, 88, 77, /* 0x1380 */ + 82, 85, 48, 52, 54, 0,230, 4, 0, 0, 76, 88, 74, 67, 67, 48, /* 0x1390 */ + 50, 48, 0,232, 4, 0, 0, 0, 0, 0, 0,234, 4, 0, 0, 76, /* 0x13a0 */ + 88, 85, 78, 70, 48, 51, 52, 0, 0, 0, 0, 0, 76, 88, 74, 67, /* 0x13b0 */ + 67, 48, 50, 49, 0,234, 4, 0, 0, 0, 0, 0, 0,239, 4, 0, /* 0x13c0 */ + 0, 76, 88, 85, 78, 70, 48, 51, 52, 0, 0, 0, 0, 0, 76, 88, /* 0x13d0 */ + 74, 67, 67, 48, 50, 51, 0,239, 4, 0, 0, 76, 88, 85, 78, 70, /* 0x13e0 */ + 48, 51, 55, 0,246, 4, 0, 0, 76, 88, 85, 78, 70, 51, 56, 54, /* 0x13f0 */ + 0,248, 4, 0, 0, 76, 88, 85, 78, 70, 51, 56, 55, 0,249, 4, /* 0x1400 */ + 0, 0, 76, 88, 85, 78, 70, 51, 56, 56, 0, 2, 5, 0, 0, 0, /* 0x1410 */ + 0, 0, 0, 5, 5, 0, 0, 76, 88, 85, 78, 70, 48, 52, 48, 0, /* 0x1420 */ + 0, 0, 0, 0, 76, 88, 85, 78, 70, 52, 56, 54, 0, 5, 5, 0, /* 0x1430 */ + 0, 76, 88, 85, 78, 70, 52, 56, 55, 0, 9, 5, 0, 0, 0, 0, /* 0x1440 */ + 0, 0, 11, 5, 0, 0, 76, 88, 85, 78, 70, 48, 52, 48, 0, 0, /* 0x1450 */ + 0, 0, 0, 76, 88, 77, 82, 85, 48, 54, 53, 0, 11, 5, 0, 0, /* 0x1460 */ + 0, 0, 0, 0, 15, 5, 0, 0, 76, 88, 77, 82, 85, 48, 55, 48, /* 0x1470 */ + 0, 5, 0, 0, 0, 77, 82, 85, 66, 89, 84, 69, 51, 0, 15, 5, /* 0x1480 */ + 0, 0, 77, 82, 85, 65, 82, 66, 51, 48, 0, 17, 5, 0, 0, 77, /* 0x1490 */ + 82, 85, 66, 73, 84, 83, 51, 0, 18, 5, 0, 0, 77, 82, 85, 65, /* 0x14a0 */ + 82, 66, 52, 48, 0, 20, 5, 0, 0, 76, 88, 77, 82, 85, 48, 55, /* 0x14b0 */ + 48, 0, 24, 5, 0, 0, 0, 0, 0, 0, 29, 5, 0, 0, 76, 88, /* 0x14c0 */ + 85, 78, 70, 48, 52, 48, 0, 0, 0, 0, 0, 77, 82, 85, 66, 89, /* 0x14d0 */ + 84, 69, 52, 0, 32, 5, 0, 0, 77, 82, 85, 66, 73, 84, 83, 52, /* 0x14e0 */ + 0, 35, 5, 0, 0, 77, 82, 85, 65, 82, 66, 53, 48, 0, 37, 5, /* 0x14f0 */ + 0, 0, 76, 88, 77, 82, 85, 48, 56, 48, 0, 43, 5, 0, 0, 77, /* 0x1500 */ + 82, 85, 66, 89, 84, 69, 53, 0, 46, 5, 0, 0, 77, 82, 85, 65, /* 0x1510 */ + 82, 66, 54, 48, 0, 48, 5, 0, 0, 77, 82, 85, 66, 73, 84, 83, /* 0x1520 */ + 53, 0, 49, 5, 0, 0, 77, 82, 85, 65, 82, 66, 55, 48, 0, 51, /* 0x1530 */ + 5, 0, 0, 76, 88, 77, 82, 85, 48, 57, 48, 0, 55, 5, 0, 0, /* 0x1540 */ + 0, 0, 0, 0, 62, 5, 0, 0, 76, 88, 77, 82, 85, 49, 48, 48, /* 0x1550 */ + 0, 10, 0, 0, 0, 77, 82, 85, 66, 89, 84, 69, 54, 0, 66, 5, /* 0x1560 */ + 0, 0, 77, 82, 85, 65, 82, 66, 56, 48, 0, 68, 5, 0, 0, 77, /* 0x1570 */ + 82, 85, 66, 73, 84, 83, 54, 0, 69, 5, 0, 0, 77, 82, 85, 65, /* 0x1580 */ + 82, 66, 57, 48, 0, 71, 5, 0, 0, 76, 88, 77, 82, 85, 49, 48, /* 0x1590 */ + 48, 0, 75, 5, 0, 0, 76, 88, 85, 78, 70, 48, 52, 48, 0, 91, /* 0x15a0 */ + 5, 0, 0, 76, 88, 77, 82, 85, 49, 49, 48, 0, 96, 5, 0, 0, /* 0x15b0 */ + 76, 88, 77, 82, 85, 49, 49, 49, 0, 99, 5, 0, 0, 76, 88, 85, /* 0x15c0 */ + 78, 70, 48, 52, 49, 0,101, 5, 0, 0, 0, 0, 0, 0,108, 5, /* 0x15d0 */ + 0, 0, 76, 88, 85, 78, 70, 48, 51, 52, 0, 0, 0, 0, 0, 76, /* 0x15e0 */ + 88, 85, 78, 70, 48, 52, 50, 0,108, 5, 0, 0, 76, 69, 88, 69, /* 0x15f0 */ + 67, 48, 49, 54, 0,108, 5, 0, 0, 0, 0, 0, 0,110, 5, 0, /* 0x1600 */ + 0, 76, 88, 85, 78, 70, 48, 52, 50, 0, 0, 0, 0, 0, 76, 88, /* 0x1610 */ + 77, 82, 85, 48, 49, 48, 0,110, 5, 0, 0, 76, 88, 74, 77, 80, /* 0x1620 */ + 65, 48, 48, 0,111, 5, 0, 0, 76, 88, 67, 65, 76, 76, 66, 48, /* 0x1630 */ + 0,113, 5, 0, 0, 76, 88, 85, 78, 70, 48, 50, 49, 0,115, 5, /* 0x1640 */ + 0, 0, 76, 88, 77, 82, 85, 48, 50, 50, 0,121, 5, 0, 0, 76, /* 0x1650 */ + 88, 74, 77, 80, 65, 48, 49, 0,124, 5, 0, 0, 76, 88, 67, 65, /* 0x1660 */ + 76, 76, 66, 49, 0,126, 5, 0, 0, 77, 82, 85, 66, 73, 84, 83, /* 0x1670 */ + 49, 0,128, 5, 0, 0, 76, 88, 77, 82, 85, 48, 51, 48, 0,129, /* 0x1680 */ + 5, 0, 0, 77, 82, 85, 66, 89, 84, 69, 49, 0,131, 5, 0, 0, /* 0x1690 */ + 77, 82, 85, 65, 82, 66, 49, 48, 0,133, 5, 0, 0, 76, 88, 77, /* 0x16a0 */ + 82, 85, 48, 52, 48, 0,134, 5, 0, 0, 0, 0, 0, 0,136, 5, /* 0x16b0 */ + 0, 0, 76, 88, 77, 82, 85, 48, 51, 48, 0, 0, 0, 0, 0, 76, /* 0x16c0 */ + 88, 85, 78, 70, 48, 51, 48, 0,136, 5, 0, 0, 76, 88, 74, 67, /* 0x16d0 */ + 67, 48, 48, 48, 0,142, 5, 0, 0, 0, 0, 0, 0,150, 5, 0, /* 0x16e0 */ + 0, 76, 88, 74, 67, 67, 48, 49, 48, 0, 0, 0, 0, 0, 76, 88, /* 0x16f0 */ + 67, 74, 48, 77, 82, 85, 0,150, 5, 0, 0, 76, 88, 67, 74, 49, /* 0x1700 */ + 77, 82, 85, 0,152, 5, 0, 0, 76, 88, 67, 65, 76, 74, 77, 80, /* 0x1710 */ + 0,155, 5, 0, 0, 76, 88, 67, 65, 76, 76, 48, 48, 0,158, 5, /* 0x1720 */ + 0, 0, 0, 0, 0, 0,160, 5, 0, 0, 76, 88, 85, 78, 70, 48, /* 0x1730 */ + 51, 55, 0, 0, 0, 0, 0, 76, 88, 67, 65, 76, 76, 48, 49, 0, /* 0x1740 */ +160, 5, 0, 0, 76, 88, 67, 74, 50, 77, 82, 85, 0,163, 5, 0, /* 0x1750 */ + 0, 0, 0, 0, 0,165, 5, 0, 0, 76, 88, 85, 78, 70, 48, 51, /* 0x1760 */ + 55, 0, 0, 0, 0, 0, 76, 88, 67, 74, 52, 77, 82, 85, 0,165, /* 0x1770 */ + 5, 0, 0, 0, 0, 0, 0,167, 5, 0, 0, 76, 88, 85, 78, 70, /* 0x1780 */ + 48, 51, 52, 0, 0, 0, 0, 0, 76, 88, 67, 74, 54, 77, 82, 85, /* 0x1790 */ + 0,167, 5, 0, 0, 0, 0, 0, 0,169, 5, 0, 0, 76, 88, 67, /* 0x17a0 */ + 74, 56, 77, 82, 85, 0, 1, 0, 0, 0, 76, 88, 67, 74, 55, 77, /* 0x17b0 */ + 82, 85, 0,169, 5, 0, 0, 0, 0, 0, 0,171, 5, 0, 0, 76, /* 0x17c0 */ + 88, 67, 74, 56, 77, 82, 85, 0, 1, 0, 0, 0, 76, 88, 67, 74, /* 0x17d0 */ + 56, 77, 82, 85, 0,171, 5, 0, 0, 0, 0, 0, 0,174, 5, 0, /* 0x17e0 */ + 0, 76, 88, 85, 78, 70, 48, 51, 55, 0, 0, 0, 0, 0, 76, 88, /* 0x17f0 */ + 85, 78, 70, 48, 51, 52, 0,174, 5, 0, 0, 0, 0, 0, 0,179, /* 0x1800 */ + 5, 0, 0, 76, 88, 85, 78, 70, 48, 51, 48, 0, 0, 0, 0, 0, /* 0x1810 */ + 76, 88, 77, 82, 85, 48, 53, 53, 0,179, 5, 0, 0, 77, 82, 85, /* 0x1820 */ + 66, 89, 84, 69, 50, 0,181, 5, 0, 0, 77, 82, 85, 66, 73, 84, /* 0x1830 */ + 83, 50, 0,186, 5, 0, 0, 77, 82, 85, 65, 82, 66, 50, 48, 0, /* 0x1840 */ +191, 5, 0, 0, 76, 88, 77, 82, 85, 48, 53, 55, 0,196, 5, 0, /* 0x1850 */ + 0, 76, 88, 77, 82, 85, 48, 53, 56, 0,202, 5, 0, 0, 76, 88, /* 0x1860 */ + 85, 78, 70, 48, 51, 53, 0,203, 5, 0, 0, 76, 88, 80, 84, 73, /* 0x1870 */ + 49, 52, 48, 0,209, 5, 0, 0, 76, 88, 80, 84, 73, 49, 52, 49, /* 0x1880 */ + 0,209, 5, 0, 0, 76, 88, 80, 84, 73, 49, 53, 48, 0,209, 5, /* 0x1890 */ + 0, 0, 67, 75, 76, 76, 84, 82, 48, 48, 0,222, 5, 0, 0, 0, /* 0x18a0 */ + 0, 0, 0,226, 5, 0, 0, 67, 75, 76, 76, 84, 82, 50, 48, 0, /* 0x18b0 */ + 30, 0, 0, 0, 67, 75, 76, 76, 84, 82, 49, 48, 0,231, 5, 0, /* 0x18c0 */ + 0, 0, 0, 0, 0,245, 5, 0, 0, 67, 75, 76, 76, 84, 82, 50, /* 0x18d0 */ + 48, 0, 6, 0, 0, 0, 67, 75, 76, 76, 84, 82, 50, 48, 0,245, /* 0x18e0 */ + 5, 0, 0, 0, 0, 0, 0,251, 5, 0, 0, 67, 75, 76, 76, 84, /* 0x18f0 */ + 82, 52, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 5, 0, 0, /* 0x1900 */ + 67, 75, 76, 76, 84, 82, 52, 48, 0, 0, 0, 0, 0, 67, 75, 76, /* 0x1910 */ + 76, 84, 82, 51, 48, 0, 22, 6, 0, 0, 0, 0, 0, 0, 29, 6, /* 0x1920 */ + 0, 0, 67, 75, 76, 76, 84, 82, 49, 48, 0, 14, 0, 0, 0, 67, /* 0x1930 */ + 75, 76, 76, 84, 82, 52, 48, 0, 29, 6, 0, 0, 0, 0, 0, 0, /* 0x1940 */ + 34, 6, 0, 0, 67, 75, 76, 76, 84, 82, 48, 48, 0, 4, 0, 0, /* 0x1950 */ + 0, 76, 88, 80, 84, 73, 49, 54, 48, 0, 34, 6, 0, 0, 76, 88, /* 0x1960 */ + 80, 84, 73, 50, 48, 48, 0, 36, 6, 0, 0, 88, 84, 72, 69, 69, /* 0x1970 */ + 78, 68, 88, 0, 36, 6, 0, 0,255,255,255,255, 36, 6 /* 0x1980 */ +}; diff --git a/src/stub/i386-linux.elf.interp-fold.h b/src/stub/i386-linux.elf.interp-fold.h new file mode 100644 index 00000000..994027ed --- /dev/null +++ b/src/stub/i386-linux.elf.interp-fold.h @@ -0,0 +1,131 @@ +/* i386-linux.elf.interp-fold.h -- created from i386-linux.elf.interp-fold.bin, 1531 (0x5fb) 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 + + */ + + +#define LINUX_I386PTI_FOLD_SIZE 1531 +#define LINUX_I386PTI_FOLD_ADLER32 0x90e59978 +#define LINUX_I386PTI_FOLD_CRC32 0xdd8fa001 + +unsigned char linux_i386pti_fold[1531] = { +127, 69, 76, 70, 1, 1, 1, 0, 76,105,110,117,120, 0, 0, 0, /* 0x 0 */ + 2, 0, 3, 0, 1, 0, 0, 0,128, 0, 1, 0, 52, 0, 0, 0, /* 0x 10 */ + 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */ + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, /* 0x 30 */ + 0, 0, 1, 0,251, 5, 0, 0,252, 5, 0, 0, 5, 0, 0, 0, /* 0x 40 */ + 0, 16, 0, 0, 1, 0, 0, 0,251, 5, 0, 0,252, 5, 1, 0, /* 0x 50 */ +252, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, /* 0x 60 */ + 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */ + 93, 89, 88,141,124,132, 4, 80, 41,192,175,117,253,175,137,254, /* 0x 80 */ +139, 6,131,248, 3,116, 8,131,198, 8,131,248, 0,117,241,139, /* 0x 90 */ + 94, 4, 83,129,236, 0, 10, 0, 0,137,226, 81,141, 67, 88,139, /* 0x a0 */ +115, 24, 41,198,139, 24,139, 72, 4,131,193, 12, 96,232, 62, 4, /* 0x b0 */ + 0, 0,129,196, 36, 10, 0, 0, 91, 80,139, 75, 20,139, 91, 8, /* 0x c0 */ +184, 91, 0, 0, 0,205,128, 41,192, 41,201, 41,210, 41,219, 41, /* 0x d0 */ +237, 41,246, 41,255,195, 83,141, 92, 36, 8,106, 90, 88,205,128, /* 0x e0 */ + 91,195, 0, 0, 87, 86,137,206, 83,137,195, 57, 8,139,120, 4, /* 0x f0 */ +115, 10,106,127, 91,106, 1, 88,205,128,235,254,133,201,116, 8, /* 0x 100 */ +138, 7, 71,136, 2, 66,226,248, 1,115, 4, 41, 51, 91, 94, 95, /* 0x 110 */ +195, 85,137,229, 87, 86,137,198, 83,137,211,131,236, 20,139,125, /* 0x 120 */ + 12,131, 58, 0, 15,132,185, 0, 0, 0,141, 85,228,185, 12, 0, /* 0x 130 */ + 0, 0,137,240,232,171,255,255,255,139, 69,228,139, 77,232,133, /* 0x 140 */ +192,117, 19,129,249, 85, 80, 88, 33,117, 15,131, 62, 0, 15,132, /* 0x 150 */ +143, 0, 0, 0,235, 4,133,201,117, 10,106,127, 91,106, 1, 88, /* 0x 160 */ +205,128,235,254, 57,193,119,242, 59, 3,119,238, 57,193,115, 86, /* 0x 170 */ + 15,182, 69,236, 80,255, 85, 8, 15,182, 85,236,137, 20, 36,141, /* 0x 180 */ + 85,224, 82,255,115, 4,255,117,232,255,118, 4,255, 16,131,196, /* 0x 190 */ + 20,133,192,117,197,139, 69,228, 57, 69,224,117,189,138, 69,237, /* 0x 1a0 */ +132,192,116, 24, 15,182,192, 80,255,215, 15,182, 85,238,137, 20, /* 0x 1b0 */ + 36,255,117,224,255,115, 4,255, 16,131,196, 12,139, 69,232, 1, /* 0x 1c0 */ + 70, 4, 41, 6,235, 10,139, 83, 4,137,240,232, 20,255,255,255, /* 0x 1d0 */ +139, 85,228,139, 3, 1, 83, 4, 41,208,133,192,137, 3,233, 65, /* 0x 1e0 */ +255,255,255,141,101,244, 91, 94, 95,201,195,133,210,137,209,116, /* 0x 1f0 */ + 6,198, 0, 0, 64,226,250,195,133,192, 83,137,211,116, 29,168, /* 0x 200 */ + 1,117, 25,139, 16, 57,218,116, 7, 74,117, 11,133,219,116, 7, /* 0x 210 */ +137, 24,137, 72, 4,235, 5,131,192, 8,235,231, 91,195, 85,137, /* 0x 220 */ +229, 87, 86, 83,131,236, 84,137, 69,228,139, 69, 8,137, 85,224, /* 0x 230 */ +139, 77, 16,137, 69,220, 3, 64, 28,139, 93,220,137, 77,212,139, /* 0x 240 */ + 85, 12,137, 69,208, 49,192,102,131,123, 16, 3,137, 85,216, 15, /* 0x 250 */ +183, 75, 44,139, 85,208, 15,149,192,131,206,255,193,224, 4,131, /* 0x 260 */ +192, 34, 49,219,137, 69,184,137,200, 49,255, 72,120, 31,131, 58, /* 0x 270 */ + 1,117, 21,139, 66, 8, 57,240,115, 5,137,198,139,122, 16, 3, /* 0x 280 */ + 66, 20, 57,195,115, 2,137,195,131,194, 32,226,225,137,240,129, /* 0x 290 */ +230, 0,240,255,255,106, 0, 41,243,106, 0, 37,255, 15, 0, 0, /* 0x 2a0 */ +137,117,188,141,179,255, 15, 0, 0,255,117,184,129,230, 0,240, /* 0x 2b0 */ +255,255,106, 7, 86,255,117,188,141,188, 7,255, 15, 0, 0,232, /* 0x 2c0 */ + 18,254,255,255,129,231, 0,240,255,255,137,194,137,195, 1,242, /* 0x 2d0 */ + 41,254,131,196, 24,137, 69,172,137, 85,240, 1,251,137,241,106, /* 0x 2e0 */ + 91, 88,205,128,139, 69,220,199, 69,196, 0, 0, 0, 0,139, 93, /* 0x 2f0 */ +172, 43, 93,188,102,131,120, 44, 0,137, 93,204, 15,132,180, 1, /* 0x 300 */ + 0, 0,139, 85,208,139, 2,131,248, 6,117, 24,139, 77,204, 3, /* 0x 310 */ + 74, 8,186, 3, 0, 0, 0,139, 69,212,232,217,254,255,255,233, /* 0x 320 */ +123, 1, 0, 0, 72, 15,133,116, 1, 0, 0,139, 93,208,199, 69, /* 0x 330 */ +192, 64, 98, 81,115,139, 75, 24,139, 67, 8,131,225, 7,139, 83, /* 0x 340 */ + 16,193,225, 2,137, 69,236,211,109,192,137,193, 3, 75, 20,137, /* 0x 350 */ +195,129,227,255, 15, 0, 0,137, 85,232,141, 60, 26,139, 85,204, /* 0x 360 */ + 41,216,131,101,192, 7, 1,209,141, 52, 16,137, 77,176,139, 77, /* 0x 370 */ +208,139, 65, 4, 41,216,131,125,216, 1, 80,255,117,228, 25,192, /* 0x 380 */ +131,224,224,131,192, 50,131,125,216, 0, 80,137,248,106, 3,116, /* 0x 390 */ + 3,141, 71, 3, 80, 86,232, 59,253,255,255,131,196, 24, 57,198, /* 0x 3a0 */ + 15,133,170, 0, 0, 0,131,125,216, 0,116, 19,255,117,224,255, /* 0x 3b0 */ +117,228,141, 85,232,139, 69,216,232, 84,253,255,255, 88, 90,137, /* 0x 3c0 */ +218,137,251,137,240,247,219,232, 31,254,255,255,129,227,255, 15, /* 0x 3d0 */ + 0, 0,141, 4, 62,137,218,137, 93,180,232, 12,254,255,255,131, /* 0x 3e0 */ +125,216, 0,116, 91,139, 69,208,131, 56, 1,117, 83,246, 64, 24, /* 0x 3f0 */ + 1,116, 77,139, 93,208,137,194,139, 64, 20, 59, 67, 16,139, 82, /* 0x 400 */ + 8,141, 12, 16,117, 14,137,200,247,216, 37,255, 15, 0, 0,131, /* 0x 410 */ +248, 3,119, 12,139, 69,208,141, 74, 12,131,120, 4, 0,117, 15, /* 0x 420 */ +139, 1, 61,205,128, 97,195,116, 6,199, 1,205,128, 97,195,133, /* 0x 430 */ +201,116, 13,139, 69,212, 49,210,131,224,254,232,184,253,255,255, /* 0x 440 */ +137,243,137,249,139, 85,192,106,125, 88,205,128,133,192,116, 10, /* 0x 450 */ +106,127, 91,106, 1, 88,205,128,235,254,139, 85,180,141, 4, 23, /* 0x 460 */ +141, 28, 6, 59, 93,176,115, 30,106, 0,106, 0,106, 50,255,117, /* 0x 470 */ +192, 41, 93,176,255,117,176, 83,232, 89,252,255,255,131,196, 24, /* 0x 480 */ + 57,195,116, 27,235,202,131,125,216, 0,116, 19,141, 79, 3,129, /* 0x 490 */ +225,255, 15, 0, 0,131,249, 3,119, 5,106, 91, 88,205,128,139, /* 0x 4a0 */ + 77,220,255, 69,196, 15,183, 65, 44,131, 69,208, 32, 57, 69,196, /* 0x 4b0 */ + 15,140, 76,254,255,255,131,125,216, 0,117, 14,139, 93,228,106, /* 0x 4c0 */ + 6, 88,205,128,133,192,116, 20,235,134,139, 69,220,102,131,120, /* 0x 4d0 */ + 16, 3,116, 8,139, 93,240,106, 45, 88,205,128,139, 85,220,139, /* 0x 4e0 */ + 82, 24, 1, 85,204,139, 69,204,141,101,244, 91, 94, 95,201,195, /* 0x 4f0 */ + 85,137,229, 87, 86, 83,131,236, 16,141, 85, 24,139,125, 20,255, /* 0x 500 */ +117, 40,141, 71, 52,139, 93, 8,255,117, 16,137, 69,240,139,117, /* 0x 510 */ + 32,141, 69, 32,232,248,251,255,255,139, 85,240,139, 69, 12,139, /* 0x 520 */ + 74, 8,186, 3, 0, 0, 0,137, 69, 32,137,216,131,193, 52, 41, /* 0x 530 */ +117, 36,232,193,252,255,255, 15,183, 79, 42,137,216,186, 4, 0, /* 0x 540 */ + 0, 0,232,177,252,255,255, 15,183, 79, 44,137,216,186, 5, 0, /* 0x 550 */ + 0, 0,232,161,252,255,255,139, 79, 24,137,216,186, 9, 0, 0, /* 0x 560 */ + 0,232,146,252,255,255,141, 69, 32, 83,139, 85, 40, 80,139, 69, /* 0x 570 */ + 16, 87,232,167,252,255,255,102,139, 79, 44,131,196, 20, 49,210, /* 0x 580 */ +102,133,201,137,195,116, 90,139, 69,240,131, 56, 3,117, 70, 49, /* 0x 590 */ +201,139, 88, 8,137,202,106, 5, 88,205,128,133,192,137,198,120, /* 0x 5a0 */ + 21,186, 0, 2, 0, 0,137,195,137,249,106, 3, 88,205,128, 61, /* 0x 5b0 */ + 0, 2, 0, 0,116, 10,106,127, 91,106, 1, 88,205,128,235,254, /* 0x 5c0 */ +106, 0, 49,210,106, 0,137,240, 87,232, 80,252,255,255,131,196, /* 0x 5d0 */ + 12,137,195,235, 12, 66, 15,183,193,131, 69,240, 32, 57,194,124, /* 0x 5e0 */ +166,141,101,244,137,216, 91, 94, 95,201,195 /* 0x 5f0 */ +}; diff --git a/src/stub/i386-linux.elf.shell-entry.h b/src/stub/i386-linux.elf.shell-entry.h new file mode 100644 index 00000000..db8af8f3 --- /dev/null +++ b/src/stub/i386-linux.elf.shell-entry.h @@ -0,0 +1,311 @@ +/* i386-linux.elf.shell-entry.h -- created from i386-linux.elf.shell-entry.bin, 4416 (0x1140) 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 + + */ + + +#define LINUX_I386SH_LOADER_SIZE 4416 +#define LINUX_I386SH_LOADER_ADLER32 0x7a82f154 +#define LINUX_I386SH_LOADER_CRC32 0x82883299 + +unsigned char linux_i386sh_loader[4416] = { +232, 0, 0, 0, 0, 96,139,116, 36, 36,139,124, 36, 44,131,205, /* 0x 0 */ +255,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7, /* 0x 10 */ +139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0, /* 0x 20 */ +184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 30 */ + 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1, /* 0x 40 */ +219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 49,201, /* 0x 50 */ +131,232, 3,114, 13,193,224, 8,138, 6, 70,131,240,255,116, 0, /* 0x 60 */ +137,197, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1, /* 0x 70 */ +219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, 0, 65, 1, /* 0x 80 */ +219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, 7, /* 0x 90 */ +139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, 9,139, /* 0x a0 */ + 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129,253, 0, /* 0x b0 */ +243,255,255,131,209, 1, 86,141, 52, 47,243,164, 94,233, 0, 0, /* 0x c0 */ + 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0,138, 2, 66, /* 0x d0 */ +136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, 4, /* 0x e0 */ +137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, 0, 0, /* 0x f0 */ + 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7, /* 0x 100 */ +139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0, /* 0x 110 */ +184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 120 */ + 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 1, /* 0x 130 */ +219,115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, 72, 1, /* 0x 140 */ +219,117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, 49,201, /* 0x 150 */ +131,232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, 0, /* 0x 160 */ +209,248,137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 170 */ +219, 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, /* 0x 180 */ +117, 0, 65, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, /* 0x 190 */ + 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, /* 0x 1a0 */ + 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, /* 0x 1b0 */ + 2,129,253, 0,251,255,255,131,209, 1, 86,141, 52, 47,243,164, /* 0x 1c0 */ + 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, /* 0x 1d0 */ + 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, /* 0x 1e0 */ + 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207, /* 0x 1f0 */ +233, 0, 0, 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, /* 0x 200 */ + 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64, /* 0x 210 */ +138, 7,114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131, /* 0x 220 */ +238,252, 17,219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 230 */ +219,114, 0, 1,219,115, 11,117, 0,139, 30,131,238,252, 17,219, /* 0x 240 */ +114, 0, 72, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192, /* 0x 250 */ +235, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,235, /* 0x 260 */ + 0, 49,201,131,232, 3,114, 17,193,224, 8,138, 6, 70,131,240, /* 0x 270 */ +255,116, 0,209,248,137,197,235, 11, 1,219,117, 7,139, 30,131, /* 0x 280 */ +238,252, 17,219,114,204, 65, 1,219,117, 7,139, 30,131,238,252, /* 0x 290 */ + 17,219,114,190, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 2a0 */ +201, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219, /* 0x 2b0 */ +115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131, /* 0x 2c0 */ +193, 2,129,253, 0,251,255,255,131,209, 2, 86,141, 52, 47,243, /* 0x 2d0 */ +164, 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15, /* 0x 2e0 */ +118, 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0, /* 0x 2f0 */ +139, 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1, /* 0x 300 */ +207,233, 0, 0, 0, 0,255,210, 1,219,117, 2,255,210,144,232, /* 0x 310 */ + 0, 0, 0, 0, 1,219,116, 0,195,139, 30,131,238,252, 17,219, /* 0x 320 */ +195, 41,201, 17,201,114, 0, 17,201,114, 0, 17,201, 17,192, 72, /* 0x 330 */ + 17,192,131,233, 1,115, 0,141, 72, 15, 61,240,255, 0, 0,114, /* 0x 340 */ + 0,141, 4, 14, 80,233, 0, 0, 0, 0, 17,201, 17,201,131,193, /* 0x 350 */ + 13,235, 0,133,201,116, 0, 65,131,193, 8,235, 0, 41,201, 90, /* 0x 360 */ + 41,219,141, 65, 1,115, 0,114, 0,114, 0,114, 0,131,193, 2, /* 0x 370 */ +114, 0, 65,114, 5,233, 0, 0, 0, 0, 17,201,209,233,115, 1, /* 0x 380 */ +164,209,233,115, 2,102,165,243,165,141, 65, 1,235, 3,164,164, /* 0x 390 */ +164, 17,192,115, 0,131,232, 3,114, 11,193,224, 8,172,131,240, /* 0x 3a0 */ +255,116, 0,137,197, 17,201, 17,201,117, 0, 65, 17,201,115, 0, /* 0x 3b0 */ +131,193, 2,129,253, 0,243,255,255,131,209, 1, 86,141, 52, 47, /* 0x 3c0 */ +131,253,252,119, 19,209,233,115, 1,164,209,233,115, 2,102,165, /* 0x 3d0 */ +243,165, 94,233, 0, 0, 0, 0,131,253,255,117, 5,172,243,170, /* 0x 3e0 */ +235,240,243,164,235,236,185, 84, 69, 88, 76,138, 7, 71, 44,232, /* 0x 3f0 */ + 60, 1,119,247,128, 63, 63,117, 0,139, 7,138, 95, 4,102,193, /* 0x 400 */ +232, 8,134,196,193,192, 16,134,196, 41,248,128,235,232,137, 7, /* 0x 410 */ +131,199, 5,136,216,226, 0,185, 84, 69, 88, 76,176,232,176,233, /* 0x 420 */ +242,174,117, 0,128, 63, 63,117, 0,139, 7,102,193,232, 8,134, /* 0x 430 */ +196,193,192, 16,134,196, 41,248,171,235, 0,139, 84, 36, 36, 3, /* 0x 440 */ + 84, 36, 40, 57,214,116, 1, 72, 43,124, 36, 44,139, 84, 36, 48, /* 0x 450 */ +137, 58,137, 68, 36, 28, 97,195, 94,252,173, 80, 84,186, 0, 0, /* 0x 460 */ + 64, 1,139, 66, 72, 1,208,131,194,116, 80,139, 74, 16,129,193, /* 0x 470 */ + 6, 16, 0, 0, 80,106,255,106, 50,106, 7, 81, 80,137,227,106, /* 0x 480 */ + 90, 88,205,128,141,152, 3, 16, 0, 0,131,196, 24,173, 80,173, /* 0x 490 */ + 86,255,213, 88, 88,195, 93,232,188,255,255,255, 76, 69, 88, 69, /* 0x 4a0 */ + 67, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, /* 0x 4b0 */ + 0, 76, 69, 88, 69, 67, 48, 50, 48, 0, 62, 0, 0, 0, 76, 69, /* 0x 4c0 */ + 88, 69, 67, 48, 49, 48, 0, 5, 0, 0, 0, 78, 50, 66, 83, 77, /* 0x 4d0 */ + 65, 49, 48, 0, 17, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, /* 0x 4e0 */ + 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, /* 0x 4f0 */ + 70, 65, 83, 49, 48, 0, 20, 0, 0, 0, 0, 0, 0, 0, 22, 0, /* 0x 500 */ + 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, /* 0x 510 */ + 50, 66, 70, 65, 83, 49, 49, 0, 22, 0, 0, 0, 78, 50, 66, 68, /* 0x 520 */ + 69, 67, 49, 48, 0, 28, 0, 0, 0, 78, 50, 66, 83, 77, 65, 50, /* 0x 530 */ + 48, 0, 39, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 78, 50, /* 0x 540 */ + 66, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 66, 70, 65, /* 0x 550 */ + 83, 50, 48, 0, 44, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, /* 0x 560 */ + 78, 50, 66, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 66, /* 0x 570 */ + 68, 69, 67, 50, 48, 0, 53, 0, 0, 0, 78, 50, 66, 83, 77, 65, /* 0x 580 */ + 51, 48, 0, 66, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 78, /* 0x 590 */ + 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, /* 0x 5a0 */ + 65, 83, 51, 48, 0, 79, 0, 0, 0, 0, 0, 0, 0, 83, 0, 0, /* 0x 5b0 */ + 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, /* 0x 5c0 */ + 0, 0, 94, 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, /* 0x 5d0 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 94, 0, 0, 0, /* 0x 5e0 */ + 0, 0, 0, 0,112, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, /* 0x 5f0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0,142, 0, 0, 0, 78, 50, 66, /* 0x 600 */ + 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, 66, 83, 77, 65, /* 0x 610 */ + 52, 48, 0,156, 0, 0, 0, 0, 0, 0, 0,169, 0, 0, 0, 78, /* 0x 620 */ + 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 78, 50, 66, 70, /* 0x 630 */ + 65, 83, 52, 48, 0,169, 0, 0, 0, 0, 0, 0, 0,173, 0, 0, /* 0x 640 */ + 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 0, 0, /* 0x 650 */ + 0, 0,184, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, /* 0x 660 */ + 0, 0, 0, 78, 50, 66, 68, 85, 77, 77, 49, 0,184, 0, 0, 0, /* 0x 670 */ + 78, 50, 66, 83, 77, 65, 53, 48, 0,184, 0, 0, 0, 78, 50, 66, /* 0x 680 */ + 70, 65, 83, 53, 48, 0,186, 0, 0, 0, 78, 50, 66, 68, 69, 67, /* 0x 690 */ + 53, 48, 0,189, 0, 0, 0, 78, 50, 66, 83, 77, 65, 54, 48, 0, /* 0x 6a0 */ +198, 0, 0, 0, 0, 0, 0, 0,210, 0, 0, 0, 78, 50, 66, 68, /* 0x 6b0 */ + 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 54, /* 0x 6c0 */ + 48, 0,210, 0, 0, 0, 0, 0, 0, 0,221, 0, 0, 0, 78, 50, /* 0x 6d0 */ + 66, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0,235, /* 0x 6e0 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, /* 0x 6f0 */ + 78, 50, 66, 70, 65, 83, 54, 49, 0,235, 0, 0, 0, 0, 0, 0, /* 0x 700 */ + 0, 1, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, /* 0x 710 */ + 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 1, 1, 0, 0, 78, /* 0x 720 */ + 82, 86, 50, 66, 69, 78, 68, 0, 1, 1, 0, 0, 78, 50, 68, 83, /* 0x 730 */ + 77, 65, 49, 48, 0, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, /* 0x 740 */ + 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, /* 0x 750 */ + 68, 70, 65, 83, 49, 48, 0, 4, 1, 0, 0, 0, 0, 0, 0, 6, /* 0x 760 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, /* 0x 770 */ + 78, 50, 68, 70, 65, 83, 49, 49, 0, 6, 1, 0, 0, 78, 50, 68, /* 0x 780 */ + 68, 69, 67, 49, 48, 0, 12, 1, 0, 0, 78, 50, 68, 83, 77, 65, /* 0x 790 */ + 50, 48, 0, 23, 1, 0, 0, 0, 0, 0, 0, 25, 1, 0, 0, 78, /* 0x 7a0 */ + 50, 68, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 68, 70, /* 0x 7b0 */ + 65, 83, 50, 48, 0, 28, 1, 0, 0, 0, 0, 0, 0, 32, 1, 0, /* 0x 7c0 */ + 0, 78, 50, 68, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, /* 0x 7d0 */ + 68, 68, 69, 67, 50, 48, 0, 37, 1, 0, 0, 78, 50, 68, 83, 77, /* 0x 7e0 */ + 65, 51, 48, 0, 50, 1, 0, 0, 0, 0, 0, 0, 63, 1, 0, 0, /* 0x 7f0 */ + 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 78, 50, 68, /* 0x 800 */ + 70, 65, 83, 51, 48, 0, 63, 1, 0, 0, 0, 0, 0, 0, 69, 1, /* 0x 810 */ + 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 0, /* 0x 820 */ + 0, 0, 0, 78, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, /* 0x 830 */ + 16, 0, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 78, 1, 0, /* 0x 840 */ + 0, 0, 0, 0, 0, 94, 1, 0, 0, 78, 50, 68, 68, 69, 67, 50, /* 0x 850 */ + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,112, 1, 0, 0, 78, 50, /* 0x 860 */ + 68, 68, 69, 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,146, /* 0x 870 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, /* 0x 880 */ + 78, 50, 68, 83, 77, 65, 52, 48, 0,160, 1, 0, 0, 0, 0, 0, /* 0x 890 */ + 0,173, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, /* 0x 8a0 */ + 0, 0, 78, 50, 68, 70, 65, 83, 52, 48, 0,173, 1, 0, 0, 0, /* 0x 8b0 */ + 0, 0, 0,177, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, /* 0x 8c0 */ + 69, 0, 0, 0, 0, 0, 0, 0,188, 1, 0, 0, 78, 50, 68, 68, /* 0x 8d0 */ + 69, 67, 51, 48, 0, 69, 0, 0, 0, 78, 50, 68, 68, 85, 77, 77, /* 0x 8e0 */ + 49, 0,188, 1, 0, 0, 78, 50, 68, 83, 77, 65, 53, 48, 0,188, /* 0x 8f0 */ + 1, 0, 0, 78, 50, 68, 70, 65, 83, 53, 48, 0,190, 1, 0, 0, /* 0x 900 */ + 78, 50, 68, 68, 69, 67, 53, 48, 0,193, 1, 0, 0, 78, 50, 68, /* 0x 910 */ + 83, 77, 65, 54, 48, 0,202, 1, 0, 0, 0, 0, 0, 0,214, 1, /* 0x 920 */ + 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, /* 0x 930 */ + 50, 68, 70, 65, 83, 54, 48, 0,214, 1, 0, 0, 0, 0, 0, 0, /* 0x 940 */ +225, 1, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 0, 0, 0, /* 0x 950 */ + 0, 0, 0, 0, 0,239, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, /* 0x 960 */ + 48, 0, 0, 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0,239, /* 0x 970 */ + 1, 0, 0, 0, 0, 0, 0, 5, 2, 0, 0, 78, 50, 68, 68, 69, /* 0x 980 */ + 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 54, 48, /* 0x 990 */ + 0, 5, 2, 0, 0, 78, 82, 86, 50, 68, 69, 78, 68, 0, 5, 2, /* 0x 9a0 */ + 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 5, 2, 0, 0, 0, /* 0x 9b0 */ + 0, 0, 0, 7, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, /* 0x 9c0 */ + 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 48, 0, 8, 2, 0, /* 0x 9d0 */ + 0, 0, 0, 0, 0, 10, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, /* 0x 9e0 */ + 48, 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 10, /* 0x 9f0 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 16, 2, 0, 0, /* 0x a00 */ + 78, 50, 69, 83, 77, 65, 50, 48, 0, 27, 2, 0, 0, 0, 0, 0, /* 0x a10 */ + 0, 29, 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 2, 0, /* 0x a20 */ + 0, 0, 78, 50, 69, 70, 65, 83, 50, 48, 0, 32, 2, 0, 0, 0, /* 0x a30 */ + 0, 0, 0, 36, 2, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, /* 0x a40 */ + 0, 0, 0, 0, 78, 50, 69, 68, 69, 67, 50, 48, 0, 41, 2, 0, /* 0x a50 */ + 0, 78, 50, 69, 83, 77, 65, 51, 48, 0, 54, 2, 0, 0, 0, 0, /* 0x a60 */ + 0, 0, 67, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, /* 0x a70 */ + 0, 0, 0, 78, 50, 69, 70, 65, 83, 51, 48, 0, 67, 2, 0, 0, /* 0x a80 */ + 0, 0, 0, 0, 73, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, /* 0x a90 */ + 0, 31, 0, 0, 0, 0, 0, 0, 0, 82, 2, 0, 0, 78, 50, 69, /* 0x aa0 */ + 68, 69, 67, 51, 48, 0, 31, 0, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x ab0 */ + 51, 48, 0, 82, 2, 0, 0, 0, 0, 0, 0, 98, 2, 0, 0, 78, /* 0x ac0 */ + 50, 69, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x ad0 */ +113, 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, 0, 0, /* 0x ae0 */ + 0, 0, 0, 0, 0,131, 2, 0, 0, 78, 50, 69, 68, 69, 67, 54, /* 0x af0 */ + 48, 0, 0, 0, 0, 0, 78, 50, 69, 83, 77, 65, 52, 48, 0,177, /* 0x b00 */ + 2, 0, 0, 0, 0, 0, 0,190, 2, 0, 0, 78, 50, 69, 68, 69, /* 0x b10 */ + 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 70, 65, 83, 52, 48, /* 0x b20 */ + 0,190, 2, 0, 0, 0, 0, 0, 0,194, 2, 0, 0, 78, 50, 69, /* 0x b30 */ + 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 0, 0, 0, 0,205, 2, /* 0x b40 */ + 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, /* 0x b50 */ + 50, 69, 68, 85, 77, 77, 49, 0,205, 2, 0, 0, 78, 50, 69, 83, /* 0x b60 */ + 77, 65, 53, 48, 0,205, 2, 0, 0, 78, 50, 69, 70, 65, 83, 53, /* 0x b70 */ + 48, 0,207, 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0,210, /* 0x b80 */ + 2, 0, 0, 78, 50, 69, 83, 77, 65, 54, 48, 0,219, 2, 0, 0, /* 0x b90 */ + 0, 0, 0, 0,231, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, /* 0x ba0 */ + 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, 48, 0,231, 2, /* 0x bb0 */ + 0, 0, 0, 0, 0, 0,242, 2, 0, 0, 78, 50, 69, 70, 65, 83, /* 0x bc0 */ + 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 78, /* 0x bd0 */ + 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, /* 0x be0 */ + 65, 83, 54, 49, 0, 0, 3, 0, 0, 0, 0, 0, 0, 22, 3, 0, /* 0x bf0 */ + 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, /* 0x c00 */ + 69, 68, 69, 67, 54, 48, 0, 22, 3, 0, 0, 78, 82, 86, 50, 69, /* 0x c10 */ + 69, 78, 68, 0, 22, 3, 0, 0, 67, 76, 49, 83, 77, 65, 49, 66, /* 0x c20 */ + 0, 22, 3, 0, 0, 67, 76, 49, 70, 65, 83, 49, 66, 0, 24, 3, /* 0x c30 */ + 0, 0, 67, 76, 49, 71, 69, 84, 49, 66, 0, 30, 3, 0, 0, 67, /* 0x c40 */ + 76, 49, 69, 78, 84, 69, 82, 0, 30, 3, 0, 0, 0, 0, 0, 0, /* 0x c50 */ + 36, 3, 0, 0, 67, 76, 49, 83, 84, 65, 82, 84, 0, 0, 0, 0, /* 0x c60 */ + 0, 67, 76, 49, 83, 77, 65, 49, 48, 0, 36, 3, 0, 0, 0, 0, /* 0x c70 */ + 0, 0, 40, 3, 0, 0, 67, 76, 49, 82, 76, 79, 65, 68, 0, 0, /* 0x c80 */ + 0, 0, 0, 67, 76, 49, 82, 76, 79, 65, 68, 0, 41, 3, 0, 0, /* 0x c90 */ + 67, 76, 49, 87, 73, 68, 48, 49, 0, 49, 3, 0, 0, 67, 76, 49, /* 0x ca0 */ + 87, 73, 68, 48, 50, 0, 51, 3, 0, 0, 67, 76, 49, 87, 73, 68, /* 0x cb0 */ + 48, 51, 0, 53, 3, 0, 0, 0, 0, 0, 0, 55, 3, 0, 0, 67, /* 0x cc0 */ + 76, 49, 87, 73, 68, 49, 48, 0, 12, 0, 0, 0, 67, 76, 49, 87, /* 0x cd0 */ + 73, 68, 48, 52, 0, 55, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, /* 0x ce0 */ + 53, 0, 57, 3, 0, 0, 0, 0, 0, 0, 59, 3, 0, 0, 67, 76, /* 0x cf0 */ + 49, 87, 73, 68, 49, 48, 0, 7, 0, 0, 0, 67, 76, 49, 87, 73, /* 0x d00 */ + 68, 48, 54, 0, 59, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 55, /* 0x d10 */ + 0, 61, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 56, 0, 64, 3, /* 0x d20 */ + 0, 0, 0, 0, 0, 0, 71, 3, 0, 0, 67, 76, 49, 87, 73, 68, /* 0x d30 */ + 48, 54, 0, 2, 0, 0, 0, 0, 0, 0, 0, 81, 3, 0, 0, 67, /* 0x d40 */ + 76, 49, 87, 73, 68, 49, 48, 0, 15, 0, 0, 0, 0, 0, 0, 0, /* 0x d50 */ + 90, 3, 0, 0, 67, 76, 49, 67, 79, 80, 89, 48, 0, 18, 0, 0, /* 0x d60 */ + 0, 67, 76, 49, 87, 73, 68, 48, 57, 0, 90, 3, 0, 0, 67, 76, /* 0x d70 */ + 49, 87, 73, 68, 49, 48, 0, 92, 3, 0, 0, 0, 0, 0, 0, 99, /* 0x d80 */ + 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 55, 0, 2, 0, 0, 0, /* 0x d90 */ + 0, 0, 0, 0,103, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 56, /* 0x da0 */ + 0, 26, 0, 0, 0, 0, 0, 0, 0,109, 3, 0, 0, 67, 76, 49, /* 0x db0 */ + 84, 79, 80, 48, 55, 0, 2, 0, 0, 0, 67, 76, 49, 83, 84, 65, /* 0x dc0 */ + 82, 84, 0,109, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 48, 0, /* 0x dd0 */ +114, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 49, 0,117, 3, 0, /* 0x de0 */ + 0, 0, 0, 0, 0,119, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, /* 0x df0 */ + 55, 0, 23, 0, 0, 0, 67, 76, 49, 84, 79, 80, 48, 50, 0,119, /* 0x e00 */ + 3, 0, 0, 0, 0, 0, 0,121, 3, 0, 0, 67, 76, 49, 84, 79, /* 0x e10 */ + 80, 48, 55, 0, 22, 0, 0, 0, 67, 76, 49, 84, 79, 80, 48, 51, /* 0x e20 */ + 0,121, 3, 0, 0, 0, 0, 0, 0,123, 3, 0, 0, 67, 76, 49, /* 0x e30 */ + 84, 79, 80, 48, 55, 0, 21, 0, 0, 0, 67, 76, 49, 84, 79, 80, /* 0x e40 */ + 48, 52, 0,123, 3, 0, 0, 0, 0, 0, 0,125, 3, 0, 0, 67, /* 0x e50 */ + 76, 49, 84, 79, 80, 48, 55, 0, 20, 0, 0, 0, 67, 76, 49, 84, /* 0x e60 */ + 79, 80, 48, 53, 0,128, 3, 0, 0, 0, 0, 0, 0,130, 3, 0, /* 0x e70 */ + 0, 67, 76, 49, 84, 79, 80, 48, 54, 0, 7, 0, 0, 0, 67, 76, /* 0x e80 */ + 49, 84, 79, 80, 48, 54, 0,131, 3, 0, 0, 0, 0, 0, 0,138, /* 0x e90 */ + 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 49, 0, 0, 0, 0, 0, /* 0x ea0 */ + 67, 76, 49, 84, 79, 80, 48, 55, 0,138, 3, 0, 0, 67, 76, 49, /* 0x eb0 */ + 79, 70, 70, 48, 49, 0,161, 3, 0, 0, 67, 76, 49, 79, 70, 70, /* 0x ec0 */ + 48, 50, 0,163, 3, 0, 0, 0, 0, 0, 0,165, 3, 0, 0, 67, /* 0x ed0 */ + 76, 49, 84, 79, 80, 48, 55, 0, 23, 0, 0, 0, 0, 0, 0, 0, /* 0x ee0 */ +179, 3, 0, 0, 67, 76, 49, 67, 79, 80, 89, 48, 0, 51, 0, 0, /* 0x ef0 */ + 0, 67, 76, 49, 79, 70, 70, 48, 51, 0,181, 3, 0, 0, 67, 76, /* 0x f00 */ + 49, 79, 70, 70, 48, 52, 0,183, 3, 0, 0, 0, 0, 0, 0,187, /* 0x f10 */ + 3, 0, 0, 67, 76, 49, 67, 79, 80, 89, 48, 0, 0, 0, 0, 0, /* 0x f20 */ + 67, 76, 49, 76, 69, 78, 48, 48, 0,187, 3, 0, 0, 67, 76, 49, /* 0x f30 */ + 76, 69, 78, 48, 49, 0,188, 3, 0, 0, 67, 76, 49, 76, 69, 78, /* 0x f40 */ + 48, 50, 0,190, 3, 0, 0, 0, 0, 0, 0,192, 3, 0, 0, 67, /* 0x f50 */ + 76, 49, 76, 69, 78, 48, 48, 0, 1, 0, 0, 0, 67, 76, 49, 67, /* 0x f60 */ + 79, 80, 89, 48, 0,195, 3, 0, 0, 0, 0, 0, 0,232, 3, 0, /* 0x f70 */ + 0, 67, 76, 49, 84, 79, 80, 48, 48, 0, 0, 0, 0, 0, 67, 76, /* 0x f80 */ + 49, 69, 78, 68, 0,246, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, /* 0x f90 */ + 48, 0,246, 3, 0, 0, 67, 84, 67, 76, 69, 86, 69, 49, 0, 4, /* 0x fa0 */ + 4, 0, 0, 0, 0, 0, 0, 9, 4, 0, 0, 67, 65, 76, 76, 84, /* 0x fb0 */ + 82, 48, 48, 0, 5, 0, 0, 0, 67, 65, 76, 76, 84, 82, 48, 49, /* 0x fc0 */ + 0, 9, 4, 0, 0, 67, 84, 68, 85, 77, 77, 89, 49, 0, 14, 4, /* 0x fd0 */ + 0, 0, 67, 84, 66, 83, 72, 82, 48, 49, 0, 14, 4, 0, 0, 67, /* 0x fe0 */ + 84, 66, 82, 79, 82, 48, 49, 0, 18, 4, 0, 0, 67, 84, 66, 83, /* 0x ff0 */ + 87, 65, 48, 49, 0, 20, 4, 0, 0, 67, 65, 76, 76, 84, 82, 48, /* 0x1000 */ + 50, 0, 25, 4, 0, 0, 0, 0, 0, 0, 39, 4, 0, 0, 67, 65, /* 0x1010 */ + 76, 76, 84, 82, 48, 48, 0, 10, 0, 0, 0, 67, 65, 76, 76, 84, /* 0x1020 */ + 82, 49, 48, 0, 39, 4, 0, 0, 67, 65, 76, 76, 84, 82, 69, 56, /* 0x1030 */ + 0, 44, 4, 0, 0, 67, 65, 76, 76, 84, 82, 69, 57, 0, 46, 4, /* 0x1040 */ + 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, 0, 48, 4, 0, 0, 0, /* 0x1050 */ + 0, 0, 0, 52, 4, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, /* 0x1060 */ + 5, 0, 0, 0, 67, 84, 67, 76, 69, 86, 69, 50, 0, 52, 4, 0, /* 0x1070 */ + 0, 0, 0, 0, 0, 57, 4, 0, 0, 67, 65, 76, 76, 84, 82, 49, /* 0x1080 */ + 49, 0, 0, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 50, 0, 57, /* 0x1090 */ + 4, 0, 0, 67, 84, 68, 85, 77, 77, 89, 50, 0, 59, 4, 0, 0, /* 0x10a0 */ + 67, 84, 66, 83, 72, 82, 49, 49, 0, 59, 4, 0, 0, 67, 84, 66, /* 0x10b0 */ + 82, 79, 82, 49, 49, 0, 63, 4, 0, 0, 67, 84, 66, 83, 87, 65, /* 0x10c0 */ + 49, 49, 0, 65, 4, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, /* 0x10d0 */ + 70, 4, 0, 0, 0, 0, 0, 0, 75, 4, 0, 0, 67, 65, 76, 76, /* 0x10e0 */ + 84, 82, 49, 48, 0, 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, /* 0x10f0 */ + 68, 0, 75, 4, 0, 0, 76, 69, 88, 69, 67, 48, 49, 53, 0, 75, /* 0x1100 */ + 4, 0, 0, 76, 69, 88, 69, 67, 48, 49, 55, 0,102, 4, 0, 0, /* 0x1110 */ + 76, 69, 88, 69, 67, 48, 50, 48, 0,104, 4, 0, 0, 88, 84, 72, /* 0x1120 */ + 69, 69, 78, 68, 88, 0,172, 4, 0, 0,255,255,255,255,172, 4 /* 0x1130 */ +}; diff --git a/src/stub/i386-linux.elf.shell-fold.h b/src/stub/i386-linux.elf.shell-fold.h new file mode 100644 index 00000000..98c8a7f7 --- /dev/null +++ b/src/stub/i386-linux.elf.shell-fold.h @@ -0,0 +1,111 @@ +/* i386-linux.elf.shell-fold.h -- created from i386-linux.elf.shell-fold.bin, 1201 (0x4b1) 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 + + */ + + +#define LINUX_I386SH_FOLD_SIZE 1201 +#define LINUX_I386SH_FOLD_ADLER32 0x5788f83f +#define LINUX_I386SH_FOLD_CRC32 0xf1ddde7a + +unsigned char linux_i386sh_fold[1201] = { +127, 69, 76, 70, 1, 1, 1, 0, 76,105,110,117,120, 0, 0, 0, /* 0x 0 */ + 2, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, /* 0x 10 */ + 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 1, 0, 0, 0, /* 0x 20 */ + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 1, /* 0x 30 */ + 0, 0, 64, 1,177, 4, 0, 0,180, 4, 0, 0, 7, 0, 0, 0, /* 0x 40 */ + 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 50 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 60 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */ + 88, 88,137,230,129,236, 80, 1, 0, 0,137,231,173,171,133,192, /* 0x 80 */ +117,250,173,171,133,192,117,250, 87, 64,106, 82, 89,243,171, 72, /* 0x 90 */ +171,171, 95,173,133,192,145,173,116, 15,131,249, 42,115,244,137, /* 0x a0 */ + 76,207,248,137, 68,207,252,235,234,129,236, 0, 10, 0, 0,147, /* 0x b0 */ +141, 82, 24,139, 10,139, 90, 4,137,198, 96,232,126, 2, 0, 0, /* 0x c0 */ + 89, 80, 97,129,196, 0, 10, 0, 0, 89, 90, 82, 65, 86,131,238, /* 0x d0 */ + 3,102,199, 6, 45, 99, 65, 86, 65, 82, 81, 87,141,188, 36, 0, /* 0x e0 */ +245,255,255, 96,137,227,137,252,185,192, 2, 0, 0, 49,192,243, /* 0x f0 */ +171,137,220, 97,195, 83,141, 92, 36, 8,106, 90, 88,205,128, 91, /* 0x 100 */ +195, 0, 0, 0, 87, 86, 83,137,195,139,124, 36, 16, 57, 56,139, /* 0x 110 */ +112, 4,115, 10,106,127, 91,106, 1, 88,205,128,235,254,133,255, /* 0x 120 */ +116, 10,137,249,138, 6, 70,136, 2, 66,226,248, 1,123, 4, 41, /* 0x 130 */ + 59, 91, 94, 95,195,133,210,137,209,116, 6,198, 0, 0, 64,226, /* 0x 140 */ +250,195, 85, 49,201,137,229, 87, 86, 83,137,195,131,236, 52,137, /* 0x 150 */ + 85,240,139, 69, 8,137,202,137, 69,236,106, 5, 88,205,128,133, /* 0x 160 */ +192,137, 69,232,121, 10,106,127, 91,106, 1, 88,205,128,235,254, /* 0x 170 */ +186, 0, 2, 0, 0,139, 93,232,139, 77,240,106, 3, 88,205,128, /* 0x 180 */ + 61, 0, 2, 0, 0,117,223,139, 69,240,139, 85,240, 3, 64, 28, /* 0x 190 */ + 15,183, 90, 44,137, 69,228, 49,192,102,131,122, 16, 3,139, 77, /* 0x 1a0 */ +228, 15,149,192,131,207,255,193,224, 4,131,192, 34, 49,210,137, /* 0x 1b0 */ + 69,212,137,216, 72,120, 33,137,222,131, 57, 1,117, 20,139, 65, /* 0x 1c0 */ + 8, 57,248,115, 2,137,199,139, 89, 20, 1,195, 57,218,115, 2, /* 0x 1d0 */ +137,218,131,193, 32, 78,117,225,246, 69,212, 16,116, 7,137,211, /* 0x 1e0 */ +106, 45, 88,205,128,137,251,106, 0,129,227, 0,240,255,255,106, /* 0x 1f0 */ +255, 41,218,255,117,212,141,130,255, 15, 0, 0,106, 7, 37, 0, /* 0x 200 */ +240,255,255, 80, 83,232,235,254,255,255,131,196, 24, 41,216,199, /* 0x 210 */ + 69,220, 0, 0, 0, 0,137, 69,224,139, 69,240,102,131,120, 44, /* 0x 220 */ + 0, 15,132,247, 0, 0, 0,139, 85,228,139, 2,131,248, 6,117, /* 0x 230 */ + 14,139, 66, 8,139, 77,236,137, 65, 20,233,200, 0, 0, 0, 72, /* 0x 240 */ + 15,133,193, 0, 0, 0,139, 93,228,199, 69,216, 64, 98, 81,115, /* 0x 250 */ +139, 75, 24,139, 67, 8,131,225, 7,193,225, 2,137,194,211,109, /* 0x 260 */ +216,139, 77,228, 3, 83, 20,137,195,139,121, 16,129,227,255, 15, /* 0x 270 */ + 0, 0,139, 77,224, 41,216, 1,223,131,101,216, 7, 1,202,141, /* 0x 280 */ + 52, 8,137, 85,204,139, 85,228,139, 66, 4, 41,216, 80,255,117, /* 0x 290 */ +232,106, 18,106, 3, 87, 86,232, 89,254,255,255,131,196, 24, 57, /* 0x 2a0 */ +198,117, 48,137,218,137,240,232,137,254,255,255,137,249,247,217, /* 0x 2b0 */ +141, 4, 62,129,225,255, 15, 0, 0,137,243,137,202,137, 77,208, /* 0x 2c0 */ +232,112,254,255,255,137,249,139, 85,216,106,125, 88,205,128,133, /* 0x 2d0 */ +192,116, 10,106,127, 91,106, 1, 88,205,128,235,254,139, 85,208, /* 0x 2e0 */ +141, 4, 23,141, 28, 6, 59, 93,204,115, 28,106, 0,106,255,106, /* 0x 2f0 */ + 50,255,117,216, 41, 93,204,255,117,204, 83,232,245,253,255,255, /* 0x 300 */ +131,196, 24, 57,195,117,204,139, 77,240,255, 69,220, 15,183, 65, /* 0x 310 */ + 44,131, 69,228, 32, 57, 69,220, 15,140, 9,255,255,255,139, 93, /* 0x 320 */ +232,106, 6, 88,205,128,133,192,117,169,139, 69,240,139, 64, 24, /* 0x 330 */ + 1, 69,224,139, 69,224,141,101,244, 91, 94, 95,201,195, 85,137, /* 0x 340 */ +229, 87, 86, 83,131,236, 36,141,117, 32,139, 69, 16,141, 93, 24, /* 0x 350 */ +139, 85, 20,137, 69,212,139, 69, 36,139,125, 8,137, 85,208, 5, /* 0x 360 */ + 85, 80, 88, 50,137, 69,240,139, 69,240, 5, 85, 80, 88, 51,131, /* 0x 370 */ +125, 32, 0,137, 69,236, 15,132,139, 0, 0, 0,141, 85,220,137, /* 0x 380 */ +216,106, 12,232,124,253,255,255, 88,139, 69,220,139, 77,224,133, /* 0x 390 */ +192,117, 15,129,249, 85, 80, 88, 33,117, 11,131, 59, 0,116,103, /* 0x 3a0 */ +235, 4,133,201,117, 10,106,127, 91,106, 1, 88,205,128,235,254, /* 0x 3b0 */ + 57,193,119,242, 59, 6,119,238, 57,193,115, 44, 15,182, 69,228, /* 0x 3c0 */ + 80,141, 69,216, 80,255,118, 4, 81,255,115, 4,255, 85,212,131, /* 0x 3d0 */ +196, 20,133,192,117,208,139, 69,220, 57, 69,216,117,200,139, 69, /* 0x 3e0 */ +224, 1, 67, 4, 41, 3,235, 12,139, 86, 4,137,216, 81,232, 17, /* 0x 3f0 */ +253,255,255, 88,139, 85,220,139, 6, 1, 86, 4, 41,208,133,192, /* 0x 400 */ +137, 6,233,111,255,255,255,139, 69,236,139, 85,208,138, 24,139, /* 0x 410 */ + 69,236,198, 0, 0,139, 69,240, 87,232, 36,253,255,255,139, 85, /* 0x 420 */ +208,137,198,139, 69,236,136, 24, 15,183, 66, 42,199, 71, 16, 3, /* 0x 430 */ + 0, 0, 0,199, 71, 24, 4, 0, 0, 0,199, 71, 32, 5, 0, 0, /* 0x 440 */ + 0,137, 71, 28, 15,183, 66, 44,199, 71, 44, 0, 16, 0, 0,137, /* 0x 450 */ +119, 68,131,194, 52,199, 71, 40, 6, 0, 0, 0,137, 71, 36,139, /* 0x 460 */ + 69,208,199, 71, 64, 9, 0, 0, 0,102,139, 88, 44, 89, 49,201, /* 0x 470 */ +102,133,219,116, 34,131, 58, 3,117, 18,139, 66, 8,106, 0,139, /* 0x 480 */ + 85,208,232,187,252,255,255,137,198, 88,235, 11, 65, 15,183,195, /* 0x 490 */ +131,194, 32, 57,193,124,222,141,101,244,137,240, 91, 94, 95,201, /* 0x 4a0 */ +195 /* 0x 4b0 */ +}; diff --git a/src/stub/i386-linux.kernel.vmlinux.h b/src/stub/i386-linux.kernel.vmlinux.h new file mode 100644 index 00000000..c4049643 --- /dev/null +++ b/src/stub/i386-linux.kernel.vmlinux.h @@ -0,0 +1,263 @@ +/* i386-linux.kernel.vmlinux.h -- created from i386-linux.kernel.vmlinux.bin, 3639 (0xe37) 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 + + */ + + +#define NRV_LOADER_SIZE 3639 +#define NRV_LOADER_ADLER32 0xd1d15198 +#define NRV_LOADER_CRC32 0xc3063bf8 + +unsigned char nrv_loader[3639] = { + 90, 80, 87, 86, 80, 80,106, 63,104, 85, 76, 69, 78,232, 0, 0, /* 0x 0 */ + 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, /* 0x 10 */ + 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, /* 0x 20 */ + 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 30 */ +219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, /* 0x 40 */ + 1,219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 49, /* 0x 50 */ +201,131,232, 3,114, 13,193,224, 8,138, 6, 70,131,240,255,116, /* 0x 60 */ + 0,137,197, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, /* 0x 70 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, 0, 65, /* 0x 80 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, /* 0x 90 */ + 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, 9, /* 0x a0 */ +139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129,253, /* 0x b0 */ + 0,243,255,255,131,209, 1, 86,141, 52, 47,243,164, 94,233, 0, /* 0x c0 */ + 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0,138, 2, /* 0x d0 */ + 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, /* 0x e0 */ + 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, 0, /* 0x f0 */ + 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, /* 0x 100 */ + 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, /* 0x 110 */ + 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 120 */ +219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, /* 0x 130 */ + 1,219,115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, 72, /* 0x 140 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, 49, /* 0x 150 */ +201,131,232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, /* 0x 160 */ + 0,209,248,137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, /* 0x 170 */ + 17,219, 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 180 */ +201,117, 0, 65, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 190 */ +201, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219, /* 0x 1a0 */ +115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131, /* 0x 1b0 */ +193, 2,129,253, 0,251,255,255,131,209, 1, 86,141, 52, 47,243, /* 0x 1c0 */ +164, 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15, /* 0x 1d0 */ +118, 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0, /* 0x 1e0 */ +139, 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1, /* 0x 1f0 */ +207,233, 0, 0, 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, /* 0x 200 */ + 71, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, /* 0x 210 */ + 64,138, 7,114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30, /* 0x 220 */ +131,238,252, 17,219, 17,192, 1,219,117, 7,139, 30,131,238,252, /* 0x 230 */ + 17,219,114, 0, 1,219,115, 11,117, 0,139, 30,131,238,252, 17, /* 0x 240 */ +219,114, 0, 72, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 250 */ +192,235, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, /* 0x 260 */ +235, 0, 49,201,131,232, 3,114, 17,193,224, 8,138, 6, 70,131, /* 0x 270 */ +240,255,116, 0,209,248,137,197,235, 11, 1,219,117, 7,139, 30, /* 0x 280 */ +131,238,252, 17,219,114,204, 65, 1,219,117, 7,139, 30,131,238, /* 0x 290 */ +252, 17,219,114,190, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 2a0 */ + 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1, /* 0x 2b0 */ +219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65, /* 0x 2c0 */ +131,193, 2,129,253, 0,251,255,255,131,209, 2, 86,141, 52, 47, /* 0x 2d0 */ +243,164, 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, /* 0x 2e0 */ + 15,118, 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, /* 0x 2f0 */ + 0,139, 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, /* 0x 300 */ + 1,207,233, 0, 0, 0, 0, 89, 90, 95,137,254,235, 0,138, 7, /* 0x 310 */ +131,199, 1, 60,128,114, 10, 60,143,119, 6,128,127,254, 15,116, /* 0x 320 */ + 0, 44,232, 60, 1,119, 0, 56, 23,117, 0,139, 7,102,193,232, /* 0x 330 */ + 8,193,192, 16,134,196, 41,248, 1,240,137, 7,131,199, 4,131, /* 0x 340 */ +233, 4,138, 7,131,199, 1,226, 0,131,233, 1,127, 0, 89, 95, /* 0x 350 */ +185, 84, 69, 88, 76,138, 7, 71, 44,232, 60, 1,119,247,128, 63, /* 0x 360 */ + 63,117, 0,139, 7,138, 95, 4,102,193,232, 8,134,196,193,192, /* 0x 370 */ + 16,134,196, 41,248,128,235,232,137, 7,131,199, 5,136,216,226, /* 0x 380 */ + 0,185, 84, 69, 88, 76,176,232,176,233,242,174,117, 0,128, 63, /* 0x 390 */ + 63,117, 0,139, 7,102,193,232, 8,134,196,193,192, 16,134,196, /* 0x 3a0 */ + 41,248,171,235, 0, 94, 95, 49,219,203, 94,139, 78,252,137,197, /* 0x 3b0 */ + 3, 4, 36,131,192, 31,131,224,240,253,141,116, 49,255,141,124, /* 0x 3c0 */ + 1,255,243,164,139, 74,252,131,193, 3,193,233, 2,141,116,138, /* 0x 3d0 */ +252,141,120,252,243,165,252,141,119, 4,137,239,131,205,255,255, /* 0x 3e0 */ +224, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, 0, 0, 0, /* 0x 3f0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 400 */ + 45, 0, 0, 0, 76, 73, 78, 85, 88, 48, 48, 48, 0, 0, 0, 0, /* 0x 410 */ + 0, 76, 88, 67, 65, 76, 76, 84, 49, 0, 4, 0, 0, 0, 76, 88, /* 0x 420 */ + 68, 85, 77, 77, 89, 48, 0, 5, 0, 0, 0, 76, 88, 67, 75, 76, /* 0x 430 */ + 76, 84, 49, 0, 5, 0, 0, 0, 76, 88, 77, 79, 86, 69, 85, 80, /* 0x 440 */ + 0, 8, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 76, 73, 78, /* 0x 450 */ + 85, 88, 57, 57, 48, 0, 5, 0, 0, 0, 78, 50, 66, 83, 77, 65, /* 0x 460 */ + 49, 48, 0, 18, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 78, /* 0x 470 */ + 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, 70, /* 0x 480 */ + 65, 83, 49, 48, 0, 21, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, /* 0x 490 */ + 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, /* 0x 4a0 */ + 66, 70, 65, 83, 49, 49, 0, 23, 0, 0, 0, 78, 50, 66, 68, 69, /* 0x 4b0 */ + 67, 49, 48, 0, 29, 0, 0, 0, 78, 50, 66, 83, 77, 65, 50, 48, /* 0x 4c0 */ + 0, 40, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 78, 50, 66, /* 0x 4d0 */ + 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 66, 70, 65, 83, /* 0x 4e0 */ + 50, 48, 0, 45, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 78, /* 0x 4f0 */ + 50, 66, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 66, 68, /* 0x 500 */ + 69, 67, 50, 48, 0, 54, 0, 0, 0, 78, 50, 66, 83, 77, 65, 51, /* 0x 510 */ + 48, 0, 67, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 78, 50, /* 0x 520 */ + 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, /* 0x 530 */ + 83, 51, 48, 0, 80, 0, 0, 0, 0, 0, 0, 0, 84, 0, 0, 0, /* 0x 540 */ + 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 550 */ + 0, 95, 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, /* 0x 560 */ + 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 95, 0, 0, 0, 0, /* 0x 570 */ + 0, 0, 0,113, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, /* 0x 580 */ + 0, 0, 0, 0, 0, 0, 0, 0,143, 0, 0, 0, 78, 50, 66, 68, /* 0x 590 */ + 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, 66, 83, 77, 65, 52, /* 0x 5a0 */ + 48, 0,157, 0, 0, 0, 0, 0, 0, 0,170, 0, 0, 0, 78, 50, /* 0x 5b0 */ + 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 78, 50, 66, 70, 65, /* 0x 5c0 */ + 83, 52, 48, 0,170, 0, 0, 0, 0, 0, 0, 0,174, 0, 0, 0, /* 0x 5d0 */ + 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 0, 0, 0, /* 0x 5e0 */ + 0,185, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, /* 0x 5f0 */ + 0, 0, 78, 50, 66, 68, 85, 77, 77, 49, 0,185, 0, 0, 0, 78, /* 0x 600 */ + 50, 66, 83, 77, 65, 53, 48, 0,185, 0, 0, 0, 78, 50, 66, 70, /* 0x 610 */ + 65, 83, 53, 48, 0,187, 0, 0, 0, 78, 50, 66, 68, 69, 67, 53, /* 0x 620 */ + 48, 0,190, 0, 0, 0, 78, 50, 66, 83, 77, 65, 54, 48, 0,199, /* 0x 630 */ + 0, 0, 0, 0, 0, 0, 0,211, 0, 0, 0, 78, 50, 66, 68, 69, /* 0x 640 */ + 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 54, 48, /* 0x 650 */ + 0,211, 0, 0, 0, 0, 0, 0, 0,222, 0, 0, 0, 78, 50, 66, /* 0x 660 */ + 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0,236, 0, /* 0x 670 */ + 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, /* 0x 680 */ + 50, 66, 70, 65, 83, 54, 49, 0,236, 0, 0, 0, 0, 0, 0, 0, /* 0x 690 */ + 2, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, /* 0x 6a0 */ + 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 2, 1, 0, 0, 78, 82, /* 0x 6b0 */ + 86, 50, 66, 69, 78, 68, 0, 2, 1, 0, 0, 78, 50, 68, 83, 77, /* 0x 6c0 */ + 65, 49, 48, 0, 2, 1, 0, 0, 0, 0, 0, 0, 4, 1, 0, 0, /* 0x 6d0 */ + 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 68, /* 0x 6e0 */ + 70, 65, 83, 49, 48, 0, 5, 1, 0, 0, 0, 0, 0, 0, 7, 1, /* 0x 6f0 */ + 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, /* 0x 700 */ + 50, 68, 70, 65, 83, 49, 49, 0, 7, 1, 0, 0, 78, 50, 68, 68, /* 0x 710 */ + 69, 67, 49, 48, 0, 13, 1, 0, 0, 78, 50, 68, 83, 77, 65, 50, /* 0x 720 */ + 48, 0, 24, 1, 0, 0, 0, 0, 0, 0, 26, 1, 0, 0, 78, 50, /* 0x 730 */ + 68, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 68, 70, 65, /* 0x 740 */ + 83, 50, 48, 0, 29, 1, 0, 0, 0, 0, 0, 0, 33, 1, 0, 0, /* 0x 750 */ + 78, 50, 68, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 68, /* 0x 760 */ + 68, 69, 67, 50, 48, 0, 38, 1, 0, 0, 78, 50, 68, 83, 77, 65, /* 0x 770 */ + 51, 48, 0, 51, 1, 0, 0, 0, 0, 0, 0, 64, 1, 0, 0, 78, /* 0x 780 */ + 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 78, 50, 68, 70, /* 0x 790 */ + 65, 83, 51, 48, 0, 64, 1, 0, 0, 0, 0, 0, 0, 70, 1, 0, /* 0x 7a0 */ + 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 0, 0, /* 0x 7b0 */ + 0, 0, 79, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, /* 0x 7c0 */ + 0, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 79, 1, 0, 0, /* 0x 7d0 */ + 0, 0, 0, 0, 95, 1, 0, 0, 78, 50, 68, 68, 69, 67, 50, 48, /* 0x 7e0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0,113, 1, 0, 0, 78, 50, 68, /* 0x 7f0 */ + 68, 69, 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,147, 1, /* 0x 800 */ + 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, /* 0x 810 */ + 50, 68, 83, 77, 65, 52, 48, 0,161, 1, 0, 0, 0, 0, 0, 0, /* 0x 820 */ +174, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, /* 0x 830 */ + 0, 78, 50, 68, 70, 65, 83, 52, 48, 0,174, 1, 0, 0, 0, 0, /* 0x 840 */ + 0, 0,178, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, /* 0x 850 */ + 0, 0, 0, 0, 0, 0, 0,189, 1, 0, 0, 78, 50, 68, 68, 69, /* 0x 860 */ + 67, 51, 48, 0, 69, 0, 0, 0, 78, 50, 68, 68, 85, 77, 77, 49, /* 0x 870 */ + 0,189, 1, 0, 0, 78, 50, 68, 83, 77, 65, 53, 48, 0,189, 1, /* 0x 880 */ + 0, 0, 78, 50, 68, 70, 65, 83, 53, 48, 0,191, 1, 0, 0, 78, /* 0x 890 */ + 50, 68, 68, 69, 67, 53, 48, 0,194, 1, 0, 0, 78, 50, 68, 83, /* 0x 8a0 */ + 77, 65, 54, 48, 0,203, 1, 0, 0, 0, 0, 0, 0,215, 1, 0, /* 0x 8b0 */ + 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, /* 0x 8c0 */ + 68, 70, 65, 83, 54, 48, 0,215, 1, 0, 0, 0, 0, 0, 0,226, /* 0x 8d0 */ + 1, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, /* 0x 8e0 */ + 0, 0, 0, 0,240, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, /* 0x 8f0 */ + 0, 0, 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0,240, 1, /* 0x 900 */ + 0, 0, 0, 0, 0, 0, 6, 2, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 910 */ + 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 54, 48, 0, /* 0x 920 */ + 6, 2, 0, 0, 78, 82, 86, 50, 68, 69, 78, 68, 0, 6, 2, 0, /* 0x 930 */ + 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 6, 2, 0, 0, 0, 0, /* 0x 940 */ + 0, 0, 8, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 4, /* 0x 950 */ + 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 48, 0, 9, 2, 0, 0, /* 0x 960 */ + 0, 0, 0, 0, 11, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, /* 0x 970 */ + 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 11, 2, /* 0x 980 */ + 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 17, 2, 0, 0, 78, /* 0x 990 */ + 50, 69, 83, 77, 65, 50, 48, 0, 28, 2, 0, 0, 0, 0, 0, 0, /* 0x 9a0 */ + 30, 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 2, 0, 0, /* 0x 9b0 */ + 0, 78, 50, 69, 70, 65, 83, 50, 48, 0, 33, 2, 0, 0, 0, 0, /* 0x 9c0 */ + 0, 0, 37, 2, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 0, /* 0x 9d0 */ + 0, 0, 0, 78, 50, 69, 68, 69, 67, 50, 48, 0, 42, 2, 0, 0, /* 0x 9e0 */ + 78, 50, 69, 83, 77, 65, 51, 48, 0, 55, 2, 0, 0, 0, 0, 0, /* 0x 9f0 */ + 0, 68, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, /* 0x a00 */ + 0, 0, 78, 50, 69, 70, 65, 83, 51, 48, 0, 68, 2, 0, 0, 0, /* 0x a10 */ + 0, 0, 0, 74, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, /* 0x a20 */ + 31, 0, 0, 0, 0, 0, 0, 0, 83, 2, 0, 0, 78, 50, 69, 68, /* 0x a30 */ + 69, 67, 51, 48, 0, 31, 0, 0, 0, 78, 50, 69, 68, 69, 67, 51, /* 0x a40 */ + 48, 0, 83, 2, 0, 0, 0, 0, 0, 0, 99, 2, 0, 0, 78, 50, /* 0x a50 */ + 69, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,114, /* 0x a60 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, /* 0x a70 */ + 0, 0, 0, 0,132, 2, 0, 0, 78, 50, 69, 68, 69, 67, 54, 48, /* 0x a80 */ + 0, 0, 0, 0, 0, 78, 50, 69, 83, 77, 65, 52, 48, 0,178, 2, /* 0x a90 */ + 0, 0, 0, 0, 0, 0,191, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x aa0 */ + 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 70, 65, 83, 52, 48, 0, /* 0x ab0 */ +191, 2, 0, 0, 0, 0, 0, 0,195, 2, 0, 0, 78, 50, 69, 68, /* 0x ac0 */ + 69, 67, 51, 48, 0, 82, 0, 0, 0, 0, 0, 0, 0,206, 2, 0, /* 0x ad0 */ + 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, /* 0x ae0 */ + 69, 68, 85, 77, 77, 49, 0,206, 2, 0, 0, 78, 50, 69, 83, 77, /* 0x af0 */ + 65, 53, 48, 0,206, 2, 0, 0, 78, 50, 69, 70, 65, 83, 53, 48, /* 0x b00 */ + 0,208, 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0,211, 2, /* 0x b10 */ + 0, 0, 78, 50, 69, 83, 77, 65, 54, 48, 0,220, 2, 0, 0, 0, /* 0x b20 */ + 0, 0, 0,232, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, /* 0x b30 */ + 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, 48, 0,232, 2, 0, /* 0x b40 */ + 0, 0, 0, 0, 0,243, 2, 0, 0, 78, 50, 69, 70, 65, 83, 54, /* 0x b50 */ + 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 78, 50, /* 0x b60 */ + 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, /* 0x b70 */ + 83, 54, 49, 0, 1, 3, 0, 0, 0, 0, 0, 0, 23, 3, 0, 0, /* 0x b80 */ + 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, /* 0x b90 */ + 68, 69, 67, 54, 48, 0, 23, 3, 0, 0, 78, 82, 86, 50, 69, 69, /* 0x ba0 */ + 78, 68, 0, 23, 3, 0, 0, 76, 88, 67, 75, 76, 76, 84, 57, 0, /* 0x bb0 */ + 23, 3, 0, 0, 67, 75, 76, 76, 84, 82, 48, 48, 0, 26, 3, 0, /* 0x bc0 */ + 0, 0, 0, 0, 0, 30, 3, 0, 0, 67, 75, 76, 76, 84, 82, 50, /* 0x bd0 */ + 48, 0, 30, 0, 0, 0, 67, 75, 76, 76, 84, 82, 49, 48, 0, 35, /* 0x be0 */ + 3, 0, 0, 0, 0, 0, 0, 49, 3, 0, 0, 67, 75, 76, 76, 84, /* 0x bf0 */ + 82, 50, 48, 0, 6, 0, 0, 0, 67, 75, 76, 76, 84, 82, 50, 48, /* 0x c00 */ + 0, 49, 3, 0, 0, 0, 0, 0, 0, 55, 3, 0, 0, 67, 75, 76, /* 0x c10 */ + 76, 84, 82, 52, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59, 3, /* 0x c20 */ + 0, 0, 67, 75, 76, 76, 84, 82, 52, 48, 0, 0, 0, 0, 0, 67, /* 0x c30 */ + 75, 76, 76, 84, 82, 51, 48, 0, 82, 3, 0, 0, 0, 0, 0, 0, /* 0x c40 */ + 89, 3, 0, 0, 67, 75, 76, 76, 84, 82, 49, 48, 0, 14, 0, 0, /* 0x c50 */ + 0, 67, 75, 76, 76, 84, 82, 52, 48, 0, 89, 3, 0, 0, 0, 0, /* 0x c60 */ + 0, 0, 94, 3, 0, 0, 67, 75, 76, 76, 84, 82, 48, 48, 0, 4, /* 0x c70 */ + 0, 0, 0, 76, 88, 68, 85, 77, 77, 89, 50, 0, 94, 3, 0, 0, /* 0x c80 */ + 76, 88, 67, 65, 76, 76, 84, 57, 0, 94, 3, 0, 0, 67, 65, 76, /* 0x c90 */ + 76, 84, 82, 48, 48, 0, 96, 3, 0, 0, 67, 84, 67, 76, 69, 86, /* 0x ca0 */ + 69, 49, 0,110, 3, 0, 0, 0, 0, 0, 0,115, 3, 0, 0, 67, /* 0x cb0 */ + 65, 76, 76, 84, 82, 48, 48, 0, 5, 0, 0, 0, 67, 65, 76, 76, /* 0x cc0 */ + 84, 82, 48, 49, 0,115, 3, 0, 0, 67, 84, 68, 85, 77, 77, 89, /* 0x cd0 */ + 49, 0,120, 3, 0, 0, 67, 84, 66, 83, 72, 82, 48, 49, 0,120, /* 0x ce0 */ + 3, 0, 0, 67, 84, 66, 82, 79, 82, 48, 49, 0,124, 3, 0, 0, /* 0x cf0 */ + 67, 84, 66, 83, 87, 65, 48, 49, 0,126, 3, 0, 0, 67, 65, 76, /* 0x d00 */ + 76, 84, 82, 48, 50, 0,131, 3, 0, 0, 0, 0, 0, 0,145, 3, /* 0x d10 */ + 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, 10, 0, 0, 0, 67, /* 0x d20 */ + 65, 76, 76, 84, 82, 49, 48, 0,145, 3, 0, 0, 67, 65, 76, 76, /* 0x d30 */ + 84, 82, 69, 56, 0,150, 3, 0, 0, 67, 65, 76, 76, 84, 82, 69, /* 0x d40 */ + 57, 0,152, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, 0,154, /* 0x d50 */ + 3, 0, 0, 0, 0, 0, 0,158, 3, 0, 0, 67, 65, 76, 76, 84, /* 0x d60 */ + 82, 49, 51, 0, 5, 0, 0, 0, 67, 84, 67, 76, 69, 86, 69, 50, /* 0x d70 */ + 0,158, 3, 0, 0, 0, 0, 0, 0,163, 3, 0, 0, 67, 65, 76, /* 0x d80 */ + 76, 84, 82, 49, 49, 0, 0, 0, 0, 0, 67, 65, 76, 76, 84, 82, /* 0x d90 */ + 49, 50, 0,163, 3, 0, 0, 67, 84, 68, 85, 77, 77, 89, 50, 0, /* 0x da0 */ +165, 3, 0, 0, 67, 84, 66, 83, 72, 82, 49, 49, 0,165, 3, 0, /* 0x db0 */ + 0, 67, 84, 66, 82, 79, 82, 49, 49, 0,169, 3, 0, 0, 67, 84, /* 0x dc0 */ + 66, 83, 87, 65, 49, 49, 0,171, 3, 0, 0, 67, 65, 76, 76, 84, /* 0x dd0 */ + 82, 49, 51, 0,176, 3, 0, 0, 0, 0, 0, 0,181, 3, 0, 0, /* 0x de0 */ + 67, 65, 76, 76, 84, 82, 49, 48, 0, 5, 0, 0, 0, 67, 84, 84, /* 0x df0 */ + 72, 69, 69, 78, 68, 0,181, 3, 0, 0, 76, 73, 78, 85, 88, 57, /* 0x e00 */ + 57, 48, 0,181, 3, 0, 0, 85, 80, 88, 49, 72, 69, 65, 68, 0, /* 0x e10 */ +241, 3, 0, 0, 76, 73, 84, 72, 69, 69, 78, 68, 0, 17, 4, 0, /* 0x e20 */ + 0,255,255,255,255, 17, 4 /* 0x e30 */ +}; diff --git a/src/stub/i386-linux.kernel.vmlinuz.h b/src/stub/i386-linux.kernel.vmlinuz.h new file mode 100644 index 00000000..157aed67 --- /dev/null +++ b/src/stub/i386-linux.kernel.vmlinuz.h @@ -0,0 +1,265 @@ +/* i386-linux.kernel.vmlinuz.h -- created from i386-linux.kernel.vmlinuz.bin, 3673 (0xe59) 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 + + */ + + +#define NRV_LOADER_SIZE 3673 +#define NRV_LOADER_ADLER32 0x82e5637b +#define NRV_LOADER_CRC32 0x989597aa + +unsigned char nrv_loader[3673] = { +140,200,131,192, 8,142,216,142,192,141,142, 83, 84, 65, 75,137, /* 0x 0 */ + 73,248,137, 65,252, 15,178, 97,248,106, 0,157,131,205,255,184, /* 0x 10 */ + 75, 69, 73, 80, 14, 80, 87, 86, 80, 80,106, 63,104, 85, 76, 69, /* 0x 20 */ + 78,190, 69, 83, 73, 48,191, 69, 68, 73, 48,185, 69, 67, 88, 48, /* 0x 30 */ +253,243,165,252,190, 69, 83, 73, 49,151,233, 74, 77, 80, 68, 71, /* 0x 40 */ +137,125, 1, 57, 56,116,248,252,190, 69, 83, 73, 49,151,235, 0, /* 0x 50 */ +164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, 30,131, /* 0x 60 */ +238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, 1, 0, /* 0x 70 */ + 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192, 1, /* 0x 80 */ +219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0, /* 0x 90 */ +117, 9,139, 30,131,238,252, 17,219,115, 0, 49,201,131,232, 3, /* 0x a0 */ +114, 13,193,224, 8,138, 6, 70,131,240,255,116, 0,137,197, 1, /* 0x b0 */ +219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, 7, /* 0x c0 */ +139, 30,131,238,252, 17,219, 17,201,117, 0, 65, 1,219,117, 7, /* 0x d0 */ +139, 30,131,238,252, 17,219, 17,201, 1,219,117, 7,139, 30,131, /* 0x e0 */ +238,252, 17,219,115, 0, 1,219,115, 0,117, 9,139, 30,131,238, /* 0x f0 */ +252, 17,219,115, 0, 65, 65,131,193, 2,129,253, 0,243,255,255, /* 0x 100 */ +131,209, 1, 86,141, 52, 47,243,164, 94,233, 0, 0, 0, 0,141, /* 0x 110 */ + 20, 47,131,253,252,138, 4, 15,118, 0,138, 2, 66,136, 7, 71, /* 0x 120 */ + 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, 4,137, 7,131, /* 0x 130 */ +199, 4,131,233, 4,119,241, 1,207,233, 0, 0, 0, 0,235, 0, /* 0x 140 */ +164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, 30,131, /* 0x 150 */ +238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, 1, 0, /* 0x 160 */ + 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192, 1, /* 0x 170 */ +219,117, 7,139, 30,131,238,252, 17,219,114, 0, 1,219,115, 11, /* 0x 180 */ +117, 0,139, 30,131,238,252, 17,219,114, 0, 72, 1,219,117, 7, /* 0x 190 */ +139, 30,131,238,252, 17,219, 17,192,235, 0, 49,201,131,232, 3, /* 0x 1a0 */ +114, 17,193,224, 8,138, 6, 70,131,240,255,116, 0,209,248,137, /* 0x 1b0 */ +197,235, 11, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, /* 0x 1c0 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, 0, 65, /* 0x 1d0 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, /* 0x 1e0 */ + 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, 9, /* 0x 1f0 */ +139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129,253, /* 0x 200 */ + 0,251,255,255,131,209, 1, 86,141, 52, 47,243,164, 94,233, 0, /* 0x 210 */ + 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0,138, 2, /* 0x 220 */ + 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, /* 0x 230 */ + 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, 0, /* 0x 240 */ + 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, /* 0x 250 */ + 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, /* 0x 260 */ + 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 270 */ +219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, /* 0x 280 */ + 1,219,115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, 72, /* 0x 290 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, 1, /* 0x 2a0 */ +219,117, 7,139, 30,131,238,252, 17,219, 17,201,235, 0, 49,201, /* 0x 2b0 */ +131,232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, 0, /* 0x 2c0 */ +209,248,137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 2d0 */ +219,114,204, 65, 1,219,117, 7,139, 30,131,238,252, 17,219,114, /* 0x 2e0 */ +190, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219, /* 0x 2f0 */ +117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, /* 0x 300 */ + 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129, /* 0x 310 */ +253, 0,251,255,255,131,209, 2, 86,141, 52, 47,243,164, 94,233, /* 0x 320 */ + 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0,138, /* 0x 330 */ + 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131, /* 0x 340 */ +194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, /* 0x 350 */ + 0, 0, 0, 89, 90, 95,235, 0,138, 7,131,199, 1, 60,128,114, /* 0x 360 */ + 10, 60,143,119, 6,128,127,254, 15,116, 0, 44,232, 60, 1,119, /* 0x 370 */ + 0, 56, 23,117, 0,139, 7,102,193,232, 8,193,192, 16,134,196, /* 0x 380 */ + 41,248,137, 7,131,199, 4,131,233, 4,138, 7,131,199, 1,226, /* 0x 390 */ + 0,131,233, 1,127, 0, 95,185, 84, 69, 88, 76,138, 7, 71, 44, /* 0x 3a0 */ +232, 60, 1,119,247,128, 63, 63,117, 0,139, 7,138, 95, 4,102, /* 0x 3b0 */ +193,232, 8,134,196,193,192, 16,134,196, 41,248,128,235,232,137, /* 0x 3c0 */ + 7,131,199, 5,136,216,226, 0,185, 84, 69, 88, 76,176,232,176, /* 0x 3d0 */ +233,242,174,117, 0,128, 63, 63,117, 0,139, 7,102,193,232, 8, /* 0x 3e0 */ +134,196,193,192, 16,134,196, 41,248,171,235, 0, 94, 95, 49,219, /* 0x 3f0 */ +203, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, 0, 0, 0, /* 0x 400 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 410 */ + 45, 0, 0, 0, 76, 73, 78, 85, 90, 48, 48, 48, 0, 0, 0, 0, /* 0x 420 */ + 0, 76, 90, 67, 65, 76, 76, 84, 49, 0, 40, 0, 0, 0, 76, 90, /* 0x 430 */ + 68, 85, 77, 77, 89, 48, 0, 41, 0, 0, 0, 76, 90, 67, 75, 76, /* 0x 440 */ + 76, 84, 49, 0, 41, 0, 0, 0, 76, 90, 68, 85, 77, 77, 89, 49, /* 0x 450 */ + 0, 49, 0, 0, 0, 76, 66, 90, 73, 77, 65, 71, 69, 0, 49, 0, /* 0x 460 */ + 0, 0, 76, 90, 73, 77, 65, 71, 69, 48, 0, 79, 0, 0, 0, 76, /* 0x 470 */ + 90, 67, 85, 84, 80, 79, 73, 0, 94, 0, 0, 0, 78, 50, 66, 83, /* 0x 480 */ + 77, 65, 49, 48, 0, 94, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, /* 0x 490 */ + 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, /* 0x 4a0 */ + 66, 70, 65, 83, 49, 48, 0, 97, 0, 0, 0, 0, 0, 0, 0, 99, /* 0x 4b0 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, /* 0x 4c0 */ + 78, 50, 66, 70, 65, 83, 49, 49, 0, 99, 0, 0, 0, 78, 50, 66, /* 0x 4d0 */ + 68, 69, 67, 49, 48, 0,105, 0, 0, 0, 78, 50, 66, 83, 77, 65, /* 0x 4e0 */ + 50, 48, 0,116, 0, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 78, /* 0x 4f0 */ + 50, 66, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 66, 70, /* 0x 500 */ + 65, 83, 50, 48, 0,121, 0, 0, 0, 0, 0, 0, 0,125, 0, 0, /* 0x 510 */ + 0, 78, 50, 66, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, /* 0x 520 */ + 66, 68, 69, 67, 50, 48, 0,130, 0, 0, 0, 78, 50, 66, 83, 77, /* 0x 530 */ + 65, 51, 48, 0,143, 0, 0, 0, 0, 0, 0, 0,156, 0, 0, 0, /* 0x 540 */ + 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 78, 50, 66, /* 0x 550 */ + 70, 65, 83, 51, 48, 0,156, 0, 0, 0, 0, 0, 0, 0,160, 0, /* 0x 560 */ + 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, /* 0x 570 */ + 0, 0, 0,171, 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, /* 0x 580 */ + 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0,171, 0, 0, /* 0x 590 */ + 0, 0, 0, 0, 0,189, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, /* 0x 5a0 */ + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,219, 0, 0, 0, 78, 50, /* 0x 5b0 */ + 66, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, 66, 83, 77, /* 0x 5c0 */ + 65, 52, 48, 0,233, 0, 0, 0, 0, 0, 0, 0,246, 0, 0, 0, /* 0x 5d0 */ + 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 78, 50, 66, /* 0x 5e0 */ + 70, 65, 83, 52, 48, 0,246, 0, 0, 0, 0, 0, 0, 0,250, 0, /* 0x 5f0 */ + 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 0, /* 0x 600 */ + 0, 0, 0, 5, 1, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, /* 0x 610 */ + 49, 0, 0, 0, 78, 50, 66, 68, 85, 77, 77, 49, 0, 5, 1, 0, /* 0x 620 */ + 0, 78, 50, 66, 83, 77, 65, 53, 48, 0, 5, 1, 0, 0, 78, 50, /* 0x 630 */ + 66, 70, 65, 83, 53, 48, 0, 7, 1, 0, 0, 78, 50, 66, 68, 69, /* 0x 640 */ + 67, 53, 48, 0, 10, 1, 0, 0, 78, 50, 66, 83, 77, 65, 54, 48, /* 0x 650 */ + 0, 19, 1, 0, 0, 0, 0, 0, 0, 31, 1, 0, 0, 78, 50, 66, /* 0x 660 */ + 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, /* 0x 670 */ + 54, 48, 0, 31, 1, 0, 0, 0, 0, 0, 0, 42, 1, 0, 0, 78, /* 0x 680 */ + 50, 66, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 690 */ + 56, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, /* 0x 6a0 */ + 0, 78, 50, 66, 70, 65, 83, 54, 49, 0, 56, 1, 0, 0, 0, 0, /* 0x 6b0 */ + 0, 0, 78, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, /* 0x 6c0 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 78, 1, 0, 0, /* 0x 6d0 */ + 78, 82, 86, 50, 66, 69, 78, 68, 0, 78, 1, 0, 0, 78, 50, 68, /* 0x 6e0 */ + 83, 77, 65, 49, 48, 0, 78, 1, 0, 0, 0, 0, 0, 0, 80, 1, /* 0x 6f0 */ + 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, /* 0x 700 */ + 50, 68, 70, 65, 83, 49, 48, 0, 81, 1, 0, 0, 0, 0, 0, 0, /* 0x 710 */ + 83, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, /* 0x 720 */ + 0, 78, 50, 68, 70, 65, 83, 49, 49, 0, 83, 1, 0, 0, 78, 50, /* 0x 730 */ + 68, 68, 69, 67, 49, 48, 0, 89, 1, 0, 0, 78, 50, 68, 83, 77, /* 0x 740 */ + 65, 50, 48, 0,100, 1, 0, 0, 0, 0, 0, 0,102, 1, 0, 0, /* 0x 750 */ + 78, 50, 68, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 68, /* 0x 760 */ + 70, 65, 83, 50, 48, 0,105, 1, 0, 0, 0, 0, 0, 0,109, 1, /* 0x 770 */ + 0, 0, 78, 50, 68, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, /* 0x 780 */ + 50, 68, 68, 69, 67, 50, 48, 0,114, 1, 0, 0, 78, 50, 68, 83, /* 0x 790 */ + 77, 65, 51, 48, 0,127, 1, 0, 0, 0, 0, 0, 0,140, 1, 0, /* 0x 7a0 */ + 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 78, 50, /* 0x 7b0 */ + 68, 70, 65, 83, 51, 48, 0,140, 1, 0, 0, 0, 0, 0, 0,146, /* 0x 7c0 */ + 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, /* 0x 7d0 */ + 0, 0, 0, 0,155, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x 7e0 */ + 0, 16, 0, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0,155, 1, /* 0x 7f0 */ + 0, 0, 0, 0, 0, 0,171, 1, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 800 */ + 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,189, 1, 0, 0, 78, /* 0x 810 */ + 50, 68, 68, 69, 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 820 */ +223, 1, 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, 0, /* 0x 830 */ + 0, 78, 50, 68, 83, 77, 65, 52, 48, 0,237, 1, 0, 0, 0, 0, /* 0x 840 */ + 0, 0,250, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, /* 0x 850 */ + 0, 0, 0, 78, 50, 68, 70, 65, 83, 52, 48, 0,250, 1, 0, 0, /* 0x 860 */ + 0, 0, 0, 0,254, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x 870 */ + 0, 69, 0, 0, 0, 0, 0, 0, 0, 9, 2, 0, 0, 78, 50, 68, /* 0x 880 */ + 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, 78, 50, 68, 68, 85, 77, /* 0x 890 */ + 77, 49, 0, 9, 2, 0, 0, 78, 50, 68, 83, 77, 65, 53, 48, 0, /* 0x 8a0 */ + 9, 2, 0, 0, 78, 50, 68, 70, 65, 83, 53, 48, 0, 11, 2, 0, /* 0x 8b0 */ + 0, 78, 50, 68, 68, 69, 67, 53, 48, 0, 14, 2, 0, 0, 78, 50, /* 0x 8c0 */ + 68, 83, 77, 65, 54, 48, 0, 23, 2, 0, 0, 0, 0, 0, 0, 35, /* 0x 8d0 */ + 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, /* 0x 8e0 */ + 78, 50, 68, 70, 65, 83, 54, 48, 0, 35, 2, 0, 0, 0, 0, 0, /* 0x 8f0 */ + 0, 46, 2, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 0, 0, /* 0x 900 */ + 0, 0, 0, 0, 0, 0, 60, 2, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 910 */ + 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, /* 0x 920 */ + 60, 2, 0, 0, 0, 0, 0, 0, 82, 2, 0, 0, 78, 50, 68, 68, /* 0x 930 */ + 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 54, /* 0x 940 */ + 48, 0, 82, 2, 0, 0, 78, 82, 86, 50, 68, 69, 78, 68, 0, 82, /* 0x 950 */ + 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 82, 2, 0, 0, /* 0x 960 */ + 0, 0, 0, 0, 84, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, /* 0x 970 */ + 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 48, 0, 85, 2, /* 0x 980 */ + 0, 0, 0, 0, 0, 0, 87, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x 990 */ + 49, 48, 0, 4, 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, /* 0x 9a0 */ + 87, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 93, 2, 0, /* 0x 9b0 */ + 0, 78, 50, 69, 83, 77, 65, 50, 48, 0,104, 2, 0, 0, 0, 0, /* 0x 9c0 */ + 0, 0,106, 2, 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 2, /* 0x 9d0 */ + 0, 0, 0, 78, 50, 69, 70, 65, 83, 50, 48, 0,109, 2, 0, 0, /* 0x 9e0 */ + 0, 0, 0, 0,113, 2, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, /* 0x 9f0 */ + 0, 0, 0, 0, 0, 78, 50, 69, 68, 69, 67, 50, 48, 0,118, 2, /* 0x a00 */ + 0, 0, 78, 50, 69, 83, 77, 65, 51, 48, 0,131, 2, 0, 0, 0, /* 0x a10 */ + 0, 0, 0,144, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, /* 0x a20 */ + 31, 0, 0, 0, 78, 50, 69, 70, 65, 83, 51, 48, 0,144, 2, 0, /* 0x a30 */ + 0, 0, 0, 0, 0,150, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, /* 0x a40 */ + 48, 0, 31, 0, 0, 0, 0, 0, 0, 0,159, 2, 0, 0, 78, 50, /* 0x a50 */ + 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, 0, 78, 50, 69, 68, 69, /* 0x a60 */ + 67, 51, 48, 0,159, 2, 0, 0, 0, 0, 0, 0,175, 2, 0, 0, /* 0x a70 */ + 78, 50, 69, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x a80 */ + 0,190, 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, 0, /* 0x a90 */ + 0, 0, 0, 0, 0, 0,208, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x aa0 */ + 54, 48, 0, 0, 0, 0, 0, 78, 50, 69, 83, 77, 65, 52, 48, 0, /* 0x ab0 */ +254, 2, 0, 0, 0, 0, 0, 0, 11, 3, 0, 0, 78, 50, 69, 68, /* 0x ac0 */ + 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 70, 65, 83, 52, /* 0x ad0 */ + 48, 0, 11, 3, 0, 0, 0, 0, 0, 0, 15, 3, 0, 0, 78, 50, /* 0x ae0 */ + 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 0, 0, 0, 0, 26, /* 0x af0 */ + 3, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, /* 0x b00 */ + 78, 50, 69, 68, 85, 77, 77, 49, 0, 26, 3, 0, 0, 78, 50, 69, /* 0x b10 */ + 83, 77, 65, 53, 48, 0, 26, 3, 0, 0, 78, 50, 69, 70, 65, 83, /* 0x b20 */ + 53, 48, 0, 28, 3, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, /* 0x b30 */ + 31, 3, 0, 0, 78, 50, 69, 83, 77, 65, 54, 48, 0, 40, 3, 0, /* 0x b40 */ + 0, 0, 0, 0, 0, 52, 3, 0, 0, 78, 50, 69, 68, 69, 67, 49, /* 0x b50 */ + 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, 48, 0, 52, /* 0x b60 */ + 3, 0, 0, 0, 0, 0, 0, 63, 3, 0, 0, 78, 50, 69, 70, 65, /* 0x b70 */ + 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 3, 0, 0, /* 0x b80 */ + 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, /* 0x b90 */ + 70, 65, 83, 54, 49, 0, 77, 3, 0, 0, 0, 0, 0, 0, 99, 3, /* 0x ba0 */ + 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, /* 0x bb0 */ + 50, 69, 68, 69, 67, 54, 48, 0, 99, 3, 0, 0, 78, 82, 86, 50, /* 0x bc0 */ + 69, 69, 78, 68, 0, 99, 3, 0, 0, 76, 90, 67, 75, 76, 76, 84, /* 0x bd0 */ + 57, 0, 99, 3, 0, 0, 67, 75, 76, 76, 84, 82, 48, 48, 0,102, /* 0x be0 */ + 3, 0, 0, 0, 0, 0, 0,104, 3, 0, 0, 67, 75, 76, 76, 84, /* 0x bf0 */ + 82, 50, 48, 0, 28, 0, 0, 0, 67, 75, 76, 76, 84, 82, 49, 48, /* 0x c00 */ + 0,109, 3, 0, 0, 0, 0, 0, 0,123, 3, 0, 0, 67, 75, 76, /* 0x c10 */ + 76, 84, 82, 50, 48, 0, 6, 0, 0, 0, 67, 75, 76, 76, 84, 82, /* 0x c20 */ + 50, 48, 0,123, 3, 0, 0, 0, 0, 0, 0,129, 3, 0, 0, 67, /* 0x c30 */ + 75, 76, 76, 84, 82, 52, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x c40 */ +133, 3, 0, 0, 67, 75, 76, 76, 84, 82, 52, 48, 0, 0, 0, 0, /* 0x c50 */ + 0, 67, 75, 76, 76, 84, 82, 51, 48, 0,154, 3, 0, 0, 0, 0, /* 0x c60 */ + 0, 0,161, 3, 0, 0, 67, 75, 76, 76, 84, 82, 49, 48, 0, 14, /* 0x c70 */ + 0, 0, 0, 67, 75, 76, 76, 84, 82, 52, 48, 0,161, 3, 0, 0, /* 0x c80 */ + 0, 0, 0, 0,166, 3, 0, 0, 67, 75, 76, 76, 84, 82, 48, 48, /* 0x c90 */ + 0, 2, 0, 0, 0, 76, 90, 68, 85, 77, 77, 89, 50, 0,166, 3, /* 0x ca0 */ + 0, 0, 76, 90, 67, 65, 76, 76, 84, 57, 0,166, 3, 0, 0, 67, /* 0x cb0 */ + 65, 76, 76, 84, 82, 48, 48, 0,167, 3, 0, 0, 67, 84, 67, 76, /* 0x cc0 */ + 69, 86, 69, 49, 0,181, 3, 0, 0, 0, 0, 0, 0,186, 3, 0, /* 0x cd0 */ + 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, 5, 0, 0, 0, 67, 65, /* 0x ce0 */ + 76, 76, 84, 82, 48, 49, 0,186, 3, 0, 0, 67, 84, 68, 85, 77, /* 0x cf0 */ + 77, 89, 49, 0,191, 3, 0, 0, 67, 84, 66, 83, 72, 82, 48, 49, /* 0x d00 */ + 0,191, 3, 0, 0, 67, 84, 66, 82, 79, 82, 48, 49, 0,195, 3, /* 0x d10 */ + 0, 0, 67, 84, 66, 83, 87, 65, 48, 49, 0,197, 3, 0, 0, 67, /* 0x d20 */ + 65, 76, 76, 84, 82, 48, 50, 0,202, 3, 0, 0, 0, 0, 0, 0, /* 0x d30 */ +216, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, 0, 10, 0, 0, /* 0x d40 */ + 0, 67, 65, 76, 76, 84, 82, 49, 48, 0,216, 3, 0, 0, 67, 65, /* 0x d50 */ + 76, 76, 84, 82, 69, 56, 0,221, 3, 0, 0, 67, 65, 76, 76, 84, /* 0x d60 */ + 82, 69, 57, 0,223, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, /* 0x d70 */ + 0,225, 3, 0, 0, 0, 0, 0, 0,229, 3, 0, 0, 67, 65, 76, /* 0x d80 */ + 76, 84, 82, 49, 51, 0, 5, 0, 0, 0, 67, 84, 67, 76, 69, 86, /* 0x d90 */ + 69, 50, 0,229, 3, 0, 0, 0, 0, 0, 0,234, 3, 0, 0, 67, /* 0x da0 */ + 65, 76, 76, 84, 82, 49, 49, 0, 0, 0, 0, 0, 67, 65, 76, 76, /* 0x db0 */ + 84, 82, 49, 50, 0,234, 3, 0, 0, 67, 84, 68, 85, 77, 77, 89, /* 0x dc0 */ + 50, 0,236, 3, 0, 0, 67, 84, 66, 83, 72, 82, 49, 49, 0,236, /* 0x dd0 */ + 3, 0, 0, 67, 84, 66, 82, 79, 82, 49, 49, 0,240, 3, 0, 0, /* 0x de0 */ + 67, 84, 66, 83, 87, 65, 49, 49, 0,242, 3, 0, 0, 67, 65, 76, /* 0x df0 */ + 76, 84, 82, 49, 51, 0,247, 3, 0, 0, 0, 0, 0, 0,252, 3, /* 0x e00 */ + 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, 0, 5, 0, 0, 0, 67, /* 0x e10 */ + 84, 84, 72, 69, 69, 78, 68, 0,252, 3, 0, 0, 76, 73, 78, 85, /* 0x e20 */ + 90, 57, 57, 48, 0,252, 3, 0, 0, 85, 80, 88, 49, 72, 69, 65, /* 0x e30 */ + 68, 0, 1, 4, 0, 0, 76, 73, 84, 72, 69, 69, 78, 68, 0, 33, /* 0x e40 */ + 4, 0, 0,255,255,255,255, 33, 4 /* 0x e50 */ +}; diff --git a/src/stub/i386-win32.pe.h b/src/stub/i386-win32.pe.h new file mode 100644 index 00000000..11a1e8df --- /dev/null +++ b/src/stub/i386-win32.pe.h @@ -0,0 +1,308 @@ +/* i386-win32.pe.h -- created from i386-win32.pe.bin, 4365 (0x110d) 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 + + */ + + +#define NRV_LOADER_SIZE 4365 +#define NRV_LOADER_ADLER32 0xf651185e +#define NRV_LOADER_CRC32 0x6461513e + +unsigned char nrv_loader[4365] = { +128,124, 36, 8, 1, 15,133, 0, 0, 0, 0, 96,190, 69, 83, 73, /* 0x 0 */ + 48,141,190, 69, 68, 73, 48,102,255,135, 73, 67, 79, 78,102,129, /* 0x 10 */ +135, 73, 67, 79, 78, 68, 82,199,135, 84, 76, 83, 65, 84, 76, 83, /* 0x 20 */ + 86, 87,131,205,255,235, 0,164,235, 0,138, 6, 70,136, 7, 71, /* 0x 30 */ + 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64, /* 0x 40 */ +114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, /* 0x 50 */ + 17,219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,115, /* 0x 60 */ + 0, 1,219,115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, /* 0x 70 */ + 49,201,131,232, 3,114, 13,193,224, 8,138, 6, 70,131,240,255, /* 0x 80 */ +116, 0,137,197, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 90 */ +201, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, 0, /* 0x a0 */ + 65, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219, /* 0x b0 */ +117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, /* 0x c0 */ + 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129, /* 0x d0 */ +253, 0,243,255,255,131,209, 1,137,242,141, 52, 47,243,164,137, /* 0x e0 */ +214,233, 0, 0, 0, 0,141, 20, 47,131,253,252,118, 0,138, 2, /* 0x f0 */ + 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, /* 0x 100 */ + 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, 0, /* 0x 110 */ + 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, /* 0x 120 */ + 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,114, 0,184, /* 0x 130 */ + 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 140 */ +192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 1,219, /* 0x 150 */ +115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, 72, 1,219, /* 0x 160 */ +117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, 49,201,131, /* 0x 170 */ +232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, 0,209, /* 0x 180 */ +248,137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 190 */ + 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, /* 0x 1a0 */ + 0, 65, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1, /* 0x 1b0 */ +219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0, /* 0x 1c0 */ +117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2, /* 0x 1d0 */ +129,253, 0,251,255,255,131,209, 1,137,242,141, 52, 47,243,164, /* 0x 1e0 */ +137,214,233, 0, 0, 0, 0,141, 20, 47,131,253,252,118, 0,138, /* 0x 1f0 */ + 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131, /* 0x 200 */ +194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, /* 0x 210 */ + 0, 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219, /* 0x 220 */ +117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,114, 0, /* 0x 230 */ +184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 240 */ + 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 1, /* 0x 250 */ +219,115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, 72, 1, /* 0x 260 */ +219,117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, 1,219, /* 0x 270 */ +117, 7,139, 30,131,238,252, 17,219, 17,201,235, 0, 49,201,131, /* 0x 280 */ +232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, 0,209, /* 0x 290 */ +248,137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 2a0 */ +114,204, 65, 1,219,117, 7,139, 30,131,238,252, 17,219,114,190, /* 0x 2b0 */ + 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, /* 0x 2c0 */ + 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, 9, /* 0x 2d0 */ +139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129,253, /* 0x 2e0 */ + 0,251,255,255,131,209, 2,137,242,141, 52, 47,243,164,137,214, /* 0x 2f0 */ +233, 0, 0, 0, 0,141, 20, 47,131,253,252,118, 0,138, 2, 66, /* 0x 300 */ +136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, 4, /* 0x 310 */ +137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, 0, 0, /* 0x 320 */ + 0,173, 1,199, 15,130, 0, 0, 0, 0, 94,141,190, 84, 69, 88, /* 0x 330 */ + 86,137,247,185, 84, 69, 88, 76,138, 7, 71, 44,232, 60, 1,119, /* 0x 340 */ +247,128, 63, 63,117, 0,139, 7,138, 95, 4,102,193,232, 8,134, /* 0x 350 */ +196,193,192, 16,134,196, 41,248,128,235,232, 1,240,137, 7,131, /* 0x 360 */ +199, 5,136,216,226, 0,185, 84, 69, 88, 76,176,232,176,233,242, /* 0x 370 */ +174,117, 0,128, 63, 63,117, 0,139, 7,102,193,232, 8,134,196, /* 0x 380 */ +193,192, 16,134,196, 41,248, 1,240,171,235, 0,141,190, 66, 73, /* 0x 390 */ + 77, 80,139, 7, 9,192,116, 0,139, 95, 4,141,132, 48, 73, 77, /* 0x 3a0 */ + 80, 83, 1,243, 80,131,199, 8,255,150, 76, 79, 65, 68,149,138, /* 0x 3b0 */ + 7, 71, 8,192,116,220,137,249,121, 0,122, 14,139, 7,131,199, /* 0x 3c0 */ + 4,139,132, 48, 75, 51, 50, 79,235, 0, 15,183, 7, 71, 80, 71, /* 0x 3d0 */ +185, 87, 72,242,174, 85,255,150, 71, 69, 84, 80, 9,192,116, 7, /* 0x 3e0 */ +137, 3,131,195, 4,235, 0, 97, 49,192,194, 12, 0,255,150, 69, /* 0x 3f0 */ + 88, 73, 84,141,190, 66, 82, 69, 76,131,199, 4,141, 94,252, 49, /* 0x 400 */ +192,138, 7, 71, 9,192,116, 0, 60,239,119, 17, 1,195,139, 3, /* 0x 410 */ +134,196,193,192, 16,134,196, 1,240,137, 3,235,226, 36, 15,193, /* 0x 420 */ +224, 16,102,139, 7,131,199, 2, 9,192,117, 0,139, 7,131,199, /* 0x 430 */ + 4,235, 0,135,254,141,143, 68, 69, 76, 84,169,102, 1, 12, 7, /* 0x 440 */ +173, 9,192,117,247,193,233, 16,169,102, 1, 12, 7,173, 9,192, /* 0x 450 */ +117,247,139,174, 86, 80, 82, 79,141,190, 73, 77, 71, 66,187, 73, /* 0x 460 */ + 77, 71, 76, 80, 84,106, 4, 83, 87,255,213,141,135, 83, 87, 82, /* 0x 470 */ + 73,128, 32,127,128, 96, 40,127, 88, 80, 84, 80, 83, 87,255,213, /* 0x 480 */ + 88, 97,141, 68, 36,128,106, 0, 57,196,117,250,131,236,128,141, /* 0x 490 */ + 68, 36,128,106, 0, 57,196,117,250,131,236,128, 49,192, 64,194, /* 0x 4a0 */ + 12, 0,233, 74, 77, 80, 79, 85, 80, 88, 33,161,216,208,213, 0, /* 0x 4b0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 4c0 */ + 0, 0, 0, 0, 0, 0, 45, 0, 80, 69, 73, 83, 68, 76, 76, 49, /* 0x 4d0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 80, 69, 77, /* 0x 4e0 */ + 65, 73, 78, 50, 49, 0, 0, 0, 0, 0, 80, 69, 77, 65, 73, 78, /* 0x 4f0 */ + 48, 49, 0, 11, 0, 0, 0, 80, 69, 73, 67, 79, 78, 83, 49, 0, /* 0x 500 */ + 23, 0, 0, 0, 80, 69, 73, 67, 79, 78, 83, 50, 0, 30, 0, 0, /* 0x 510 */ + 0, 80, 69, 73, 67, 79, 78, 83, 90, 0, 39, 0, 0, 0, 80, 69, /* 0x 520 */ + 84, 76, 83, 72, 65, 75, 0, 39, 0, 0, 0, 80, 69, 77, 65, 73, /* 0x 530 */ + 78, 48, 50, 0, 49, 0, 0, 0, 78, 50, 66, 83, 77, 65, 49, 48, /* 0x 540 */ + 0, 53, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 78, 50, 66, /* 0x 550 */ + 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, 70, 65, 83, /* 0x 560 */ + 49, 48, 0, 56, 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, 0, 78, /* 0x 570 */ + 50, 66, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 66, 70, /* 0x 580 */ + 65, 83, 49, 49, 0, 58, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, /* 0x 590 */ + 48, 0, 64, 0, 0, 0, 78, 50, 66, 83, 77, 65, 50, 48, 0, 75, /* 0x 5a0 */ + 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 78, 50, 66, 83, 77, /* 0x 5b0 */ + 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 66, 70, 65, 83, 50, 48, /* 0x 5c0 */ + 0, 80, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 78, 50, 66, /* 0x 5d0 */ + 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, /* 0x 5e0 */ + 50, 48, 0, 87, 0, 0, 0, 78, 50, 66, 83, 77, 65, 51, 48, 0, /* 0x 5f0 */ +100, 0, 0, 0, 0, 0, 0, 0,113, 0, 0, 0, 78, 50, 66, 68, /* 0x 600 */ + 69, 67, 50, 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 51, /* 0x 610 */ + 48, 0,113, 0, 0, 0, 0, 0, 0, 0,117, 0, 0, 0, 78, 50, /* 0x 620 */ + 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, /* 0x 630 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 0, /* 0x 640 */ + 78, 50, 66, 68, 69, 67, 51, 48, 0,128, 0, 0, 0, 0, 0, 0, /* 0x 650 */ + 0,146, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, 0, 0, 0, /* 0x 660 */ + 0, 0, 0, 0, 0, 0,176, 0, 0, 0, 78, 50, 66, 68, 69, 67, /* 0x 670 */ + 53, 48, 0, 0, 0, 0, 0, 78, 50, 66, 83, 77, 65, 52, 48, 0, /* 0x 680 */ +190, 0, 0, 0, 0, 0, 0, 0,203, 0, 0, 0, 78, 50, 66, 68, /* 0x 690 */ + 69, 67, 51, 48, 0, 49, 0, 0, 0, 78, 50, 66, 70, 65, 83, 52, /* 0x 6a0 */ + 48, 0,203, 0, 0, 0, 0, 0, 0, 0,207, 0, 0, 0, 78, 50, /* 0x 6b0 */ + 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, 0, 0, 0, 0,218, /* 0x 6c0 */ + 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 0, 49, 0, 0, 0, /* 0x 6d0 */ + 78, 50, 66, 68, 85, 77, 77, 49, 0,218, 0, 0, 0, 78, 50, 66, /* 0x 6e0 */ + 83, 77, 65, 53, 48, 0,218, 0, 0, 0, 78, 50, 66, 70, 65, 83, /* 0x 6f0 */ + 53, 48, 0,220, 0, 0, 0, 78, 50, 66, 68, 69, 67, 53, 48, 0, /* 0x 700 */ +223, 0, 0, 0, 78, 50, 66, 83, 77, 65, 54, 48, 0,232, 0, 0, /* 0x 710 */ + 0, 0, 0, 0, 0,246, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, /* 0x 720 */ + 48, 0, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 54, 48, 0,246, /* 0x 730 */ + 0, 0, 0, 0, 0, 0, 0,254, 0, 0, 0, 78, 50, 66, 70, 65, /* 0x 740 */ + 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 1, 0, 0, /* 0x 750 */ + 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 66, /* 0x 760 */ + 70, 65, 83, 54, 49, 0, 12, 1, 0, 0, 0, 0, 0, 0, 34, 1, /* 0x 770 */ + 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, /* 0x 780 */ + 50, 66, 68, 69, 67, 54, 48, 0, 34, 1, 0, 0, 78, 82, 86, 50, /* 0x 790 */ + 66, 69, 78, 68, 0, 34, 1, 0, 0, 78, 50, 68, 83, 77, 65, 49, /* 0x 7a0 */ + 48, 0, 34, 1, 0, 0, 0, 0, 0, 0, 36, 1, 0, 0, 78, 50, /* 0x 7b0 */ + 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 68, 70, 65, /* 0x 7c0 */ + 83, 49, 48, 0, 37, 1, 0, 0, 0, 0, 0, 0, 39, 1, 0, 0, /* 0x 7d0 */ + 78, 50, 68, 68, 69, 67, 49, 48, 0, 4, 0, 0, 0, 78, 50, 68, /* 0x 7e0 */ + 70, 65, 83, 49, 49, 0, 39, 1, 0, 0, 78, 50, 68, 68, 69, 67, /* 0x 7f0 */ + 49, 48, 0, 45, 1, 0, 0, 78, 50, 68, 83, 77, 65, 50, 48, 0, /* 0x 800 */ + 56, 1, 0, 0, 0, 0, 0, 0, 58, 1, 0, 0, 78, 50, 68, 83, /* 0x 810 */ + 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, 50, 68, 70, 65, 83, 50, /* 0x 820 */ + 48, 0, 61, 1, 0, 0, 0, 0, 0, 0, 63, 1, 0, 0, 78, 50, /* 0x 830 */ + 68, 70, 65, 83, 49, 49, 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, /* 0x 840 */ + 67, 50, 48, 0, 68, 1, 0, 0, 78, 50, 68, 83, 77, 65, 51, 48, /* 0x 850 */ + 0, 81, 1, 0, 0, 0, 0, 0, 0, 94, 1, 0, 0, 78, 50, 68, /* 0x 860 */ + 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 78, 50, 68, 70, 65, 83, /* 0x 870 */ + 51, 48, 0, 94, 1, 0, 0, 0, 0, 0, 0,100, 1, 0, 0, 78, /* 0x 880 */ + 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, 0, 0, 0, 0, 0, /* 0x 890 */ +109, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 16, 0, 0, /* 0x 8a0 */ + 0, 78, 50, 68, 68, 69, 67, 51, 48, 0,109, 1, 0, 0, 0, 0, /* 0x 8b0 */ + 0, 0,125, 1, 0, 0, 78, 50, 68, 68, 69, 67, 50, 48, 0, 0, /* 0x 8c0 */ + 0, 0, 0, 0, 0, 0, 0,143, 1, 0, 0, 78, 50, 68, 68, 69, /* 0x 8d0 */ + 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,177, 1, 0, 0, /* 0x 8e0 */ + 78, 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 78, 50, 68, /* 0x 8f0 */ + 83, 77, 65, 52, 48, 0,191, 1, 0, 0, 0, 0, 0, 0,204, 1, /* 0x 900 */ + 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, 0, 78, /* 0x 910 */ + 50, 68, 70, 65, 83, 52, 48, 0,204, 1, 0, 0, 0, 0, 0, 0, /* 0x 920 */ +208, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 0, 69, 0, 0, /* 0x 930 */ + 0, 0, 0, 0, 0,219, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, /* 0x 940 */ + 48, 0, 69, 0, 0, 0, 78, 50, 68, 68, 85, 77, 77, 49, 0,219, /* 0x 950 */ + 1, 0, 0, 78, 50, 68, 83, 77, 65, 53, 48, 0,219, 1, 0, 0, /* 0x 960 */ + 78, 50, 68, 70, 65, 83, 53, 48, 0,221, 1, 0, 0, 78, 50, 68, /* 0x 970 */ + 68, 69, 67, 53, 48, 0,224, 1, 0, 0, 78, 50, 68, 83, 77, 65, /* 0x 980 */ + 54, 48, 0,233, 1, 0, 0, 0, 0, 0, 0,247, 1, 0, 0, 78, /* 0x 990 */ + 50, 68, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 68, 70, /* 0x 9a0 */ + 65, 83, 54, 48, 0,247, 1, 0, 0, 0, 0, 0, 0,255, 1, 0, /* 0x 9b0 */ + 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 0, 0, 0, 0, 0, 0, /* 0x 9c0 */ + 0, 0, 13, 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 0, 0, /* 0x 9d0 */ + 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, 0, 13, 2, 0, 0, /* 0x 9e0 */ + 0, 0, 0, 0, 35, 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, /* 0x 9f0 */ + 0, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 54, 48, 0, 35, 2, /* 0x a00 */ + 0, 0, 78, 82, 86, 50, 68, 69, 78, 68, 0, 35, 2, 0, 0, 78, /* 0x a10 */ + 50, 69, 83, 77, 65, 49, 48, 0, 35, 2, 0, 0, 0, 0, 0, 0, /* 0x a20 */ + 37, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 4, 0, 0, /* 0x a30 */ + 0, 78, 50, 69, 70, 65, 83, 49, 48, 0, 38, 2, 0, 0, 0, 0, /* 0x a40 */ + 0, 0, 40, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 4, /* 0x a50 */ + 0, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 40, 2, 0, 0, /* 0x a60 */ + 78, 50, 69, 68, 69, 67, 49, 48, 0, 46, 2, 0, 0, 78, 50, 69, /* 0x a70 */ + 83, 77, 65, 50, 48, 0, 57, 2, 0, 0, 0, 0, 0, 0, 59, 2, /* 0x a80 */ + 0, 0, 78, 50, 69, 83, 77, 65, 49, 48, 0, 2, 0, 0, 0, 78, /* 0x a90 */ + 50, 69, 70, 65, 83, 50, 48, 0, 62, 2, 0, 0, 0, 0, 0, 0, /* 0x aa0 */ + 64, 2, 0, 0, 78, 50, 69, 70, 65, 83, 49, 49, 0, 0, 0, 0, /* 0x ab0 */ + 0, 78, 50, 69, 68, 69, 67, 50, 48, 0, 69, 2, 0, 0, 78, 50, /* 0x ac0 */ + 69, 83, 77, 65, 51, 48, 0, 82, 2, 0, 0, 0, 0, 0, 0, 95, /* 0x ad0 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, 0, 0, /* 0x ae0 */ + 78, 50, 69, 70, 65, 83, 51, 48, 0, 95, 2, 0, 0, 0, 0, 0, /* 0x af0 */ + 0,101, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, 31, 0, /* 0x b00 */ + 0, 0, 0, 0, 0, 0,110, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x b10 */ + 51, 48, 0, 31, 0, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 0, /* 0x b20 */ +110, 2, 0, 0, 0, 0, 0, 0,126, 2, 0, 0, 78, 50, 69, 68, /* 0x b30 */ + 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,141, 2, 0, /* 0x b40 */ + 0, 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 0, 0, /* 0x b50 */ + 0, 0,159, 2, 0, 0, 78, 50, 69, 68, 69, 67, 54, 48, 0, 0, /* 0x b60 */ + 0, 0, 0, 78, 50, 69, 83, 77, 65, 52, 48, 0,205, 2, 0, 0, /* 0x b70 */ + 0, 0, 0, 0,218, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, /* 0x b80 */ + 0, 82, 0, 0, 0, 78, 50, 69, 70, 65, 83, 52, 48, 0,218, 2, /* 0x b90 */ + 0, 0, 0, 0, 0, 0,222, 2, 0, 0, 78, 50, 69, 68, 69, 67, /* 0x ba0 */ + 51, 48, 0, 82, 0, 0, 0, 0, 0, 0, 0,233, 2, 0, 0, 78, /* 0x bb0 */ + 50, 69, 68, 69, 67, 51, 48, 0, 82, 0, 0, 0, 78, 50, 69, 68, /* 0x bc0 */ + 85, 77, 77, 49, 0,233, 2, 0, 0, 78, 50, 69, 83, 77, 65, 53, /* 0x bd0 */ + 48, 0,233, 2, 0, 0, 78, 50, 69, 70, 65, 83, 53, 48, 0,235, /* 0x be0 */ + 2, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, 0,238, 2, 0, 0, /* 0x bf0 */ + 78, 50, 69, 83, 77, 65, 54, 48, 0,247, 2, 0, 0, 0, 0, 0, /* 0x c00 */ + 0, 5, 3, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 0, 0, 0, /* 0x c10 */ + 0, 0, 78, 50, 69, 70, 65, 83, 54, 48, 0, 5, 3, 0, 0, 0, /* 0x c20 */ + 0, 0, 0, 13, 3, 0, 0, 78, 50, 69, 70, 65, 83, 54, 49, 0, /* 0x c30 */ + 0, 0, 0, 0, 0, 0, 0, 0, 27, 3, 0, 0, 78, 50, 69, 68, /* 0x c40 */ + 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, /* 0x c50 */ + 49, 0, 27, 3, 0, 0, 0, 0, 0, 0, 49, 3, 0, 0, 78, 50, /* 0x c60 */ + 69, 68, 69, 67, 49, 48, 0, 0, 0, 0, 0, 78, 50, 69, 68, 69, /* 0x c70 */ + 67, 54, 48, 0, 49, 3, 0, 0, 78, 82, 86, 50, 69, 69, 78, 68, /* 0x c80 */ + 0, 49, 3, 0, 0, 80, 69, 77, 85, 76, 84, 73, 80, 0, 49, 3, /* 0x c90 */ + 0, 0, 0, 0, 0, 0, 58, 3, 0, 0, 80, 69, 77, 65, 73, 78, /* 0x ca0 */ + 48, 50, 0, 1, 0, 0, 0, 80, 69, 77, 65, 73, 78, 49, 48, 0, /* 0x cb0 */ + 58, 3, 0, 0, 80, 69, 67, 65, 76, 76, 84, 82, 0, 59, 3, 0, /* 0x cc0 */ + 0, 80, 69, 67, 84, 84, 80, 79, 83, 0, 59, 3, 0, 0, 80, 69, /* 0x cd0 */ + 67, 84, 84, 78, 85, 76, 0, 65, 3, 0, 0, 80, 69, 68, 85, 77, /* 0x ce0 */ + 77, 89, 48, 0, 67, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, /* 0x cf0 */ + 0, 67, 3, 0, 0, 67, 84, 67, 76, 69, 86, 69, 49, 0, 81, 3, /* 0x d00 */ + 0, 0, 0, 0, 0, 0, 86, 3, 0, 0, 67, 65, 76, 76, 84, 82, /* 0x d10 */ + 48, 48, 0, 5, 0, 0, 0, 67, 65, 76, 76, 84, 82, 48, 49, 0, /* 0x d20 */ + 86, 3, 0, 0, 67, 84, 68, 85, 77, 77, 89, 49, 0, 91, 3, 0, /* 0x d30 */ + 0, 67, 84, 66, 83, 72, 82, 48, 49, 0, 91, 3, 0, 0, 67, 84, /* 0x d40 */ + 66, 82, 79, 82, 48, 49, 0, 95, 3, 0, 0, 67, 84, 66, 83, 87, /* 0x d50 */ + 65, 48, 49, 0, 97, 3, 0, 0, 67, 65, 76, 76, 84, 82, 48, 50, /* 0x d60 */ + 0,102, 3, 0, 0, 0, 0, 0, 0,118, 3, 0, 0, 67, 65, 76, /* 0x d70 */ + 76, 84, 82, 48, 48, 0, 10, 0, 0, 0, 67, 65, 76, 76, 84, 82, /* 0x d80 */ + 49, 48, 0,118, 3, 0, 0, 67, 65, 76, 76, 84, 82, 69, 56, 0, /* 0x d90 */ +123, 3, 0, 0, 67, 65, 76, 76, 84, 82, 69, 57, 0,125, 3, 0, /* 0x da0 */ + 0, 67, 65, 76, 76, 84, 82, 49, 49, 0,127, 3, 0, 0, 0, 0, /* 0x db0 */ + 0, 0,131, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0, 7, /* 0x dc0 */ + 0, 0, 0, 67, 84, 67, 76, 69, 86, 69, 50, 0,131, 3, 0, 0, /* 0x dd0 */ + 0, 0, 0, 0,136, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, /* 0x de0 */ + 0, 0, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 50, 0,136, 3, /* 0x df0 */ + 0, 0, 67, 84, 68, 85, 77, 77, 89, 50, 0,138, 3, 0, 0, 67, /* 0x e00 */ + 84, 66, 83, 72, 82, 49, 49, 0,138, 3, 0, 0, 67, 84, 66, 82, /* 0x e10 */ + 79, 82, 49, 49, 0,142, 3, 0, 0, 67, 84, 66, 83, 87, 65, 49, /* 0x e20 */ + 49, 0,144, 3, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51, 0,149, /* 0x e30 */ + 3, 0, 0, 0, 0, 0, 0,156, 3, 0, 0, 67, 65, 76, 76, 84, /* 0x e40 */ + 82, 49, 48, 0, 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, 68, /* 0x e50 */ + 0,156, 3, 0, 0, 80, 69, 68, 85, 77, 77, 89, 49, 0,156, 3, /* 0x e60 */ + 0, 0, 80, 69, 73, 77, 80, 79, 82, 84, 0,156, 3, 0, 0, 0, /* 0x e70 */ + 0, 0, 0,168, 3, 0, 0, 80, 69, 73, 77, 68, 79, 78, 69, 0, /* 0x e80 */ + 0, 0, 0, 0, 80, 69, 73, 66, 89, 79, 82, 68, 0,200, 3, 0, /* 0x e90 */ + 0, 0, 0, 0, 0,202, 3, 0, 0, 80, 69, 73, 77, 79, 82, 68, /* 0x ea0 */ + 49, 0, 7, 0, 0, 0, 80, 69, 75, 51, 50, 79, 82, 68, 0,202, /* 0x eb0 */ + 3, 0, 0, 0, 0, 0, 0,218, 3, 0, 0, 80, 69, 73, 77, 80, /* 0x ec0 */ + 79, 82, 50, 0, 15, 0, 0, 0, 80, 69, 73, 77, 79, 82, 68, 49, /* 0x ed0 */ + 0,218, 3, 0, 0, 80, 69, 73, 77, 80, 79, 82, 50, 0,225, 3, /* 0x ee0 */ + 0, 0, 0, 0, 0, 0,247, 3, 0, 0, 80, 69, 73, 77, 80, 79, /* 0x ef0 */ + 82, 84, 0, 35, 0, 0, 0, 80, 69, 73, 69, 82, 68, 76, 76, 0, /* 0x f00 */ +247, 3, 0, 0, 80, 69, 73, 69, 82, 69, 88, 69, 0,253, 3, 0, /* 0x f10 */ + 0, 80, 69, 73, 77, 68, 79, 78, 69, 0, 3, 4, 0, 0, 80, 69, /* 0x f20 */ + 73, 77, 80, 79, 82, 57, 0, 3, 4, 0, 0, 80, 69, 82, 69, 76, /* 0x f30 */ + 79, 67, 49, 0, 3, 4, 0, 0, 80, 69, 82, 69, 76, 79, 67, 50, /* 0x f40 */ + 0, 9, 4, 0, 0, 80, 69, 82, 69, 76, 79, 67, 51, 0, 12, 4, /* 0x f50 */ + 0, 0, 82, 69, 76, 79, 67, 51, 50, 48, 0, 15, 4, 0, 0, 0, /* 0x f60 */ + 0, 0, 0, 24, 4, 0, 0, 82, 69, 76, 79, 67, 51, 50, 74, 0, /* 0x f70 */ + 2, 0, 0, 0, 82, 69, 76, 51, 50, 66, 73, 71, 0, 56, 4, 0, /* 0x f80 */ + 0, 0, 0, 0, 0, 60, 4, 0, 0, 82, 69, 76, 79, 67, 51, 50, /* 0x f90 */ + 48, 0, 13, 0, 0, 0, 82, 69, 76, 79, 67, 51, 50, 74, 0, 65, /* 0x fa0 */ + 4, 0, 0, 0, 0, 0, 0, 67, 4, 0, 0, 82, 69, 76, 79, 67, /* 0x fb0 */ + 51, 50, 48, 0, 13, 0, 0, 0, 82, 69, 76, 51, 50, 69, 78, 68, /* 0x fc0 */ + 0, 67, 4, 0, 0, 80, 69, 82, 69, 76, 79, 67, 57, 0, 67, 4, /* 0x fd0 */ + 0, 0, 80, 69, 82, 76, 79, 72, 73, 48, 0, 67, 4, 0, 0, 80, /* 0x fe0 */ + 69, 82, 76, 79, 72, 73, 90, 0, 75, 4, 0, 0, 80, 69, 82, 69, /* 0x ff0 */ + 76, 76, 79, 48, 0, 75, 4, 0, 0, 80, 69, 82, 69, 76, 76, 79, /* 0x1000 */ + 90, 0, 85, 4, 0, 0, 80, 69, 82, 69, 76, 72, 73, 48, 0, 85, /* 0x1010 */ + 4, 0, 0, 80, 69, 82, 69, 76, 72, 73, 90, 0, 98, 4, 0, 0, /* 0x1020 */ + 80, 69, 68, 69, 80, 72, 65, 75, 0, 98, 4, 0, 0, 80, 69, 68, /* 0x1030 */ + 69, 80, 72, 65, 88, 0,145, 4, 0, 0, 80, 69, 77, 65, 73, 78, /* 0x1040 */ + 50, 48, 0,145, 4, 0, 0, 80, 69, 82, 69, 84, 85, 82, 78, 95, /* 0x1050 */ + 67, 76, 69, 65, 82, 83, 84, 65, 67, 75, 0,146, 4, 0, 0, 80, /* 0x1060 */ + 69, 82, 69, 84, 85, 82, 78, 95, 67, 76, 69, 65, 82, 83, 84, 65, /* 0x1070 */ + 67, 75, 57, 0,159, 4, 0, 0, 80, 69, 68, 79, 74, 85, 77, 80, /* 0x1080 */ + 95, 67, 76, 69, 65, 82, 83, 84, 65, 67, 75, 0,159, 4, 0, 0, /* 0x1090 */ + 80, 69, 68, 79, 74, 85, 77, 80, 95, 67, 76, 69, 65, 82, 83, 84, /* 0x10a0 */ + 65, 67, 75, 57, 0,172, 4, 0, 0, 80, 69, 77, 65, 73, 78, 50, /* 0x10b0 */ + 49, 0,172, 4, 0, 0, 80, 69, 82, 69, 84, 85, 82, 78, 0,172, /* 0x10c0 */ + 4, 0, 0, 80, 69, 68, 79, 74, 85, 77, 80, 0,178, 4, 0, 0, /* 0x10d0 */ + 80, 69, 68, 85, 77, 77, 89, 51, 0,183, 4, 0, 0, 85, 80, 88, /* 0x10e0 */ + 49, 72, 69, 65, 68, 0,183, 4, 0, 0, 80, 69, 84, 72, 69, 69, /* 0x10f0 */ + 78, 68, 0,215, 4, 0, 0,255,255,255,255,215, 4 /* 0x1100 */ +}; diff --git a/src/stub/m68k-atari.tos-nrv2b.h b/src/stub/m68k-atari.tos-nrv2b.h new file mode 100644 index 00000000..7bf5af70 --- /dev/null +++ b/src/stub/m68k-atari.tos-nrv2b.h @@ -0,0 +1,77 @@ +/* m68k-atari.tos-nrv2b.h -- created from m68k-atari.tos-nrv2b.bin, 668 (0x29c) 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 + + */ + + +#define NRV2B_LOADER_SIZE 668 +#define NRV2B_LOADER_ADLER32 0x36bbef0f +#define NRV2B_LOADER_CRC32 0x4f682ad4 + +unsigned char nrv2b_loader[668] = { + 32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */ +127,254, 36, 64, 80,138, 44, 90, 40, 14, 36,188,117,112, 49, 49, /* 0x 10 */ +221,218, 36,206, 36,188,117,112, 49, 50,221,218, 40, 82, 36,206, /* 0x 20 */ + 36,188,117,112, 49, 51, 38, 68,215,252,117,112, 50, 49, 32, 60, /* 0x 30 */ +117,112, 50, 50, 73,236,255, 96, 76,236, 39,238, 0,120, 72,227, /* 0x 40 */ +119,228, 76,236, 39,238, 0, 80, 72,227,119,228, 76,236, 39,238, /* 0x 50 */ + 0, 40, 72,227,119,228, 76,212, 39,238, 72,227,119,228,117, 49, /* 0x 60 */ +102,210,117, 50, 39, 36, 81,200,255,252, 69,250, 0,188, 47, 4, /* 0x 70 */ +122, 73, 63, 34, 83,133,100,250, 63,124, 78,113, 0,130, 97, 32, /* 0x 80 */ + 40, 68,112,128,126,255,124,152,235, 78, 36, 68,213,252,117,112, /* 0x 90 */ + 51, 49, 78,210, 44,195, 44,195, 44,195, 44,195,117, 52,102,244, /* 0x a0 */ + 72,120,255,255, 66,167, 47, 60, 1, 84, 0, 22, 78, 65, 79,239, /* 0x b0 */ + 0, 12, 74,128,103, 96, 72,122, 0, 16, 63, 60, 0, 38, 78, 78, /* 0x c0 */ + 92,143, 96, 82, 46, 73, 78,208, 47, 56, 0, 16, 47, 56, 0, 44, /* 0x d0 */ + 47, 56, 0,244, 34, 79, 65,250,255,236, 33,200, 0, 16, 33,200, /* 0x e0 */ + 0, 44, 33,200, 0,244, 78,113, 65,250, 0, 6,244,248, 96, 22, /* 0x f0 */ + 65,250, 0, 20, 78,122, 0, 2, 34, 0, 0, 65, 8, 8, 78,123, /* 0x 100 */ + 16, 2, 78,123, 0, 2, 33,223, 0,244, 33,223, 0, 44, 33,223, /* 0x 110 */ + 0, 16, 78,113, 78,117, 78,117, 79,239, 0,152, 76,223,127,254, /* 0x 120 */ + 32, 8,103, 2,159,207, 78,249, 10, 0, 36, 73,110,102,111, 58, /* 0x 130 */ + 32, 84,104,105,115, 32,102,105,108,101, 32,105,115, 32,112, 97, /* 0x 140 */ + 99,107,101,100, 32,119,105,116,104, 32,116,104,101, 32, 85, 80, /* 0x 150 */ + 88, 32,101,120,101, 99,117,116, 97, 98,108,101, 32,112, 97, 99, /* 0x 160 */ +107,101,114, 32,104,116,116,112, 58, 47, 47,117,112,120, 46,115, /* 0x 170 */ +102, 46,110,101,116, 32, 36, 10, 0, 36, 73,100, 58, 32, 85, 80, /* 0x 180 */ + 88, 32, 85, 80, 88, 86, 32, 67,111,112,121,114,105,103,104,116, /* 0x 190 */ + 32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116, /* 0x 1a0 */ +104,101, 32, 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108,108, /* 0x 1b0 */ + 32, 82,105,103,104,116,115, 32, 82,101,115,101,114,118,101,100, /* 0x 1c0 */ + 46, 32, 36, 10, 0, 0, 0, 0, 85, 80, 88, 33,161,216,208,213, /* 0x 1d0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 1e0 */ + 0, 0, 0, 0, 0, 0, 0, 45, 24,219,208, 0,100, 8,102,248, /* 0x 1f0 */ + 16, 27,209, 0,101,242,114, 1,118, 0,208, 0,102, 4, 16, 27, /* 0x 200 */ +209, 0,211,129,208, 0,100,242,102, 6, 16, 27,209, 0,100,234, /* 0x 210 */ + 87,129,101, 10,225,137, 18, 27, 70,129,103, 72, 42, 1,208, 0, /* 0x 220 */ +102, 4, 16, 27,209, 0,215, 67,208, 0,102, 4, 16, 27,209, 0, /* 0x 230 */ +215, 67, 74, 67,102, 26, 82, 67,208, 0,102, 4, 16, 27,209, 0, /* 0x 240 */ +215, 67,208, 0,100,242,102, 6, 16, 27,209, 0,100,234, 84, 67, /* 0x 250 */ + 69,244, 88, 0, 34, 5,146,134,215, 71, 24,218, 24,218, 81,203, /* 0x 260 */ +255,252, 96,134, 44, 60,117,112, 52, 49,117, 51, 32, 78, 34, 68, /* 0x 270 */ +211,216,211,195,217,145, 22, 24,103, 10,182, 5,102,244, 67,233, /* 0x 280 */ + 0,254, 96,242, 78,215, 1,248, 0,158, 0, 2 /* 0x 290 */ +}; diff --git a/src/stub/m68k-atari.tos-nrv2b.small.h b/src/stub/m68k-atari.tos-nrv2b.small.h new file mode 100644 index 00000000..2c072dfa --- /dev/null +++ b/src/stub/m68k-atari.tos-nrv2b.small.h @@ -0,0 +1,69 @@ +/* m68k-atari.tos-nrv2b.small.h -- created from m68k-atari.tos-nrv2b.small.bin, 530 (0x212) 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 + + */ + + +#define NRV2B_LOADER_SMALL_SIZE 530 +#define NRV2B_LOADER_SMALL_ADLER32 0x6843b39e +#define NRV2B_LOADER_SMALL_CRC32 0x68e5d2d4 + +unsigned char nrv2b_loader_small[530] = { + 32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */ +127,254, 36, 64, 80,138, 44, 90, 40, 14, 36,188,117,112, 49, 49, /* 0x 10 */ +221,218, 36,206, 36,188,117,112, 49, 50,221,218, 40, 82, 36,206, /* 0x 20 */ + 36,188,117,112, 49, 51, 38, 68,215,252,117,112, 50, 49, 32, 60, /* 0x 30 */ +117,112, 50, 50, 39, 36,117, 49,102,250, 69,250, 0,182, 47, 4, /* 0x 40 */ +122, 70, 63, 34, 83,133,100,250, 63,124, 78,113, 0,124, 97, 26, /* 0x 50 */ + 40, 68,112,128,126,255,124,152,235, 78, 36, 68,213,252,117,112, /* 0x 60 */ + 51, 49, 78,210, 44,195,117, 52,102,250, 72,120,255,255, 66,167, /* 0x 70 */ + 47, 60, 1, 84, 0, 22, 78, 65, 79,239, 0, 12, 74,128,103, 96, /* 0x 80 */ + 72,122, 0, 16, 63, 60, 0, 38, 78, 78, 92,143, 96, 82, 46, 73, /* 0x 90 */ + 78,208, 47, 56, 0, 16, 47, 56, 0, 44, 47, 56, 0,244, 34, 79, /* 0x a0 */ + 65,250,255,236, 33,200, 0, 16, 33,200, 0, 44, 33,200, 0,244, /* 0x b0 */ + 78,113, 65,250, 0, 6,244,248, 96, 22, 65,250, 0, 20, 78,122, /* 0x c0 */ + 0, 2, 34, 0, 0, 65, 8, 8, 78,123, 16, 2, 78,123, 0, 2, /* 0x d0 */ + 33,223, 0,244, 33,223, 0, 44, 33,223, 0, 16, 78,113, 78,117, /* 0x e0 */ + 78,117, 79,239, 0,146, 76,223,127,254, 32, 8,103, 2,159,207, /* 0x f0 */ + 78,249, 10, 36, 73,100, 58, 32, 85, 80, 88, 32, 40, 67, 41, 32, /* 0x 100 */ + 49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116,104,101, 32, 85, 80, /* 0x 110 */ + 88, 32, 84,101, 97,109, 46, 32, 65,108,108, 32, 82,105,103,104, /* 0x 120 */ +116,115, 32, 82,101,115,101,114,118,101,100, 46, 32,104,116,116, /* 0x 130 */ +112, 58, 47, 47,117,112,120, 46,115,102, 46,110,101,116, 32, 36, /* 0x 140 */ + 10, 0, 0, 0, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, /* 0x 150 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 160 */ + 0, 0, 0, 45, 24,219,208, 0,102, 4, 16, 27,209, 0,101,244, /* 0x 170 */ +114, 1,118, 0,208, 0,102, 4, 16, 27,209, 0,211,129,208, 0, /* 0x 180 */ +102, 4, 16, 27,209, 0,100,236, 87,129,101, 10,225,137, 18, 27, /* 0x 190 */ + 70,129,103, 70, 42, 1,208, 0,102, 4, 16, 27,209, 0,215, 67, /* 0x 1a0 */ +208, 0,102, 4, 16, 27,209, 0,215, 67, 74, 67,102, 24, 82, 67, /* 0x 1b0 */ +208, 0,102, 4, 16, 27,209, 0,215, 67,208, 0,102, 4, 16, 27, /* 0x 1c0 */ +209, 0,100,236, 84, 67, 69,244, 88, 0, 34, 5,146,134,215, 71, /* 0x 1d0 */ + 24,218, 24,218, 81,203,255,252, 96,140, 44, 60,117,112, 52, 49, /* 0x 1e0 */ +117, 51, 32, 78, 34, 68,211,216,211,195,217,145, 22, 24,103, 10, /* 0x 1f0 */ +182, 5,102,244, 67,233, 0,254, 96,242, 78,215, 1,116, 0,152, /* 0x 200 */ + 0, 2 /* 0x 210 */ +}; diff --git a/src/stub/m68k-atari.tos-nrv2d.h b/src/stub/m68k-atari.tos-nrv2d.h new file mode 100644 index 00000000..3696a968 --- /dev/null +++ b/src/stub/m68k-atari.tos-nrv2d.h @@ -0,0 +1,78 @@ +/* m68k-atari.tos-nrv2d.h -- created from m68k-atari.tos-nrv2d.bin, 688 (0x2b0) 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 + + */ + + +#define NRV2D_LOADER_SIZE 688 +#define NRV2D_LOADER_ADLER32 0x1785f4ed +#define NRV2D_LOADER_CRC32 0xecd288cc + +unsigned char nrv2d_loader[688] = { + 32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */ +127,254, 36, 64, 80,138, 44, 90, 40, 14, 36,188,117,112, 49, 49, /* 0x 10 */ +221,218, 36,206, 36,188,117,112, 49, 50,221,218, 40, 82, 36,206, /* 0x 20 */ + 36,188,117,112, 49, 51, 38, 68,215,252,117,112, 50, 49, 32, 60, /* 0x 30 */ +117,112, 50, 50, 73,236,255, 96, 76,236, 39,238, 0,120, 72,227, /* 0x 40 */ +119,228, 76,236, 39,238, 0, 80, 72,227,119,228, 76,236, 39,238, /* 0x 50 */ + 0, 40, 72,227,119,228, 76,212, 39,238, 72,227,119,228,117, 49, /* 0x 60 */ +102,210,117, 50, 39, 36, 81,200,255,252, 69,250, 0,188, 47, 4, /* 0x 70 */ +122, 73, 63, 34, 83,133,100,250, 63,124, 78,113, 0,130, 97, 32, /* 0x 80 */ + 40, 68,112,128,126,255,124,176,233, 78, 36, 68,213,252,117,112, /* 0x 90 */ + 51, 49, 78,210, 44,195, 44,195, 44,195, 44,195,117, 52,102,244, /* 0x a0 */ + 72,120,255,255, 66,167, 47, 60, 1, 84, 0, 22, 78, 65, 79,239, /* 0x b0 */ + 0, 12, 74,128,103, 96, 72,122, 0, 16, 63, 60, 0, 38, 78, 78, /* 0x c0 */ + 92,143, 96, 82, 46, 73, 78,208, 47, 56, 0, 16, 47, 56, 0, 44, /* 0x d0 */ + 47, 56, 0,244, 34, 79, 65,250,255,236, 33,200, 0, 16, 33,200, /* 0x e0 */ + 0, 44, 33,200, 0,244, 78,113, 65,250, 0, 6,244,248, 96, 22, /* 0x f0 */ + 65,250, 0, 20, 78,122, 0, 2, 34, 0, 0, 65, 8, 8, 78,123, /* 0x 100 */ + 16, 2, 78,123, 0, 2, 33,223, 0,244, 33,223, 0, 44, 33,223, /* 0x 110 */ + 0, 16, 78,113, 78,117, 78,117, 79,239, 0,152, 76,223,127,254, /* 0x 120 */ + 32, 8,103, 2,159,207, 78,249, 10, 0, 36, 73,110,102,111, 58, /* 0x 130 */ + 32, 84,104,105,115, 32,102,105,108,101, 32,105,115, 32,112, 97, /* 0x 140 */ + 99,107,101,100, 32,119,105,116,104, 32,116,104,101, 32, 85, 80, /* 0x 150 */ + 88, 32,101,120,101, 99,117,116, 97, 98,108,101, 32,112, 97, 99, /* 0x 160 */ +107,101,114, 32,104,116,116,112, 58, 47, 47,117,112,120, 46,115, /* 0x 170 */ +102, 46,110,101,116, 32, 36, 10, 0, 36, 73,100, 58, 32, 85, 80, /* 0x 180 */ + 88, 32, 85, 80, 88, 86, 32, 67,111,112,121,114,105,103,104,116, /* 0x 190 */ + 32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116, /* 0x 1a0 */ +104,101, 32, 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108,108, /* 0x 1b0 */ + 32, 82,105,103,104,116,115, 32, 82,101,115,101,114,118,101,100, /* 0x 1c0 */ + 46, 32, 36, 10, 0, 0, 0, 0, 85, 80, 88, 33,161,216,208,213, /* 0x 1d0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 1e0 */ + 0, 0, 0, 0, 0, 0, 0, 45, 24,219,208, 0,100, 8,102,248, /* 0x 1f0 */ + 16, 27,209, 0,101,242,114, 1,118, 0,208, 0,102, 4, 16, 27, /* 0x 200 */ +209, 0,211, 65,208, 0,100, 8,102, 22, 16, 27,209, 0,101, 16, /* 0x 210 */ + 83, 65,208, 0,102, 4, 16, 27,209, 0,211, 65,106,220, 96, 88, /* 0x 220 */ + 87, 65,101, 12,225,137, 18, 27, 70,129,226,129, 42, 1, 96, 8, /* 0x 230 */ +208, 0,102, 4, 16, 27,209, 0,215, 67,208, 0,102, 4, 16, 27, /* 0x 240 */ +209, 0,215, 67, 74, 67,102, 26, 82, 67,208, 0,102, 4, 16, 27, /* 0x 250 */ +209, 0,215, 67,208, 0,100,242,102, 6, 16, 27,209, 0,100,234, /* 0x 260 */ + 84, 67, 69,244, 88, 0, 34, 5,146,134,215, 71, 24,218, 24,218, /* 0x 270 */ + 81,203,255,252, 96, 0,255,116, 44, 60,117,112, 52, 49,117, 51, /* 0x 280 */ + 32, 78, 34, 68,211,216,211,195,217,145, 22, 24,103, 10,182, 5, /* 0x 290 */ +102,244, 67,233, 0,254, 96,242, 78,215, 1,248, 0,178, 0, 2 /* 0x 2a0 */ +}; diff --git a/src/stub/m68k-atari.tos-nrv2d.small.h b/src/stub/m68k-atari.tos-nrv2d.small.h new file mode 100644 index 00000000..81ed2fde --- /dev/null +++ b/src/stub/m68k-atari.tos-nrv2d.small.h @@ -0,0 +1,70 @@ +/* m68k-atari.tos-nrv2d.small.h -- created from m68k-atari.tos-nrv2d.small.bin, 550 (0x226) 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 + + */ + + +#define NRV2D_LOADER_SMALL_SIZE 550 +#define NRV2D_LOADER_SMALL_ADLER32 0x3655ba56 +#define NRV2D_LOADER_SMALL_CRC32 0x7bba64b7 + +unsigned char nrv2d_loader_small[550] = { + 32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */ +127,254, 36, 64, 80,138, 44, 90, 40, 14, 36,188,117,112, 49, 49, /* 0x 10 */ +221,218, 36,206, 36,188,117,112, 49, 50,221,218, 40, 82, 36,206, /* 0x 20 */ + 36,188,117,112, 49, 51, 38, 68,215,252,117,112, 50, 49, 32, 60, /* 0x 30 */ +117,112, 50, 50, 39, 36,117, 49,102,250, 69,250, 0,182, 47, 4, /* 0x 40 */ +122, 70, 63, 34, 83,133,100,250, 63,124, 78,113, 0,124, 97, 26, /* 0x 50 */ + 40, 68,112,128,126,255,124,176,233, 78, 36, 68,213,252,117,112, /* 0x 60 */ + 51, 49, 78,210, 44,195,117, 52,102,250, 72,120,255,255, 66,167, /* 0x 70 */ + 47, 60, 1, 84, 0, 22, 78, 65, 79,239, 0, 12, 74,128,103, 96, /* 0x 80 */ + 72,122, 0, 16, 63, 60, 0, 38, 78, 78, 92,143, 96, 82, 46, 73, /* 0x 90 */ + 78,208, 47, 56, 0, 16, 47, 56, 0, 44, 47, 56, 0,244, 34, 79, /* 0x a0 */ + 65,250,255,236, 33,200, 0, 16, 33,200, 0, 44, 33,200, 0,244, /* 0x b0 */ + 78,113, 65,250, 0, 6,244,248, 96, 22, 65,250, 0, 20, 78,122, /* 0x c0 */ + 0, 2, 34, 0, 0, 65, 8, 8, 78,123, 16, 2, 78,123, 0, 2, /* 0x d0 */ + 33,223, 0,244, 33,223, 0, 44, 33,223, 0, 16, 78,113, 78,117, /* 0x e0 */ + 78,117, 79,239, 0,146, 76,223,127,254, 32, 8,103, 2,159,207, /* 0x f0 */ + 78,249, 10, 36, 73,100, 58, 32, 85, 80, 88, 32, 40, 67, 41, 32, /* 0x 100 */ + 49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116,104,101, 32, 85, 80, /* 0x 110 */ + 88, 32, 84,101, 97,109, 46, 32, 65,108,108, 32, 82,105,103,104, /* 0x 120 */ +116,115, 32, 82,101,115,101,114,118,101,100, 46, 32,104,116,116, /* 0x 130 */ +112, 58, 47, 47,117,112,120, 46,115,102, 46,110,101,116, 32, 36, /* 0x 140 */ + 10, 0, 0, 0, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, /* 0x 150 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 160 */ + 0, 0, 0, 45, 24,219,208, 0,102, 4, 16, 27,209, 0,101,244, /* 0x 170 */ +114, 1,118, 0,208, 0,102, 4, 16, 27,209, 0,211, 65,208, 0, /* 0x 180 */ +102, 4, 16, 27,209, 0,101, 16, 83, 65,208, 0,102, 4, 16, 27, /* 0x 190 */ +209, 0,211, 65,106,222, 96, 86, 87, 65,101, 12,225,137, 18, 27, /* 0x 1a0 */ + 70,129,226,129, 42, 1, 96, 8,208, 0,102, 4, 16, 27,209, 0, /* 0x 1b0 */ +215, 67,208, 0,102, 4, 16, 27,209, 0,215, 67, 74, 67,102, 24, /* 0x 1c0 */ + 82, 67,208, 0,102, 4, 16, 27,209, 0,215, 67,208, 0,102, 4, /* 0x 1d0 */ + 16, 27,209, 0,100,236, 84, 67, 69,244, 88, 0, 34, 5,146,134, /* 0x 1e0 */ +215, 71, 24,218, 24,218, 81,203,255,252, 96, 0,255,122, 44, 60, /* 0x 1f0 */ +117,112, 52, 49,117, 51, 32, 78, 34, 68,211,216,211,195,217,145, /* 0x 200 */ + 22, 24,103, 10,182, 5,102,244, 67,233, 0,254, 96,242, 78,215, /* 0x 210 */ + 1,116, 0,172, 0, 2 /* 0x 220 */ +}; diff --git a/src/stub/m68k-atari.tos-nrv2e.h b/src/stub/m68k-atari.tos-nrv2e.h new file mode 100644 index 00000000..af2fd8a9 --- /dev/null +++ b/src/stub/m68k-atari.tos-nrv2e.h @@ -0,0 +1,79 @@ +/* m68k-atari.tos-nrv2e.h -- created from m68k-atari.tos-nrv2e.bin, 696 (0x2b8) 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 + + */ + + +#define NRV2E_LOADER_SIZE 696 +#define NRV2E_LOADER_ADLER32 0xa0e6f701 +#define NRV2E_LOADER_CRC32 0x1d26a023 + +unsigned char nrv2e_loader[696] = { + 32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */ +127,254, 36, 64, 80,138, 44, 90, 40, 14, 36,188,117,112, 49, 49, /* 0x 10 */ +221,218, 36,206, 36,188,117,112, 49, 50,221,218, 40, 82, 36,206, /* 0x 20 */ + 36,188,117,112, 49, 51, 38, 68,215,252,117,112, 50, 49, 32, 60, /* 0x 30 */ +117,112, 50, 50, 73,236,255, 96, 76,236, 39,238, 0,120, 72,227, /* 0x 40 */ +119,228, 76,236, 39,238, 0, 80, 72,227,119,228, 76,236, 39,238, /* 0x 50 */ + 0, 40, 72,227,119,228, 76,212, 39,238, 72,227,119,228,117, 49, /* 0x 60 */ +102,210,117, 50, 39, 36, 81,200,255,252, 69,250, 0,188, 47, 4, /* 0x 70 */ +122, 73, 63, 34, 83,133,100,250, 63,124, 78,113, 0,130, 97, 32, /* 0x 80 */ + 40, 68,112,128,126, 0,124,176,233, 78, 36, 68,213,252,117,112, /* 0x 90 */ + 51, 49, 78,210, 44,195, 44,195, 44,195, 44,195,117, 52,102,244, /* 0x a0 */ + 72,120,255,255, 66,167, 47, 60, 1, 84, 0, 22, 78, 65, 79,239, /* 0x b0 */ + 0, 12, 74,128,103, 96, 72,122, 0, 16, 63, 60, 0, 38, 78, 78, /* 0x c0 */ + 92,143, 96, 82, 46, 73, 78,208, 47, 56, 0, 16, 47, 56, 0, 44, /* 0x d0 */ + 47, 56, 0,244, 34, 79, 65,250,255,236, 33,200, 0, 16, 33,200, /* 0x e0 */ + 0, 44, 33,200, 0,244, 78,113, 65,250, 0, 6,244,248, 96, 22, /* 0x f0 */ + 65,250, 0, 20, 78,122, 0, 2, 34, 0, 0, 65, 8, 8, 78,123, /* 0x 100 */ + 16, 2, 78,123, 0, 2, 33,223, 0,244, 33,223, 0, 44, 33,223, /* 0x 110 */ + 0, 16, 78,113, 78,117, 78,117, 79,239, 0,152, 76,223,127,254, /* 0x 120 */ + 32, 8,103, 2,159,207, 78,249, 10, 0, 36, 73,110,102,111, 58, /* 0x 130 */ + 32, 84,104,105,115, 32,102,105,108,101, 32,105,115, 32,112, 97, /* 0x 140 */ + 99,107,101,100, 32,119,105,116,104, 32,116,104,101, 32, 85, 80, /* 0x 150 */ + 88, 32,101,120,101, 99,117,116, 97, 98,108,101, 32,112, 97, 99, /* 0x 160 */ +107,101,114, 32,104,116,116,112, 58, 47, 47,117,112,120, 46,115, /* 0x 170 */ +102, 46,110,101,116, 32, 36, 10, 0, 36, 73,100, 58, 32, 85, 80, /* 0x 180 */ + 88, 32, 85, 80, 88, 86, 32, 67,111,112,121,114,105,103,104,116, /* 0x 190 */ + 32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116, /* 0x 1a0 */ +104,101, 32, 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108,108, /* 0x 1b0 */ + 32, 82,105,103,104,116,115, 32, 82,101,115,101,114,118,101,100, /* 0x 1c0 */ + 46, 32, 36, 10, 0, 0, 0, 0, 85, 80, 88, 33,161,216,208,213, /* 0x 1d0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 1e0 */ + 0, 0, 0, 0, 0, 0, 0, 45, 24,219,208, 0,100, 8,102,248, /* 0x 1f0 */ + 16, 27,209, 0,101,242,114, 1,118, 0,208, 0,102, 4, 16, 27, /* 0x 200 */ +209, 0,211, 65,208, 0,100, 8,102, 22, 16, 27,209, 0,101, 16, /* 0x 210 */ + 83, 65,208, 0,102, 4, 16, 27,209, 0,211, 65,106,220, 96, 96, /* 0x 220 */ + 87, 65,101, 22,225,137, 18, 27, 70,129,226,129,100, 24,208, 0, /* 0x 230 */ +102, 4, 16, 27,209, 0,215, 67, 96, 48, 34, 5,208, 0,102, 4, /* 0x 240 */ + 16, 27,209, 0,101,232, 82, 67,208, 0,102, 4, 16, 27,209, 0, /* 0x 250 */ +101,220,208, 0,102, 4, 16, 27,209, 0,215, 67,208, 0,100,242, /* 0x 260 */ +102, 6, 16, 27,209, 0,100,234, 84, 67, 42, 1, 69,244, 24, 0, /* 0x 270 */ +146,134,215, 71, 24,218, 24,218, 81,203,255,252, 96, 0,255,108, /* 0x 280 */ + 44, 60,117,112, 52, 49,117, 51, 32, 78, 34, 68,211,216,211,195, /* 0x 290 */ +217,145, 22, 24,103, 10,182, 5,102,244, 67,233, 0,254, 96,242, /* 0x 2a0 */ + 78,215, 1,248, 0,186, 0, 2 /* 0x 2b0 */ +}; diff --git a/src/stub/m68k-atari.tos-nrv2e.small.h b/src/stub/m68k-atari.tos-nrv2e.small.h new file mode 100644 index 00000000..fc3b0693 --- /dev/null +++ b/src/stub/m68k-atari.tos-nrv2e.small.h @@ -0,0 +1,70 @@ +/* m68k-atari.tos-nrv2e.small.h -- created from m68k-atari.tos-nrv2e.small.bin, 558 (0x22e) 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 + + */ + + +#define NRV2E_LOADER_SMALL_SIZE 558 +#define NRV2E_LOADER_SMALL_ADLER32 0x4cabbc6a +#define NRV2E_LOADER_SMALL_CRC32 0xda3e6739 + +unsigned char nrv2e_loader_small[558] = { + 32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */ +127,254, 36, 64, 80,138, 44, 90, 40, 14, 36,188,117,112, 49, 49, /* 0x 10 */ +221,218, 36,206, 36,188,117,112, 49, 50,221,218, 40, 82, 36,206, /* 0x 20 */ + 36,188,117,112, 49, 51, 38, 68,215,252,117,112, 50, 49, 32, 60, /* 0x 30 */ +117,112, 50, 50, 39, 36,117, 49,102,250, 69,250, 0,182, 47, 4, /* 0x 40 */ +122, 70, 63, 34, 83,133,100,250, 63,124, 78,113, 0,124, 97, 26, /* 0x 50 */ + 40, 68,112,128,126, 0,124,176,233, 78, 36, 68,213,252,117,112, /* 0x 60 */ + 51, 49, 78,210, 44,195,117, 52,102,250, 72,120,255,255, 66,167, /* 0x 70 */ + 47, 60, 1, 84, 0, 22, 78, 65, 79,239, 0, 12, 74,128,103, 96, /* 0x 80 */ + 72,122, 0, 16, 63, 60, 0, 38, 78, 78, 92,143, 96, 82, 46, 73, /* 0x 90 */ + 78,208, 47, 56, 0, 16, 47, 56, 0, 44, 47, 56, 0,244, 34, 79, /* 0x a0 */ + 65,250,255,236, 33,200, 0, 16, 33,200, 0, 44, 33,200, 0,244, /* 0x b0 */ + 78,113, 65,250, 0, 6,244,248, 96, 22, 65,250, 0, 20, 78,122, /* 0x c0 */ + 0, 2, 34, 0, 0, 65, 8, 8, 78,123, 16, 2, 78,123, 0, 2, /* 0x d0 */ + 33,223, 0,244, 33,223, 0, 44, 33,223, 0, 16, 78,113, 78,117, /* 0x e0 */ + 78,117, 79,239, 0,146, 76,223,127,254, 32, 8,103, 2,159,207, /* 0x f0 */ + 78,249, 10, 36, 73,100, 58, 32, 85, 80, 88, 32, 40, 67, 41, 32, /* 0x 100 */ + 49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116,104,101, 32, 85, 80, /* 0x 110 */ + 88, 32, 84,101, 97,109, 46, 32, 65,108,108, 32, 82,105,103,104, /* 0x 120 */ +116,115, 32, 82,101,115,101,114,118,101,100, 46, 32,104,116,116, /* 0x 130 */ +112, 58, 47, 47,117,112,120, 46,115,102, 46,110,101,116, 32, 36, /* 0x 140 */ + 10, 0, 0, 0, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, /* 0x 150 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 160 */ + 0, 0, 0, 45, 24,219,208, 0,102, 4, 16, 27,209, 0,101,244, /* 0x 170 */ +114, 1,118, 0,208, 0,102, 4, 16, 27,209, 0,211, 65,208, 0, /* 0x 180 */ +102, 4, 16, 27,209, 0,101, 16, 83, 65,208, 0,102, 4, 16, 27, /* 0x 190 */ +209, 0,211, 65,106,222, 96, 94, 87, 65,101, 22,225,137, 18, 27, /* 0x 1a0 */ + 70,129,226,129,100, 24,208, 0,102, 4, 16, 27,209, 0,215, 67, /* 0x 1b0 */ + 96, 46, 34, 5,208, 0,102, 4, 16, 27,209, 0,101,232, 82, 67, /* 0x 1c0 */ +208, 0,102, 4, 16, 27,209, 0,101,220,208, 0,102, 4, 16, 27, /* 0x 1d0 */ +209, 0,215, 67,208, 0,102, 4, 16, 27,209, 0,100,236, 84, 67, /* 0x 1e0 */ + 42, 1, 69,244, 24, 0,146,134,215, 71, 24,218, 24,218, 81,203, /* 0x 1f0 */ +255,252, 96, 0,255,114, 44, 60,117,112, 52, 49,117, 51, 32, 78, /* 0x 200 */ + 34, 68,211,216,211,195,217,145, 22, 24,103, 10,182, 5,102,244, /* 0x 210 */ + 67,233, 0,254, 96,242, 78,215, 1,116, 0,180, 0, 2 /* 0x 220 */ +}; diff --git a/src/stub/mipsel.r3000-ps1-boot.h b/src/stub/mipsel.r3000-ps1-boot.h new file mode 100644 index 00000000..fc4ffff2 --- /dev/null +++ b/src/stub/mipsel.r3000-ps1-boot.h @@ -0,0 +1,281 @@ +/* mipsel.r3000-ps1-boot.h -- created from mipsel.r3000-ps1-boot.bin, 3935 (0xf5f) 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 + + */ + + +#define NRV_BOOT_LOADER_SIZE 3935 +#define NRV_BOOT_LOADER_ADLER32 0x07b10524 +#define NRV_BOOT_LOADER_CRC32 0x0ac25782 + +unsigned char nrv_boot_loader[3935] = { + 83, 80, 8, 60, 82, 86, 8, 53, 35, 64, 8, 2, 8, 0, 0, 1, /* 0x 0 */ +228,255,189, 39, 0, 0,164,175, 4, 0,165,175, 8, 0,166,175, /* 0x 10 */ + 12, 0,167,175, 16, 0,162,175, 20, 0,163,175, 24, 0,191,175, /* 0x 20 */ + 80, 67, 4, 60, 79, 68,132, 52, 69, 68, 6, 60, 79, 67,198, 52, /* 0x 30 */ + 69, 68, 6, 60, 33, 72, 0, 0, 1, 0, 11, 36, 33, 64,128, 0, /* 0x 40 */ +127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, /* 0x 50 */ + 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, /* 0x 60 */ + 1, 0, 66, 48, 6, 0, 64, 16, 1, 0, 3, 36, 0, 0, 2,145, /* 0x 70 */ + 1, 0, 8, 37, 0, 0,194,160,241,255, 0, 16, 1, 0,198, 36, /* 0x 80 */ +127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, /* 0x 90 */ + 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, /* 0x a0 */ + 1, 0, 66, 48, 64, 24, 3, 0, 33, 24, 98, 0,127, 0, 34, 49, /* 0x b0 */ + 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, /* 0x c0 */ + 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, /* 0x d0 */ +236,255, 64, 16,127, 0, 34, 49, 2, 0, 2, 36, 3, 0, 98, 20, /* 0x e0 */ +253,255, 99, 36, 9, 0, 0, 16, 33, 24, 96, 1, 0, 0, 2,145, /* 0x f0 */ + 1, 0, 8, 37, 0, 26, 3, 0, 33, 24, 98, 0,255,255, 2, 36, /* 0x 100 */ + 77, 0, 98, 16, 1, 0, 99, 36, 33, 88, 96, 0,127, 0, 34, 49, /* 0x 110 */ + 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 120 */ + 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, /* 0x 130 */ + 33, 96, 64, 0, 64, 96, 12, 0,127, 0, 34, 49, 5, 0, 64, 20, /* 0x 140 */ + 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, /* 0x 150 */ + 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, 33, 96,130, 1, /* 0x 160 */ + 26, 0,128, 21, 1, 13, 98, 44, 1, 0, 12, 36,127, 0, 34, 49, /* 0x 170 */ + 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 180 */ + 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, /* 0x 190 */ + 64, 96, 12, 0, 33, 96,130, 1,127, 0, 34, 49, 5, 0, 64, 20, /* 0x 1a0 */ + 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, /* 0x 1b0 */ + 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48,236,255, 64, 16, /* 0x 1c0 */ +127, 0, 34, 49, 2, 0,140, 37, 1, 13, 98, 44, 1, 0, 66, 56, /* 0x 1d0 */ + 33, 96,130, 1, 4, 0, 98, 40, 14, 0, 64, 20, 1, 0,140, 37, /* 0x 1e0 */ + 35, 24,195, 0, 4, 0,130, 41, 12, 0, 64, 20, 0, 0, 98,152, /* 0x 1f0 */ + 3, 0, 98,136,252,255,140, 37, 0, 0,194,184, 3, 0,194,168, /* 0x 200 */ + 4, 0, 99, 36,247,255,128, 21, 4, 0,198, 36,141,255, 0, 16, /* 0x 210 */ +127, 0, 34, 49, 35, 24,195, 0, 0, 0, 98,144,255,255,140, 37, /* 0x 220 */ + 0, 0,194,160, 1, 0, 99, 36,251,255,128, 21, 1, 0,198, 36, /* 0x 230 */ +132,255, 0, 16,127, 0, 34, 49, 33, 72, 0, 0, 1, 0, 11, 36, /* 0x 240 */ + 33, 64,128, 0,127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, /* 0x 250 */ + 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, /* 0x 260 */ + 2, 18, 9, 0, 1, 0, 66, 48, 6, 0, 64, 16, 1, 0, 3, 36, /* 0x 270 */ + 0, 0, 2,145, 1, 0, 8, 37, 0, 0,194,160,241,255, 0, 16, /* 0x 280 */ + 1, 0,198, 36,127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, /* 0x 290 */ + 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, /* 0x 2a0 */ + 2, 18, 9, 0, 1, 0, 66, 48, 64, 24, 3, 0, 33, 24, 98, 0, /* 0x 2b0 */ +127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, /* 0x 2c0 */ + 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, /* 0x 2d0 */ + 1, 0, 66, 48, 13, 0, 64, 20,255,255, 98, 36, 64, 24, 2, 0, /* 0x 2e0 */ +127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, /* 0x 2f0 */ + 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, /* 0x 300 */ + 1, 0, 66, 48,223,255, 0, 16, 33, 24, 98, 0, 2, 0, 2, 36, /* 0x 310 */ + 13, 0, 98, 20,253,255, 99, 36,127, 0, 34, 49, 5, 0, 64, 20, /* 0x 320 */ + 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, /* 0x 330 */ + 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, 33, 24, 96, 1, /* 0x 340 */ + 12, 0, 0, 16, 1, 0, 76, 48, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 350 */ + 0, 26, 3, 0, 33, 24, 98, 0,255,255, 2, 36, 70, 0, 98, 16, /* 0x 360 */ + 39, 16, 3, 0, 1, 0, 76, 48, 66, 24, 3, 0, 1, 0, 99, 36, /* 0x 370 */ + 33, 88, 96, 0,127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, /* 0x 380 */ + 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, /* 0x 390 */ + 2, 18, 9, 0, 1, 0, 66, 48, 64, 96, 12, 0, 33, 96,130, 1, /* 0x 3a0 */ + 26, 0,128, 21, 1, 5, 98, 44, 1, 0, 12, 36,127, 0, 34, 49, /* 0x 3b0 */ + 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 3c0 */ + 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, /* 0x 3d0 */ + 64, 96, 12, 0, 33, 96,130, 1,127, 0, 34, 49, 5, 0, 64, 20, /* 0x 3e0 */ + 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, /* 0x 3f0 */ + 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48,236,255, 64, 16, /* 0x 400 */ +127, 0, 34, 49, 2, 0,140, 37, 1, 5, 98, 44, 1, 0, 66, 56, /* 0x 410 */ + 33, 96,130, 1, 4, 0, 98, 40, 14, 0, 64, 20, 1, 0,140, 37, /* 0x 420 */ + 35, 24,195, 0, 4, 0,130, 41, 12, 0, 64, 20, 0, 0, 98,152, /* 0x 430 */ + 3, 0, 98,136,252,255,140, 37, 0, 0,194,184, 3, 0,194,168, /* 0x 440 */ + 4, 0, 99, 36,247,255,128, 21, 4, 0,198, 36,126,255, 0, 16, /* 0x 450 */ +127, 0, 34, 49, 35, 24,195, 0, 0, 0, 98,144,255,255,140, 37, /* 0x 460 */ + 0, 0,194,160, 1, 0, 99, 36,251,255,128, 21, 1, 0,198, 36, /* 0x 470 */ +117,255, 0, 16,127, 0, 34, 49, 33, 72, 0, 0, 1, 0, 11, 36, /* 0x 480 */ + 33, 64,128, 0,127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, /* 0x 490 */ + 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, /* 0x 4a0 */ + 2, 18, 9, 0, 1, 0, 66, 48, 6, 0, 64, 16, 1, 0, 3, 36, /* 0x 4b0 */ + 0, 0, 2,145, 1, 0, 8, 37, 0, 0,194,160,241,255, 0, 16, /* 0x 4c0 */ + 1, 0,198, 36,127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, /* 0x 4d0 */ + 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, /* 0x 4e0 */ + 2, 18, 9, 0, 1, 0, 66, 48, 64, 24, 3, 0, 33, 24, 98, 0, /* 0x 4f0 */ +127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, /* 0x 500 */ + 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, /* 0x 510 */ + 1, 0, 66, 48, 13, 0, 64, 20,255,255, 98, 36, 64, 24, 2, 0, /* 0x 520 */ +127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, /* 0x 530 */ + 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, /* 0x 540 */ + 1, 0, 66, 48,223,255, 0, 16, 33, 24, 98, 0, 2, 0, 2, 36, /* 0x 550 */ + 13, 0, 98, 20,253,255, 99, 36, 33, 24, 96, 1,127, 0, 34, 49, /* 0x 560 */ + 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 570 */ + 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, /* 0x 580 */ + 12, 0, 0, 16, 1, 0, 76, 48, 0, 0, 2,145, 0, 26, 3, 0, /* 0x 590 */ + 33, 24, 98, 0,255,255, 2, 36, 92, 0, 98, 16, 1, 0, 8, 37, /* 0x 5a0 */ + 39, 16, 3, 0, 1, 0, 76, 48, 66, 24, 3, 0, 1, 0, 99, 36, /* 0x 5b0 */ + 33, 88, 96, 0, 13, 0,128, 17,127, 0, 34, 49,127, 0, 34, 49, /* 0x 5c0 */ + 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 5d0 */ + 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, /* 0x 5e0 */ + 46, 0, 0, 16, 1, 0, 76, 36,127, 0, 34, 49, 5, 0, 64, 20, /* 0x 5f0 */ + 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, /* 0x 600 */ + 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, 12, 0, 64, 16, /* 0x 610 */ + 1, 0,140, 37,127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, /* 0x 620 */ + 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, /* 0x 630 */ + 2, 18, 9, 0, 1, 0, 66, 48, 24, 0, 0, 16, 3, 0, 76, 36, /* 0x 640 */ +127, 0, 34, 49, 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, /* 0x 650 */ + 1, 0, 8, 37, 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, /* 0x 660 */ + 1, 0, 66, 48, 64, 96, 12, 0, 33, 96,130, 1,127, 0, 34, 49, /* 0x 670 */ + 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 680 */ + 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, 1, 0, 66, 48, /* 0x 690 */ +236,255, 64, 16,127, 0, 34, 49, 3, 0,140, 37, 1, 5, 98, 44, /* 0x 6a0 */ + 1, 0, 66, 56, 33, 96,130, 1, 4, 0, 98, 40, 14, 0, 64, 20, /* 0x 6b0 */ + 1, 0,140, 37, 35, 24,195, 0, 4, 0,130, 41, 12, 0, 64, 20, /* 0x 6c0 */ + 0, 0, 98,152, 3, 0, 98,136,252,255,140, 37, 0, 0,194,184, /* 0x 6d0 */ + 3, 0,194,168, 4, 0, 99, 36,247,255,128, 21, 4, 0,198, 36, /* 0x 6e0 */ +105,255, 0, 16,127, 0, 34, 49, 35, 24,195, 0, 0, 0, 98,144, /* 0x 6f0 */ +255,255,140, 37, 0, 0,194,160, 1, 0, 99, 36,251,255,128, 21, /* 0x 700 */ + 1, 0,198, 36, 96,255, 0, 16,127, 0, 34, 49, 33, 72, 0, 0, /* 0x 710 */ + 33,104, 32, 1, 1, 0, 11, 36, 33, 64,128, 0,255,255,173, 37, /* 0x 720 */ + 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, /* 0x 730 */ + 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, /* 0x 740 */ + 6, 0, 64, 16, 1, 0, 3, 36, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 750 */ + 0, 0,194,160,241,255, 0, 16, 1, 0,198, 36,255,255,173, 37, /* 0x 760 */ + 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, /* 0x 770 */ + 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, /* 0x 780 */ + 64, 24, 3, 0, 33, 24, 98, 0,255,255,173, 37, 6, 0,161, 5, /* 0x 790 */ + 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, /* 0x 7a0 */ + 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48,235,255, 64, 16, /* 0x 7b0 */ + 0, 0, 0, 0, 2, 0, 2, 36, 3, 0, 98, 20,253,255, 99, 36, /* 0x 7c0 */ + 9, 0, 0, 16, 33, 24, 96, 1, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 7d0 */ + 0, 26, 3, 0, 33, 24, 98, 0,255,255, 2, 36, 77, 0, 98, 16, /* 0x 7e0 */ + 1, 0, 99, 36, 33, 88, 96, 0,255,255,173, 37, 6, 0,161, 5, /* 0x 7f0 */ + 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, /* 0x 800 */ + 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, 33, 96, 64, 0, /* 0x 810 */ + 64, 96, 12, 0,255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, /* 0x 820 */ + 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, /* 0x 830 */ + 6, 16,169, 1, 1, 0, 66, 48, 33, 96,130, 1, 26, 0,128, 21, /* 0x 840 */ + 1, 13, 98, 44, 1, 0, 12, 36,255,255,173, 37, 6, 0,161, 5, /* 0x 850 */ + 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, /* 0x 860 */ + 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, 64, 96, 12, 0, /* 0x 870 */ + 33, 96,130, 1,255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, /* 0x 880 */ + 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, /* 0x 890 */ + 6, 16,169, 1, 1, 0, 66, 48,235,255, 64, 16, 0, 0, 0, 0, /* 0x 8a0 */ + 2, 0,140, 37, 1, 13, 98, 44, 1, 0, 66, 56, 33, 96,130, 1, /* 0x 8b0 */ + 4, 0, 98, 40, 14, 0, 64, 20, 1, 0,140, 37, 35, 24,195, 0, /* 0x 8c0 */ + 4, 0,130, 41, 12, 0, 64, 20, 0, 0, 98,152, 3, 0, 98,136, /* 0x 8d0 */ +252,255,140, 37, 0, 0,194,184, 3, 0,194,168, 4, 0, 99, 36, /* 0x 8e0 */ +247,255,128, 21, 4, 0,198, 36,141,255, 0, 16,255,255,173, 37, /* 0x 8f0 */ + 35, 24,195, 0, 0, 0, 98,144,255,255,140, 37, 0, 0,194,160, /* 0x 900 */ + 1, 0, 99, 36,251,255,128, 21, 1, 0,198, 36,132,255, 0, 16, /* 0x 910 */ +255,255,173, 37, 33, 72, 0, 0, 33,104, 32, 1, 1, 0, 11, 36, /* 0x 920 */ + 33, 64,128, 0,255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, /* 0x 930 */ + 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, /* 0x 940 */ + 6, 16,169, 1, 1, 0, 66, 48, 6, 0, 64, 16, 1, 0, 3, 36, /* 0x 950 */ + 0, 0, 2,145, 1, 0, 8, 37, 0, 0,194,160,241,255, 0, 16, /* 0x 960 */ + 1, 0,198, 36,255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, /* 0x 970 */ + 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, /* 0x 980 */ + 6, 16,169, 1, 1, 0, 66, 48, 64, 24, 3, 0, 33, 24, 98, 0, /* 0x 990 */ +255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, /* 0x 9a0 */ + 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, /* 0x 9b0 */ + 1, 0, 66, 48, 13, 0, 64, 20,255,255, 98, 36, 64, 24, 2, 0, /* 0x 9c0 */ +255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, /* 0x 9d0 */ + 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, /* 0x 9e0 */ + 1, 0, 66, 48,223,255, 0, 16, 33, 24, 98, 0, 2, 0, 2, 36, /* 0x 9f0 */ + 13, 0, 98, 20,253,255, 99, 36,255,255,173, 37, 6, 0,161, 5, /* 0x a00 */ + 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, /* 0x a10 */ + 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, 33, 24, 96, 1, /* 0x a20 */ + 12, 0, 0, 16, 1, 0, 76, 48, 0, 0, 2,145, 1, 0, 8, 37, /* 0x a30 */ + 0, 26, 3, 0, 33, 24, 98, 0,255,255, 2, 36, 70, 0, 98, 16, /* 0x a40 */ + 39, 16, 3, 0, 1, 0, 76, 48, 66, 24, 3, 0, 1, 0, 99, 36, /* 0x a50 */ + 33, 88, 96, 0,255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, /* 0x a60 */ + 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, /* 0x a70 */ + 6, 16,169, 1, 1, 0, 66, 48, 64, 96, 12, 0, 33, 96,130, 1, /* 0x a80 */ + 26, 0,128, 21, 1, 5, 98, 44, 1, 0, 12, 36,255,255,173, 37, /* 0x a90 */ + 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, /* 0x aa0 */ + 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, /* 0x ab0 */ + 64, 96, 12, 0, 33, 96,130, 1,255,255,173, 37, 6, 0,161, 5, /* 0x ac0 */ + 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, /* 0x ad0 */ + 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48,235,255, 64, 16, /* 0x ae0 */ + 0, 0, 0, 0, 2, 0,140, 37, 1, 5, 98, 44, 1, 0, 66, 56, /* 0x af0 */ + 33, 96,130, 1, 4, 0, 98, 40, 14, 0, 64, 20, 1, 0,140, 37, /* 0x b00 */ + 35, 24,195, 0, 4, 0,130, 41, 12, 0, 64, 20, 0, 0, 98,152, /* 0x b10 */ + 3, 0, 98,136,252,255,140, 37, 0, 0,194,184, 3, 0,194,168, /* 0x b20 */ + 4, 0, 99, 36,247,255,128, 21, 4, 0,198, 36,126,255, 0, 16, /* 0x b30 */ +255,255,173, 37, 35, 24,195, 0, 0, 0, 98,144,255,255,140, 37, /* 0x b40 */ + 0, 0,194,160, 1, 0, 99, 36,251,255,128, 21, 1, 0,198, 36, /* 0x b50 */ +117,255, 0, 16,255,255,173, 37, 33, 72, 0, 0, 33,104, 32, 1, /* 0x b60 */ + 1, 0, 11, 36, 33, 64,128, 0,255,255,173, 37, 6, 0,161, 5, /* 0x b70 */ + 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, /* 0x b80 */ + 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, 6, 0, 64, 16, /* 0x b90 */ + 1, 0, 3, 36, 0, 0, 2,145, 1, 0, 8, 37, 0, 0,194,160, /* 0x ba0 */ +241,255, 0, 16, 1, 0,198, 36,255,255,173, 37, 6, 0,161, 5, /* 0x bb0 */ + 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, /* 0x bc0 */ + 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, 64, 24, 3, 0, /* 0x bd0 */ + 33, 24, 98, 0,255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, /* 0x be0 */ + 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, /* 0x bf0 */ + 6, 16,169, 1, 1, 0, 66, 48, 13, 0, 64, 20,255,255, 98, 36, /* 0x c00 */ + 64, 24, 2, 0,255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, /* 0x c10 */ + 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, /* 0x c20 */ + 6, 16,169, 1, 1, 0, 66, 48,223,255, 0, 16, 33, 24, 98, 0, /* 0x c30 */ + 2, 0, 2, 36, 13, 0, 98, 20,253,255, 99, 36, 33, 24, 96, 1, /* 0x c40 */ +255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, /* 0x c50 */ + 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, /* 0x c60 */ + 1, 0, 66, 48, 12, 0, 0, 16, 1, 0, 76, 48, 0, 0, 2,145, /* 0x c70 */ + 0, 26, 3, 0, 33, 24, 98, 0,255,255, 2, 36, 92, 0, 98, 16, /* 0x c80 */ + 1, 0, 8, 37, 39, 16, 3, 0, 1, 0, 76, 48, 66, 24, 3, 0, /* 0x c90 */ + 1, 0, 99, 36, 33, 88, 96, 0, 12, 0,128, 17, 0, 0, 0, 0, /* 0x ca0 */ +255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, /* 0x cb0 */ + 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, /* 0x cc0 */ + 1, 0, 66, 48, 46, 0, 0, 16, 1, 0, 76, 36,255,255,173, 37, /* 0x cd0 */ + 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, /* 0x ce0 */ + 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, /* 0x cf0 */ + 12, 0, 64, 16, 1, 0,140, 37,255,255,173, 37, 6, 0,161, 5, /* 0x d00 */ + 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, /* 0x d10 */ + 4, 0, 8, 37, 6, 16,169, 1, 1, 0, 66, 48, 24, 0, 0, 16, /* 0x d20 */ + 3, 0, 76, 36,255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, /* 0x d30 */ + 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, /* 0x d40 */ + 6, 16,169, 1, 1, 0, 66, 48, 64, 96, 12, 0, 33, 96,130, 1, /* 0x d50 */ +255,255,173, 37, 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, /* 0x d60 */ + 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, /* 0x d70 */ + 1, 0, 66, 48,235,255, 64, 16, 0, 0, 0, 0, 3, 0,140, 37, /* 0x d80 */ + 1, 5, 98, 44, 1, 0, 66, 56, 33, 96,130, 1, 4, 0, 98, 40, /* 0x d90 */ + 14, 0, 64, 20, 1, 0,140, 37, 35, 24,195, 0, 4, 0,130, 41, /* 0x da0 */ + 12, 0, 64, 20, 0, 0, 98,152, 3, 0, 98,136,252,255,140, 37, /* 0x db0 */ + 0, 0,194,184, 3, 0,194,168, 4, 0, 99, 36,247,255,128, 21, /* 0x dc0 */ + 4, 0,198, 36,105,255, 0, 16,255,255,173, 37, 35, 24,195, 0, /* 0x dd0 */ + 0, 0, 98,144,255,255,140, 37, 0, 0,194,160, 1, 0, 99, 36, /* 0x de0 */ +251,255,128, 21, 1, 0,198, 36, 96,255, 0, 16,255,255,173, 37, /* 0x df0 */ + 67, 83, 4, 52, 67, 83, 4, 52,192, 32, 4, 0, 0, 0,192,172, /* 0x e00 */ +255,255,132, 36,253,255,128, 20, 4, 0,198, 36, 3, 0,192,168, /* 0x e10 */ + 0, 0,192,184,255,255,132, 36,252,255,128, 20, 4, 0,198, 36, /* 0x e20 */ +160, 0, 10, 36, 9,248, 64, 1, 68, 0, 9, 36, 0, 0,164,143, /* 0x e30 */ + 4, 0,165,143, 8, 0,166,143, 12, 0,167,143, 16, 0,162,143, /* 0x e40 */ + 20, 0,163,143, 80, 69, 80, 74, 24, 0,191,143, 85, 80, 88, 33, /* 0x e50 */ +161,216,208,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x e60 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 80, 83, 49, 83, /* 0x e70 */ + 84, 65, 82, 84, 0, 0, 0, 0, 0, 80, 83, 49, 69, 78, 84, 82, /* 0x e80 */ + 89, 0, 20, 0, 0, 0, 80, 83, 49, 67, 79, 78, 72, 76, 0, 56, /* 0x e90 */ + 0, 0, 0, 80, 83, 49, 67, 79, 78, 72, 73, 0, 64, 0, 0, 0, /* 0x ea0 */ + 80, 83, 49, 78, 50, 66, 48, 56, 0, 68, 0, 0, 0, 80, 83, 49, /* 0x eb0 */ + 78, 50, 68, 48, 56, 0, 72, 2, 0, 0, 80, 83, 49, 78, 50, 69, /* 0x ec0 */ + 48, 56, 0,136, 4, 0, 0, 80, 83, 49, 78, 50, 66, 51, 50, 0, /* 0x ed0 */ + 28, 7, 0, 0, 80, 83, 49, 78, 50, 68, 51, 50, 0, 36, 9, 0, /* 0x ee0 */ + 0, 80, 83, 49, 78, 50, 69, 51, 50, 0,104, 11, 0, 0, 80, 83, /* 0x ef0 */ + 49, 77, 83, 69, 84, 83, 0, 0, 14, 0, 0, 80, 83, 49, 77, 83, /* 0x f00 */ + 69, 84, 66, 0, 4, 14, 0, 0, 80, 83, 49, 77, 83, 69, 84, 65, /* 0x f10 */ + 0, 12, 14, 0, 0, 80, 83, 49, 77, 83, 69, 84, 85, 0, 28, 14, /* 0x f20 */ + 0, 0, 80, 83, 49, 69, 88, 73, 84, 67, 0, 48, 14, 0, 0, 80, /* 0x f30 */ + 83, 49, 80, 65, 72, 68, 82, 0, 92, 14, 0, 0, 80, 83, 49, 69, /* 0x f40 */ + 79, 65, 83, 77, 0,124, 14, 0, 0,255,255,255,255,124, 14 /* 0x f50 */ +}; diff --git a/src/stub/mipsel.r3000-ps1-console.h b/src/stub/mipsel.r3000-ps1-console.h new file mode 100644 index 00000000..d749ee71 --- /dev/null +++ b/src/stub/mipsel.r3000-ps1-console.h @@ -0,0 +1,212 @@ +/* mipsel.r3000-ps1-console.h -- created from mipsel.r3000-ps1-console.bin, 2829 (0xb0d) 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 + + */ + + +#define NRV_CON_LOADER_SIZE 2829 +#define NRV_CON_LOADER_ADLER32 0xa3df7da3 +#define NRV_CON_LOADER_CRC32 0x923b55c4 + +unsigned char nrv_con_loader[2829] = { + 83, 76, 1, 36, 35,232,161, 3, 0, 0,161,175, 4, 0,164,175, /* 0x 0 */ + 8, 0,165,175, 12, 0,166,175, 16, 0,167,175, 20, 0,162,175, /* 0x 10 */ + 24, 0,163,175, 28, 0,191,175,224,255, 38, 36, 32, 0,167, 39, /* 0x 20 */ + 33, 40,224, 0, 67, 68, 4, 60, 84, 82,132, 52, 0, 0,129,140, /* 0x 30 */ +252,255,198, 36, 0, 0,161,172, 4, 0,132, 36,251,255,192, 20, /* 0x 40 */ + 4, 0,165, 36, 67, 80,132, 36, 69, 68, 6, 60, 8, 0,224, 0, /* 0x 50 */ + 79, 67,198, 52, 8, 0,224, 0, 69, 68, 6, 60, 33, 72, 0, 0, /* 0x 60 */ + 1, 0, 11, 36, 33, 64,128, 0, 76, 0, 17, 4,127, 0, 34, 49, /* 0x 70 */ + 6, 0, 64, 16, 1, 0, 3, 36, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 80 */ + 0, 0,194,160,248,255, 0, 16, 1, 0,198, 36, 67, 0, 17, 4, /* 0x 90 */ +127, 0, 34, 49, 64, 24, 3, 0, 33, 24, 98, 0, 63, 0, 17, 4, /* 0x a0 */ +127, 0, 34, 49,249,255, 64, 16, 0, 0, 0, 0, 2, 0, 2, 36, /* 0x b0 */ + 3, 0, 98, 20,253,255, 99, 36, 9, 0, 0, 16, 33, 24, 96, 1, /* 0x c0 */ + 0, 0, 2,145, 1, 0, 8, 37, 0, 26, 3, 0, 33, 24, 98, 0, /* 0x d0 */ +255,255, 2, 36, 58, 0, 98, 16, 1, 0, 99, 36, 33, 88, 96, 0, /* 0x e0 */ + 46, 0, 17, 4,127, 0, 34, 49, 33, 96, 64, 0, 64, 96, 12, 0, /* 0x f0 */ + 42, 0, 17, 4,127, 0, 34, 49, 33, 96,130, 1, 12, 0,128, 21, /* 0x 100 */ + 1, 13, 98, 44, 1, 0, 12, 36, 36, 0, 17, 4,127, 0, 34, 49, /* 0x 110 */ + 64, 96, 12, 0, 33, 96,130, 1, 32, 0, 17, 4,127, 0, 34, 49, /* 0x 120 */ +249,255, 64, 16, 0, 0, 0, 0, 2, 0,140, 37, 1, 13, 98, 44, /* 0x 130 */ + 1, 0, 66, 56, 33, 96,130, 1, 4, 0, 98, 40, 14, 0, 64, 20, /* 0x 140 */ + 1, 0,140, 37, 35, 24,195, 0, 4, 0,130, 41, 12, 0, 64, 20, /* 0x 150 */ + 0, 0, 98,152, 3, 0, 98,136,252,255,140, 37, 0, 0,194,184, /* 0x 160 */ + 3, 0,194,168, 4, 0, 99, 36,247,255,128, 21, 4, 0,198, 36, /* 0x 170 */ +189,255, 0, 16, 0, 0, 0, 0, 35, 24,195, 0, 0, 0, 98,144, /* 0x 180 */ +255,255,140, 37, 0, 0,194,160, 1, 0, 99, 36,251,255,128, 21, /* 0x 190 */ + 1, 0,198, 36,180,255, 0, 16, 0, 0, 0, 0, 5, 0, 64, 20, /* 0x 1a0 */ + 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, 64, 16, 2, 0, /* 0x 1b0 */ + 1, 0, 73, 36, 2, 18, 9, 0, 8, 0,224, 3, 1, 0, 66, 48, /* 0x 1c0 */ + 33, 72, 0, 0, 1, 0, 11, 36, 33, 64,128, 0, 84, 0, 17, 4, /* 0x 1d0 */ +127, 0, 34, 49, 6, 0, 64, 16, 1, 0, 3, 36, 0, 0, 2,145, /* 0x 1e0 */ + 1, 0, 8, 37, 0, 0,194,160,248,255, 0, 16, 1, 0,198, 36, /* 0x 1f0 */ + 75, 0, 17, 4,127, 0, 34, 49, 64, 24, 3, 0, 33, 24, 98, 0, /* 0x 200 */ + 71, 0, 17, 4,127, 0, 34, 49, 6, 0, 64, 20,255,255, 98, 36, /* 0x 210 */ + 64, 24, 2, 0, 66, 0, 17, 4,127, 0, 34, 49,244,255, 0, 16, /* 0x 220 */ + 33, 24, 98, 0, 2, 0, 2, 36, 6, 0, 98, 20,253,255, 99, 36, /* 0x 230 */ + 59, 0, 17, 4,127, 0, 34, 49, 33, 24, 96, 1, 12, 0, 0, 16, /* 0x 240 */ + 1, 0, 76, 48, 0, 0, 2,145, 1, 0, 8, 37, 0, 26, 3, 0, /* 0x 250 */ + 33, 24, 98, 0,255,255, 2, 36, 58, 0, 98, 16, 39, 16, 3, 0, /* 0x 260 */ + 1, 0, 76, 48, 66, 24, 3, 0, 1, 0, 99, 36, 33, 88, 96, 0, /* 0x 270 */ + 43, 0, 17, 4,127, 0, 34, 49, 64, 96, 12, 0, 33, 96,130, 1, /* 0x 280 */ + 12, 0,128, 21, 1, 5, 98, 44, 1, 0, 12, 36, 36, 0, 17, 4, /* 0x 290 */ +127, 0, 34, 49, 64, 96, 12, 0, 33, 96,130, 1, 32, 0, 17, 4, /* 0x 2a0 */ +127, 0, 34, 49,249,255, 64, 16, 0, 0, 0, 0, 2, 0,140, 37, /* 0x 2b0 */ + 1, 5, 98, 44, 1, 0, 66, 56, 33, 96,130, 1, 4, 0, 98, 40, /* 0x 2c0 */ + 14, 0, 64, 20, 1, 0,140, 37, 35, 24,195, 0, 4, 0,130, 41, /* 0x 2d0 */ + 12, 0, 64, 20, 0, 0, 98,152, 3, 0, 98,136,252,255,140, 37, /* 0x 2e0 */ + 0, 0,194,184, 3, 0,194,168, 4, 0, 99, 36,247,255,128, 21, /* 0x 2f0 */ + 4, 0,198, 36,181,255, 0, 16, 0, 0, 0, 0, 35, 24,195, 0, /* 0x 300 */ + 0, 0, 98,144,255,255,140, 37, 0, 0,194,160, 1, 0, 99, 36, /* 0x 310 */ +251,255,128, 21, 1, 0,198, 36,172,255, 0, 16, 0, 0, 0, 0, /* 0x 320 */ + 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 330 */ + 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, 8, 0,224, 3, /* 0x 340 */ + 1, 0, 66, 48, 33, 72, 0, 0, 1, 0, 11, 36, 33, 64,128, 0, /* 0x 350 */ + 91, 0, 17, 4,127, 0, 34, 49, 6, 0, 64, 16, 1, 0, 3, 36, /* 0x 360 */ + 0, 0, 2,145, 1, 0, 8, 37, 0, 0,194,160,248,255, 0, 16, /* 0x 370 */ + 1, 0,198, 36, 82, 0, 17, 4,127, 0, 34, 49, 64, 24, 3, 0, /* 0x 380 */ + 33, 24, 98, 0, 78, 0, 17, 4,127, 0, 34, 49, 6, 0, 64, 20, /* 0x 390 */ +255,255, 98, 36, 64, 24, 2, 0, 73, 0, 17, 4,127, 0, 34, 49, /* 0x 3a0 */ +244,255, 0, 16, 33, 24, 98, 0, 2, 0, 2, 36, 6, 0, 98, 20, /* 0x 3b0 */ +253,255, 99, 36, 33, 24, 96, 1, 65, 0, 17, 4,127, 0, 34, 49, /* 0x 3c0 */ + 12, 0, 0, 16, 1, 0, 76, 48, 0, 0, 2,145, 0, 26, 3, 0, /* 0x 3d0 */ + 33, 24, 98, 0,255,255, 2, 36, 66, 0, 98, 16, 1, 0, 8, 37, /* 0x 3e0 */ + 39, 16, 3, 0, 1, 0, 76, 48, 66, 24, 3, 0, 1, 0, 99, 36, /* 0x 3f0 */ + 33, 88, 96, 0, 5, 0,128, 17, 0, 0, 0, 0, 48, 0, 17, 4, /* 0x 400 */ +127, 0, 34, 49, 18, 0, 0, 16, 1, 0, 76, 36, 44, 0, 17, 4, /* 0x 410 */ +127, 0, 34, 49, 5, 0, 64, 16, 1, 0,140, 37, 40, 0, 17, 4, /* 0x 420 */ +127, 0, 34, 49, 10, 0, 0, 16, 3, 0, 76, 36, 36, 0, 17, 4, /* 0x 430 */ +127, 0, 34, 49, 64, 96, 12, 0, 33, 96,130, 1, 32, 0, 17, 4, /* 0x 440 */ +127, 0, 34, 49,249,255, 64, 16, 0, 0, 0, 0, 3, 0,140, 37, /* 0x 450 */ + 1, 5, 98, 44, 1, 0, 66, 56, 33, 96,130, 1, 4, 0, 98, 40, /* 0x 460 */ + 14, 0, 64, 20, 1, 0,140, 37, 35, 24,195, 0, 4, 0,130, 41, /* 0x 470 */ + 12, 0, 64, 20, 0, 0, 98,152, 3, 0, 98,136,252,255,140, 37, /* 0x 480 */ + 0, 0,194,184, 3, 0,194,168, 4, 0, 99, 36,247,255,128, 21, /* 0x 490 */ + 4, 0,198, 36,174,255, 0, 16, 0, 0, 0, 0, 35, 24,195, 0, /* 0x 4a0 */ + 0, 0, 98,144,255,255,140, 37, 0, 0,194,160, 1, 0, 99, 36, /* 0x 4b0 */ +251,255,128, 21, 1, 0,198, 36,165,255, 0, 16, 0, 0, 0, 0, /* 0x 4c0 */ + 5, 0, 64, 20, 64, 72, 9, 0, 0, 0, 2,145, 1, 0, 8, 37, /* 0x 4d0 */ + 64, 16, 2, 0, 1, 0, 73, 36, 2, 18, 9, 0, 8, 0,224, 3, /* 0x 4e0 */ + 1, 0, 66, 48, 33, 72, 0, 0, 33,104, 32, 1, 1, 0, 11, 36, /* 0x 4f0 */ + 33, 64,128, 0, 76, 0, 17, 4,255,255,173, 37, 6, 0, 64, 16, /* 0x 500 */ + 1, 0, 3, 36, 0, 0, 2,145, 1, 0, 8, 37, 0, 0,194,160, /* 0x 510 */ +248,255, 0, 16, 1, 0,198, 36, 67, 0, 17, 4,255,255,173, 37, /* 0x 520 */ + 64, 24, 3, 0, 33, 24, 98, 0, 63, 0, 17, 4,255,255,173, 37, /* 0x 530 */ +249,255, 64, 16, 0, 0, 0, 0, 2, 0, 2, 36, 3, 0, 98, 20, /* 0x 540 */ +253,255, 99, 36, 9, 0, 0, 16, 33, 24, 96, 1, 0, 0, 2,145, /* 0x 550 */ + 1, 0, 8, 37, 0, 26, 3, 0, 33, 24, 98, 0,255,255, 2, 36, /* 0x 560 */ + 58, 0, 98, 16, 1, 0, 99, 36, 33, 88, 96, 0, 46, 0, 17, 4, /* 0x 570 */ +255,255,173, 37, 33, 96, 64, 0, 64, 96, 12, 0, 42, 0, 17, 4, /* 0x 580 */ +255,255,173, 37, 33, 96,130, 1, 12, 0,128, 21, 1, 13, 98, 44, /* 0x 590 */ + 1, 0, 12, 36, 36, 0, 17, 4,255,255,173, 37, 64, 96, 12, 0, /* 0x 5a0 */ + 33, 96,130, 1, 32, 0, 17, 4,255,255,173, 37,249,255, 64, 16, /* 0x 5b0 */ + 0, 0, 0, 0, 2, 0,140, 37, 1, 13, 98, 44, 1, 0, 66, 56, /* 0x 5c0 */ + 33, 96,130, 1, 4, 0, 98, 40, 14, 0, 64, 20, 1, 0,140, 37, /* 0x 5d0 */ + 35, 24,195, 0, 4, 0,130, 41, 12, 0, 64, 20, 0, 0, 98,152, /* 0x 5e0 */ + 3, 0, 98,136,252,255,140, 37, 0, 0,194,184, 3, 0,194,168, /* 0x 5f0 */ + 4, 0, 99, 36,247,255,128, 21, 4, 0,198, 36,189,255, 0, 16, /* 0x 600 */ + 0, 0, 0, 0, 35, 24,195, 0, 0, 0, 98,144,255,255,140, 37, /* 0x 610 */ + 0, 0,194,160, 1, 0, 99, 36,251,255,128, 21, 1, 0,198, 36, /* 0x 620 */ +180,255, 0, 16, 0, 0, 0, 0, 6, 0,161, 5, 6, 16,169, 1, /* 0x 630 */ + 31, 0, 13, 36, 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, /* 0x 640 */ + 6, 16,169, 1, 8, 0,224, 3, 1, 0, 66, 48, 33, 72, 0, 0, /* 0x 650 */ + 33,104, 32, 1, 1, 0, 11, 36, 33, 64,128, 0, 84, 0, 17, 4, /* 0x 660 */ +255,255,173, 37, 6, 0, 64, 16, 1, 0, 3, 36, 0, 0, 2,145, /* 0x 670 */ + 1, 0, 8, 37, 0, 0,194,160,248,255, 0, 16, 1, 0,198, 36, /* 0x 680 */ + 75, 0, 17, 4,255,255,173, 37, 64, 24, 3, 0, 33, 24, 98, 0, /* 0x 690 */ + 71, 0, 17, 4,255,255,173, 37, 6, 0, 64, 20,255,255, 98, 36, /* 0x 6a0 */ + 64, 24, 2, 0, 66, 0, 17, 4,255,255,173, 37,244,255, 0, 16, /* 0x 6b0 */ + 33, 24, 98, 0, 2, 0, 2, 36, 6, 0, 98, 20,253,255, 99, 36, /* 0x 6c0 */ + 59, 0, 17, 4,255,255,173, 37, 33, 24, 96, 1, 12, 0, 0, 16, /* 0x 6d0 */ + 1, 0, 76, 48, 0, 0, 2,145, 1, 0, 8, 37, 0, 26, 3, 0, /* 0x 6e0 */ + 33, 24, 98, 0,255,255, 2, 36, 58, 0, 98, 16, 39, 16, 3, 0, /* 0x 6f0 */ + 1, 0, 76, 48, 66, 24, 3, 0, 1, 0, 99, 36, 33, 88, 96, 0, /* 0x 700 */ + 43, 0, 17, 4,255,255,173, 37, 64, 96, 12, 0, 33, 96,130, 1, /* 0x 710 */ + 12, 0,128, 21, 1, 5, 98, 44, 1, 0, 12, 36, 36, 0, 17, 4, /* 0x 720 */ +255,255,173, 37, 64, 96, 12, 0, 33, 96,130, 1, 32, 0, 17, 4, /* 0x 730 */ +255,255,173, 37,249,255, 64, 16, 0, 0, 0, 0, 2, 0,140, 37, /* 0x 740 */ + 1, 5, 98, 44, 1, 0, 66, 56, 33, 96,130, 1, 4, 0, 98, 40, /* 0x 750 */ + 14, 0, 64, 20, 1, 0,140, 37, 35, 24,195, 0, 4, 0,130, 41, /* 0x 760 */ + 12, 0, 64, 20, 0, 0, 98,152, 3, 0, 98,136,252,255,140, 37, /* 0x 770 */ + 0, 0,194,184, 3, 0,194,168, 4, 0, 99, 36,247,255,128, 21, /* 0x 780 */ + 4, 0,198, 36,181,255, 0, 16, 0, 0, 0, 0, 35, 24,195, 0, /* 0x 790 */ + 0, 0, 98,144,255,255,140, 37, 0, 0,194,160, 1, 0, 99, 36, /* 0x 7a0 */ +251,255,128, 21, 1, 0,198, 36,172,255, 0, 16, 0, 0, 0, 0, /* 0x 7b0 */ + 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, 0, 0, 9,153, /* 0x 7c0 */ + 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, 8, 0,224, 3, /* 0x 7d0 */ + 1, 0, 66, 48, 33, 72, 0, 0, 33,104, 32, 1, 1, 0, 11, 36, /* 0x 7e0 */ + 33, 64,128, 0, 91, 0, 17, 4,255,255,173, 37, 6, 0, 64, 16, /* 0x 7f0 */ + 1, 0, 3, 36, 0, 0, 2,145, 1, 0, 8, 37, 0, 0,194,160, /* 0x 800 */ +248,255, 0, 16, 1, 0,198, 36, 82, 0, 17, 4,255,255,173, 37, /* 0x 810 */ + 64, 24, 3, 0, 33, 24, 98, 0, 78, 0, 17, 4,255,255,173, 37, /* 0x 820 */ + 6, 0, 64, 20,255,255, 98, 36, 64, 24, 2, 0, 73, 0, 17, 4, /* 0x 830 */ +255,255,173, 37,244,255, 0, 16, 33, 24, 98, 0, 2, 0, 2, 36, /* 0x 840 */ + 6, 0, 98, 20,253,255, 99, 36, 33, 24, 96, 1, 65, 0, 17, 4, /* 0x 850 */ +255,255,173, 37, 12, 0, 0, 16, 1, 0, 76, 48, 0, 0, 2,145, /* 0x 860 */ + 0, 26, 3, 0, 33, 24, 98, 0,255,255, 2, 36, 66, 0, 98, 16, /* 0x 870 */ + 1, 0, 8, 37, 39, 16, 3, 0, 1, 0, 76, 48, 66, 24, 3, 0, /* 0x 880 */ + 1, 0, 99, 36, 33, 88, 96, 0, 5, 0,128, 17, 0, 0, 0, 0, /* 0x 890 */ + 48, 0, 17, 4,255,255,173, 37, 18, 0, 0, 16, 1, 0, 76, 36, /* 0x 8a0 */ + 44, 0, 17, 4,255,255,173, 37, 5, 0, 64, 16, 1, 0,140, 37, /* 0x 8b0 */ + 40, 0, 17, 4,255,255,173, 37, 10, 0, 0, 16, 3, 0, 76, 36, /* 0x 8c0 */ + 36, 0, 17, 4,255,255,173, 37, 64, 96, 12, 0, 33, 96,130, 1, /* 0x 8d0 */ + 32, 0, 17, 4,255,255,173, 37,249,255, 64, 16, 0, 0, 0, 0, /* 0x 8e0 */ + 3, 0,140, 37, 1, 5, 98, 44, 1, 0, 66, 56, 33, 96,130, 1, /* 0x 8f0 */ + 4, 0, 98, 40, 14, 0, 64, 20, 1, 0,140, 37, 35, 24,195, 0, /* 0x 900 */ + 4, 0,130, 41, 12, 0, 64, 20, 0, 0, 98,152, 3, 0, 98,136, /* 0x 910 */ +252,255,140, 37, 0, 0,194,184, 3, 0,194,168, 4, 0, 99, 36, /* 0x 920 */ +247,255,128, 21, 4, 0,198, 36,174,255, 0, 16, 0, 0, 0, 0, /* 0x 930 */ + 35, 24,195, 0, 0, 0, 98,144,255,255,140, 37, 0, 0,194,160, /* 0x 940 */ + 1, 0, 99, 36,251,255,128, 21, 1, 0,198, 36,165,255, 0, 16, /* 0x 950 */ + 0, 0, 0, 0, 6, 0,161, 5, 6, 16,169, 1, 31, 0, 13, 36, /* 0x 960 */ + 0, 0, 9,153, 3, 0, 9,137, 4, 0, 8, 37, 6, 16,169, 1, /* 0x 970 */ + 8, 0,224, 3, 1, 0, 66, 48, 67, 83, 4, 52, 67, 83, 4, 52, /* 0x 980 */ +192, 32, 4, 0, 0, 0,192,172,255,255,132, 36,253,255,128, 20, /* 0x 990 */ + 4, 0,198, 36, 3, 0,192,168, 0, 0,192,184,255,255,132, 36, /* 0x 9a0 */ +252,255,128, 20, 4, 0,198, 36,160, 0, 10, 36, 9,248, 64, 1, /* 0x 9b0 */ + 68, 0, 9, 36, 0, 0,161,143, 4, 0,164,143, 8, 0,165,143, /* 0x 9c0 */ + 12, 0,166,143, 16, 0,167,143, 20, 0,162,143, 24, 0,163,143, /* 0x 9d0 */ + 28, 0,191,143, 80, 69, 80, 74, 33,232,161, 3, 85, 80, 88, 33, /* 0x 9e0 */ +161,216,208,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 9f0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 32, 0, 0, 0, /* 0x a00 */ + 80, 83, 49, 83, 84, 65, 82, 84, 0, 0, 0, 0, 0, 80, 83, 49, /* 0x a10 */ + 80, 65, 68, 67, 68, 0, 84, 0, 0, 0, 80, 83, 49, 67, 79, 78, /* 0x a20 */ + 72, 76, 0, 88, 0, 0, 0, 80, 83, 49, 67, 79, 78, 72, 73, 0, /* 0x a30 */ +100, 0, 0, 0, 80, 83, 49, 69, 78, 84, 82, 89, 0,108, 0, 0, /* 0x a40 */ + 0, 80, 83, 49, 78, 50, 66, 48, 56, 0,108, 0, 0, 0, 80, 83, /* 0x a50 */ + 49, 78, 50, 68, 48, 56, 0,208, 1, 0, 0, 80, 83, 49, 78, 50, /* 0x a60 */ + 69, 48, 56, 0, 84, 3, 0, 0, 80, 83, 49, 78, 50, 66, 51, 50, /* 0x a70 */ + 0,244, 4, 0, 0, 80, 83, 49, 78, 50, 68, 51, 50, 0, 92, 6, /* 0x a80 */ + 0, 0, 80, 83, 49, 78, 50, 69, 51, 50, 0,228, 7, 0, 0, 80, /* 0x a90 */ + 83, 49, 77, 83, 69, 84, 83, 0,136, 9, 0, 0, 80, 83, 49, 77, /* 0x aa0 */ + 83, 69, 84, 66, 0,140, 9, 0, 0, 80, 83, 49, 77, 83, 69, 84, /* 0x ab0 */ + 65, 0,148, 9, 0, 0, 80, 83, 49, 77, 83, 69, 84, 85, 0,164, /* 0x ac0 */ + 9, 0, 0, 80, 83, 49, 69, 88, 73, 84, 67, 0,184, 9, 0, 0, /* 0x ad0 */ + 80, 83, 49, 80, 65, 72, 68, 82, 0,236, 9, 0, 0, 80, 83, 49, /* 0x ae0 */ + 83, 82, 69, 71, 83, 0, 12, 10, 0, 0, 80, 83, 49, 69, 79, 65, /* 0x af0 */ + 83, 77, 0, 16, 10, 0, 0,255,255,255,255, 16, 10 /* 0x b00 */ +}; diff --git a/src/stub/powerpc-darwin.macho-entry.h b/src/stub/powerpc-darwin.macho-entry.h new file mode 100644 index 00000000..671414c7 --- /dev/null +++ b/src/stub/powerpc-darwin.macho-entry.h @@ -0,0 +1,67 @@ +/* powerpc-darwin.macho-entry.h -- created from powerpc-darwin.macho-entry.bin, 508 (0x1fc) 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 + + */ + + +#define L_MAC_PPC32_LOADER_SIZE 508 +#define L_MAC_PPC32_LOADER_ADLER32 0x2cecab12 +#define L_MAC_PPC32_LOADER_CRC32 0x8bce10ce + +unsigned char l_mac_ppc32_loader[508] = { + 72, 0, 1,241,124, 0, 41,236,144,166, 0, 0,124,132, 26, 20, /* 0x 0 */ + 60, 0,128, 0, 61, 32,128, 0, 56, 99,255,255, 56,165,255,255, /* 0x 10 */ + 57, 64,255,255,125,168, 2,166, 72, 0, 1, 12, 57, 32, 0, 1, /* 0x 20 */ +125, 41, 28, 44, 56, 99, 0, 4,124, 9, 0, 64,125, 41, 72, 20, /* 0x 30 */ + 97, 41, 0, 1, 78,128, 0, 32,141, 3, 0, 1,157, 5, 0, 1, /* 0x 40 */ +124, 9, 0, 64,125, 41, 74, 20, 65,162,255,213, 65,129,255,236, /* 0x 50 */ + 56,224, 0, 1, 72, 0, 0, 20, 56,231,255,255,125, 41, 72, 21, /* 0x 60 */ + 65,162,255,189,124,231, 57, 20,125, 41, 72, 21, 65,162,255,177, /* 0x 70 */ +124,231, 57, 20,124, 9, 0, 64,125, 41, 74, 20, 65,162,255,161, /* 0x 80 */ + 65,160,255,216, 57, 0, 0, 0, 52,231,255,253, 84,231, 64, 46, /* 0x 90 */ + 65,128, 0, 32,140, 67, 0, 1,124,234, 16,249,125, 74, 14,112, /* 0x a0 */ + 65,130, 0,148,112, 66, 0, 1, 65,162, 0, 80, 72, 0, 0, 20, /* 0x b0 */ +124, 9, 0, 64,125, 41, 74, 20, 65,162,255,101, 65,161, 0, 60, /* 0x c0 */ + 57, 0, 0, 1,124, 9, 0, 64,125, 41, 74, 20, 65,162,255, 81, /* 0x d0 */ + 65,161, 0, 40,125, 41, 72, 21, 65,162,255, 69,125, 8, 65, 20, /* 0x e0 */ +124, 9, 0, 64,125, 41, 74, 20, 65,162,255, 53, 65,160,255,232, /* 0x f0 */ + 57, 8, 0, 2, 72, 0, 0, 16,125, 41, 72, 21, 65,162,255, 33, /* 0x 100 */ +125, 8, 65, 20, 32,234,250,255, 57, 8, 0, 2,125, 8, 1,148, /* 0x 110 */ +124,234, 42, 20,125, 9, 3,166,141, 7, 0, 1,157, 5, 0, 1, /* 0x 120 */ + 66, 0,255,248, 56,224, 1, 0,124, 7, 41,236,124, 7, 26, 44, /* 0x 130 */ + 75,255,255, 16,128, 6, 0, 0,125,168, 3,166, 56,165, 0, 1, /* 0x 140 */ + 56, 99, 0, 1,124,160, 40, 80,124,100, 24, 80,144,166, 0, 0, /* 0x 150 */ + 78,128, 0, 32, 10, 36, 73,100, 58, 32, 85, 80, 88, 32, 40, 67, /* 0x 160 */ + 41, 32, 49, 57, 57, 54, 45, 50, 48, 48, 54, 32,116,104,101, 32, /* 0x 170 */ + 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108,108, 32, 82,105, /* 0x 180 */ +103,104,116,115, 32, 82,101,115,101,114,118,101,100, 46, 32,104, /* 0x 190 */ +116,116,112, 58, 47, 47,117,112,120, 46,115,102, 46,110,101,116, /* 0x 1a0 */ + 32, 36, 10, 0,124, 72, 2,166,128,130, 0, 8,124,137, 3,166, /* 0x 1b0 */ +128,194, 0, 4,124,164, 18, 20, 56,165, 0, 16,124,102, 18, 20, /* 0x 1c0 */ + 56, 99, 0,192,140, 5,255,255,156, 3,255,255, 66, 0,255,248, /* 0x 1d0 */ +127,233, 3,166, 56,162, 0,128, 56,193,255,252, 78,128, 4, 32, /* 0x 1e0 */ +127,232, 2,166, 75,255,255,193, 72, 0, 0,128 /* 0x 1f0 */ +}; diff --git a/src/stub/powerpc-darwin.macho-fold.h b/src/stub/powerpc-darwin.macho-fold.h new file mode 100644 index 00000000..d1777121 --- /dev/null +++ b/src/stub/powerpc-darwin.macho-fold.h @@ -0,0 +1,138 @@ +/* powerpc-darwin.macho-fold.h -- created from powerpc-darwin.macho-fold.bin, 1648 (0x670) 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 + + */ + + +#define FOLD_MACHPPC32_SIZE 1648 +#define FOLD_MACHPPC32_ADLER32 0x16162538 +#define FOLD_MACHPPC32_CRC32 0x67f187d4 + +unsigned char fold_machppc32[1648] = { + 72, 0, 0,105, 40, 6, 0,208, 76,130, 0, 32, 84,132,240,191, /* 0x 0 */ + 77,130, 0, 32, 60, 0, 0, 16,124, 4, 0, 64, 65,128, 0, 8, /* 0x 10 */ +124, 4, 3,120, 56,165, 1, 32,124,103, 27,120, 56, 99,255,252, /* 0x 20 */ +124,137, 3,166, 72, 0, 0, 28, 84, 75, 2,186,125, 99, 88, 80, /* 0x 30 */ +125,107, 58, 20, 81, 98, 1,186,144, 67, 0, 0, 78, 64, 0, 32, /* 0x 40 */ +132, 67, 0, 4, 84, 75, 85,190,124, 11, 40, 64, 65,162,255,220, /* 0x 50 */ + 66, 0,255,240, 78,128, 0, 32, 57, 32, 0, 0,149, 33,255,252, /* 0x 60 */ +124, 41, 11,120,125, 8, 2,166,128,159,255,248,124,100,248, 80, /* 0x 70 */ +128,195, 0, 24, 40, 6, 8, 0, 65,129, 0, 8, 56,192, 8, 0, /* 0x 80 */ +124, 61, 11,120,124, 38, 8, 80,124, 37, 11,120, 56, 33,255,232, /* 0x 90 */ +127,231,251,120, 72, 0, 4, 57,127,161,235,120,128, 67, 0, 0, /* 0x a0 */ +124, 73, 3,166,128, 67, 0,136,124, 79,241, 32,128, 67, 0,140, /* 0x b0 */ +124, 65, 3,166,128, 67, 0,144,124, 72, 3,166,184,131, 0, 24, /* 0x c0 */ +128, 3, 0, 8,128, 67, 0, 16,128, 99, 0, 20, 78,128, 4, 32, /* 0x d0 */ +124,199, 51,120, 56,192, 0, 0, 56, 0, 0,153, 72, 0, 0, 16, /* 0x e0 */ +125, 9, 67,120, 57, 0, 0, 0, 56, 0, 0,197, 68, 0, 0, 2, /* 0x f0 */ + 56, 96,255,255, 78,128, 0, 32, 56, 0, 0, 1, 75,255,255,240, /* 0x 100 */ + 56, 0, 0, 3, 75,255,255,232, 56, 0, 0, 5, 75,255,255,224, /* 0x 110 */ + 56, 0, 0, 6, 75,255,255,216, 56, 0, 0, 74, 75,255,255,208, /* 0x 120 */ +124, 8, 2,166,148, 33,255,240,144, 1, 0, 20,128, 3, 0, 0, /* 0x 130 */ +129, 35, 0, 4,127,128, 40, 64, 64,188, 0, 12, 56, 96, 0,127, /* 0x 140 */ + 75,255,255,185, 47,133, 0, 0, 65,158, 0, 28,124,169, 3,166, /* 0x 150 */ +136, 9, 0, 0, 57, 41, 0, 1,152, 4, 0, 0, 56,132, 0, 1, /* 0x 160 */ + 66, 0,255,240,128, 3, 0, 0,129, 35, 0, 4,124, 5, 0, 80, /* 0x 170 */ +144, 3, 0, 0,125, 41, 42, 20,128, 1, 0, 20, 56, 33, 0, 16, /* 0x 180 */ +145, 35, 0, 4,124, 8, 3,166, 78,128, 0, 32,124, 8, 2,166, /* 0x 190 */ +148, 33,255,192,191,129, 0, 48,124,159, 35,120,124,126, 27,120, /* 0x 1a0 */ +124,188, 43,120,144, 1, 0, 68,124,221, 51,120,128, 4, 0, 0, /* 0x 1b0 */ + 47,128, 0, 0, 65,158, 1, 32, 56,160, 0, 12,127,195,243,120, /* 0x 1c0 */ + 56,129, 0, 16, 75,255,255, 93,129, 33, 0, 16,128,161, 0, 20, /* 0x 1d0 */ + 47,137, 0, 0, 64,190, 0, 36, 60, 0, 33, 88, 96, 0, 80, 85, /* 0x 1e0 */ +127,133, 0, 0, 64,190, 0, 28,128, 30, 0, 0, 47,128, 0, 0, /* 0x 1f0 */ + 65,190, 0,228, 72, 0, 0, 12, 47,133, 0, 0, 64,190, 0, 12, /* 0x 200 */ + 56, 96, 0,127, 75,255,254,245,127, 5, 72, 64, 65,185,255,244, /* 0x 210 */ +128, 31, 0, 0,127,137, 0, 64, 65,189,255,232,128, 31, 0, 4, /* 0x 220 */ + 64,152, 0,132,124,164, 43,120,128,126, 0, 4,124, 5, 3,120, /* 0x 230 */ + 56,193, 0, 32,136,225, 0, 24,127,136, 3,166, 78,128, 0, 33, /* 0x 240 */ + 47,131, 0, 0, 64,190,255,188,128,129, 0, 32,128, 1, 0, 16, /* 0x 250 */ +127,132, 0, 0, 64,190,255,172,136,193, 0, 25, 49, 61,255,255, /* 0x 260 */ +124, 9,233, 16,125, 38, 0,208, 85, 41, 15,254,125, 43, 0, 57, /* 0x 270 */ + 65,162, 0, 20,128,127, 0, 4,127,168, 3,166,136,161, 0, 26, /* 0x 280 */ + 78,128, 0, 33,128, 30, 0, 4,129, 97, 0, 20,129, 62, 0, 0, /* 0x 290 */ +124, 0, 90, 20,125, 43, 72, 80,144, 30, 0, 4,145, 62, 0, 0, /* 0x 2a0 */ + 72, 0, 0, 16,124, 4, 3,120,127,195,243,120, 75,255,254,117, /* 0x 2b0 */ +129, 97, 0, 16,129, 63, 0, 0,128, 31, 0, 4,125, 43, 72, 80, /* 0x 2c0 */ + 47,137, 0, 0,124, 0, 90, 20,144, 31, 0, 4,145, 63, 0, 0, /* 0x 2d0 */ + 75,255,254,228,128, 1, 0, 68,187,129, 0, 48, 56, 33, 0, 64, /* 0x 2e0 */ +124, 8, 3,166, 78,128, 0, 32,124, 8, 2,166,148, 33,255,176, /* 0x 2f0 */ +190, 65, 0, 24,125,128, 0, 38, 58,224, 0, 0,124,122, 27,120, /* 0x 300 */ +144, 1, 0, 84,124,146, 35,120,128, 3, 0, 16,124,187, 43,120, /* 0x 310 */ +145,129, 0, 20,124,211, 51,120,127,151, 0, 64,124,244, 59,120, /* 0x 320 */ +125, 21, 67,120,125, 54, 75,120, 59,195, 0, 28, 59, 0, 0, 0, /* 0x 330 */ + 64,156, 1,124,129, 62, 0, 0, 47,137, 0, 1, 64,190, 1, 48, /* 0x 340 */ +129, 62, 0, 24,129,126, 0, 36, 85, 61, 5, 62,128, 30, 0, 28, /* 0x 350 */ +127,139,234, 20,145, 97, 0, 8, 46, 28, 0, 0,127, 41, 2, 20, /* 0x 360 */ +145, 33, 0, 12,127,253, 72, 80, 65,146, 0, 76, 47,155, 0, 0, /* 0x 370 */ + 64,190, 0, 16, 47,139, 0, 0, 56,192, 0, 18, 64,158, 0, 8, /* 0x 380 */ + 56,192, 16, 18, 47,139, 0, 0,126,103,155,120, 64,158, 0, 8, /* 0x 390 */ + 56,224,255,255,129, 30, 0, 32,127,227,251,120,127,132,227,120, /* 0x 3a0 */ + 56,160, 0, 3,125, 8,146, 20, 75,255,253, 57,127,159, 24, 0, /* 0x 3b0 */ + 64,158, 0,124, 47,155, 0, 0, 65,158, 0, 52,128, 30, 0, 36, /* 0x 3c0 */ + 47,128, 0, 0, 65,158, 0, 40,128, 30, 0, 32, 47,128, 0, 0, /* 0x 3d0 */ + 64,158, 0, 8,147,244, 0, 0,127, 99,219,120, 56,129, 0, 8, /* 0x 3e0 */ +126,165,171,120,126,198,179,120, 75,255,253,165,124, 28, 0,208, /* 0x 3f0 */ +125, 63,226, 20,112, 29, 15,255, 65,130, 0, 24,127,169, 3,166, /* 0x 400 */ + 56, 0, 0, 0,152, 9, 0, 0, 57, 41, 0, 1, 66, 0,255,248, /* 0x 410 */ + 65,178, 0, 36,128,190, 0, 44,127,227,251,120,127,132,227,120, /* 0x 420 */ + 75,255,252,249, 47,131, 0, 0, 65,190, 0, 12, 56, 96, 0,127, /* 0x 430 */ + 75,255,252,201,124, 28,234, 20,127,255, 2, 20,127,159,200, 64, /* 0x 440 */ + 64,188, 0, 84,128,190, 0, 44,124,159,200, 80,127,227,251,120, /* 0x 450 */ + 56,192, 16, 18, 56,224,255,255, 57, 0, 0, 0, 75,255,252,133, /* 0x 460 */ +127,159, 24, 0, 65,190, 0, 48, 75,255,255,196, 56, 9,255,252, /* 0x 470 */ + 43,128, 0, 1, 65,157, 0, 32,128, 30, 0, 8, 47,128, 0, 1, /* 0x 480 */ + 64,190, 0, 20,128, 30, 0, 12, 47,128, 0, 40, 64,190, 0, 8, /* 0x 490 */ + 58,254, 0, 16,128, 26, 0, 16, 59, 24, 0, 1,127,152, 0, 64, /* 0x 4a0 */ +128, 30, 0, 4,127,222, 2, 20, 75,255,254,136,128, 1, 0, 84, /* 0x 4b0 */ +126,227,187,120,129,129, 0, 20,186, 65, 0, 24,124, 8, 3,166, /* 0x 4c0 */ + 56, 33, 0, 80,125,128,129, 32, 78,128, 0, 32,148, 33,255,192, /* 0x 4d0 */ +124, 8, 2,166,144,129, 0, 8,191, 97, 0, 44,129, 97, 0, 8, /* 0x 4e0 */ +124,191, 43,120,144, 1, 0, 68, 56, 3, 0, 24, 57,107,255,232, /* 0x 4f0 */ +144, 1, 0, 20,145, 97, 0, 16,125, 27, 67,120,128, 3, 0, 24, /* 0x 500 */ +125, 60, 75,120,200, 1, 0, 16,124,253, 59,120,124,229, 59,120, /* 0x 510 */ + 56, 97, 0, 16, 56,129, 0, 24,124,222, 51,120, 56,192, 0, 0, /* 0x 520 */ +144, 1, 0, 24,216, 1, 0, 32,147,225, 0, 28, 75,255,252, 97, /* 0x 530 */ +127,105,219,120,127,135,227,120,127,227,251,120,127,168,235,120, /* 0x 540 */ + 56,128, 0, 0, 56,161, 0, 32, 56,192,255,255, 59, 96, 0, 0, /* 0x 550 */ + 75,255,253,153,129, 95, 0, 16, 57, 96, 0, 0,124,124, 27,120, /* 0x 560 */ +127,139, 80, 64, 57, 63, 0, 28, 64,156, 0,224,128, 9, 0, 0, /* 0x 570 */ + 57,107, 0, 1,127, 11, 80, 64, 47,128, 0, 14, 64,190, 0,192, /* 0x 580 */ +128,105, 0, 8, 56,128, 0, 0, 56,160, 0, 0,124,105, 26, 20, /* 0x 590 */ + 75,255,251,121,124,125, 27,121, 65,128, 0, 32,127,163,235,120, /* 0x 5a0 */ +127,228,251,120,127,197,243,120,127,102,219,120, 75,255,251, 37, /* 0x 5b0 */ +127,158, 24, 0, 65,190, 0, 20, 56, 96, 0,127, 75,255,251, 61, /* 0x 5c0 */ +131,105, 0, 8, 75,255,255,216,128, 31, 0, 0, 61, 32,202,254, /* 0x 5d0 */ + 97, 41,186,190,127,128, 72, 0, 64,158, 0, 52,129, 95, 0, 4, /* 0x 5e0 */ + 57, 96, 0, 0, 57, 63, 0, 8,127,139, 80, 64, 64,156, 0, 32, /* 0x 5f0 */ +128, 9, 0, 0, 57,107, 0, 1,127, 11, 80, 64, 47,128, 0, 18, /* 0x 600 */ + 65,190,255,192, 57, 41, 0, 20, 65,152,255,232,127,227,251,120, /* 0x 610 */ +127,100,219,120, 56,160, 0, 0,127,166,235,120, 56,224, 0, 0, /* 0x 620 */ + 57, 0, 0, 0, 57, 32, 0, 0, 75,255,252,193,124,124, 27,120, /* 0x 630 */ +127,163,235,120, 75,255,250,221, 72, 0, 0, 16,128, 9, 0, 4, /* 0x 640 */ +125, 41, 2, 20, 65,152,255, 40,128, 1, 0, 68,127,131,227,120, /* 0x 650 */ +187, 97, 0, 44, 56, 33, 0, 64,124, 8, 3,166, 78,128, 0, 32 /* 0x 660 */ +}; diff --git a/src/stub/powerpc-linux.elf-entry.h b/src/stub/powerpc-linux.elf-entry.h new file mode 100644 index 00000000..27ed6640 --- /dev/null +++ b/src/stub/powerpc-linux.elf-entry.h @@ -0,0 +1,73 @@ +/* powerpc-linux.elf-entry.h -- created from powerpc-linux.elf-entry.bin, 604 (0x25c) 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 + + */ + + +#define LINUX_ELFPPC32_LOADER_SIZE 604 +#define LINUX_ELFPPC32_LOADER_ADLER32 0x0a8bbdb5 +#define LINUX_ELFPPC32_LOADER_CRC32 0xcfe347e7 + +unsigned char linux_elfppc32_loader[604] = { + 72, 0, 2, 77,124, 0, 41,236,144,166, 0, 0,124,132, 26, 20, /* 0x 0 */ + 60, 0,128, 0, 61, 32,128, 0, 56, 99,255,255, 56,165,255,255, /* 0x 10 */ + 57, 64,255,255,125,168, 2,166, 72, 0, 1, 12, 57, 32, 0, 1, /* 0x 20 */ +125, 41, 28, 44, 56, 99, 0, 4,124, 9, 0, 64,125, 41, 72, 20, /* 0x 30 */ + 97, 41, 0, 1, 78,128, 0, 32,141, 3, 0, 1,157, 5, 0, 1, /* 0x 40 */ +124, 9, 0, 64,125, 41, 74, 20, 65,162,255,213, 65,129,255,236, /* 0x 50 */ + 56,224, 0, 1, 72, 0, 0, 20, 56,231,255,255,125, 41, 72, 21, /* 0x 60 */ + 65,162,255,189,124,231, 57, 20,125, 41, 72, 21, 65,162,255,177, /* 0x 70 */ +124,231, 57, 20,124, 9, 0, 64,125, 41, 74, 20, 65,162,255,161, /* 0x 80 */ + 65,160,255,216, 57, 0, 0, 0, 52,231,255,253, 84,231, 64, 46, /* 0x 90 */ + 65,128, 0, 32,140, 67, 0, 1,124,234, 16,249,125, 74, 14,112, /* 0x a0 */ + 65,130, 0,148,112, 66, 0, 1, 65,162, 0, 80, 72, 0, 0, 20, /* 0x b0 */ +124, 9, 0, 64,125, 41, 74, 20, 65,162,255,101, 65,161, 0, 60, /* 0x c0 */ + 57, 0, 0, 1,124, 9, 0, 64,125, 41, 74, 20, 65,162,255, 81, /* 0x d0 */ + 65,161, 0, 40,125, 41, 72, 21, 65,162,255, 69,125, 8, 65, 20, /* 0x e0 */ +124, 9, 0, 64,125, 41, 74, 20, 65,162,255, 53, 65,160,255,232, /* 0x f0 */ + 57, 8, 0, 2, 72, 0, 0, 16,125, 41, 72, 21, 65,162,255, 33, /* 0x 100 */ +125, 8, 65, 20, 32,234,250,255, 57, 8, 0, 2,125, 8, 1,148, /* 0x 110 */ +124,234, 42, 20,125, 9, 3,166,141, 7, 0, 1,157, 5, 0, 1, /* 0x 120 */ + 66, 0,255,248, 56,224, 1, 0,124, 7, 41,236,124, 7, 26, 44, /* 0x 130 */ + 75,255,255, 16,128, 6, 0, 0,125,168, 3,166, 56,165, 0, 1, /* 0x 140 */ + 56, 99, 0, 1,124,160, 40, 80,124,100, 24, 80,144,166, 0, 0, /* 0x 150 */ + 78,128, 0, 32, 10, 36, 73,100, 58, 32, 85, 80, 88, 32, 40, 67, /* 0x 160 */ + 41, 32, 49, 57, 57, 54, 45, 50, 48, 48, 54, 32,116,104,101, 32, /* 0x 170 */ + 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108,108, 32, 82,105, /* 0x 180 */ +103,104,116,115, 32, 82,101,115,101,114,118,101,100, 46, 32,104, /* 0x 190 */ +116,116,112, 58, 47, 47,117,112,120, 46,115,102, 46,110,101,116, /* 0x 1a0 */ + 32, 36, 10, 0, 72, 0, 0, 37, 80, 82, 79, 84, 95, 69, 88, 69, /* 0x 1b0 */ + 67,124, 80, 82, 79, 84, 95, 87, 82, 73, 84, 69, 32,102, 97,105, /* 0x 1c0 */ +108,101,100, 46, 10, 0, 0, 0, 56,160, 0, 32,124,136, 2,166, /* 0x 1d0 */ + 56, 96, 0, 2, 56, 0, 0, 4, 68, 0, 0, 2, 56, 96, 0,127, /* 0x 1e0 */ + 56, 0, 0, 1, 68, 0, 0, 2,127,200, 2,166, 57, 0, 0, 0, /* 0x 1f0 */ + 56,224,255,255,128,126, 0, 4, 56,192, 0, 50, 56,160, 0, 7, /* 0x 200 */ + 56,128, 16, 0,124, 99,242, 20, 56, 0, 0, 90, 56, 99, 16, 11, /* 0x 210 */ + 84, 99, 0, 38, 68, 0, 0, 2, 65,163,255,140,127,233, 3,166, /* 0x 220 */ +136,254, 0, 8, 56,193, 0,124,124,101, 27,120,124,104, 3,166, /* 0x 230 */ +128,158, 0, 4, 56,126, 0, 12, 78,128, 4, 32,148, 33,255,128, /* 0x 240 */ +188, 65, 0, 4,127,232, 2,166, 75,255,255,161 /* 0x 250 */ +}; diff --git a/src/stub/powerpc-linux.elf-fold.h b/src/stub/powerpc-linux.elf-fold.h new file mode 100644 index 00000000..da2522ef --- /dev/null +++ b/src/stub/powerpc-linux.elf-fold.h @@ -0,0 +1,177 @@ +/* powerpc-linux.elf-fold.h -- created from powerpc-linux.elf-fold.bin, 2260 (0x8d4) 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 + + */ + + +#define LINUX_ELFPPC32_FOLD_SIZE 2260 +#define LINUX_ELFPPC32_FOLD_ADLER32 0x6c8685d0 +#define LINUX_ELFPPC32_FOLD_CRC32 0xa1bffc23 + +unsigned char linux_elfppc32_fold[2260] = { +127, 69, 76, 70, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */ + 0, 2, 0, 20, 0, 0, 0, 1, 0, 16, 0,128, 0, 0, 0, 52, /* 0x 10 */ + 0, 0, 7,188, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 40, /* 0x 20 */ + 0, 7, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 16, 0, 0, /* 0x 30 */ + 0, 16, 0, 0, 0, 0, 7,132, 0, 0, 7,132, 0, 0, 0, 5, /* 0x 40 */ + 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 7,132, 0, 16, 7,132, /* 0x 50 */ + 0, 16, 7,132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, /* 0x 60 */ + 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */ + 72, 0, 0,125, 40, 6, 0,208, 76,130, 0, 32, 84,132,240,191, /* 0x 80 */ + 77,130, 0, 32, 60, 0, 0, 16,124, 4, 0, 64, 65,128, 0, 8, /* 0x 90 */ +124, 4, 3,120, 56,165, 1, 32,124,103, 27,120, 56, 99,255,252, /* 0x a0 */ +124,137, 3,166, 72, 0, 0, 28, 84, 75, 2,186,125, 99, 88, 80, /* 0x b0 */ +125,107, 58, 20, 81, 98, 1,186,144, 67, 0, 0, 78, 64, 0, 32, /* 0x c0 */ +132, 67, 0, 4, 84, 75, 85,190,124, 11, 40, 64, 65,162,255,220, /* 0x d0 */ + 66, 0,255,240, 78,128, 0, 32,128, 73, 0, 0, 57, 41, 0, 4, /* 0x e0 */ + 47,130, 0, 0, 64,158,255,244, 78,128, 0, 32,125, 8, 2,166, /* 0x f0 */ +129, 33, 0, 0, 75,255,255,229, 75,255,255,225,128,159,255,248, /* 0x 100 */ + 85, 30, 0, 38, 56,161,248, 0,127,231,251,120,124,100,248, 80, /* 0x 110 */ + 56, 33,247,240, 84,125, 0, 38,128,195, 0, 24, 72, 0, 5, 9, /* 0x 120 */ +124,127, 27,120,127,163,235,120,124,157,240, 80, 72, 0, 0, 81, /* 0x 130 */ +127,232, 3,166,184, 65, 8, 20,128, 33, 8, 16, 78,128, 0, 32, /* 0x 140 */ + 56, 0, 0, 90, 68, 0, 0, 2, 64,163, 0, 8, 56, 96,255,255, /* 0x 150 */ + 78,128, 0, 32, 56, 0, 0, 1, 75,255,255,236, 56, 0, 0, 3, /* 0x 160 */ + 75,255,255,228, 56, 0, 0, 5, 75,255,255,220, 56, 0, 0, 6, /* 0x 170 */ + 75,255,255,212, 56, 0, 0,125, 75,255,255,204, 56, 0, 0, 91, /* 0x 180 */ + 75,255,255,196, 56, 0, 0, 45, 75,255,255,188,124, 8, 2,166, /* 0x 190 */ +148, 33,255,240,144, 1, 0, 20,128, 3, 0, 0,129, 35, 0, 4, /* 0x 1a0 */ +127,128, 40, 64, 64,188, 0, 12, 56, 96, 0,127, 75,255,255,169, /* 0x 1b0 */ + 47,133, 0, 0, 65,158, 0, 28,124,169, 3,166,136, 9, 0, 0, /* 0x 1c0 */ + 57, 41, 0, 1,152, 4, 0, 0, 56,132, 0, 1, 66, 0,255,240, /* 0x 1d0 */ +128, 3, 0, 0,129, 35, 0, 4,124, 5, 0, 80,144, 3, 0, 0, /* 0x 1e0 */ +125, 41, 42, 20,128, 1, 0, 20, 56, 33, 0, 16,145, 35, 0, 4, /* 0x 1f0 */ +124, 8, 3,166, 78,128, 0, 32,124, 8, 2,166,148, 33,255,192, /* 0x 200 */ +191,129, 0, 48,124,159, 35,120,124,126, 27,120,124,188, 43,120, /* 0x 210 */ +144, 1, 0, 68,124,221, 51,120,128, 4, 0, 0, 47,128, 0, 0, /* 0x 220 */ + 65,158, 1, 32, 56,160, 0, 12,127,195,243,120, 56,129, 0, 16, /* 0x 230 */ + 75,255,255, 93,129, 33, 0, 16,128,161, 0, 20, 47,137, 0, 0, /* 0x 240 */ + 64,190, 0, 36, 60, 0, 33, 88, 96, 0, 80, 85,127,133, 0, 0, /* 0x 250 */ + 64,190, 0, 28,128, 30, 0, 0, 47,128, 0, 0, 65,190, 0,228, /* 0x 260 */ + 72, 0, 0, 12, 47,133, 0, 0, 64,190, 0, 12, 56, 96, 0,127, /* 0x 270 */ + 75,255,254,229,127, 5, 72, 64, 65,185,255,244,128, 31, 0, 0, /* 0x 280 */ +127,137, 0, 64, 65,189,255,232,128, 31, 0, 4, 64,152, 0,132, /* 0x 290 */ +124,164, 43,120,128,126, 0, 4,124, 5, 3,120, 56,193, 0, 32, /* 0x 2a0 */ +136,225, 0, 24,127,136, 3,166, 78,128, 0, 33, 47,131, 0, 0, /* 0x 2b0 */ + 64,190,255,188,128,129, 0, 32,128, 1, 0, 16,127,132, 0, 0, /* 0x 2c0 */ + 64,190,255,172,136,193, 0, 25, 49, 61,255,255,124, 9,233, 16, /* 0x 2d0 */ +125, 38, 0,208, 85, 41, 15,254,125, 43, 0, 57, 65,162, 0, 20, /* 0x 2e0 */ +128,127, 0, 4,127,168, 3,166,136,161, 0, 26, 78,128, 0, 33, /* 0x 2f0 */ +128, 30, 0, 4,129, 97, 0, 20,129, 62, 0, 0,124, 0, 90, 20, /* 0x 300 */ +125, 43, 72, 80,144, 30, 0, 4,145, 62, 0, 0, 72, 0, 0, 16, /* 0x 310 */ +124, 4, 3,120,127,195,243,120, 75,255,254,117,129, 97, 0, 16, /* 0x 320 */ +129, 63, 0, 0,128, 31, 0, 4,125, 43, 72, 80, 47,137, 0, 0, /* 0x 330 */ +124, 0, 90, 20,144, 31, 0, 4,145, 63, 0, 0, 75,255,254,228, /* 0x 340 */ +128, 1, 0, 68,187,129, 0, 48, 56, 33, 0, 64,124, 8, 3,166, /* 0x 350 */ + 78,128, 0, 32, 44, 3, 0, 0, 77,130, 0, 32, 48, 4,255,255, /* 0x 360 */ +125, 96, 33, 16,128, 3, 0, 0,127,128, 32, 0,104, 9, 0, 1, /* 0x 370 */ + 33, 73, 0, 0,125, 42, 73, 20,125, 42, 88, 57, 65,158, 0, 8, /* 0x 380 */ + 65,162, 0, 16,144,163, 0, 4,144,131, 0, 0, 78,128, 0, 32, /* 0x 390 */ + 56, 99, 0, 8, 75,255,255,208,124, 8, 2,166,148, 33,255,160, /* 0x 3a0 */ +125,128, 0, 38,190, 65, 0, 40,124,121, 27,120,124,151, 35,120, /* 0x 3b0 */ +144, 1, 0,100,124,178, 43,120,161, 67, 0, 44,124,211, 51,120, /* 0x 3c0 */ +160, 3, 0, 16,124,244, 59,120, 53, 74,255,255,129, 35, 0, 28, /* 0x 3d0 */ +104, 0, 0, 3,145,129, 0, 36,124, 0, 0,208,127,163, 74, 20, /* 0x 3e0 */ + 84, 3, 46,246,125, 21, 67,120, 56, 99, 8, 34,127,171,235,120, /* 0x 3f0 */ + 59,224,255,255, 59,192, 0, 0, 65,128, 0, 68, 57, 74, 0, 1, /* 0x 400 */ +125, 73, 3,166,128, 11, 0, 0, 47,128, 0, 1, 64,190, 0, 40, /* 0x 410 */ +129, 43, 0, 8,127,137,248, 64, 64,156, 0, 8,125, 63, 75,120, /* 0x 420 */ +128, 11, 0, 20,124, 0, 74, 20,127,158, 0, 64, 64,156, 0, 8, /* 0x 430 */ +124, 30, 3,120, 57,107, 0, 32, 66, 0,255,204, 87,255, 0, 38, /* 0x 440 */ +124,102, 27,120,125, 63,240, 80,127,227,251,120, 57, 41, 15,255, /* 0x 450 */ + 56,160, 0, 0, 85, 62, 0, 38, 56,224,255,255,127,196,243,120, /* 0x 460 */ + 57, 0, 0, 0, 75,255,252,221,160, 25, 0, 44, 58,192, 0, 0, /* 0x 470 */ +127, 31, 24, 80,127,150, 0, 0,124, 3,242, 20,144, 1, 0, 8, /* 0x 480 */ + 64,156, 1,128, 46, 23, 0, 0, 65,146, 0, 40,128, 29, 0, 0, /* 0x 490 */ + 47,128, 0, 6, 64,190, 0, 28,128,189, 0, 8,126, 99,155,120, /* 0x 4a0 */ + 56,128, 0, 3,124,165,194, 20, 75,255,254,173, 72, 0, 1, 64, /* 0x 4b0 */ +128, 29, 0, 0, 47,128, 0, 1, 64,190, 1, 52,128, 29, 0, 24, /* 0x 4c0 */ + 61, 32,115, 81,129, 93, 0, 8, 97, 41, 98, 64, 84, 0, 22,250, /* 0x 4d0 */ +129,125, 0, 20,125, 41, 4, 48, 85, 94, 5, 62, 48, 23,255,255, /* 0x 4e0 */ +124,160,185, 16,128, 29, 0, 16, 85, 58, 7,126,127,106, 90, 20, /* 0x 4f0 */ + 84,165, 8, 60,127,254, 80, 80,144, 1, 0, 16,127,128,242, 20, /* 0x 500 */ +145, 65, 0, 20,127,255,194, 20,127,123,194, 20,124,165,211,120, /* 0x 510 */ + 65,146, 0, 12, 56,192, 0, 50, 72, 0, 0, 8, 56,192, 0, 18, /* 0x 520 */ + 64,146, 0, 12,126, 71,147,120, 72, 0, 0, 8, 56,224,255,255, /* 0x 530 */ +129, 29, 0, 4,127,227,251,120,127,132,227,120,125, 30, 64, 80, /* 0x 540 */ + 75,255,252, 1,127,159, 24, 0, 64,158, 0,104, 65,178, 0, 24, /* 0x 550 */ +126,227,187,120, 56,129, 0, 16,126,133,163,120,126,166,171,120, /* 0x 560 */ + 75,255,252,153,115, 64, 0, 2,124, 28, 0,208, 84, 30, 5, 62, /* 0x 570 */ + 65,130, 0, 36, 47,158, 0, 0,125, 63,226, 20, 65,158, 0, 24, /* 0x 580 */ +127,201, 3,166, 56, 0, 0, 0,152, 9, 0, 0, 57, 41, 0, 1, /* 0x 590 */ + 66, 0,255,248, 65,178, 0, 36,127,227,251,120,127,132,227,120, /* 0x 5a0 */ +127, 69,211,120, 75,255,251,209, 47,131, 0, 0, 65,190, 0, 12, /* 0x 5b0 */ + 56, 96, 0,127, 75,255,251,161,124, 28,242, 20,127,255, 2, 20, /* 0x 5c0 */ +127,159,216, 64, 64,188, 0, 40,124,159,216, 80,127, 69,211,120, /* 0x 5d0 */ +127,227,251,120, 56,192, 0, 50, 56,224,255,255, 57, 0, 0, 0, /* 0x 5e0 */ + 75,255,251, 97,127,159, 24, 0, 64,190,255,200,160, 25, 0, 44, /* 0x 5f0 */ + 58,214, 0, 1, 59,189, 0, 32,127,150, 0, 0, 75,255,254,132, /* 0x 600 */ +128,121, 0, 24,128, 1, 0,100,129,129, 0, 36,124, 99,194, 20, /* 0x 610 */ +124, 8, 3,166,186, 65, 0, 40,125,128,129, 32, 56, 33, 0, 96, /* 0x 620 */ + 78,128, 0, 32,124, 8, 2,166,148, 33,255,192, 56,132,255,232, /* 0x 630 */ +191, 97, 0, 44,144,129, 0, 8,124,191, 43,120,144, 1, 0, 68, /* 0x 640 */ + 56, 3, 0, 24,144, 1, 0, 12,124,229, 59,120,128, 3, 0, 24, /* 0x 650 */ + 56,192, 0, 0,200, 1, 0, 8, 56, 97, 0, 8, 56,129, 0, 16, /* 0x 660 */ + 59,223, 0, 52,125, 61, 75,120,124,251, 59,120,144, 1, 0, 16, /* 0x 670 */ +125, 28, 67,120,216, 1, 0, 24,147,225, 0, 20, 75,255,251,125, /* 0x 680 */ +128,190, 0, 8,127,163,235,120, 56,128, 0, 3, 56,165, 0, 52, /* 0x 690 */ + 75,255,252,197,160,191, 0, 44,127,163,235,120, 56,128, 0, 5, /* 0x 6a0 */ + 75,255,252,181,128,191, 0, 24,127,163,235,120, 56,128, 0, 9, /* 0x 6b0 */ + 75,255,252,165,127,103,219,120,127,136,227,120,127,227,251,120, /* 0x 6c0 */ +127,166,235,120, 56,129, 0, 24, 56,160, 0, 0, 59, 96, 0, 0, /* 0x 6d0 */ + 75,255,252,201,160, 31, 0, 44,124,124, 27,120,127,155, 0, 0, /* 0x 6e0 */ + 64,156, 0,124,128, 30, 0, 0, 59,123, 0, 1, 56,128, 0, 0, /* 0x 6f0 */ + 56,160, 0, 0, 47,128, 0, 3, 64,190, 0, 88,128,126, 0, 8, /* 0x 700 */ + 75,255,250,101,127,228,251,120,124,125, 27,121, 56,160, 2, 0, /* 0x 710 */ + 65,128, 0, 40, 75,255,250, 73, 56,128, 0, 0, 47,131, 2, 0, /* 0x 720 */ +127,165,235,120,127,227,251,120, 56,192, 0, 0, 56,224, 0, 0, /* 0x 730 */ + 57, 0, 0, 0, 65,190, 0, 12, 56, 96, 0,127, 75,255,250, 25, /* 0x 740 */ + 75,255,252, 89,124,124, 27,120,127,163,235,120, 75,255,250, 33, /* 0x 750 */ +160, 31, 0, 44, 59,222, 0, 32, 75,255,255,132,128, 1, 0, 68, /* 0x 760 */ +127,131,227,120,187, 97, 0, 44, 56, 33, 0, 64,124, 8, 3,166, /* 0x 770 */ + 78,128, 0, 32, 0, 46,115,104,115,116,114,116, 97, 98, 0, 46, /* 0x 780 */ +116,101,120,116, 0, 46, 98,115,115, 0, 46,115,100, 97,116, 97, /* 0x 790 */ + 0, 46,115,100, 97,116, 97, 50, 0, 46,110,111,116,101, 46, 71, /* 0x 7a0 */ + 78, 85, 45,115,116, 97, 99,107, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 7b0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 7c0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 7d0 */ + 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 1, 0, 0, 0, 6, /* 0x 7e0 */ + 0, 16, 0,128, 0, 0, 0,128, 0, 0, 7, 4, 0, 0, 0, 0, /* 0x 7f0 */ + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 17, /* 0x 800 */ + 0, 0, 0, 8, 0, 0, 0, 3, 0, 16, 7,132, 0, 0, 7,132, /* 0x 810 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x 820 */ + 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 1, 0, 0, 0, 3, /* 0x 830 */ + 0, 16, 7,132, 0, 0, 7,132, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 840 */ + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 29, /* 0x 850 */ + 0, 0, 0, 1, 0, 0, 0, 2, 0, 16, 7,132, 0, 0, 7,132, /* 0x 860 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, /* 0x 870 */ + 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 7, 0, 0, 0, 0, /* 0x 880 */ + 0, 0, 0, 0, 0, 0, 7,132, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 890 */ + 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x 8a0 */ + 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,132, /* 0x 8b0 */ + 0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0x 8c0 */ + 0, 0, 0, 0 /* 0x 8d0 */ +}; diff --git a/src/stub/scripts/UNUSED/asl_m68k.sh b/src/stub/scripts/UNUSED/asl_m68k.sh new file mode 100644 index 00000000..22e722ce --- /dev/null +++ b/src/stub/scripts/UNUSED/asl_m68k.sh @@ -0,0 +1,50 @@ +#! /bin/sh +# +# asl_m68k.sh -- +# +# This file is part of the UPX executable compressor. +# +# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 1996-2006 Laszlo Molnar +# 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 +# +# + +set -e + +# wrapper for the ASL cross-assembler (version 1.42bld43) +# http://john.ccac.rwth-aachen.de:8000/as/ +# http://john.ccac.rwth-aachen.de:8000/ftp/as/source/c_version/ + +file="$1" +test -f "$file" || exit 1 + +ofile=`echo "$file" | sed 's/\.[a-z]*$/.o/'` + +# convert ' to " in dc.x statements +perl -p -i -e ' + s,\x27,",g if m,^\s*dc\.,; +' "$file" + +echo asl -q -xC -U -cpu 68000 -o "$ofile" -L "$file" + asl -q -xC -U -cpu 68000 -o "$ofile" -L "$file" + +exit 0 + diff --git a/src/stub/scripts/UNUSED/bin2h.pl b/src/stub/scripts/UNUSED/bin2h.pl new file mode 100644 index 00000000..b7368309 --- /dev/null +++ b/src/stub/scripts/UNUSED/bin2h.pl @@ -0,0 +1,143 @@ +#! /usr/bin/perl -w +# +# bin2h.pl -- +# +# 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 +# +# + + +use Compress::Zlib; + +$delim = $/; +undef $/; # undef input record separator - read file as a whole + +$ifile = shift || die; +$ident = shift || die; +$ofile = shift || die; + +$opt_q = ""; +$opt_q = shift if ($#ARGV >= 0); + +# open ifile +open(INFILE,$ifile) || die "open $ifile\n"; +binmode(INFILE); + +# check file size +@st = stat($ifile); +if (1 && $st[7] <= 0) { + print STDERR "$ifile: ERROR: emtpy file\n"; + exit(1); +} +if (1 && $st[7] > 64*1024) { + print STDERR "$ifile: ERROR: file is too big (${st[7]} bytes)\n"; + if ($ifile =~ /^fold/) { + print STDERR " (please upgrade your binutils to 2.12.90.0.15 or better)\n"; + } + exit(1); +} + +# read whole file +$data = ; +close(INFILE) || die; +$n = length($data); +die if ($n != $st[7]); + +# open ofile +open(OUTFILE,">$ofile") || die "open $ofile\n"; +binmode(OUTFILE); +select(OUTFILE); + +$if = $ifile; +$if =~ s/.*[\/\\]//; +$of = $ofile; +$of =~ s/.*[\/\\]//; + +if ($opt_q ne "-q") { +printf ("/* %s -- created from %s, %d (0x%x) bytes\n", $of, $if, $n, $n); +print <<"EOF"; + + 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 + + */ + + +EOF +} + +$s = $ident; +$s =~ tr/a-z/A-Z/; +printf("#define %s_SIZE %d\n", $s, $n); +printf("#define %s_ADLER32 0x%08x\n", $s, &adler32($data)); +printf("#define %s_CRC32 0x%08x\n", $s, &crc32($data)); +printf("\n"); + +printf("unsigned char %s[%d] = {", $ident, $n); +for ($i = 0; $i < $n; $i++) { + if ($i % 16 == 0) { + printf(" /* 0x%4x */", $i - 16) if $i > 0; + print "\n"; + } + printf("%3d", ord(substr($data, $i, 1))); + print "," if ($i != $n - 1); +} + +while (($i % 16) != 0) { + $i++; + print " "; +} +printf(" /* 0x%4x */", $i - 16); + +print "\n};\n"; + +close(OUTFILE) || die; +select(STDOUT); + +undef $delim; +exit(0); + +# vi:ts=4:et diff --git a/src/stub/scripts/UNUSED/setfold.pl b/src/stub/scripts/UNUSED/setfold.pl new file mode 100644 index 00000000..d145d645 --- /dev/null +++ b/src/stub/scripts/UNUSED/setfold.pl @@ -0,0 +1,58 @@ +#! /usr/bin/perl -w +# +# setfold.pl -- set Elf32_Phdr[1].p_offset +# +# This file is part of the UPX executable compressor. +# +# 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 +# +# +# John F. Reiser +# +# + + +$fname = shift || die; +sysopen (FH,$fname,2) || die; +binmode FH; + +$fsize = (stat($fname))[7]; + +$val = shift || die "$val"; +###print STDERR "$val\n"; +$val = oct($val); # acutally hex() +$val = $val & 0xfff; +printf STDERR "setfold info: $fname: setting fold to 0x%x, file size 0x%x\n", $val, $fsize; +die unless $val > 0; +die unless $val < $fsize; +$num = pack("V", $val); + +# 0x34 = sizeof(Elf32_Ehdr) +# 0x20 = sizeof(Elf32_Phdr) +# 4 = offset(p_offset) +sysseek (FH,0x34+0x20+4,0) || die; + +syswrite (FH,$num,4) || die; + +close(FH) || die; +exit 0; + +# vi:ts=4:et diff --git a/src/stub/scripts/UNUSED/setfold.sh b/src/stub/scripts/UNUSED/setfold.sh new file mode 100644 index 00000000..8ca0f727 --- /dev/null +++ b/src/stub/scripts/UNUSED/setfold.sh @@ -0,0 +1,52 @@ +#! /bin/sh +# +# setfold.sh -- +# +# This file is part of the UPX executable compressor. +# +# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 1996-2006 Laszlo Molnar +# 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 +# +# + +set -e + +file="$1" + +# get directory of this script +bindir=`echo "$0" | sed -e 's|[^/][^/]*$||'` +bindir=`cd "$bindir" && pwd` + +sstrip="./util/sstrip/sstrip" +test -x "$sstrip" || sstrip="$bindir/../util/sstrip/sstrip" + +# get address of symbol "fold_begin" +fold=`nm -f bsd "$file" | grep fold_begin | sed 's/^0*\([0-9a-fA-F]*\).*/0x\1/'` + +# strip +objcopy -S -R .comment -R .note "$file" +"$sstrip" "$file" + +# patch address +perl -w "$bindir/setfold.pl" "$file" "$fold" + +exit 0 + diff --git a/src/stub/scripts/UNUSED/stripelf.pl b/src/stub/scripts/UNUSED/stripelf.pl new file mode 100644 index 00000000..1c360afe --- /dev/null +++ b/src/stub/scripts/UNUSED/stripelf.pl @@ -0,0 +1,78 @@ +#! /usr/bin/perl -w +# +# stripelf.pl -- strip section headers from an ELF executable +# +# This file is part of the UPX executable compressor. +# +# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 1996-2006 Laszlo Molnar +# 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 +# +# + +# +# Strip section headers from the Linux stub. Section headers are +# optional for executables, but nevertheless binutils (2.9.1.0.25) +# complain with a "File format not recognized" error. +# Looks like a bug in binutils to me. +# +# A positive side effect of this is that `strip' cannot ruin an UPX +# compressed file any longer. +# + +$fname = shift || die; +sysopen (FH,$fname,2) || die; +binmode FH; + +sysseek (FH,0x20,0) || die; +sysread (FH,$num,4) || die; +$shpos = unpack ("V",$num); # e_shoff + +sysseek (FH,0x2e,0) || die; +sysread (FH,$num,2) || die; +$ssize = unpack ("v",$num); # e_shentsize + +sysseek (FH,0x32,0) || die; +sysread (FH,$num,2) || die; +$idx = unpack ("v",$num); # e_shstrndx + +sysseek (FH,$shpos + $idx * $ssize + 16,0) || die; +sysread (FH,$num,4) || die; +$neweof = unpack ("V",$num); # sh_offset of the e_shstrndx section + +$num = pack ("x6"); +sysseek (FH,0x20,0) || die; +syswrite (FH,$num,4) || die; # clear e_shoff + +if (1) { + sysseek (FH,0x2e,0) || die; + syswrite (FH,$num,6) || die; # clear e_shentsize, e_shnum & e_shstrndx +} else { + sysseek (FH,0x30,0) || die; + syswrite (FH,$num,4) || die; # clear e_shnum & e_shstrndx +} + +truncate (FH,$neweof) || die; +close(FH) || die; + +print STDOUT "$0: truncated $fname to $neweof bytes.\n"; +exit 0; + +# vi:ts=4:et diff --git a/src/stub/scripts/UNUSED/version.pl b/src/stub/scripts/UNUSED/version.pl new file mode 100644 index 00000000..878f3f50 --- /dev/null +++ b/src/stub/scripts/UNUSED/version.pl @@ -0,0 +1,42 @@ +#! /usr/bin/perl -w +# +# version.pl -- convert version.h into version.asy +# +# This file is part of the UPX executable compressor. +# +# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 1996-2006 Laszlo Molnar +# 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 +# +# + + +$mode = shift || "--nasm"; +while (<>) { + chop; + s/\s+$//; + if (/^\s*\#\s*define\s+(.*)/) { + print "%define $1\n" if ($mode eq "--nasm"); + } +} + +exit (0); + +# vi:ts=4:et diff --git a/src/stub/scripts/bin2h.py b/src/stub/scripts/bin2h.py index 21890faf..214aff1f 100644 --- a/src/stub/scripts/bin2h.py +++ b/src/stub/scripts/bin2h.py @@ -1,14 +1,11 @@ #! /usr/bin/env python -# -*- coding: iso-8859-1 -*- -# vi:ts=4:et +## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- # # bin2h.py -- # # 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 @@ -31,7 +28,13 @@ # -import os, sys, zlib +import getopt, os, re, sys, zlib + + +class opts: + dry_run = 0 + ident = None + verbose = 0 def w_header(w, ifile, ofile, n): @@ -91,11 +94,19 @@ def w_data(w, data): def main(argv): - ifile = argv[1] - ident = argv[2] - ofile = argv[3] + shortopts, longopts = "qv", ["dry-run", "ident=", "quiet", "verbose"] + xopts, args = getopt.gnu_getopt(argv[1:], shortopts, longopts) + for opt, optarg in xopts: + if 0: pass + elif opt in ["-q", "--quiet"]: opts.verbose = opts.verbose - 1 + elif opt in ["-v", "--verbose"]: opts.verbose = opts.verbose + 1 + elif opt in ["--dry-run"]: opts.dry_run = opts.dry_run + 1 + elif opt in ["--ident"]: opts.ident = optarg + else: assert 0, ("getopt problem:", opt, optarg, xopts, args) - opt_q = len(argv) >= 5 + assert len(args) == 2 + ifile = args[0] + ofile = args[1] # check file size st = os.stat(ifile) @@ -117,12 +128,14 @@ def main(argv): # write ofile fp = open(ofile, "wb") w = fp.write - if not opt_q: + if opts.verbose >= 0: w_header(w, ifile, ofile, len(data)) - w_checksum(w, ident.upper(), data) - w("unsigned char %s[%d] = {\n" % (ident, len(data))) + if opts.ident: + w_checksum(w, opts.ident.upper(), data) + w("unsigned char %s[%d] = {\n" % (opts.ident, len(data))) w_data(w, data) - w("};\n") + if opts.ident: + w("};\n") fp.close() diff --git a/src/stub/scripts/gpp_inc.py b/src/stub/scripts/gpp_inc.py new file mode 100644 index 00000000..5b92a86b --- /dev/null +++ b/src/stub/scripts/gpp_inc.py @@ -0,0 +1,179 @@ +#! /usr/bin/env python +## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- +# +# gpp_inc.py -- Generic PreProcessor: include +# +# This file is part of the UPX executable compressor. +# +# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +# 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 +# +# + + +import getopt, os, re, sys + + +class opts: + dry_run = 0 + verbose = 0 + fatal = 1 + includes = [] + mode = "c" + target_mf = None + target_mmd = None + + +files_md = [] +files_mmd = [] +files_st = {} + +def add_dep(state, fn, mode): + if mode: + files = files_md + else: + files = files_mmd + fn = os.path.normpath(fn) + fn = os.path.normcase(fn) + if fn in files: + return + # FIXME: could use samestat() etc. + files.append(fn) + files_st[fn] = os.stat(fn) + + +def not_found(l, s, state): + if opts.fatal: + raise Exception, "%s:%d: include file %s not found" % (state[0], state[2], s) + return l + + +def handle_inc_c(l, state, ofp): + m = re.search(r"^\s*\#\s*include\s+([\"\<].+)", l) + if not m: + return l + s = m.group(1).strip() + # FIXME: strip comments ? + if len(s) < 3: + return not_found(l, s, state) + if s[0] == '<' and s[-1] == '>': + dirs = opts.includes + elif s[0] == '"' and s[-1] == '"': + dirs = [state[1]] + opts.includes + else: + raise Exception, "syntax error: include line " + l + inc = s[1:-1] + for dir in dirs: + fn = os.path.join(dir, inc) + if os.path.isfile(fn): + add_dep(state, fn, s[0] == '<') + handle_file(fn, ofp, state) + return None + return not_found(l, s, state) + + +def handle_inc_nasm(l, state, ofp): + m = re.search(r"^\s*\%\s*include\s+([\"\<].+)", l) + if not m: + return l + s = m.group(1).strip() + # FIXME: strip comments ? + if len(s) < 3: + return not_found(l, s, state) + if s[0] == '<' and s[-1] == '>': + pass + elif s[0] == '"' and s[-1] == '"': + pass + else: + raise Exception, "syntax error: include line " + l + inc = s[1:-1] + # info: nasm simply does concat the includes + for prefix in opts.includes + [""]: + fn = prefix + inc + if os.path.isfile(fn): + add_dep(state, fn, False) + handle_file(fn, ofp, state) + return None + return not_found(l, s, state) + + +def handle_file(ifn, ofp, parent_state=None): + state = [ifn, os.path.dirname(ifn) or ".", 0, parent_state] + ifp = open(ifn, "rb") + for l in ifp.readlines(): + state[2] += 1 # line counter + l = l.rstrip("\n") + if opts.mode == "c": + l = handle_inc_c(l, state, ofp) + elif opts.mode == "nasm": + l = handle_inc_nasm(l, state, ofp) + if l is not None: + ofp.write(l + "\n") + + +def main(argv): + ofile = None + shortopts, longopts = "qvI:o:", ["dry-run", "MF=", "MMD=", "mode=", "quiet", "verbose"] + xopts, args = getopt.gnu_getopt(argv[1:], shortopts, longopts) + for opt, optarg in xopts: + if 0: pass + elif opt in ["-q", "--quiet"]: opts.verbose = opts.verbose - 1 + elif opt in ["-v", "--verbose"]: opts.verbose = opts.verbose + 1 + elif opt in ["--dry-run"]: opts.dry_run = opts.dry_run + 1 + elif opt in ["-I"]: opts.includes.append(optarg) + elif opt in ["-o"]: ofile = optarg + elif opt in ["--mode"]: opts.mode = optarg.lower() + elif opt in ["--MF"]: opts.target_mf = optarg + elif opt in ["--MMD"]: opts.target_mmd = optarg + else: assert 0, ("getopt problem:", opt, optarg, xopts, args) + + if ofile is None: + assert len(args) == 2 + ifile = args[0] + ofile = args[1] + else: + assert len(args) == 1 + ifile = args[0] + + assert os.path.isfile(ifile) + ofp = open(ofile, "wb") + handle_file(ifile, ofp) + ofp.close() + + if opts.target_mmd: + fn = ofile + ".d" + if opts.target_mf: + fn = opts.target_mf + if os.path.isfile(fn): + os.unlink(fn) + if files_mmd: + fp = open(fn, "wb") + fp.write("%s : \\\n" % opts.target_mmd) + for i, f in enumerate(files_mmd): + if i < len(files_mmd) - 1: + fp.write(" %s \\\n" % f) + else: + fp.write(" %s\n" % f) + fp.close() + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) + diff --git a/src/stub/src/Makefile b/src/stub/src/Makefile new file mode 100644 index 00000000..67045a13 --- /dev/null +++ b/src/stub/src/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C .. $@ diff --git a/src/stub/src/amd64-linux.elf-entry.S b/src/stub/src/amd64-linux.elf-entry.S new file mode 100644 index 00000000..13c2b805 --- /dev/null +++ b/src/stub/src/amd64-linux.elf-entry.S @@ -0,0 +1,271 @@ +/* l_lx_elf64amd.S -- Linux program entry point & decompressor (Elf binary) +* +* This file is part of the UPX executable compressor. +* +* Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +* Copyright (C) 1996-2004 Laszlo Molnar +* Copyright (C) 2000-2005 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 +* +* +* John F. Reiser +* +*/ + +#include "arch/amd64/regs.h" + +sz_l_info= 12 + l_lsize= 8 + +sz_p_info= 12 + +sz_b_info= 12 + sz_unc= 0 + sz_cpr= 4 + b_method= 8 + +PROT_READ= 1 +PROT_WRITE= 2 +PROT_EXEC= 4 + +MAP_PRIVATE= 2 +MAP_FIXED= 0x10 +MAP_ANONYMOUS= 0x20 + +SYS_mmap= 9 # 64-bit mode only! + +PAGE_SHIFT= 12 +PAGE_MASK= (~0<likely, n==>unlikely} */ +/* Prediction omitted for now. */ +/* On refill: prefetch next byte, for latency reduction on literals and offsets. */ +#define jnextb0np jnextb0yp +#define jnextb0yp GETBITp; jnc +#define jnextb1np jnextb1yp +#define jnextb1yp GETBITp; jc +#define GETBITp \ + addl bits,bits; jnz 0f; \ + movl (%rsi),bits; subq $-4,%rsi; \ + adcl bits,bits; movb (%rsi),%dl; \ +0: +/* Same, but without prefetch (not useful for length of match.) */ +#define jnextb0n jnextb0y +#define jnextb0y GETBIT; jnc +#define jnextb1n jnextb1y +#define jnextb1y GETBIT; jc +#define GETBIT \ + addl bits,bits; jnz 0f; \ + movl (%rsi),bits; subq $-4,%rsi; \ + adcl bits,bits; \ +0: + +/* rotate next bit into bottom bit of reg */ +#define getnextbp(reg) call *%r11; adcl reg,reg +#define getnextb(reg) getnextbp(reg) + + .p2align 3 +getbit: + addl bits,bits; jz refill # Carry= next bit + rep; ret +refill: + movl (%rsi),bits; subq $-4,%rsi # next 32 bits; set Carry + adcl bits,bits # LSB= 1 (CarryIn); CarryOut= next bit + movb (%rsi),%dl # speculate: literal, or bottom 8 bits of offset + rep; ret + +copy: # In: len, %rdi, disp; Out: 0==len, %rdi, disp; trashes %rax, %rdx + leaq (%rdi,disp),%rax; cmpl $5,len # <=3 is forced + movb (%rax),%dl; jbe copy1 # <=5 for better branch predict + cmpq $-4,disp; ja copy1 # 4-byte chunks would overlap + subl $4,len # adjust for termination cases +copy4: + movl (%rax),%edx; addq $4, %rax; subl $4,len + movl %edx,(%rdi); leaq 4(%rdi),%rdi; jnc copy4 + addl $4,len; movb (%rax),%dl; jz copy0 +copy1: + incq %rax; movb %dl,(%rdi); subl $1,len + movb (%rax),%dl + leaq 1(%rdi),%rdi; jnz copy1 +copy0: + rep; ret + +#include "arch/amd64/nrv2e_d.S" +#include "arch/amd64/nrv2b_d.S" + +setup: + cld + pop %r11 # addq $ getbit - ra_setup,%r11 # &getbit + cmpl $ M_NRV2E_LE32,meth; je top_n2e + cmpl $ M_NRV2B_LE32,meth; je top_n2b +eof: + pop %rcx # &input_eof + movq %rsi,%rax; subq %rcx,%rax # src -= eof; // return 0: good; else: bad + pop %rdx; subq %rdx,%rdi # dst -= original dst + pop %rcx; movl %edi,(%rcx) # actual length used at dst XXX: 4GB + pop %rbx; pop %rbp + ret + +/* Temporary until we get the buildLoader stuff working ... */ + .ascii "\n$Id: UPX (C) 1996-2006 the UPX Team. " + .asciz "All Rights Reserved. http://upx.sf.net $\n" + +/* These from /usr/include/asm-x86_64/unistd.h */ +__NR_write = 1 +__NR_exit = 60 + +msg_SELinux: + push $ L71 - L70; pop %arg3 # length + call L71 +L70: + .asciz "PROT_EXEC|PROT_WRITE failed.\n" +L71: + pop %arg2 # message text + push $2; pop %arg1 # fd stderr + push $ __NR_write; pop %rax + syscall +die: + push $127; pop %arg1 + push $ __NR_exit; pop %rax + syscall + +/* Decompress the rest of this loader, and jump to it. + Map a page to hold the decompressed bytes. Logically this could + be done by setting .p_memsz for our first PT_LOAD. But as of 2005-11-09, + linux 2.6.14 only does ".bss expansion" on the PT_LOAD that describes the + highest address. [I regard this as a bug, and it makes the kernel's + fs/binfmt_elf.c complicated, buggy, and insecure.] For us, that is the 2nd + PT_LOAD, which is the only way that linux allows to set the brk() for the + uncompressed program. [This is a significant kernel misfeature.] +*/ +unfold: + pop %rbx # &b_info + +/* Get some pages. If small, then get 1 page located just after the end + of the first PT_LOAD of the compressed program. This will still be below + all of the uncompressed program. If large (>=3MB compressed), then get enough + to duplicate the entire compressed PT_LOAD, plus 1 page, located just after + the brk() of the _un_compressed program. The address and length are pre- + calculated by PackLinuxElf64amd::pack3(), and patched in at compress time. +*/ + .byte 7+0xB8; .ascii "ADRM" # movl $'ADRM',%edi XXX: 4GB + push $ PROT_READ | PROT_WRITE | PROT_EXEC; pop %arg3 + .byte 6+0xB8; .ascii "LENM" # movl $'LENM',%esi XXX: 4GB + push $ MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS; pop %sys4 + subl %arg5l,%arg5l #; subl %arg6l,%arg6l # MAP_ANON ==> ignore offset + push $ SYS_mmap; pop %rax + syscall # %rax= result; trashes %rcx,%r11 only + cmpl %eax,%edi; jne msg_SELinux # XXX: 4GB + +/* Load the addresses and lengths that ::pack3() patched in. + XXX: 2GB Note that PUSH $imm32 sign-extends to 64 bits. + XXX: 4GB Note that MOVL $imm32,reg zero-extends to 64-bits. + (Use an temporary register to obtain 4GB range on PUSH constant.) +*/ + .byte 0x68; .ascii "JMPU" # push $'JMPU' # for unmap in fold + .byte 0x68; .ascii "ADRU" # push $'ADRU' # for unmap in fold + .byte 6+0xB8; .ascii "ADRC" # movl $'ADRC',%esi + .byte 0x68; .ascii "LENU" # push $'LENU' # for unmap in fold + .byte 1+0xB8; .ascii "CNTC" # movl $'CNTC',%ecx + .byte 0x68; .ascii "ADRX" # push $'ADRX' # for upx_main + .byte 0x68; .ascii "LENX" # push $'LENX' # for upx_main + +/* Move and relocate if compressed overlaps uncompressed. + Move by 0 when total compressed executable is < 3MB. +*/ + movl %edi,%edx # ADRM + subl %esi,%edx # (ADRM - ADRC) == relocation amount + addl %edx,%ebp # update &decompress + addl %edx,%ebx # update &b_info + + cld + rep; movsq + xchgl %eax,%edi + +/* Decompress the folded part of this stub, then execute it. */ + movl %ebx,%esi # %arg2l= &b_info (relocated) + push %rax # ret_addr after decompression + xchgl %eax,%arg3l # %arg3= dst for unfolding XXX: 4GB + lodsl; push %rax # allocate slot on stack + movq %rsp,%arg4 # &len_dst ==> &do_not_care + lodsl; xchgl %eax,%arg1l # sz_cpr XXX: 4GB + lodsl; movzbl %al,%arg5l # b_method + xchg %arg1l,%arg2l # XXX: 4GB + call *%rbp # decompress + pop %rcx # discard len_dst + ret + +main: + # int3 # uncomment for debugging + pop %rbp # &decompress + call unfold # push &b_info + /* { b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...} */ + +/*__XTHEENDX__*/ + +/* +vi:ts=8:et:nowrap +*/ + diff --git a/src/stub/src/amd64-linux.elf-fold.S b/src/stub/src/amd64-linux.elf-fold.S new file mode 100644 index 00000000..ab0a20d3 --- /dev/null +++ b/src/stub/src/amd64-linux.elf-fold.S @@ -0,0 +1,120 @@ +/* fold_elf64amd.S -- linkage to C code to process Elf binary +* +* This file is part of the UPX executable compressor. +* +* Copyright (C) 2000-2005 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 +* +* +* John F. Reiser +* +*/ +#include "arch/amd64/regs.h" + +PAGE_SHIFT= 12 +PAGE_MASK= 0xffffffffffffffff< + + John F. Reiser + + */ + + +OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") +OUTPUT_ARCH(i386:x86-64) +/*ENTRY(_start)*/ +PHDRS +{ + text PT_LOAD FILEHDR PHDRS FLAGS ( 5 ) ; /* r-x (no -w-) */ + data PT_LOAD ; /* for setting brk(0) */ +} +SECTIONS +{ + . = 0x00100000 + SIZEOF_HEADERS + 12; /* 12==sizeof(l_info) */ + .text : { + *(.text) + *(.data) + } : text + .data : { + } : data +} diff --git a/src/stub/src/amd64-linux.elf-main.c b/src/stub/src/amd64-linux.elf-main.c new file mode 100644 index 00000000..e1e2df19 --- /dev/null +++ b/src/stub/src/amd64-linux.elf-main.c @@ -0,0 +1,368 @@ +/* a_lx_elf64.c -- stub loader for Linux 64-bit ELF executable + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 Laszlo Molnar + Copyright (C) 2000-2005 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 + + + John F. Reiser + + */ + + +#include "include/linux.h" +extern void exit(int); + + +/************************************************************************* +// configuration section +**************************************************************************/ + +// In order to make it much easier to move this code at runtime and execute +// it at an address different from it load address: there must be no +// static data, and no string constants. + +#define MAX_ELF_HDR 1024 // Elf64_Ehdr + n*Elf64_Phdr must fit in this + + +/************************************************************************* +// "file" util +**************************************************************************/ + +typedef struct { + size_t size; // must be first to match size[0] uncompressed size + char *buf; +} Extent; + + +static void +xread(Extent *x, char *buf, size_t count) +{ + char *p=x->buf, *q=buf; + size_t j; + if (x->size < count) { + exit(127); + } + for (j = count; 0!=j--; ++p, ++q) { + *q = *p; + } + x->buf += count; + x->size -= count; +} + + +/************************************************************************* +// util +**************************************************************************/ + +#if 1 //{ save space +#define ERR_LAB error: exit(127); +#define err_exit(a) goto error +#else //}{ save debugging time +#define ERR_LAB +static void +err_exit(int a) +{ + (void)a; // debugging convenience + exit(127); +} +#endif //} + +/************************************************************************* +// UPX & NRV stuff +**************************************************************************/ + +typedef void f_unfilter( + nrv_byte *, // also addvalue + nrv_uint, + unsigned cto8, // junk in high 24 bits + unsigned ftid +); +typedef int f_expand( + const nrv_byte *, nrv_uint, + nrv_byte *, nrv_uint *, unsigned ); + +static void +unpackExtent( + Extent *const xi, // input + Extent *const xo, // output + f_expand *const f_decompress, + f_unfilter *f_unf +) +{ + while (xo->size) { + struct b_info h; + // Note: if h.sz_unc == h.sz_cpr then the block was not + // compressible and is stored in its uncompressed form. + + // Read and check block sizes. + xread(xi, (char *)&h, sizeof(h)); + if (h.sz_unc == 0) { // uncompressed size 0 -> EOF + if (h.sz_cpr != UPX_MAGIC_LE32) // h.sz_cpr must be h->magic + err_exit(2); + if (xi->size != 0) // all bytes must be written + err_exit(3); + break; + } + if (h.sz_cpr <= 0) { + err_exit(4); +ERR_LAB + } + if (h.sz_cpr > h.sz_unc + || h.sz_unc > xo->size ) { + err_exit(5); + } + // Now we have: + // assert(h.sz_cpr <= h.sz_unc); + // assert(h.sz_unc > 0 && h.sz_unc <= blocksize); + // assert(h.sz_cpr > 0 && h.sz_cpr <= blocksize); + + if (h.sz_cpr < h.sz_unc) { // Decompress block + nrv_uint out_len; + int const j = (*f_decompress)((unsigned char *)xi->buf, h.sz_cpr, + (unsigned char *)xo->buf, &out_len, h.b_method ); + if (j != 0 || out_len != (nrv_uint)h.sz_unc) + err_exit(7); + // Skip Ehdr+Phdrs: separate 1st block, not filtered + if (h.b_ftid!=0 && f_unf // have filter + && ((512 < out_len) // this block is longer than Ehdr+Phdrs + || (xo->size==(unsigned)h.sz_unc) ) // block is last in Extent + ) { + (*f_unf)((unsigned char *)xo->buf, out_len, h.b_cto8, h.b_ftid); + } + xi->buf += h.sz_cpr; + xi->size -= h.sz_cpr; + } + else { // copy literal block + xread(xi, xo->buf, h.sz_cpr); + } + xo->buf += h.sz_unc; + xo->size -= h.sz_unc; + } +} + +#if 0 /*{*/ +static void +upx_bzero(char *p, size_t len) +{ + if (len) do { + *p++= 0; + } while (--len); +} +#define bzero upx_bzero +#else +#define bzero(a,b) __builtin_memset(a,0,b) +#endif /*}*/ + +static void +auxv_up(Elf64_auxv_t *av, unsigned const type, uint64_t const value) +{ + if (av) + for (;; ++av) { + if (av->a_type==type || (av->a_type==AT_IGNORE && type!=AT_NULL)) { + av->a_type = type; + av->a_un.a_val = value; + return; + } + } +} + +// The PF_* and PROT_* bits are {1,2,4}; the conversion table fits in 32 bits. +#define REP8(x) \ + ((x)|((x)<<4)|((x)<<8)|((x)<<12)|((x)<<16)|((x)<<20)|((x)<<24)|((x)<<28)) +#define EXP8(y) \ + ((1&(y)) ? 0xf0f0f0f0 : (2&(y)) ? 0xff00ff00 : (4&(y)) ? 0xffff0000 : 0) +#define PF_TO_PROT(pf) \ + ((PROT_READ|PROT_WRITE|PROT_EXEC) & ( \ + ( (REP8(PROT_EXEC ) & EXP8(PF_X)) \ + |(REP8(PROT_READ ) & EXP8(PF_R)) \ + |(REP8(PROT_WRITE) & EXP8(PF_W)) \ + ) >> ((pf & (PF_R|PF_W|PF_X))<<2) )) + + +// Find convex hull of PT_LOAD (the minimal interval which covers all PT_LOAD), +// and mmap that much, to be sure that a kernel using exec-shield-randomize +// won't place the first piece in a way that leaves no room for the rest. +static unsigned long // returns relocation constant +xfind_pages(unsigned mflags, Elf64_Phdr const *phdr, int phnum, + char **const p_brk +) +{ + size_t lo= ~0, hi= 0, szlo= 0; + char *addr; + mflags += MAP_PRIVATE | MAP_ANONYMOUS; // '+' can optimize better than '|' + for (; --phnum>=0; ++phdr) if (PT_LOAD==phdr->p_type) { + if (phdr->p_vaddr < lo) { + lo = phdr->p_vaddr; + szlo = phdr->p_filesz; + } + if (hi < (phdr->p_memsz + phdr->p_vaddr)) { + hi = phdr->p_memsz + phdr->p_vaddr; + } + } + szlo += ~PAGE_MASK & lo; // page fragment on lo edge + lo -= ~PAGE_MASK & lo; // round down to page boundary + hi = PAGE_MASK & (hi - lo - PAGE_MASK -1); // page length + szlo = PAGE_MASK & (szlo - PAGE_MASK -1); // page length + addr = mmap((void *)lo, hi, PROT_NONE, mflags, -1, 0); + *p_brk = hi + addr; // the logical value of brk(0) + //mprotect(szlo + addr, hi - szlo, PROT_NONE); // no access, but keep the frames! + return (unsigned long)addr - lo; +} + +static Elf64_Addr // entry address +do_xmap( + Elf64_Ehdr const *const ehdr, + Extent *const xi, + int const fdi, + Elf64_auxv_t *const av, + f_expand *const f_decompress, + f_unfilter *const f_unf +) +{ + Elf64_Phdr const *phdr = (Elf64_Phdr const *) (ehdr->e_phoff + + (char const *)ehdr); + char *v_brk; + unsigned long const reloc = xfind_pages( + ((ET_DYN!=ehdr->e_type) ? MAP_FIXED : 0), phdr, ehdr->e_phnum, &v_brk); + int j; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) + if (xi && PT_PHDR==phdr->p_type) { + auxv_up(av, AT_PHDR, phdr->p_vaddr + reloc); + } else + if (PT_LOAD==phdr->p_type) { + unsigned const prot = PF_TO_PROT(phdr->p_flags); + Extent xo; + size_t mlen = xo.size = phdr->p_filesz; + char *addr = xo.buf = reloc + (char *)phdr->p_vaddr; + char *haddr = phdr->p_memsz + addr; + size_t frag = (long)addr &~ PAGE_MASK; + mlen += frag; + addr -= frag; + + if (addr != mmap(addr, mlen, prot | (xi ? PROT_WRITE : 0), + MAP_FIXED | MAP_PRIVATE | (xi ? MAP_ANONYMOUS : 0), + (xi ? -1 : fdi), phdr->p_offset - frag) ) { + err_exit(8); + } + if (xi) { + unpackExtent(xi, &xo, f_decompress, f_unf); + } + // Linux does not fixup the low end, so neither do we. + //if (PROT_WRITE & prot) { + // bzero(addr, frag); // fragment at lo end + //} + frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary + if (PROT_WRITE & prot) { // note: read-only .bss not supported here + bzero(mlen+addr, frag); // fragment at hi end + } + if (xi) { + if (0==phdr->p_offset) { + Elf64_Ehdr *const ehdr = (Elf64_Ehdr *)addr; + *(int *)&ehdr->e_ident[12] = 0x90c3050f; // syscall; ret; nop + } + if (0!=mprotect(addr, mlen, prot)) { + err_exit(10); +ERR_LAB + } + } + addr += mlen + frag; /* page boundary on hi end */ + if (addr < haddr) { // need pages for .bss + if (addr != mmap(addr, haddr - addr, prot, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0 ) ) { + err_exit(9); + } + } + } + if (xi) { // 1st call (main); also have (0!=av) here + if (ET_DYN!=ehdr->e_type) { + // Needed only if compressed shell script invokes compressed shell. + brk(v_brk); + } + } + return ehdr->e_entry + reloc; +} + + +/************************************************************************* +// upx_main - called by our entry code +// +// This function is optimized for size. +**************************************************************************/ + +void * +upx_main( // returns entry address + struct b_info const *const bi, // 1st block header + size_t const sz_compressed, // total length + Elf64_Ehdr *const ehdr, // temp char[sz_ehdr] for decompressing + Elf64_auxv_t *const av, + f_expand *const f_decompress, + f_unfilter *const f_unf +) +{ + Elf64_Phdr const *phdr = (Elf64_Phdr const *)(1+ ehdr); + Elf64_Addr entry; + + Extent xo, xi1, xi2; + xo.buf = (char *)ehdr; + xo.size = bi->sz_unc; + xi2.buf = CONST_CAST(char *, bi); xi2.size = sz_compressed; + xi1.buf = CONST_CAST(char *, bi); xi1.size = sz_compressed; + + // ehdr = Uncompress Ehdr and Phdrs + unpackExtent(&xi2, &xo, f_decompress, 0); // never filtered? + + // AT_PHDR.a_un.a_val is set again by do_xmap if PT_PHDR is present. + auxv_up(av, AT_PHDR , (unsigned long)(1+(Elf64_Ehdr *)phdr->p_vaddr)); + auxv_up(av, AT_PHNUM , ehdr->e_phnum); + auxv_up(av, AT_ENTRY , (unsigned long)ehdr->e_entry); + //auxv_up(av, AT_PHENT , ehdr->e_phentsize); /* this can never change */ + //auxv_up(av, AT_PAGESZ, PAGE_SIZE); /* ld-linux.so.2 does not need this */ + + entry = do_xmap(ehdr, &xi1, 0, av, f_decompress, f_unf); // "rewind" + + { // Map PT_INTERP program interpreter + int j; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) if (PT_INTERP==phdr->p_type) { + char const *const iname = (char const *)phdr->p_vaddr; + int const fdi = open(iname, O_RDONLY, 0); + if (0 > fdi) { + err_exit(18); + } + if (MAX_ELF_HDR!=read(fdi, (void *)ehdr, MAX_ELF_HDR)) { +ERR_LAB + err_exit(19); + } + entry = do_xmap(ehdr, 0, fdi, 0, 0, 0); + close(fdi); + } + } + + return (void *)entry; +} + + +/* +vi:ts=4:et:nowrap +*/ + diff --git a/src/stub/src/arch/Makefile b/src/stub/src/arch/Makefile new file mode 100644 index 00000000..b2e39f4b --- /dev/null +++ b/src/stub/src/arch/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../.. $@ diff --git a/src/stub/src/arch/amd64/Makefile b/src/stub/src/arch/amd64/Makefile new file mode 100644 index 00000000..413a5328 --- /dev/null +++ b/src/stub/src/arch/amd64/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../.. $@ diff --git a/src/stub/src/arch/amd64/bxx.S b/src/stub/src/arch/amd64/bxx.S new file mode 100644 index 00000000..adf2bed3 --- /dev/null +++ b/src/stub/src/arch/amd64/bxx.S @@ -0,0 +1,64 @@ +/* amd_bxx.S -- AMD x86_64 Call/Branch Trick unfilter + + This file is part of the UPX executable compressor. + + Copyright (C) 2005 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. + + John F. Reiser + +*/ + +#include "regs.h" + +amdbxx: # (*f_unf)(xo->buf, out_len, h.b_cto8, h.b_ftid); + +#define ptr %arg1 /* known to be %rdi */ +#define len %arg2 +#define cto8 %arg3l /* known to be "%dl" */ +#define ftid %arg4l + + cmpl $0x49,ftid; jne ckend # filter: JMP, CALL, 6-byte Jxx + movq len,%rcx # byte count + movq ptr,%rsi # remember start of buffer + jmp ckstart +ckloop3: + movb (%rdi),%al; addq $1,%rdi + cmpb $0x80,%al; jb ckloop2 # lo of 6-byte Jcc + cmpb $0x8F,%al; ja ckloop2 # hi of 6-byte Jcc + cmpb $0x0F,-2(%rdi); je ckmark # prefix of 6-byte Jcc +ckloop2: + subb $ 0xE8,%al + cmpb $0xE9-0xE8,%al; ja ckcount # not JMP, not CALL +ckmark: + cmpb %dl,(%rdi); jne ckcount # not marked with cto8 + movl (%rdi),%eax # the marked, bswapped 32-bit displacement + andl $~0<<8,%eax # clear the mark + bswap %eax + subl %edi,%eax + addl %esi,%eax + stosl # *%rdi++ = %eax; +ckstart: + subq $4,%rcx + movb (%rdi),%al; addq $1,%rdi + decq %rcx; jnz ckloop2 # prefix cannot overlap previous displacement + jmp ckend +ckcount: + decq %rcx; jnz ckloop3 +ckend: + ret diff --git a/src/stub/src/arch/amd64/nrv2b_d.S b/src/stub/src/arch/amd64/nrv2b_d.S new file mode 100644 index 00000000..0d977868 --- /dev/null +++ b/src/stub/src/arch/amd64/nrv2b_d.S @@ -0,0 +1,68 @@ +/* amd_d_nrv2b.S -- AMD64 decompressor for NRV2B + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 Laszlo Molnar + Copyright (C) 2000-2005 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 + + + John F. Reiser + +*/ + + .p2align 3 +lit_n2b: + incq %rsi; movb %dl,(%rdi) + incq %rdi +top_n2b: + movb (%rsi),%dl # speculate: literal, or bottom 8 bits of offset + jnextb1yp lit_n2b + lea 1(lenq),off # [len= 0] off= 1 +offmore_n2b: + getnextbp(off) + jnextb0np offmore_n2b + + subl $ 3,off; jc len_n2b # use previous offset + shll $ 8,off; movzbl %dl,%edx + orl %edx,off; incq %rsi + xorl $~0,off; jz eof + movslq off,disp # XXX: 2GB +len_n2b: + lea 1(lenq),off # [len= 0] off= 1 + getnextb(len); getnextb(len) # two bits; cc set on result + jnz gotlen_n2b # raw 1,2,3 ==> 2,3,4 + movl off,len # len= 1, the msb + addl $3-1,off # raw 2.. ==> 5.. +lenmore_n2b: + getnextb(len) + jnextb0n lenmore_n2b +gotlen_n2b: + cmpq $-0xd00,disp + adcl off,len # len += off + (disp < -0xd00) + call copy +bot_n2b: # In: 0==len + jmp top_n2b + +/* +vi:ts=8:et:nowrap +*/ + diff --git a/src/stub/src/arch/amd64/nrv2e_d.S b/src/stub/src/arch/amd64/nrv2e_d.S new file mode 100644 index 00000000..d1f8d108 --- /dev/null +++ b/src/stub/src/arch/amd64/nrv2e_d.S @@ -0,0 +1,81 @@ +/* amd_d_nrv2e.S -- AMD64 decompressor for NRV2E + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 Laszlo Molnar + Copyright (C) 2000-2005 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 + + + John F. Reiser + +*/ + + .p2align 3 +lit_n2e: + incq %rsi; movb %dl,(%rdi) + incq %rdi +top_n2e: + movb (%rsi),%dl # speculate: literal, or bottom 8 bits of offset + jnextb1yp lit_n2e + lea 1(lenq),off # [len= 0] off= 1 + jmp getoff_n2e + +off_n2e: + dec off + getnextbp(off) +getoff_n2e: + getnextbp(off) + jnextb0np off_n2e + + subl $ 3,off; jc offprev_n2e + shll $ 8,off; movzbl %dl,%edx + orl %edx,off; incq %rsi + xorl $~0,off; jz eof + sarl off # Carry= original low bit + movslq off,disp # XXX: 2GB + jc lenlast_n2e + jmp lenmore_n2e + +offprev_n2e: + jnextb1y lenlast_n2e +lenmore_n2e: + incl len # len= 1 + jnextb1y lenlast_n2e +len_n2e: + getnextb(len) + jnextb0n len_n2e + addl $6-2-2,len + jmp gotlen_n2e + +lenlast_n2e: + getnextb(len) # 0,1,2,3 +gotlen_n2e: + cmpq $-0x500,disp + adcl $2,len # len += 2+ (disp < -0x500); + call copy +bot_n2e: # In: 0==len + jmp top_n2e + +/* +vi:ts=8:et:nowrap +*/ + diff --git a/src/stub/src/arch/amd64/regs.h b/src/stub/src/arch/amd64/regs.h new file mode 100644 index 00000000..d761dd07 --- /dev/null +++ b/src/stub/src/arch/amd64/regs.h @@ -0,0 +1,15 @@ +/* NOTE: THE FIRST ARGUMENT IS arg1, NOT arg0. */ +#define arg1 rdi +#define arg1l edi +#define arg2 rsi +#define arg2l esi +#define arg3 rdx +#define arg3l edx +#define arg4 rcx +#define arg4l ecx +#define sys4 r10 # 4th arg to syscall is not in %rcx +#define sys4l r10d +#define arg5 r8 +#define arg5l r8d +#define arg6 r9 +#define arg6l r9d diff --git a/src/stub/src/arch/arm/Makefile b/src/stub/src/arch/arm/Makefile new file mode 100644 index 00000000..413a5328 --- /dev/null +++ b/src/stub/src/arch/arm/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../.. $@ diff --git a/src/stub/src/arch/arm/v4a/Makefile b/src/stub/src/arch/arm/v4a/Makefile new file mode 100644 index 00000000..ff0b0eff --- /dev/null +++ b/src/stub/src/arch/arm/v4a/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../../.. $@ diff --git a/src/stub/src/arch/arm/v4a/nrv2e_d8.S b/src/stub/src/arch/arm/v4a/nrv2e_d8.S new file mode 100644 index 00000000..12f3c621 --- /dev/null +++ b/src/stub/src/arch/arm/v4a/nrv2e_d8.S @@ -0,0 +1,195 @@ +/* armv4_n2e_d8.S -- ARM decompressor for NRV2E + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 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 + + + John F. Reiser + +*/ +#define SAFE 0 /* 1 for src+dst bounds checking: cost 76 bytes */ + +#define src r0 +#define len r1 /* overlaps 'cnt' */ +#define dst r2 +#define tmp r3 +#define bits r4 +#define off r5 +/* r6 UNUSED in ARM code unless DEBUG mode */ +#define srclim r7 +#if 1==SAFE /*{*/ +#define dstlim r12 +#endif /*}*/ + +#define cnt r1 /* overlaps 'len' while reading an offset */ + +/* macros reduce "noise" when comparing this ARM code to corresponding THUMB code */ +#define PUSH stmdb sp!, +#define POP ldmia sp!, +#define ADD2( dst,src) add dst,dst,src +#define ADD2S(dst,src) adds dst,dst,src +#define ADC2( dst,src) adc dst,dst,src +#define ADC2S(dst,src) adcs dst,dst,src +#define SUB2( dst,src) sub dst,dst,src +#define SUB2S(dst,src) subs dst,dst,src +#define LDRB3(reg,psrc,incr) ldrb reg,psrc,incr +#define STRB3(reg,pdst,incr) strb reg,pdst,incr + +#if 1==SAFE /*{*/ +#define CHECK_SRC cmp srclim,src; bls bad_src_n2e /* Out: 1==Carry for get8_n2e */ +#define CHECK_DST cmp dst,dstlim; bhs bad_dst_n2e +#else /*}{*/ +#define CHECK_SRC /*empty*/ +#define CHECK_DST /*empty*/ +#endif /*}*/ + +#if 0 /*{ DEBUG only: check newly-decompressed against original dst */ +#define CHECK_BYTE \ + ldrb r6,[dst]; \ + cmp r6,tmp; beq 0f; bkpt; 0: +#else /*}{*/ +#define CHECK_BYTE /*empty*/ +#endif /*}*/ + +#define GETBIT ADD2S(bits,bits); bleq get8_n2e + +#define getnextb(reg) GETBIT; ADC2(reg,reg) /* Out: condition code not changed */ +#define jnextb0 GETBIT; bcc +#define jnextb1 GETBIT; bcs + +ucl_nrv2e_decompress_8: .globl ucl_nrv2e_decompress_8 @ ARM mode + .type ucl_nrv2e_decompress_8, %function +/* error = (*)(char const *src, int len_src, char *dst, int *plen_dst) + Actual decompressed length is stored through plen_dst. + For SAFE mode: at call, *plen_dst must be allowed length of output buffer. +*/ + PUSH {r2,r3, r4,r5,r6,r7, lr} +#define sp_DST0 0 /* stack offset of original dst */ + add srclim,len,src @ srclim= eof_src; +#if 1==SAFE /*{*/ + ldr tmp,[r3] @ len_dst + add dstlim,tmp,dst +#endif /*}*/ + mvn off,#~-1 @ off= -1 initial condition + mov bits,#1<<31 @ refill next time + b top_n2e + +#if 1==SAFE /*{*/ +bad_dst_n2e: # return value will be 2 +bkpt + add src,srclim,#1 +bad_src_n2e: # return value will be 1 + ADD2(src,#1) +#endif /*}*/ +eof_n2e: + POP {r3,r4} @ r3= orig_dst; r4= plen_dst + SUB2(src,srclim) @ 0 if actual src length equals expected length + SUB2(dst,r3) @ actual dst length + str dst,[r4] + +#if defined(LINUX_ARM_CACHEFLUSH) /*{*/ +/* linux/include/asm-arm/unistd.h */ +#define __NR_SYSCALL_BASE 0x900000 +#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000) +#define __ARM_NR_cacheflush (__ARM_NR_BASE+2) + mov r4,r0 @ save result value + mov r0,r3 @ orig_dst + add r1,r3,dst @ orig_dst + dst_len + mov r2,#0 + swi __ARM_NR_cacheflush @ decompressed region + mov r0,r4 @ result value +#endif /*}*/ + + POP {r4,r5,r6,r7 ,pc} + +get8_n2e: @ In: Carry set [from adding 0x80000000 (1<<31) to itself] + CHECK_SRC; LDRB3(bits,[src],#1) @ zero-extend next byte + adc bits,bits,bits @ double and insert CarryIn as low bit + movs bits,bits,lsl #24 @ move to top byte, and set CarryOut from old bit 8 + mov pc,lr + +lit_n2e: + CHECK_SRC; LDRB3(tmp,[src],#1) + CHECK_BYTE + CHECK_DST; STRB3(tmp,[dst],#1) +top_n2e: + jnextb1 lit_n2e + mov cnt,#1; b getoff_n2e + +off_n2e: + SUB2(cnt,#1) + getnextb(cnt) +getoff_n2e: + getnextb(cnt) + jnextb0 off_n2e + + subs tmp,cnt,#3 @ set Carry + mov len,#0 @ Carry unaffected + blo offprev_n2e @ cnt was 2; tests Carry only + CHECK_SRC; LDRB3(off,[src],#1) @ low 7+1 bits + orr off,off,tmp,lsl #8 + mvns off,off; beq eof_n2e @ off= ~off + movs off,off,asr #1; bcs lenlast_n2e + b lenmore_n2e + +offprev_n2e: + jnextb1 lenlast_n2e +lenmore_n2e: + mov len,#1 + jnextb1 lenlast_n2e +len_n2e: + getnextb(len) + jnextb0 len_n2e + ADD2(len,#6-2) + b gotlen_n2e + +lenlast_n2e: + getnextb(len) @ 0,1,2,3 + ADD2(len,#2) +gotlen_n2e: @ 'cmn': add the inputs, set condition codes, discard the sum + cmn off,#5<<8; bcs near_n2e @ within M2_MAX_OFFSET + ADD2(len,#1) @ too far away, so minimum match length is 3 +near_n2e: +#if 1==SAFE /*{*/ + ldr tmp,[sp,#sp_DST0] + SUB2( tmp,dst) + SUB2S(tmp,off); bhi bad_dst_n2e @ reaching back too far + + add tmp,dst,cnt + cmp tmp,dstlim; bhi bad_dst_n2e @ too much output +#endif /*}*/ + ldrb tmp,[dst] @ force cacheline allocate +copy_n2e: + ldrb tmp,[dst,off] + CHECK_BYTE + STRB3(tmp,[dst],#1) + SUB2S(len,#1); bne copy_n2e + b top_n2e + + .size ucl_nrv2e_decompress_8, .-ucl_nrv2e_decompress_8 + +/* +vi:ts=8:et:nowrap + */ + diff --git a/src/stub/src/arch/arm/v4t/Makefile b/src/stub/src/arch/arm/v4t/Makefile new file mode 100644 index 00000000..ff0b0eff --- /dev/null +++ b/src/stub/src/arch/arm/v4t/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../../.. $@ diff --git a/src/stub/src/arch/arm/v4t/nrv2b_d32.S b/src/stub/src/arch/arm/v4t/nrv2b_d32.S new file mode 100644 index 00000000..08aba583 --- /dev/null +++ b/src/stub/src/arch/arm/v4t/nrv2b_d32.S @@ -0,0 +1,129 @@ +/* arm_nrv2b_d32.S -- ARM decompressor for NRV2B + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 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 + + + John F. Reiser + +*/ + +#define src r0 +#define len r1 +#define dst r2 +#define tmp r3 +#define bits r4 +#define off r5 +#define g1b r6 +#define wrnk r7 /* 0xd00 M2_MAX_OFFSET before "wrinkle" */ + +/* r12 ("ip") is assumed to be a scratch register. */ + +#define GETBIT blx g1b + +#define getnextb(reg) GETBIT; adc reg,reg +#define jnextb0 GETBIT; bcc +#define jnextb1 GETBIT; bcs + +ucl_nrv2b_decompress_32: .globl ucl_nrv2b_decompress_32 @ ARM mode + .type ucl_nrv2b_decompress_32, %function +/* error = (*)(char const *src, int len_src, char *dst, int *plen_dst) */ + adr r12,1+go_thumb_n2b @ load pc-relative address + bx r12 @ enter THUMB mode + + .code 16 @ THUMB mode +go_thumb_n2b: + add r1,len,src @ r1= eof_src; + push {r1,r2,r3, r4,r5,r6,r7, lr} + mov bits,#1; neg off,bits @ off= -1 initial condition + lsl bits,#31 @ 1<<31: refill next time + mov wrnk,#0xd + lsl wrnk,#8 @ 0xd00 + adr g1b,get1b @ load pc-relative address + b top_n2b + +eof_n2b: + pop {r1,r3,r4} @ r1= eof_src; r3= orig_dst; r4= plen_dst + sub src,r1 @ 0 if actual src length equals expected length + sub dst,r3 @ actual dst length + str dst,[r4] + pop {r4,r5,r6,r7, pc} @ return + +lit_n2b: + ldrb tmp,[src]; add src,#1 + strb tmp,[dst]; add dst,#1 +top_n2b: + jnextb1 lit_n2b + + mov len,#1 @ the msb +getoff_n2b: @ ss11 len= [2..) + getnextb(len) + jnextb0 getoff_n2b + + sub tmp,len,#3 @ set Carry + mov len,#0 @ Carry unaffected + blo offprev_n2b @ ss11 returned 2 + lsl tmp,#8 + ldrb off,[src]; add src,#1 @ low 8 bits + orr off,tmp + mvn off,off; beq eof_n2b @ off= ~off +offprev_n2b: @ In: 0==len + getnextb(len); getnextb(len); bne plus1_n2b @ two bits; 1,2,3 ==> 2,3,4 + + mov len,#1 @ the msb +getlen_n2b: @ ss11 len= [2..) + getnextb(len) + jnextb0 getlen_n2b + + add len,#2 @ [2..) ==> [4..); +plus1_n2b: + add len,#1 @ 1,2,3 ==> 2,3,4; [4..) ==> [5..) +/* 'cmn': add the inputs, set condition codes, discard the sum */ + cmn off,wrnk; bcs near_n2b @ within M2_MAX_OFFSET + add len,#1 @ too far away, so minimum match length is 3 +near_n2b: + ldrb tmp,[dst] @ force cacheline allocate +copy_n2b: + ldrb tmp,[dst,off] + strb tmp,[dst]; add dst,#1 + sub len,#1; bne copy_n2b + b top_n2b + + .code 32 @ ARM mode +get1b: @ Out: Carry= next_bit + adds bits,bits,bits @ shift up, set Carry + bxne lr @ return if reload is not needed +/* In: Carry set (unchanged until final adcs) */ + ldrb bits,[src],#1 + ldrb tmp, [src],#1; orr bits,bits,tmp,lsl #1*8 + ldrb tmp, [src],#1; orr bits,bits,tmp,lsl #2*8 + ldrb tmp, [src],#1; orr bits,bits,tmp,lsl #3*8 + adcs bits,bits,bits @ Carry= next_bit; set bit0 flag from CarryIn + bx lr + + .size ucl_nrv2b_decompress_32, .-ucl_nrv2b_decompress_32 +/* +vi:ts=8:et:nowrap + */ + diff --git a/src/stub/src/arch/arm/v4t/nrv2b_d8.S b/src/stub/src/arch/arm/v4t/nrv2b_d8.S new file mode 100644 index 00000000..f6b07ace --- /dev/null +++ b/src/stub/src/arch/arm/v4t/nrv2b_d8.S @@ -0,0 +1,124 @@ +/* arm_nrv2b_d8.S -- ARM decompressor for NRV2B + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 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 + + + John F. Reiser + +*/ + +#define src r0 +#define len r1 +#define dst r2 +#define tmp r3 +#define bits r4 +#define off r5 +/* r6 UNUSED */ +#define wrnk r7 /* 0xd00 M2_MAX_OFFSET before "wrinkle" */ + +/* r12 ("ip") is assumed to be a scratch register. */ + +#define GETBIT add bits,bits; mov lr,pc; beq get1_n2b + +#define getnextb(reg) GETBIT; adc reg,reg +#define jnextb0 GETBIT; bcc +#define jnextb1 GETBIT; bcs + +ucl_nrv2b_decompress_8: .globl ucl_nrv2b_decompress_8 @ ARM mode + .type ucl_nrv2b_decompress_8, %function +/* error = (*)(char const *src, int len_src, char *dst, int *plen_dst) */ + adr r12,1+go_thumb_n2b @ load pc-relative address + bx r12 @ enter THUMB mode + + .code 16 @ THUMB mode + .thumb_func +go_thumb_n2b: .globl go_thumb_n2b + add r1,len,src @ r1= eof_src; + push {r1,r2,r3, r4,r5,r6,r7, lr} + mov bits,#1; neg off,bits @ off= -1 initial condition + lsl bits,#31 @ 1<<31: refill next time + mov wrnk,#0xd + lsl wrnk,#8 @ 0xd00 + b top_n2b + +eof_n2b: + pop {r1,r3,r4} @ r1= eof_src; r3= orig_dst; r4= plen_dst + sub src,r1 @ 0 if actual src length equals expected length + sub dst,r3 @ actual dst length + str dst,[r4] + pop {r4,r5,r6,r7 /*,pc*/} + pop {r1}; bx r1 @ "pop {,pc}" fails return to ARM mode on ARMv4T + +get1_n2b: + ldrb bits,[src] @ zero-extend next byte + adc bits,bits @ double and insert CarryIn as low bit + add src,#1 + lsl bits,#24 @ move to top byte, and set CarryOut from old bit 8 + mov pc,lr + +lit_n2b: + ldrb tmp,[src]; add src,#1 + strb tmp,[dst]; add dst,#1 +top_n2b: + jnextb1 lit_n2b + mov len,#1 @ the msb +getoff_n2b: @ ss11 len= [2..) + getnextb(len) + jnextb0 getoff_n2b + + sub tmp,len,#3 @ set Carry + mov len,#0 @ Carry unaffected + blo offprev_n2b @ ss11 returned 2 + lsl tmp,#8 + ldrb off,[src]; add src,#1 @ low 8 bits + orr off,tmp + mvn off,off; beq eof_n2b @ off= ~off +offprev_n2b: @ In: 0==len + getnextb(len); getnextb(len); bne plus1_n2b @ two bits; 1,2,3 ==> 2,3,4 + + mov len,#1 @ the msb +getlen_n2b: @ ss11 len= [2..) + getnextb(len) + jnextb0 getlen_n2b + + add len,#2 @ [2..) ==> [4..); +plus1_n2b: + add len,#1 @ 1,2,3 ==> 2,3,4; [4..) ==> [5..) +/* 'cmn': add the inputs, set condition codes, discard the sum */ + cmn off,wrnk; bcs near_n2b @ within M2_MAX_OFFSET + add len,#1 @ too far away, so minimum match length is 3 +near_n2b: + ldrb tmp,[dst] @ force cacheline allocate +copy_n2b: + ldrb tmp,[dst,off] + strb tmp,[dst]; add dst,#1 + sub len,#1; bne copy_n2b + b top_n2b + + .size ucl_nrv2b_decompress_8, .-ucl_nrv2b_decompress_8 +/* +vi:ts=8:et:nowrap + */ + diff --git a/src/stub/src/arch/arm/v4t/nrv2e_d32.S b/src/stub/src/arch/arm/v4t/nrv2e_d32.S new file mode 100644 index 00000000..9e707cff --- /dev/null +++ b/src/stub/src/arch/arm/v4t/nrv2e_d32.S @@ -0,0 +1,138 @@ +/* arm_nrv2e_d32.S -- ARM decompressor for NRV2E + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 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 + + + John F. Reiser + +*/ + +#define src r0 +#define len r1 /* overlaps 'cnt' */ +#define dst r2 +#define tmp r3 +#define bits r4 +#define off r5 +#define g32 r6 +#define wrnk r7 /* 0x500 M2_MAX_OFFSET before "wrinkle" */ + +#define cnt r1 /* overlaps 'len' while reading an offset */ + +#define GETBIT \ + add bits,bits; beq 1f; 0: \ + .subsection 1; \ +1: blx g32; b 0b; \ + .subsection 0 + +#define getnextb(reg) GETBIT; adc reg,reg +#define jnextb0 GETBIT; bcc +#define jnextb1 GETBIT; bcs + +ucl_nrv2e_decompress_32: .globl ucl_nrv2e_decompress_32 @ ARM mode + .type ucl_nrv2e_decompress_32, %function +/* error = (*)(char const *src, int len_src, char *dst, int *plen_dst) */ + adr r12,1+thumb_nrv2e_d32; bx r12 @ enter THUMB mode + .code 16 @ THUMB mode +thumb_nrv2e_d32: + add r1,len,src @ r1= eof_src; + push {r1,r2,r3, r4,r5,r6,r7, lr} + mov bits,#1; neg off,bits @ off= -1 initial condition + lsl bits,#31 @ 1<<31; refill next time + mov wrnk,#5 + lsl wrnk,#8 @ 0x500 + adr g32,get32 @ load pc-relative address + b top_n2e + +eof_n2e: + pop {r1,r3,r4} @ r1= eof_src; r3= orig_dst; r4= plen_dst + sub src,r1 @ 0 if actual src length equals expected length + sub dst,r3 @ actual dst length + str dst,[r4] + pop {r4,r5,r6,r7, pc} @ return + +lit_n2e: + ldrb tmp,[src]; add src,#1 + strb tmp,[dst]; add dst,#1 +top_n2e: + jnextb1 lit_n2e + mov cnt,#1; b getoff_n2e + +off_n2e: + sub cnt,#1 + getnextb(cnt) +getoff_n2e: + getnextb(cnt) + jnextb0 off_n2e + + sub tmp,cnt,#3 @ set Carry + mov len,#0 @ Carry unaffected + blo offprev_n2e @ cnt was 2; tests Carry only + lsl tmp,#8 + ldrb off,[src]; add src,#1 @ low 7+1 bits + orr off,tmp + mvn off,off; beq eof_n2e @ off= ~off + asr off,#1; bcs lenlast_n2e + b lenmore_n2e + +offprev_n2e: + jnextb1 lenlast_n2e +lenmore_n2e: + mov len,#1 + jnextb1 lenlast_n2e +len_n2e: + getnextb(len) + jnextb0 len_n2e + add len,#6-2 + b gotlen_n2e + +lenlast_n2e: + getnextb(len) @ 0,1,2,3 + add len,#2 +gotlen_n2e: @ 'cmn': add the inputs, set condition codes, discard the sum + cmn off,wrnk; bcs near_n2e @ within M2_MAX_OFFSET + add len,#1 @ too far away, so minimum match length is 3 +near_n2e: + ldrb tmp,[dst] @ force cacheline allocate +copy_n2e: + ldrb tmp,[dst,off] + strb tmp,[dst]; add dst,#1 + sub len,#1; bne copy_n2e + b top_n2e + + .code 32 @ ARM mode for ease of Carry manipulation +get32: @ In: Carry set (unchanged until final adcs) + ldrb bits,[src],#1 + ldrb tmp, [src],#1; orr bits,bits,tmp,lsl #1*8 + ldrb tmp, [src],#1; orr bits,bits,tmp,lsl #2*8 + ldrb tmp, [src],#1; orr bits,bits,tmp,lsl #3*8 + adcs bits,bits,bits @ Set Carry out + bx lr + + .size ucl_nrv2e_decompress_32, .-ucl_nrv2e_decompress_32 + +/* +vi:ts=8:et:nowrap + */ + diff --git a/src/stub/src/arch/arm/v4t/nrv2e_d8.S b/src/stub/src/arch/arm/v4t/nrv2e_d8.S new file mode 100644 index 00000000..af01d12d --- /dev/null +++ b/src/stub/src/arch/arm/v4t/nrv2e_d8.S @@ -0,0 +1,182 @@ +/* arm_nrv2e_d8.S -- ARM decompressor for NRV2E + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 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 + + + John F. Reiser + +*/ +#define SAFE 0 /* 1 for src+dst bounds checking: cost 40 bytes */ + +#define src r0 +#define len r1 /* overlaps 'cnt' */ +#define dst r2 +#define tmp r3 +#define bits r4 +#define off r5 +#define wrnk r6 /* 0x500 M2_MAX_OFFSET before "wrinkle" */ +#define srclim r7 +#if 1==SAFE /*{*/ +#define dstlim r12 +#endif /*}*/ + +#define cnt r1 /* overlaps 'len' while reading an offset */ + +#if 1==SAFE /*{*/ +#define CHECK_SRC cmp src,srclim; bhs bad_src_n2e +#define CHECK_DST cmp dst,dstlim; bhs bad_dst_n2e +#else /*}{*/ +#define CHECK_SRC /*empty*/ +#define CHECK_DST /*empty*/ +#endif /*}*/ + +#if 0 /*{ DEBUG only: check newly-decompressed against original dst */ +#define CHECK_BYTE \ + push {wrnk}; \ + ldrb wrnk,[dst]; \ + cmp wrnk,tmp; beq 0f; bkpt; \ +0: pop {wrnk} +#else /*}{*/ +#define CHECK_BYTE /*empty*/ +#endif /*}*/ + +/* "mov lr,pc; bxx ..." implements conditional subroutine call */ +#define GETBIT add bits,bits; mov lr,pc; beq get1_n2e + +#define getnextb(reg) GETBIT; adc reg,reg +#define jnextb0 GETBIT; bcc +#define jnextb1 GETBIT; bcs + +ucl_nrv2e_decompress_8: .globl ucl_nrv2e_decompress_8 @ ARM mode + .type ucl_nrv2e_decompress_8, %function +/* error = (*)(char const *src, int len_src, char *dst, int *plen_dst) + Actual decompressed length is stored through plen_dst. + For SAFE mode: at call, *plen_dst must be allowed length of output buffer. +*/ + adr r12,1+thumb_nrv2e_d8; bx r12 @ enter THUMB mode + .code 16 @ THUMB mode + .globl thumb_nrv2e_d8 + .thumb_func +thumb_nrv2e_d8: + push {r2,r3, r4,r5,r6,r7, lr} +#define sp_DST0 0 /* stack offset of original dst */ + add srclim,len,src @ srclim= eof_src; +#if 1==SAFE /*{*/ + ldr tmp,[r3] @ len_dst + add tmp,dst + mov dstlim,tmp +#endif /*}*/ + mov bits,#1; neg off,bits @ off= -1 initial condition + lsl bits,#31 @ 1<<31; refill next time + mov wrnk,#5 + lsl wrnk,#8 @ 0x500 @ nrv2e M2_MAX_OFFSET + b top_n2e + +#if 1==SAFE /*{*/ +bad_dst_n2e: # return value will be 2 + add src,srclim,#1 +bad_src_n2e: # return value will be 1 + add src,#1 +#endif /*}*/ +eof_n2e: + pop {r3,r4} @ r3= orig_dst; r4= plen_dst + sub src,srclim @ 0 if actual src length equals expected length + sub dst,r3 @ actual dst length + str dst,[r4] + pop {r4,r5,r6,r7 /*,pc*/} + pop {r1}; bx r1 @ "pop {,pc}" fails return to ARM mode on ARMv4T + +get1_n2e: @ In: Carry set [from adding 0x80000000 (1<<31) to itself] + ldrb bits,[src] @ zero-extend next byte + adc bits,bits @ double and insert CarryIn as low bit + CHECK_SRC + add src,#1 + lsl bits,#24 @ move to top byte, and set CarryOut from old bit 8 + mov pc,lr @ return, stay in current (THUMB) mode + +lit_n2e: + CHECK_SRC; ldrb tmp,[src]; add src,#1 + CHECK_BYTE + CHECK_DST; strb tmp,[dst]; add dst,#1 +top_n2e: + jnextb1 lit_n2e + mov cnt,#1; b getoff_n2e + +off_n2e: + sub cnt,#1 + getnextb(cnt) +getoff_n2e: + getnextb(cnt) + jnextb0 off_n2e + + sub tmp,cnt,#3 @ set Carry + mov len,#0 @ Carry unaffected + blo offprev_n2e @ cnt was 2; tests Carry only + lsl tmp,#8 + CHECK_SRC; ldrb off,[src]; add src,#1 @ low 7+1 bits + orr off,tmp + mvn off,off; beq eof_n2e @ off= ~off + asr off,#1; bcs lenlast_n2e + b lenmore_n2e + +offprev_n2e: + jnextb1 lenlast_n2e +lenmore_n2e: + mov len,#1 + jnextb1 lenlast_n2e +len_n2e: + getnextb(len) + jnextb0 len_n2e + add len,#6-2 + b gotlen_n2e + +lenlast_n2e: + getnextb(len) @ 0,1,2,3 + add len,#2 +gotlen_n2e: @ 'cmn': add the inputs, set condition codes, discard the sum + cmn wrnk,off; bcs near_n2e @ within M2_MAX_OFFSET + add len,#1 @ too far away, so minimum match length is 3 +near_n2e: +#if 1==SAFE /*{*/ + ldr tmp,[sp,#sp_DST0] + sub tmp,dst + sub tmp,off; bhi bad_dst_n2e @ reaching back too far + + add tmp,dst,cnt + cmp tmp,dstlim; bhi bad_dst_n2e @ too much output +#endif /*}*/ + ldrb tmp,[dst] @ force cacheline allocate +copy_n2e: + ldrb tmp,[dst,off] + CHECK_BYTE + strb tmp,[dst]; add dst,#1 + sub len,#1; bne copy_n2e + b top_n2e + .size ucl_nrv2e_decompress_8, .-ucl_nrv2e_decompress_8 + +/* +vi:ts=8:et:nowrap + */ + diff --git a/src/stub/src/arch/i086/Makefile b/src/stub/src/arch/i086/Makefile new file mode 100644 index 00000000..413a5328 --- /dev/null +++ b/src/stub/src/arch/i086/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../.. $@ diff --git a/src/stub/src/arch/i086/app-nasm.pl b/src/stub/src/arch/i086/app-nasm.pl new file mode 100644 index 00000000..a87bb04e --- /dev/null +++ b/src/stub/src/arch/i086/app-nasm.pl @@ -0,0 +1,121 @@ +#! /usr/bin/perl -w +# +# app_i386.pl -- assembly preprocessor for upx +# +# This file is part of the UPX executable compressor. +# +# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 1996-2006 Laszlo Molnar +# 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 +# +# + +# +# usage: app.pl infile outfile +# + +$in = shift || die; +$ou = shift || die; + +open (IN,"<$in") or die; +open (OU,">$ou") or die; +binmode IN; +binmode OU; + +@lines = ; + +%labels = (); +$i = 0; +$cs = ""; + +($ilabel = $in) =~ s,^.*[\/\\],,; # get basename +$ilabel =~ s/\W//g; + +# 1st pass +for $line (@lines) +{ + $labels{$1} = "$cs" if ($line =~ /^(\w+):/ && $cs); + if ($line =~ /__([A-Z][A-Z0-9_]+)__/) { + $cs = $1; + # verify the line + if ($line =~ /^[\%\;]ifdef/) { + # ok + } elsif ($line =~ /^([\%\;]\w+)?\s*;/) { + # ok + } else { + print STDERR "$in:$i:warning 1:$line" + } + } + + if ($line =~ /^[\%\;](if|el|endi)/) + { + if ($line =~ /__([A-Z][A-Z0-9_]+)__/) + { + $line=";$line" unless ($line =~ /^\;/); + } + else + { + print STDERR "$in:$i:warning 2:$line"; + } + } + $line =~ s/\.ash/\.asy/ if ($line =~ /^\s*\%include/); + $i++; +} + +$cs = ""; +$i = 0; + +# 2nd pass +for $line (@lines) +{ + if ($line =~ /^\s+(j\w+|loop|call)\s+(\w*)/) + { + $label = $2; + die "$line" if ($label =~ /(\bnear\b|\bshort\b)/); + if (defined $labels{$label}) + { + $ts = $labels{$label}; + if ($ts ne $cs) + { + $line =~ s/$label/J$i$ilabel/; + print OU $line; + print OU "J$i$ilabel:\n"; + print OU "\t\tsection\t.data\n\t\tdd\t"; + print OU "0,J$i$ilabel\n\t\tdb\t\'$ts\',0\n\t\tdd\t$label - S$ts$ilabel\n"; + print OU "\t\tsection\t.text\n\n"; + $line = ""; + } + } + } + + $line = ";$line" if ($line =~ /^\s+align\s/); + + print OU $line; + if ($line =~ /__([A-Z][A-Z0-9_]+)__/) + { + print OU "S$1$ilabel:\n"; + print OU "\t\tsection\t.data\n\t\tdb\t\'$1\',0\n\t\tdd\tS$1$ilabel\n"; + print OU "\t\tsection\t.text\n\n"; + $cs = $1; + } + $i++; +} + +# vi:ts=4:et diff --git a/src/stub/src/arch/i086/macros.ash b/src/stub/src/arch/i086/macros.ash new file mode 100644 index 00000000..92e508b0 --- /dev/null +++ b/src/stub/src/arch/i086/macros.ash @@ -0,0 +1,92 @@ +; macros.ash -- +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +; ============= +; ============= 16-BIT CALLTRICK & JUMPTRICK +; ============= + + +%macro cjt16 1 +%ifdef __CALLTR16__ + pop si + mov cx, 'CT' +cjt16_L1: + lodsb + sub al, 0xe8 + cmp al, 1 + ja cjt16_L1 + +%ifdef __CT16I286__ + rol word [si], 8 +; __CT16SUB0__ + sub [si], si +%else; __CT16I086__ + mov bx, [si] + xchg bl, bh + sub bx, si + mov [si], bx +%endif; __CALLTRI2__ + lodsw + loop cjt16_L1 +%endif; __CT16DUM1__ + +; ============= + +%ifdef __CT16E800__ + mov al, 0xe8 +%else; __CT16E900__ + mov al, 0xe9 +%endif; __CALLTRI5__ + pop di + mov cx, 'CT' +cjt16_L11: + repne + scasb +%ifdef __CT16JEND__ + jnz %1 ; FIXME: this doesn't get relocated +%else; __CT16JUL2__ + jnz cjt16_L2 +%endif; __CT16DUM2__ + +%ifdef __CT16I287__ + rol word [di], 8 +; __CT16SUB1__ + sub [di], di +%else; __CT16I087__ + mov bx, [di] + xchg bl, bh + sub bx, di + mov [di], bx +%endif; __CALLTRI6__ + scasw + jmps cjt16_L11 +cjt16_L2: +; __CT16DUMM3__ +%endmacro + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/arch/i086/nrv2b_d16.ash b/src/stub/src/arch/i086/nrv2b_d16.ash new file mode 100644 index 00000000..f839bacc --- /dev/null +++ b/src/stub/src/arch/i086/nrv2b_d16.ash @@ -0,0 +1,184 @@ +; n2b_d16.ash -- ucl_nrv2b_decompress_le16 in 16-bit assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; Input +; bx - 0x8000 +; cx - 0 +; si - source +; di - dest +; bp - -1 + + + %ifndef jmps + %define jmps jmp short + %endif + %ifndef jmpn + %define jmpn jmp near + %endif + + CPU 8086 + + +; __NRV2B160__ +literal_n2b: + movsb +decomp_start_n2b: + call getbit_n2b + jc literal_n2b + + inc cx +loop1_n2b: + call getbit_cx_n2b +%ifdef __NRVDDONE__ + jcxz decomp_done_n2b +%else; __NRVDRETU__ + jcxz decomp_ret_n2b +%endif; __NRVDECO1__ + jnb loop1_n2b + sub cx, byte 3 + jb axbp_n2b + mov ah, cl + lodsb + not ax + xchg bp, ax +axbp_n2b: + xor cx, cx + call getbit_cx_n2b + adc cx, cx + jnz copy_match_n2b + inc cx +loop2_n2b: + call getbit_cx_n2b + jnb loop2_n2b + inc cx + inc cx +copy_match_n2b: +%ifdef __NRVLED00__ + inc cx +%else; __NRVGTD00__ + cmp bp, -0xd00 + adc cx, byte 1 +%endif; __NRVDECO2__ + lea ax, [di+bp] + xchg ax, si + rep + movsb + xchg ax, si + jmps decomp_start_n2b +getbit_cx_n2b: + call getbit_n2b + adc cx, cx +getbit_n2b: + add bx, bx + jnz decomp_ret_n2b + lodsw + adc ax, ax + xchg ax, bx +decomp_ret_n2b: + ret +decomp_done_n2b: +; __NRV2B169__ + + + +; ============= +; ============= 16-BIT CALLTRICK & JUMPTRICK +; ============= + + + %ifdef CJT16 + +%ifdef __CALLTR16__ + pop si + mov cx, 'CT' +cjt16_L1: + lodsb + sub al, 0xe8 + cmp al, 1 + ja cjt16_L1 + +%ifdef __CT16I286__ + CPU 286 + rol word [si], 8 + CPU 8086 +; __CT16SUB0__ + sub [si], si +%else; __CT16I086__ + mov bx, [si] + xchg bl, bh + sub bx, si + mov [si], bx +%endif; __CALLTRI2__ + lodsw + loop cjt16_L1 +%endif; __CT16DUM1__ + +; ============= + +%ifdef __CT16E800__ + mov al, 0xe8 +%else; __CT16E900__ + mov al, 0xe9 +%endif; __CALLTRI5__ + pop di + mov cx, 'CT' +cjt16_L11: + repne + scasb +%ifdef __CT16JEND__ + jnz decomp_ret_n2b +%else; __CT16JUL2__ + jnz cjt16_L2 +%endif; __CT16DUM2__ + +%ifdef __CT16I287__ + CPU 286 + rol word [di], 8 + CPU 8086 +; __CT16SUB1__ + sub [di], di +%else; __CT16I087__ + mov bx, [di] + xchg bl, bh + sub bx, di + mov [di], bx +%endif; __CALLTRI6__ + scasw + jmps cjt16_L11 +cjt16_L2: +; __CT16DUMM3__ + + %endif ; CJT16 + + + CPU 8086 + +; vi:ts=8:et + diff --git a/src/stub/src/arch/i086/nrv2b_d8.ash b/src/stub/src/arch/i086/nrv2b_d8.ash new file mode 100644 index 00000000..05bb8514 --- /dev/null +++ b/src/stub/src/arch/i086/nrv2b_d8.ash @@ -0,0 +1,167 @@ +; n2b_d8e.ash -- ucl_nrv2b_decompress_8 in 16-bit assembly (dos/exe) +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; Input +; ds:si - source +; es:di - dest +; dx = ds +; cx = 0 +; bx = 0x800F +; bp = 1 + + + %ifndef jmps + %define jmps jmp short + %endif + %ifndef jmpn + %define jmpn jmp near + %endif + + CPU 8086 + + +; __NRV2B16S__ +literal_n2b: + movsb +decompr_start_n2b: + add bh, bh + jnz dec1_n2b + call reloadbh_n2b +dec1_n2b: + jc literal_n2b + inc cx + mov ax, es +%ifdef __N2B64K01__ + add di, di + jnc di_ok_n2b + add ah, 8 + mov es, ax +di_ok_n2b: + shr di, 1 +%endif; __NRV2BEX1__ +offset_loop_n2b: + call getbit_cx_n2b + jcxz decomp_done_n2b + jnc offset_loop_n2b + dec cx + dec cx + jz offset_ok_n2b +%ifdef __N2BX8601__ + add cx, cx + add cx, cx + add cx, cx + add cx, cx +%else; __N2B28601__ + CPU 286 + shl cx, 4 + CPU 8086 +%endif; __NRV2BEX2__ + mov bp, cx + mov bl, [si] + inc si + not bl + xor cx, cx +offset_ok_n2b: + call getbit_cx_n2b + adc cx, cx + jnz copy_match_n2b + inc cx +length_loop_n2b: + call getbit_cx_n2b + jnc length_loop_n2b + inc cx + inc cx +copy_match_n2b: + cmp bp, 0xd1 + sbb cx, byte -2 + + sub ax, bp + jb handle_underflow_n2b + mov ds, ax + lea ax, [bx + di] +ds_ok_n2b: + sub ah, bh + xchg ax, si + rep + movsb + xchg ax, si + mov ds, dx + jmps decompr_start_n2b +handle_underflow_n2b: +%ifdef __N2BX8602__ + shl ax, 1 + shl ax, 1 + shl ax, 1 + shl ax, 1 + push ax + xor ax, ax + mov ds, ax + pop ax +%else; __N2B28602__ + CPU 286 + shl ax, 4 + push byte 0 + pop ds + CPU 8086 +%endif; __NRV2BEX3__ + add ax, bx + add ax, di + jmps ds_ok_n2b +getbit_cx_n2b: + add bh, bh + jnz gb2_n2b + call reloadbh_n2b +gb2_n2b: + adc cx, cx +getbit_n2b: + add bh, bh + jnz f2_n2b +reloadbh_n2b: + mov bh, [si] +%ifdef __N2B64K02__ + adc si, si + jnc si_ok_n2b + add dh, 8 + mov ds, dx +si_ok_n2b: + shr si, 1 +%endif; __NRV2BEX9__ + inc si + adc bh, bh +f2_n2b: + ret +decomp_done_n2b: +; __NRV2B16E__ + + + CPU 8086 + +; vi:ts=8:et + diff --git a/src/stub/src/arch/i086/nrv2d_d8.ash b/src/stub/src/arch/i086/nrv2d_d8.ash new file mode 100644 index 00000000..41c5243c --- /dev/null +++ b/src/stub/src/arch/i086/nrv2d_d8.ash @@ -0,0 +1,177 @@ +; n2d_d8e.ash -- ucl_nrv2d_decompress_8 in 16-bit assembly (dos/exe) +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; Input +; ds:si - source +; es:di - dest +; dx = ds +; cx = 0 +; bx = 0x800F +; bp = 1 + + + %ifndef jmps + %define jmps jmp short + %endif + %ifndef jmpn + %define jmpn jmp near + %endif + + CPU 8086 + + +; __NRV2D16S__ +literal_n2d: + movsb +decompr_start_n2d: + add bh, bh + jnz dec1_n2d + call reloadbh_n2d +dec1_n2d: + jc literal_n2d + inc cx + mov ax, es +%ifdef __N2D64K01__ + add di, di + jnc di_ok_n2d + add ah, 8 + mov es, ax +di_ok_n2d: + shr di, 1 +%endif; __NRV2DEX1__ +offset_loop_n2d: + call getbit_cx_n2d + jc offset_loopend_n2d + dec cx + call getbit_n2d + adc cx, cx + jns offset_loop_n2d + jmps decomp_done_n2d + +offset_loopend_n2d: + dec cx + dec cx + jz offset_ok_n2d +%ifdef __N2DX8601__ + add cx, cx + add cx, cx + add cx, cx +%else; __N2D28601__ + CPU 286 + shl cx, 3 + CPU 8086 +%endif; __NRV2DEX2__ + mov bp, cx + mov bl, [si] + inc si + not bl + xor cx, cx + shr bl, 1 + jmps ook1_n2d +offset_ok_n2d: + call getbit_n2d +ook1_n2d: + adc cx, cx + call getbit_n2d + adc cx, cx + jnz copy_match_n2d + inc cx +length_loop_n2d: + call getbit_cx_n2d + jnc length_loop_n2d + inc cx + inc cx +copy_match_n2d: + cmp bp, byte 0x51 + sbb cx, byte -2 + + sub ax, bp + jb handle_underflow_n2d + mov ds, ax + lea ax, [bx + di] +ds_ok_n2d: + sub ah, bh + xchg ax, si + rep + movsb + xchg ax, si + mov ds, dx + jmps decompr_start_n2d +handle_underflow_n2d: +%ifdef __N2DX8602__ + shl ax, 1 + shl ax, 1 + shl ax, 1 + shl ax, 1 + push ax + xor ax, ax + mov ds, ax + pop ax +%else; __N2D28602__ + CPU 286 + shl ax, 4 + push byte 0 + pop ds + CPU 8086 +%endif; __NRV2DEX3__ + add ax, bx + add ax, di + jmps ds_ok_n2d +getbit_cx_n2d: + add bh, bh + jnz gb2_n2d + call reloadbh_n2d +gb2_n2d: + adc cx, cx +getbit_n2d: + add bh, bh + jnz f2_n2d +reloadbh_n2d: + mov bh, [si] +%ifdef __N2D64K02__ + adc si, si + jnc si_ok_n2d + add dh, 8 + mov ds, dx +si_ok_n2d: + shr si, 1 +%endif; __NRV2DEX9__ + inc si + adc bh, bh +f2_n2d: + ret +decomp_done_n2d: +; __NRV2D16E__ + + + CPU 8086 + +; vi:ts=8:et + diff --git a/src/stub/src/arch/i086/nrv2e_d8.ash b/src/stub/src/arch/i086/nrv2e_d8.ash new file mode 100644 index 00000000..56329cba --- /dev/null +++ b/src/stub/src/arch/i086/nrv2e_d8.ash @@ -0,0 +1,183 @@ +; n2e_d8e.ash -- ucl_nrv2e_decompress_8 in 16-bit assembly (dos/exe) +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; Input +; ds:si - source +; es:di - dest +; dx = ds +; cx = 0 +; bx = 0x800F +; bp = 1 + + + %ifndef jmps + %define jmps jmp short + %endif + %ifndef jmpn + %define jmpn jmp near + %endif + + CPU 8086 + + +; __NRV2E16S__ +literal_n2e: + movsb +decompr_start_n2e: + add bh, bh + jnz dec1_n2e + call reloadbh_n2e +dec1_n2e: + jc literal_n2e + inc cx + mov ax, es +%ifdef __N2E64K01__ + add di, di + jnc di_ok_n2e + add ah, 8 + mov es, ax +di_ok_n2e: + shr di, 1 +%endif; __NRV2EEX1__ +offset_loop_n2e: + call getbit_cx_n2e + jc offset_loopend_n2e + dec cx + call getbit_n2e + adc cx, cx + jns offset_loop_n2e + jmps decomp_done_n2e + +offset_loopend_n2e: + dec cx + dec cx + jz offset_ok_n2e +%ifdef __N2EX8601__ + add cx, cx + add cx, cx + add cx, cx +%else; __N2E28601__ + CPU 286 + shl cx, 3 + CPU 8086 +%endif; __NRV2EEX2__ + mov bp, cx + mov bl, [si] + inc si + not bl + xor cx, cx + shr bl, 1 + jnc ook1_n2e +mlen1_n2e: + call getbit_n2e + adc cx, cx + jmps copy_match_n2e + +offset_ok_n2e: + call getbit_n2e + jc mlen1_n2e +ook1_n2e: + inc cx + call getbit_n2e + jc mlen1_n2e +length_loop_n2e: + call getbit_cx_n2e + jnc length_loop_n2e + inc cx + inc cx +copy_match_n2e: + cmp bp, byte 0x51 + sbb cx, byte -3 + + sub ax, bp + jb handle_underflow_n2e + mov ds, ax + lea ax, [bx + di] +ds_ok_n2e: + sub ah, bh + xchg ax, si + rep + movsb + xchg ax, si + mov ds, dx + jmps decompr_start_n2e + +handle_underflow_n2e: +%ifdef __N2EX8602__ + shl ax, 1 + shl ax, 1 + shl ax, 1 + shl ax, 1 + push ax + xor ax, ax + mov ds, ax + pop ax +%else; __N2E28602__ + CPU 286 + shl ax, 4 + push byte 0 + pop ds + CPU 8086 +%endif; __NRV2EEX3__ + add ax, bx + add ax, di + jmps ds_ok_n2e + +getbit_cx_n2e: + add bh, bh + jnz gb2_n2e + call reloadbh_n2e +gb2_n2e: + adc cx, cx +getbit_n2e: + add bh, bh + jnz f2_n2e +reloadbh_n2e: + mov bh, [si] +%ifdef __N2E64K02__ + adc si, si + jnc si_ok_n2e + add dh, 8 + mov ds, dx +si_ok_n2e: + shr si, 1 +%endif; __NRV2EEX9__ + inc si + adc bh, bh +f2_n2e: + ret +decomp_done_n2e: +; __NRV2E16E__ + + + CPU 8086 + +; vi:ts=8:et + diff --git a/src/stub/src/arch/i386/Makefile b/src/stub/src/arch/i386/Makefile new file mode 100644 index 00000000..413a5328 --- /dev/null +++ b/src/stub/src/arch/i386/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../.. $@ diff --git a/src/stub/src/arch/i386/app-nasm.pl b/src/stub/src/arch/i386/app-nasm.pl new file mode 100644 index 00000000..a87bb04e --- /dev/null +++ b/src/stub/src/arch/i386/app-nasm.pl @@ -0,0 +1,121 @@ +#! /usr/bin/perl -w +# +# app_i386.pl -- assembly preprocessor for upx +# +# This file is part of the UPX executable compressor. +# +# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 1996-2006 Laszlo Molnar +# 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 +# +# + +# +# usage: app.pl infile outfile +# + +$in = shift || die; +$ou = shift || die; + +open (IN,"<$in") or die; +open (OU,">$ou") or die; +binmode IN; +binmode OU; + +@lines = ; + +%labels = (); +$i = 0; +$cs = ""; + +($ilabel = $in) =~ s,^.*[\/\\],,; # get basename +$ilabel =~ s/\W//g; + +# 1st pass +for $line (@lines) +{ + $labels{$1} = "$cs" if ($line =~ /^(\w+):/ && $cs); + if ($line =~ /__([A-Z][A-Z0-9_]+)__/) { + $cs = $1; + # verify the line + if ($line =~ /^[\%\;]ifdef/) { + # ok + } elsif ($line =~ /^([\%\;]\w+)?\s*;/) { + # ok + } else { + print STDERR "$in:$i:warning 1:$line" + } + } + + if ($line =~ /^[\%\;](if|el|endi)/) + { + if ($line =~ /__([A-Z][A-Z0-9_]+)__/) + { + $line=";$line" unless ($line =~ /^\;/); + } + else + { + print STDERR "$in:$i:warning 2:$line"; + } + } + $line =~ s/\.ash/\.asy/ if ($line =~ /^\s*\%include/); + $i++; +} + +$cs = ""; +$i = 0; + +# 2nd pass +for $line (@lines) +{ + if ($line =~ /^\s+(j\w+|loop|call)\s+(\w*)/) + { + $label = $2; + die "$line" if ($label =~ /(\bnear\b|\bshort\b)/); + if (defined $labels{$label}) + { + $ts = $labels{$label}; + if ($ts ne $cs) + { + $line =~ s/$label/J$i$ilabel/; + print OU $line; + print OU "J$i$ilabel:\n"; + print OU "\t\tsection\t.data\n\t\tdd\t"; + print OU "0,J$i$ilabel\n\t\tdb\t\'$ts\',0\n\t\tdd\t$label - S$ts$ilabel\n"; + print OU "\t\tsection\t.text\n\n"; + $line = ""; + } + } + } + + $line = ";$line" if ($line =~ /^\s+align\s/); + + print OU $line; + if ($line =~ /__([A-Z][A-Z0-9_]+)__/) + { + print OU "S$1$ilabel:\n"; + print OU "\t\tsection\t.data\n\t\tdb\t\'$1\',0\n\t\tdd\tS$1$ilabel\n"; + print OU "\t\tsection\t.text\n\n"; + $cs = $1; + } + $i++; +} + +# vi:ts=4:et diff --git a/src/stub/src/arch/i386/cl1_d32.ash b/src/stub/src/arch/i386/cl1_d32.ash new file mode 100644 index 00000000..365bd7a2 --- /dev/null +++ b/src/stub/src/arch/i386/cl1_d32.ash @@ -0,0 +1,253 @@ +; cl1_d32.ash -- cl1_decompress_le32 in 32-bit assembly +; schema from ucl/nrv2b_d32.ash +; +; Copyright (C) 2004 John Reiser +; Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer +; All Rights Reserved. +; +; This file 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. +; +; This file 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 John Reiser +; +; + + +; ------------- DECOMPRESSION ------------- + +; Input: +; esi - source +; edi - dest +; ebp - -1 +; cld + +; Output: +; eax - 0 +; ecx - 0 + + + %ifndef jmps + %define jmps jmp short + %endif + %ifndef jmpn + %define jmpn jmp near + %endif + + +;; One of these two is instantiated many times by buildLoader +%ifdef __CL1SMA1B__ + call edx +%else; __CL1FAS1B__ + add ebx, ebx + db 0x75,2 ;jnz cl1_no_reload + call edx + ;cl1_no_reload: +%endif; __CL1GET1B__ + +; __CL1ENTER__ + nop ; 'int3' for debugging + call start_cl1 ; pic push address of next instr +; __CL1SMA10__ +getbit_cl1: ; appears only in small version + add ebx, ebx + jz reload_cl1 + ret +; __CL1RLOAD__ +reload_cl1: ; for both small and fast version + mov ebx, [esi] + sub esi, byte -4 + adc ebx, ebx + ret +; __CL1WID01__ +widelit_cl1: + sub ecx,ecx ; back to 0 + ; getbit +; __CL1WID02__ + adc ecx,ecx + ; getbit +; __CL1WID03__ + jc lit89_cl1 + ; getbit +; __CL1WID04__ + adc ecx,ecx + ; getbit +; __CL1WID05__ + jc lit10_12_cl1 + ; getbit +; __CL1WID06__ + adc ecx,ecx ; 0..7; -1+ (width/2) of length +litwidth_cl1: ; ss22 algorithm, counted width<=8 pairs; returns eax= 2..0x15555 + ; getbit +; __CL1WID07__ + adc eax,eax + dec eax + ; getbit +; __CL1WID08__ + adc eax,eax + sub ecx, byte 1 + jnc litwidth_cl1 + lea ecx,[17 -2 + eax] ; 17: predecessors; ss22 returns 2.. + cmp eax,0xffff-(17 -2) + jb litgo_cl1 ; not maximal range of search + lea eax,[esi + ecx] ; esi after copy + push eax ; "parameter" to maxlit_cl1 + jmpn maxlit_cl1 ; can have another literal afterwards +lit13_16_cl1: + ; getbit +; __CL1WID09__ + adc ecx,ecx + ; getbit +; __CL1WID10__ + adc ecx,ecx + add ecx, byte 13 + jmps litmov_cl1 +lit10_12_cl1: + test ecx,ecx + jz lit13_16_cl1 + inc ecx ; 2,3,4 +lit89_cl1: + add ecx, byte 8 +litgo_cl1: + jmps litmov_cl1 +; __CL1START__ +start_cl1: + sub ecx,ecx ; 0 + pop edx ; edx= getbit_cl1 or reload_cl1 + sub ebx, ebx ; cause reload on first bit + +; __CL1TOP00__ +top_cl1: ; In: 0==ecx + lea eax,[1+ ecx] ; 1: the msb of offset or large width + ; getbit +; __CL1TOP01__ + jnc match_cl1 + ; getbit +; __CL1TOP02__ + jc lit1_cl1 + ; getbit +; __CL1TOP03__ + jc lit2_cl1 + ; getbit +; __CL1TOP04__ + jc lit3_cl1 + add ecx, byte 2 + ; getbit +; __CL1TOP05__ + jc lit45_cl1 + inc ecx + ; getbit +; __CL1TOP06__ + jc lit67_cl1 + jmpn widelit_cl1 +lit67_cl1: +lit45_cl1: + ; getbit +; __CL1TOP07__ + adc ecx,ecx +litmov_cl1: + db 0xD1,((3<<6)|(5<<3)|1) ;shr ecx,1 + jnc litmovb_cl1 + movsb +litmovb_cl1: + db 0xD1,((3<<6)|(5<<3)|1) ;shr ecx,1 + jnc litmovw_cl1 + movsw +litmovw_cl1: + rep + movsd + lea eax,[1+ ecx] ; 1: the msb + jmps litdone_cl1 +lit3_cl1: + movsb +lit2_cl1: + movsb +lit1_cl1: + movsb +litdone_cl1: + +match_cl1: ; In: 0==ecx; 1==eax + +offset_cl1: ; ss11 algorithm + ; getbit +; __CL1OFF01__ + adc eax,eax + ; getbit +; __CL1OFF02__ + jnc offset_cl1 + sub eax, byte 3 ; 2.. ==> -1[prev], (0,,<<8)|byte + jc prev_off_cl1 + shl eax,8 + lodsb + xor eax, byte ~0 + jz done_cl1 ; EOF + mov ebp,eax ; -offset +prev_off_cl1: ; 1st 2 bits encode (5<=len),2,3,4 + ; getbit +; __CL1OFF03__ + adc ecx,ecx + ; getbit +; __CL1OFF04__ + adc ecx,ecx + jnz wrinkle_cl1 +; __CL1LEN00__ + inc ecx ; 1: the msb +mlen_cl1: + ; getbit +; __CL1LEN01__ + adc ecx,ecx + ; getbit +; __CL1LEN02__ + jnc mlen_cl1 + add ecx, byte 2 ; 2.. ==> 4.. +; __CL1COPY0__ +wrinkle_cl1: + cmp ebp,-0xd00 + adc ecx, byte 1 +copy_cl1: + push esi + lea esi,[edi + ebp] + cmp ebp, byte -4 + ja ripple_cl1 +maxlit_cl1: ; literal copy cannot overlap; omit test for ripple + db 0xD1,((3<<6)|(5<<3)|1) ;shr ecx,1 + jnc maxlitb_cl1 + movsb +maxlitb_cl1: + db 0xD1,((3<<6)|(5<<3)|1) ;shr ecx,1 + jnc maxlitw_cl1 + movsw +maxlitw_cl1: + rep + movsd +popbot_cl1: + pop esi +bottom_cl1: + jmpn top_cl1 +ripple_cl1: + cmp ebp, byte -1 + jne ripmov_cl1 + lodsb + rep + stosb + jmps popbot_cl1 +ripmov_cl1: + rep + movsb + jmps popbot_cl1 +done_cl1: +; __CL1END__ + +; vi:ts=8:et + diff --git a/src/stub/src/arch/i386/macros.ash b/src/stub/src/arch/i386/macros.ash new file mode 100644 index 00000000..c458f1ca --- /dev/null +++ b/src/stub/src/arch/i386/macros.ash @@ -0,0 +1,520 @@ +; macros.ash -- +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +;; ============= +;; ============= 32-BIT CALLTRICK & JUMPTRICK +;; ============= + +;; call & jump trick : 2 in 1 +%macro cjt32 1 +%ifdef __CALLTR00__ + mov ecx, 'TEXL' +calltrickloop: + mov al, [edi] + inc edi + sub al, 0xE8 +ct1: + cmp al, 1 + ja calltrickloop +%ifdef __CTCLEVE1__ + cmp byte [edi], '?' + jnz calltrickloop +%endif; __CALLTR01__ + mov eax, [edi] + mov bl, [edi + 4] +%ifdef __CTDUMMY1__ +%ifdef __CTBSHR01__ + shr ax, 8 +%else; __CTBROR01__ + xchg al, ah +%endif; __CTBSWA01__ + rol eax, 16 + xchg al, ah +%endif; __CALLTR02__ + sub eax, edi + sub bl, 0xE8 + %ifnidn %1,0 + add eax, %1 + %endif + mov [edi], eax + add edi, byte 5 + mov al, bl + loop ct1 +%else; __CALLTR10__ +;; 32-bit call XOR jump trick + mov ecx, 'TEXL' +ctloop1: +%ifdef __CALLTRE8__ + mov al,0xE8 +%else; __CALLTRE9__ + mov al,0xE9 +%endif; __CALLTR11__ +ctloop2: + repnz + scasb + jnz ctend +%ifdef __CTCLEVE2__ + cmp byte [edi], '?' + jnz ctloop2 +%endif; __CALLTR12__ + mov eax, [edi] +%ifdef __CTDUMMY2__ +%ifdef __CTBSHR11__ + shr ax, 8 +%else; __CTBROR11__ + xchg al, ah +%endif; __CTBSWA11__ + rol eax, 16 + xchg al, ah +%endif; __CALLTR13__ + sub eax, edi + %ifnidn %1,0 + add eax, %1 + %endif + stosd + jmps ctloop1 +ctend: +%endif; __CTTHEEND__ +%endmacro + + +;; call/jump/jcc trick; also used more than once (and/or optionally), so +;; ecx has byte count (not count of applied instances), and +;; edi points to buffer. +%macro ckt32 2 +; 1st param: effective addvalue (typically 0 or edi; any rvalue) +; 2nd param: where is cto8 (dl, bl, or literal) + +;__CKLLTR00__ + %ifnidn %1,0 + mov esi, %1 + %endif + jmps ckstart +ckloop3: + mov al, [edi] + add edi, byte 1 +;__CKLLTR10__ Jcc only + cmp al, 0x80 ; lo of 6-byte Jcc + jb ckloop2 + cmp al, 0x8f ; hi of 6-byte Jcc + ja ckloop2 + cmp byte [edi -2], 0x0F ; prefix of 6-byte Jcc + je ckmark +ckloop2: +;__CKLLTR20__ + sub al, 0xE8 + cmp al, 0xE9 - 0xE8 + ja ckcount +ckmark: + cmp byte [edi], %2 ; cto8 + jnz ckcount + mov eax, [edi] + + shr ax, 8 + rol eax, 16 + xchg al, ah +; above 3 instr are equivalent to the following 2 instr: +; mov al, 0 ; clear cto8 [setup partial-write stall] +; bswap eax ; not on 386: need 486 and up + + sub eax, edi + %ifnidn %1,0 + add eax, esi + %endif + mov [edi], eax + add edi, byte 4 +ckstart: + sub ecx, byte 4 +;__CKLLTR30__ Jcc only + mov al, [edi] + add edi, byte 1 + loop ckloop2 ; prefix cannot overlap previous displacement +;__CKLLTR40__ +ckcount: + sub ecx, byte 1 + jg ckloop3 +ckend: +%endmacro + +;; ============= +;; ============= 32-BIT RELOCATIONS +;; ============= + +%macro reloc32 3 +; __RELOC320__ +reloc_main: + xor eax, eax + mov al, [%1] + inc %1 + or eax, eax + jz reloc_endx + cmp al, 0xEF + ja reloc_fx +reloc_add: + add %2, eax + %if 1 + mov eax, [%2] + xchg al, ah + rol eax, 16 + xchg al, ah + add eax, %3 + mov [%2], eax + %else + add [%2], %3 + %endif + jmps reloc_main +reloc_fx: + and al, 0x0F + shl eax, 16 + mov ax, [%1] + add %1, byte 2 +%ifdef __REL32BIG__ + or eax, eax + jnz reloc_add + mov eax, [%1] + add %1, byte 4 +%endif; __RELOC32J__ + jmps reloc_add +reloc_endx: +; __REL32END__ +%endmacro + + +;; ============= +;; ============= 32-BIT CALL TRICK UNFILTER WITH MostRecentlyUsed BUFFER +;; ============= + +;;;; names of pseudo-sections for addLoader: +;; LXUNFnnn Linux unfilter +;; LXMRUnnn MostRecentlyUsed recoding of destinations +;; MRUARBnn arbitrary number of entries in wheel +;; MRUBITSn power of 2 entries in wheel (smaller code) +;; MRUBYTEn 256 entries in wheel (smallest code) + +%macro ctojr32 0 +%push ctojr32 + +;; I got confused by the syntactic sugar of the fake %ifdefs. +;; I can read the section name more easily when it is at the left margin. +;; Also, some of the logic to select the sections is not that simple, +;; and any mismatch between the logic and the %ifdefs is very confusing. +;; Instead, I use comments after the section name, and blank lines for grouping. + +;__LXUNF000__ enter at +0 for decompression; +2 for unfiltering + jmps decompr0 +;__LXUNF002__ + ;; 2+ address of decompress subroutine + ;; unfilter(upx_byte *, length, cto8) +lxunfilter: + pop edx ; return address + pop eax ; upx_byte *, same as addvalue + pop ecx ; length + xchg eax, edi ; edi= pointer; eax= saved_edi + pusha ; save C-convention ebx, ebp, esi, edi; also eax, edx + +; at most one of the next 2 +;__MRUBYTE0__ 256==n_mru + xor ebx, ebx ; zero +;__LXMRU005__ 0!=n_mru + mov ebx, 'NMRU' ; modified N_MRU or N_MRU -1 + +;__LXMRU006__ 0!=n_mru + push byte 0x0f ; prefix of 6-byte Jcc + pop eax + mov ah, [esp + 8*4] ; cto8 +;__LXMRU007__ 0==n_mru + push byte 0x0f ; prefix of 6-byte Jcc + pop ebx + mov bh, [esp + 8*4] ; cto8 + +;__LXUNF008__ + mov dl, [esp + 8*4] ; cto8 + +;__LXUNF010__ + jmpn lxunf0 +decompr0: + +;; These %define are only if 0!=n_mru; +;; else 0x0F==bl && cto8==bh==dh && 0xE8==dl && addvalue==esi . +%define %$n_mru [esi] +%define %$n_mru1 [esi] +%define %$tail [esi + 4*1] +%define %$cto8_e8e9 [esi + 4*2] +%define %$cto8_0f [esi + 4*3] +%define %$addvalue [esi + 4*4] +%define %$tmp ebp +%define %$hand ebx +%define %$hand_l bl +%define %$kh edx +%define %$kh_l dl + +;__LXJCC010__ +lxunf2: ; have seen 0x80..0x8f of possible recoded 6-byte Jcc + movzx ebp, word [edi] ; 2 bytes, zero-extended + +;__LXMRU045__ 0!=n_mru + sub ebp, %$cto8_0f +;__LXMRU046__ 0==n_mru + sub ebp, ebx + +;__LXJCC020__ 0==n_mru, or Jcc excluded ('sub' of equals clears Carry) + jne unfcount +;__LXJCC021__ 0!=n_mru and Jcc participates; must set Carry + sub ebp, byte 1 ; set Carry iff in range + jnb unfcount + +;__LXJCC023__ found Jcc; re-swap 0x8Y opcode and 0x0f prefix + mov byte [edi -1], bl ; 0x0f prefix + dec ecx ; preserve Carry + mov byte [edi], al ; Jcc opcode + inc edi ; preserve Carry + +;__LXUNF037__ +%define %$jc eax + +lxunf: ; in: Carry set iff we should apply mru and 0!=n_mru + mov eax, [edi] ; BE32 displacement with cto8 in low 8 bits + +;__LXUNF386__ 0!=n_mru && 386 + pushf +;__LXUNF387__ ==386 + shr ax, 8 + rol eax, 16 + xchg al, ah +;__LXUNF388__ 0!=n_mru && 386 + popf + jnc unf_store ; do not apply mru + +;__LXUNF486__ >=486 + mov al, byte 0 + CPU 486 + bswap eax ; preserve Carry (2-byte instruction) + CPU 386 +;__LXUNF487__ 0!=n_mru && >=486 + jnc unf_store ; do not apply mru + +;__LXMRU065__ 0!=n_mru + shr %$jc, 1 ; eax= jc, or mru index + jnc mru4 ; not 1st time for this jc +;__MRUBYTE3__ + dec %$hand_l +;__MRUARB30__ + dec %$hand +;__MRUBITS3__ + and %$hand, %$n_mru1 +;__MRUARB40__ + jge mru3 + add %$hand, %$n_mru +mru3: +;__LXMRU070__ + + mov [esp + 4*%$hand], %$jc ; 1st time: mru[hand] = jc + jmps unf_store + +mru4: ; not 1st time for this jc + lea %$kh, [%$jc + %$hand] ; kh = jc + hand +;__MRUBYTE4__ + movzx %$kh, %$kh_l +;__MRUBITS4__ + and %$kh, %$n_mru1 +;__MRUARB50__ + cmp %$kh, %$n_mru + jb mru5 + sub %$kh, %$n_mru +mru5: +;__LXMRU080__ + mov %$jc, [esp + 4*%$kh] ; jc = mru[kh] +;__MRUBYTE5__ + dec %$hand_l +;__MRUARB60__ + dec %$hand +;__MRUBITS5__ + and %$hand, %$n_mru1 +;__MRUARB70__ + jge mru6 + add %$hand, %$n_mru +mru6: +;__LXMRU090__ + + mov %$tmp, [esp + 4*%$hand] ; tmp = mru[hand] + test %$tmp,%$tmp + jnz mru8 + + push %$jc ; ran out of registers + mov eax, %$tail + +;__MRUBYTE6__ + dec al +;__MRUARB80__ + dec eax +;__MRUBITS6__ + and eax, %$n_mru1 +;__MRUARB90__ + jge mru7 + add eax, %$n_mru +mru7: +;__LXMRU100__ + + xor %$tmp,%$tmp + mov %$tail, eax + xchg [4+ esp + 4*eax], %$tmp ; tmp = mru[tail]; mru[tail] = 0 + pop %$jc +mru8: + mov [esp + 4*%$kh ], %$tmp ; mru[kh] = tmp + mov [esp + 4*%$hand], %$jc ; mru[hand] = jc +;__LXUNF040__ +unf_store: + sub eax, edi + sub ecx, byte 4 + +; one of the next2 +;__LXMRU110__ 0!=n_mru + add eax, %$addvalue +;__LXMRU111__ 0==n_mru + add eax, esi ; addvalue (same as initial pointer) + +;__LXUNF041__ + mov [edi], eax + add edi, byte 4 + jmps unfcount +;__LXUNF042__ +lxunf0: ;; continuation of entry prolog for unfilter +;__LEXEC016__ bug in APP: jmp and label must be in same .asx/.asy + jmp lxunf0 ; this instr does not really go here! + +;__LXMRU010__ 0!=n_mru + push eax ; cto8_0f +;__LXJMPA00__ only JMP, and not CALL, is filtered + mov al, 0xE9 +;__LXCALLB0__ only CALL, or both CALL and JMP are filtered + mov al, 0xE8 +;__LXUNF021__ common tail + push eax ; cto8_e8e9 + push byte 0 ; tail + push ebx ; n_mru or n_mru1 + mov esi, esp ; flat model "[esi]" saves a byte over "[ebp]" + +;__LXMRU022__ 0==n_mru + pop esi ; addvalue + mov edx, ebx ; dh= cto8 +;__LXJMPA01__ only JMP, and not CALL, is filtered + mov dl, 0xE9 +;__LXCALLB1__ only CALL, or both CALL and JMP are filtered + mov dl, 0xE8 + + +;__MRUBITS1__ + inc %$hand ; n_mru1 ==> n_mru +;__LXMRU030__ +lxunf1: ; allocate and clear mru[] + push byte 0 + +; one of the next 2, if n_mru +;__MRUBYTE1__ + dec %$hand_l +;__MRUARB10__ + dec %$hand + +;__LXMRU040__ 0!=n_mru + jnz lxunf1 ; leaves 0=='hand' + +;__LXUNF030__ +lxctloop: + movzx eax, word [edi] ; 2 bytes, zero extended + add edi, byte 1 +;__LXJCC000__ + cmp al, 0x80 ; lo of Jcc + jb lxct1 + cmp al, 0x8f ; hi of Jcc + jbe lxunf2 +lxct1: + +;__LXCJ0MRU__ 0==n_mru + sub eax, edx +;__LXCJ1MRU__ 0!=n_mru + sub eax, %$cto8_e8e9 + +; both CALL and JMP are filtered +;__LXCALJMP__ + sub eax, byte 1+ (0xE9 - 0xE8) ; set Carry iff in range (result: -2, -1) + +; only CALL, or only JMP, is filtered +;__LXCALL00__ 0==n_mru + je lxunf +;__LXCALL01__ 0!=n_rmu + sub eax, byte 1 ; set Carry iff in range + +;__LXCJ2MRU__ 0==n_mru, or apply mru to all that are filtered here + jb lxunf ; only Carry (Borrow) matters +;__LXCJ4MRU__ 0!=n_mru, but apply mru only to subset of filtered here + jnb unfcount ; was not filtered anyway: do not unfilter + +;we will unfilter, and 0!=n_mru, but should we apply mru? +;__LXCJ6MRU__ apply mru to JMP only (0xFF==al) + jpe lxct3 ; jump if even number of 1 bits in al +;__LXCJ7MRU__ apply mru to CALL only (0xFE==al) + jpo lxct3 ; jump if odd number of 1 bits in al +;__LXCJ8MRU__ do not apply mru to one or both + clc +lxct3: + jmps lxunf + +;__LXUNF034__ +unfcount: + sub ecx, byte 1 + jg lxctloop + +;__LXMRU055__ + mov edi, esp ; clear mru[] portion of stack +;__MRUBYTE2__ + mov ecx, 4+ 256 ; unused, tail, cto8_e8e9, cto8_0f +;__MRUBITS2__ + mov ecx, %$n_mru1 + add ecx, byte 1+ 4 ; n_mru1, tail, cto8_e8e9, cto8_0f +;__MRUARB20__ + mov ecx, %$n_mru + add ecx, byte 4 ; n_mru, tail, cto8_e8e9, cto8_0f +;__LXMRU057__ + xor eax, eax + rep + stosd + mov esp, edi + +;__LXMRU058__ 0==n_mru + push esi +;__LXUNF035__ + popa + xchg eax, edi + push ecx + push eax + push edx + ret +%pop +%endmacro + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/arch/i386/nrv2b_d32.ash b/src/stub/src/arch/i386/nrv2b_d32.ash new file mode 100644 index 00000000..a57da0f9 --- /dev/null +++ b/src/stub/src/arch/i386/nrv2b_d32.ash @@ -0,0 +1,198 @@ +; n2b_d32.ash -- ucl_nrv2b_decompress_le32 in 32-bit assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; Input: +; esi - source +; edi - dest +; ebp - -1 +; cld + +; Output: +; eax - 0 +; ecx - 0 + + + %ifndef jmps + %define jmps jmp short + %endif + %ifndef jmpn + %define jmpn jmp near + %endif + + CPU 386 + + +%macro getbit_n2b 1 + %if %1==1 + add ebx, ebx + jnz %%gotbit + %endif + mov ebx, [esi] + sub esi, byte -4 + adc ebx, ebx +%%gotbit: +%endmacro +%undef getbit +%define getbit getbit_n2b + + +%ifdef __N2BSMA10__ + jmps dcl1_n2b +decompr_literals_n2b: + movsb +%else; __N2BFAS10__ + jmps dcl1_n2b + align 8 +; __N2BFAS11__ +decompr_literalb_n2b: + mov al, [esi] + inc esi + mov [edi], al + inc edi +%endif; __N2BDEC10__ + + +decompr_loop_n2b: + add ebx, ebx + jnz dcl2_n2b +dcl1_n2b: + getbit 32 +dcl2_n2b: +%ifdef __N2BSMA20__ + jc decompr_literals_n2b + xor eax, eax + inc eax +%else; __N2BFAS20__ + %ifndef UPX102 + mov al, [edi] ;; force data cache allocate (PentiumPlain or MMX) + %endif + jc decompr_literalb_n2b + mov eax, 1 +%endif; __N2BDEC20__ +loop1_n2b: + getbit 1 + adc eax, eax +%ifdef __N2BSMA30__ + getbit 1 + jnc loop1_n2b +%else; __N2BFAS30__ + add ebx, ebx + jnc loop1_n2b + jnz loopend1_n2b + getbit 32 + jnc loop1_n2b +loopend1_n2b: +%endif; __N2BDEC30__ + xor ecx, ecx + sub eax, byte 3 + jb decompr_ebpeax_n2b + shl eax, 8 + mov al, [esi] + inc esi + xor eax, byte -1 + jz 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 +%ifdef __N2BSMA40__ + getbit 1 + jnc loop2_n2b +%else; __N2BFAS40__ + add ebx, ebx + jnc loop2_n2b + jnz loopend2_n2b + getbit 32 + jnc loop2_n2b +loopend2_n2b: +%endif; __N2BDUMM1__ +%ifdef __N2BSMA50__ + inc ecx + inc ecx +%else; __N2BFAS50__ + add ecx, byte 2 +%endif; __N2BDEC50__ +decompr_got_mlen_n2b: + cmp ebp, -0xd00 + adc ecx, byte 1 +%ifdef __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 + jmpn decompr_loop_n2b +%else; __N2BFAS60__ + lea edx, [edi+ebp] + cmp ebp, byte -4 + %ifndef UPX102 + mov al, [edi+ecx] ;; force data cache allocate (PentiumPlain or MMX) + %endif + jbe decompr_copy4_n2b +loop3_n2b: + mov al, [edx] + inc edx + mov [edi], al + inc edi + dec ecx + jnz loop3_n2b + jmpn decompr_loop_n2b +; __N2BFAS61__ + align 4 +decompr_copy4_n2b: + mov eax, [edx] + add edx, byte 4 + mov [edi], eax + add edi, byte 4 + sub ecx, byte 4 + ja decompr_copy4_n2b + add edi, ecx + jmpn decompr_loop_n2b +%endif; __N2BDEC60__ +decompr_end_n2b: +; __NRV2BEND__ + +; vi:ts=8:et + diff --git a/src/stub/src/arch/i386/nrv2d_d32.ash b/src/stub/src/arch/i386/nrv2d_d32.ash new file mode 100644 index 00000000..663d20a1 --- /dev/null +++ b/src/stub/src/arch/i386/nrv2d_d32.ash @@ -0,0 +1,206 @@ +; n2d_d32.ash -- ucl_nrv2d_decompress_le32 in 32-bit assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; Input: +; esi - source +; edi - dest +; ebp - -1 +; cld + +; Output: +; eax - 0 +; ecx - 0 + + + %ifndef jmps + %define jmps jmp short + %endif + %ifndef jmpn + %define jmpn jmp near + %endif + + CPU 386 + + +%macro getbit_n2d 1 + %if %1==1 + add ebx, ebx + jnz %%gotbit + %endif + mov ebx, [esi] + sub esi, byte -4 + adc ebx, ebx +%%gotbit: +%endmacro +%undef getbit +%define getbit getbit_n2d + + +%ifdef __N2DSMA10__ + jmps dcl1_n2d +decompr_literals_n2d: + movsb +%else; __N2DFAS10__ + jmps dcl1_n2d + align 8 +; __N2DFAS11__ +decompr_literalb_n2d: + mov al, [esi] + inc esi + mov [edi], al + inc edi +%endif; __N2DDEC10__ + + +decompr_loop_n2d: + add ebx, ebx + jnz dcl2_n2d +dcl1_n2d: + getbit 32 +dcl2_n2d: +%ifdef __N2DSMA20__ + jc decompr_literals_n2d + xor eax, eax + inc eax +%else; __N2DFAS20__ + %ifndef UPX102 + mov al, [edi] ;; force data cache allocate (PentiumPlain or MMX) + %endif + jc decompr_literalb_n2d + mov eax, 1 +%endif; __N2DDEC20__ +loop1_n2d: + getbit 1 + adc eax, eax +%ifdef __N2DSMA30__ + getbit 1 + jc loopend1_n2d +%else; __N2DFAS30__ + add ebx, ebx + jnc loopcontinue1_n2d + jnz loopend1_n2d + getbit 32 + jc loopend1_n2d +loopcontinue1_n2d: +%endif; __N2DDEC30__ + dec eax + getbit 1 + adc eax, eax + jmps loop1_n2d +loopend1_n2d: + xor ecx, ecx + sub eax, byte 3 + jb decompr_prev_dist_n2d + shl eax, 8 + mov al, [esi] + inc esi + xor eax, byte -1 + jz decompr_end_n2d + sar eax, 1 ; shift low-bit into carry + mov ebp, eax + jmps decompr_ebpeax_n2d +decompr_prev_dist_n2d: + getbit 1 +decompr_ebpeax_n2d: + adc ecx, ecx + getbit 1 + adc ecx, ecx + jnz decompr_got_mlen_n2d + inc ecx +loop2_n2d: + getbit 1 + adc ecx, ecx +%ifdef __N2DSMA40__ + getbit 1 + jnc loop2_n2d +%else; __N2DFAS40__ + add ebx, ebx + jnc loop2_n2d + jnz loopend2_n2d + getbit 32 + jnc loop2_n2d +loopend2_n2d: +%endif; __N2DDUMM1__ +%ifdef __N2DSMA50__ + inc ecx + inc ecx +%else; __N2DFAS50__ + add ecx, byte 2 +%endif; __N2DDEC50__ +decompr_got_mlen_n2d: + cmp ebp, -0x500 + adc ecx, byte 1 +%ifdef __N2DSMA60__ + %ifndef UPX102 + push esi + %else + mov edx, esi + %endif + lea esi, [edi+ebp] + rep + movsb + %ifndef UPX102 + pop esi + %else + mov esi, edx + %endif + jmpn decompr_loop_n2d +%else; __N2DFAS60__ + lea edx, [edi+ebp] + cmp ebp, byte -4 + %ifndef UPX102 + mov al, [edi+ecx] ;; force data cache allocate (PentiumPlain or MMX) + %endif + jbe decompr_copy4_n2d +loop3_n2d: + mov al, [edx] + inc edx + mov [edi], al + inc edi + dec ecx + jnz loop3_n2d + jmpn decompr_loop_n2d +; __N2DFAS61__ + align 4 +decompr_copy4_n2d: + mov eax, [edx] + add edx, byte 4 + mov [edi], eax + add edi, byte 4 + sub ecx, byte 4 + ja decompr_copy4_n2d + add edi, ecx + jmpn decompr_loop_n2d +%endif; __N2DDEC60__ +decompr_end_n2d: +; __NRV2DEND__ + +; vi:ts=8:et + diff --git a/src/stub/src/arch/i386/nrv2e_d32.ash b/src/stub/src/arch/i386/nrv2e_d32.ash new file mode 100644 index 00000000..8521e867 --- /dev/null +++ b/src/stub/src/arch/i386/nrv2e_d32.ash @@ -0,0 +1,211 @@ +; n2e_d32.ash -- ucl_nrv2e_decompress_le32 in 32-bit assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; Input: +; esi - source +; edi - dest +; ebp - -1 +; cld + +; Output: +; eax - 0 +; ecx - 0 + + + %ifndef jmps + %define jmps jmp short + %endif + %ifndef jmpn + %define jmpn jmp near + %endif + + CPU 386 + + +%macro getbit_n2e 1 + %if %1==1 + add ebx, ebx + jnz %%gotbit + %endif + mov ebx, [esi] + sub esi, byte -4 + adc ebx, ebx +%%gotbit: +%endmacro +%undef getbit +%define getbit getbit_n2e + + +%ifdef __N2ESMA10__ + jmps dcl1_n2e +decompr_literals_n2e: + movsb +%else; __N2EFAS10__ + jmps dcl1_n2e + align 8 +; __N2EFAS11__ +decompr_literalb_n2e: + mov al, [esi] + inc esi + mov [edi], al + inc edi +%endif; __N2EDEC10__ + + +decompr_loop_n2e: + add ebx, ebx + jnz dcl2_n2e +dcl1_n2e: + getbit 32 +dcl2_n2e: +%ifdef __N2ESMA20__ + jc decompr_literals_n2e + xor eax, eax + inc eax +%else; __N2EFAS20__ + %ifndef UPX102 + mov al, [edi] ;; force data cache allocate (PentiumPlain or MMX) + %endif + jc decompr_literalb_n2e + mov eax, 1 +%endif; __N2EDEC20__ +loop1_n2e: + getbit 1 + adc eax, eax +%ifdef __N2ESMA30__ + getbit 1 + jc loopend1_n2e +%else; __N2EFAS30__ + add ebx, ebx + jnc loopcontinue1_n2e + jnz loopend1_n2e + getbit 32 + jc loopend1_n2e +loopcontinue1_n2e: +%endif; __N2EDEC30__ + dec eax + getbit 1 + adc eax, eax + jmps loop1_n2e + +decompr_mlen1_n2e: + getbit 1 + adc ecx, ecx + jmps decompr_got_mlen_n2e + +loopend1_n2e: + xor ecx, ecx + sub eax, byte 3 + jb decompr_prev_dist_n2e + shl eax, 8 + mov al, [esi] + inc esi + xor eax, byte -1 + jz decompr_end_n2e + sar eax, 1 ; shift low-bit into carry + mov ebp, eax + jmps decompr_ebpeax_n2e +decompr_prev_dist_n2e: + getbit 1 +decompr_ebpeax_n2e: + jc decompr_mlen1_n2e + inc ecx + getbit 1 + jc decompr_mlen1_n2e +loop2_n2e: + getbit 1 + adc ecx, ecx +%ifdef __N2ESMA40__ + getbit 1 + jnc loop2_n2e +%else; __N2EFAS40__ + add ebx, ebx + jnc loop2_n2e + jnz loopend2_n2e + getbit 32 + jnc loop2_n2e +loopend2_n2e: +%endif; __N2EDUMM1__ +%ifdef __N2ESMA50__ + inc ecx + inc ecx +%else; __N2EFAS50__ + add ecx, byte 2 +%endif; __N2EDEC50__ +decompr_got_mlen_n2e: + cmp ebp, -0x500 + adc ecx, byte 2 +%ifdef __N2ESMA60__ + %ifndef UPX102 + push esi + %else + mov edx, esi + %endif + lea esi, [edi+ebp] + rep + movsb + %ifndef UPX102 + pop esi + %else + mov esi, edx + %endif + jmpn decompr_loop_n2e +%else; __N2EFAS60__ + lea edx, [edi+ebp] + cmp ebp, byte -4 + %ifndef UPX102 + mov al, [edi+ecx] ;; force data cache allocate (PentiumPlain or MMX) + %endif + jbe decompr_copy4_n2e +loop3_n2e: + mov al, [edx] + inc edx + mov [edi], al + inc edi + dec ecx + jnz loop3_n2e + jmpn decompr_loop_n2e +; __N2EFAS61__ + align 4 +decompr_copy4_n2e: + mov eax, [edx] + add edx, byte 4 + mov [edi], eax + add edi, byte 4 + sub ecx, byte 4 + ja decompr_copy4_n2e + add edi, ecx + jmpn decompr_loop_n2e +%endif; __N2EDEC60__ +decompr_end_n2e: +; __NRV2EEND__ + +; vi:ts=8:et + diff --git a/src/stub/src/arch/i386/upx_itoa.ash b/src/stub/src/arch/i386/upx_itoa.ash new file mode 100644 index 00000000..ae91e87b --- /dev/null +++ b/src/stub/src/arch/i386/upx_itoa.ash @@ -0,0 +1,58 @@ +; upx_itoa.asm -- decimal print; smaller than gcc, and no relocations +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 2002-2004 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. +; +; John F. Reiser +; +; + + + BITS 32 + SECTION .text + CPU 386 + GLOBAL upx_itoa + +upx_itoa: ; char *upx_itoa(eax= unsigned v, edx= char *buf) /* 0<=(int)v */ + push edi ; save register + mov edi,edx ; output ptr + push byte 10 + cld + pop ecx ; radix + call recur + mov [edi],ah ; NUL terminate + xchg eax,edi ; eax= continuation point + pop edi ; restore register + ret +recur: + cdq ; zero extend eax into edx [use "sub edx,edx" if eax < 0 ] + div ecx ; eax=quo, edx=rem; flags are undefined + push edx + test eax,eax + je quo0 + call recur +quo0: + pop eax ; remainder + add al, byte '0' + stosb + ret + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/arch/m68k/Makefile b/src/stub/src/arch/m68k/Makefile new file mode 100644 index 00000000..413a5328 --- /dev/null +++ b/src/stub/src/arch/m68k/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../.. $@ diff --git a/src/stub/src/arch/m68k/app-a68k.pl b/src/stub/src/arch/m68k/app-a68k.pl new file mode 100644 index 00000000..161e1a8c --- /dev/null +++ b/src/stub/src/arch/m68k/app-a68k.pl @@ -0,0 +1,155 @@ +#! /usr/bin/perl -w +# +# app_m68k.pl -- assembly preprocessor for upx +# +# This file is part of the UPX executable compressor. +# +# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 1996-2006 Laszlo Molnar +# 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 +# +# + +# +# usage: app_m68k.pl infile outfile +# + +$in = shift || die; +$ou = shift || die; + +open (IN,"<$in") or die; +open (OU,">$ou") or die; +binmode IN; +binmode OU; + +@lines = ; + +%labels = (); +$i = 0; +$cs = ""; + +($ilabel = $in) =~ s,^.*[\/\\],,; # get basename +$ilabel =~ s/\W//g; + +# 1st pass +for $line (@lines) +{ + $labels{$1} = "$cs" if ($line =~ /^(\w+):/ && $cs); + if ($line =~ /__([A-Z0-9]{8})__/) { + $cs = $1; + # verify the line + if ($line =~ /^[\%\;]ifdef/) { + # ok + } elsif ($line =~ /^([\%\;]\w+)?\s*;/) { + # ok + } else { + print STDERR "$in:$i:warning 1:$line" + } + } + + if ($line =~ /^[\%\;](if|el|endi)/) + { + if ($line =~ /__([A-Z0-9]{8})__/) + { + $line=";$line" unless ($line =~ /^\;/); + } + else + { + print STDERR "$in:$i:warning 2:$line"; + } + } + $line =~ s/\.ash/\.asy/ if ($line =~ /^\s*\%include/); + $i++; +} + +$cs = ""; +$i = 0; + +@data = (); + +# 2nd pass +for $line (@lines) +{ + last if ($line =~ /^\s*end\b/i); + + if ($line =~ /^\s+(b[\w\.]+|db[\w\.]+)\s+(\w*)/) + { + $label = $2; + ##print STDERR "$label $cs\n"; # debug + if (defined $labels{$label}) + { + $ts = $labels{$label}; + if ($ts ne $cs) + { + $line =~ s/$label/J$i$ilabel/; + print OU $line; + print OU "J$i$ilabel:\n"; + $d = "dc.l\t0, J$i$ilabel"; + push(@data, $d); + $d = "dc.b\t'$ts'"; + push(@data, $d); + $d = "dc.l\t$label - S$ts$ilabel"; + push(@data, $d); + $line = ""; + } + } + } + + $line = ";$line" if ($line =~ /^\s+align\b/i); + $line = ";$line" if ($line =~ /^\s+even\b/i); + + if ($line =~ /^;*\s+print_data\b/i) { + &print_data(); + } else { + print OU $line; + } + + if ($line =~ /__([A-Z0-9]{8})__/) + { + print OU "S$1$ilabel:\n"; + $cs = $1; + $d = "dc.b\t'$1'"; + push(@data, $d); + $d = "dc.l\tS$1$ilabel"; + push(@data, $d); + } + $i++; +} + +&print_data(); +print OU "\t\tend\n"; +exit(0); + + +# /*********************************************************************** +# // +# ************************************************************************/ + +sub print_data { + return if ($#data < 0); + ###print OU "\n\n\t\tsection_data\n"; + local ($d); + for $d (@data) { + print OU "\t\t$d\n"; + } + @data = (); +} + +# vi:ts=4:et diff --git a/src/stub/src/arch/m68k/bits.ash b/src/stub/src/arch/m68k/bits.ash new file mode 100644 index 00000000..8ef6733d --- /dev/null +++ b/src/stub/src/arch/m68k/bits.ash @@ -0,0 +1,165 @@ +; bits.ash -- bit access for decompression +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- ADDBITS ------------- + +macro(ADDBITS) +#if (NRV_BB == 8) + add.b d0,d0 ; sets Z, C and X ; 4 +#elif (NRV_BB == 32) + add.l d0,d0 ; sets Z, C and X ; 6 +#endif + endm + + +#if 0 +macro(ADDXBITS) +#if (NRV_BB == 8) + addx.b d0,d0 ; sets C and X ; 4 +#elif (NRV_BB == 32) + addx.l d0,d0 ; sets C and X ; 8 +#endif + endm +#endif + + +; ------------- FILLBYTES_xx ------------- + +; get 1 byte; then get 1 bit into both C and X +macro(FILLBYTES_8) + ; note: we shift the X flag through -> must init d0.b with $80 + move.b (a0)+,d0 ; 8 + addx.b d0,d0 ; sets C and X ; 4 + endm + + +; get 32 bits in little endian format; then get 1 bit into both C and X +macro(FILLBYTES_LE32) +#if 0 + move.b (a0)+,d0 ; 8 + ror.l #8,d0 ; 24 + move.b (a0)+,d0 ; 8 + ror.l #8,d0 ; 24 + move.b (a0)+,d0 ; 8 + ror.l #8,d0 ; 24 + move.b (a0)+,d0 ; 8 + ror.l #8,d0 ; 24 + add.l d0,d0 ; sets C and X ; 6 + bset #0,d0 ; only changes Z ; 12 + ; ----- + ; 146 +#elif 1 + move.b 3(a0),d0 ; 12 + lsl.w #8,d0 ; 22 + move.b 2(a0),d0 ; 12 + swap d0 ; 4 + move.b 1(a0),d0 ; 12 + lsl.w #8,d0 ; 22 + move.b (a0),d0 ; 8 + addq.l #4,a0 ; does not affect flags ; 8 + add.l d0,d0 ; sets C and X ; 6 + bset #0,d0 ; only changes Z ; 12 + ; ----- + ; 118 +#elif 1 + ; note: we shift the X flag through -> must init d0.l with $80000000 + ; note: rol/ror do not change X flag (but asl/asr/lsl/lsr do) + move.b 3(a0),d0 ; 12 + ror.w #8,d0 ; 22 + move.b 2(a0),d0 ; 12 + swap d0 ; 4 + move.b 1(a0),d0 ; 12 + ror.w #8,d0 ; 22 + move.b (a0),d0 ; 8 + addq.l #4,a0 ; does not affect flags ; 8 + addx.l d0,d0 ; sets C and X ; 8 + ; ----- + ; 108 +#else + ; IMPORTANT: movep is not implemented on the 68060 +# error "do not use movep" + ; note: we shift the X flag through -> must init d0.l with $80000000 + ; note: must use dc.l because of a bug in the pasm assembler + ; note: may access past the end of the input; this is ok for UPX + dc.l $01080003 ; movep.w 3(a0),d0 ; 16 + move.b 2(a0),d0 ; 12 + swap d0 ; 4 + dc.l $01080001 ; movep.w 1(a0),d0 ; 16 + move.b (a0),d0 ; 8 + addq.l #4,a0 ; does not affect flags ; 8 + addx.l d0,d0 ; sets C and X ; 8 + ; ----- + ; 72 +#endif + endm + + +; ------------- FILLBITS ------------- + +macro(FILLBITS) +#if (NRV_BB == 8) + ; no need for a subroutine + FILLBYTES_8 +#elif (NRV_BB == 32) +# ifdef SMALL +# define FILLBYTES_SR FILLBYTES_LE32 + bsr fillbytes_sr ; 18 +# else + FILLBYTES_LE32 +# endif +#endif + endm + + +; ------------- GETBIT ------------- + +; get one bit into both the Carry and eXtended flag +macro(GETBIT) +#if defined(__A68K__) + ADDBITS ; 4 / 6 + bne \@ ; 10 (if jump) + FILLBITS +\@: +#elif defined(__ASL__) + ADDBITS ; 4 / 6 + bne done ; 10 (if jump) + FILLBITS +done: +#else +LOCAL done + ADDBITS ; 4 / 6 + bne done ; 10 (if jump) + FILLBITS +done: +#endif + endm + + + +; vi:ts=8:et + diff --git a/src/stub/src/arch/m68k/nrv2b_d.ash b/src/stub/src/arch/m68k/nrv2b_d.ash new file mode 100644 index 00000000..633750d1 --- /dev/null +++ b/src/stub/src/arch/m68k/nrv2b_d.ash @@ -0,0 +1,227 @@ +; n2b_d.ash -- NRV2B decompression in 68000 assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; decompress from a0 to a1 +; note: must preserve d4 and a5-a7 + +; +; On entry: +; a0 src pointer +; a1 dest pointer +; +; On exit: +; d1.l = 0 +; d2.l = 0 +; +; Register usage: +; a3 m_pos +; +; d0 bit buffer +; d1 m_off +; d2 m_len +; d5 last_m_off +; +; d6 constant: -$d00 +; d7 constant: -1 +; +; +; Notes: +; we have max_match = 65535, so we can use word arithmetics on d2 +; + + +; ------------- constants & macros ------------- + +#if !defined(NRV_NO_INIT) + + ;;move.l #-$d00,d6 ; 0xfffff300 + moveq.l #-$68,d6 ; 0xffffff98 + lsl.w #5,d6 ; << 5 + + moveq.l #-1,d7 + moveq.l #-1,d5 ; last_off = -1 + + ; init d0 with high bit set +#if (NRV_BB == 8) + ;;move.b #$80,d0 ; init d0.b for FILLBYTES + moveq.l #-128,d0 ; d0.b = $80 +#elif (NRV_BB == 32) + ;;move.l #$80000000,d0 ; init d0.l for FILLBYTES + moveq.l #1,d0 + ror.l #1,d0 ; d0.l = $80000000 +#endif + bra decompr_start + +#endif + + +#include "bits.ash" + + +#if defined(FILLBYTES_SR) +fillbytes_sr: FILLBYTES_SR + rts ; 16 +#endif + + + +; ------------- DECOMPRESSION ------------- + + +decompr_literal: + move.b (a0)+,(a1)+ + +decompr_start: +decompr_loop: +#ifdef SMALL + ; cost literal: 4 + 10 + 10 + ; cost match: 4 + 10 + 8 + ; cost fillbits: 4 + 8 + GETBIT + bcs decompr_literal +#else + ; optimization: carry is clear -> we know that bits are available + ; cost literal: 4 + 8 + 10 + ; cost match: 4 + 10 + ; cost fillbits: 4 + 8 + 8 + ADDBITS + bcc decompr_match + bne decompr_literal + FILLBITS + bcs decompr_literal +#endif + + + +decompr_match: + moveq.l #1,d1 + moveq.l #0,d2 +decompr_l1: + GETBIT + addx.l d1,d1 +#ifdef SMALL + ; cost loop continue: 4 + 10 + 10 + ; cost loop break: 4 + 10 + 8 + ; cost fillbits: 4 + 8 + GETBIT + bcc decompr_l1 +#else + ; optimization: carry is clear -> we know that bits are available + ; cost loop continue: 4 + 10 + ; cost loop break: 4 + 8 + 10 + ; cost fillbits: 4 + 8 + 8 + ADDBITS + bcc decompr_l1 + bne L(break) + FILLBITS + bcc decompr_l1 +L(break): +#endif + subq.l #3,d1 + bcs decompr_get_mlen ; last m_off + lsl.l #8,d1 + move.b (a0)+,d1 + not.l d1 + beq decompr_end + move.l d1,d5 + + + +decompr_get_mlen: + GETBIT + addx.w d2,d2 + GETBIT + addx.w d2,d2 + tst.w d2 ; addx doesn't set the Z flag... + bne decompr_got_mlen + addq.w #1,d2 + +decompr_l2: GETBIT + addx.w d2,d2 +#ifdef SMALL + ; cost loop continue: 4 + 10 + 10 + ; cost loop break: 4 + 10 + 8 + ; cost fillbits: 4 + 8 + GETBIT + bcc decompr_l2 +#else + ; optimization: carry is clear -> we know that bits are available + ; cost loop continue: 4 + 10 + ; cost loop break: 4 + 8 + 10 + ; cost fillbits: 4 + 8 + 8 + ADDBITS + bcc decompr_l2 + bne L(break) + FILLBITS + bcc decompr_l2 +L(break): +#endif + addq.w #2,d2 + + + +decompr_got_mlen: + lea 0(a1,d5.l),a3 + + ; must use sub as cmp doesn't affect the X flag + move.l d5,d1 + sub.l d6,d1 + addx.w d7,d2 + +; TODO: partly unroll this loop; could use some magic with d7 for address +; computations, then compute a nice `jmp yyy(pc,dx.w)' + +#if 1 + ; cost for any m_len: 12 + 22 * (m_len - 1) + 4 + ; 38, 60, 82, 104, 126, 148, 170, 192, 214, 236 + move.b (a3)+,(a1)+ ; 12 +L(copy): move.b (a3)+,(a1)+ ; 12 + dbra d2,L(copy) ; 10 / 14 +#else + ; cost for even m_len: 18 + 34 * (m_len / 2) + 4 + ; cost for odd m_len: 28 + 34 * (m_len / 2) + 4 + ; 56, 66, 90, 100, 124, 134, 158, 168, 192, 202 + lsr.w #1,d2 ; 8 + bcc L(copy) ; 10 / 8 + move.b (a3)+,(a1)+ ; 12 +L(copy): move.b (a3)+,(a1)+ ; 12 + move.b (a3)+,(a1)+ ; 12 + dbra d2,L(copy) ; 10 / 14 +#endif + + bra decompr_loop + + + +decompr_end: + + +; vi:ts=8:et + diff --git a/src/stub/src/arch/m68k/nrv2d_d.ash b/src/stub/src/arch/m68k/nrv2d_d.ash new file mode 100644 index 00000000..526b916d --- /dev/null +++ b/src/stub/src/arch/m68k/nrv2d_d.ash @@ -0,0 +1,235 @@ +; n2d_d.ash -- NRV2D decompression in 68000 assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; decompress from a0 to a1 +; note: must preserve d4 and a5-a7 + +; +; On entry: +; a0 src pointer +; a1 dest pointer +; +; On exit: +; d1.l = 0x00008000 +; d2.l = 0 +; +; Register usage: +; a3 m_pos +; +; d0 bit buffer +; d1 m_off +; d2 m_len +; d5 last_m_off +; +; d6 constant: -$500 +; d7 constant: -1 +; +; +; Notes: +; we have max_match = 65535, so we can use word arithmetics on d2 +; we have max_offset < 2**23, so we can use partial word arithmetics on d1 +; + + +; ------------- constants & macros ------------- + +#if !defined(NRV_NO_INIT) + + ;;move.l #-$500,d6 ; 0xfffffb00 + moveq.l #-$50,d6 ; 0xffffffb0 + lsl.w #4,d6 ; << 4 + + moveq.l #-1,d7 + moveq.l #-1,d5 ; last_off = -1 + + ; init d0 with high bit set +#if (NRV_BB == 8) + ;;move.b #$80,d0 ; init d0.b for FILLBYTES + moveq.l #-128,d0 ; d0.b = $80 +#elif (NRV_BB == 32) + ;;move.l #$80000000,d0 ; init d0.l for FILLBYTES + moveq.l #1,d0 + ror.l #1,d0 ; d0.l = $80000000 +#endif + bra decompr_start + +#endif + + +#include "bits.ash" + + +#if defined(FILLBYTES_SR) +fillbytes_sr: FILLBYTES_SR + rts ; 16 +#endif + + + +; ------------- DECOMPRESSION ------------- + + +decompr_literal: + move.b (a0)+,(a1)+ + +decompr_start: +decompr_loop: +#ifdef SMALL + ; cost literal: 4 + 10 + 10 + ; cost match: 4 + 10 + 8 + ; cost fillbits: 4 + 8 + GETBIT + bcs decompr_literal +#else + ; optimization: carry is clear -> we know that bits are available + ; cost literal: 4 + 8 + 10 + ; cost match: 4 + 10 + ; cost fillbits: 4 + 8 + 8 + ADDBITS + bcc decompr_match + bne decompr_literal + FILLBITS + bcs decompr_literal +#endif + + + +decompr_match: + moveq.l #1,d1 + moveq.l #0,d2 +decompr_l1: + GETBIT + addx.w d1,d1 +#ifdef SMALL + ; cost loop continue: 4 + 10 + 8 + ; cost loop break: 4 + 10 + 10 + ; cost fillbits: 4 + 8 + GETBIT + bcs decompr_break1 +#else + ; optimization: carry is clear -> we know that bits are available + ; cost loop continue: 4 + 10 + ; cost loop break: 4 + 8 + 10 + ; cost fillbits: 4 + 8 + 8 + ADDBITS + bcc L(continue) + bne decompr_break1 + FILLBITS + bcs decompr_break1 +L(continue): +#endif + subq.w #1,d1 + GETBIT + addx.w d1,d1 + bpl decompr_l1 + bra decompr_end +decompr_break1: + subq.w #3,d1 + bcs decompr_prev_dist ; last m_off + lsl.l #8,d1 + move.b (a0)+,d1 + not.l d1 + asr.l #1,d1 + move.l d1,d5 + bra decompr_get_mlen + + +decompr_prev_dist: + GETBIT +decompr_get_mlen: + addx.w d2,d2 + GETBIT + addx.w d2,d2 + tst.w d2 ; addx doesn't set the Z flag... + bne decompr_got_mlen + addq.w #1,d2 + +decompr_l2: GETBIT + addx.w d2,d2 +#ifdef SMALL + ; cost loop continue: 4 + 10 + 10 + ; cost loop break: 4 + 10 + 8 + ; cost fillbits: 4 + 8 + GETBIT + bcc decompr_l2 +#else + ; optimization: carry is clear -> we know that bits are available + ; cost loop continue: 4 + 10 + ; cost loop break: 4 + 8 + 10 + ; cost fillbits: 4 + 8 + 8 + ADDBITS + bcc decompr_l2 + bne L(break) + FILLBITS + bcc decompr_l2 +L(break): +#endif + addq.w #2,d2 + + + +decompr_got_mlen: + lea 0(a1,d5.l),a3 + + ; must use sub as cmp doesn't affect the X flag + move.l d5,d1 + sub.l d6,d1 + addx.w d7,d2 + +; TODO: partly unroll this loop; could use some magic with d7 for address +; computations, then compute a nice `jmp yyy(pc,dx.w)' + +#if 1 + ; cost for any m_len: 12 + 22 * (m_len - 1) + 4 + ; 38, 60, 82, 104, 126, 148, 170, 192, 214, 236 + move.b (a3)+,(a1)+ ; 12 +L(copy): move.b (a3)+,(a1)+ ; 12 + dbra d2,L(copy) ; 10 / 14 +#else + ; cost for even m_len: 18 + 34 * (m_len / 2) + 4 + ; cost for odd m_len: 28 + 34 * (m_len / 2) + 4 + ; 56, 66, 90, 100, 124, 134, 158, 168, 192, 202 + lsr.w #1,d2 ; 8 + bcc L(copy) ; 10 / 8 + move.b (a3)+,(a1)+ ; 12 +L(copy): move.b (a3)+,(a1)+ ; 12 + move.b (a3)+,(a1)+ ; 12 + dbra d2,L(copy) ; 10 / 14 +#endif + + bra decompr_loop + + + +decompr_end: + + +; vi:ts=8:et + diff --git a/src/stub/src/arch/m68k/nrv2e_d.ash b/src/stub/src/arch/m68k/nrv2e_d.ash new file mode 100644 index 00000000..bd214b87 --- /dev/null +++ b/src/stub/src/arch/m68k/nrv2e_d.ash @@ -0,0 +1,236 @@ +; n2e_d.ash -- NRV2E decompression in 68000 assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 +; +; http://www.oberhumer.com/opensource/ucl/ +; + + +; ------------- DECOMPRESSION ------------- + +; decompress from a0 to a1 +; note: must preserve d4 and a5-a7 + +; +; On entry: +; a0 src pointer +; a1 dest pointer +; +; On exit: +; d1.l = 0x00008000 +; d2.l = 0 +; +; Register usage: +; a3 m_pos +; +; d0 bit buffer +; d1 m_off +; d2 m_len +; d5 last_m_off +; +; d6 constant: -$500 +; d7 constant: 0 +; +; +; Notes: +; we have max_match = 65535, so we can use word arithmetics on d2 +; we have max_offset < 2**23, so we can use partial word arithmetics on d1 +; + + +; ------------- constants & macros ------------- + +#if !defined(NRV_NO_INIT) + + ;;move.l #-$500,d6 ; 0xfffffb00 + moveq.l #-$50,d6 ; 0xffffffb0 + lsl.w #4,d6 ; << 4 + + moveq.l #0,d7 + moveq.l #-1,d5 ; last_off = -1 + + ; init d0 with high bit set +#if (NRV_BB == 8) + ;;move.b #$80,d0 ; init d0.b for FILLBYTES + moveq.l #-128,d0 ; d0.b = $80 +#elif (NRV_BB == 32) + ;;move.l #$80000000,d0 ; init d0.l for FILLBYTES + moveq.l #1,d0 + ror.l #1,d0 ; d0.l = $80000000 +#endif + bra decompr_start + +#endif + + +#include "bits.ash" + + +#if defined(FILLBYTES_SR) +fillbytes_sr: FILLBYTES_SR + rts ; 16 +#endif + + + +; ------------- DECOMPRESSION ------------- + + +decompr_literal: + move.b (a0)+,(a1)+ + +decompr_start: +decompr_loop: +#ifdef SMALL + ; cost literal: 4 + 10 + 10 + ; cost match: 4 + 10 + 8 + ; cost fillbits: 4 + 8 + GETBIT + bcs decompr_literal +#else + ; optimization: carry is clear -> we know that bits are available + ; cost literal: 4 + 8 + 10 + ; cost match: 4 + 10 + ; cost fillbits: 4 + 8 + 8 + ADDBITS + bcc decompr_match + bne decompr_literal + FILLBITS + bcs decompr_literal +#endif + + + +decompr_match: + moveq.l #1,d1 + moveq.l #0,d2 +decompr_l1: + GETBIT + addx.w d1,d1 +#ifdef SMALL + ; cost loop continue: 4 + 10 + 8 + ; cost loop break: 4 + 10 + 10 + ; cost fillbits: 4 + 8 + GETBIT + bcs decompr_break1 +#else + ; optimization: carry is clear -> we know that bits are available + ; cost loop continue: 4 + 10 + ; cost loop break: 4 + 8 + 10 + ; cost fillbits: 4 + 8 + 8 + ADDBITS + bcc L(continue) + bne decompr_break1 + FILLBITS + bcs decompr_break1 +L(continue): +#endif + subq.w #1,d1 + GETBIT + addx.w d1,d1 + bpl decompr_l1 + bra decompr_end +decompr_break1: + subq.w #3,d1 + bcs decompr_prev_dist ; last m_off + lsl.l #8,d1 + move.b (a0)+,d1 + not.l d1 + asr.l #1,d1 + bcc decompr_get_mlen2 + +decompr_get_mlen1: + GETBIT + addx.w d2,d2 + bra decompr_got_mlen +decompr_prev_dist: + move.l d5,d1 + GETBIT + bcs decompr_get_mlen1 +decompr_get_mlen2: + addq.w #1,d2 + GETBIT + bcs decompr_get_mlen1 + +decompr_l2: GETBIT + addx.w d2,d2 +#ifdef SMALL + ; cost loop continue: 4 + 10 + 10 + ; cost loop break: 4 + 10 + 8 + ; cost fillbits: 4 + 8 + GETBIT + bcc decompr_l2 +#else + ; optimization: carry is clear -> we know that bits are available + ; cost loop continue: 4 + 10 + ; cost loop break: 4 + 8 + 10 + ; cost fillbits: 4 + 8 + 8 + ADDBITS + bcc decompr_l2 + bne L(break) + FILLBITS + bcc decompr_l2 +L(break): +#endif + addq.w #2,d2 + + + +decompr_got_mlen: + move.l d1,d5 + lea 0(a1,d1.l),a3 + + ; must use sub as cmp doesn't affect the X flag + sub.l d6,d1 + addx.w d7,d2 + +; TODO: partly unroll this loop; could use some magic with d7 for address +; computations, then compute a nice `jmp yyy(pc,dx.w)' + +#if 1 + ; cost for any m_len: 12 + 22 * (m_len - 1) + 4 + ; 38, 60, 82, 104, 126, 148, 170, 192, 214, 236 + move.b (a3)+,(a1)+ ; 12 +L(copy): move.b (a3)+,(a1)+ ; 12 + dbra d2,L(copy) ; 10 / 14 +#else + ; cost for even m_len: 18 + 34 * (m_len / 2) + 4 + ; cost for odd m_len: 28 + 34 * (m_len / 2) + 4 + ; 56, 66, 90, 100, 124, 134, 158, 168, 192, 202 + lsr.w #1,d2 ; 8 + bcc L(copy) ; 10 / 8 + move.b (a3)+,(a1)+ ; 12 +L(copy): move.b (a3)+,(a1)+ ; 12 + move.b (a3)+,(a1)+ ; 12 + dbra d2,L(copy) ; 10 / 14 +#endif + + bra decompr_loop + + + +decompr_end: + + +; vi:ts=8:et + diff --git a/src/stub/src/arch/mips/Makefile b/src/stub/src/arch/mips/Makefile new file mode 100644 index 00000000..413a5328 --- /dev/null +++ b/src/stub/src/arch/mips/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../.. $@ diff --git a/src/stub/src/arch/mips/mipsel.r3000/Makefile b/src/stub/src/arch/mips/mipsel.r3000/Makefile new file mode 100644 index 00000000..ff0b0eff --- /dev/null +++ b/src/stub/src/arch/mips/mipsel.r3000/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../../.. $@ diff --git a/src/stub/src/arch/mips/mipsel.r3000/app-asm5900.pl b/src/stub/src/arch/mips/mipsel.r3000/app-asm5900.pl new file mode 100644 index 00000000..dd263926 --- /dev/null +++ b/src/stub/src/arch/mips/mipsel.r3000/app-asm5900.pl @@ -0,0 +1,111 @@ +#! /usr/bin/perl -w +# +# app_mr3k.pl -- assembly preprocessor for upx +# +# This file is part of the UPX executable compressor. +# +# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +# Copyright (C) 1996-2006 Laszlo Molnar +# 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 +# +# + +# +# usage: app_mr3k.pl infile outfile +# + +$in = shift || die; +$ou = shift || die; + +open (IN,"<$in") or die; +open (OU,">$ou") or die; +binmode IN; +binmode OU; + +@lines = ; + +%labels = (); +$i = 0; +$cs = ""; + +($ilabel = $in) =~ s,^.*[\/\\],,; # get basename +$ilabel =~ s/\W//g; + +# 1st pass +for $line (@lines) +{ + $labels{$1} = "$cs" if ($line =~ /^(\w+):/ && $cs); + if ($line =~ /__([A-Z0-9]{8})__/) { + $cs = $1; + # verify the line + if ($line =~ /^[\%\;]ifdef/) { + # ok + } elsif ($line =~ /^([\%\;]\w+)?\s*;/) { + # ok + } else { + print STDERR "$in:$i:warning 1:$line" + } + } + + if ($line =~ /^[\%\;](if|el|endi)/) + { + if ($line =~ /__([A-Z0-9]{8})__/) + { + $line=";$line" unless ($line =~ /^\;/); + } + else + { + print STDERR "$in:$i:warning 2:$line"; + } + } + $line =~ s/\.ash/\.asy/ if ($line =~ /^\s*\%include/); + $i++; +} + +$cs = ""; +$i = 0; +$test = ""; + +# 2nd pass +for $line (@lines) +{ + $line = ";$line" if ($line =~ /^\s+align\s/); + + print OU $line; + + if ($line =~ /__([A-Z0-9]{8})__/) + { + print OU "S$1$ilabel:\n"; + push @{ $test[++$#test] }, "\t\tDB\t\t\"$1\",0\n\t\tDW_UNALIGNED\tS$1$ilabel\n"; + + $cs = $1; + } + $i++; + + if ($line =~ /section .data/) + { + for $i ( 0 .. $#test ) + { + print OU "@{$test[$i]}"; + } + } +} + +# vi:ts=4:et diff --git a/src/stub/src/arch/mips/mipsel.r3000/bits.ash b/src/stub/src/arch/mips/mipsel.r3000/bits.ash new file mode 100644 index 00000000..57bbe310 --- /dev/null +++ b/src/stub/src/arch/mips/mipsel.r3000/bits.ash @@ -0,0 +1,192 @@ +; bits.ash -- bit access for decompression +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 Jens Medoch +; +; http://www.oberhumer.com/opensource/ucl/ +; + +#ifndef _MR3K_STD_CONF_ +#define _MR3K_STD_CONF_ + + +;////////////////////////////////////// +;// register defines +;////////////////////////////////////// + +#define src a0 +#define dst a2 + +#define src_ilen t0 +#define bb t1 +#define ilen t2 +#define last_m_off t3 +#define m_len t4 +#define bc t5 + +#define var v0 +#define m_off v1 +#define m_pos v1 + + +;////////////////////////////////////// +;// optimized branch macros +;////////////////////////////////////// + +beqz2gb MACRO reg,label,nrv_bb + IF (!small) && (nrv_bb == 8) + beqz reg,label+4 + andi var,bb,0x007F + ELSE + beqz reg,label + nop + ENDIF +beqz2gb ENDM + +b2gb MACRO label,nrv_bb + IF (!small) + b label+4 + IF (nrv_bb == 8) + andi var,bb,0x007F + ELSE ;(nrv_bb == 32) + addiu bc,-1 + ENDIF + ELSE + b label + nop + ENDIF +b2gb ENDM + + +;////////////////////////////////////// +;// ucl memcpy +;////////////////////////////////////// + +uclmcpy MACRO retoffset,nrv_bb +# ifdef FAST + slti var,m_off,4 + bnez var,prepbytecpy + addiu m_len,1 + subu m_pos,dst,m_off +wordchk: + slti var,m_len,4 + bnez var,bytecopy+4 + lwr var,0(m_pos) + lwl var,3(m_pos) + addiu m_len,-4 + swr var,0(dst) + swl var,3(dst) + addiu m_pos,4 + bnez m_len,wordchk + addiu dst,4 + b2gb retoffset,nrv_bb +prepbytecpy: +# else + addiu m_len,1 +# endif + subu m_pos,dst,m_off +bytecopy: + lbu var,0(m_pos) + addiu m_len,-1 + sb var,0(dst) + addiu m_pos,1 + bnez m_len,bytecopy + addiu dst,1 + b2gb retoffset,nrv_bb +uclmcpy ENDM + + +;////////////////////////////////////// +;// init decompressor +;////////////////////////////////////// + +init MACRO nrv_bb + move bb,zero + IF (nrv_bb == 32) + move bc,bb + ENDIF + li last_m_off,1 + move src_ilen,src +init ENDM + + +;////////////////////////////////////// +;// 32bit getbit macro +;////////////////////////////////////// + +gbit_le32 MACRO + IF (!small) + addiu bc,-1 + ENDIF + bgez bc,\@z + srlv var,bb,bc + li bc,31 + lwr bb,0(src_ilen) + lwl bb,3(src_ilen) + addiu src_ilen,4 + srlv var,bb,bc +\@z: + IF (small) + jr ra + ENDIF + andi var,0x0001 +gbit_le32 ENDM + + +;////////////////////////////////////// +;// 8bit getbit macro +;////////////////////////////////////// + +gbit_8 MACRO + IF (!small) + andi var,bb,0x007F + ENDIF + bnez var,\@x + sll bb,1 + lbu var,0(src_ilen) + addiu src_ilen,1 + sll var,1 + addiu bb,var,1 +\@x: + srl var,bb,8 + IF (small) + jr ra + ENDIF + andi var,0x0001 +gbit_8 ENDM + + +;////////////////////////////////////// +;// getbit call macro for small version +;////////////////////////////////////// + +gbit_call MACRO subroutine,nrv_bb + bal subroutine + IF (nrv_bb == 8) + andi var,bb,0x007F + ELSE + addiu bc,-1 + ENDIF +gbit_call ENDM + + +#endif //_MR3K_STD_CONF_ diff --git a/src/stub/src/arch/mips/mipsel.r3000/macros.ash b/src/stub/src/arch/mips/mipsel.r3000/macros.ash new file mode 100644 index 00000000..750901de --- /dev/null +++ b/src/stub/src/arch/mips/mipsel.r3000/macros.ash @@ -0,0 +1,52 @@ +; macros.ash -- macros +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 Jens Medoch +; +; http://www.oberhumer.com/opensource/ucl/ +; + +; Load Address macro + +la MACRO reg,addr + lui reg,(addr >> 16)+((addr >> 15)&1) + addiu reg,reg,((addr & 0FFFFh)) +la ENDM + +; Load Immidiate macro + +li MACRO reg,imm +IF (imm == -1) + addiu reg, zero, -1 +ELSE + IF ((imm>>16)!=0) + lui reg,imm >> 16 + ori reg,reg,(imm & 0FFFFh) + ELSE + IF ((imm&0xffff)>0x8000) + ori reg,zero,(imm & 0FFFFh) + ELSE + addiu reg,zero,(imm & 0FFFFh) + ENDIF + ENDIF +ENDIF +li ENDM diff --git a/src/stub/src/arch/mips/mipsel.r3000/nrv2b_d.ash b/src/stub/src/arch/mips/mipsel.r3000/nrv2b_d.ash new file mode 100644 index 00000000..b4202ba0 --- /dev/null +++ b/src/stub/src/arch/mips/mipsel.r3000/nrv2b_d.ash @@ -0,0 +1,131 @@ +; n2b_d.ash -- NRV2B decompressor in Mips R3000 assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 Jens Medoch +; +; http://www.oberhumer.com/opensource/ucl/ +; + +#if (NRV_BB==8) +# ifdef SMALL + IF (!small) + DEFINE small + ENDIF +# define UCL_DECOMPRESSOR ucl_nrv2b_decompress_8_small +# define GETBIT gbit_call gbit_sub,NRV_BB +# else +# define UCL_DECOMPRESSOR ucl_nrv2b_decompress_8 +# define GETBIT gbit_8 +# endif +#elif (NRV_BB==32) +# ifdef SMALL +# define UCL_DECOMPRESSOR ucl_nrv2b_decompress_32_small +# define GETBIT gbit_call gbit_sub,NRV_BB +# else + IF (small) + UNDEF small + ENDIF +# define UCL_DECOMPRESSOR ucl_nrv2b_decompress_32 +# define GETBIT gbit_le32 +# endif +#else +# error "define NRV_BB first!" +#endif + + +#include "bits.ash" + +; ------------- DECOMPRESSION ------------- +; On entry: +; a0 src pointer +; a2 dest pointer + + +UCL_DECOMPRESSOR PROC + init NRV_BB +n2b_18: + GETBIT + beqz var,n2b_78 + li m_off,1 + lbu var,0(src_ilen) + addiu src_ilen,1 + sb var,0(dst) + b n2b_18 + addiu dst,1 +n2b_78: + GETBIT + sll m_off,1 + addu m_off,var + GETBIT + beqz2gb var,n2b_78,NRV_BB + li var,2 + bne m_off,var,n2b_FC + addiu m_off,-3 + b n2b_120 + move m_off,last_m_off +n2b_FC: + lbu var,0(src_ilen) + addiu src_ilen,1 + sll m_off,8 ; *256 + addu m_off,var ; +scr[ilen++] + li var,-1 + beq m_off,var,n2b_decomp_done + addiu m_off,1 + move last_m_off,m_off +n2b_120: + GETBIT + move m_len,var + sll m_len,1 + GETBIT + addu m_len,var + bnez m_len,n2b_208 + sltiu var,m_off,0x0D01 + li m_len,1 +n2b_190: + GETBIT + sll m_len,1 + addu m_len,var + GETBIT + beqz2gb var,n2b_190,NRV_BB + addiu m_len,2 + sltiu var,m_off,0x0D01 +n2b_208: + xori var,0x0001 + addu m_len,var + uclmcpy n2b_18,NRV_BB + +#ifdef SMALL +gbit_sub: +# if (NRV_BB == 8) + gbit_8 +# elif (NRV_BB == 32) + gbit_le32 +# else +# error "define NRV_BB first!" +# endif +#endif + +n2b_decomp_done: +UCL_DECOMPRESSOR ENDP + +#undef UCL_DECOMPRESSOR +#undef GETBIT diff --git a/src/stub/src/arch/mips/mipsel.r3000/nrv2d_d.ash b/src/stub/src/arch/mips/mipsel.r3000/nrv2d_d.ash new file mode 100644 index 00000000..8b69381c --- /dev/null +++ b/src/stub/src/arch/mips/mipsel.r3000/nrv2d_d.ash @@ -0,0 +1,140 @@ +; n2d_d.ash -- NRV2D decompressor in Mips R3000 assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 Jens Medoch +; +; http://www.oberhumer.com/opensource/ucl/ +; + +#if (NRV_BB==8) +# ifdef SMALL + IF (!small) + DEFINE small + ENDIF +# define UCL_DECOMPRESSOR ucl_nrv2d_decompress_8_small +# define GETBIT gbit_call gbit_sub,NRV_BB +# else +# define UCL_DECOMPRESSOR ucl_nrv2d_decompress_8 +# define GETBIT gbit_8 +# endif +#elif (NRV_BB==32) +# ifdef SMALL +# define UCL_DECOMPRESSOR ucl_nrv2d_decompress_32_small +# define GETBIT gbit_call gbit_sub,NRV_BB +# else + IF (small) + UNDEF small + ENDIF +# define UCL_DECOMPRESSOR ucl_nrv2d_decompress_32 +# define GETBIT gbit_le32 +# endif +#else +# error "define NRV_BB first!" +#endif + + +#include "bits.ash" + +; ------------- DECOMPRESSION ------------- +; On entry: +; a0 src pointer +; a2 dest pointer + + +UCL_DECOMPRESSOR PROC + init NRV_BB +n2d_18: + GETBIT + beqz var,n2d_74 + li m_off,1 + lbu var,0(src_ilen) + addiu src_ilen,1 + sb var,0(dst) + b n2d_18 + addiu dst,1 +n2d_74: + GETBIT + sll m_off,1 + addu m_off,var + GETBIT + bnez var,n2d_124 + addiu var,m_off,-1 + sll m_off,var,1 + GETBIT + b n2d_74 + addu m_off,var +n2d_124: + li var,2 + bne m_off,var,n2d_168 + addiu m_off,-3 + GETBIT + move m_off,last_m_off + b n2d_198 + andi m_len,var,0x0001 +n2d_168: + lbu var,0(src_ilen) + addiu src_ilen,1 + sll m_off,8 + addu m_off,var + li var,-1 + beq m_off,var,n2d_decomp_done + nor var,zero,m_off + andi m_len,var,0x0001 + srl m_off,1 + addiu m_off,1 + move last_m_off,m_off +n2d_198: + GETBIT + sll m_len,1 + addu m_len,var + bnez m_len,n2d_25C + sltiu var,m_off,0x0501 + li m_len,1 +n2d_1E4: + GETBIT + sll m_len,1 + addu m_len,var + GETBIT + beqz2gb var,n2d_1E4,NRV_BB + addiu m_len,2 + sltiu var,m_off,0x0501 +n2d_25C: + xori var,0x0001 + addu m_len,var + uclmcpy n2d_18,NRV_BB + +#ifdef SMALL +gbit_sub: +# if (NRV_BB == 8) + gbit_8 +# elif (NRV_BB == 32) + gbit_le32 +# else +# error "define NRV_BB first!" +# endif +#endif + +n2d_decomp_done: +UCL_DECOMPRESSOR ENDP + +#undef UCL_DECOMPRESSOR +#undef GETBIT diff --git a/src/stub/src/arch/mips/mipsel.r3000/nrv2e_d.ash b/src/stub/src/arch/mips/mipsel.r3000/nrv2e_d.ash new file mode 100644 index 00000000..96c62e3c --- /dev/null +++ b/src/stub/src/arch/mips/mipsel.r3000/nrv2e_d.ash @@ -0,0 +1,145 @@ +; n2e_d.ash -- NRV2E decompressor in Mips R3000 assembly +; +; This file is part of the UCL data compression library. +; +; Copyright (C) 1996-2005 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 Jens Medoch +; +; http://www.oberhumer.com/opensource/ucl/ +; + +#if (NRV_BB==8) +# ifdef SMALL + IF (!small) + DEFINE small + ENDIF +# define UCL_DECOMPRESSOR ucl_nrv2e_decompress_8_small +# define GETBIT gbit_call gbit_sub,NRV_BB +# else +# define UCL_DECOMPRESSOR ucl_nrv2e_decompress_8 +# define GETBIT gbit_8 +# endif +#elif (NRV_BB==32) +# ifdef SMALL +# define UCL_DECOMPRESSOR ucl_nrv2e_decompress_32_small +# define GETBIT gbit_call gbit_sub,NRV_BB +# else + IF (small) + UNDEF small + ENDIF +# define UCL_DECOMPRESSOR ucl_nrv2e_decompress_32 +# define GETBIT gbit_le32 +# endif +#else +# error "define NRV_BB first!" +#endif + + +#include "bits.ash" + +; ------------- DECOMPRESSION ------------- +; On entry: +; a0 src pointer +; a2 dest pointer + + +UCL_DECOMPRESSOR PROC + init NRV_BB +n2e_18: + GETBIT + beqz var,n2e_4C + li m_off,1 + lbu var,0(src_ilen) + addiu src_ilen,1 + sb var,0(dst) + b n2e_18 + addiu dst,1 +n2e_4C: + GETBIT + sll m_off,1 + addu m_off,var + GETBIT + bnez var,n2e_E4 + addiu var,m_off,-1 + sll m_off,var,1 + GETBIT + b n2e_4C + addu m_off,var +n2e_E4: + li var,2 + bne m_off,var,n2e_124 + addiu m_off,-3 + move m_off,last_m_off + GETBIT + b n2e_150 + andi m_len,var,0x0001 +n2e_124: + lbu var,0(src_ilen) + sll m_off,8 + addu m_off,var + li var,-1 + beq m_off,var,n2e_decomp_done + addiu src_ilen,1 + nor var,zero,m_off + andi m_len,var,0x0001 + srl m_off,1 + addiu m_off,1 + move last_m_off,m_off +n2e_150: + beqz2gb m_len,n2e_184,NRV_BB + GETBIT + b n2e_244 + addiu m_len,var,1 +n2e_184: + GETBIT + beqz var,n2e_1E0 + addiu m_len,1 + GETBIT + b n2e_244 + addiu m_len,var,3 +n2e_1E0: + GETBIT + sll m_len,1 + addu m_len,var + GETBIT + beqz2gb var,n2e_1E0,NRV_BB + addiu m_len,3 +n2e_244: + sltiu var,m_off,0x0501 + xori var,0x0001 + addu m_len,var + uclmcpy n2e_18,NRV_BB + +#ifdef SMALL +gbit_sub: +# if (NRV_BB == 8) + gbit_8 +# elif (NRV_BB == 32) + gbit_le32 +# else +# error "define NRV_BB first!" +# endif +#endif + +n2e_decomp_done: +UCL_DECOMPRESSOR ENDP + +#undef UCL_DECOMPRESSOR +#undef GETBIT diff --git a/src/stub/src/arch/powerpc/32/Makefile b/src/stub/src/arch/powerpc/32/Makefile new file mode 100644 index 00000000..ff0b0eff --- /dev/null +++ b/src/stub/src/arch/powerpc/32/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../../.. $@ diff --git a/src/stub/src/arch/powerpc/32/bxx.S b/src/stub/src/arch/powerpc/32/bxx.S new file mode 100644 index 00000000..080ab414 --- /dev/null +++ b/src/stub/src/arch/powerpc/32/bxx.S @@ -0,0 +1,64 @@ +/* ppc_bxx.S -- PowerPC Branch Trick unfilter + + This file is part of the UPX executable compressor. + + Copyright (C) 2005 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. + + John F. Reiser + +*/ + +#include "regs.h" + +ppcbxx: # (*f_unf)(xo->buf, out_len, h.b_cto8, h.b_ftid); +#define W_CTO 4 /* must match filteri/ppcbxx.h */ + +#define ptr a0 +#define len a1 +#define cto8 a2 +#define ftid a3 + +#define ptr0 a4 + + cmpli cr0,ftid,0xd0; bnelr- cr0 # if (0xd0!=ftid) return; + rlwinm. len,len,32-2,2,31; beqlr- cr0 # if (0==(len>>=2)) return; + lis r0,-(~0<<(32-16- (2+6+ W_CTO))) # limit in 32-bit words + cmpl cr0,len,r0 + blt cr0,L5 + mr len,r0 +L5: + addi cto8,cto8,18< + + John F. Reiser + +*/ + +#include "ppc_regs.h" + +SZ_DLINE=128 # size of data cache line in Apple G5 + +/* Returns 0 on success; non-zero on failure. */ +decompress: # (uchar const *src, size_t lsrc, uchar *dst, size_t &ldst, uint method) + +/* PowerPC has no 'cmplis': compare logical [unsigned] immediate shifted [by 16] */ +#define hibit r0 /* holds 0x80000000 during decompress */ + +#define src a0 +#define lsrc a1 +#define dst a2 +#define ldst a3 /* Out: actually a reference: &len_dst */ +#define meth a4 + +#define off a4 +#define len a5 +#define bits a6 +#define disp a7 + + dcbtst 0,dst # prime dcache for store + + stw dst,0(ldst) # original dst + add lsrc,lsrc,src # input eof + + lis hibit,0x8000 # 0x80000000 for detecting next bit + lis bits,0x8000 # prepare for first load + addi src,src,-1 # prepare for 'lbzu' + addi dst,dst,-1 # prepare for 'stbu' + li disp,-1 # initial displacement + + mflr t3 # return address + b bot_n2b + +/* jump on next bit, with branch prediction: y==>likely; n==>unlikely + cr0 is set by the cmpl ["compare logical"==>unsigned]: + lt next bit is 0 + gt next bit is 1 + eq must load next 32 bits from memory +*/ +#define jnextb0y call get1; blt+ cr0, +#define jnextb0n call get1; blt- cr0, +#define jnextb1y call get1; bgt+ cr0, +#define jnextb1n call get1; bgt- cr0, + +/* rotate next bit into bottom bit of reg; set cr0 based on entire result reg */ +#define getnextb(reg) call get1; adde. reg,reg,reg + +get1: + cmpl cr0,bits,hibit # cr0 for jnextb + addc bits,bits,bits # CArry for getnextb + bnelr+ cr0 # return if reload not needed; likely 31/32 + +/* CArry has been set from adding 0x80000000 to itself; preserve for 'adde' */ + # fetch 4 bytes unaligned and LITTLE ENDIAN +#if 0 /*{ clean; but 4 instr larger, and 3 cycles longer */ + lbz bits,1(src) # lo8 + lbz t0,2(src); rlwimi bits,t0, 8,16,23 + lbz t0,3(src); rlwimi bits,t0,16, 8,15 + lbzu t0,4(src); rlwimi bits,t0,24, 0, 7 +#else /*}{ pray for no unalignment trap or slowdown */ + li bits,1 # compensate for 'lbzu' + lwbrx bits,bits,src # bits= fetch_le32(bits+src) + addi src,src,4 +#endif /*}*/ + + cmpl cr0,bits,hibit # cr0 for jnextb + adde bits,bits,bits # CArry for getnextb; set lo bit from CarryIn + ret + +lit_n2b: +#define tmp len + lbzu tmp,1(src) # tmp= *++src; + stbu tmp,1(dst) # *++dst= tmp; +#undef tmp +top_n2b: + jnextb1y lit_n2b + li off,1 # "the msb" +offmore_n2b: + getnextb(off) + jnextb0n offmore_n2b + + addic. off,off,-3 # CArry set [and ignored], but no 'addi.' + li len,0 + blt- offprev_n2b + lbzu t0,1(src) + rlwinm off,off,8,0,31-8 # off<<=8; + nor. disp,off,t0 # disp = -(1+ (off|t0)); + beq- eof_n2b + +offprev_n2b: # In: 0==len + getnextb(len); getnextb(len) # two bits; cr0 set on result + li off,1; bne- gotlen_n2b # raw 1,2,3 ==> 2,3,4 + li off,3 # raw 2.. ==> 5.. + li len,1 # "the msb" +lenmore_n2b: + getnextb(len) + jnextb0n lenmore_n2b +gotlen_n2b: + subfic t0,disp,(~0)+(-0xd00) # want CArry only + adde len,len,off # len += off + (disp < -0xd00); + +copy: +#define back off + add back,disp,dst # point back to match in dst + mtctr len +short_n2b: +#define tmp len + lbzu tmp,1(back) + stbu tmp,1(dst) +#undef tmp + bdnz+ short_n2b + +/* This "prefetch for store" is simple, small, and effective. Matches + usually occur more frequently than once per 128 bytes, but G4 line size + is only 32 bytes anyway. Assume that an 'unnecessary' dcbtst costs only + about as much as a hit. The counter register is free at top_n2b, so we could + pace the dcbtst optimally; but that takes 7 or 8 instructions of space. +*/ +bot_n2b: + li back,2*SZ_DLINE + dcbtst back,dst # 2 lines ahead [-1 for stbu] + dcbt back,src # jump start auto prefetch at page boundary +/* Auto prefetch for Read quits at page boundary; needs 2 misses to restart. */ +#undef back + b top_n2b + +eof_n2b: +#define tmp r0 /* hibit is dead */ + lwz tmp,0(ldst) # original dst + mtlr t3 # return address + addi dst,dst,1 # uncorrect for 'stbu' + addi src,src,1 # uncorrect for 'lbzu' + subf dst,tmp,dst # dst -= tmp; // dst length +#undef tmp + subf a0,lsrc,src # src -= eof; // return 0: good; else: bad + stw dst,0(ldst) + ret + diff --git a/src/stub/src/arch/powerpc/32/nrv2e_d.S b/src/stub/src/arch/powerpc/32/nrv2e_d.S new file mode 100644 index 00000000..9e985f7b --- /dev/null +++ b/src/stub/src/arch/powerpc/32/nrv2e_d.S @@ -0,0 +1,184 @@ +/* ppc_d_nrv2e.S -- PowerPC decompressor for NRV2E + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 Laszlo Molnar + Copyright (C) 2000-2005 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 + + + John F. Reiser + +*/ + +#include "regs.h" + +SZ_DLINE=128 # size of data cache line in Apple G5 + +/* Returns 0 on success; non-zero on failure. */ +decompress: # (uchar const *src, size_t lsrc, uchar *dst, size_t &ldst, uint method) + +/* PowerPC has no 'cmplis': compare logical [unsigned] immediate shifted [by 16] */ +#define hibit r0 /* holds 0x80000000 during decompress */ + +#define src a0 +#define lsrc a1 +#define dst a2 +#define ldst a3 /* Out: actually a reference: &len_dst */ +#define meth a4 + +#define off a4 +#define len a5 +#define bits a6 +#define disp a7 + + dcbtst 0,dst # prime dcache for store + + stw dst,0(ldst) # original dst + add lsrc,lsrc,src # input eof + + lis hibit,0x8000 # 0x80000000 for detecting next bit + lis bits,0x8000 # prepare for first load + addi src,src,-1 # prepare for 'lbzu' + addi dst,dst,-1 # prepare for 'stbu' + li disp,-1 # initial displacement + + mflr t3 # return address + b bot_n2e + +/* jump on next bit, with branch prediction: y==>likely; n==>unlikely + cr0 is set by the cmpl ["compare logical"==>unsigned]: + lt next bit is 0 + gt next bit is 1 + eq must load next 32 bits from memory + + beql-: branch and link [call subroutine] if cr0 is eq, unlikely +*/ +#define jnextb0y cmpl 0,bits,hibit; add bits,bits,bits; beql- get32; blt+ +#define jnextb0n cmpl 0,bits,hibit; add bits,bits,bits; beql- get32; blt- +#define jnextb1y cmpl 0,bits,hibit; add bits,bits,bits; beql- get32; bgt+ +#define jnextb1n cmpl 0,bits,hibit; add bits,bits,bits; beql- get32; bgt- + +/* rotate next bit into bottom bit of reg */ +#define getnextb(reg) addc. bits,bits,bits; beql- get32; adde reg,reg,reg + +get32: + # fetch 4 bytes unaligned and LITTLE ENDIAN +#if 0 /*{ clean; but 4 instr larger, and 3 cycles longer */ + lbz bits,1(src) # lo8 + lbz t0,2(src); rlwimi bits,t0, 8,16,23 + lbz t0,3(src); rlwimi bits,t0,16, 8,15 + lbzu t0,4(src); rlwimi bits,t0,24, 0, 7 +#else /*}{ pray for no unalignment trap or slowdown */ + li bits,1 # compensate for 'lbzu' + lwbrx bits,bits,src # bits= fetch_le32(bits+src) + addi src,src,4 +#endif /*}*/ + + cmpl 0,bits,hibit # cr0 for jnextb + addc bits,bits,bits # CArry for getnextb + ori bits,bits,1 # the flag bit + ret + +lit_n2e: +#define tmp len + lbzu tmp,1(src) # tmp= *++src; + stbu tmp,1(dst) # *++dst= tmp; +#undef tmp +top_n2e: + jnextb1y lit_n2e + li off,1 + b getoff_n2e + +off_n2e: + addi off,off,-1 + getnextb(off) +getoff_n2e: + getnextb(off) + jnextb0n off_n2e + + li len,0 + addic. off,off,-3 # CArry set [and ignored], but no 'addi.' + rlwinm off,off,8,0,31-8 # off<<=8; + blt- offprev_n2e + lbzu t0,1(src) + nor. disp,off,t0 # disp = -(1+ (off|t0)); + srawi disp,disp,1 # shift off low bit (sets CArry; ignored) + beq- eof_n2e + andi. t0,t0,1 # complement of low bit of unshifted disp + beq+ lenlast_n2e # low bit was 1 + b lenmore_n2e # low bit was 0 + +offprev_n2e: + jnextb1y lenlast_n2e +lenmore_n2e: + li len,1 # 1: "the msb" + jnextb1y lenlast_n2e +len_n2e: + getnextb(len) + jnextb0n len_n2e + addi len,len,6-2-2 + b gotlen_n2e + +lenlast_n2e: + getnextb(len) # 0,1,2,3 +gotlen_n2e: +#define tmp off + subfic tmp,disp,(~0)+(-0x500) # want CArry only +#undef tmp + addi len,len,2 + addze len,len # len += (disp < -0x500); + +#define back off + add back,disp,dst # point back to match in dst + mtctr len +short_n2e: +#define tmp len + lbzu tmp,1(back) + stbu tmp,1(dst) +#undef tmp + bdnz+ short_n2e +bot_n2e: +/* This "prefetch for store" is simple, small, and effective. Matches + usually occur more frequently than once per 128 bytes, but G4 line size + is only 32 bytes anyway. Assume that an 'unnecessary' dcbtst costs only + about as much as a hit. The counter register is free at top_n2e, so we could + pace the dcbtst optimally; but that takes 7 or 8 instructions of space. +*/ + li back,2*SZ_DLINE + dcbtst back,dst # 2 lines ahead [-1 for stbu] + dcbt back,src # jump start auto prefetch at page boundary +/* Auto prefetch for Read quits at page boundary; needs 2 misses to restart. */ + b top_n2e +#undef back + +eof_n2e: +#define tmp r0 /* hibit is dead */ + lwz tmp,0(ldst) # original dst + mtlr t3 # return address + addi dst,dst,1 # uncorrect for 'stbu' + addi src,src,1 # uncorrect for 'lbzu' + subf dst,tmp,dst # dst -= tmp; // dst length +#undef tmp + subf a0,lsrc,src # src -= eof; // return 0: good; else: bad + stw dst,0(ldst) + ret + diff --git a/src/stub/src/arch/powerpc/32/regs.h b/src/stub/src/arch/powerpc/32/regs.h new file mode 100644 index 00000000..c601c622 --- /dev/null +++ b/src/stub/src/arch/powerpc/32/regs.h @@ -0,0 +1,46 @@ +#ifndef __PPC_REGS__ /*{*/ +#define __PPC_REGS__ + +#define r0 0 +#define r1 1 +#define r2 2 + +#define r29 29 +#define r30 30 +#define r31 31 + +/* Stack pointer */ +#define sp 1 + +/* Subroutine arguments; not saved by callee */ +#define a0 3 +#define a1 4 +#define a2 5 +#define a3 6 +#define a4 7 +#define a5 8 +#define a6 9 +#define a7 10 + +/* Scratch (temporary) registers; not saved by callee */ +#define t0 2 +#define t1 11 +#define t2 12 +#define t3 13 + +/* branch and link */ +#define call bl + +/* branch to link register */ +#define ret blr + +/* move register */ +#define movr mr + +#endif /*} __PPC_REGS__ */ + + +/* +vi:ts=4:et:nowrap +*/ + diff --git a/src/stub/src/arch/powerpc/Makefile b/src/stub/src/arch/powerpc/Makefile new file mode 100644 index 00000000..413a5328 --- /dev/null +++ b/src/stub/src/arch/powerpc/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../../.. $@ diff --git a/src/stub/src/arm-linux.elf-entry.S b/src/stub/src/arm-linux.elf-entry.S new file mode 100644 index 00000000..39066956 --- /dev/null +++ b/src/stub/src/arm-linux.elf-entry.S @@ -0,0 +1,145 @@ +/* l_lx_elf32arm.S -- Linux program entry point & decompressor (Elf binary) +* +* This file is part of the UPX executable compressor. +* +* Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +* Copyright (C) 1996-2004 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 +* +* +* John F. Reiser +* +*/ + +sz_Elf32_Ehdr = 13*4 +sz_Elf32_Phdr = 8*4 + +sz_b_info= 12 + sz_unc= 0 + sz_cpr= 4 + b_method= 8 + +PROT_READ= 1 +PROT_WRITE= 2 +PROT_EXEC= 4 + +MAP_PRIVATE= 2 +MAP_FIXED= 0x10 +MAP_ANONYMOUS= 0x20 + +PAGE_SHIFT= 12 +PAGE_SIZE = -(~0< +@ +@ John F. Reiser +@ +@ + +sz_Elf32_Ehdr = 13*4 +sz_Elf32_Phdr = 8*4 +sz_l_info = 12 +sz_p_info = 12 +sz_b_info = 12 + sz_unc= 0 + sz_cpr= 4 + b_method= 8 + +@@ control just falls through, after this part and compiled C code +@@ are uncompressed. + +#define OVERHEAD 2048 +#define MAX_ELF_HDR 512 + +fold_begin: +/* In: + r10= &b_info of first compressed block (after move) + r9= total size of compressed data + r5= f_decompress + sp/ ADRU,LENU,sz_unc,argc,argv... +*/ + ldr r3,[sp,#3*4] @ argc + add r3,sp,r3,lsl #2 @ skip argv + add r3,r3,#3*4 +4 +4 @ skip ADRU,LENU,sz_unc, argc, env_end +.Lenv: + ldr r0,[r3],#4 @ skip env + cmp r0,#0 + bne .Lenv + /* r3= &Elf32_auxv_t */ + mov r2,r3 +.Laux: + ldr r0,[r2],#2*4 @ .a_type + cmp r0,#0 + bne .Laux + str r2,[sp,#2*4] @ clobber sz_unc with 1+ &Elf32_auxv_t[AT_NULL@.a_type] + + sub sp,sp,#MAX_ELF_HDR + OVERHEAD @ alloca + mov r4,r9 @ total size of compressed data + ldr r9,[r10,#sz_cpr] @ xi.size of ELF headers + mov r8,sp @ xo.ptr + ldr r7,[r10,#sz_unc] @ xo.size + adr r6,f_unfilter + add r9,r9,#sz_b_info @ for unpackExtent + mov r11,#0 @ dynbase for ET_EXEC; FIXME for ET_DYN + stmdb sp!,{r3,r4,r5,r6,r7,r8,r9,r10,r11} + ldmia sp!,{r0,r1,r2,r3} + bl upx_main + mov lr,r0 @ entry address + add sp,sp,#(9-4)*4 + add sp,sp,#MAX_ELF_HDR + OVERHEAD @ un-alloca + ldmia sp!,{r0,r1,r2} @ ADRU,LENU,1+ &Elf32_auxv_t[AT_NULL@.a_type] + ldr pc,[r2,#4 -2*4] @ Elf32_auxv_t[AT_NULL@.a_type].a_val + +f_unfilter: @ (char *ptr, uint len, uint cto, uint fid) + ptr .req r0 + len .req r1 + cto .req r2 @ unused + fid .req r3 + + t1 .req r2 + t2 .req r3 + + and fid,fid,#0xff + cmp fid,#0x50 @ last use of fid + movne pc,lr @ no-op if not filter 0x50 + + movs len,len,lsr #2 @ word count + cmpne ptr,#0 + moveq pc,lr @ no-op if either len or ptr is 0 + +top_unf: + sub len,len,#1 + ldr t1,[ptr,len,lsl #2] + and t2,t1,#0x0f<<24 + cmp t2, #0x0b<<24; bne tst_unf @ not 'bl' subroutine call + and t2,t1,#0xff<<24 @ all the non-displacement bits + sub t1,t1,len @ convert to word-relative displacement + bic t1,t1,#0xff<<24 @ restrict to displacement field + orr t1,t1,t2 @ re-combine + str t1,[ptr,len,lsl #2] +tst_unf: + cmp len,#0 + bne top_unf + mov pc,lr + + .unreq ptr + .unreq len + .unreq cto + .unreq fid + + .globl exit +exit: + swi 0x00900001 + + .globl read +read: + swi 0x00900003; mov pc,lr + + .globl write +write: + swi 0x00900004; mov pc,lr + + .globl open +open: + swi 0x00900005; mov pc,lr + + .globl close +close: + swi 0x00900006; mov pc,lr + + .globl brk +brk: + swi 0x0090002d; mov pc,lr + + .globl munmap +munmap: + swi 0x0090005b; mov pc,lr + + .globl mprotect +mprotect: + swi 0x0090007d; mov pc,lr + + .globl mmap +mmap: + str r5,[sp,#-4]!; ldr r5,[sp,#4+4] + str r4,[sp,#-4]!; ldr r4,[sp,#4+4] + mov r5,r5,lsr #12 @ convert to page number + swi 0x009000c0 @ mmap64 + ldr r4,[sp],#4 + ldr r5,[sp],#4 + mov pc,lr + +#if 0 /*{ "gcc-3.4 -fPIC" botches string constants when code moves! */ + .globl STR_0x +STR_0x: + mov r0,pc; mov pc,lr + .asciz "0x" + .balign 4 + + .globl STR_hex +STR_hex: + mov r0,pc; mov pc,lr + .asciz "0123456789abcdef" + .balign 4 + + .globl STR_xread +STR_xread: + mov r0,pc; mov pc,lr + .asciz "xread %p(%x %p) %p %x\n" + .balign 4 + + .globl STR_unpackExtent +STR_unpackExtent: + mov r0,pc; mov pc,lr + .asciz "unpackExtent in=%p(%x %p) out=%p(%x %p) %p %p\n" + .balign 4 + + .globl STR_make_hatch_arm +STR_make_hatch_arm: + mov r0,pc; mov pc,lr + .asciz "make_hatch_arm %p %x\n" + .balign 4 + + .globl STR_auxv_up +STR_auxv_up: + mov r0,pc; mov pc,lr + .asciz "auxv_up %p %x %x\n" + .balign 4 + + .globl STR_xfind_pages +STR_xfind_pages: + mov r0,pc; mov pc,lr + .asciz "xfind_pages %x %p %d %p\n" + .balign 4 + + .globl STR_do_xmap +STR_do_xmap: + mov r0,pc; mov pc,lr + .asciz "do_xmap fdi=%x ehdr=%p xi=%p(%x %p) av=%p p_reloc=%p f_unf=%p\n" + .balign 4 + + .globl STR_upx_main +STR_upx_main: + mov r0,pc; mov pc,lr + .asciz "upx_main av=%p szc=%x f_dec=%p f_unf=%p xo=%p(%x %p) xi=%p(%x %p) dynbase=%x\n", + .balign 4 +#endif /*}*/ + +@ vi:ts=8:et:nowrap + diff --git a/src/stub/src/arm-linux.elf-fold.lds b/src/stub/src/arm-linux.elf-fold.lds new file mode 100644 index 00000000..8d8d4173 --- /dev/null +++ b/src/stub/src/arm-linux.elf-fold.lds @@ -0,0 +1,49 @@ +/* l_lx_elf32arm.lds -- + + This file is part of the UPX executable compressor. + + 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 + + + John F. Reiser + + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +/*ENTRY(_start)*/ +PHDRS +{ + text PT_LOAD FILEHDR PHDRS ; + data PT_LOAD ; /* for setting brk(0) */ +} +SECTIONS +{ + /* 0x00004000: below 0x00008000 usual, enough to avoid icache sync */ + . = 0x00008000 + SIZEOF_HEADERS + 12; /* 12==sizeof(l_info) */ + .text : { + *(.text) + *(.data) + } : text + .data : { + } : data +} diff --git a/src/stub/src/arm-linux.elf-main.c b/src/stub/src/arm-linux.elf-main.c new file mode 100644 index 00000000..5f0b0433 --- /dev/null +++ b/src/stub/src/arm-linux.elf-main.c @@ -0,0 +1 @@ +#include "i386-linux.elf-main.c" diff --git a/src/stub/src/arm.v4a-wince.pe.S b/src/stub/src/arm.v4a-wince.pe.S new file mode 100644 index 00000000..7b6ebcf0 --- /dev/null +++ b/src/stub/src/arm.v4a-wince.pe.S @@ -0,0 +1,374 @@ +/* l_armpea.S -- ARM/PE decompressor assembly startup (arm mode) + + 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 + + + John F. Reiser + +*/ + +// DEBUG == 0 -> none +// DEBUG == 1 -> for armpe_tester +// DEBUG == 2 -> wince - dumps memory +// DEBUG == 3 -> wince - removes files + +#define DEBUG 0 +#if DEBUG == 0 +# define DINIT +# define DDUMP(x) +# define DDONE +#else + #define DDUMP(x) stmfd sp!, {r0 - r3}; mov r0, x; mov lr, pc; mov pc, r8; ldmia sp!, {r0 - r3} + #if DEBUG == 1 + #define DINIT mov r8, r0 + #define DDONE mov pc, lr + #elif DEBUG == 2 + #define DINIT adr r8, writefile + #define DDONE + #elif DEBUG == 3 + #define DINIT adr r8, DelFile + #define DDONE + #endif +#endif + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +// magic for the UPX linker +#define SECT(n) .text 1; .asciz #n; .long n - _start; .text 0; n + +#define BL(t) \ + .text 1; .long 0, bl##t - _start; .asciz #t; .long 0; \ + .text 0; .byte 0, 0, 0; bl##t: .byte 0xeb + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + .text + .balign 0 + .globl _start + .arm +_start: + + dst0 .req r9 @ global register + +SECT(DllStart): + cmp r1, #1 + bne .Lstart_orig + +SECT(ExeStart): + stmfd sp!, {r0 - r11, lr} + DINIT + adr r3, SRC0 + ldmia r3!, {r0, r1, r2} @ r0=src0, r1=slen, r2=dst0, r3=addr dstl + ldmia r3, {r4, r10, r11} @ r10=LoadLibraryW, r11=GetProcAddressA + mov dst0, r2 + + bl ProcessAll + mov r0, #4 + bl CacheSync + ldmia sp!, {r0 - r11, lr} + DDONE +.Lstart_orig: + ldr pc, ENTR + +CacheSync: + ldr pc, IATT + 8 + +SRC0: .ascii "SRC0" @ start of compressed data +SRCL: .ascii "SRCL" @ compressed length +DST0: .ascii "DST0" @ start of uncompressed data +DSTL: .ascii "DSTL" @ uncompressed length +IATT: .ascii "IATT"; .long 0, 0, 0 @ import address table +ENTR: .ascii "ENTR" @ original entry point + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +#if DEBUG == 2 +writefile: + stmfd sp!, {r4, r5, r6, r7, lr} + mov r1, dst0 + sub r2, r8, r1 + add r2, r2, #4096+2048 + mov r3, #2 + sub sp, sp, #24 + mov r4, #0 + strh r0, [sp, #18] + str r3, [sp, #0] + mov r0, #128 + mov r3, #92 + str r0, [sp, #4] + mov r6, r1 + mov r7, r2 + strh r3, [sp, #16] + strh r4, [sp, #20] + mov r3, r4 + str r4, [sp, #8] + mov r1, #1073741824 + mov r2, #3 + add r0, sp, #16 + ldr ip, .L3 + mov lr, pc + mov pc, ip + add r3, sp, #12 + mov r5, r0 + str r4, [sp, #0] + mov r1, r6 + mov r2, r7 + ldr ip, .L3+4 + mov lr, pc + mov pc, ip + mov r0, r5 + ldr r3, .L3+8 + mov lr, pc + mov pc, r3 + add sp, sp, #24 + ldmfd sp!, {r4, r5, r6, r7, pc} +.L3: + .word 33135704 + .word 33135968 + .word 33137392 +#endif + +#if DEBUG == 3 +DelFile: + adr r1, filename + strb r0, [r1, #2] + mov r0, r1 + ldr pc, deleteffilew + +deleteffilew: + .word 0x1f99bc8 +filename: + .byte '\\', 0, 'r', 0, 0, 0 + .align 2 +#endif + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +ProcessAll: + stmfd sp!, {lr} + + @@ uncompress/unfilter/imports/relocs are copied here by the upx linker + +SECT(ProcessEnd): + ldmia sp!, {pc} + + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(Unfilter_0x50): + buffer .req r0 + addval .req r2 + bufend .req ip + + ldr buffer, FIBS + mov addval, #0 + ldr bufend, FIBE +.Luf50_0: + cmp buffer, bufend + beq .Luf_end + + ldr r3, [buffer] + and r1, r3, #0x0f000000 + cmp r1, #0x0b000000 + bne .Luf50_1 + and r1, r3, #0xff000000 + sub r3, r3, addval + and r3, r3, #0x00ffffff + orr r3, r3, r1 + str r3, [buffer] + +.Luf50_1: + add buffer, buffer, #4 + add addval, addval, #1 + b .Luf50_0 + + .unreq buffer + .unreq addval + .unreq bufend + +FIBS: .ascii "FIBS" @ buffer start for filter +FIBE: .ascii "FIBE" @ buffer end for filter + +.Luf_end: + DDUMP (#'F') + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(Relocs): + dest .req r0 + buffer .req r1 + addval .req dst0 + + ldr buffer, BREL + sub dest, addval, #4 + +.Lreloc_loop: + ldrb r3, [buffer], #1 + cmp r3, #0 + beq .Lreloc_end + cmp r3, #0xf0 + + bichs ip, r3, #0xf0 + ldrhsb r3, [buffer, #1] @ get_le16 + addhs ip, r3, ip, lsl #8 + ldrhsb r3, [buffer], #2 + addhs r3, r3, ip, lsl #8 + + add dest, dest, r3 + ldrb r3, [dest] @ get_be32 + add ip, r3, ip, lsl #8 + ldrb r3, [dest, #1] + add ip, r3, ip, lsl #8 + ldrb r3, [dest, #2] + add ip, r3, ip, lsl #8 + ldrb r3, [dest, #3] + add ip, r3, ip, lsl #8 + add ip, ip, addval + str ip, [dest] + b .Lreloc_loop + +BREL: .ascii "BREL" @ start of reloc info + + .unreq buffer + .unreq addval + .unreq dest + +.Lreloc_end: + DDUMP (#'R') + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(Imports): + imp .req r4 + iat .req r5 + dll .req r6 + .equ bufsize, 2048 + + sub sp, sp, #bufsize + ldr imp, BIMP +.Lhi_loop1: + mov r0, imp + bl get_le32 + beq .Lhi_end + + ldr r1, ONAM + add r0, r0, r1 + mov r1, sp +.Lhi_copyname: + ldrb r2, [r0], #1 + strh r2, [r1], #2 + cmp r2, #0 + bne .Lhi_copyname + + mov r0, sp + bl LoadLibraryW + + mov dll, r0 + add r0, imp, #4 + bl get_le32 + add iat, dst0, r0 + add imp, imp, #8 + +.Lhi_gpa_loop: + ldrb r0, [imp], #1 + cmp r0, #1 + bmi .Lhi_loop1 + bne .Lhi_by_ord + + mov r1, imp +.Lhi_by_name: + ldrb r0, [imp], #1 + cmp r0, #0 + bne .Lhi_by_name + b .Lhi_call_gpa + +.Lhi_by_ord: + ldrb r0, [imp], #1 + ldrb r1, [imp], #1 + add r1, r0, r1, lsl #8 + +.Lhi_call_gpa: + mov r0, dll + bl GetProcAddressA + str r0, [iat], #4 + b .Lhi_gpa_loop + + .unreq iat + .unreq imp + .unreq dll + +get_le32: @ optimized for size + mov r2, #3 +.Lg0: + ldrb r3, [r0, r2] + subs r2, r2, #1 + add r1, r3, r1, asl #8 + bpl .Lg0 + movs r0, r1 @ set the Z flag if zero + mov pc, lr + +LoadLibraryW: + mov pc, r10 + +GetProcAddressA: + mov pc, r11 + +BIMP: .ascii "BIMP" @ start of import data +ONAM: .ascii "ONAM" @ start of dll names + +.Lhi_end: + add sp, sp, #bufsize + DDUMP (#'I') + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(ucl_nrv2e_decompress_8): + +#include "arch/arm/v4a/nrv2e_d8.S" + +SECT(Call2E): + BL (ucl_nrv2e_decompress_8) + DDUMP (#'C') + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(UPX1HEAD): + .byte 85,80,88,33 @ 0 UPX_MAGIC_LE32 + .byte 161,216,208,213 @ 4 UPX_MAGIC2_LE32 + .long 0 @ 8 uncompressed adler32 + .long 0 @ 12 compressed adler32 + .long 0 @ 16 uncompressed len + .long 0 @ 20 compressed len + .long 0 @ 24 original file size + .byte 0 @ 28 filter id + .byte 0 @ 29 filter cto + .byte 0 @ unused + .byte 45 @ 31 header checksum + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(eof): + .text 1 + .long -1; .short eof - _start diff --git a/src/stub/src/arm.v4t-wince.pe.S b/src/stub/src/arm.v4t-wince.pe.S new file mode 100644 index 00000000..aed7ea68 --- /dev/null +++ b/src/stub/src/arm.v4t-wince.pe.S @@ -0,0 +1,345 @@ +/* l_armpet.S -- ARM/PE decompressor assembly startup (thumb mode) + + 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 + + + John F. Reiser + +*/ + +#define DEBUG 0 + +// magic for the UPX linker +#define SECT(n) .text 1; .asciz #n; .long n - _start; .text 0; n + +#define BL(t) \ + .text 1; .long 0, bl##t - _start; .asciz #t; .long 0; \ + .text 0; .byte 0, 0, 0; bl##t: .byte 0xf8 + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + .text + .balign 0 + .globl _start + .arm +_start: + + dst0 .req r9 @ global register + +SECT(DllStart): + cmp r1, #1 + bne .Lstart_orig + +SECT(ExeStart): + stmfd sp!, {r0 - r11, lr} + + @ access all pages in ARM mode - this seems to be required + @ otherwise the THUMB mode stuff fails + + adr r3, SRC0 + ldmia r3, {r5, r6, r7, r9, r10, r11, ip} @ r7=dst0 + add r5, pc, #4096 @ r3=addr src0, r10=LoadLibraryW +.L01: @ r11=GetProcAddressA, ip=CacheSync + ldr r6, [r7] + add r7, r7, #4096 + cmp r7, r5 + bls .L01 + + adr r4, ProcessAll + 1 + mov lr, pc + bx r4 + + ldmfd sp!, {r0 - r11, lr} +.Lstart_orig: + ldr ip, ENTR + bx ip + +SRC0: .ascii "SRC0" @ start of compressed data +SRCL: .ascii "SRCL" @ compressed length +DST0: .ascii "DST0" @ start of uncompressed data +DSTL: .ascii "DSTL" @ uncompressed length +IATT: .ascii "IATT"; .long 0, 0, 0 @ import address table +ENTR: .ascii "ENTR" @ original entry point + + .thumb + +ProcessAll: + ldmia r3!, {r0, r1, r2} @ r0=src0, r1=slen, r2=dst0, r3=addr dstl + mov dst0, r2 + mov r4, ip @ CacheSync + push {r4, lr} + .align 2 + + @@ uncompress/unfilter/imports/relocs are copied here by the upx linker + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(Unfilter_0x50): + .align 2 + buffer .req r0 + addval .req r2 + bufend .req r4 + + ldr buffer, FIBS + mov addval, #0 + ldr bufend, FIBE + mov r5, #0x0f + mov r6, #0xff + lsl r6, #24 + mvn r7, r6 +.Luf50_0: + cmp buffer, bufend + beq .Luf50_ret + + ldr r3, [buffer] + lsr r1, r3, #24 + and r1, r5 + cmp r1, #0x0b + bne .Luf50_1 + mov r1, r3 + and r1, r6 + sub r3, addval + and r3, r7 + orr r3, r1 + str r3, [buffer] + +.Luf50_1: + add buffer, #4 + add addval, #1 + b .Luf50_0 + + .unreq buffer + .unreq addval + .unreq bufend + + .align 2 +FIBS: .ascii "FIBS" @ buffer start for filter +FIBE: .ascii "FIBE" @ buffer end for filter + +.Luf50_ret: + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(Relocs): + .align 2 + buffer .req r0 + dest .req r1 + addval .req r2 + + ldr buffer, BREL + mov addval, dst0 + sub dest, addval, #4 + +.Lreloc_loop: + ldrb r3, [buffer] + add buffer, #1 + cmp r3, #0 + beq .Lreloc_end + cmp r3, #0xf0 + blo .Lreloc_add + + mov r4, #0x0f + and r4, r3 + ldrb r3, [buffer, #1] @ get_le16 + lsl r4, #8 + add r4, r3 + ldrb r3, [buffer] + add buffer, #2 + lsl r4, #8 + add r3, r4 + +.Lreloc_add: + add dest, r3 + mov r5, #0 + +.Lread_be32: + ldrb r3, [dest, r5] + lsl r4, #8 + add r4, r3 + add r5, #1 + cmp r5, #4 + bne .Lread_be32 + + add r4, addval + str r4, [dest] + b .Lreloc_loop + + .align 2 +BREL: .ascii "BREL" @ start of reloc info + +.Lreloc_end: + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(Imports): + .align 2 + imp .req r4 + iat .req r5 + dll .req r6 + + mov r7, sp + sub sp, #508 + sub sp, #508 + sub sp, #508 + sub sp, #508 + ldr imp, BIMP +.Lhi_loop1: + mov r0, imp + bl get_le32 + beq .Lhi_end + + ldr r1, ONAM + add r0, r1 + mov r1, sp +.Lhi_copyname: + ldrb r2, [r0] + add r0, #1 + strh r2, [r1] + add r1, #2 + cmp r2, #0 + bne .Lhi_copyname + + mov r0, sp + bl LoadLibraryW + mov dll, r0 + add r0, imp, #4 + bl get_le32 + mov iat, dst0 + add iat, r0 + add imp, #8 + +.Lhi_gpa_loop: + ldrb r0, [imp] + add imp, #1 + cmp r0, #1 + bmi .Lhi_loop1 + bne .Lhi_by_ord + + mov r1, imp +.Lhi_by_name: + ldrb r0, [imp] + add imp, #1 + cmp r0, #0 + bne .Lhi_by_name + b .Lhi_call_gpa + +.Lhi_by_ord: + ldrb r0, [imp] + ldrb r1, [imp, #1] + add imp, #2 + lsl r1, #8 + add r1, r0 + +.Lhi_call_gpa: + mov r0, dll + bl GetProcAddressA + stmia iat!, {r0} + b .Lhi_gpa_loop + + .unreq iat + .unreq imp + .unreq dll + +get_le32: @ optimized for size + mov r1, #3 +.Lg0: + ldrb r3, [r0, r1] + lsl r2, r2, #8 + add r2, r2, r3 + sub r1, #1 + bpl .Lg0 + mov r0, r2 @ sets the Z flag if zero + bx lr + +LoadLibraryW: + bx r10 + +GetProcAddressA: + bx r11 + + .align 2 +BIMP: .ascii "BIMP" @ start of import data +ONAM: .ascii "ONAM" @ start of dll names + +.Lhi_end: + mov sp, r7 + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(ProcessEnd): + pop {r1, r2} @ r1=CacheSync, r2=lr + mov r0, #4 @ parameter of CacheSync + mov lr, r2 + bx r1 + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +#define XSECT(n) .text 1; .asciz #n; .long n - _start; .text 0 + +SECT(dummy0): + .align 2 + .arm +#include "arch/arm/v4t/nrv2b_d8.S" + + XSECT (go_thumb_n2b) + +SECT(Call2B): + BL (go_thumb_n2b) + +#undef wrnk +#undef GETBIT + +SECT(dummy1): + .align 2 + .arm +#include "arch/arm/v4t/nrv2e_d8.S" + + XSECT (thumb_nrv2e_d8) + +SECT(Call2E): + BL (thumb_nrv2e_d8) + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +SECT(UPX1HEAD): + .byte 85,80,88,33 @ 0 UPX_MAGIC_LE32 + .byte 161,216,208,213 @ 4 UPX_MAGIC2_LE32 + .long 0 @ 8 uncompressed adler32 + .long 0 @ 12 compressed adler32 + .long 0 @ 16 uncompressed len + .long 0 @ 20 compressed len + .long 0 @ 24 original file size + .byte 0 @ 28 filter id + .byte 0 @ 29 filter cto + .byte 0 @ unused + .byte 45 @ 31 header checksum + +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + .arm +SECT(eof): + .text 1 + .long -1; .short eof - _start + diff --git a/src/stub/src/i086-dos16.com.asm b/src/stub/src/i086-dos16.com.asm new file mode 100644 index 00000000..cb63c849 --- /dev/null +++ b/src/stub/src/i086-dos16.com.asm @@ -0,0 +1,102 @@ +; l_com.asm -- loader & decompressor for the dos/com format +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +%define COM 1 +%define CJT16 1 +%define jmps jmp short +%define jmpn jmp near +%include "arch/i086/macros.ash" + + BITS 16 + ORG 0 + SECTION .text + CPU 8086 + +; ============= +; ============= ENTRY POINT +; ============= + +; __COMMAIN1__ +start: + cmp sp, 'SP' + ja mem_ok + int 0x20 +mem_ok: + mov cx, 'CX' ; size of decomp + sizeof (data) + 1 + mov si, 'SI' ; cx + 0x100 + mov di, 'DI' + mov bx, 0x8000 + + std + rep + movsb + cld + + xchg si, di + sub si, byte start - cutpoint +; __COMSUBSI__ +; __COMSBBBP__ + sbb bp, bp +; __COMPSHDI__ + push di +%ifdef __COMCALLT__ + push di +%endif; __COMMAIN2__ + jmpn .1+'JM' +.1: +%include "include/header.ash" + +cutpoint: +; __COMCUTPO__ + + +; ============= +; ============= DECOMPRESSION +; ============= + + CPU 286 +%include "arch/i086/nrv2b_d16.ash" + CPU 8086 + +; ============= +; ============= CALLTRICK +; ============= + + +; ============= + +; __CORETURN__ + ret +eof: +; __COMTHEND__ + section .data + dd -1 + dw eof + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/i086-dos16.exe.asm b/src/stub/src/i086-dos16.exe.asm new file mode 100644 index 00000000..dc889cfe --- /dev/null +++ b/src/stub/src/i086-dos16.exe.asm @@ -0,0 +1,242 @@ +; l_exe.asm -- loader & decompressor for the dos/exe format +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +%define EXE +%define jmps jmp short +%define jmpn jmp near + + BITS 16 + ORG 0 + SECTION .text + CPU 8086 + +; __DEVICEENTRY__ + + dd -1 + dw 0 + dw strategy ; .sys header + dw 0 ; opendos wants this field untouched +original_strategy: + dw 'ST' +strategy: + push cs + push word [cs:original_strategy] + push ax + push bx + push cx + push dx + mov ax, cs + add ax, 'OS' ; calculate normal EXE stack + mov bx, 'OP' + mov cx, ss + mov dx, sp + mov ss, ax ; switch to stack EXE normally has + mov sp, bx + push cx ; save device stack on EXE stack + push dx + push si + push di + push bp + push ds + push es + db 0x72 ; "jc 0xf9" but flag C is 0 => nop +exe_as_device_entry: + stc ; flag C is 1 + pushf + +; ============= +; ============= ENTRY POINT +; ============= +; __EXEENTRY__ +exe_entry: + mov cx, 'CX' ; first_copy_len/2 + mov si, 'SI' ; cx*2-2 + mov di, si + push ds + db 0xa9 +do_copy: + mov ch, 0x80 ; 64 kbyte + mov ax, cs +addaxds: + add ax, 'DS' ; MSB is referenced by the "sub" below + mov ds, ax + add ax, 'ES' + mov es, ax + + std + rep + movsw + cld +; __DEVICESUB__ + sub [byte cs:si + addaxds + 4], byte 0x10 +; __EXESUB__ + sub [byte cs:si + addaxds - exe_entry + 4], byte 0x10 +; __JNCDOCOPY__ + jnc do_copy + xchg ax, dx + scasw + lodsw +%ifdef __EXERELPU__ + push cs +%endif; __EXEMAIN4__ + push cs + push cs + push es + pop ds + pop es + push ss + mov bp, 'BP' ; entry point [0x1,0x10] + mov bx, 'BX' ; 0x800F + 0x10*bp - 0x10 + push bp + retf + +%include "include/header.ash" + +; __EXECUTPO__ + +; ============= +; ============= DECOMPRESSION +; ============= + + CPU 286 +%include "arch/i086/nrv2b_d8.ash" +%include "arch/i086/nrv2d_d8.ash" +%include "arch/i086/nrv2e_d8.ash" + CPU 8086 + +; ============= +; ============= RELOCATION +; ============= +; __EXEMAIN5__ + pop bp +%ifdef __EXERELOC__ +%ifdef __EXEADJUS__ + mov ax, es + sub ah, 0x6 ; MAXRELOCS >> 12 + mov ds, ax +%else; __EXENOADJ__ + push es + pop ds +%endif; __EXERELO1__ + lea si, [di+'RS'] + lodsw + + pop bx + + xchg ax, cx ; number of 0x01 bytes (not exactly) + lodsw + xchg ax, dx ; seg_hi +reloc_0: + lodsw + xchg ax, di + lodsw + add bx, ax + mov es, bx + xor ax, ax +reloc_1: + add di, ax + add [es:di], bp +reloc_2: + lodsb + dec ax + jz reloc_5 + inc ax + jnz reloc_1 +%ifdef __EXEREL9A__ + inc di +reloc_4: + inc di + cmp byte [es:di], 0x9a + jne reloc_4 + cmp [es:di+3], dx + ja reloc_4 + mov al, 3 + jmps reloc_1 +%endif; __EXERELO2__ +reloc_5: + add di, 0xfe +%ifdef __EXEREBIG__ + jc reloc_0 +%endif; __EXERELO3__ + loop reloc_2 +%endif; __EXEMAIN8__ + +; ============= + + pop es + push es + pop ds + +; __DEVICEEND__ + popf + jc loaded_as_exe + pop es + pop ds + pop bp + pop di + pop si + pop bx ; get original device SS:SP + pop ax + mov ss, ax ; switch to device driver stack + mov sp, bx + pop dx + pop cx + pop bx + pop ax + retf ; return to original strategy + +loaded_as_exe: +%ifdef __EXESTACK__ + lea ax, ['SS'+bp] + mov ss, ax +%endif; __EXEDUMMS__ +%ifdef __EXESTASP__ + mov sp, 'SP' +%endif; __EXEDUMMP__ + +; ============= + +%ifdef __EXEJUMPF__ + jmp 'CS':'IP' +%else; __EXERETUR__ +%ifdef __EXERCSPO__ + add bp, 'CS' +%endif; __EXERETIP__ + push bp + mov ax, 'IP' + push ax + retf +%endif; __EXEDUMMZ__ +eof: +; __EXETHEND__ + section .data + dd -1 + dw eof + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/i086-dos16.sys.asm b/src/stub/src/i086-dos16.sys.asm new file mode 100644 index 00000000..ce0ac758 --- /dev/null +++ b/src/stub/src/i086-dos16.sys.asm @@ -0,0 +1,134 @@ +; l_sys.asm -- loader & decompressor for the dos/sys format +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +%define SYS 1 +%define COM 0 +%define CJT16 1 +%define jmps jmp short +%define jmpn jmp near +%include "arch/i086/macros.ash" + + BITS 16 + ORG 0 + SECTION .text + CPU 8086 + +; ============= +; ============= ENTRY POINT +; ============= + +; __SYSMAIN1__ +start: + dd -1 + dw 0 + dw strategy ; .sys header + dw 0 ; opendos wants this field untouched +strategy: +%ifdef __SYSI2861__ + CPU 286 + pusha + CPU 8086 +%else; __SYSI0861__ + push ax + push bx + push cx + push dx + push si + push di + push bp +%endif; __SYSMAIN2__ + mov si, 'SI' + mov di, 'DI' + + mov cx, si ; at the end of the copy si will be 0 + + push es + push ds + pop es + + std + rep + movsb + cld + + mov bx, 0x8000 + + xchg si, di + sub si, byte start - cutpoint +; __SYSSUBSI__ +; __SYSSBBBP__ + sbb bp, bp +%ifdef __SYSCALLT__ + push di +%endif; __SYSMAIN3__ + jmpn .1+'JM' ; jump to the decompressor +.1: +%include "include/header.ash" + +cutpoint: +; __SYSCUTPO__ + +; ============= +; ============= DECOMPRESSION +; ============= + + CPU 286 +%include "arch/i086/nrv2b_d16.ash" + CPU 8086 + +; ============= +; ============= CALLTRICK +; ============= + + +; ============= + +; __SYSMAIN5__ + pop es +%ifdef __SYSI2862__ + CPU 286 + popa + CPU 8086 +%else; __SYSI0862__ + pop bp + pop di + pop si + pop dx + pop cx + pop bx + pop ax +%endif; __SYSJUMP1__ + jmpn eof+'JO' +eof: +; __SYSTHEND__ + section .data + dd -1 + dw eof + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/i386-dos32.djgpp2-stubify.asm b/src/stub/src/i386-dos32.djgpp2-stubify.asm new file mode 100644 index 00000000..3557f1d9 --- /dev/null +++ b/src/stub/src/i386-dos32.djgpp2-stubify.asm @@ -0,0 +1,988 @@ +; Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details +; Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details +; Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details +; Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details +; Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details +; Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details +; -*- asm -*- +; +; KLUDGE-WARNING! +; +; So you say you want to change this file, right? Are you really sure +; that's a good idea? Let me tell you a bit about the pitfalls here: +; +; * Some code runs in protected mode, some in real-mode, some in both. +; * Some code must run on a 8088 without crashing it. +; * Registers and flags may be expected to survive for a long time. +; * The code is optimized for size, not for speed or readability. +; * Some comments are parsed by other programs. +; +; You still want to change it? Oh well, go ahead, but don't come +; crying back saying you weren't warned. +; +;----------------------------------------------------------------------------- +; djgpp extender-less stub loader +; +; (C) Copyright 1993-1995 DJ Delorie +; +; Redistribution and use in source and binary forms are permitted +; provided that: (1) source distributions retain this entire copyright +; notice and comment, (2) distributions including binaries display +; the following acknowledgement: ``This product includes software +; developed by DJ Delorie and contributors to the djgpp project'' +; in the documentation or other materials provided with the distribution +; and in all advertising materials mentioning features or use of this +; software, and (3) binary distributions include information sufficient +; for the binary user to obtain the sources for the binary and utilities +; required to built and use it. Neither the name of DJ Delorie nor the +; names of djgpp's contributors may be used to endorse or promote +; products derived from this software without specific prior written +; permission. +; +; THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +; IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +; +; Revision history: +; +; 93/12/05 DJ Delorie Initial version v2.00, requires DPMI 0.9 +; 94/10/13 CW Sandmann v2.01, accumlated changes: 60K load bug, limits, cwsdpmi, optimization +; 94/10/29 CW Sandmann v2.03, M Welinder changes; cwsdpmi load anywhere, size decrease +; + .copyright "The STUB.EXE stub loader is Copyright (C) 1993-1995 DJ Delorie. " + .copyright "Permission granted to use for any purpose provided this copyright " + .copyright "remains present and unmodified. " + .copyright "This only applies to the stub, and not necessarily the whole program.\n" + .id +; +;----------------------------------------------------------------------------- +; Interface to 32-bit executable: +; +; cs:eip according to COFF header +; ds 32-bit data segment for COFF program +; fs selector for our data segment (fs:0 is stubinfo) +; ss:sp our stack (ss to be freed) +; All unspecified registers have unspecified values in them. +;----------------------------------------------------------------------------- +; This is the stubinfo structure. The presence of this structure +; indicates that the executable is a djgpp v2.00 executable. +; Fields will never be deleted from this structure, only obsoleted. +; + .org 0 ; just in case +stubinfo: +stubinfo_magic: ; char [16] + .db "go32stub, v 2.04" ; version may change, [0..7] won't +stubinfo_size: ; unsigned long + .dd stubinfo_end ; bytes in structure +stubinfo_minstack: ; unsigned long + .dd 0x80000 ; minimum amount of DPMI stack space (512K) +stubinfo_memory_handle: ; unsigned long + .dd 0 ; DPMI memory handle +stubinfo_initial_size: ; unsigned long + .dd 0 ; size of initial segment +stubinfo_minkeep: ; unsigned short + .dw 16384 ; amount of automatic real-mode buffer +stubinfo_ds_selector: ; unsigned short + .dw 0 ; our DS selector (used for transfer buffer) +stubinfo_ds_segment: ; unsigned short + .dw 0 ; our DS segment (used for simulated calls) +stubinfo_psp_selector: ; unsigned short + .dw 0 ; PSP selector +stubinfo_cs_selector: ; unsigned short + .dw 0 ; to be freed +stubinfo_env_size: ; unsigned short + .dw 0 ; number of bytes of environment +stubinfo_basename: ; char [8] + .db 8 .dup 0 ; base name of executable to load (asciiz if < 8) +stubinfo_argv0: ; char [16] + .db 16 .dup 0 ; used ONLY by the application (asciiz if < 16) +stubinfo_dpmi_server: ; char [16] + .db "CWSDPMI.EXE\0\0\0\0\0" ; used by stub to load DPMI server if no DPMI already present + + .align 4 +stubinfo_end: + +;----------------------------------------------------------------------------- +; First, set up our memory and stack environment + + .start ; execution begins here + push cs + pop ds + mov [stubinfo_ds_segment], ds + + mov [psp_segment], es ; save the PSP segment + cld + +;----------------------------------------------------------------------------- +; Check that we have DOS 3.00 or later. (We need this because earlier +; versions don't supply argv[0] to us and will scrog registers on dpmi exec). + mov ah, 0x30 + int 0x21 + cmp al, 3 + jae dos3ok + mov al, 109 + mov dx, msg_bad_dos + jmpl error +dos3ok: + mov [dos_major], al + mov si, stubinfo_minkeep + +;----------------------------------------------------------------------------- +; Resize memory in case we need to exec a DPMI server + +resize_again: + mov ax, [si] ; si=&stubinfo_minkeep + or ax, ax + jnz @f1 +; mov ax,0xfe00 ; 0 was probably 64k, so max it! (mod 512) + mov ah,0xfe ; al already 0 +@f1: + mov bx, end_of_memory ; does not include PSP + cmp bx, ax ; is our program big enough to hold it? + jae @f1 + mov bx, ax +@f1: + mov [si], bx ; si=&stubinfo_minkeep store for reference + inc bh ; add 256 bytes for PSP + mov cx, 0xff04 ; 0xff is for below + shr bx, cl ; bytes to paragraphs + + mov ah, 0x4a ; ES = PSP segment from above + int 0x21 ; resize our memory block + jnc @f1 ; did it work? + shl bx,cl ; calculate smaller [keep] value + dec bh + mov [si], bx ; si=&stubinfo_minkeep + jmp resize_again ; and try again +@f1: + +;----------------------------------------------------------------------------- +; Scan environment for "PATH=" and the stub's full name after environment + + mov es, es:[0x2c] ; get environment segment + xor di, di ; begin search for NUL/NUL (di = 0) +; mov cx, 0xff04 ; effectively `infinite' loop + xor al, al + .db 0xa9 ; "test ax,...." -- skip 2 bytes +scan_environment: + repne + scasb ; search for NUL + cmpw es:[di], 0x4150 ; "PA" + jne not_path + scasw + cmpw es:[di], 0x4854 ; "TH" + jne not_path + scasw + cmpb es:[di], '=' + jne not_path + inc di ; Point to PATH contents + mov [path_off], di ; save for later + dec di ; in case the PATH is empty +not_path: + scasb + jne scan_environment ; no, still environment + scasw ; adjust pointer to point to prog name + +;; When we are spawned from a program which has more than 20 handles in use, +;; all the handles passed to us by DOS are taken (since only the first 20 +;; handles are inherited), and opening the .exe file will fail. +;; Therefore, we forcefully close handles 18 and 19, to make sure at least two +;; handles are available. + + mov ah, 0x3e + mov bx, 19 + int 0x21 ; don't care about errors + mov ah, 0x3e + mov bx, 18 + int 0x21 ; don't care about errors + +;----------------------------------------------------------------------------- +; Get DPMI information before doing anything 386-specific + + push es + push di + xor cx, cx ; flag for load attempt set cx = 0 + jz @f2 ; We always jump, shorter than jmp +@b1: + mov al, 110 + mov dx, msg_no_dpmi + jmpl error +@b2: + or cx, cx + jnz @b1 ; we already tried load once before + inc cx + call load_dpmi + jc @b1 +@f2: + mov ax, 0x1687 ; get DPMI entry point + int 0x2f + or ax, ax + jnz @b2 ; if 0 then it's there + and bl, 1 ; 32 bit capable? + jz @b2 +@f3: + mov [modesw], di ; store the DPMI entry point + mov [modesw+2], es + mov [modesw_mem], si + pop di + pop es + +;----------------------------------------------------------------------------- +; Now, find the name of the program file we are supposed to load. + +; xor ah, ah ; termination character (set above!) + call store_env_string ; copy it to loadname, set bx + + mov [stubinfo_env_size], di + mov [loadname_nul], si ; remember nul so we can change it to $ + cmpb stubinfo_basename[0], 0 + je no_symlink + +;----------------------------------------------------------------------------- +; Replace the stub's file name with the link's name after the directory + + mov cx, 8 ; max length of basename + mov di, stubinfo_basename ; pointer to new basename +@b1: + mov al, [di] ; get next character + inc di + or al, al ; end of basename? + je @f1 + mov [bx], al ; store character + inc bx + loop @b1 ; eight characters? +@f1: + movd [bx], 0x4558452e ; append ".EXE" + add bx, 4 + movb [bx], 0 ; null terminate + mov [loadname_nul], bx ; remember nul so we can change it to $ + +no_symlink: + +;----------------------------------------------------------------------------- +; Load the COFF information from the file + + mov ax, 0x3d00 ; open file for reading + mov dx, loadname + int 0x21 + jcl error_no_progfile ; do rest of error message + +@f1: + mov [program_file], ax ; store for future reference + + mov bx, ax + mov cx, exe_header_length + mov dx, exe_header + mov ah, 0x3f ; read EXE header + int 0x21 + + xor dx, dx ; dx = 0 + xor cx, cx ; offset of COFF header + + mov ax, [exe_magic] + cmp ax, 0x014c ; COFF? + je file_is_just_coff + cmp ax, 0x5a4d ; EXE magic value + jnel error_not_exe + + mov dx, [exe_sectors] + shl dx, 9 ; 512 bytes per sector + mov bx, [exe_bytes_last_page] + or bx, bx ; is bx = 0 ? + je @f1 + sub dh, 2 ; dx -= 512 + add dx, bx +@f1: + +file_is_just_coff: ; cx:dx is offset + mov coff_offset[0], dx + mov coff_offset[2], cx + mov ax, 0x4200 ; seek from beginning + mov bx, [program_file] + int 0x21 + + mov cx, coff_header_length + mov dx, coff_header + mov ah, 0x3f ; read file (bx = handle) + int 0x21 + + cmp ax, coff_header_length + jne @f2 + cmpw coff_header[coff_magic], 0x014c +@f2: + jnel error_not_coff + + mov eax, aout_header[aout_entry] + mov [start_eip], eax + + mov ecx, [coff_offset] + + mov eax, text_section[s_scnptr] + add eax, ecx + mov [text_foffset], eax + + add ecx, data_section[s_scnptr] ; Ok to destroy ecx now: last use. + mov [data_foffset], ecx + + mov ebx, bss_section[s_vaddr] + add ebx, bss_section[s_size] + mov eax, 0x00010001 + cmp ebx, eax + jae @f1 + mov ebx, eax ; ensure 32-bit segment +@f1: + add ebx, 0x0000ffff ; ensure 64K rounded + xor bx, bx ; clear rounded bits + mov [stubinfo_initial_size], ebx + +;----------------------------------------------------------------------------- +; Set up for the DPMI environment + + call include_umb + mov bx, [modesw_mem] + or bx, bx + jz no_dos_alloc + + mov ah, 0x48 ; allocate memory for the DPMI host + int 0x21 + jcl error_no_dos_memory_umb + mov es, ax + +no_dos_alloc: + call restore_umb + mov ax, 1 ; indicates a 32-bit client + callf [modesw] ; enter protected mode + + jcl error_in_modesw + +;----------------------------------------------------------------------------- +; We're in protected mode at this point. + + mov [stubinfo_psp_selector], es + mov [stubinfo_cs_selector], cs + mov ax, ds + mov [stubinfo_ds_selector], ax + mov es, ax + + xor ax, ax ; AX = 0x0000 + mov cx, 1 + int 0x31 ; allocate LDT descriptor + jc @f2 + mov [client_cs], ax + + xor ax, ax ; AX = 0x0000 +; mov cx, 1 ; already set above + int 0x31 ; allocate LDT descriptor +@f2: + jcl perror_no_selectors + mov [client_ds], ax + +; Try getting a DPMI 1.0 memory block first, then try DPMI 0.9 +; Note: This causes the Borland Windows VxD to puke, commented for now with ;* +;* mov ax, 0x0504 +;* xor ebx, ebx ; don't specify linear address + mov ecx, stubinfo_initial_size[0] +;* mov edx, 1 ; allocate committed pages +;* int 0x31 ; allocate memory block +;* jc try_old_dpmi_alloc +;* mov client_memory[0], ebx +;* mov stubinfo_memory_handle[0], esi +;* jmp got_dpmi_memory +try_old_dpmi_alloc: + mov ax, 0x0501 + mov bx, stubinfo_initial_size[2] +; mov cx, stubinfo_initial_size[0] ;Set above + int 0x31 ; allocate memory block + jcl perror_no_dpmi_memory + mov client_memory[2], bx + mov client_memory[0], cx + mov stubinfo_memory_handle[2], si + mov stubinfo_memory_handle[0], di +got_dpmi_memory: + + mov ax, 0x0007 + mov bx, [client_cs] ; initialize client CS + mov cx, client_memory[2] + mov dx, client_memory[0] + int 0x31 ; set segment base address + + mov ax, 0x0009 +; mov bx, [client_cs] ; already set above + mov cx, cs ; get CPL + and cx, 0x0003 + shl cx, 5 + push cx ; save shifted CPL for below + or cx, 0xc09b ; 32-bit, big, code, non-conforming, readable + int 0x31 ; set descriptor access rights + + mov ax, 0x0008 +; mov bx, [client_cs] ; already set above + mov cx, stubinfo_initial_size[2] + dec cx + mov dx, 0xffff + int 0x31 ; set segment limit + + mov ax, 0x0007 + mov bx, [client_ds] ; initialize client DS + mov cx, client_memory[2] + mov dx, client_memory[0] + int 0x31 ; set segment base address + + mov ax, 0x0009 +; mov bx, [client_ds] ; already set above + pop cx ; shifted CPL from above + or cx, 0xc093 ; 32-bit, big, data, r/w, expand-up + int 0x31 ; set descriptor access rights + + mov ax, 0x0008 +; mov bx, [client_ds] ; already set above + mov cx, stubinfo_initial_size[2] + dec cx + mov dx, 0xffff + int 0x31 ; set segment limit + +;----------------------------------------------------------------------------- +; Load the program data + + mov ax, 0x0100 + mov bx, 0x0f00 ; 60K DOS block size + int 0x31 ; allocate DOS memory + jnc @f1 + cmp ax, 0x0008 + jnel perror_no_dos_memory + mov ax, 0x0100 ; try again with new value in bx + int 0x31 ; allocate DOS memory + jcl perror_no_dos_memory +@f1: + mov [dos_block_seg], ax + mov [dos_block_sel], dx + shl bx, 4 ; paragraphs to bytes + mov [dos_block_size], bx + + mov esi, [text_foffset] ; load text section + mov edi, text_section[s_vaddr] + mov ecx, text_section[s_size] + call read_section + + mov esi, [data_foffset] ; load data section + mov edi, data_section[s_vaddr] + mov ecx, data_section[s_size] + call read_section + + mov es, [client_ds] ; clear the BSS section + mov edi, bss_section[s_vaddr] + mov ecx, bss_section[s_size] + xor eax,eax + shr ecx,2 + .addrsize + rep + stosd + + mov ah,0x3e + mov bx, [program_file] + int 0x21 ; close the file + + mov ax, 0x0101 + mov dx, [dos_block_sel] + int 0x31 ; free up the DOS memory + + push ds + pop fs + mov ds, [client_ds] + .opsize + jmpf fs:[start_eip] ; start program + +;----------------------------------------------------------------------------- +; Read a section from the program file + +read_section: + mov eax, esi ; sector alignment by default + and eax, 0x1ff + add ecx, eax + sub si, ax ; sector align disk offset (can't carry) + sub edi, eax ; memory maybe not aligned! + + mov [read_size], ecx ; store for later reference + mov [read_soffset], edi + + call zero_regs + mov dpmi_regs[dr_dx], si ; store file offset + shr esi, 16 + mov dpmi_regs[dr_cx], si + mov bx, [program_file] + mov dpmi_regs[dr_bx], bx + movw dpmi_regs[dr_ax], 0x4200 + call pm_dos ; seek to start of data + +; Note, handle set above + mov ax, [dos_block_seg] + mov dpmi_regs[dr_ds], ax + movw dpmi_regs[dr_dx], 0 ; store file offset +read_loop: + movb dpmi_regs[dr_ah], 0x3f + mov ax, read_size[2] ; see how many bytes to read + or ax, ax + jnz read_too_big + mov ax, read_size[0] + cmp ax, [dos_block_size] + jna read_size_in_ax ; jna shorter than jmp +read_too_big: + mov ax, [dos_block_size] +read_size_in_ax: + mov dpmi_regs[dr_cx], ax + call pm_dos ; read the next chunk of file data + + xor ecx, ecx + mov cx, dpmi_regs[dr_ax] ; get byte count + mov edi, [read_soffset] ; adjust pointers + add [read_soffset], ecx + sub [read_size], ecx + + xor esi, esi ; esi=0 offset for copy data + shr cx, 2 ; ecx < 64K + push ds + push es + mov es, [client_ds] + mov ds, [dos_block_sel] + .addrsize + rep + movsd + pop es + pop ds + + add ecx, [read_size] ; ecx zero from the rep movsd + jnz read_loop + + ret + +;----------------------------------------------------------------------------- +; Routine to check al for delimiter + +test_delim: + cmp al, ':' ; watch for file name part + je @f3 + cmp al, '/' + je @f3 + cmp al, '\\' +@f3: + ret + +;----------------------------------------------------------------------------- +; Copy string from environment to loadname. +; On entry: di = environment offset +; ah = termination character (null also does) +; On exit: bx = pointer to one character after last observed file delimiter +; di = pointer to one character after last copied +; si = pointer to the copied termination character +; al = terminating character + +store_env_string: + mov si, loadname ; pointer to buffer + mov bx, si ; in case no delimiters +@b1: + mov al, es:[di] ; copy a character to buffer + inc di + mov [si], al + cmp al, ah ; end of file name? + je @f1 + or al, al ; end of file name? + je @f1 + inc si + call test_delim + jne @b1 + mov bx, si ; remember pointer to first char of + je @b1 ; next name component (shorter than jmp) +@f1: + ret + +;----------------------------------------------------------------------------- +; Most errors come here, early ones jump direct (8088 instructions) + +error_no_progfile: + mov al, 102 + mov dx, msg_no_progfile + jmp error_fn + +error_not_exe: + mov al, 103 + mov dx, msg_not_exe + jmp error_fn + +error_not_coff: + mov al, 104 + mov dx, msg_not_coff +; jmp error_fn + +error_fn: + push dx + mov bx, [loadname_nul] ; error, print file name + movb [bx], '$' + mov bx, loadname + jmp @f1 + +error_no_dos_memory_umb: + call restore_umb +error_no_dos_memory: + mov al, 105 + mov dx, msg_no_dos_memory + jmp error + +error_in_modesw: + mov al, 106 + mov dx, msg_error_in_modesw + jmp error + +perror_no_selectors: + mov al, 107 + mov dx, msg_no_selectors + jmp error + +perror_no_dpmi_memory: + mov al, 108 + mov dx, msg_no_dpmi_memory + jmp error + +perror_no_dos_memory: + mov al, 105 + mov dx, msg_no_dos_memory +; jmp error + +error: + push dx + mov bx, err_string +@f1: + call printstr + pop bx + call printstr +exit: + mov bx, crlfdollar + call printstr + mov ah, 0x4c ; error exit - exit code is in al + int 0x21 + +printstr1: + inc bx + push ax ; have to preserve al set by error call + mov ah, 2 + int 0x21 + pop ax ; restore ax (John A.) +printstr: + mov dl, [bx] + cmp dl, '$' + jne printstr1 + ret + +crlfdollar: + .db 13,10,'$' +;----------------------------------------------------------------------------- +; DPMI utility functions + +zero_regs: + push ax + push cx + push di + xor ax, ax + mov di, dpmi_regs + mov cx, 0x19 + rep + stosw + pop di + pop cx + pop ax + ret + +pm_dos: + mov ax, 0x0300 ; simulate interrupt + mov bx, 0x0021 ; int 21, no flags + xor cx, cx ; cx = 0x0000 (copy no args) + mov edi, dpmi_regs + int 0x31 + ret + +;----------------------------------------------------------------------------- +; load DPMI server if not present +; First check directory from which stub is loaded, then path, then default +; On entry di points to image name + +path_off: + .dw 0 ; If stays zero, no path + +load_dpmi: + xor ah, ah ; Copy until this character (=0) + call store_env_string ; copy stub image to "loadname" + mov si, bx ; remove name so we can add DPMI name + mov di, [path_off] ; Pointer to path contents (next try) + jmp @f2 +loadloop: + mov ah, ';' ; Copy until this character + call store_env_string ; to "loadname" + or al,al ; Check terminating character + jne @f1 ; If ';', continue + dec di ; else point at null for next pass. +@f1: + cmp si, loadname ; anything there? + je do_exec ; final try (no path) let it return + mov al, [si-1] + call test_delim ; is final character a path delimiter + je @f2 + movb [si], '\\' ; no, add separator between path & name + inc si +@f2: + call do_exec ; copy our name to string and try load + jc loadloop + ret + +;----------------------------------------------------------------------------- +; add the string CWSDPMI to path ending + +do_exec: + call include_umb + mov bx, stubinfo_dpmi_server +@b1: + mov al, [bx] + mov [si], al + inc bx + inc si + or al, al + jne @b1 +; movw [si], 0x0a0d ;debug +; movb [si+2], '$' ;debug + + push es ; Save in case of failure + push di + +;memory saving - use dpmi_regs as a temporary parameter block + push ds + pop es ;zero_regs needs es set + call zero_regs + mov bx, dpmi_regs + mov [bx+4], ds ;segment of command tail + mov [bx+2], bx ;offset (point to zero) + + mov dx, loadname +; mov ah, 9 ;debug +; int 0x21 ;debug + mov ax, 0x4b00 ;Do program exec + int 0x21 + pop di + pop es + jc @f1 ;carry set if exec failed + + mov ah, 0x4d ;get return code + int 0x21 + sub ax, 0x300 ;ah=3 TSR, al=code (success) + neg ax ;CY, if not originally 0x300 +@f1: + jmp restore_umb ;called func. return for us. + +;----------------------------------------------------------------------------- +; Make upper memory allocatable. Clobbers Ax and Bx. + +include_umb: + cmpb [dos_major], 5 ; Won't work before dos 5 + jb @f1 + mov ax, 0x5800 ; get allocation strategy + int 0x21 + mov [old_strategy],al + mov ax, 0x5802 ; Get UMB status. + int 0x21 + mov [old_umb],al + mov ax, 0x5801 + mov bx, 0x0080 ; first fit, first high then low + int 0x21 + mov ax, 0x5803 + mov bx, 0x0001 ; include UMB in memory chain + int 0x21 +@f1: + ret + +; Restore upper memory status. All registers and flags preserved. + +restore_umb: + pushf + cmpb [dos_major], 5 ; Won't work before dos 5 + jb @f1 + push ax + push bx + mov ax, 0x5803 ; restore UMB status. + mov bl,[old_umb] + xor bh, bh + int 0x21 + mov ax, 0x5801 ; restore allocation strategy + mov bl,[old_strategy] + xor bh, bh + int 0x21 + pop bx + pop ax +@f1: + popf + ret + +;----------------------------------------------------------------------------- +; Stored Data +err_string: + .db "Load error: $" +msg_no_progfile: + .db ": can't open$" +msg_not_exe: + .db ": not EXE$" +msg_not_coff: + .db ": not COFF (Check for viruses)$" +msg_no_dpmi: + .db "no DPMI - Get csdpmi*b.zip$" +msg_no_dos_memory: + .db "no DOS memory$" +msg_bad_dos: + .db "need DOS 3$" +msg_error_in_modesw: + .db "can't switch mode$" +msg_no_selectors: + .db "no DPMI selectors$" +msg_no_dpmi_memory: + .db "no DPMI memory$" + +;----------------------------------------------------------------------------- +; Unstored Data, available during and after mode switch + +last_generated_byte: + + .align 512 ; Align ourselves to a sector + ; boundary for startup speed. + .bss ; data after this isn't in file. + +modesw: ; address of DPMI mode switch + .dd 0 +modesw_mem: ; amount of memory DPMI needs + .dw 0 + +program_file: ; file ID of program data + .dw 0 + +text_foffset: ; offset in file + .dd 0 + +data_foffset: ; offset in file + .dd 0 + +start_eip: ; EIP value to start at + .dd 0 +client_cs: ; must follow start_eip + .dw 0 +client_ds: + .dw 0 + +client_memory: + .dd 0 + +dos_block_seg: + .dw 0 +dos_block_sel: + .dw 0 +dos_block_size: + .dw 0 + +read_soffset: + .dd 0 +read_size: + .dd 0 + +dpmi_regs: + .db 0x32 .dup 0 +dr_edi = 0x00 +dr_di = 0x00 +dr_esi = 0x04 +dr_si = 0x04 +dr_ebp = 0x08 +dr_bp = 0x08 +dr_ebx = 0x10 +dr_bx = 0x10 +dr_bl = 0x10 +dr_bh = 0x11 +dr_edx = 0x14 +dr_dx = 0x14 +dr_dl = 0x14 +dr_dh = 0x15 +dr_ecx = 0x18 +dr_cx = 0x18 +dr_cl = 0x18 +dr_ch = 0x19 +dr_eax = 0x1c +dr_ax = 0x1c +dr_al = 0x1c +dr_ah = 0x1d +dr_efl = 0x20 +dr_es = 0x22 +dr_ds = 0x24 +dr_fs = 0x26 +dr_gs = 0x28 +dr_ip = 0x2a +dr_cs = 0x2c +dr_sp = 0x2e +dr_ss = 0x30 + +;----------------------------------------------------------------------------- + + .align 16 ; so that stack ends on para boundary + .dw 128 .dup 0 + .stack + +;----------------------------------------------------------------------------- +; At one time real mode only data. Header stuff now used during image load. + +psp_segment: + .dw 0 + +loadname_nul: ; offset of NUL so it can become '$' + .dw 0 +loadname: ; name of program file to load, if it + .db 81 .dup 0 ; gets really long ok to overwrite next + +exe_header: ; loaded from front of loadfile +exe_magic: + .dw 0 +exe_bytes_last_page: + .dw 0 +exe_sectors: + .dw 0 +exe_header_length = . - exe_header + +coff_offset: + .dd 0 ; from start of file + +coff_header: ; loaded from after stub + .db 20 .dup 0 +aout_header: + .db 28 .dup 0 +text_section: + .db 40 .dup 0 +data_section: + .db 40 .dup 0 +bss_section: + .db 40 .dup 0 +coff_header_length = . - coff_header + +old_strategy: + .db 0 +old_umb: + .db 0 + +dos_major: + .db 0 + + .align 16 ; Align ourselves to a paragraph +end_of_memory: ; resize is done early so must keep all + +;----------------------------------------------------------------------------- +; structure definitions +; + +coff_magic = 0 ; from coff header + +aout_entry = 16 ; from aout header + +s_paddr = 8 ; from section headers +s_vaddr = 12 +s_size = 16 +s_scnptr = 20 + + diff --git a/src/stub/src/i386-dos32.djgpp2.asm b/src/stub/src/i386-dos32.djgpp2.asm new file mode 100644 index 00000000..e619c83b --- /dev/null +++ b/src/stub/src/i386-dos32.djgpp2.asm @@ -0,0 +1,97 @@ +; l_djgpp2.asm -- loader & decompressor for the djgpp2/coff format +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +%define jmps jmp short +%define jmpn jmp near +%include "arch/i386/macros.ash" + + BITS 32 + SECTION .text + ORG 0 + CPU 386 + +; ============= +; ============= ENTRY POINT +; ============= + +; __DJ2MAIN1__ +start: + push ds + pop es + + mov esi, 'INPP' ; input pointer + mov edi, 'OUTP' ; output pointer +%ifdef __DJCALLT1__ + push edi +%endif; __DJ2MAIN2__ +; cld ; the stub sets this + or ebp, byte -1 + +; ============= +; ============= DECOMPRESSION +; ============= + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" + +; ============= + +; __DJ2BSS00__ + mov ecx, 'BSSL' + rep + stosd +%ifdef __DJCALLT2__ + +; ============= +; ============= CALLTRICK +; ============= + + pop edi + cjt32 0 +%endif; __DJRETURN__ + +; ============= + + push dword 'ENTR' ; entry point + ret + +; because of a feature of the djgpp loader, the size of this stub must be +; a multiple of 4 and as the upx decompressor depends on the fact that +; the compressed data stream begins just after the header, i must +; use an alignment here - ML + align 4 +%include "include/header.ash" +eof: +; __DJTHEEND__ + section .data + dd -1 + dw eof + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/i386-dos32.tmt.asm b/src/stub/src/i386-dos32.tmt.asm new file mode 100644 index 00000000..fc36131d --- /dev/null +++ b/src/stub/src/i386-dos32.tmt.asm @@ -0,0 +1,109 @@ +; l_tmt.asm -- loader & decompressor for the tmt/adam format +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +%define jmps jmp short +%define jmpn jmp near +%include "arch/i386/macros.ash" + + BITS 32 + SECTION .text + ORG 0 + CPU 386 + +; ============= +; ============= ENTRY POINT +; ============= + +start: +; __TMTMAIN1__ + mov edi, 0 ; relocation offset + push edi + lea esi, [edi + 'ESI0'] + lea edi, [edi + 'EDI0'] + mov ecx, 'ECX0' + + std + rep + movsb + cld + + lea esi, [edi + 1] + pop edi + or ebp, byte -1 + push edi +%ifdef __TMTCALT1__ + push edi +%endif; __TMTMAIN2__ + jmpn .1+'JMPD' +.1: +%include "include/header.ash" + +cutpoint: +; __TMTCUTPO__ + +; ============= +; ============= DECOMPRESSION +; ============= + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" + +; __TMTMAIN5__ + pop ebp + mov esi, edi + sub esi, [edi - 4] + +; ============= +; ============= CALLTRICK +; ============= + +%ifdef __TMTCALT2__ + pop edi + cjt32 ebp +%endif; __TMTRELOC__ + +; ============= +; ============= RELOCATION +; ============= + + lea edi, [ebp - 4] + reloc32 esi, edi, ebp + +; ============= +; __TMTJUMP1__ + jmpn .1+'JMPO' +.1: +eof: +; __TMTHEEND__ + section .data + dd -1 + dw eof + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/i386-dos32.watcom.le.asm b/src/stub/src/i386-dos32.watcom.le.asm new file mode 100644 index 00000000..3cc5ae29 --- /dev/null +++ b/src/stub/src/i386-dos32.watcom.le.asm @@ -0,0 +1,143 @@ +; l_wcle.asm -- loader & decompressor for the watcom/le format +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +%define jmps jmp short +%define jmpn jmp near +%include "arch/i386/macros.ash" + + BITS 32 + SECTION .text + ORG 0 + CPU 386 + +; ============= +; ============= ENTRY POINT +; ============= + +start: +; __WCLEMAIN__ + mov edi, 'alib' ; address of obj#1:0 (filled by a fixup record) + +; The following hack fools the lame protection of dos4g/w, which expects the +; 'WATCOM' string somewhere in the first 18 bytes after the entry point +; I use this imul thingy, because it's 1 byte shorter than a jump ;-) +; ... and "alibiWATCOM" looks cool + db 'iWATCOM' ; imul edx,[edi+0x41],'TCOM' + + push es + push ds + pop es + push edi + + lea esi, [edi + 'ESI0'] + lea edi, [edi + 'EDI0'] + mov ecx, 'ECX0' + + std + rep + movsd + cld + + lea esi, [edi + 4] + pop edi + or ebp, byte -1 + push edi + jmpn .1+'JMPD' +.1: +%include "include/header.ash" + +cutpoint: +; __WCLECUTP__ + +; ============= +; ============= DECOMPRESSION +; ============= + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" + +; ============= + +; __WCLEMAI2__ + pop ebp + push esi + lea esi, [ebp + 'RELO'] + push esi + +; ============= +; ============= CALLTRICK +; ============= + +%ifdef __WCALLTRI__ +%ifdef __WCCTTPOS__ + lea edi, [ebp + 'TEXV'] +%else; __WCCTTNUL__ + mov edi, ebp +%endif; __WCALLTR1__ + cjt32 ebp +%endif; __WCDUMMY1__ + +; ============= +; ============= RELOCATION +; ============= + +%ifdef __WCRELOC1__ + lea edi, [ebp - 4] + reloc32 esi, edi, ebp +; eax = 0 +%endif; __WCDUMMY2__ + +%ifdef __WCRELSEL__ + call esi ; selector fixup code (modifies bx) +%endif; __WCLEMAI4__ + +; ============= + + pop edi + pop ecx + sub ecx, edi + shr ecx, 2 + rep + stosd ; clear dirty memory + pop es + lea esp, [ebp + 'ESP0'] + + jmpn .1+'JMPO' +.1: + +; ============= + +eof: +; __WCTHEEND__ + section .data + dd -1 + dw eof + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/i386-linux.elf-entry.asm b/src/stub/src/i386-linux.elf-entry.asm new file mode 100644 index 00000000..e726bed8 --- /dev/null +++ b/src/stub/src/i386-linux.elf-entry.asm @@ -0,0 +1,221 @@ +; l_lx_elf86.asm -- Linux program entry point & decompressor (Elf binary) +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; Copyright (C) 2000-2004 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 +; +; +; John F. Reiser +; +; + + + BITS 32 + SECTION .text + CPU 386 + +%define jmps jmp short +%define jmpn jmp near + +; /************************************************************************* +; // program entry point +; // see glibc/sysdeps/i386/elf/start.S +; **************************************************************************/ + +GLOBAL _start +;__LEXEC000__ +_start: +;;;; int3 +;; 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. +;; Invoke gdb, and give a 'run' command. Define a single-step macro such as +;; define g +;; stepi +;; x/i $pc +;; end +;; and a step-over macro such as +;; define h +;; x/2i $pc +;; tbreak *$_ +;; continue +;; x/i $pc +;; end +;; Step through the code; remember that repeats the previous command. +;; + call main ; push address of decompress subroutine +decompress: + +; /************************************************************************* +; // C callable decompressor +; **************************************************************************/ + +%define INP dword [esp+8*4+8] +%define INS dword [esp+8*4+12] +%define OUTP dword [esp+8*4+16] +%define OUTS dword [esp+8*4+20] + +;__LEXEC009__ + ;; empty section for commonality with l_lx_exec86.asm +;__LEXEC010__ + pusha + push byte '?' ; cto8 (sign extension does not matter) + ; cld + + mov esi, INP + mov edi, OUTP + + or ebp, byte -1 +;;; align 8 + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" +%include "arch/i386/macros.ash" + cjt32 0 + +;__LEXEC015__ + ; eax is 0 from decompressor code + ;xor eax, eax ; return code + +; check compressed size + mov edx, INP + add edx, INS + cmp esi, edx + jz .ok + dec eax +.ok: + +; write back the uncompressed size + sub edi, OUTP + mov edx, OUTS + mov [edx], edi + + pop edx ; cto8 + + mov [7*4 + esp], eax + popa + ret + + ctojr32 + ckt32 edi, dl +;__LEXEC017__ + popa + ret + +;__LEXEC020__ + +%define PAGE_SIZE ( 1<<12) + +%define MAP_FIXED 0x10 +%define MAP_PRIVATE 0x02 +%define MAP_ANONYMOUS 0x20 +%define PROT_READ 1 +%define PROT_WRITE 2 +%define PROT_EXEC 4 +%define __NR_mmap 90 +%define szElf32_Ehdr 0x34 +%define p_memsz 5*4 + +%define __NR_write 4 +%define __NR_exit 1 + +msg_SELinux: + push byte L71 - L70 + pop edx ; length + call L71 +L70: + db "PROT_EXEC|PROT_WRITE failed.",10 +L71: + pop ecx ; message text + push byte 2 ; fd stderr + pop ebx + push byte __NR_write + pop eax + int 0x80 +die: + mov bl, byte 127 ; only low 7 bits matter! + push byte __NR_exit + pop eax ; write to stderr could fail, leaving eax as -EBADF etc. + int 0x80 + +; Decompress the rest of this loader, and jump to it +unfold: + pop esi ; &{ b_info:{sz_unc, sz_cpr, 4{byte}}, compressed_data...} + + lea eax, [ebp - (4+ decompress - _start)] ; 4: sizeof(int) + sub eax, [eax] ; %eax= &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), +; 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 we must round up here, instead of pre-rounding .p_memsz. + add eax, [p_memsz + szElf32_Ehdr + eax] ; address after .text + add eax, PAGE_SIZE -1 + and eax, -PAGE_SIZE + + push eax ; destination for 'ret' + + ; mmap a page to hold the decompressed fold_elf86 + xor ecx, ecx ; %ecx= 0 + ; MAP_ANONYMOUS ==>offset is ignored, so do not push! + ; push ecx ; offset + push byte -1 ; *BSD demands -1==fd for mmap(,,,MAP_ANON,,) + push byte MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS + mov ch, PAGE_SIZE >> 8 ; %ecx= PAGE_SIZE + push byte PROT_READ | PROT_WRITE | PROT_EXEC + push ecx ; length + push eax ; destination + mov ebx, esp ; address of parameter vector for __NR_mmap + push byte __NR_mmap + pop eax + int 0x80 ; changes only %eax; %edx is live + test eax,eax + js msg_SELinux + xchg eax, edx ; %edx= page after .text; %eax= &Elf32_Ehdr of this program + xchg eax, ebx ; %ebx= &Elf32_Ehdr of this program + + cld + lodsd + push eax ; sz_uncompressed (junk, actually) + push esp ; &dstlen + push edx ; &dst + lodsd + push eax ; sz_compressed + lodsd ; last 4 bytes of b_info + push esi ; &compressed_data + call ebp ; decompress(&src, srclen, &dst, &dstlen) + add esp, byte (4+1 + 6-1)*4 ; (4+1) args to decompress, (6-1) args to mmap + ret ; &destination +main: + pop ebp ; &decompress + call unfold + ; compressed fold_elf86 follows +eof: +; __XTHEENDX__ + section .data + dd -1 + dw eof + +; vi:ts=8:et:nowrap + diff --git a/src/stub/src/i386-linux.elf-fold.asm b/src/stub/src/i386-linux.elf-fold.asm new file mode 100644 index 00000000..34e3b49c --- /dev/null +++ b/src/stub/src/i386-linux.elf-fold.asm @@ -0,0 +1,212 @@ +; fold_elf86.asm -- linkage to C code to process Elf binary +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 2000-2004 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 +; +; +; John F. Reiser +; +; + + + BITS 32 + SECTION .text + CPU 386 + +%define PAGE_SIZE ( 1<<12) +%define szElf32_Ehdr 0x34 +%define szElf32_Phdr 8*4 +%define e_type 16 +%define e_entry (16 + 2*2 + 4) +%define p_memsz 5*4 +%define szb_info 12 +%define szl_info 12 +%define szp_info 12 +%define a_type 0 +%define a_val 4 +%define sz_auxv 8 + +%define __NR_munmap 91 + +;; control just falls through, after this part and compiled C code +;; are uncompressed. + +fold_begin: ; enter: %ebx= &Elf32_Ehdr of this program + ; patchLoader will modify to be + ; dword sz_uncompressed, sz_compressed + ; byte compressed_data... + +; ld-linux.so.2 depends on AT_PHDR and AT_ENTRY, for instance. +; Move argc,argv,envp down to make room for Elf_auxv table. +; Linux kernel 2.4.2 and earlier give only AT_HWCAP and AT_PLATFORM +; because we have no PT_INTERP. Linux kernel 2.4.5 (and later?) +; give not quite everything. It is simpler and smaller code for us +; to generate a "complete" table where Elf_auxv[k -1].a_type = k. +; On second thought, that wastes a lot of stack space (the entire kernel +; auxv, plus those slots that remain empty anyway). So try for minimal +; space on stack, without too much code, by doing it serially. + +%define AT_NULL 0 +%define AT_IGNORE 1 +%define AT_PHDR 3 +%define AT_PHENT 4 +%define AT_PHNUM 5 +%define AT_PAGESZ 6 +%define AT_ENTRY 9 + +%define ET_DYN 3 + + sub ecx, ecx + mov edx, (1< + + John F. Reiser + + */ + + +#include "include/linux.h" + + +/************************************************************************* +// configuration section +**************************************************************************/ + +// In order to make it much easier to move this code at runtime and execute +// it at an address different from it load address: there must be no +// static data, and no string constants. + +#if 1 /*{*/ +#define DPRINTF(a) /* empty: no debug drivel */ +#else /*}{*/ +#include "stdarg.h" + +static int +unsimal(unsigned x, char *ptr, int n) +{ + if (10<=x) { + n = unsimal(x/10, ptr, n); + x %= 10; + } + ptr[n] = '0' + x; + return 1+ n; +} + +static int +decimal(int x, char *ptr, int n) +{ + if (x < 0) { + *ptr++ = '-'; ++n; + x = -x; + } + return unsimal(x, ptr, n); +} + +extern char const *STR_hex(); + +static int +heximal(unsigned x, char *ptr, int n) +{ + if (16<=x) { + n = heximal(x>>4, ptr, n); + x &= 0xf; + } + ptr[n] = STR_hex()[x]; + return 1+ n; +} + + +#define DPRINTF(a) dprintf a +extern char const *STR_0x(); +extern char const *STR_xread(); +extern char const *STR_unpackExtent(); +extern char const *STR_make_hatch_arm(); +extern char const *STR_auxv_up(); +extern char const *STR_xfind_pages(); +extern char const *STR_do_xmap(); +extern char const *STR_upx_main(); + +extern int write(int fd, char const *buf, size_t n); + +static int +dprintf(char const *fmt, ...) +{ + char c; + int n= 0; + char *ptr; + char buf[20]; + va_list va; va_start(va, fmt); + ptr= &buf[0]; + while (0!=(c= *fmt++)) if ('%'!=c) goto literal; + else switch (c= *fmt++) { + default: { +literal: + n+= write(2, fmt-1, 1); + } break; + case 0: goto done; /* early */ + case 'u': { + n+= write(2, buf, unsimal(va_arg(va, unsigned), buf, 0)); + } break; + case 'd': { + n+= write(2, buf, decimal(va_arg(va, int), buf, 0)); + } break; + case 'p': /* same as 'x'; relies on sizeof(int)==sizeof(void *) */ + case 'x': { + buf[0] = '0'; + buf[1] = 'x'; + n+= write(2, buf, heximal(va_arg(va, int), buf, 2)); + } break; + } +done: + va_end(va); + return n; +} +#endif /*}*/ + +#define MAX_ELF_HDR 512 // Elf32_Ehdr + n*Elf32_Phdr must fit in this + + +/************************************************************************* +// "file" util +**************************************************************************/ + +struct Extent { + size_t size; // must be first to match size[0] uncompressed size + char *buf; +}; + + +static void +#if (ACC_CC_GNUC >= 0x030300) && defined(__i386__) /*{*/ +__attribute__((__noinline__, __used__, regparm(3), stdcall)) +#endif /*}*/ +xread(struct Extent *x, char *buf, size_t count) +{ + char *p=x->buf, *q=buf; + size_t j; + DPRINTF((STR_xread(), x, x->size, x->buf, buf, count)); + if (x->size < count) { + exit(127); + } + for (j = count; 0!=j--; ++p, ++q) { + *q = *p; + } + x->buf += count; + x->size -= count; +} + + +/************************************************************************* +// util +**************************************************************************/ + +#if 1 //{ save space +#define ERR_LAB error: exit(127); +#define err_exit(a) goto error +#else //}{ save debugging time +#define ERR_LAB +static void +err_exit(int a) __attribute__ ((__noreturn__)); +{ + (void)a; // debugging convenience + exit(127); +} +#endif //} + +static void * +do_brk(void *addr) +{ + return brk(addr); +} + +extern void *mmap(void *addr, size_t len, + int prot, int flags, int fd, off_t offset); + +/************************************************************************* +// UPX & NRV stuff +**************************************************************************/ + +typedef void f_unfilter( + nrv_byte *, // also addvalue + nrv_uint, + unsigned cto8, // junk in high 24 bits + unsigned ftid +); +typedef int f_expand( + const nrv_byte *, nrv_uint, + nrv_byte *, nrv_uint *, unsigned ); + +static void +unpackExtent( + struct Extent *const xi, // input + struct Extent *const xo, // output + f_expand *const f_decompress, + f_unfilter *f_unf +) +{ + DPRINTF((STR_unpackExtent(), + xi, xi->size, xi->buf, xo, xo->size, xo->buf, f_decompress, f_unf)); + while (xo->size) { + struct b_info h; + // Note: if h.sz_unc == h.sz_cpr then the block was not + // compressible and is stored in its uncompressed form. + + // Read and check block sizes. + xread(xi, (char *)&h, sizeof(h)); + if (h.sz_unc == 0) { // uncompressed size 0 -> EOF + if (h.sz_cpr != UPX_MAGIC_LE32) // h.sz_cpr must be h->magic + err_exit(2); + if (xi->size != 0) // all bytes must be written + err_exit(3); + break; + } + if (h.sz_cpr <= 0) { + err_exit(4); +ERR_LAB + } + if (h.sz_cpr > h.sz_unc + || h.sz_unc > xo->size ) { + err_exit(5); + } + // Now we have: + // assert(h.sz_cpr <= h.sz_unc); + // assert(h.sz_unc > 0 && h.sz_unc <= blocksize); + // assert(h.sz_cpr > 0 && h.sz_cpr <= blocksize); + + if (h.sz_cpr < h.sz_unc) { // Decompress block + nrv_uint out_len; + int const j = (*f_decompress)((unsigned char *)xi->buf, h.sz_cpr, + (unsigned char *)xo->buf, &out_len, h.b_method ); + if (j != 0 || out_len != (nrv_uint)h.sz_unc) + err_exit(7); + // Skip Ehdr+Phdrs: separate 1st block, not filtered + if (h.b_ftid!=0 && f_unf // have filter + && ((512 < out_len) // this block is longer than Ehdr+Phdrs + || (xo->size==(unsigned)h.sz_unc) ) // block is last in Extent + ) { + (*f_unf)((unsigned char *)xo->buf, out_len, h.b_cto8, h.b_ftid); + } + xi->buf += h.sz_cpr; + xi->size -= h.sz_cpr; + } + else { // copy literal block + xread(xi, xo->buf, h.sz_cpr); + } + xo->buf += h.sz_unc; + xo->size -= h.sz_unc; + } +} + +#if defined(__i386__) /*{*/ +// Create (or find) an escape hatch to use when munmapping ourselves the stub. +// Called by do_xmap to create it; remembered in AT_NULL.d_val +static void * +make_hatch_x86(Elf32_Phdr const *const phdr, unsigned const reloc) +{ + unsigned *hatch = 0; + if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) { + // The format of the 'if' is + // if ( ( (hatch = loc1), test_loc1 ) + // || ( (hatch = loc2), test_loc2 ) ) { + // action + // } + // which uses the comma to save bytes when test_locj involves locj + // and the action is the same when either test succeeds. + + // Try page fragmentation just beyond .text . + if ( ( (hatch = (void *)(phdr->p_memsz + phdr->p_vaddr + reloc)), + ( phdr->p_memsz==phdr->p_filesz // don't pollute potential .bss + && 4<=(~PAGE_MASK & -(int)hatch) ) ) // space left on page + // Try Elf32_Ehdr.e_ident[12..15] . warning: 'const' cast away + || ( (hatch = (void *)(&((Elf32_Ehdr *)phdr->p_vaddr + reloc)->e_ident[12])), + (phdr->p_offset==0) ) ) { + // Omitting 'const' saves repeated literal in gcc. + unsigned /*const*/ escape = 0xc36180cd; // "int $0x80; popa; ret" + // Don't store into read-only page if value is already there. + if (* (volatile unsigned*) hatch != escape) { + * hatch = escape; + } + } + } + return hatch; +} +#elif defined(__arm__) /*}{*/ +static void * +make_hatch_arm(Elf32_Phdr const *const phdr, unsigned const reloc) +{ + unsigned *hatch = 0; + DPRINTF((STR_make_hatch_arm(),phdr,reloc)); + if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) { + // The format of the 'if' is + // if ( ( (hatch = loc1), test_loc1 ) + // || ( (hatch = loc2), test_loc2 ) ) { + // action + // } + // which uses the comma to save bytes when test_locj involves locj + // and the action is the same when either test succeeds. + + // Try page fragmentation just beyond .text . + if ( ( (hatch = (void *)(phdr->p_memsz + phdr->p_vaddr + reloc)), + ( phdr->p_memsz==phdr->p_filesz // don't pollute potential .bss + && 8<=(~PAGE_MASK & -(int)hatch) ) ) // space left on page + // Try Elf32_Ehdr.e_ident[8..15] . warning: 'const' cast away + || ( (hatch = (void *)(&((Elf32_Ehdr *)phdr->p_vaddr + reloc)->e_ident[8])), + (phdr->p_offset==0) ) ) + { + hatch[0]= 0xef90005b; // syscall __NR_unmap + hatch[1]= 0xe1a0f00e; // mov pc,lr + } + } + return hatch; +} +#endif /*}*/ + +static void +#if defined(__i386__) /*{*/ +__attribute__((regparm(2), stdcall)) +#endif /*}*/ +upx_bzero(char *p, size_t len) +{ + if (len) do { + *p++= 0; + } while (--len); +} +#define bzero upx_bzero + + +static void +#if defined(__i386__) /*{*/ +__attribute__((regparm(3), stdcall)) +#endif /*}*/ +auxv_up(Elf32_auxv_t *av, unsigned const type, unsigned const value) +{ + DPRINTF((STR_auxv_up(),av,type,value)); + if (av +#if defined(__i386__) /*{*/ + && 0==(1&(int)av) /* PT_INTERP usually inhibits, except for hatch */ +#endif /*}*/ + ) + for (;; ++av) { + if (av->a_type==type || (av->a_type==AT_IGNORE && type!=AT_NULL)) { + av->a_type = type; + av->a_un.a_val = value; + return; + } + } +} + +// The PF_* and PROT_* bits are {1,2,4}; the conversion table fits in 32 bits. +#define REP8(x) \ + ((x)|((x)<<4)|((x)<<8)|((x)<<12)|((x)<<16)|((x)<<20)|((x)<<24)|((x)<<28)) +#define EXP8(y) \ + ((1&(y)) ? 0xf0f0f0f0 : (2&(y)) ? 0xff00ff00 : (4&(y)) ? 0xffff0000 : 0) +#define PF_TO_PROT(pf) \ + ((PROT_READ|PROT_WRITE|PROT_EXEC) & ( \ + ( (REP8(PROT_EXEC ) & EXP8(PF_X)) \ + |(REP8(PROT_READ ) & EXP8(PF_R)) \ + |(REP8(PROT_WRITE) & EXP8(PF_W)) \ + ) >> ((pf & (PF_R|PF_W|PF_X))<<2) )) + + +// Find convex hull of PT_LOAD (the minimal interval which covers all PT_LOAD), +// and mmap that much, to be sure that a kernel using exec-shield-randomize +// won't place the first piece in a way that leaves no room for the rest. +static unsigned long // returns relocation constant +#if defined(__i386__) /*{*/ +__attribute__((regparm(3), stdcall)) +#endif /*}*/ +xfind_pages(unsigned mflags, Elf32_Phdr const *phdr, int phnum, + char **const p_brk +) +{ + size_t lo= ~0, hi= 0, szlo= 0; + char *addr; + DPRINTF((STR_xfind_pages(), mflags, phdr, phnum, p_brk)); + mflags += MAP_PRIVATE | MAP_ANONYMOUS; // '+' can optimize better than '|' + for (; --phnum>=0; ++phdr) if (PT_LOAD==phdr->p_type) { + if (phdr->p_vaddr < lo) { + lo = phdr->p_vaddr; + szlo = phdr->p_filesz; + } + if (hi < (phdr->p_memsz + phdr->p_vaddr)) { + hi = phdr->p_memsz + phdr->p_vaddr; + } + } + szlo += ~PAGE_MASK & lo; // page fragment on lo edge + lo -= ~PAGE_MASK & lo; // round down to page boundary + hi = PAGE_MASK & (hi - lo - PAGE_MASK -1); // page length + szlo = PAGE_MASK & (szlo - PAGE_MASK -1); // page length + addr = mmap((void *)lo, hi, PROT_NONE, mflags, -1, 0); + *p_brk = hi + addr; // the logical value of brk(0) + //mprotect(szlo + addr, hi - szlo, PROT_NONE); // no access, but keep the frames! + return (unsigned long)addr - lo; +} + +static Elf32_Addr // entry address +do_xmap(int const fdi, Elf32_Ehdr const *const ehdr, struct Extent *const xi, + Elf32_auxv_t *const av, unsigned *p_reloc, f_unfilter *const f_unf) +{ + Elf32_Phdr const *phdr = (Elf32_Phdr const *) (ehdr->e_phoff + + (void const *)ehdr); + char *v_brk; + unsigned const reloc = xfind_pages( + ((ET_EXEC==ehdr->e_type) ? MAP_FIXED : 0), phdr, ehdr->e_phnum, &v_brk); + int j; + DPRINTF((STR_do_xmap(), + fdi, ehdr, xi, (xi? xi->size: 0), (xi? xi->buf: 0), av, p_reloc, f_unf)); + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) + if (PT_PHDR==phdr->p_type) { + auxv_up(av, AT_PHDR, phdr->p_vaddr + reloc); + } + else if (PT_LOAD==phdr->p_type) { + unsigned const prot = PF_TO_PROT(phdr->p_flags); + struct Extent xo; + size_t mlen = xo.size = phdr->p_filesz; + char *addr = xo.buf = (char *)(phdr->p_vaddr + reloc); + char *haddr = phdr->p_memsz + addr; + size_t frag = (int)addr &~ PAGE_MASK; + mlen += frag; + addr -= frag; + + if (addr != mmap(addr, mlen +#if defined(__i386__) /*{*/ + // Decompressor can overrun the destination by 3 bytes. + + (xi ? 3 : 0) +#endif /*}*/ + , prot | (xi ? PROT_WRITE : 0), + MAP_FIXED | MAP_PRIVATE | (xi ? MAP_ANONYMOUS : 0), + (xi ? -1 : fdi), phdr->p_offset - frag) ) { + err_exit(8); + } + if (xi) { + unpackExtent(xi, &xo, (f_expand *)fdi, + ((PROT_EXEC & prot) ? f_unf : 0) ); + } + // Linux does not fixup the low end, so neither do we. + //if (PROT_WRITE & prot) { + // bzero(addr, frag); // fragment at lo end + //} + frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary + if (PROT_WRITE & prot) { // note: read-only .bss not supported here + bzero(mlen+addr, frag); // fragment at hi end + } + if (xi) { +#if defined(__i386__) /*{*/ + void *const hatch = make_hatch_x86(phdr, reloc); + if (0!=hatch) { + /* always update AT_NULL, especially for compressed PT_INTERP */ + auxv_up((Elf32_auxv_t *)(~1 & (int)av), AT_NULL, (unsigned)hatch); + } +#elif defined(__arm__) /*}{*/ + void *const hatch = make_hatch_arm(phdr, reloc); + if (0!=hatch) { + auxv_up((Elf32_auxv_t *)(void *)av, AT_NULL, (unsigned)hatch); + } +#endif /*}*/ + if (0!=mprotect(addr, mlen, prot)) { + err_exit(10); +ERR_LAB + } + } + addr += mlen + frag; /* page boundary on hi end */ + if (addr < haddr) { // need pages for .bss + if (addr != mmap(addr, haddr - addr, prot, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0 ) ) { + err_exit(9); + } + } +#if defined(__i386__) /*{*/ + else if (xi) { // cleanup if decompressor overrun crosses page boundary + mlen = ~PAGE_MASK & (3+ mlen); + if (mlen<=3) { // page fragment was overrun buffer only + munmap(addr, mlen); + } + } +#endif /*}*/ + } + if (!xi) { // 2nd call (PT_INTERP); close()+check is smaller here + if (0!=close(fdi)) { + err_exit(11); + } + } + else { // 1st call (main); also have (0!=av) here + if (ET_DYN!=ehdr->e_type) { + // Needed only if compressed shell script invokes compressed shell. + do_brk(v_brk); + } + } + if (0!=p_reloc) { + *p_reloc = reloc; + } + return ehdr->e_entry + reloc; +} + + +/************************************************************************* +// upx_main - called by our entry code +// +// This function is optimized for size. +**************************************************************************/ + +void *upx_main( + Elf32_auxv_t *const av, + unsigned const sz_compressed, + f_expand *const f_decompress, + f_unfilter */*const*/ f_unfilter, + struct Extent xo, + struct Extent xi, + unsigned const volatile dynbase +) __asm__("upx_main"); + +void *upx_main( + Elf32_auxv_t *const av, + unsigned const sz_compressed, + f_expand *const f_decompress, + f_unfilter */*const*/ f_unf, + struct Extent xo, // {sz_unc, ehdr} for ELF headers + struct Extent xi, // {sz_cpr, &b_info} for ELF headers + unsigned const volatile dynbase // value+result: compiler must not change +) +{ + Elf32_Ehdr *const ehdr = (Elf32_Ehdr *)(void *)xo.buf; // temp char[MAX_ELF_HDR+OVERHEAD] + Elf32_Phdr const *phdr = (Elf32_Phdr const *)(1+ ehdr); + Elf32_Addr reloc; + Elf32_Addr entry; + + // sizeof(Ehdr+Phdrs), compressed; including b_info header + size_t const sz_pckhdrs = xi.size; + + DPRINTF((STR_upx_main(), + av, sz_compressed, f_decompress, f_unf, &xo, xo.size, xo.buf, + &xi, xi.size, xi.buf, dynbase)); +#if defined(__i386__) /*{*/ + f_unf = (f_unfilter *)(2+ (long)f_decompress); +#endif /*}*/ + + // Uncompress Ehdr and Phdrs. + unpackExtent(&xi, &xo, f_decompress, 0); + + // Prepare to decompress the Elf headers again, into the first PT_LOAD. + xi.buf -= sz_pckhdrs; + xi.size = sz_compressed; + + // Some kernels omit AT_PHNUM,AT_PHENT,AT_PHDR because this stub has no PT_INTERP. + // That is "too much" optimization. Linux 2.6.x seems to give all AT_*. + //auxv_up(av, AT_PAGESZ, PAGE_SIZE); /* ld-linux.so.2 does not need this */ + auxv_up(av, AT_PHNUM , ehdr->e_phnum); + auxv_up(av, AT_PHENT , ehdr->e_phentsize); + auxv_up(av, AT_PHDR , dynbase + (unsigned)(1+(Elf32_Ehdr *)phdr->p_vaddr)); + // AT_PHDR.a_un.a_val is set again by do_xmap if PT_PHDR is present. + // This is necessary for ET_DYN if|when we override a prelink address. + + entry = do_xmap((int)f_decompress, ehdr, &xi, av, &reloc, f_unf); + auxv_up(av, AT_ENTRY , entry); // might not be necessary? + + { // Map PT_INTERP program interpreter + int j; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) if (PT_INTERP==phdr->p_type) { + int const fdi = open(reloc + (char const *)phdr->p_vaddr, O_RDONLY, 0); + if (0 > fdi) { + err_exit(18); + } + if (MAX_ELF_HDR!=read(fdi, (void *)ehdr, MAX_ELF_HDR)) { +ERR_LAB + err_exit(19); + } + entry = do_xmap(fdi, ehdr, 0, 0, 0, 0); + break; + } + } + + return (void *)entry; +} + + +/* +vi:ts=4:et:nowrap +*/ + diff --git a/src/stub/src/i386-linux.elf.execve-entry.asm b/src/stub/src/i386-linux.elf.execve-entry.asm new file mode 100644 index 00000000..44173b18 --- /dev/null +++ b/src/stub/src/i386-linux.elf.execve-entry.asm @@ -0,0 +1,158 @@ +; l_lx_exec86.asm -- Linux program entry point & decompressor (kernel exec) +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; Copyright (C) 2000-2004 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 +; +; +; John F. Reiser +; +; + + + BITS 32 + SECTION .text + CPU 386 + +%define jmps jmp short +%define jmpn jmp near + +; /************************************************************************* +; // program entry point +; // see glibc/sysdeps/i386/elf/start.S +; **************************************************************************/ + +GLOBAL _start +;__LEXEC000__ +_start: +;;;; int3 +;; 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. +;; Invoke gdb, and give a 'run' command. Define a single-step macro such as +;; define g +;; stepi +;; x/i $pc +;; end +;; and a step-over macro such as +;; define h +;; x/2i $pc +;; tbreak *$_ +;; continue +;; x/i $pc +;; end +;; Step through the code; remember that repeats the previous command. +;; + + %if 0 + ; personality(PER_LINUX) + mov eax, 136 ; syscall_personality + xor ebx, ebx ; PER_LINUX + int 0x80 + %endif + + call main ; push address of decompress subroutine +decompress: + +; /************************************************************************* +; // C callable decompressor +; **************************************************************************/ + +%define INP dword [esp+8*4+8] +%define INS dword [esp+8*4+12] +%define OUTP dword [esp+8*4+16] +%define OUTS dword [esp+8*4+20] + +;__LEXEC009__ + mov eax, 'NMRU' ; free slot in following 'pusha' +;__LEXEC010__ + pusha + push byte '?' ; cto8 (sign extension does not matter) + ; cld + + mov esi, INP + mov edi, OUTP + + or ebp, byte -1 +;;; align 8 + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" +%include "arch/i386/macros.ash" + cjt32 0 + +;__LEXEC015__ + ; eax is 0 from decompressor code + ;xor eax, eax ; return code + +; check compressed size + mov edx, INP + add edx, INS + cmp edx, esi + jz .ok + dec eax +.ok: + xchg [8*4 + esp], eax ; store success/failure, fetch NMRU + +; write back the uncompressed size, and prepare for unfilter + mov edx, OUTS + mov ecx, edi + mov edi, OUTP + sub ecx, edi ; ecx= uncompressed size + mov [edx], ecx + + pop edx ; cto8 + +;__LEXEC110__ Jcc and/or possible n_mru + push edi ; addvalue + push byte 0x0f + pop ebx + mov bh, dl ; ebx= 0,,cto8,0x0F + +;__LEXEC100__ 0!=n_mru + xchg eax, ebx ; eax= ct08_0f; ebx= n_mru {or n_mru1} + +;;LEXEC016 bug in APP: jmp and target must be in same .asx +;; jmpn lxunf0 ; logically belongs here + + ctojr32 + ckt32 edi, dl +;__LEXEC017__ + popa + ret + +;__LEXEC020__ + +main: + pop ebp ; &decompress + mov ebx, 0x401000 ; &Elf32_Ehdr of this program +;; fall into fold_begin + +eof: +; __XTHEENDX__ + section .data + dd -1 + dw eof + +; vi:ts=8:et:nowrap + diff --git a/src/stub/src/i386-linux.elf.execve-fold.asm b/src/stub/src/i386-linux.elf.execve-fold.asm new file mode 100644 index 00000000..baa278bc --- /dev/null +++ b/src/stub/src/i386-linux.elf.execve-fold.asm @@ -0,0 +1,72 @@ +; fold_exec86.asm -- linkage to C code to process Elf binary +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 2000-2004 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 +; +; +; John F. Reiser +; +; + + + BITS 32 + SECTION .text + CPU 386 + +;; control just falls through, after this part and compiled C code +;; are uncompressed. + +%define szElf32_Ehdr 0x34 +%define szElf32_Phdr 8*4 +%define e_entry (16 + 2*2 + 4) +%define p_vaddr 2*4 +%define p_memsz 5*4 +%define szl_info 12 +%define szp_info 12 + +fold_begin: ; enter: %ebx= &Elf32_Ehdr of this program + + pop eax ; Pop the argument count + mov ecx, esp ; argv starts just at the current stack top + lea edx, [esp+eax*4+4] ; envp = &argv[argc + 1] + mov edi, [ebx + e_entry] + lea esi, [ebx + szElf32_Ehdr + szElf32_Phdr + szl_info] + sub edi, esi ; length + lea ebx, [2 + ebp] ; f_unfilter, maybe + pusha ; (cprLen, cprSrc, f_decpr, xx, f_unf, envp, argv, argc) +EXTERN upx_main + call upx_main ; Call the UPX main function + hlt ; Crash if somehow upx_main does return + +%define __NR_mmap 90 + + global mmap +mmap: + push ebx + lea ebx, [2*4 + esp] + push byte __NR_mmap + pop eax + int 0x80 + pop ebx + ret + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/i386-linux.elf.execve-fold.lds b/src/stub/src/i386-linux.elf.execve-fold.lds new file mode 100644 index 00000000..4ed1f7b8 --- /dev/null +++ b/src/stub/src/i386-linux.elf.execve-fold.lds @@ -0,0 +1,50 @@ +/* l_lx_exec86.lds -- + + This file is part of the UPX executable compressor. + + Copyright (C) 2000-2004 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 + + + John F. Reiser + + */ + + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +/*ENTRY(_start)*/ +PHDRS /* force exactly 1 ELF32_Phdr: in particular, no PT_GNU_STACK */ +{ + phdr0 PT_LOAD FILEHDR PHDRS FLAGS(5); /* no PF_W: strict SELinux, PaX, grSecurity */ +} + +SECTIONS +{ + /* 0x00401000: l_lx_exec86.asm assumes 1 page up from 64KB boundary */ + . = 0x00401000 + SIZEOF_HEADERS + 12; /* 12==sizeof(l_info) */ + .data : { /* put everything together in one Phdr */ + *(.text) + *(.rodata) + *(.data) + *(.bss) + *(COMMON) + } : phdr0 +} diff --git a/src/stub/src/i386-linux.elf.execve-main.c b/src/stub/src/i386-linux.elf.execve-main.c new file mode 100644 index 00000000..a2c4ce80 --- /dev/null +++ b/src/stub/src/i386-linux.elf.execve-main.c @@ -0,0 +1,522 @@ +/* l_lx_exec.c -- generic stub loader for Linux using execve() + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 Laszlo Molnar + 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 + + + John F. Reiser + + */ + + +#include "include/linux.h" + + +/************************************************************************* +// configuration section +**************************************************************************/ + +// mmap() the temporary output file +#define USE_MMAP_FO + + +/************************************************************************* +// file util +**************************************************************************/ + +struct Extent { + int size; // must be first to match size[0] uncompressed size + char *buf; +}; + + +#if !defined(USE_MMAP_FO) +#if 1 +static __inline__ int xwrite(int fd, const void *buf, int count) +{ + // note: we can assert(count > 0); + do { + int n = write(fd, buf, count); + if (n == -EINTR) + continue; + if (n <= 0) + break; + buf += n; // gcc extension: add to void * + count -= n; + } while (count > 0); + return count; +} +#else +#define xwrite(fd,buf,count) ((count) - write(fd,buf,count)) +#endif +#endif /* !USE_MMAP_FO */ + + +/************************************************************************* +// util +**************************************************************************/ + +#if 1 + +extern char * +__attribute__((regparm(2), stdcall)) // be ruthless +upx_itoa(unsigned long v, char *buf); + +#else + +// Some versions of gcc optimize the division and/or remainder using +// a multiplication by (2**32)/10, and use a relocatable 32-bit address +// to reference the constant. We require no relocations because we move +// the code at runtime. See upx_itoa.asm for replacement [also smaller.] +static char *upx_itoa(unsigned long v, char *buf) +{ +// const unsigned TEN = 10; + volatile unsigned TEN = 10; // an ugly way to achieve no relocation + char *p = buf; + { + unsigned long k = v; + do { + p++; + k /= TEN; + } while (k > 0); + } + buf = p; + *p = 0; + { + unsigned long k = v; + do { + *--p = '0' + k % TEN; + k /= TEN; + } while (k > 0); + } + return buf; +} + +#endif + + +static uint32_t ascii5(char *p, uint32_t v, unsigned n) +{ + do { + unsigned char d = v % 32; + if (d >= 26) d -= 43; // 43 == 'Z' - '0' + 1 + *--p = (d += 'A'); + v /= 32; + } while (--n > 0); + return v; +} + + +extern char *mmap(void *addr, size_t len, + int prot, int flags, int fd, off_t offset); + +#if defined(__i386__) +# define SET2(p, c0, c1) \ + * (unsigned short *) (p) = ((c1)<<8 | (c0)) +# define SET4(p, c0, c1, c2, c3) \ + * (uint32_t *) (p) = ((c3)<<24 | (c2)<<16 | (c1)<<8 | (c0)) +# define SET3(p, c0, c1, c2) \ + SET4(p, c0, c1, c2, 0) +#else +# define SET2(p, c0, c1) \ + (p)[0] = c0, (p)[1] = c1 +# define SET3(p, c0, c1, c2) \ + (p)[0] = c0, (p)[1] = c1, (p)[2] = c2 +# define SET4(p, c0, c1, c2, c3) \ + (p)[0] = c0, (p)[1] = c1, (p)[2] = c2, (p)[3] = c3 +#endif + + +// go_self is a separate subroutine to spread the burden of local arrays. +// Otherwise the size of the stack frame in upx_main exceeds 128 bytes, +// which causes too many offsets to expand from 1 byte to 4. + +static int +#if (ACC_CC_GNUC >= 0x030300) +__attribute__((__noinline__, __used__, __stdcall__)) +#endif +go_self(char const *tmpname, char *argv[], char *envp[]) +{ + // Old FreeBSD does not have /proc/self, so use /proc/ instead. + + // Open the temp file. + int const fdi = open(tmpname, O_RDONLY, 0); + + if (0 <= fdi) { + // 17 chars for "/proc/PPPPP/fd/XX" should be enough, but we + // play safe in case there will be 32-bit pid_t at some time. + //char procself_buf[17+1]; + char procself_buf[31+1]; + + // Compute name of temp fdi. + SET4(procself_buf + 0, '/', 'p', 'r', 'o'); + SET4(procself_buf + 4, 'c', '/', 0 , 0 ); + { + char *const procself = upx_itoa(getpid(), procself_buf + 6); + SET4(procself, '/', 'f', 'd', '/'); + upx_itoa(fdi, procself + 4); + } + + // Check for working /proc/self/fd/X by accessing the + // temp file again, now via temp fdi. + if (UPX2 == access(procself_buf, R_OK | X_OK)) { + // Now it's safe to unlink the temp file (as it is still open). + unlink(tmpname); + // Set the file close-on-exec. + fcntl(fdi, F_SETFD, FD_CLOEXEC); + // Execute the original program via /proc/self/fd/X. + execve(procself_buf, argv, envp); + // NOTE: if we get here we've lost. + } + + // The proc filesystem isn't working. No problem. + close(fdi); + } + return fdi; +} + + +/************************************************************************* +// UPX & NRV stuff +**************************************************************************/ + +typedef void f_unfilter( + nrv_byte *, // also addvalue + nrv_uint, + unsigned cto8 // junk in high 24 bits +); +typedef int f_expand( + const nrv_byte *src, nrv_uint src_len, + nrv_byte *dst, nrv_uint *dst_len, int method ); + + +/************************************************************************* +// upx_main - called by our entry code +// +// This function is optimized for size. +**************************************************************************/ + +void upx_main( + struct Extent xi, + f_expand *const f_decompress, + int junk2, + f_unfilter *const f_unf, + char *envp[], + char *argv[], + int argc +) __asm__("upx_main"); +void upx_main( + struct Extent xi, + f_expand *const f_decompress, + int junk, + f_unfilter *const f_unf, + char *envp[], + char *argv[], + int argc +) +{ + // file descriptor + int fdo; + + // decompression buffer + unsigned char *buf; + + char *tmpname; + struct p_info header; + + // temporary file name + char tmpname_buf[20]; + + (void)junk; + + // + // ----- Step 0: set /proc/self using /proc/ ----- + // + + //personality(PER_LINUX); + + + // + // ----- Step 1: prepare input file ----- + // + + // Read header. + { + register char *__d0, *__d1; + __asm__ __volatile__( "movsl; movsl; movsl" + : "=&D" (__d0), "=&S" (__d1) + : "0" (&header), "1" (xi.buf) + : "memory"); + xi.buf = __d1; + xi.size -= sizeof(header); + } + + // Paranoia. Make sure this is actually our expected executable + // by checking the random program id. (The id is both stored + // in the header and patched into this stub.) + if (header.p_progid != UPX3) + goto error1; + + + // + // ----- Step 2: prepare temporary output file ----- + // + + tmpname = tmpname_buf; + SET4(tmpname + 0, '/', 't', 'm', 'p'); + SET4(tmpname + 4, '/', 'u', 'p', 'x'); + + // Compute name of temporary output file in tmpname[]. + // Protect against Denial-of-Service attacks. + { + char *p = tmpname_buf + sizeof(tmpname_buf) - 1; + + // Compute the last 4 characters (20 bits) from getpid(). + uint32_t r = ascii5(p, (uint32_t)getpid(), 4); *p = '\0'; p -= 4; + + // Provide 4 random bytes from our program id. + r ^= header.p_progid; + // Mix in 4 runtime random bytes. + // Don't consume precious bytes from /dev/urandom. + { +#if 1 + struct timeval tv; + gettimeofday(&tv, 0); + r ^= (uint32_t) tv.tv_sec; + r ^= ((uint32_t) tv.tv_usec) << 12; // shift into high-bits +#else + // using adjtimex() may cause portability problems + struct timex tx; + adjtimex(&tx); + r ^= (uint32_t) tx.time.tv_sec; + r ^= ((uint32_t) tx.time.tv_usec) << 12; // shift into high-bits + r ^= (uint32_t) tx.errcnt; +#endif + } + // Compute 7 more characters from the 32 random bits. + ascii5(p, r, 7); + } + + // Just in case, remove the file. + { + int err = unlink(tmpname); + if (err != -ENOENT && err != 0) + goto error1; + } + + // Create the temporary output file. +#if defined(USE_MMAP_FO) + fdo = open(tmpname, O_RDWR | O_CREAT | O_EXCL, 0700); +#else + fdo = open(tmpname, O_WRONLY | O_CREAT | O_EXCL, 0700); +#endif +#if 0 + // Save some bytes of code - the ftruncate() below will fail anyway. + if (fdo < 0) + goto error; +#endif + + // Set expected uncompressed file size. + if (ftruncate(fdo, header.p_filesize) != 0) + goto error; + + + // + // ----- Step 3: setup memory ----- + // + +#if defined(USE_MMAP_FO) + // FIXME: packer could set length + buf = (unsigned char *)mmap(0, header.p_filesize, + PROT_READ | PROT_WRITE, MAP_SHARED, fdo, 0); + if ((unsigned long) buf >= (unsigned long) -4095) + goto error; + + // Decompressor can overrun the output by 3 bytes. + // Defend against SIGSEGV by using a scratch page. + // FIXME: packer could set address delta + mmap(buf + (PAGE_MASK & (header.p_filesize + ~PAGE_MASK)), + -PAGE_MASK, PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0 ); +#else + // Temporary decompression buffer. + // FIXME: packer could set length + buf = mmap(0, (header.p_blocksize + OVERHEAD + ~PAGE_MASK) & PAGE_MASK, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0 ); + if ((unsigned long) buf >= (unsigned long) -4095) + goto error; +#endif + + // + // ----- Step 4: decompress blocks ----- + // + + for (;;) + { + struct b_info h; + + // Read and check block sizes. + { + register char *__d0, *__d1; + __asm__ __volatile__( "movsl; movsl; movsl" + : "=&D" (__d0), "=&S" (__d1) + : "0" (&h), "1" (xi.buf) + : "memory"); + xi.buf = __d1; + xi.size -= sizeof(h); + } + if (h.sz_unc == 0) // uncompressed size 0 -> EOF + { + if (h.sz_cpr != UPX_MAGIC_LE32) // h.sz_cpr must be h->magic + goto error; + if (header.p_filesize != 0) // all bytes must be written + goto error; + break; + } + // Note: if sz_unc == sz_cpr then the block was not + // compressible and is stored in its uncompressed form. + + if (h.sz_cpr > h.sz_unc || h.sz_cpr > header.p_blocksize) + goto error; + // Now we have: + // assert(h.sz_cpr <= h.sz_unc); + // assert(h.sz_unc > 0 && h.sz_unc <= blocksize); + // assert(h.sz_cpr > 0 && h.sz_cpr <= blocksize); + + if (h.sz_cpr < h.sz_unc) { // Decompress block. + nrv_uint out_len; + int i = (*f_decompress)((unsigned char *)xi.buf, h.sz_cpr, buf, &out_len, h.b_method); + if (i != 0 || out_len != (nrv_uint)h.sz_unc) + goto error; + // Right now, unfilter is combined with decompression. + // (*f_unfilter)(buf, out_len, cto8); + (void)f_unf; + } + else + { + // Incompressible block +#if defined(USE_MMAP_FO) + //memcpy(buf, xi.buf, h.sz_unc); + register unsigned long int __d0, __d1, __d2; + __asm__ __volatile__( "rep; movsb" + : "=&c" (__d0), "=&D" (__d1), "=&S" (__d2) + : "0" (h.sz_unc), "1" (buf), "2" (xi.buf) + : "memory"); +#endif + } + +#if defined(USE_MMAP_FO) + // unmap part of the output + munmap(buf, h.sz_unc); + buf += h.sz_unc; +#else + // write output file + if (xwrite(fdo, buf, h.sz_unc) != 0) + goto error; +#endif + + header.p_filesize -= h.sz_unc; + + xi.buf += h.sz_cpr; + xi.size -= h.sz_cpr; + + if (xi.size < 0) { +// error exit is here in the middle to keep the jumps short. + error: + (void) unlink(tmpname); + error1: + // Note: the kernel will close all open files and + // unmap any allocated memory. + for (;;) + (void) exit(127); + } + } + + // + // ----- Step 5: release resources ----- + // + + +#if !defined(USE_MMAP_FO) + // Free our temporary decompression buffer. + munmap(buf, malloc_args.ma_length); +#endif + + if (close(fdo) != 0) + goto error; + + + // + // ----- Step 6: try to start program via /proc/self/fd/X ----- + // + + // Many thanks to Andi Kleen and + // Jamie Lokier for this nice idea. + + if (0 > go_self(tmpname, argv, envp)) + goto error; + + + // + // ----- Step 7: start program in /tmp ----- + // + + // Fork off a subprocess to clean up. + // We have to do this double-fork trick to keep a zombie from + // hanging around if the spawned original program doesn't check for + // subprocesses (as well as to prevent the real program from getting + // confused about this subprocess it shouldn't have). + // Thanks to Adam Ierymenko for this solution. + + if (fork() == 0) + { + if (fork() == 0) + { + // Sleep 3 seconds, then remove the temp file. + struct timespec ts; ts.tv_sec = UPX4; ts.tv_nsec = 0; + nanosleep(&ts, 0); + unlink(tmpname); + } + exit(0); + } + + // Wait for the first fork()'d process to die. + waitpid(-1, (int *)0, 0); + + // Execute the original program. + (void)argc; + execve(tmpname, argv, envp); + + + // + // ----- Step 8: error exit ----- + // + + // If we return from execve() there was an error. Give up. + goto error; +} + + +/* +vi:ts=4:et:nowrap +*/ diff --git a/src/stub/src/i386-linux.elf.execve-upx_itoa.asm b/src/stub/src/i386-linux.elf.execve-upx_itoa.asm new file mode 100644 index 00000000..2eb8950b --- /dev/null +++ b/src/stub/src/i386-linux.elf.execve-upx_itoa.asm @@ -0,0 +1 @@ +%include "arch/i386/upx_itoa.ash" diff --git a/src/stub/src/i386-linux.elf.interp-entry.asm b/src/stub/src/i386-linux.elf.interp-entry.asm new file mode 100644 index 00000000..82025e67 --- /dev/null +++ b/src/stub/src/i386-linux.elf.interp-entry.asm @@ -0,0 +1,187 @@ +; l_lx_pti86.asm -- Linux separate ELF PT_INTERP +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; Copyright (C) 2000-2004 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 +; +; +; John F. Reiser +; +; + + + BITS 32 + SECTION .text + CPU 386 + +%define jmps jmp short +%define jmpn jmp near + +; /************************************************************************* +; // program entry point +; // see glibc/sysdeps/i386/elf/start.S +; **************************************************************************/ + +GLOBAL _start +;__LXPTI000__ +_start: +;;;; int3 +;; 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. +;; Invoke gdb, and give a 'run' command. Define a single-step macro such as +;; define g +;; stepi +;; x/i $pc +;; end +;; and a step-over macro such as +;; define h +;; x/2i $pc +;; tbreak *$_ +;; continue +;; x/i $pc +;; end +;; Step through the code; remember that repeats the previous command. +;; + call L200 ; push address of get_funf +get_funf: + cmp eax, byte 0x46 + mov ecx, unf46 + je L110 + cmp eax, byte 0x49 + mov ecx, unf49 + je L110 +L120: + mov ecx, none +L110: + mov eax, ecx +none: + ret + +%define M_NRV2B_LE32 2 +%define M_NRV2D_LE32 5 +%define M_NRV2E_LE32 8 +%define M_CL1B_LE32 11 + +L200: + call L300 ; push address of get_fexp +get_fexp: + cmp eax, byte M_NRV2B_LE32 + mov ecx, nrv2b + je L110 + cmp eax, byte M_NRV2D_LE32 + mov ecx, nrv2d + je L110 + cmp eax, byte M_NRV2E_LE32 + mov ecx, nrv2e + je L110 + cmp eax, byte M_CL1B_LE32 + mov ecx, cl1b + je L110 + jmpn L120 + +; /************************************************************************* +; // C callable decompressor +; **************************************************************************/ +;__LXPTI040__ +nrv2b: +;__LXPTI041__ +nrv2d: +;__LXPTI042__ +nrv2e: +;__LXPTI043__ +cl1b: + +%define INP dword [esp+8*4+1*4] +%define INS dword [esp+8*4+2*4] +%define OUTP dword [esp+8*4+3*4] +%define OUTS dword [esp+8*4+4*4] + +;__LXPTI050__ + pusha + ; cld + or ebp, byte -1 + mov esi, INP + mov edi, OUTP +;;; align 8 + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" +%include "arch/i386/cl1_d32.ash" +;__LXPTI090__ + jmpn exp_done +;__LXPTI091__ + ; eax is 0 from decompressor code + ;xor eax, eax ; return code +exp_done: +; check compressed size + mov edx, INP + add edx, INS + cmp esi, edx + jz .ok + dec eax +.ok: + +; write back the uncompressed size + sub edi, OUTP + mov edx, OUTS + mov [edx], edi + + mov [7*4 + esp], eax + popa + ret + +%include "arch/i386/macros.ash" + cjt32 0 + ctojr32 + +;__LXPTI140__ +unf46: +;__LXPTI141__ +unf49: + +%define CTO8 dword [esp+8*4+3*4] + +;__LXPTI150__ + pusha + mov edi,INP + mov ecx,INS + mov edx,CTO8 + + ckt32 edi, dl + +;__LXPTI160__ + popa + ret + +;__LXPTI200__ +L300: + +eof: +; __XTHEENDX__ + section .data + dd -1 + dw eof + +; vi:ts=8:et:nowrap + diff --git a/src/stub/src/i386-linux.elf.interp-fold.asm b/src/stub/src/i386-linux.elf.interp-fold.asm new file mode 100644 index 00000000..95d21887 --- /dev/null +++ b/src/stub/src/i386-linux.elf.interp-fold.asm @@ -0,0 +1,131 @@ +; fold_pti86.asm -- linkage to C code to act as ELF PT_INTERP +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 2000-2004 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 +; +; +; John F. Reiser +; +; + + + BITS 32 + SECTION .text + CPU 386 + + +%define PAGE_SIZE ( 1<<12) + +%define AT_NULL 0 +%define AT_PHDR 3 + +%define szElf32_Ehdr 0x34 +%define szElf32_Phdr 8*4 +%define e_entry (16 + 2*2 + 4) +%define p_vaddr 2*4 +%define p_memsz 5*4 +%define szb_info 12 +%define szl_info 12 +%define szp_info 12 +%define a_type 0 +%define a_val 4 +%define sz_auxv 8 + +%define MAP_FIXED 0x10 +%define MAP_PRIVATE 0x02 +%define MAP_ANONYMOUS 0x20 +%define PROT_READ 1 +%define PROT_WRITE 2 +%define PROT_EXEC 4 +%define __NR_mmap 90 +%define __NR_munmap 91 + +%define OVERHEAD 2048 +%define MAX_ELF_HDR 512 + + pop ebp ; get_fexp + pop ecx ; get_funf + pop eax ; argc + lea edi, [4+ 4*eax + esp] ; &environ + push eax ; argc + + sub eax,eax ; 0 +L310: + scasd + jne L310 + scasd ; edi= &Elf32_auxv_t + + mov esi,edi +L320: + mov eax,[esi] ; a_type + cmp eax, byte AT_PHDR + je L330 + add esi, byte sz_auxv + cmp eax, byte AT_NULL + jne L320 +L330: + mov ebx,[a_val + esi] + push ebx ; save &Elf32_Phdr of compressed data + + sub esp, dword MAX_ELF_HDR + OVERHEAD ; working storage + mov edx, esp + push ecx ; get_funf 9th param to pti_main + lea eax, [2*szElf32_Phdr + szl_info + szp_info + ebx] ; 1st &b_info + mov esi, [e_entry + ebx] ; beyond compressed data + sub esi, eax ; length of compressed data + mov ebx, [ eax] ; length of uncompressed ELF headers + mov ecx, [4+ eax] ; length of compressed ELF headers + add ecx, byte szb_info + pusha ; (AT_table, sz_cpr, get_fexp, &tmp_ehdr, {sz_unc, &tmp}, {sz_cpr, &b1st_info} ) +EXTERN pti_main + call pti_main ; returns entry address + add esp, dword 9*4 + MAX_ELF_HDR + OVERHEAD ; remove 9 params, temp space + pop ebx ; &Elf32_Phdr + push eax ; save entry address + mov ecx,[p_memsz + ebx] + mov ebx,[p_vaddr + ebx] + mov eax,__NR_munmap + int 0x80 ; unmap compressed data + + sub eax,eax + sub ecx,ecx + sub edx,edx + sub ebx,ebx + sub ebp,ebp + sub esi,esi + sub edi,edi + ret ; goto entry point + +%define __NR_mmap 90 + + global mmap +mmap: + push ebx + lea ebx, [2*4 + esp] + push byte __NR_mmap + pop eax + int 0x80 + pop ebx + ret + +; vi:ts=8:et:nowrap + diff --git a/src/stub/src/i386-linux.elf.interp-fold.lds b/src/stub/src/i386-linux.elf.interp-fold.lds new file mode 100644 index 00000000..e03b1047 --- /dev/null +++ b/src/stub/src/i386-linux.elf.interp-fold.lds @@ -0,0 +1,50 @@ +/* l_lx_pti86.lds -- + + This file is part of the UPX executable compressor. + + Copyright (C) 2000-2004 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 + + + John F. Reiser + + */ + + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +/*ENTRY(_start)*/ +PHDRS /* force exactly 1 ELF32_Phdr: in particular, no PT_GNU_STACK */ +{ + phdr0 PT_LOAD FILEHDR PHDRS FLAGS(5); /* no PF_W */ + phdr1 PT_LOAD; +} + +SECTIONS +{ + . = 0x10000 + SIZEOF_HEADERS; + .text : { /* put everything together in one Phdr */ + *(.text) + *(.rodata) + *(.data) + } : phdr0 + .data : { + } : phdr1 +} diff --git a/src/stub/src/i386-linux.elf.interp-main.c b/src/stub/src/i386-linux.elf.interp-main.c new file mode 100644 index 00000000..2798a2d3 --- /dev/null +++ b/src/stub/src/i386-linux.elf.interp-main.c @@ -0,0 +1,429 @@ +/* l_lx_pti.c -- stub loader for Linux x86 separate PT_INTERP + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 Laszlo Molnar + Copyright (C) 2000-2004 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 + + + John F. Reiser + + */ + + +#include "include/linux.h" + + +/************************************************************************* +// configuration section +**************************************************************************/ + +// In order to make it much easier to move this code at runtime and execute +// it at an address different from it load address: there must be no +// static data, and no string constants. + +#define MAX_ELF_HDR 512 // Elf32_Ehdr + n*Elf32_Phdr must fit in this + + +/************************************************************************* +// "file" util +**************************************************************************/ + +struct Extent { + size_t size; // must be first to match size[0] uncompressed size + char *buf; +}; + + +static void +#if (ACC_CC_GNUC >= 0x030300) +__attribute__((__noinline__, __used__, regparm(3), stdcall)) +#endif +xread(struct Extent *x, char *buf, size_t count) +{ + char *p=x->buf, *q=buf; + size_t j; + if (x->size < count) { + exit(127); + } + for (j = count; 0!=j--; ++p, ++q) { + *q = *p; + } + x->buf += count; + x->size -= count; +} + + +/************************************************************************* +// util +**************************************************************************/ + +#if 1 //{ save space +#define ERR_LAB error: exit(127); +#define err_exit(a) goto error +#else //}{ save debugging time +#define ERR_LAB +static void +err_exit(int a) +{ + (void)a; // debugging convenience + exit(127); +} +#endif //} + +static void * +do_brk(void *addr) +{ + return brk(addr); +} + +extern char *mmap(void *addr, size_t len, + int prot, int flags, int fd, off_t offset); + +/************************************************************************* +// UPX & NRV stuff +**************************************************************************/ + +typedef void f_unfilter( + nrv_byte *, // also addvalue + nrv_uint, + unsigned cto8 // junk in high 24 bits +); +typedef int f_expand( + const nrv_byte *, nrv_uint, + nrv_byte *, nrv_uint *, int method +); + +static void +unpackExtent( + struct Extent *const xi, // input + struct Extent *const xo, // output + f_expand *(*get_fexp(int)), + f_unfilter *(*get_funf(int)) +) +{ + while (xo->size) { + struct b_info h; + // Note: if h.sz_unc == h.sz_cpr then the block was not + // compressible and is stored in its uncompressed form. + + // Read and check block sizes. + xread(xi, (char *)&h, sizeof(h)); + if (h.sz_unc == 0) { // uncompressed size 0 -> EOF + if (h.sz_cpr != UPX_MAGIC_LE32) // h.sz_cpr must be h->magic + err_exit(2); + if (xi->size != 0) // all bytes must be written + err_exit(3); + break; + } + if (h.sz_cpr <= 0) { + err_exit(4); +ERR_LAB + } + if (h.sz_cpr > h.sz_unc + || h.sz_unc > xo->size ) { + err_exit(5); + } + // Now we have: + // assert(h.sz_cpr <= h.sz_unc); + // assert(h.sz_unc > 0 && h.sz_unc <= blocksize); + // assert(h.sz_cpr > 0 && h.sz_cpr <= blocksize); + + if (h.sz_cpr < h.sz_unc) { // Decompress block + nrv_uint out_len; + int const j = (*get_fexp(h.b_method))((unsigned char *)xi->buf, h.sz_cpr, + (unsigned char *)xo->buf, &out_len, h.b_method); + if (j != 0 || out_len != (nrv_uint)h.sz_unc) + err_exit(7); + if (h.b_ftid!=0) { + (*get_funf(h.b_ftid))((unsigned char *)xo->buf, out_len, h.b_cto8); + } + xi->buf += h.sz_cpr; + xi->size -= h.sz_cpr; + } + else { // copy literal block + xread(xi, xo->buf, h.sz_cpr); + } + xo->buf += h.sz_unc; + xo->size -= h.sz_unc; + } +} + +// Create (or find) an escape hatch to use when munmapping ourselves the stub. +// Called by do_xmap to create it, and by assembler code to find it. +static void * +make_hatch(Elf32_Phdr const *const phdr) +{ + unsigned *hatch = 0; + if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) { + // The format of the 'if' is + // if ( ( (hatch = loc1), test_loc1 ) + // || ( (hatch = loc2), test_loc2 ) ) { + // action + // } + // which uses the comma to save bytes when test_locj involves locj + // and the action is the same when either test succeeds. + + // Try page fragmentation just beyond .text . + if ( ( (hatch = (void *)(phdr->p_memsz + phdr->p_vaddr)), + ( phdr->p_memsz==phdr->p_filesz // don't pollute potential .bss + && 4<=(~PAGE_MASK & -(int)hatch) ) ) // space left on page + // Try Elf32_Ehdr.e_ident[12..15] . warning: 'const' cast away + || ( (hatch = (void *)(&((Elf32_Ehdr *)phdr->p_vaddr)->e_ident[12])), + (phdr->p_offset==0) ) ) { + // Omitting 'const' saves repeated literal in gcc. + unsigned /*const*/ escape = 0xc36180cd; // "int $0x80; popa; ret" + // Don't store into read-only page if value is already there. + if (* (volatile unsigned*) hatch != escape) { + * hatch = escape; + } + } + } + return hatch; +} + +static void +__attribute__((regparm(2), stdcall)) +upx_bzero(char *p, size_t len) +{ + if (len) do { + *p++= 0; + } while (--len); +} +#define bzero upx_bzero + + +static void +__attribute__((regparm(3), stdcall)) +auxv_up(Elf32_auxv_t *av, unsigned const type, unsigned const value) +{ + if (av && 0==(1&(int)av)) /* PT_INTERP usually inhibits, except for hatch */ + for (;; ++av) { + if (av->a_type==type || (av->a_type==AT_IGNORE && type!=AT_NULL)) { + av->a_type = type; + av->a_un.a_val = value; + return; + } + } +} + +// The PF_* and PROT_* bits are {1,2,4}; the conversion table fits in 32 bits. +#define REP8(x) \ + ((x)|((x)<<4)|((x)<<8)|((x)<<12)|((x)<<16)|((x)<<20)|((x)<<24)|((x)<<28)) +#define EXP8(y) \ + ((1&(y)) ? 0xf0f0f0f0 : (2&(y)) ? 0xff00ff00 : (4&(y)) ? 0xffff0000 : 0) +#define PF_TO_PROT(pf) \ + ((PROT_READ|PROT_WRITE|PROT_EXEC) & ( \ + ( (REP8(PROT_EXEC ) & EXP8(PF_X)) \ + |(REP8(PROT_READ ) & EXP8(PF_R)) \ + |(REP8(PROT_WRITE) & EXP8(PF_W)) \ + ) >> ((pf & (PF_R|PF_W|PF_X))<<2) )) + + +// Find convex hull of PT_LOAD (the minimal interval which covers all PT_LOAD), +// and mmap that much, to be sure that a kernel using exec-shield-randomize +// won't place the first piece in a way that leaves no room for the rest. +static unsigned long // returns relocation constant +__attribute__((regparm(3), stdcall)) +xfind_pages(unsigned mflags, Elf32_Phdr const *phdr, int phnum, + char **const p_brk +) +{ + size_t lo= ~0, hi= 0, szlo= 0; + char *addr; + mflags += MAP_PRIVATE | MAP_ANONYMOUS; // '+' can optimize better than '|' + for (; --phnum>=0; ++phdr) if (PT_LOAD==phdr->p_type) { + if (phdr->p_vaddr < lo) { + lo = phdr->p_vaddr; + szlo = phdr->p_filesz; + } + if (hi < (phdr->p_memsz + phdr->p_vaddr)) { + hi = phdr->p_memsz + phdr->p_vaddr; + } + } + szlo += ~PAGE_MASK & lo; // page fragment on lo edge + lo -= ~PAGE_MASK & lo; // round down to page boundary + hi = PAGE_MASK & (hi - lo - PAGE_MASK -1); // page length + szlo = PAGE_MASK & (szlo - PAGE_MASK -1); // page length + addr = mmap((void *)lo, hi, PROT_READ|PROT_WRITE|PROT_EXEC, mflags, 0, 0); + *p_brk = hi + addr; // the logical value of brk(0) + munmap(szlo + addr, hi - szlo); // desirable if PT_LOAD non-contiguous + return (unsigned long)addr - lo; +} + +static Elf32_Addr // entry address +do_xmap( + int const fdi, + f_unfilter *(*get_funf(int)), + Elf32_Ehdr const *const ehdr, + struct Extent *const xi, + Elf32_auxv_t *const av) +{ + f_expand *(*(*get_fexp)(int)); + Elf32_Phdr const *phdr = (Elf32_Phdr const *) (ehdr->e_phoff + + (char const *)ehdr); + char *v_brk; + unsigned long const reloc = xfind_pages( + ((ET_DYN!=ehdr->e_type) ? MAP_FIXED : 0), phdr, ehdr->e_phnum, &v_brk); + int j; + + *(int *)(void *)&get_fexp = fdi; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) + if (PT_PHDR==phdr->p_type) { + auxv_up(av, AT_PHDR, phdr->p_vaddr + reloc); + } + else if (PT_LOAD==phdr->p_type) { + unsigned const prot = PF_TO_PROT(phdr->p_flags); + struct Extent xo; + size_t mlen = xo.size = phdr->p_filesz; + char *addr = xo.buf = (char *)phdr->p_vaddr; + char *haddr = phdr->p_memsz + addr; + size_t frag = (int)addr &~ PAGE_MASK; + mlen += frag; + addr -= frag; + addr += reloc; + haddr += reloc; + + // Decompressor can overrun the destination by 3 bytes. + if (addr != mmap(addr, mlen + (xi ? 3 : 0), PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_PRIVATE | (xi ? MAP_ANONYMOUS : 0), + fdi, phdr->p_offset - frag) ) { + err_exit(8); + } + if (xi) { + unpackExtent(xi, &xo, get_fexp, get_funf); + } + bzero(addr, frag); // fragment at lo end + frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary + bzero(mlen+addr, frag); // fragment at hi end + if (xi) { + void *const hatch = make_hatch(phdr); + if (0!=hatch) { + /* always update AT_NULL, especially for compressed PT_INTERP */ + auxv_up((Elf32_auxv_t *)(~1 & (int)av), AT_NULL, (unsigned)hatch); + } + } + if (0!=mprotect(addr, mlen, prot)) { + err_exit(10); +ERR_LAB + } + addr += mlen + frag; /* page boundary on hi end */ + if (addr < haddr) { // need pages for .bss + if (addr != mmap(addr, haddr - addr, prot, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, 0, 0 ) ) { + err_exit(9); + } + } + else if (xi) { // cleanup if decompressor overrun crosses page boundary + mlen = ~PAGE_MASK & (3+ mlen); + if (mlen<=3) { // page fragment was overrun buffer only + munmap(addr, mlen); + } + } + } + if (!xi) { // 2nd call (PT_INTERP); close()+check is smaller here + if (0!=close((int)fdi)) { + err_exit(11); + } + } + else { // 1st call (main); also have (0!=av) here + if (ET_DYN!=ehdr->e_type) { + // Needed only if compressed shell script invokes compressed shell. + do_brk(v_brk); + } + } + return ehdr->e_entry + reloc; +} + + +/************************************************************************* +// pti_main - called by our entry code +// +// This function is optimized for size. +**************************************************************************/ + +void *pti_main( + Elf32_auxv_t *const av, + unsigned const sz_compressed, + f_expand *(*get_fexp(int)), + Elf32_Ehdr *const ehdr, + struct Extent xo, + struct Extent xi, + f_unfilter *(*get_funf(int)) +) __asm__("pti_main"); + +void *pti_main( + Elf32_auxv_t *const av, + unsigned const sz_compressed, + f_expand *(*get_fexp(int)), + Elf32_Ehdr *const ehdr, // temp char[MAX_ELF_HDR+OVERHEAD] + struct Extent xo, // {sz_unc, ehdr} for ELF headers + struct Extent xi, // {sz_cpr, &b_info} for ELF headers + f_unfilter *(*get_funf(int)) +) +{ + Elf32_Phdr const *phdr = (Elf32_Phdr const *)(1+ ehdr); + Elf32_Addr entry; + + // sizeof(Ehdr+Phdrs), compressed; including b_info header + size_t const sz_pckhdrs = xi.size; + + // Uncompress Ehdr and Phdrs. + unpackExtent(&xi, &xo, get_fexp, get_funf); + + // Prepare to decompress the Elf headers again, into the first PT_LOAD. + xi.buf -= sz_pckhdrs; + xi.size = sz_compressed; + + // AT_PHDR.a_un.a_val is set again by do_xmap if PT_PHDR is present. + auxv_up(av, AT_PHDR , (unsigned)(1+(Elf32_Ehdr *)phdr->p_vaddr)); + auxv_up(av, AT_PHENT , ehdr->e_phentsize); + auxv_up(av, AT_PHNUM , ehdr->e_phnum); + //auxv_up(av, AT_PAGESZ, PAGE_SIZE); /* ld-linux.so.2 does not need this */ + auxv_up(av, AT_ENTRY , (unsigned)ehdr->e_entry); + entry = do_xmap((int)get_fexp, get_funf, ehdr, &xi, av); + + { // Map PT_INTERP program interpreter + int j; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) if (PT_INTERP==phdr->p_type) { + char const *const iname = (char const *)phdr->p_vaddr; + int const fdi = open(iname, O_RDONLY, 0); + if (0 > fdi) { + err_exit(18); + } + if (MAX_ELF_HDR!=read(fdi, (void *)ehdr, MAX_ELF_HDR)) { +ERR_LAB + err_exit(19); + } + entry = do_xmap(fdi, 0, ehdr, 0, 0); + break; + } + } + + return (void *)entry; +} + + +/* +vi:ts=4:et:nowrap +*/ + diff --git a/src/stub/src/i386-linux.elf.shell-entry.asm b/src/stub/src/i386-linux.elf.shell-entry.asm new file mode 100644 index 00000000..04b55f82 --- /dev/null +++ b/src/stub/src/i386-linux.elf.shell-entry.asm @@ -0,0 +1,183 @@ +; l_lx_sh86.asm -- Linux program entry point & decompressor (shell script) +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; Copyright (C) 2000-2004 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 +; +; +; John F. Reiser +; +; + + + BITS 32 + SECTION .text + CPU 386 + +; /************************************************************************* +; // program entry point +; // see glibc/sysdeps/i386/elf/start.S +; **************************************************************************/ + +GLOBAL _start +;__LEXEC000__ +_start: +;;;; int3 +;; 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. +;; Invoke gdb, and give a 'run' command. Define a single-step macro such as +;; define g +;; stepi +;; x/i $pc +;; end +;; and a step-over macro such as +;; define h +;; x/2i $pc +;; tbreak *$_ +;; continue +;; x/i $pc +;; end +;; Step through the code; remember that repeats the previous command. +;; + + call main ; push address of decompress subroutine +decompress: + +; /************************************************************************* +; // C callable decompressor +; **************************************************************************/ + +%define INP dword [esp+8*4+4] +%define INS dword [esp+8*4+8] +%define OUTP dword [esp+8*4+12] +%define OUTS dword [esp+8*4+16] + +;__LEXEC010__ + pusha + ; cld + + mov esi, INP + mov edi, OUTP + + or ebp, byte -1 +;;; align 8 + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" +%include "arch/i386/cl1_d32.ash" +%include "arch/i386/macros.ash" + cjt32 0 + +;__LEXEC015__ + ; eax is 0 from decompressor code + ;xor eax, eax ; return code + +; check compressed size + mov edx, INP + add edx, INS + cmp esi, edx + jz .ok + dec eax +.ok: + +; write back the uncompressed size + sub edi, OUTP + mov edx, OUTS + mov [edx], edi + + mov [7*4 + esp], eax +;__LEXEC017__ + popa + ret + +;__LEXEC020__ + +%define PAGE_SIZE ( 1<<12) + +%define MAP_FIXED 0x10 +%define MAP_PRIVATE 0x02 +%define MAP_ANONYMOUS 0x20 +%define PROT_READ 1 +%define PROT_WRITE 2 +%define PROT_EXEC 4 +%define __NR_mmap 90 + +%define szElf32_Ehdr 0x34 +%define szElf32_Phdr 8*4 +%define e_entry (16 + 2*2 + 4) +%define p_memsz 5*4 +%define szl_info 12 +%define szp_info 12 +%define p_filesize 4 + +; Decompress the rest of this loader, and jump to it +unfold: + pop esi ; &{ sz_uncompressed, sz_compressed, compressed_data...} + cld + lodsd + push eax ; sz_uncompressed of folded stub (junk, actually) + push esp ; &sz_uncompressed + mov edx, 0x01400000 ; origin of this program + mov eax, [p_memsz + szElf32_Ehdr + edx] ; length of loaded pages + add eax, edx + add edx, szElf32_Ehdr + 2*szElf32_Phdr ; convenient ptr + push eax ; &destination + + ; mmap space for unfolded stub, and uncompressed script + mov ecx, [szl_info + p_filesize + edx] ; script size + add ecx, 1+ 3+ (3 -1)+ PAGE_SIZE ; '\0' + "-c" + decompr_overrun + stub + + push eax ; offset (ignored when MAP_ANONYMOUS) + push byte -1 ; fd [required by *BSD for MAP_ANONYMOUS] + push byte MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS + push byte PROT_READ | PROT_WRITE | PROT_EXEC + push ecx ; length + push eax ; destination + mov ebx, esp ; address of parameter vector for __NR_mmap + push byte __NR_mmap + pop eax + int 0x80 + lea ebx, [3+ PAGE_SIZE + eax] ; place for uncompressed script + add esp, byte 6*4 ; discard args to mmap + + lodsd + push eax ; sz_compressed of folded stub + lodsd ; junk cto8, algo, unused[2] + push esi ; &compressed_data + call ebp ; decompress(&src, srclen, &dst, &dstlen) + pop eax ; discard &compressed_data + pop eax ; discard sz_compressed + ret ; &destination +main: + pop ebp ; &decompress + call unfold + +eof: +; __XTHEENDX__ + section .data + dd -1 + dw eof + +; vi:ts=8:et:nowrap + diff --git a/src/stub/src/i386-linux.elf.shell-fold.asm b/src/stub/src/i386-linux.elf.shell-fold.asm new file mode 100644 index 00000000..d4087ce1 --- /dev/null +++ b/src/stub/src/i386-linux.elf.shell-fold.asm @@ -0,0 +1,182 @@ +; fold_sh86.asm -- Linux program entry point & decompressor (shell script) +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; Copyright (C) 2000-2004 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 +; +; +; John F. Reiser +; +; + + + BITS 32 + SECTION .text + CPU 386 + +%define PAGE_SIZE ( 1<<12) +%define szElf32_Ehdr 0x34 +%define szElf32_Phdr 8*4 +%define e_entry (16 + 2*2 + 4) +%define szl_info 12 +%define szp_info 12 +%define a_type 0 +%define a_val 4 +%define sz_auxv 8 + +fold_begin: ; enter: %ebx= uncDst + ; also edx= szElf32_Ehdr + 2*szElf32_Phdr + &Elf32_Ehdr + pop eax ; discard &sz_uncompressed + pop eax ; discard sz_uncompressed + +; Move argc,argv,envp down to make room for complete Elf_auxv table. +; Linux kernel 2.4.2 and earlier give only AT_HWCAP and AT_PLATFORM +; because we have no PT_INTERP. Linux kernel 2.4.5 (and later?) +; give not quite everything. It is simpler and smaller code for us +; to generate a "complete" table where Elf_auxv[k -1].a_type = k. +; ld-linux.so.2 depends on AT_PHDR and AT_ENTRY, for instance + +%define AT_NULL 0 +%define AT_IGNORE 1 +%define AT_PHDR 3 +%define AT_NUMBER (5+ 37) +; 2002-11-09 glibc-2.2.90 AT_IGNOREPPC==22 plus 5 for future growth +; 2006-05-15 glibc-2.4-4 AT_L3_CACHESHAPE==37 + + mov esi, esp + sub esp, sz_auxv * AT_NUMBER ; more than 128 bytes + mov edi, esp +do_auxv: ; entry: %esi=src = &argc; %edi=dst. exit: %edi= &AT_NULL + ; cld + +L10: ; move argc+argv + lodsd + stosd + test eax,eax + jne L10 + +L20: ; move envp + lodsd + stosd + test eax,eax + jne L20 + +; complete Elf_auxv table full of AT_IGNORE + push edi ; save base of resulting table + inc eax ; convert 0 to AT_IGNORE + push byte 2 * (AT_NUMBER -1) ; less than 128 + pop ecx + rep stosd + dec eax ; convert AT_IGNORE into AT_NULL + stosd ; terminate Elf_auxv + stosd + pop edi ; base of resulting table + +L30: ; distribute existing Elf32_auxv into new table + lodsd + test eax,eax ; AT_NULL ? + xchg eax,ecx ; edx is busy, do not use + lodsd + je L40 + cmp ecx, byte AT_NUMBER + jae L30 + mov [a_type + sz_auxv*(ecx -1) + edi], ecx + mov [a_val + sz_auxv*(ecx -1) + edi], eax + jmp L30 +L40: + +%define OVERHEAD 2048 +%define MAX_ELF_HDR 512 + + sub esp, dword MAX_ELF_HDR + OVERHEAD + + xchg eax, ebx ; eax= uncDst + lea edx, [szl_info + szp_info + edx] ; cprSrc + mov ecx, [ edx] ; sz_unc + mov ebx, [4+ edx] ; sz_cpr + mov esi, eax ; extra copy of uncDst + pusha ; (AT_table,uncDst,f_decpr,&ehdr,{sz_cpr,cprSrc},{sz_unc,uncDst}) +EXTERN upx_main + call upx_main ; entry = upx_main(...) + pop ecx ; junk + push eax ; save entry address + popa ; edi= entry address; esi= uncDst + add esp, dword MAX_ELF_HDR + OVERHEAD ; remove temp space + + pop ecx ; argc + pop edx ; $0 filename, to become argv[0] + push edx ; restore $0 filename + + inc ecx + push esi ; &uncompressed shell script + sub esi, byte 3 + + mov [esi], word 0x632d ; "-c" + inc ecx + push esi ; &"-c" + + inc ecx + push edx ; argv[0] is duplicate of $0 + + push ecx ; new argc + push edi ; save entry address + +; _dl_start and company (ld-linux.so.2) assumes that it has virgin stack, +; and does not initialize all its stack local variables to zero. +; Ulrich Drepper (drepper@cyngus.com) has refused to fix the bugs. +; See GNU wwwgnats libc/1165 . + +%define N_STKCLR (0x100 + MAX_ELF_HDR + OVERHEAD)/4 + lea edi, [esp - 4*N_STKCLR] + pusha ; values will be zeroed + mov ebx,esp ; save + mov esp,edi ; Linux does not grow stack below esp + mov ecx, N_STKCLR + xor eax,eax + rep stosd + mov esp,ebx ; restore + +; Because the decompressed shell script occupies low memory anyway, +; there isn't much payback to unmapping the compressed script and +; ourselves the stub. We would need a place to put the escape hatch +; "int $0x80; popa; ret", and some kernels do not allow execution +; on the stack. So, we would have to dirty a page of the shell +; or of /lib/ld-linux.so. It's simpler just to omit the unmapping. + popa + ret + +%define __NR_mmap 90 + + global mmap +mmap: + push ebx + lea ebx, [2*4 + esp] + push byte __NR_mmap + pop eax + int 0x80 + pop ebx + ret + + +; vi:ts=8:et:nowrap + diff --git a/src/stub/src/i386-linux.elf.shell-fold.lds b/src/stub/src/i386-linux.elf.shell-fold.lds new file mode 100644 index 00000000..ecf37a36 --- /dev/null +++ b/src/stub/src/i386-linux.elf.shell-fold.lds @@ -0,0 +1,51 @@ +/* l_lx_sh86.lds -- + + This file is part of the UPX executable compressor. + + Copyright (C) 2000-2004 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 + + + John F. Reiser + + */ + + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +/*ENTRY(_start)*/ +PHDRS /* force exactly 1 ELF32_Phdr: in particular, no PT_GNU_STACK */ +{ + phdr0 PT_LOAD FILEHDR PHDRS FLAGS(7); +} + +SECTIONS +{ + /* 0x01400000: avoid 0x01000000 for shell itself being compressed */ + . = 0x01400000 + SIZEOF_HEADERS; + . = ALIGN(0x80); + .data : { /* put everything together in one Phdr */ + *(.text) + *(.rodata) + *(.data) + *(.bss) + *(COMMON) + } : phdr0 +} diff --git a/src/stub/src/i386-linux.elf.shell-main.c b/src/stub/src/i386-linux.elf.shell-main.c new file mode 100644 index 00000000..dc126028 --- /dev/null +++ b/src/stub/src/i386-linux.elf.shell-main.c @@ -0,0 +1,358 @@ +/* l_lx_sh.c -- stub loader for Linux x86 shell script executable + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 Laszlo Molnar + Copyright (C) 2000-2004 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 + + + John F. Reiser + + */ + + +#include "include/linux.h" + + +/************************************************************************* +// configuration section +**************************************************************************/ + +// In order to make it much easier to move this code at runtime and execute +// it at an address different from it load address: there must be no +// static data, and no string constants. + +#define MAX_ELF_HDR 512 // Elf32_Ehdr + n*Elf32_Phdr must fit in this + + +/************************************************************************* +// "file" util +**************************************************************************/ + +struct Extent { + size_t size; // must be first to match size[0] uncompressed size + char *buf; +}; + + +static void +xread(struct Extent *x, char *buf, size_t count) +{ + char *p=x->buf, *q=buf; + size_t j; + if (x->size < count) { + exit(127); + } + for (j = count; 0!=j--; ++p, ++q) { + *q = *p; + } + x->buf += count; + x->size -= count; +} + + +/************************************************************************* +// util +**************************************************************************/ + +#if 1 //{ save space +#define ERR_LAB error: exit(127); +#define err_exit(a) goto error +#else //}{ save debugging time +#define ERR_LAB +static void +err_exit(int a) +{ + (void)a; // debugging convenience + exit(127); +} +#endif //} + +static void * +do_brk(void *addr) +{ + return brk(addr); +} + +extern char *mmap(void *addr, size_t len, + int prot, int flags, int fd, off_t offset); + +/************************************************************************* +// UPX & NRV stuff +**************************************************************************/ + +typedef int f_expand( + const nrv_byte *, nrv_uint, + nrv_byte *, nrv_uint *, int method ); + +static void +unpackExtent( + struct Extent *const xi, // input + struct Extent *const xo, // output + f_expand *const f_decompress +) +{ + while (xo->size) { + struct b_info h; + // Note: if h.sz_unc == h.sz_cpr then the block was not + // compressible and is stored in its uncompressed form. + + // Read and check block sizes. + xread(xi, (char *)&h, sizeof(h)); + if (h.sz_unc == 0) { // uncompressed size 0 -> EOF + if (h.sz_cpr != UPX_MAGIC_LE32) // h.sz_cpr must be h->magic + err_exit(2); + if (xi->size != 0) // all bytes must be written + err_exit(3); + break; + } + if (h.sz_cpr <= 0) { + err_exit(4); +ERR_LAB + } + if (h.sz_cpr > h.sz_unc + || h.sz_unc > xo->size ) { + err_exit(5); + } + // Now we have: + // assert(h.sz_cpr <= h.sz_unc); + // assert(h.sz_unc > 0 && h.sz_unc <= blocksize); + // assert(h.sz_cpr > 0 && h.sz_cpr <= blocksize); + + if (h.sz_cpr < h.sz_unc) { // Decompress block + nrv_uint out_len; + int const j = (*f_decompress)((unsigned char *)xi->buf, h.sz_cpr, + (unsigned char *)xo->buf, &out_len, h.b_method ); + if (j != 0 || out_len != (nrv_uint)h.sz_unc) + err_exit(7); + xi->buf += h.sz_cpr; + xi->size -= h.sz_cpr; + } + else { // copy literal block + xread(xi, xo->buf, h.sz_cpr); + } + xo->buf += h.sz_unc; + xo->size -= h.sz_unc; + } +} + +static void +bzero(char *p, size_t len) +{ + if (len) do { + *p++= 0; + } while (--len); +} + +#define REP8(x) \ + ((x)|((x)<<4)|((x)<<8)|((x)<<12)|((x)<<16)|((x)<<20)|((x)<<24)|((x)<<28)) +#define EXP8(y) \ + ((1&(y)) ? 0xf0f0f0f0 : (2&(y)) ? 0xff00ff00 : (4&(y)) ? 0xffff0000 : 0) +#define PF_TO_PROT(pf) \ + (7 & (( (REP8(PROT_EXEC ) & EXP8(PF_X)) \ + |(REP8(PROT_READ ) & EXP8(PF_R)) \ + |(REP8(PROT_WRITE) & EXP8(PF_W)) ) \ + >> ((pf & (PF_R|PF_W|PF_X))<<2) )) + + +// Find convex hull of PT_LOAD (the minimal interval which covers all PT_LOAD), +// and mmap that much, to be sure that a kernel using exec-shield-randomize +// won't place the first piece in a way that leaves no room for the rest. +static unsigned long // returns relocation constant +__attribute__((regparm(3), stdcall)) +xfind_pages(unsigned mflags, Elf32_Phdr const *phdr, int phnum) +{ + size_t lo= ~0, hi= 0, szlo= 0; + char *addr; + mflags += MAP_PRIVATE | MAP_ANONYMOUS; // '+' can optimize better than '|' + for (; --phnum>=0; ++phdr) if (PT_LOAD==phdr->p_type) { + if (phdr->p_vaddr < lo) { + lo = phdr->p_vaddr; + szlo = phdr->p_filesz; + } + if (hi < (phdr->p_memsz + phdr->p_vaddr)) { + hi = phdr->p_memsz + phdr->p_vaddr; + } + } + if (MAP_FIXED & mflags) { // the "shell", and not the PT_INTERP + // This is a dirty hack to set the proper value for brk(0) as seen by + // the "shell" which we will mmap() soon, upon return to do_xmap(). + // It depends on our own brk() starting out at 0x08048000, which is the + // default base address used by /bin/ld for an ET_EXEC. We must brk() + // now. If we wait until after mmap() of shell pages, then the kernel + // "vma" containing our original brk() of 0x08048000 will not be contiguous + // with hi [the mmap'ed pages from the shell will be in between], + // and various linux kernels will not move the brk() in this case; + // the typical symptom is SIGSEGV early in ld-linux.so.2 (the PT_INTERP). + do_brk((void *)hi); + } + szlo += ~PAGE_MASK & lo; // page fragment on lo edge + lo -= ~PAGE_MASK & lo; // round down to page boundary + hi = PAGE_MASK & (hi - lo - PAGE_MASK -1); // page length + szlo = PAGE_MASK & (szlo - PAGE_MASK -1); // page length + addr = mmap((void *)lo, hi, PROT_READ|PROT_WRITE|PROT_EXEC, mflags, -1, 0); + + // Doing this may destroy the brk() that we set so carefully above. + // The munmap() is "needed" only for discontiguous PT_LOAD, + // and neither shells nor ld-linux.so.2 have that. + // munmap(szlo + addr, hi - szlo); + + return (unsigned long)addr - lo; +} + +// This do_xmap() has no Extent *xi input because it doesn't decompress anything; +// it only maps the shell and its PT_INTERP. So, it was specialized by hand +// to reduce compiled instruction size. gcc 2.91.66 does not notice that +// there is only one call to this static function (from getexec(), which +// would specify 0 for xi), so gcc does not propagate the constant parameter. +// Notice there is no make_hatch(), either. + +static Elf32_Addr // entry address +do_xmap(int const fdi, Elf32_Ehdr const *const ehdr, Elf32_auxv_t *const av) +{ + Elf32_Phdr const *phdr = (Elf32_Phdr const *) (ehdr->e_phoff + + (char const *)ehdr); + unsigned long const reloc = xfind_pages( + ((ET_DYN!=ehdr->e_type) ? MAP_FIXED : 0), phdr, ehdr->e_phnum); + int j; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) + if (PT_PHDR==phdr->p_type) { + av[AT_PHDR -1].a_un.a_val = phdr->p_vaddr; + } + else if (PT_LOAD==phdr->p_type) { + unsigned const prot = PF_TO_PROT(phdr->p_flags); + struct Extent xo; + size_t mlen = xo.size = phdr->p_filesz; + char *addr = xo.buf = (char *)phdr->p_vaddr; + char *haddr = phdr->p_memsz + addr; + size_t frag = (int)addr &~ PAGE_MASK; + mlen += frag; + addr -= frag; + addr += reloc; + haddr += reloc; + + // Decompressor can overrun the destination by 3 bytes. + if (addr != mmap(addr, mlen, PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_PRIVATE, + fdi, phdr->p_offset - frag) ) { + err_exit(8); + } + bzero(addr, frag); // fragment at lo end + frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary + bzero(mlen+addr, frag); // fragment at hi end + if (0!=mprotect(addr, mlen, prot)) { + err_exit(10); +ERR_LAB + } + addr += mlen + frag; /* page boundary on hi end */ + if (addr < haddr) { // need pages for .bss + if (addr != mmap(addr, haddr - addr, prot, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0 ) ) { + err_exit(9); + } + } + } + if (0!=close(fdi)) { + err_exit(11); + } + return ehdr->e_entry + reloc; +} + +static Elf32_Addr // entry address +getexec(char const *const fname, Elf32_Ehdr *const ehdr, Elf32_auxv_t *const av) +{ + int const fdi = open(fname, O_RDONLY, 0); + if (0 > fdi) { + err_exit(18); +ERR_LAB + } + if (MAX_ELF_HDR!=read(fdi, (void *)ehdr, MAX_ELF_HDR)) { + err_exit(19); + } + return do_xmap(fdi, ehdr, av); +} + + +/************************************************************************* +// upx_main - called by our entry code +// +// This function is optimized for size. +**************************************************************************/ + +void *upx_main( + Elf32_auxv_t *const av, + unsigned const junk, + f_expand *const f_decompress, + Elf32_Ehdr *const ehdr, // temp char[MAX_ELF_HDR] + struct Extent xi, + struct Extent xo +) __asm__("upx_main"); + +void *upx_main( + Elf32_auxv_t *const av, + unsigned const junk, + f_expand *const f_decompress, + Elf32_Ehdr *const ehdr, // temp char[MAX_ELF_HDR] + struct Extent xi, + struct Extent xo +) +{ + // 'fn' and 'efn' must not suffer constant-propagation by gcc + // UPX2 = offset to name_of_shell + // UPX3 = strlen(name_of_shell) + char * /*const*/ volatile fn = UPX2 + xo.buf; // past "-c" and "#!" + char * /*const*/ volatile efn = UPX3 + fn; // &terminator + Elf32_Addr entry; + + (void)junk; + unpackExtent(&xi, &xo, f_decompress); + + { // Map shell program + char const c = *efn; *efn = 0; // terminator + entry = getexec(fn, ehdr, av); + *efn = c; // replace terminator character + + // av[AT_PHDR -1].a_un.a_val is set again by do_xmap if PT_PHDR is present. + av[AT_PHDR -1].a_type = AT_PHDR ; // av[AT_PHDR-1].a_un.a_val is set by do_xmap + av[AT_PHENT -1].a_type = AT_PHENT ; av[AT_PHENT -1].a_un.a_val = ehdr->e_phentsize; + av[AT_PHNUM -1].a_type = AT_PHNUM ; av[AT_PHNUM -1].a_un.a_val = ehdr->e_phnum; + av[AT_PAGESZ -1].a_type = AT_PAGESZ; av[AT_PAGESZ -1].a_un.a_val = PAGE_SIZE; + av[AT_ENTRY -1].a_type = AT_ENTRY ; av[AT_ENTRY -1].a_un.a_val = entry; + } + + { // Map PT_INTERP program interpreter + Elf32_Phdr const *phdr = (Elf32_Phdr *)(1+ehdr); + int j; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) if (PT_INTERP==phdr->p_type) { + entry = getexec((char const *)phdr->p_vaddr, ehdr, 0); + break; + } + } + + return (void *)entry; +} + + +/* +vi:ts=4:et:nowrap +*/ + diff --git a/src/stub/src/i386-linux.kernel.vmlinux.asm b/src/stub/src/i386-linux.kernel.vmlinux.asm new file mode 100644 index 00000000..30e3922f --- /dev/null +++ b/src/stub/src/i386-linux.kernel.vmlinux.asm @@ -0,0 +1,147 @@ +; l_vmlinx.asm -- loader & decompressor for the vmlinux/i386 format +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; Copyright (C) 2004 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 +; +; +; John Reiser +; + + +%define jmps jmp short +%define jmpn jmp near +%include "arch/i386/macros.ash" + + BITS 32 + SECTION .text + ORG 0 + +; ============= +; ============= ENTRY POINT +; ============= + +start: +; In: +; %eax= &uncompressed [and final entry]; %ds= %es= __BOOT_DS +; %esp: &compressed; __BOOT_CS +; __LINUX000__ + pop edx ; &compressed; length at -4(%edx) + + push eax ; MATCH00(1/2) entry address; __BOOT_CS + push edi ; MATCH01 save + push esi ; MATCH02 save + +%ifdef __LXCALLT1__ + push eax ; MATCH03 src unfilter +%endif; __LXDUMMY0__ +%ifdef __LXCKLLT1__ + push eax ; MATCH03 src unfilter + push byte '?' ; MATCH04 cto unfilter +%endif; __LXMOVEUP__ + push 'ULEN' ; MATCH05 uncompressed length + call move_up ; MATCH06 + +; ============= +; ============= DECOMPRESSION +; ============= + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" + +; ============= +; ============= UNFILTER +; ============= + +%ifdef __LXCKLLT9__ + pop ecx ; MATCH05 len + pop edx ; MATCH04 cto + pop edi ; MATCH03 src + + ckt32 edi, dl ; dl has cto8 + ;edi: adjust for the difference between 0 origin of buffer at filter, + ;and actual origin of destination at unfilter. + ;Filter.addvalue is 0: destination origin is unknown at filter time. + ;The input data is still relocatable, and address is assigned later + ;[as of 2004-12-15 it is 'always' 0x100000]. + +%endif; __LXDUMMY2__ +%ifdef __LXCALLT9__ + pop ecx ; MATCH05 len + pop edi ; MATCH03 src + cjt32 0 +%endif; __LINUX990__ + pop esi ; MATCH02 restore + pop edi ; MATCH01 restore + xor ebx, ebx ; booting the 1st cpu + retf ; MATCH00 set cs + +%define UNLAP 0x10 +%define ALIGN (~0<<4) + ; must have 0==(UNLAP &~ ALIGN) + +move_up: + pop esi ; MATCH06 &decompressor + mov ecx,[-4+ esi] ; length of decompressor+unfilter + mov ebp,eax ; &uncompressed + add eax,[esp] ; MATCH05 ULEN + base; entry to decompressor + add eax, byte ~ALIGN + UNLAP + and eax, byte ALIGN + + std + ; copy decompressor + lea esi,[-1+ ecx + esi] ; unmoved top -1 of decompressor + lea edi,[-1+ ecx + eax] ; moved top -1 of decompressor + rep + movsb + + mov ecx,[-4+ edx] ; length of compressed data + add ecx, byte 3 + shr ecx,2 ; count of .long + ; copy compressed data + lea esi,[-4+ 4*ecx + edx] ; unmoved top -4 of compressed data + lea edi,[-4+ eax] ; moved top -4 of compressed data + rep + movsd + + cld + lea esi,[4+ edi] ; &compressed [after move] + mov edi,ebp ; &uncompressed + or ebp, byte -1 ; decompressor assumption + jmp eax ; enter moved decompressor + +; ============= +; ============= CUT HERE +; ============= + +%include "include/header.ash" + +eof: +; __LITHEEND__ + section .data + dd -1 + dw eof + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/i386-linux.kernel.vmlinuz.asm b/src/stub/src/i386-linux.kernel.vmlinuz.asm new file mode 100644 index 00000000..0118d13b --- /dev/null +++ b/src/stub/src/i386-linux.kernel.vmlinuz.asm @@ -0,0 +1,167 @@ +; l_vmlinz.asm -- loader & decompressor for the vmlinuz/i386 format +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +%define jmps jmp short +%define jmpn jmp near +%include "arch/i386/macros.ash" + + BITS 32 + SECTION .text + ORG 0 + +; ============= +; ============= ENTRY POINT +; ============= + +start: +; __LINUZ000__ + ;cli ;this must be true already + + ; The only facts about segments here, that are true for all kernels: + ; %cs is a valid "flat" code segment; no other segment reg is valid; + ; the next segment after %cs is a valid "flat" data segment, but + ; no segment register designates it yet. + mov eax, cs + add eax, byte 1<<3 ; the next segment after %cs + mov ds, eax + mov es, eax + ; fs, gs set by startup_32 in arch/i386/kernel/head.S + + ; Linux Documentation/i386/boot.txt "SAMPLE BOOT CONFIGURATION" says + ; 0x8000-0x8FFF Stack and heap [inside the "real mode segment", + ; just below the command line at offset 0x9000]. + + ; arch/i386/boot/compressed/head.S "Do the decompression ..." says + ; %esi contains the "real mode pointer" [as a 32-bit addr]. + + ; In any case, avoid EBDA (Extended BIOS Data Area) below 0xA0000. + ; boot.txt says 0x9A000 is the limit. LILO goes up to 0x9B000. + + lea ecx, ['STAK' + esi] ; (0x9000 + 0x90000) typical + mov [-8 + ecx], ecx ; 32-bit offset for stack pointer + mov [-4 + ecx], eax ; segment for stack + lss esp, [-8 + ecx] ; %ss:%esp= %ds:0x99000 + + push byte 0 + popf ; BIOS can leave random flags (such as NT) + +; do not clear .bss: at this point, .bss comes only from +; arch/i386/boot/compressed/*.o which we are replacing entirely + + or ebp, byte -1 ; decompressor assumption + mov eax, 'KEIP' ; 0x100000 : address of startup_32 + push cs ; MATCH00 + push eax ; MATCH00 entry address + push edi ; MATCH01 save + push esi ; MATCH02 save + +%ifdef __LZCALLT1__ + push eax ; MATCH03 src unfilter +%endif; __LZDUMMY0__ +%ifdef __LZCKLLT1__ + push eax ; MATCH03 src unfilter + push byte '?' ; MATCH04 cto unfilter + push 'ULEN' ; MATCH05 len unfilter +%endif; __LZDUMMY1__ +%ifdef __LBZIMAGE__ + mov esi, 'ESI0' + mov edi, 'EDI0' + mov ecx, 'ECX0' + + std + rep + movsd + cld + + mov esi, 'ESI1' ; esi = src for decompressor + xchg eax, edi ; edi = dst for decompressor = 0x100000 + jmp .1 + 'JMPD' ; jump to the copied decompressor +.1: +%else; __LZIMAGE0__ + +; this checka20 stuff looks very unneccessary to me +checka20: + inc edi ; change value + mov [1 + ebp], edi ; store to 0x000000 (even megabyte) + cmp [eax], edi ; compare 0x100000 ( odd megabyte) + je checka20 ; addresses are [still] aliased + + cld + mov esi, 'ESI1' + xchg eax, edi ; edi = dst for decompressor = 0x100000 + +%endif; __LZCUTPOI__ + +; ============= +; ============= DECOMPRESSION +; ============= + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" + +; ============= +; ============= UNFILTER +; ============= + +%ifdef __LZCKLLT9__ + pop ecx ; MATCH05 len + pop edx ; MATCH04 cto + pop edi ; MATCH03 src + + ckt32 0, dl ; dl has cto8 + ;0: Filter.addvalue = kernel_entry already did the 'add' at filter time + ;[the runtime address of the destination was known], so we save 4 bytes + ;(plus 1 cycle per instance) by not doing the 'add' when unfiltering. + ;If .addvalue was 0, then use 'edi' instead of 0 in call to ckt32, + ;to compensate for difference in origin of buffer. + +%endif; __LZDUMMY2__ +%ifdef __LZCALLT9__ + pop edi ; MATCH03 src + cjt32 0 +%endif; __LINUZ990__ + pop esi ; MATCH02 restore + pop edi ; MATCH01 restore + xor ebx, ebx ; booting the 1st cpu + retf ; MATCH00 set cs + +; ============= +; ============= CUT HERE +; ============= + +%include "include/header.ash" + +eof: +; __LITHEEND__ + section .data + dd -1 + dw eof + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/i386-win32.pe.asm b/src/stub/src/i386-win32.pe.asm new file mode 100644 index 00000000..5546ff0f --- /dev/null +++ b/src/stub/src/i386-win32.pe.asm @@ -0,0 +1,289 @@ +; l_w32pe.asm -- loader & decompressor for the w32/pe 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 +; 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 +; +; + + +%define UPX102 1 +%define jmps jmp short +%define jmpn jmp near +%define jnzn jnz near +%define jbn jb near +%include "arch/i386/macros.ash" + + BITS 32 + SECTION .text + ORG 0 + CPU 386 + +; ============= +; ============= ENTRY POINT +; ============= + +%ifdef __PEISDLL1__ + cmp byte [esp + 8], 1 + jnzn reloc_end_jmp +%endif; __PEMAIN01__ + pushad + mov esi, 'ESI0' ; relocated + lea edi, [esi + 'EDI0'] +%ifdef __PEICONS1__ + inc word [edi + 'ICON'] +%else; __PEICONS2__ + add word [edi + 'ICON'],'DR' +%endif; __PEICONSZ__ +%ifdef __PETLSHAK__ + mov dword [edi + 'TLSA'],'TLSV' +%endif; __PEMAIN02__ + push edi +mpass: + or ebp, byte -1 + +; ============= +; ============= DECOMPRESSION +; ============= + +%include "arch/i386/nrv2b_d32.ash" +%include "arch/i386/nrv2d_d32.ash" +%include "arch/i386/nrv2e_d32.ash" + +; ============= + +%ifdef __PEMULTIP__ + lodsd + add edi, eax + jbn mpass +%endif; __PEMAIN10__ + +; ============= + pop esi ; load vaddr + +; ============= +; ============= CALLTRICK +; ============= + +%ifdef __PECALLTR__ +%ifdef __PECTTPOS__ + lea edi, [esi + 'TEXV'] +%else; __PECTTNUL__ + mov edi, esi +%endif; __PEDUMMY0__ + cjt32 esi +%endif; __PEDUMMY1__ + +; ============= +; ============= IMPORTS +; ============= + +%ifdef __PEIMPORT__ + lea edi, [esi + 'BIMP'] +next_dll: + mov eax, [edi] + or eax, eax + jz imports_done + mov ebx, [edi+4] ; iat + lea eax, [eax + esi + 'IMPS'] + add ebx, esi + push eax + add edi, byte 8 + call [esi + 'LOAD'] ; LoadLibraryA + xchg eax, ebp +next_func: + mov al, [edi] + inc edi + or al, al + jz next_dll + mov ecx, edi ; something > 0 +%ifdef __PEIBYORD__ + jns byname +%ifdef __PEK32ORD__ + jpe not_kernel32 + mov eax, [edi] + add edi, byte 4 + mov eax, [eax + esi + 'K32O'] + jmps next_imp +not_kernel32: +%endif; __PEIMORD1__ + movzx eax, word [edi] + inc edi + push eax + inc edi + db 0xb9 ; mov ecx,xxxx +byname: +%endif; __PEIMPOR2__ + push edi + dec eax + repne + scasb + + push ebp + call [esi + 'GETP'] ; GetProcAddr + or eax, eax + jz imp_failed +next_imp: + mov [ebx], eax + add ebx, byte 4 + jmps next_func +imp_failed: +%ifdef __PEIERDLL__ + popad + xor eax, eax + retn 0x0c +%else; __PEIEREXE__ + call [esi + 'EXIT'] ; ExitProcess +%endif; __PEIMDONE__ +imports_done: +%endif; __PEIMPOR9__ + +; ============= +; ============= RELOCATION +; ============= + +%ifdef __PERELOC1__ + lea edi, [esi + 'BREL'] +; __PERELOC2__ + add edi, byte 4 +; __PERELOC3__ + lea ebx, [esi - 4] + reloc32 edi, ebx, esi +%endif; __PERELOC9__ + +; ============= + +; FIXME: depends on that in PERELOC1 edi is set!! +%ifdef __PERLOHI0__ + xchg edi, esi + lea ecx, [edi + 'DELT'] +%endif; __PERLOHIZ__ + +%ifdef __PERELLO0__ + db 0xA9 +rello0: + add [edi + eax], cx + lodsd + or eax, eax + jnz rello0 +%endif; __PERELLOZ__ + +; ============= + +%ifdef __PERELHI0__ + shr ecx, 16 + db 0xA9 +relhi0: + add [edi + eax], cx + lodsd + or eax, eax + jnz relhi0 +%endif; __PERELHIZ__ + +; ============= +%ifdef __PEDEPHAK__ + mov ebp, [esi + 'VPRO'] ; VirtualProtect + lea edi, [esi + 'IMGB'] + mov ebx, 'IMGL' ; 0x1000 or 0x2000 + + push eax ; provide 4 bytes stack + + push esp ; &lpflOldProtect on stack + push byte 4 ; PAGE_READWRITE + push ebx + push edi + call ebp + + %if 0 + or eax, eax + jz pedep9 ; VirtualProtect failed + %endif + + lea eax, [edi + 'SWRI'] + and byte [eax], 0x7f ; marks UPX0 non writeable + and byte [eax + 0x28], 0x7f ; marks UPX1 non writeable + + %if 0 + push esp + push byte 2 ; PAGE_READONLY + %else + pop eax + push eax + push esp + push eax ; restore protection + %endif + push ebx + push edi + call ebp + +pedep9: + pop eax ; restore stack +%endif; __PEDEPHAX__ + +; __PEMAIN20__ + popad + + +; clear the dirty stack +%macro clearstack128 1 + lea %1, [esp - 128] +%%clearst0: + push byte 0 + cmp esp, %1 + jnz %%clearst0 + sub esp, byte -128 +%endmacro + +%ifdef __PERETURN_CLEARSTACK__ + clearstack128 eax +%endif; __PERETURN_CLEARSTACK9__ +%ifdef __PEDOJUMP_CLEARSTACK__ + clearstack128 eax +%endif; __PEDOJUMP_CLEARSTACK9__ + + +; __PEMAIN21__ +reloc_end_jmp: + +%ifdef __PERETURN__ + xor eax, eax + inc eax + retn 0x0C +%else; __PEDOJUMP__ + jmpn .1+'JMPO' +.1: +%endif; __PEDUMMY3__ + +; ============= +; ============= CUT HERE +; ============= + +%include "include/header.ash" + +eof: +; __PETHEEND__ + section .data + dd -1 + dw eof + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/include/Makefile b/src/stub/src/include/Makefile new file mode 100644 index 00000000..b2e39f4b --- /dev/null +++ b/src/stub/src/include/Makefile @@ -0,0 +1,3 @@ +# convenience Makefile +default %: + $(MAKE) -C ../.. $@ diff --git a/src/stub/src/include/header.ash b/src/stub/src/include/header.ash new file mode 100644 index 00000000..5e62ad42 --- /dev/null +++ b/src/stub/src/include/header.ash @@ -0,0 +1,66 @@ +; header.ash -- +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +; ------------- HEADER ------------- ; __UPX1HEAD__ + + db 85,80,88,33 ; 0 UPX_MAGIC_LE32 + %if 0 + db 0 ; 4 version + db 0 ; 5 format + db 0 ; 6 compression method + db 0 ; 7 compression level + %else + ; another magic for PackHeader::putPackHeader + db 161,216,208,213 ; UPX_MAGIC2_LE32 + %endif + dd 0 ; 8 uncompressed adler32 + dd 0 ; 12 compressed adler32 + + %ifdef COM + dw 0 ; 16 uncompressed len + dw 0 ; 18 compressed len + db 0 ; 20 filter + db 45 ; 21 header checksum + %elifdef EXE + db 0,0,0 ; 16 uncompressed len + db 0,0,0 ; 19 compressed len + db 0,0,0 ; 22 original file size + db 0 ; 25 filter + db 45 ; 26 header checksum + %else + dd 0 ; 16 uncompressed len + dd 0 ; 20 compressed len + dd 0 ; 24 original file size + db 0 ; 28 filter id + db 0 ; 29 filter cto + db 0 ; unused + db 45 ; 31 header checksum + %endif + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/include/ident.ash b/src/stub/src/include/ident.ash new file mode 100644 index 00000000..60c27c19 --- /dev/null +++ b/src/stub/src/include/ident.ash @@ -0,0 +1,37 @@ +; ident.ash -- +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2006 Laszlo Molnar +; 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 +; +; + + +; ------------- COPYRIGHT ------------- + +%ifdef __IDENTSMA__ +%include "ident_s.ash" +%else; __IDENTBIG__ +%include "ident_n.ash" +%endif; __IDENTEND__ + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/include/ident_n.ash b/src/stub/src/include/ident_n.ash new file mode 100644 index 00000000..ca512d4c --- /dev/null +++ b/src/stub/src/include/ident_n.ash @@ -0,0 +1,42 @@ +; ident_n.ash -- +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2006 Laszlo Molnar +; 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 +; +; + + +; ------------- COPYRIGHT ------------- + + db 10,0 + db '$Info: ' + db 'This file is packed with the UPX executable packer ' + db 'http://upx.sf.net $' + db 10,0 + db '$Id: UPX ' + db 'UPXV' + db ' Copyright (C) 1996-UPXY the UPX Team. All Rights Reserved. $' + db 10,0 + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/include/ident_s.ash b/src/stub/src/include/ident_s.ash new file mode 100644 index 00000000..2d070c98 --- /dev/null +++ b/src/stub/src/include/ident_s.ash @@ -0,0 +1,37 @@ +; ident_s.ash -- +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2006 Laszlo Molnar +; 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 +; +; + + +; ------------- COPYRIGHT ------------- + + db 10 + db '$Id: UPX (C) 1996-UPXY the UPX Team. ' + db 'All Rights Reserved. http://upx.sf.net $' + db 10,0 + + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/include/linux.h b/src/stub/src/include/linux.h new file mode 100644 index 00000000..93c08b3a --- /dev/null +++ b/src/stub/src/include/linux.h @@ -0,0 +1,565 @@ +/* linux.hh -- common stuff the the Linux stub loaders + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2005 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2005 Laszlo Molnar + 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 + + */ + + +// NOTE: +// to avoid endless problems with moving libc and kernel headers, this +// section is now completely freestanding + + +#if defined(__GNUC__) +# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) +# define ACC_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) +# elif defined(__GNUC_MINOR__) +# define ACC_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) +# else +# define ACC_CC_GNUC (__GNUC__ * 0x10000L) +# endif +#endif + +#define ACC_UNUSED(var) ((void) var) + + +/************************************************************************* +// +**************************************************************************/ + +// +typedef long ptrdiff_t; +typedef long ssize_t; +typedef unsigned long size_t; +// +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned uint32_t; +#if (ACC_CC_GNUC >= 0x020800ul) +__extension__ typedef long long int64_t; +__extension__ typedef unsigned long long uint64_t; +#elif defined(_WIN32) +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +typedef long long int64_t; +typedef unsigned long long uint64_t; +#endif +typedef size_t uintptr_t; + +// +typedef long off_t; +//typedef int64_t off64_t; +//typedef size_t caddr_t; +typedef void* caddr_t; +typedef unsigned pid_t; + +struct rusage; +struct timex; +struct timeval { + unsigned tv_sec; + unsigned tv_usec; +}; +struct timespec { + unsigned tv_sec; + long tv_nsec; +}; + + +// misc constants + +#if defined(__amd64__) || defined(__powerpc64__) +#define PAGE_MASK (~0ul<<12) // discards the offset, keeps the page +#define PAGE_SIZE ( 1ul<<12) +#elif defined(__i386__) || defined(__powerpc__) || defined(__arm__) +#define PAGE_MASK (~0ul<<12) // discards the offset, keeps the page +#define PAGE_SIZE ( 1ul<<12) +#endif + +#define SEEK_SET 0 +#define SEEK_CUR 1 + +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 +#define O_EXCL 0200 + +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_OK 0 + +#define F_GETFD 1 +#define F_SETFD 2 +#define FD_CLOEXEC 1 + +// +#define ENOENT 2 +#define EINTR 4 + +// +#define PROT_READ 0x1 +#define PROT_WRITE 0x2 +#define PROT_EXEC 0x4 +#define PROT_NONE 0x0 + +#define MAP_SHARED 0x01 +#define MAP_PRIVATE 0x02 +#define MAP_FIXED 0x10 +#define MAP_ANONYMOUS 0x20 +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ + + +/************************************************************************* +// i386 syscalls +// +// Because of different versions and subtle bugs +// in both gcc and egcs we define all syscalls manually. +// +// Also, errno conversion is not necessary in our case, and we +// use optimized assembly statements to further decrease the size. +**************************************************************************/ + +#if defined(__i386__) /*{*/ + +// +#define __NR_exit 1 +#define __NR_fork 2 +#define __NR_read 3 +#define __NR_write 4 +#define __NR_open 5 +#define __NR_close 6 +#define __NR_waitpid 7 +#define __NR_unlink 10 +#define __NR_execve 11 +#define __NR_lseek 19 +#define __NR_getpid 20 +#define __NR_access 33 +#define __NR_brk 45 +#define __NR_fcntl 55 +#define __NR_getrusage 77 +#define __NR_gettimeofday 78 +#define __NR_mmap 90 +#define __NR_munmap 91 +#define __NR_ftruncate 93 +#define __NR_adjtimex 124 +#define __NR_mprotect 125 +#define __NR_personality 136 +#define __NR_msync 144 +#define __NR_nanosleep 162 +#define __NR_getcwd 183 + +#undef _syscall0 +#undef _syscall1 +#undef _syscall2 +#undef _syscall3 +#ifndef __NR__exit +# define __NR__exit __NR_exit +#endif + +#define Z0(x) (__builtin_constant_p(x) && (long)(x) == 0) +#define Z1(x) (__builtin_constant_p(x) && (long)(x) >= -128 && (long)(x) <= 127) + +#define _syscall0(type,name) \ +type name(void) \ +{ \ + long __res; \ + if (Z1(__NR_##name)) { \ + __asm__ __volatile__ ("push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res) \ + : [sysN] "g" (__NR_##name)); \ + } else { \ + __asm__ __volatile__ ("int $0x80" \ + : "=a" (__res) \ + : [sysN] "a" (__NR_##name)); \ + } \ + return (type) __res; \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ + long __res, junk; \ + if (Z1(__NR_##name)) { \ + if (Z0(arg1)) { \ + __asm__ __volatile__ ("xorl %%ebx,%%ebx; push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res) \ + : [sysN] "g" (__NR_##name) \ + : "ebx"); \ + } else if (Z1(arg1)) { \ + __asm__ __volatile__ ("push %[a1]; popl %%ebx; push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res) \ + : [sysN] "g" (__NR_##name), [a1] "g" ((long)(arg1)) \ + : "ebx"); \ + } else { \ + __asm__ __volatile__ ("push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res), "=b" (junk) \ + : [sysN] "g" (__NR_##name),"b" ((long)(arg1))); \ + } \ + } else { \ + __asm__ __volatile__ ("int $0x80" \ + : "=a" (__res), "=b" (junk) \ + : "a" (__NR_##name),"b" ((long)(arg1))); \ + } \ + return (type) __res; \ +} + +#define _syscall1nr(name,type1,arg1) \ +void __attribute__((__noreturn__)) name(type1 arg1) \ +{ \ + if (Z1(__NR_##name)) { \ + if (Z0(arg1)) { \ + __asm__ __volatile__ ("xorl %%ebx,%%ebx; push %0; popl %%eax; int $0x80" \ + : : "g" (__NR_##name) ); \ + } else if (Z1(arg1)) { \ + __asm__ __volatile__ ("push %[a1]; popl %%ebx; push %[sysN]; popl %%eax; int $0x80" \ + : : [sysN] "g" (__NR_##name), [a1] "g" ((long)(arg1)) ); \ + } else { \ + __asm__ __volatile__ ("push %0; popl %%eax; int $0x80" \ + : : "g" (__NR_##name),"b" ((long)(arg1))); \ + } \ + } else { \ + __asm__ __volatile__ ("int $0x80" \ + : : "a" (__NR_##name),"b" ((long)(arg1))); \ + } \ + for(;;) ; \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ + long __res, junkb, junkc; \ + if (Z1(__NR_##name)) { \ + if (Z0(arg1) && Z0(arg2)) { \ + __asm__ __volatile__ ("xorl %%ecx,%%ecx; xorl %%ebx,%%ebx; push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res) \ + : [sysN] "g" (__NR_##name) \ + : "ebx", "ecx"); \ + } else if (Z0(arg1) && Z1(arg2)) { \ + __asm__ __volatile__ ("push %[a2]; popl %%ecx; xorl %%ebx,%%ebx; push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res) \ + : [sysN] "g" (__NR_##name), [a2] "g" ((long)(arg2)) \ + : "ebx", "ecx"); \ + } else if (Z1(arg1) && Z0(arg2)) { \ + __asm__ __volatile__ ("xorl %%ecx,%%ecx; push %[a1]; popl %%ebx; push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res) \ + : [sysN] "g" (__NR_##name), [a1] "g" ((long)(arg1)) \ + : "ebx", "ecx"); \ + } else if (Z1(arg1) && Z1(arg2)) { \ + __asm__ __volatile__ ("push %[a2]; popl %%ecx; push %[a1]; popl %%ebx; push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res) \ + : [sysN] "g" (__NR_##name), [a1] "g" ((long)(arg1)), [a2] "g" ((long)(arg2)) \ + : "ebx", "ecx"); \ + } else if (Z0(arg1)) { \ + __asm__ __volatile__ ("xorl %%ebx,%%ebx; push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res), "=c" (junkc) \ + : [sysN] "g" (__NR_##name),"c" ((long)(arg2)) \ + : "ebx"); \ + } else if (Z0(arg2)) { \ + __asm__ __volatile__ ("push %[sysN]; popl %0; xorl %%ecx,%%ecx; int $0x80" \ + : "=a" (__res), "=b" (junkb) \ + : [sysN] "g" (__NR_##name),"b" ((long)(arg1)) \ + : "ecx"); \ + } else if (Z1(arg1)) { \ + __asm__ __volatile__ ("push %[sysN]; popl %0; push %[a1]; popl %%ebx; int $0x80" \ + : "=a" (__res), "=c" (junkc) \ + : [sysN] "g" (__NR_##name), [a1] "g" ((long)(arg1)),"c" ((long)(arg2)) \ + : "ebx"); \ + } else if (Z1(arg2)) { \ + __asm__ __volatile__ ("push %[sysN]; popl %0; push %[a2]; popl %%ecx; int $0x80" \ + : "=a" (__res), "=b" (junkb) \ + : [sysN] "g" (__NR_##name),"b" ((long)(arg1)), [a2] "g" ((long)(arg2)) \ + : "ecx"); \ + } else { \ + __asm__ __volatile__ ("push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res), "=b" (junkb), "=c" (junkc) \ + : [sysN] "g" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ + } \ + } else { \ + __asm__ __volatile__ ("int $0x80" \ + : "=a" (__res), "=b" (junkb), "=c" (junkc) \ + : [sysN] "a" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ + } \ + return (type) __res; \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ + long __res, junkb, junkc, junkd; \ + if (Z1(__NR_##name)) { \ + __asm__ __volatile__ ("push %[sysN]; popl %0; int $0x80" \ + : "=a" (__res), "=b" (junkb), "=c" (junkc), "=d" (junkd) \ + : [sysN] "g" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3))); \ + } else { \ + __asm__ __volatile__ ("int $0x80" \ + : "=a" (__res), "=b" (junkb), "=c" (junkc), "=d" (junkd) \ + : [sysN] "a" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3))); \ + } \ + return (type) __res; \ +} + + +#define _exit syscall_exit +#define exit syscall_exit + +static inline _syscall2(int,access,const char *,file,int,mode) +static inline _syscall1(int,adjtimex,struct timex *,ntx) +static inline _syscall1(void *,brk,void *,high) +static inline _syscall1(int,close,int,fd) +static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) +static inline _syscall1nr(_exit,int,exitcode) +static inline _syscall3(int,fcntl,int,fd,int,cmd,long,arg) +static inline _syscall2(int,ftruncate,int,fd,size_t,len) +static inline _syscall0(pid_t,fork) +static inline _syscall2(int,getcwd,char *,buf,unsigned long,size); +static inline _syscall0(pid_t,getpid) +static inline _syscall2(int,getrusage,int,who,struct rusage *,usage); +static inline _syscall2(int,gettimeofday,struct timeval *,tv,void *,tz) +static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,whence) +static inline _syscall3(int,mprotect,void *,addr,size_t,len,int,prot) +static inline _syscall3(int,msync,const void *,start,size_t,length,int,flags) +static inline _syscall2(int,munmap,void *,start,size_t,length) +static inline _syscall2(int,nanosleep,const struct timespec *,rqtp,struct timespec *,rmtp) +static inline _syscall3(int,open,const char *,file,int,flag,int,mode) +static inline _syscall1(int,personality,unsigned long,persona) +static inline _syscall3(ssize_t,read,int,fd,void *,buf,size_t,count) +static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) +static inline _syscall3(ssize_t,write,int,fd,const void *,buf,size_t,count) +static inline _syscall1(int,unlink,const char *,file) + +#undef Z0 +#undef Z1 + +#else /*}{ generic */ + +void *brk(void *); +int close(int); +void *mmap(void *, size_t, int, int, int, off_t); +int munmap(void *, size_t); +int mprotect(void const *, size_t, int); +int open(char const *, unsigned, unsigned); +ssize_t read(int, void *, size_t); +void exit(int) __attribute__((noreturn)); + +#endif /*}*/ + + +/************************************************************************* +// +**************************************************************************/ + +typedef uint16_t Elf32_Half; +typedef uint16_t Elf64_Half; +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; +typedef uint32_t Elf32_Addr; +typedef uint64_t Elf64_Addr; +typedef uint32_t Elf32_Off; +typedef uint64_t Elf64_Off; +typedef uint16_t Elf32_Section; +typedef uint16_t Elf64_Section; +typedef Elf32_Half Elf32_Versym; +typedef Elf64_Half Elf64_Versym; + + +#define EI_NIDENT 16 + +typedef struct +{ + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +typedef struct +{ + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +typedef struct +{ + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +typedef struct +{ + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +} Elf64_Phdr; + +typedef struct +{ + uint32_t a_type; + union { + uint32_t a_val; + } a_un; +} Elf32_auxv_t; + +typedef struct +{ + uint64_t a_type; + union + { + uint64_t a_val; + } a_un; +} Elf64_auxv_t; + +#define AT_NULL 0 +#define AT_IGNORE 1 +#define AT_PHDR 3 +#define AT_PHENT 4 +#define AT_PHNUM 5 +#define AT_PAGESZ 6 +#define AT_ENTRY 9 + +#define ET_EXEC 2 +#define ET_DYN 3 + +#define PF_X 1 +#define PF_W 2 +#define PF_R 4 + +#define PT_LOAD 1 +#define PT_INTERP 3 +#define PT_PHDR 6 + + +/************************************************************************* +// UPX stuff +**************************************************************************/ + +// !!! must be the same as in p_unix.h !!! +#define OVERHEAD 2048 + +#define UPX_MAGIC_LE32 0x21585055 // "UPX!" + +// patch constants for our loader (le32 format) +#define UPX1 0x31585055 // "UPX1" +#define UPX2 0x32585055 // "UPX2" +#define UPX3 0x33585055 // "UPX4" +#define UPX4 0x34585055 // "UPX4" +#define UPX5 0x35585055 // "UPX5" + + +typedef int nrv_int; +typedef int nrv_int32; +typedef unsigned int nrv_uint; +typedef unsigned int nrv_uint32; +#define nrv_byte unsigned char +#define nrv_bytep unsigned char * +#define nrv_voidp void * + + +// From ../p_unix.h +struct b_info { // 12-byte header before each compressed block + uint32_t sz_unc; // uncompressed_size + uint32_t sz_cpr; // compressed_size + unsigned char b_method; // compression algorithm + unsigned char b_ftid; // filter id + unsigned char b_cto8; // filter parameter + unsigned char b_unused; +}; + +struct l_info // 12-byte trailer in header for loader (offset 116) +{ + uint32_t l_checksum; + uint32_t l_magic; + uint16_t l_lsize; + uint8_t l_version; + uint8_t l_format; +}; + +struct p_info // 12-byte packed program header follows stub loader +{ + uint32_t p_progid; + uint32_t p_filesize; + uint32_t p_blocksize; +}; + + +#define CONST_CAST(type, var) \ + ((type) ((uintptr_t) (var))) + + +#if (ACC_CC_GNUC >= 0x030300) +# define __attribute_cdecl __attribute__((__cdecl__, __used__)) +#elif (ACC_CC_GNUC >= 0x020700) +# define __attribute_cdecl __attribute__((__cdecl__)) +#else +# define __attribute_cdecl +#endif + + +/* +vi:ts=4:et:nowrap +*/ + diff --git a/src/stub/src/m68k-atari.tos.asm b/src/stub/src/m68k-atari.tos.asm new file mode 100644 index 00000000..177a2915 --- /dev/null +++ b/src/stub/src/m68k-atari.tos.asm @@ -0,0 +1,558 @@ +; l_tos.s -- loader & decompressor for the atari/tos format +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; 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 +; +; + + +#define NRV_BB 8 +#include "../../version.h" + + +; +; see also: +; freemint/sys/mint/basepage.h +; freemint/sys/mint/mem.h (FILEHEAD) +; freemint/sys/memory.c (load_region, load_and_reloc) +; freemint/sys/arch/cpu.S (cpush) +; + +; +; This file is first preprocessed by cpp, then the a68k assembler +; is run and finally the generated object file is translated to a .h file +; by a simple perl script. We also maintain compatiblity with the pasm +; assembler (which must be started in the emulator window). +; + + +#if defined(__A68K__) +# define align4 align 0,4 +# define L(label) \/**/label +# define macro(name) name macro +# define text section code +#elif defined(__ASL__) +# define align4 align 4 +# define L(label) $$/**/label +# define macro(name) name macro +# define text section code +#else +# define align4 align 4 +# define L(label) ./**/label +# define macro(name) macro name +#endif + +; defines needed for including ident_[ns].ash +#define db dc.b +#define dw dc.w +#define dd dc.l + + +; basepage offsets +p_lowtpa equ $0 ; .l pointer to self (bottom of TPA) +p_hitpa equ $4 ; .l pointer to top of TPA + 1 +p_tbase equ $8 ; .l base of text segment +p_tlen equ $c ; .l length of text segment +p_dbase equ $10 ; .l base of data segment +p_dlen equ $14 ; .l length of data segment +p_bbase equ $18 ; .l base of BSS segment +p_blen equ $1c ; .l length of BSS segment +p_dta equ $20 ; .l pointer to current DTA +p_parent equ $24 ; .l pointer to parent's basepage +p_flags equ $28 ; .l memory usage flags +p_env equ $2c ; .l pointer to environment string + +; +; long living registers: +; d4 p_tbase - start of text segment +; a6 p_bbase - start of decompressed bss segment, this also is the +; - end of decompressed text+data +; - start of decompressed relocations +; - start of dirty bss +; ASTACK (a7) - final startup code copied below stack +; + + +; /************************************************************************* +; // flush cache macros +; **************************************************************************/ + +; note: +; GEMDOS/XBIOS trashes d0, d1, d2, a0, a1, a2 + + +; long Ssystem(S_FLUSHCACHE, base, length) - inside the kernel this +; is called `cpush(base, length)'. +; returns: d0.l should be either 0 or -32 (== ENOSYS == EINVFN) +; Available since FreeMiNT 1.15.1 (1999-04-13). +; +; Note that on a 68060 FreeMiNT just uses `cpusha bc' in all cases, +; so we don't bother passing base and length. (info: base would be d4) + +macro(MINT_FLUSH_CACHE) + pea -1 ; length + clr.l -(sp) ; base +#if 0 + move.w #$0016,-(sp) ; S_FLUSHCACHE (22) + move.w #$0154,-(sp) ; Ssystem (340) +#else + move.l #$01540016,-(sp) +#endif + trap #1 ; GEMDOS + lea 12(sp),sp + endm + + +; First try `cpusha bc' (68040/68060). If that fails try temporary changing +; the cache control register (68030). + +macro(SUPEXEC_FLUSH_CACHE) + pea \@super(pc) + move.w #$0026,-(sp) ; Supexec (38) + trap #14 ; XBIOS + addq.l #6,sp + bra \@done + + +; exception handler +\@exception: move.l a1,sp ; restore stack (SSP) + jmp (a0) ; and continue + + +\@super: move.l ($10),-(sp) + move.l ($2c),-(sp) + move.l ($f4),-(sp) + move.l sp,a1 ; save stack pointer (SSP) + + ; set exception vectors + lea \@exception(pc),a0 + move.l a0,($10) + move.l a0,($2c) + move.l a0,($f4) + nop ; flush write pipeline + + ; try 68040 / 68060 + lea \@1(pc),a0 + dc.w $f4f8 ; cpusha bc + bra \@ret +\@1: + ; try 68030 + lea \@2(pc),a0 + dc.l $4e7a0002 ; movec.l cacr,d0 + move.l d0,d1 + or.w #$0808,d1 + dc.l $4e7b1002 ; movec.l d1,cacr + dc.l $4e7b0002 ; movec.l d0,cacr +;;; bra \@ret +\@2: + +\@ret: move.l (sp)+,($f4) + move.l (sp)+,($2c) + move.l (sp)+,($10) + nop ; flush write pipeline + rts + +\@done: + endm + + + +macro(BOTH_FLUSH_CACHE) + MINT_FLUSH_CACHE + tst.l d0 + beq \@done + SUPEXEC_FLUSH_CACHE +\@done: + endm + + + +#define ASTACK a7 + +#if 1 +# define FLUSH_CACHE BOTH_FLUSH_CACHE +#elif 0 +# define FLUSH_CACHE MINT_FLUSH_CACHE +#else +# undef FLUSH_CACHE +#endif + + +; /************************************************************************* +; // entry - the text segment of a compressed executable +; // +; // note: compressed programs never have the F_SHTEXT flag set, +; // so we can assume that the text, data & bss segments +; // are contiguous in memory +; **************************************************************************/ + +#if defined(__ASL__) + padding off +#endif + text + dc.b 'UPX1' ; marker for o2bin.pl + +start: + move.l a0,d0 ; a0 is basepage if accessory + beq L(l_app) + move.l 4(a0),sp ; accessory - get stack + bra L(start) + +L(l_app): move.l 4(sp),d0 ; application - get basepage +L(start): movem.l d1-d7/a0-a6,-(sp) + + +; ------------- restore original basepage + + ; we also setup d4 and a6 here, and we prepare a4 + + move.l d0,a2 ; a2 = basepage + addq.l #p_tbase,a2 + move.l (a2)+,a6 + move.l a6,d4 ; d4 = p_tbase + move.l #'up11',(a2) ; p_tlen + add.l (a2)+,a6 + move.l a6,(a2)+ ; p_dbase + move.l #'up12',(a2) ; p_dlen + add.l (a2)+,a6 ; a6 = decompressed p_bbase + move.l (a2),a4 ; a4 = compressed p_bbase + move.l a6,(a2)+ ; p_bbase + move.l #'up13',(a2) ; p_blen + + +; ------------- copy data segment (from a4 to a3, downwards) + + ; a4 (top of compressed data) already initialized above + + move.l d4,a3 + add.l #'up21',a3 ; top of data segment + offset + +#if defined(SMALL) + + move.l #'up22',d0 ; (len / 4) + + ; copy 4 bytes per loop +L(loop): move.l -(a4),-(a3) + ;;subq.l #1,d0 + dc.b 'u1' ; subq.l #1,d0 / subq.w #1,d0 + bne L(loop) + +#else + + move.l #'up22',d0 ; (len / 160) + + ; loop1 - use 10 registers to copy 4*10*4 = 160 bytes per loop +L(loop1): + lea.l -160(a4),a4 + movem.l 120(a4),d1-d3/d5-d7/a0-a2/a5 + movem.l d1-d3/d5-d7/a0-a2/a5,-(a3) + movem.l 80(a4),d1-d3/d5-d7/a0-a2/a5 + movem.l d1-d3/d5-d7/a0-a2/a5,-(a3) + movem.l 40(a4),d1-d3/d5-d7/a0-a2/a5 + movem.l d1-d3/d5-d7/a0-a2/a5,-(a3) + movem.l (a4),d1-d3/d5-d7/a0-a2/a5 + movem.l d1-d3/d5-d7/a0-a2/a5,-(a3) + ;;subq.l #1,d0 + dc.b 'u1' ; subq.l #1,d0 / subq.w #1,d0 + bne L(loop1) + + ; loop2 - copy the remaining 4..160 bytes + ;;moveq.l #xx,d0 ; ((len % 160) / 4) - 1 + dc.b 'u2' ; moveq.l #xx,d0 + +L(loop2): move.l -(a4),-(a3) + dbra d0,L(loop2) + +#endif + + ; a3 now points to the start of the compressed block + + +; ------------- copy code to stack and setup ASTACK + +; Copy the final startup code below the stack. This will get +; called via "jmp (ASTACK)" after decompression and relocation. + +copy_to_stack: + + lea.l clear_bss_end(pc),a2 + move.l d4,-(ASTACK) ; entry point for final jmp + + moveq.l #((clear_bss_end-clear_bss)/2-1),d5 +L(loop): move.w -(a2),-(ASTACK) + subq.l #1,d5 + bcc L(loop) + +#ifdef FLUSH_CACHE + ; patch code: on the stack, the `rts' becomes a `nop' + move.w #$4e71,flush_cache_rts-clear_bss(ASTACK) +#endif + + ; note: d5.l is now -1 (needed for decompressor) + + +; ------------- + +#ifdef FLUSH_CACHE + bsr flush_cache +#endif + + +; ------------- prepare decompressor + + ; a3 still points to the start of the compressed block + move.l d4,a4 ; dest. for decompressing + +#define NRV_NO_INIT + + ;;moveq.l #-1,d5 ; last_off = -1 + moveq.l #-128,d0 ; d0.b = $80 +#if defined(NRV2B) + moveq.l #-1,d7 + moveq.l #-$68,d6 ; 0xffffff98 + lsl.w #5,d6 ; 0xfffff300 == -0xd00 +#elif defined(NRV2D) + moveq.l #-1,d7 + moveq.l #-$50,d6 ; 0xffffffb0 + lsl.w #4,d6 ; 0xfffffb00 == -0x500 +#elif defined(NRV2E) + moveq.l #0,d7 + moveq.l #-$50,d6 ; 0xffffffb0 + lsl.w #4,d6 ; 0xfffffb00 == -0x500 +#else +# error +#endif + + +; ------------- jump to copied decompressor + + move.l d4,a2 + add.l #'up31',a2 + jmp (a2) ; jmp decompr_start + + +; /************************************************************************* +; // this is the final part of the startup code which runs in the stack +; **************************************************************************/ + +; ------------- clear dirty bss + +clear_bss: + + ; on entry: + ; ASTACK == pc == clear_bss (on stack) + ; a6 start of dirty bss [long living register] + ; d6.l number of clr loops + ; d3.l 0 + + +#if defined(SMALL) +L(loop): move.l d3,(a6)+ + ;;subq.l #1,d6 + dc.b 'u4' ; subq.l #1,d6 / subq.w #1,d6 + bne L(loop) +#else + ; the dirty bss is usually not too large, so we don't + ; bother making movem optimizations here +L(loop): move.l d3,(a6)+ + move.l d3,(a6)+ + move.l d3,(a6)+ + move.l d3,(a6)+ + ;;subq.l #1,d6 + dc.b 'u4' ; subq.l #1,d6 / subq.w #1,d6 + bne L(loop) +#endif + + +; ------------- flush the cache + +#ifdef FLUSH_CACHE + +; info: +; This is also called as a subroutine (before decompression, NOT running +; in the stack). When running in the stack the `rts' is replaced by a `nop'. + +flush_cache: + FLUSH_CACHE +flush_cache_rts: + rts + +#endif + + +; ------------- restore ASTACK + + lea clear_bss_end-clear_bss+4(ASTACK),sp + + ;; assert sp == clear_bss_end(pc)+4 + + +; ------------- clear the dirty stack + +#if 0 + +; better don't do this - we are currently running in the stack +; and don't want to make yet another instruction-cache-line dirty + +clear_dirty_stack: + + ; clear down to clear_bss(pc) + 32 extra longs + moveq.l #((L(loop)-clear_bss+3)/4+32-1),d0 + lea L(loop)(pc),a0 +L(loop): move.l d3,-(a0) + dbra d0,L(loop) + +#endif + + +; ------------- start program + + movem.l (sp)+,d1-d7/a0-a6 + move.l a0,d0 + beq L(l_app) + sub.l sp,sp ; accessory: no stack +L(l_app): dc.w $4ef9 ; jmp $xxxxxxxx - jmp to text segment + +clear_bss_end: + + +; /************************************************************************* +; // UPX ident & packheader +; **************************************************************************/ + +#if defined(SMALL) +# include "include/ident_s.ash" +#else +# include "include/ident_n.ash" +#endif + + align4 + + ; 32 bytes - #include "header.ash" + dc.b 85,80,88,33 ; UPX_MAGIC_LE32 + dc.b 161,216,208,213 ; UPX_MAGIC2_LE32 + dc.l 0,0,0,0,0 + dc.b 0,0,0,45 + + + ; end of text segment - size is a multiple of 4 + + +; /************************************************************************* +; // This part is appended after the compressed data. +; // It runs in the last part of the dirty bss (after the +; // relocations and the original fileheader). +; **************************************************************************/ + +cutpoint: + +; ------------- decompress (from a3 to a4) + +#define a0 A3 +#define a1 A4 +#define a3 A2 +#define d2 D3 + +#if defined(NRV2B) +# include "arch/m68k/nrv2b_d.ash" +#elif defined(NRV2D) +# include "arch/m68k/nrv2d_d.ash" +#elif defined(NRV2E) +# include "arch/m68k/nrv2e_d.ash" +#else +# error +#endif + +#undef a0 +#undef a1 +#undef a3 +#undef d2 + + ; note: d3.l is 0 from decompressor above + + +; ------------- prepare d6 for clearing the dirty bss + +#if defined(SMALL) + move.l #'up41',d6 ; dirty_bss / 4 +#else + move.l #'up41',d6 ; dirty_bss / 16 +#endif + + +; ------------- test if we need to reloc + + dc.b 'u3' ; moveq.l #1,d5 / jmp (ASTACK) + + +; ------------- reloc + +reloc: + +; The decompressed relocations now are just after the decompressed +; data segment, i.e. at the beginning of the (dirty) bss. + + ; note: d3.l is still 0 + + move.l a6,a0 ; a0 = start of relocations + + move.l d4,a1 + add.l (a0)+,a1 ; get initial fixup + +L(loop1): add.l d3,a1 ; increase fixup + add.l d4,(a1) ; reloc one address +L(loop2): move.b (a0)+,d3 + beq reloc_end + cmp.b d5,d3 ; note: d5.b is #1 from above + bne L(loop1) + lea 254(a1),a1 ; d3 == 1 -> add 254, don't reloc + bra L(loop2) + +reloc_end: + + +; ------------- clear dirty bss & start program + +; We are currently running in the dirty bss. +; Jump to the code we copied below the stack. + + ; note: d3.l is still 0 + + jmp (ASTACK) ; jmp clear_bss (on stack) + + + +eof: + dc.w cutpoint-start ; size of entry + dc.w eof-cutpoint ; size of decompressor + dc.w decompr_start-cutpoint ; offset of decompressor start + dc.b 'UPX9' ; marker for o2bin.pl + +#if defined(__ASL__) + endsection code +#endif + end + + +; vi:ts=8:et:nowrap + diff --git a/src/stub/src/mipsel.r3000-ps1.asm b/src/stub/src/mipsel.r3000-ps1.asm new file mode 100644 index 00000000..e0aec109 --- /dev/null +++ b/src/stub/src/mipsel.r3000-ps1.asm @@ -0,0 +1,238 @@ +; l_ps1.asm -- ps1/exe program entry & decompressor +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2004 Laszlo Molnar +; Copyright (C) 2002-2004 Jens Medoch +; 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 +; +; +; Jens Medoch +; +; + + +#include "arch/mips/mipsel.r3000/macros.ash" + +#define HI(a) (a >> 16) +#define LO(a) (a & 0xffff) + +#define SZ_REG 4 + +#if CDBOOT +regs MACRO _w, marker + _w a0,SZ_REG*0(sp) + _w a1,SZ_REG*1(sp) + _w a2,SZ_REG*2(sp) + _w a3,SZ_REG*3(sp) + _w v0,SZ_REG*4(sp) + _w v1,SZ_REG*5(sp) +IF (marker != 0) + DW marker +ENDIF + _w ra,SZ_REG*6(sp) +regs ENDM + +#define REG_SZ (7*SZ_REG) + +#else //console + +regs MACRO _w, marker + _w at,SZ_REG*0(sp) + _w a0,SZ_REG*1(sp) + _w a1,SZ_REG*2(sp) + _w a2,SZ_REG*3(sp) + _w a3,SZ_REG*4(sp) + _w v0,SZ_REG*5(sp) + _w v1,SZ_REG*6(sp) + _w ra,SZ_REG*7(sp) +IF (marker != 0) + DW marker + addu sp,at +ENDIF +regs ENDM + +#define REG_SZ (8*SZ_REG) + +#endif //CDBOOT + + ORG 0 +start: + +#if CDBOOT +; ============= +; ============= ENTRY POINT +; ============= +; for cd-boot only + +; __PS1START__ + li t0,'PSVR' ; prepare to compute value + subu t0,s0,t0 ; get stored header offset in mem + jr t0 + subiu sp,REG_SZ ; adjust stack +cutpoint: +; __PS1ENTRY__ + regs sw,0 ; push used regs + li a0,'CPDO' ; load COMPDATA offset +; li a1,'CDSZ' ; compressed data size - disabled! +; __PS1CONHL__ + li a2,'DECO' +; __PS1CONHI__ + lui a2,HI('DECO') + + +#else //CONSOLE +; ============= +; ============= ENTRY POINT +; ============= +; for console- / cd-boot + +; __PS1START__ + addiu at,zero,'LS' ; size of decomp. routine + subu sp,at ; adjust the stack with this size + regs sw,0 ; push used regs + subiu a2,at,REG_SZ ; a2 = counter copyloop + addiu a3,sp,REG_SZ ; get offset for decomp. routine + move a1,a3 + li a0,'DCRT' ; load decompression routine's offset +copyloop: + lw at,0(a0) ; memcpy *a0 -> at -> *a1 + addiu a2,-4 + sw at,0(a1) + addiu a0,4 + bnez a2,copyloop + addiu a1,4 + +; __PS1PADCD__ + addiu a0,'PC' ; a0 = pointer compressed data +; __PS1CONHL__ + lui a2,HI('DECO') ; load DECOMPDATA HI offset + jr a3 + ori a2,LO('DECO') ; load DECOMPDATA LO offset +; __PS1CONHI__ + jr a3 + lui a2,HI('DECO') ; same for HI only !(offset&0xffff) +cutpoint: +; __PS1ENTRY__ + +#endif //CDBOOT +; ============= +; ============= DECOMPRESSION +; ============= + +#ifndef FAST +# define FAST +#endif + +#if CDBOOT +# ifdef SMALL +# undef SMALL +# endif +#else //CONSOLE +# ifndef SMALL +# define SMALL +# endif +#endif //CDBOOT + +#ifdef NRV_BB +# undef NRV_BB +#endif +#define NRV_BB 8 + +; __PS1N2B08__ +#include "arch/mips/mipsel.r3000/nrv2b_d.ash" +; __PS1N2D08__ +#include "arch/mips/mipsel.r3000/nrv2d_d.ash" +; __PS1N2E08__ +#include "arch/mips/mipsel.r3000/nrv2e_d.ash" + +#ifdef NRV_BB +# undef NRV_BB +#endif +#define NRV_BB 32 + +; __PS1N2B32__ +#include "arch/mips/mipsel.r3000/nrv2b_d.ash" +; __PS1N2D32__ +#include "arch/mips/mipsel.r3000/nrv2d_d.ash" +; __PS1N2E32__ +#include "arch/mips/mipsel.r3000/nrv2e_d.ash" + + +; ============= + +; __PS1MSETS__ + ori a0,zero,'SC' ; amount of removed zeros at eof +; __PS1MSETB__ + ori a0,zero,'SC' ; amount of removed zeros at eof + sll a0,3 ; (cd mode 2 data sector alignment) +; __PS1MSETA__ +memset_aligned: + sw zero,0(a2) + addiu a0,-1 + bnez a0,memset_aligned + addiu a2,4 +; __PS1MSETU__ +memset_unaligned: + swl zero,3(a2) + swr zero,0(a2) + addiu a0,-1 + bnez a0,memset_unaligned + addiu a2,4 + +; ============= + +; __PS1EXITC__ + li t2,160 ; flushes + jalr ra,t2 ; instruction + li t1,68 ; cache + regs lw, 'JPEP' ; marker for the entry jump + +; ============= + +; __PS1PAHDR__ + DB 85,80,88,33 ; 0 UPX_MAGIC_LE32 + ; another magic for PackHeader::putPackHeader + DB 161,216,208,213 ; UPX_MAGIC2_LE32 + DW 0 ; 8 uncompressed adler32 + DW 0 ; 12 compressed adler32 + DW 0 ; 16 uncompressed len + DW 0 ; 20 compressed len + DW 0 ; 24 original file size + DB 0 ; 28 filter id + DB 0 ; 29 filter cto + DB 0 ; unsused + DB 45 ; 31 header checksum + +; ============= + +#if !CDBOOT +; __PS1SREGS__ + DW REG_SZ +#endif //CDBOOT + +; __PS1EOASM__ +eof: +; section .data + DW_UNALIGNED -1 + DH_UNALIGNED eof + +; vi:ts=8:et:nowrap diff --git a/src/stub/src/powerpc-darwin.macho-entry.S b/src/stub/src/powerpc-darwin.macho-entry.S new file mode 100644 index 00000000..218ea281 --- /dev/null +++ b/src/stub/src/powerpc-darwin.macho-entry.S @@ -0,0 +1,76 @@ +/* + * l_mac_ppc32.S -- program entry point & decompressor (PowerPC32 Mach-o) + * + * This file is part of the UPX executable compressor. + * + * Copyright (C) 2005 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. + * + * John F. Reiser + * + * + */ + +#include "arch/powerpc/32/regs.h" + +/*__MACOS000__*/ +_start: .globl _start + call main # must be exactly 1 instruction; link_register= &decompress +#include "arch/powerpc/32/nrv2e_d.S" + +/* Temporary until we get the buildLoader stuff working ... */ + .ascii "\n$Id: UPX (C) 1996-2006 the UPX Team. " + .asciz "All Rights Reserved. http://upx.sf.net $\n" + .p2align 2 # (1<<2) + +sz_b_info= 12 + sz_unc= 0 + sz_cpr= 4 + +/* Decompress the rest of this loader, and jump to it. */ +unfold: + mflr t0 # -4+ &{ b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...} + + lwz lsrc,4+sz_cpr(t0); mtctr lsrc # length to copy (and decompress) + lwz ldst,4+sz_unc(t0) + add dst,lsrc,t0; addi dst,dst,4+sz_b_info + add src,ldst,t0; addi src,src,GAP+64 # defend against prefetch and overlap +movup: # descending copy moves folded_loader to higher address + lbzu r0,-1(dst) + stbu r0,-1(src) + bdnz+ movup # typical count is about 0x4cb(1227) bytes + + mtctr r31 # &decompress + addi dst,t0,GAP # &unfolded result + la ldst,-4(sp) # &sz_result [will be ignored] + bctr # call decompress: branch to counter register, return to link register + +main: + mflr r31 # r31= &decompress + call unfold +L100: GAP= 128 # > farthest_prefetch; must match ../p_mach.cpp + b GAP+L100 # 'isync' has trouble on Macintosh G4? + /* { b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...} */ + +eof: +/*__XTHEENDX__*/ + +/* +vi:ts=8:et:nowrap +*/ + diff --git a/src/stub/src/powerpc-darwin.macho-fold.S b/src/stub/src/powerpc-darwin.macho-fold.S new file mode 100644 index 00000000..0277e646 --- /dev/null +++ b/src/stub/src/powerpc-darwin.macho-fold.S @@ -0,0 +1,132 @@ +/* fold_machppc32.S -- linkage to C code to process Mach-o binary +* +* This file is part of the UPX executable compressor. +* +* Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +* Copyright (C) 1996-2004 Laszlo Molnar +* Copyright (C) 2000-2005 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 +* +* +* John F. Reiser +* +*/ +#include "arch/powerpc/32/regs.h" + +sz_b_info= 12 + sz_unc= 0 + sz_cpr= 4 + +sz_l_info= 12 +sz_p_info= 12 + +/* Mach_ppc_thread_state */ +srr0 = 0*4 +srr1 = 1*4 +reg0 = 2*4 + +reg_cr = 34*4 +reg_xer = 35*4 +reg_lr = 36*4 +reg_ctr = 37*4 +reg_mq = 38*4 +reg_vrsave = 39*4 + + +_start: .globl _start # ignored, but silence "cannot find entry symbol _start" from ld +/* In: + r31= &decompress; also 8+ (char *)&(offset to {l_info; p_info; b_info}) +*/ +fold_begin: + call L90 +#include "arch/powerpc/32/bxx.S" + +L90: + li a6,0 + stwu a6,-4(sp) # default value + movr a6,sp # &mhdrp + mflr a5 # &ppcbxx: f_unfilter + + lwz a1,-8(r31) # offset to {l_info; p_info; b_info} + subf a0,a1,r31 # &l_info + lwz a3,sz_unc+sz_p_info+sz_l_info(a0) # sz_mach_headers + cmpli 0,a3,2048; bgt L100; li a3,2048 # at least 2KB for /usr/bin/dyld +L100: + movr r29,sp # remember for restoring later + subf sp,a3,sp # alloca + movr a2,sp # &temp char[sz_mach_headers] + addi sp,sp,-4*6 # linkage area assumed by C code (sp,cr,lr, xx,yy,zz) + movr a4,r31 # f_decompress + call upx_main # Out: a0= &Mach_ppc_thread_state of dyld + + movr sp,r29 # restore stack pointer + lwz t0, srr0(a0); mtctr t0 # entry address + /* Next 3 lines probably are not needed, but ... */ + lwz t0, reg_cr(a0); mtcr t0 # condition code + lwz t0,reg_xer(a0); mtxer t0 # extended error reg (CArry, etc.) + lwz t0, reg_lr(a0); mtlr t0 # link register + + lmw 4,4*4+reg0(3) # reg 4 thru 31 + lwz 0,0*4+reg0(3) + lwz 2,2*4+reg0(3) + lwz 3,3*4+reg0(3) + bctr # goto dyld + +SYS_exit =1 +SYS_fork =2 +SYS_read =3 +SYS_write =4 +SYS_open =5 +SYS_close =6 + +SYS_pread =153 +SYS_mmap =197 +SYS_mprotect= 74 + +/* SYS_mmap takes a 64-bit off_t, but gcc-3.4.1-20040827 passes long long + in wrong registers. So change C interface to use size_t (32-bits) instead + of off_t (64 bits), and convert here. +*/ +pread: .globl pread + movr a4,a3; li a3,0 # zero extend 4th arg size_t to off_t + li 0,SYS_pread; b sysgo +mmap: .globl mmap + movr a6,a5; li a5,0 # zero extend 6th arg size_t to off_t + li 0,SYS_mmap +sysgo: + sc + li a0,-1 # failure return + ret + +exit: .globl exit + li 0,SYS_exit; b sysgo +read: .globl read + li 0,SYS_read; b sysgo +open: .globl open + li 0,SYS_open; b sysgo +close: .globl close + li 0,SYS_close; b sysgo +mprotect: .globl mprotect + li 0,SYS_mprotect; b sysgo + +/* +vi:ts=8:et:nowrap +*/ + diff --git a/src/stub/src/powerpc-darwin.macho-main.c b/src/stub/src/powerpc-darwin.macho-main.c new file mode 100644 index 00000000..5ff236a3 --- /dev/null +++ b/src/stub/src/powerpc-darwin.macho-main.c @@ -0,0 +1,474 @@ +/* m_mach_ppc32.c -- loader stub for Mach-o PowerPC32 + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 Laszlo Molnar + Copyright (C) 2000-2005 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 + + + John F. Reiser + +*/ + +typedef long ssize_t; +typedef unsigned long size_t; +typedef size_t uintptr_t; +__extension__ typedef unsigned long long off_t; +typedef unsigned char nrv_byte; +typedef unsigned int nrv_uint; + +#define UPX_MAGIC_LE32 0x21585055 // "UPX!" +#define PAGE_MASK (~0u<<12) +#define PAGE_SIZE -PAGE_MASK +#define O_RDONLY 0 + +int close(int); +void exit(int) __attribute__((__noreturn__)); +int mprotect(void *, size_t, int); +int open(char const *, unsigned, unsigned); +ssize_t pread(int, void *, size_t, unsigned); + +#define CONST_CAST(type, var) \ + ((type) ((uintptr_t) (var))) + + +/************************************************************************* +// configuration section +**************************************************************************/ + +// In order to make it much easier to move this code at runtime and execute +// it at an address different from it load address: there must be no +// static data, and no string constants. + +/************************************************************************* +// "file" util +**************************************************************************/ + +typedef struct { + size_t size; // must be first to match size[0] uncompressed size + char *buf; +} Extent; + + +static void +xread(Extent *x, char *buf, size_t count) +{ + char *p=x->buf, *q=buf; + size_t j; + if (x->size < count) { + exit(127); + } + for (j = count; 0!=j--; ++p, ++q) { + *q = *p; + } + x->buf += count; + x->size -= count; +} + + +/************************************************************************* +// util +**************************************************************************/ + +#if 1 //{ save space +#define ERR_LAB error: exit(127); +#define err_exit(a) goto error +#else //}{ save debugging time +#define ERR_LAB +static void +err_exit(int a) +{ + (void)a; // debugging convenience + exit(127); +} +#endif //} + +/************************************************************************* +// UPX & NRV stuff +**************************************************************************/ + +struct l_info { // 12-byte trailer for loader (after macho headers) + unsigned l_checksum; + unsigned l_magic; // UPX_MAGIC_LE32 + unsigned short l_lsize; + unsigned char l_version; + unsigned char l_format; +}; +struct p_info { // 12-byte packed program header + unsigned p_progid; + unsigned p_filesize; + unsigned p_blocksize; +}; + +struct b_info { // 12-byte header before each compressed block + unsigned sz_unc; // uncompressed_size + unsigned sz_cpr; // compressed_size + unsigned char b_method; // compression algorithm + unsigned char b_ftid; // filter id + unsigned char b_cto8; // filter parameter + unsigned char b_unused; +}; + +typedef void f_unfilter( + nrv_byte *, // also addvalue + nrv_uint, + unsigned cto8, // junk in high 24 bits + unsigned ftid +); +typedef int f_expand( + const nrv_byte *, nrv_uint, + nrv_byte *, nrv_uint *, unsigned ); + +static void +unpackExtent( + Extent *const xi, // input + Extent *const xo, // output + f_expand *const f_decompress, + f_unfilter *f_unf +) +{ + while (xo->size) { + struct b_info h; + // Note: if h.sz_unc == h.sz_cpr then the block was not + // compressible and is stored in its uncompressed form. + + // Read and check block sizes. + xread(xi, (char *)&h, sizeof(h)); + if (h.sz_unc == 0) { // uncompressed size 0 -> EOF + if (h.sz_cpr != UPX_MAGIC_LE32) // h.sz_cpr must be h->magic + err_exit(2); + if (xi->size != 0) // all bytes must be written + err_exit(3); + break; + } + if (h.sz_cpr <= 0) { + err_exit(4); +ERR_LAB + } + if (h.sz_cpr > h.sz_unc + || h.sz_unc > xo->size ) { + err_exit(5); + } + // Now we have: + // assert(h.sz_cpr <= h.sz_unc); + // assert(h.sz_unc > 0 && h.sz_unc <= blocksize); + // assert(h.sz_cpr > 0 && h.sz_cpr <= blocksize); + + if (h.sz_cpr < h.sz_unc) { // Decompress block + nrv_uint out_len; + int const j = (*f_decompress)(xi->buf, h.sz_cpr, xo->buf, &out_len, + h.b_method); + if (j != 0 || out_len != (nrv_uint)h.sz_unc) + err_exit(7); + if (h.b_ftid!=0 && f_unf) { // have filter + (*f_unf)(xo->buf, out_len, h.b_cto8, h.b_ftid); + } + xi->buf += h.sz_cpr; + xi->size -= h.sz_cpr; + } + else { // copy literal block + xread(xi, xo->buf, h.sz_cpr); + } + xo->buf += h.sz_unc; + xo->size -= h.sz_unc; + } +} + +static void +upx_bzero(char *p, size_t len) +{ + if (len) do { + *p++= 0; + } while (--len); +} +#define bzero upx_bzero + + +// The PF_* and PROT_* bits are {1,2,4}; the conversion table fits in 32 bits. +#define REP8(x) \ + ((x)|((x)<<4)|((x)<<8)|((x)<<12)|((x)<<16)|((x)<<20)|((x)<<24)|((x)<<28)) +#define EXP8(y) \ + ((1&(y)) ? 0xf0f0f0f0 : (2&(y)) ? 0xff00ff00 : (4&(y)) ? 0xffff0000 : 0) +#define PF_TO_PROT(pf) \ + ((PROT_READ|PROT_WRITE|PROT_EXEC) & ( \ + ( (REP8(PROT_EXEC ) & EXP8(PF_X)) \ + |(REP8(PROT_READ ) & EXP8(PF_R)) \ + |(REP8(PROT_WRITE) & EXP8(PF_W)) \ + ) >> ((pf & (PF_R|PF_W|PF_X))<<2) )) + +typedef struct { + unsigned magic; + unsigned nfat_arch; +} Fat_header; +typedef struct { + unsigned cputype; + unsigned cpusubtype; + unsigned offset; + unsigned size; + unsigned align; /* power of 2 */ +} Fat_arch; + enum e8 { + FAT_MAGIC = 0xcafebabe + }; + enum e9 { + CPU_TYPE_POWERPC = 0x00000012, + CPU_TYPE_POWERPC64 = 0x01000012 + }; + +typedef struct { + unsigned magic; + unsigned cputype; + unsigned cpysubtype; + unsigned filetype; + unsigned ncmds; + unsigned sizeofcmds; + unsigned flags; +} Mach_header; + enum e0 { + MH_MAGIC = 0xfeedface + }; + enum e2 { + MH_EXECUTE = 2 + }; + enum e3 { + MH_NOUNDEFS = 1 + }; + +typedef struct { + unsigned cmd; + unsigned cmdsize; +} Mach_load_command; + enum e4 { + LC_SEGMENT = 0x1, + LC_THREAD = 0x4, + LC_UNIXTHREAD = 0x5, + LC_LOAD_DYLINKER = 0xe + }; + +typedef struct { + unsigned cmd; + unsigned cmdsize; + char segname[16]; + unsigned vmaddr; + unsigned vmsize; + unsigned fileoff; + unsigned filesize; + unsigned maxprot; + unsigned initprot; + unsigned nsects; + unsigned flags; +} Mach_segment_command; + enum e5 { + VM_PROT_READ = 1, + VM_PROT_WRITE = 2, + VM_PROT_EXECUTE = 4 + }; + +typedef struct { + unsigned srr0; /* Instruction address register (PC; entry addr) */ + unsigned srr1; /* Machine state register (supervisor) */ + unsigned r0, r1, r2, r3, r4, r5, r6, r7; + unsigned r8, r9,r10,r11,r12,r13,r14,r15; + unsigned r16,r17,r18,r19,r20,r21,r22,r23; + unsigned r24,r25,r26,r27,r28,r29,r30,r31; + + unsigned cr; /* Condition register */ + unsigned xer; /* User's integer exception register */ + unsigned lr; /* Link register */ + unsigned ctr; /* Count register */ + unsigned mq; /* MQ register (601 only) */ + + unsigned vrsave; /* Vector Save Register */ +} Mach_ppc_thread_state; + +typedef struct { + unsigned cmd; /* LC_THREAD or LC_UNIXTHREAD */ + unsigned cmdsize; /* total size of this command */ + unsigned flavor; + unsigned count; /* sizeof(following_thread_state)/4 */ + Mach_ppc_thread_state state; +} Mach_thread_command; + enum e6 { + PPC_THREAD_STATE = 1 + }; + enum e7 { + PPC_THREAD_STATE_COUNT = sizeof(Mach_ppc_thread_state)/4 + }; + +typedef union { + unsigned long offset; /* from start of load command to string */ + char *ptr; +} Mach_lc_str; + +#define MAP_FIXED 0x10 +#define MAP_PRIVATE 0x02 +#define MAP_ANON 0x1000 +#define PROT_READ 1 +#define PROT_WRITE 2 +#define PROT_EXEC 4 + +/* bug in crosstool/powerpc-750-linux-gnu/gcc-3.4.1-glibc-20040827: + unsigned long long off_t goes into registers (9,10) instead of (8,9). + Adjust in mmap(). +*/ +extern char *mmap(char *, size_t, unsigned, unsigned, int, /*off_t*/size_t); + +static Mach_ppc_thread_state const * +do_xmap( + Mach_header const *const mhdr, + unsigned const fat_offset, + Extent *const xi, + int const fdi, + Mach_header **mhdrpp, + f_expand *const f_decompress, + f_unfilter *const f_unf +) +{ + Mach_segment_command const *sc = (Mach_segment_command const *)(1+ mhdr); + Mach_ppc_thread_state const *entry = 0; + unsigned j; + + for ( j=0; j < mhdr->ncmds; ++j, + (sc = (Mach_segment_command const *)(sc->cmdsize + (char const *)sc)) + ) if (LC_SEGMENT==sc->cmd) { + Extent xo; + size_t mlen = xo.size = sc->filesize; + char *addr = xo.buf = (char *)sc->vmaddr; + char *haddr = sc->vmsize + addr; + size_t frag = (int)addr &~ PAGE_MASK; + addr -= frag; + mlen += frag; + + if (0!=mlen && addr != mmap(addr, mlen, VM_PROT_READ | VM_PROT_WRITE, + MAP_FIXED | MAP_PRIVATE | + ((xi || 0==sc->filesize) ? MAP_ANON : 0), + ((0==sc->filesize) ? -1 : fdi), sc->fileoff + fat_offset) ) { + err_exit(8); + } + if (xi && 0!=sc->filesize) { + if (0==sc->fileoff /*&& 0!=mhdrpp*/) { + *mhdrpp = (Mach_header *)addr; + } + unpackExtent(xi, &xo, f_decompress, f_unf); + } + /*bzero(addr, frag);*/ // fragment at lo end + frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary + bzero(mlen+addr, frag); // fragment at hi end + if (0!=mlen && 0!=mprotect(addr, mlen, sc->initprot)) { + err_exit(10); +ERR_LAB + } + addr += mlen + frag; /* page boundary on hi end */ + if (addr < haddr) { // need pages for .bss + if (addr != mmap(addr, haddr - addr, sc->initprot, + MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0 ) ) { + err_exit(9); + } + } + } + else if (LC_UNIXTHREAD==sc->cmd || LC_THREAD==sc->cmd) { + Mach_thread_command const *const thrc = (Mach_thread_command const *)sc; + if (PPC_THREAD_STATE ==thrc->flavor + && PPC_THREAD_STATE_COUNT==thrc->count ) { + entry = &thrc->state; + } + } + return entry; +} + + +/************************************************************************* +// upx_main - called by our entry code +// +**************************************************************************/ + +Mach_ppc_thread_state const * +upx_main( + struct l_info const *const li, + size_t volatile sz_compressed, // total length + Mach_header *const mhdr, // temp char[sz_mhdr] for decompressing + size_t const sz_mhdr, + f_expand *const f_decompress, + f_unfilter *const f_unf, + Mach_header **const mhdrpp // Out: *mhdrpp= &real Mach_header +) +{ + Mach_ppc_thread_state const *entry; + unsigned fat_offset = 0; + Extent xi, xo, xi0; + xi.buf = CONST_CAST(char *, 1+ (struct p_info const *)(1+ li)); // &b_info + xi.size = sz_compressed - (sizeof(struct l_info) + sizeof(struct p_info)); + xo.buf = (char *)mhdr; + xo.size = ((struct b_info const *)xi.buf)->sz_unc; + xi0 = xi; + + // Uncompress Macho headers + unpackExtent(&xi, &xo, f_decompress, 0); // never filtered? + + entry = do_xmap(mhdr, fat_offset, &xi0, -1, mhdrpp, f_decompress, f_unf); + + { // Map dyld dynamic loader + Mach_load_command const *lc = (Mach_load_command const *)(1+ mhdr); + unsigned j; + + for (j=0; j < mhdr->ncmds; ++j, + (lc = (Mach_load_command const *)(lc->cmdsize + (char const *)lc)) + ) if (LC_LOAD_DYLINKER==lc->cmd) { + char const *const dyld_name = ((Mach_lc_str const *)(1+ lc))->offset + + (char const *)lc; + int const fdi = open(dyld_name, O_RDONLY, 0); + if (0 > fdi) { + err_exit(18); + } +fat: + if ((ssize_t)sz_mhdr!=pread(fdi, (void *)mhdr, sz_mhdr, fat_offset)) { +ERR_LAB + err_exit(19); + } + switch (mhdr->magic) { + case MH_MAGIC: break; + case FAT_MAGIC: { + // stupid Apple: waste code and a page fault on EVERY execve + Fat_header const *const fh = (Fat_header const *)mhdr; + Fat_arch const *fa = (Fat_arch const *)(1+ fh); + for (j= 0; j < fh->nfat_arch; ++j, ++fa) { + if (CPU_TYPE_POWERPC==fa->cputype) { + fat_offset= fa->offset; + goto fat; + } + } + } break; + } // switch + entry = do_xmap(mhdr, fat_offset, 0, fdi, 0, 0, 0); + close(fdi); + break; + } + } + + return entry; +} + + +/* +vi:ts=4:et:nowrap +*/ + diff --git a/src/stub/src/powerpc-linux.elf-entry.S b/src/stub/src/powerpc-linux.elf-entry.S new file mode 100644 index 00000000..a6901180 --- /dev/null +++ b/src/stub/src/powerpc-linux.elf-entry.S @@ -0,0 +1,118 @@ +/* l_lx_elfppc.S -- Linux program entry point & decompressor (Elf binary) +* +* This file is part of the UPX executable compressor. +* +* Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer +* Copyright (C) 1996-2004 Laszlo Molnar +* Copyright (C) 2000-2005 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 +* +* +* John F. Reiser +* +*/ + +#include "arch/powerpc/32/regs.h" + +/*__MACOS000__*/ +_start: .globl _start + call main # must be exactly 1 instruction; link_register= &decompress +#include "arch/powerpc/32/nrv2e_d.S" + +sz_b_info= 12 + sz_unc= 0 + sz_cpr= 4 + b_method= 8 + +PROT_READ= 1 +PROT_WRITE= 2 +PROT_EXEC= 4 + +MAP_PRIVATE= 2 +MAP_FIXED= 0x10 +MAP_ANONYMOUS= 0x20 + +__NR_mmap= 90 + +PAGE_SHIFT= 12 +PAGE_SIZE = -(~0< + + John F. Reiser + + */ + + +OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") +OUTPUT_ARCH(powerpc:common) +/*ENTRY(_start)*/ +PHDRS +{ + text PT_LOAD FILEHDR PHDRS ; + data PT_LOAD ; /* for setting brk(0) */ +} +SECTIONS +{ + . = 0x00100000 + SIZEOF_HEADERS + 12; /* 12==sizeof(l_info) */ + .text : { + *(.text) + *(.data) + } : text + .data : { + } : data +} diff --git a/src/stub/src/powerpc-linux.elf-main.c b/src/stub/src/powerpc-linux.elf-main.c new file mode 100644 index 00000000..4651591d --- /dev/null +++ b/src/stub/src/powerpc-linux.elf-main.c @@ -0,0 +1,354 @@ +/* m_lx_elfppc32.c -- stub loader for Linux ELF PowerPC32 executable + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2004 Laszlo Molnar + Copyright (C) 2000-2004 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 + + + John F. Reiser + + */ + + +#include "include/linux.h" + +/************************************************************************* +// configuration section +**************************************************************************/ + +// In order to make it much easier to move this code at runtime and execute +// it at an address different from it load address: there must be no +// static data, and no string constants. + +#define MAX_ELF_HDR 512 // Elf32_Ehdr + n*Elf32_Phdr must fit in this + + +/************************************************************************* +// "file" util +**************************************************************************/ + +extern void exit (int __status) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__)); + +typedef struct { + size_t size; // must be first to match size[0] uncompressed size + char *buf; +} Extent; + + +static void +xread(Extent *x, char *buf, size_t count) +{ + char *p=x->buf, *q=buf; + size_t j; + if (x->size < count) { + exit(127); + } + for (j = count; 0!=j--; ++p, ++q) { + *q = *p; + } + x->buf += count; + x->size -= count; +} + + +/************************************************************************* +// util +**************************************************************************/ + +#if 1 //{ save space +#define ERR_LAB error: exit(127); +#define err_exit(a) goto error +#else //}{ save debugging time +#define ERR_LAB +static void +err_exit(int a) +{ + (void)a; // debugging convenience + exit(127); +} +#endif //} + +/************************************************************************* +// UPX & NRV stuff +**************************************************************************/ + +typedef void f_unfilter( + nrv_byte *, // also addvalue + nrv_uint, + unsigned cto8, // junk in high 24 bits + unsigned ftid +); +typedef int f_expand( + const nrv_byte *, nrv_uint, + nrv_byte *, nrv_uint *, unsigned ); + +static void +unpackExtent( + Extent *const xi, // input + Extent *const xo, // output + f_expand *const f_decompress, + f_unfilter *f_unf +) +{ + while (xo->size) { + struct b_info h; + // Note: if h.sz_unc == h.sz_cpr then the block was not + // compressible and is stored in its uncompressed form. + + // Read and check block sizes. + xread(xi, (char *)&h, sizeof(h)); + if (h.sz_unc == 0) { // uncompressed size 0 -> EOF + if (h.sz_cpr != UPX_MAGIC_LE32) // h.sz_cpr must be h->magic + err_exit(2); + if (xi->size != 0) // all bytes must be written + err_exit(3); + break; + } + if (h.sz_cpr <= 0) { + err_exit(4); +ERR_LAB + } + if (h.sz_cpr > h.sz_unc + || h.sz_unc > xo->size ) { + err_exit(5); + } + // Now we have: + // assert(h.sz_cpr <= h.sz_unc); + // assert(h.sz_unc > 0 && h.sz_unc <= blocksize); + // assert(h.sz_cpr > 0 && h.sz_cpr <= blocksize); + + if (h.sz_cpr < h.sz_unc) { // Decompress block + nrv_uint out_len; + int const j = (*f_decompress)(xi->buf, h.sz_cpr, xo->buf, &out_len, + h.b_method); + if (j != 0 || out_len != (nrv_uint)h.sz_unc) + err_exit(7); + if (h.b_ftid!=0 && f_unf) { // have filter + (*f_unf)(xo->buf, out_len, h.b_cto8, h.b_ftid); + } + xi->buf += h.sz_cpr; + xi->size -= h.sz_cpr; + } + else { // copy literal block + xread(xi, xo->buf, h.sz_cpr); + } + xo->buf += h.sz_unc; + xo->size -= h.sz_unc; + } +} + +static void +upx_bzero(char *p, size_t len) +{ + if (len) do { + *p++= 0; + } while (--len); +} +#define bzero upx_bzero + + +static void +auxv_up(Elf32_auxv_t *av, unsigned type, unsigned const value) +{ + if (av) + for (;; ++av) { + if (av->a_type==type || (av->a_type==AT_IGNORE && type!=AT_NULL)) { + av->a_type = type; + av->a_un.a_val = value; + return; + } + } +} + +// The PF_* and PROT_* bits are {1,2,4}; the conversion table fits in 32 bits. +#define REP8(x) \ + ((x)|((x)<<4)|((x)<<8)|((x)<<12)|((x)<<16)|((x)<<20)|((x)<<24)|((x)<<28)) +#define EXP8(y) \ + ((1&(y)) ? 0xf0f0f0f0 : (2&(y)) ? 0xff00ff00 : (4&(y)) ? 0xffff0000 : 0) +#define PF_TO_PROT(pf) \ + ((PROT_READ|PROT_WRITE|PROT_EXEC) & ( \ + ( (REP8(PROT_EXEC ) & EXP8(PF_X)) \ + |(REP8(PROT_READ ) & EXP8(PF_R)) \ + |(REP8(PROT_WRITE) & EXP8(PF_W)) \ + ) >> ((pf & (PF_R|PF_W|PF_X))<<2) )) + + +// Find convex hull of PT_LOAD (the minimal interval which covers all PT_LOAD), +// and mmap that much, to be sure that a kernel using exec-shield-randomize +// won't place the first piece in a way that leaves no room for the rest. +static unsigned long // returns relocation constant +xfind_pages(unsigned mflags, Elf32_Phdr const *phdr, int phnum, + char **const p_brk +) +{ + size_t lo= ~0, hi= 0, szlo= 0; + char *addr; + mflags += MAP_PRIVATE | MAP_ANONYMOUS | MAP_DENYWRITE; // '+' can optimize better than '|' + for (; --phnum>=0; ++phdr) if (PT_LOAD==phdr->p_type) { + if (phdr->p_vaddr < lo) { + lo = phdr->p_vaddr; + szlo = phdr->p_filesz; + } + if (hi < (phdr->p_memsz + phdr->p_vaddr)) { + hi = phdr->p_memsz + phdr->p_vaddr; + } + } + szlo += ~PAGE_MASK & lo; // page fragment on lo edge + lo -= ~PAGE_MASK & lo; // round down to page boundary + hi = PAGE_MASK & (hi - lo - PAGE_MASK -1); // page length + szlo = PAGE_MASK & (szlo - PAGE_MASK -1); // page length + addr = mmap((void *)lo, hi, PROT_NONE, mflags, -1, 0); + *p_brk = hi + addr; // the logical value of brk(0) + //mprotect(szlo + addr, hi - szlo, PROT_NONE); // but keep the frames! + return (unsigned long)addr - lo; +} + +static Elf32_Addr // entry address +do_xmap( + Elf32_Ehdr const *const ehdr, + Extent *const xi, + int const fdi, + Elf32_auxv_t *const av, + f_expand *const f_decompress, + f_unfilter *const f_unf +) +{ + Elf32_Phdr const *phdr = (Elf32_Phdr const *) (ehdr->e_phoff + + (char const *)ehdr); + char *v_brk; + unsigned long const reloc = xfind_pages( + ((ET_DYN!=ehdr->e_type) ? MAP_FIXED : 0), phdr, ehdr->e_phnum, &v_brk); + int j; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) + if (xi && PT_PHDR==phdr->p_type) { + auxv_up(av, AT_PHDR, phdr->p_vaddr + reloc); + } else + if (PT_LOAD==phdr->p_type) { + unsigned const prot = PF_TO_PROT(phdr->p_flags); + Extent xo; + size_t mlen = xo.size = phdr->p_filesz; + char *addr = xo.buf = (char *)phdr->p_vaddr; + char *haddr = phdr->p_memsz + addr; + size_t frag = (int)addr &~ PAGE_MASK; + mlen += frag; + addr -= frag; + addr += reloc; + haddr += reloc; + + if (addr != mmap(addr, mlen, prot | (xi ? PROT_WRITE : 0), + MAP_FIXED | MAP_PRIVATE | (xi ? MAP_ANONYMOUS : 0), + (xi ? -1 : fdi), phdr->p_offset - frag) ) { + err_exit(8); + } + if (xi) { + unpackExtent(xi, &xo, f_decompress, f_unf); + } + // Linux does not fixup the low end, so neither do we. + //if (PROT_WRITE & prot) { + // bzero(addr, frag); // fragment at lo end + //} + frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary + if (PROT_WRITE & prot) { + bzero(mlen+addr, frag); // fragment at hi end + } + if (xi) { + if (0!=mprotect(addr, mlen, prot)) { + err_exit(10); +ERR_LAB + } + } + addr += mlen + frag; /* page boundary on hi end */ + if (addr < haddr) { // need pages for .bss + if (addr != mmap(addr, haddr - addr, prot, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0 ) ) { + err_exit(9); + } + } + } + return ehdr->e_entry + reloc; +} + + +/************************************************************************* +// upx_main - called by our entry code +**************************************************************************/ + +void *upx_main( + struct l_info const *const li, + size_t const sz_compressed, // total length + Elf32_Ehdr *const ehdr, // temp char[sz_ehdr] for decompressing + size_t const sz_ehdr, + f_expand *const f_decompress, + f_unfilter *const f_unf, + Elf32_auxv_t *const av +) +{ + Elf32_Phdr const *phdr = (Elf32_Phdr const *)(1+ ehdr); + Elf32_Addr entry; + + Extent xi, xo, xi0; + xi.buf = CONST_CAST(char *, 1+ (struct p_info const *)(1+ li)); // &b_info + xi.size = sz_compressed - (sizeof(struct l_info) + sizeof(struct p_info)); + xo.buf = (char *)ehdr; + xo.size = ((struct b_info const *)xi.buf)->sz_unc; + xi0 = xi; + + ACC_UNUSED(sz_ehdr); + + // ehdr = Uncompress Ehdr and Phdrs + unpackExtent(&xi, &xo, f_decompress, 0); // never filtered? + + // AT_PHDR.a_un.a_val is set again by do_xmap if PT_PHDR is present. + auxv_up(av, AT_PHDR , (unsigned)(1+(Elf32_Ehdr *)phdr->p_vaddr)); + auxv_up(av, AT_PHNUM , ehdr->e_phnum); + auxv_up(av, AT_ENTRY , (unsigned)ehdr->e_entry); + //auxv_up(av, AT_PHENT , ehdr->e_phentsize); /* this can never change */ + //auxv_up(av, AT_PAGESZ, PAGE_SIZE); /* ld-linux.so.2 does not need this */ + + entry = do_xmap(ehdr, &xi0, 0, av, f_decompress, f_unf); + + { // Map PT_INTERP program interpreter + int j; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) if (PT_INTERP==phdr->p_type) { + char const *const iname = (char const *)phdr->p_vaddr; + int const fdi = open(iname, O_RDONLY, 0); + if (0 > fdi) { + err_exit(18); + } + if (MAX_ELF_HDR!=read(fdi, (void *)ehdr, MAX_ELF_HDR)) { +ERR_LAB + err_exit(19); + } + entry = do_xmap(ehdr, 0, fdi, 0, 0, 0); + close(fdi); + } + } + + return (void *)entry; +} + + +/* +vi:ts=4:et:nowrap +*/ + diff --git a/src/stub/tools/armpe/Makefile b/src/stub/tools/armpe/Makefile new file mode 100644 index 00000000..2a37d55f --- /dev/null +++ b/src/stub/tools/armpe/Makefile @@ -0,0 +1,25 @@ +# Makefile for armpe_tester + +MAKEFLAGS += -rR +SHELL = /bin/sh + +# update path for our special stub build tools +ifneq ($(wildcard $(HOME)/local/bin/bin-upx),) +export PATH := $(HOME)/local/bin/bin-upx:$(PATH) +endif + + +all: armpe_tester wtest.exe + +armpe_tester: armpe_tester.c + arm-9tdmi-linux-gnu-gcc -Wl,--section-start,.interp=0x1000 -g -Wall -W -o $@ $< + +wtest.exe: armpe_tester.c + arm-wince-pe-gcc -Wl,--image-base,0x400000 -s -Wall -W -o $@ $< + +mostlyclean clean distclean maintainer-clean: + rm -f *.d *.o *.obj + rm -f armpe_tester wtest.exe + +.PHONY: all mostlyclean clean distclean maintainer-clean + diff --git a/src/stub/tools/armpe/armpe_tester.c b/src/stub/tools/armpe/armpe_tester.c new file mode 100644 index 00000000..72529586 --- /dev/null +++ b/src/stub/tools/armpe/armpe_tester.c @@ -0,0 +1,354 @@ +/* armpe_tester.c -- ARM/PE loader/tester for arm linux + + 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 + + + John F. Reiser + +*/ + +// arm-9tdmi-linux-gnu-gcc -Wl,--section-start,.interp=0x1000 +// arm-wince-pe-gcc -Wl,--image-base,0x400000 + +#include +#include +#include +#include + +#ifdef i386 +# define UPX_MMAP_ADDRESS 0x20000000 +#else +# define UPX_MMAP_ADDRESS 0x10000 +#endif + +#ifdef linux +# include +#else +void *VirtualAlloc(void *address, unsigned size, unsigned type, unsigned protect); +# define MEM_COMMIT 0x1000 +# define PAGE_EXECUTE_READWRITE 0x0040 +#endif + +typedef unsigned short LE16; +typedef unsigned long LE32; +#define __attribute_packed + +struct ddirs_t +{ + LE32 vaddr; + LE32 size; +} +__attribute_packed; + +struct pe_header_t +{ + // 0x0 + char _[4]; + LE16 cpu; + LE16 objects; + char __[12]; + LE16 opthdrsize; + LE16 flags; + // optional header + char ___[4]; + LE32 codesize; + // 0x20 + LE32 datasize; + LE32 bsssize; + LE32 entry; + LE32 codebase; + // 0x30 + LE32 database; + // nt specific fields + LE32 imagebase; + LE32 objectalign; + LE32 filealign; + // 0x40 + char ____[16]; + // 0x50 + LE32 imagesize; + LE32 headersize; + LE32 chksum; + LE16 subsystem; + LE16 dllflags; + // 0x60 + char _____[20]; + // 0x74 + LE32 ddirsentries; + + struct ddirs_t ddirs[16]; +} +__attribute_packed; + +struct pe_section_t +{ + char name[8]; + LE32 vsize; + LE32 vaddr; + LE32 size; + LE32 rawdataptr; + char _[12]; + LE32 flags; +} +__attribute_packed; + + +struct exe_header_t +{ + LE16 mz; + LE16 m512; + LE16 p512; + char _[18]; + LE16 relocoffs; + char __[34]; + LE32 nexepos; +} +__attribute_packed; + +enum { + PEDIR_EXPORT = 0, + PEDIR_IMPORT = 1, + PEDIR_RESOURCE = 2, + PEDIR_EXCEPTION = 3, + PEDIR_SEC = 4, + PEDIR_RELOC = 5, + PEDIR_DEBUG = 6, + PEDIR_COPYRIGHT = 7, + PEDIR_GLOBALPTR = 8, + PEDIR_TLS = 9, + PEDIR_LOADCONF = 10, + PEDIR_BOUNDIM = 11, + PEDIR_IAT = 12, + PEDIR_DELAYIMP = 13, + PEDIR_COMRT = 14 +}; + +#define get_le32(p) (*(unsigned *) (p)) +#define set_le32(p, v) (*(unsigned *) (p) = (v)) +#define get_le16(p) (*(unsigned short *) (p)) + +static struct pe_header_t ih; +static struct pe_section_t isections[3]; +static FILE *f; +static void *vaddr; +static FILE *out; + +static int print(const char *format, ...) +{ + va_list ap; + int ret; + + va_start(ap, format); + ret = fprintf(out, format, ap); + fflush(out); + va_end(ap); + return ret; +} + +static int load(const char *file) +{ + struct exe_header_t h; + int ic; + unsigned pe_offset = 0; + + if ((f = fopen(file, "rb")) == NULL) + return print("can not open file: %s\n", file); + + for (ic = 0; ic < 20; ic++) + { + if (fseek(f, pe_offset, SEEK_SET) + || fread(&h, sizeof(h), 1, f) != 1) + return print("read error at %u\n", pe_offset); + + if (h.mz == 'M' + 'Z'*256) // dos exe + { + if (h.relocoffs >= 0x40) // new format exe + pe_offset += h.nexepos; + else + pe_offset += h.p512 * 512 + h.m512 - h.m512 ? 512 : 0; + } + else if (get_le32(&h) == 'P' + 'E'*256) + break; + else + return print("bad header at %u\n", pe_offset); + } + if (ic == 20) + return print("pe header not found\n"); + if (fseek(f, pe_offset, SEEK_SET) + || fread(&ih, sizeof(ih), 1, f) != 1) + return print("can not load pe header\n"); + + if (ih.cpu != 0x1c0 && ih.cpu != 0x1c2) + return print("unsupported processor type: %x\n", ih.cpu); + + if (ih.objects != 3 || fread(isections, sizeof(isections), 1, f) != 1) + return print("error reading section descriptors\n"); + + return 0; +} + +static int read(void) +{ + unsigned ic; +#ifdef linux + vaddr = mmap((void *) UPX_MMAP_ADDRESS, ih.imagesize, + PROT_WRITE | PROT_READ | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + if (((int) vaddr) == -1) + return print("mmap() failed: %d\n", errno); +#else + if ((vaddr = VirtualAlloc(0, ih.imagesize, + MEM_COMMIT, PAGE_EXECUTE_READWRITE)) == 0) + return print("VirtualAlloc() failed\n"); + print("VirtualAlloc() ok %x\n", vaddr); +#endif + + for (ic = 1; ic <= 2; ic++) + if (fseek(f, isections[ic].rawdataptr, SEEK_SET) + || fread(vaddr + isections[ic].vaddr, + isections[ic].vsize, 1, f) != 1) + return print("error reading section %u\n", ic); + return 0; +} + +static void dump(char n) +{ + char buf[100]; +#ifdef linux + snprintf(buf, sizeof(buf), "/tmp/a.dump%c", n); +#else + snprintf(buf, sizeof(buf), "/a.dump%c", n); +#endif + FILE *f2 = fopen(buf, "wb"); + fwrite(vaddr + 0x1000, ih.imagesize - 0x1000, 1, f2); + fclose(f2); +} + +static int loadlibraryw(unsigned short *name) +{ + return name[0] + name[1] * 0x100 + name[2] * 0x10000; +} + +static int getprocaddressa(unsigned h, const char *proc) +{ + unsigned p = (unsigned) proc; + if (p < 0x10000) + { + print("getprocaddressa called %c%c%c, ordinal %u\n", + h, h >> 8, h >> 16, p); + return h + p * 0x10000; + } + print("getprocaddressa called %c%c%c, name %s\n", + h, h >> 8, h >> 16, proc); + return h + proc[0] * 0x10000 + proc[1] * 0x1000000; +} + +static void cachesync(unsigned v) +{ + print("cachesync called %u\n", v); +} + +static int import(void) +{ + if (ih.ddirs[PEDIR_IMPORT].vaddr == 0) + return print("no imports?\n"); + void *imports = vaddr + ih.ddirs[PEDIR_IMPORT].vaddr; + void *coredll_imports = vaddr + get_le32(imports + 16); + set_le32(coredll_imports, (unsigned) loadlibraryw); + set_le32(coredll_imports + 4, (unsigned) getprocaddressa); + set_le32(coredll_imports + 8, (unsigned) cachesync); + return 0; +} + +static int reloc(void) +{ + if (ih.ddirs[PEDIR_RELOC].vaddr == 0) + return 0; + void *relocs = vaddr + ih.ddirs[PEDIR_RELOC].vaddr; + void *page = vaddr + get_le32(relocs); + unsigned size = get_le32(relocs + 4); + if (size != ih.ddirs[PEDIR_RELOC].size) + return print("only 1 page can be relocated\n"); + unsigned num = (size - 8) / 2; + while (num--) + { + unsigned pos = get_le16(relocs + 8 + num * 2); + if (pos == 0) + continue; + if ((pos & 0xF000) != 0x3000) + return print("unknown relocation type: %x\n", pos); + + void *r = page + (pos & 0xFFF); + set_le32(r, get_le32(r) - ih.imagebase + (unsigned) vaddr); + } + return 0; +} + +static void dump2(int c) +{ + print("dump2 %c\n", c); + dump(c); +} + +static void call(void) +{ +#ifndef i386 + void (*entry)(void (*)(int), unsigned) = vaddr + ih.entry; + entry(dump2, 1); + dump('z'); +#endif +} + +static int main2(int argc, char **argv) +{ + if (argc != 2) + return print("usage: %s arm_pe_file\n", argv[0]), 1; + if (load(argv[1])) + return 2; + if (read()) + return 3; + dump('0'); + if (import()) + return 4; + dump('1'); + if (reloc()) + return 5; + dump('2'); + + call(); + print("ok.\n"); + return 0; +} + +int main(int argc, char **argv) +{ + out = stdout; +#ifndef linux + out = fopen("/wtest.log", "wt"); +#endif + int ret = main2(argc, argv); + fclose(out); + return ret; +} diff --git a/src/stub/tools/sstrip/Makefile b/src/stub/tools/sstrip/Makefile new file mode 100644 index 00000000..0511895a --- /dev/null +++ b/src/stub/tools/sstrip/Makefile @@ -0,0 +1,21 @@ +# Makefile for sstrip + +SHELL = /bin/sh + +##all: amd64-linux-sstrip +##all: i386-linux-sstrip +all: sstrip + +sstrip: sstrip.c + gcc -O2 -g -Wall -W -o $@ $< +amd64-linux-sstrip: sstrip.c + gcc -m64 -O2 -g -Wall -W -o $@ $< +i386-linux-sstrip: sstrip.c + gcc -m32 -O2 -g -Wall -W -o $@ $< + +mostlyclean clean distclean maintainer-clean: + rm -f *.d *.o *.obj + rm -f sstrip amd64-linux-sstrip i386-linux-sstrip + +.PHONY: all mostlyclean clean distclean maintainer-clean + diff --git a/src/stub/tools/sstrip/README b/src/stub/tools/sstrip/README new file mode 100644 index 00000000..218376c2 --- /dev/null +++ b/src/stub/tools/sstrip/README @@ -0,0 +1,40 @@ +sstrip is a small utility that removes the contents at the end of an +ELF file that are not part of the program's memory image. + +Most ELF executables are built with both a program header table and a +section header table. However, only the former is required in order +for the OS to load, link and execute a program. sstrip attempts to +extract the ELF header, the program header table, and its contents, +leaving everything else in the bit bucket. It can only remove parts of +the file that occur at the end, after the parts to be saved. However, +this almost always includes the section header table, and occasionally +a few random sections that are not used when running a program. + +It should be noted that the GNU bfd library is (understandably) +dependent on the section header table as an index to the file's +contents. Thus, an executable file that has no section header table +cannot be used with gdb, objdump, or any other program based upon the +bfd library, at all. In fact, the program will not even recognize the +file as a valid executable. (This limitation is noted in the source +code comments for bfd, and is marked "FIXME", so this may change at +some future date. However, I would imagine that it is a pretty +low-priority item, as executables without a section header table are +rare in the extreme.) This probably also explains why strip doesn't +offer the option to do this. + +Shared library files may also have their section header table removed. +Such a library will still function; however, it will no longer be +possible for a compiler to link a new program against it. + +As an added bonus, sstrip also tries to removes trailing zero bytes +from the end of the file. (This normally cannot be done with an +executable that has a section header table.) + +sstrip is a very simplistic program. It depends upon the common +practice of putting the parts of the file that contribute to the +memory image at the front, and the remaining material at the end. This +permits it to discard the latter material without affecting file +offsets and memory addresses in what remains. Of course, the ELF +standard permits files to be organized in almost any order, so if a +pathological linker decided to put its section headers at the top, +sstrip would be useless on such executables. diff --git a/src/stub/tools/sstrip/README.1ST b/src/stub/tools/sstrip/README.1ST new file mode 100644 index 00000000..3b6466a6 --- /dev/null +++ b/src/stub/tools/sstrip/README.1ST @@ -0,0 +1,73 @@ +This distribution is a collection of programs that are generally +unrelated, except in that they all deal with the ELF file format. + +The main purpose of these programs is to be illustrative and +educational -- to help fellow programmers understand the ELF file +format and something of how it works under the Linux platform. For the +most part, these programs have limited real-world utility. (Although I +myself have found some of these programs quite useful while writing +the others.) + +Each program is independent. There is no shared code between them, and +in fact they all take slightly different approaches to handling ELF +files. + +The table of contents: + +sstrip/ + sstrip is a small utility that removes everything from an ELF file + that is not part of the file's memory image. + +rebind/ + rebind is another small utility that alters the binding of selected + exported symbols in an ELF object file. + +elfls/ + elfls is a utility that displays an ELF file's program and/or + section header tables, which serve as a kind of global roadmap to + the file's contents. + +elftoc/ + elftoc takes an ELF file and generates C code that defines a + structure with the same memory image, using the structures and + preprocessor symbols defined in . + +ebfc/ + ebfc is a compiler for a tiny programming language. The compiler can + generate ELF executables, object files, and shared libraries. + +tiny/ + This directory contains a collection of very small ELF executables. + +See the README in each directory for more details. + +The ELF standard is necessary reading if you wish to fully understand +how all of the programs work. You can download a copy as a Postscript +document from ftp://tsx.mit.edu/pub/linux/packages/GCC/ELF.doc.tar.gz. +Alternately, you can obtain a flat-text transcription of this document +from http://www.muppetlabs.com/~breadbox/software/ELF.txt. + + These programs are Copyright (C) 1999-2001 by Brian Raiter. + + These programs are all free software; you can redistribute 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. + + These programs are distributed in the hope that they will be + interesting, 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, in the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA. + +Bug reports and general feedback should be directed to the author at +breadbox@muppetlabs.com. + +Share and enjoy. + +Brian Raiter +breadbox@muppetlabs.com diff --git a/src/stub/tools/sstrip/sstrip.c b/src/stub/tools/sstrip/sstrip.c new file mode 100644 index 00000000..e54ab081 --- /dev/null +++ b/src/stub/tools/sstrip/sstrip.c @@ -0,0 +1,473 @@ +/* http://www.muppetlabs.com/~breadbox/software/elfkickers.html */ + +/* sstrip: Copyright (C) 1999-2001 by Brian Raiter, under the GNU + * General Public License. No warranty. See COPYING for details. + * + * Aug 23, 2004 Hacked by Manuel Novoa III to + * handle targets of different endianness and/or elf class, making + * it more useful in a cross-devel environment. + */ + +/* ============== original README =================== + * + * sstrip is a small utility that removes the contents at the end of an + * ELF file that are not part of the program's memory image. + * + * Most ELF executables are built with both a program header table and a + * section header table. However, only the former is required in order + * for the OS to load, link and execute a program. sstrip attempts to + * extract the ELF header, the program header table, and its contents, + * leaving everything else in the bit bucket. It can only remove parts of + * the file that occur at the end, after the parts to be saved. However, + * this almost always includes the section header table, and occasionally + * a few random sections that are not used when running a program. + * + * It should be noted that the GNU bfd library is (understandably) + * dependent on the section header table as an index to the file's + * contents. Thus, an executable file that has no section header table + * cannot be used with gdb, objdump, or any other program based upon the + * bfd library, at all. In fact, the program will not even recognize the + * file as a valid executable. (This limitation is noted in the source + * code comments for bfd, and is marked "FIXME", so this may change at + * some future date. However, I would imagine that it is a pretty + * low-priority item, as executables without a section header table are + * rare in the extreme.) This probably also explains why strip doesn't + * offer the option to do this. + * + * Shared library files may also have their section header table removed. + * Such a library will still function; however, it will no longer be + * possible for a compiler to link a new program against it. + * + * As an added bonus, sstrip also tries to removes trailing zero bytes + * from the end of the file. (This normally cannot be done with an + * executable that has a section header table.) + * + * sstrip is a very simplistic program. It depends upon the common + * practice of putting the parts of the file that contribute to the + * memory image at the front, and the remaining material at the end. This + * permits it to discard the latter material without affecting file + * offsets and memory addresses in what remains. Of course, the ELF + * standard permits files to be organized in almost any order, so if a + * pathological linker decided to put its section headers at the top, + * sstrip would be useless on such executables. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +/* The name of the program. + */ +static char const *progname; + +/* The name of the current file. + */ +static char const *filename; + + +/* A simple error-handling function. FALSE is always returned for the + * convenience of the caller. + */ +static int err(char const *errmsg) +{ + fprintf(stderr, "%s: %s: %s\n", progname, filename, errmsg); + return FALSE; +} + +/* A flag to signal the need for endian reversal. + */ +static int do_reverse_endian; + +/* Get a value from the elf header, compensating for endianness. + */ +#define EGET(X) \ + (__extension__ ({ \ + uint64_t __res; \ + if (!do_reverse_endian) { \ + __res = (X); \ + } else if (sizeof(X) == 1) { \ + __res = (X); \ + } else if (sizeof(X) == 2) { \ + __res = bswap_16((X)); \ + } else if (sizeof(X) == 4) { \ + __res = bswap_32((X)); \ + } else if (sizeof(X) == 8) { \ + __res = bswap_64((X)); \ + } else { \ + fprintf(stderr, "%s: %s: EGET failed for size %ld\n", \ + progname, filename, (long) sizeof(X)); \ + exit(EXIT_FAILURE); \ + } \ + __res; \ + })) + +/* Set a value 'Y' in the elf header to 'X', compensating for endianness. + */ +#define ESET(Y,X) \ + do if (!do_reverse_endian) { \ + Y = (X); \ + } else if (sizeof(Y) == 1) { \ + Y = (X); \ + } else if (sizeof(Y) == 2) { \ + Y = bswap_16((uint16_t)(X)); \ + } else if (sizeof(Y) == 4) { \ + Y = bswap_32((uint32_t)(X)); \ + } else if (sizeof(Y) == 8) { \ + Y = bswap_64((uint64_t)(X)); \ + } else { \ + fprintf(stderr, "%s: %s: ESET failed for size %ld\n", \ + progname, filename, (long) sizeof(Y)); \ + exit(EXIT_FAILURE); \ + } while (0) + + +/* A macro for I/O errors: The given error message is used only when + * errno is not set. + */ +#define ferr(msg) (err(errno ? strerror(errno) : (msg))) + + + +#define HEADER_FUNCTIONS(CLASS) \ + \ +/* readelfheader() reads the ELF header into our global variable, and \ + * checks to make sure that this is in fact a file that we should be \ + * munging. \ + */ \ +static int readelfheader ## CLASS (int fd, Elf ## CLASS ## _Ehdr *ehdr) \ +{ \ + if (read(fd, ((char *)ehdr)+EI_NIDENT, sizeof(*ehdr) - EI_NIDENT) \ + != (ssize_t)sizeof(*ehdr) - EI_NIDENT) \ + return ferr("missing or incomplete ELF header."); \ + \ + /* Verify the sizes of the ELF header and the program segment \ + * header table entries. \ + */ \ + if (EGET(ehdr->e_ehsize) != sizeof(Elf ## CLASS ## _Ehdr)) \ + return err("unrecognized ELF header size."); \ + if (EGET(ehdr->e_phentsize) != sizeof(Elf ## CLASS ## _Phdr)) \ + return err("unrecognized program segment header size."); \ + \ + /* Finally, check the file type. \ + */ \ + if (EGET(ehdr->e_type) != ET_EXEC && EGET(ehdr->e_type) != ET_DYN) \ + return err("not an executable or shared-object library."); \ + \ + return TRUE; \ +} \ + \ +/* readphdrtable() loads the program segment header table into memory. \ + */ \ +static int readphdrtable ## CLASS (int fd, Elf ## CLASS ## _Ehdr const *ehdr, \ + Elf ## CLASS ## _Phdr **phdrs) \ +{ \ + size_t size; \ + \ + if (!EGET(ehdr->e_phoff) || !EGET(ehdr->e_phnum) \ +) return err("ELF file has no program header table."); \ + \ + size = EGET(ehdr->e_phnum) * sizeof **phdrs; \ + if (!(*phdrs = malloc(size))) \ + return err("Out of memory!"); \ + \ + errno = 0; \ + if (read(fd, *phdrs, size) != (ssize_t)size) \ + return ferr("missing or incomplete program segment header table."); \ + \ + return TRUE; \ +} \ + \ +/* getmemorysize() determines the offset of the last byte of the file \ + * that is referenced by an entry in the program segment header table. \ + * (Anything in the file after that point is not used when the program \ + * is executing, and thus can be safely discarded.) \ + */ \ +static int getmemorysize ## CLASS (Elf ## CLASS ## _Ehdr const *ehdr, \ + Elf ## CLASS ## _Phdr const *phdrs, \ + unsigned long *newsize) \ +{ \ + Elf ## CLASS ## _Phdr const *phdr; \ + unsigned long size, n; \ + size_t i; \ + \ + /* Start by setting the size to include the ELF header and the \ + * complete program segment header table. \ + */ \ + size = EGET(ehdr->e_phoff) + EGET(ehdr->e_phnum) * sizeof *phdrs; \ + if (size < sizeof *ehdr) \ + size = sizeof *ehdr; \ + \ + /* Then keep extending the size to include whatever data the \ + * program segment header table references. \ + */ \ + for (i = 0, phdr = phdrs ; i < EGET(ehdr->e_phnum) ; ++i, ++phdr) { \ + if (EGET(phdr->p_type) != PT_NULL) { \ + n = EGET(phdr->p_offset) + EGET(phdr->p_filesz); \ + if (n > size) \ + size = n; \ + } \ + } \ + \ + *newsize = size; \ + return TRUE; \ +} \ + \ +/* modifyheaders() removes references to the section header table if \ + * it was stripped, and reduces program header table entries that \ + * included truncated bytes at the end of the file. \ + */ \ +static int modifyheaders ## CLASS (Elf ## CLASS ## _Ehdr *ehdr, \ + Elf ## CLASS ## _Phdr *phdrs, \ + unsigned long newsize) \ +{ \ + Elf ## CLASS ## _Phdr *phdr; \ + size_t i; \ + \ + /* If the section header table is gone, then remove all references \ + * to it in the ELF header. \ + */ \ + if (EGET(ehdr->e_shoff) >= newsize) { \ + ESET(ehdr->e_shoff,0); \ + ESET(ehdr->e_shnum,0); \ + ESET(ehdr->e_shentsize,0); \ + ESET(ehdr->e_shstrndx,0); \ + } \ + \ + /* The program adjusts the file size of any segment that was \ + * truncated. The case of a segment being completely stripped out \ + * is handled separately. \ + */ \ + for (i = 0, phdr = phdrs ; i < EGET(ehdr->e_phnum) ; ++i, ++phdr) { \ + if (EGET(phdr->p_offset) >= newsize) { \ + ESET(phdr->p_offset,newsize); \ + ESET(phdr->p_filesz,0); \ + } else if (EGET(phdr->p_offset) + EGET(phdr->p_filesz) > newsize) { \ + newsize -= EGET(phdr->p_offset); \ + ESET(phdr->p_filesz, newsize); \ + } \ + } \ + \ + return TRUE; \ +} \ + \ +/* commitchanges() writes the new headers back to the original file \ + * and sets the file to its new size. \ + */ \ +static int commitchanges ## CLASS (int fd, Elf ## CLASS ## _Ehdr const *ehdr, \ + Elf ## CLASS ## _Phdr *phdrs, \ + unsigned long newsize) \ +{ \ + size_t n; \ + \ + /* Save the changes to the ELF header, if any. \ + */ \ + if (lseek(fd, 0, SEEK_SET)) \ + return ferr("could not rewind file"); \ + errno = 0; \ + if (write(fd, ehdr, sizeof *ehdr) != (ssize_t)sizeof *ehdr) \ + return err("could not modify file"); \ + \ + /* Save the changes to the program segment header table, if any. \ + */ \ + if (lseek(fd, EGET(ehdr->e_phoff), SEEK_SET) == (off_t)-1) { \ + err("could not seek in file."); \ + goto warning; \ + } \ + n = EGET(ehdr->e_phnum) * sizeof *phdrs; \ + if (write(fd, phdrs, n) != (ssize_t)n) { \ + err("could not write to file"); \ + goto warning; \ + } \ + \ + /* Eleventh-hour sanity check: don't truncate before the end of \ + * the program segment header table. \ + */ \ + if (newsize < EGET(ehdr->e_phoff) + n) \ + newsize = EGET(ehdr->e_phoff) + n; \ + \ + /* Chop off the end of the file. \ + */ \ + if (ftruncate(fd, newsize)) { \ + err("could not resize file"); \ + goto warning; \ + } \ + \ + return TRUE; \ + \ + warning: \ + return err("ELF file may have been corrupted!"); \ +} + + +/* First elements of Elf32_Ehdr and Elf64_Ehdr are common. + */ +static int readelfheaderident(int fd, Elf32_Ehdr *ehdr) +{ + errno = 0; + if (read(fd, ehdr, EI_NIDENT) != EI_NIDENT) + return ferr("missing or incomplete ELF header."); + + /* Check the ELF signature. + */ + if (!(ehdr->e_ident[EI_MAG0] == ELFMAG0 && + ehdr->e_ident[EI_MAG1] == ELFMAG1 && + ehdr->e_ident[EI_MAG2] == ELFMAG2 && + ehdr->e_ident[EI_MAG3] == ELFMAG3)) + { + err("missing ELF signature."); + return -1; + } + + /* Compare the file's class and endianness with the program's. + */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) { + do_reverse_endian = 0; + } else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { +/* fprintf(stderr, "ELF file has different endianness.\n"); */ + do_reverse_endian = 1; + } +#elif __BYTE_ORDER == __BIG_ENDIAN + if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) { +/* fprintf(stderr, "ELF file has different endianness.\n"); */ + do_reverse_endian = 1; + } else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { + do_reverse_endian = 0; + } +#else +#error unkown endianness +#endif + else { + err("Unsupported endianness"); + return -1; + } + + /* Check the target architecture. + */ +/* if (EGET(ehdr->e_machine) != ELF_ARCH) { */ +/* /\* return err("ELF file created for different architecture."); *\/ */ +/* fprintf(stderr, "ELF file created for different architecture.\n"); */ +/* } */ + return ehdr->e_ident[EI_CLASS]; +} + + +HEADER_FUNCTIONS(32) + +HEADER_FUNCTIONS(64) + +/* truncatezeros() examines the bytes at the end of the file's + * size-to-be, and reduces the size to exclude any trailing zero + * bytes. + */ +static int truncatezeros(int fd, unsigned long *newsize) +{ + unsigned char contents[1024]; + unsigned long size, n; + + size = *newsize; + do { + n = sizeof contents; + if (n > size) + n = size; + if (lseek(fd, size - n, SEEK_SET) == (off_t)-1) + return ferr("cannot seek in file."); + if (read(fd, contents, n) != (ssize_t)n) + return ferr("cannot read file contents"); + while (n && !contents[--n]) + --size; + } while (size && !n); + + /* Sanity check. + */ + if (!size) + return err("ELF file is completely blank!"); + + *newsize = size; + return TRUE; +} + +/* main() loops over the cmdline arguments, leaving all the real work + * to the other functions. + */ +int main(int argc, char *argv[]) +{ + int fd; + union { + Elf32_Ehdr ehdr32; + Elf64_Ehdr ehdr64; + } e; + union { + Elf32_Phdr *phdrs32; + Elf64_Phdr *phdrs64; + } p; + unsigned long newsize; + char **arg; + int failures = 0; + + if (argc < 2 || argv[1][0] == '-') { + printf("Usage: sstrip FILE...\n" + "sstrip discards all nonessential bytes from an executable.\n\n" + "Version 2.0-X Copyright (C) 2000,2001 Brian Raiter.\n" + "Cross-devel hacks Copyright (C) 2004 Manuel Novoa III.\n" + "This program is free software, licensed under the GNU\n" + "General Public License. There is absolutely no warranty.\n"); + return EXIT_SUCCESS; + } + + progname = argv[0]; + + for (arg = argv + 1 ; *arg != NULL ; ++arg) { + filename = *arg; + + fd = open(*arg, O_RDWR); + if (fd < 0) { + ferr("can't open"); + ++failures; + continue; + } + + switch (readelfheaderident(fd, &e.ehdr32)) { + case ELFCLASS32: + if (!(readelfheader32(fd, &e.ehdr32) && + readphdrtable32(fd, &e.ehdr32, &p.phdrs32) && + getmemorysize32(&e.ehdr32, p.phdrs32, &newsize) && + truncatezeros(fd, &newsize) && + modifyheaders32(&e.ehdr32, p.phdrs32, newsize) && + commitchanges32(fd, &e.ehdr32, p.phdrs32, newsize))) + ++failures; + break; + case ELFCLASS64: + if (!(readelfheader64(fd, &e.ehdr64) && + readphdrtable64(fd, &e.ehdr64, &p.phdrs64) && + getmemorysize64(&e.ehdr64, p.phdrs64, &newsize) && + truncatezeros(fd, &newsize) && + modifyheaders64(&e.ehdr64, p.phdrs64, newsize) && + commitchanges64(fd, &e.ehdr64, p.phdrs64, newsize))) + ++failures; + break; + default: + ++failures; + break; + } + close(fd); + } + + return failures ? EXIT_FAILURE : EXIT_SUCCESS; +} + +/* +vi:ts=4:et:nowrap +*/ +