diff --git a/src/p_lx_interp.cpp b/src/p_lx_interp.cpp new file mode 100644 index 00000000..e742ac3d --- /dev/null +++ b/src/p_lx_interp.cpp @@ -0,0 +1,321 @@ +/* p_lx_interp.cpp -- + + 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 + markus@oberhumer.com ml1050@cdata.tvnet.hu jreiser@BitWagon.com + */ + + +#include "conf.h" + +#include "file.h" +#include "filter.h" +#include "linker.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_interp.h" + +#define PT_LOAD Elf32_Phdr::PT_LOAD +#define PT_INTERP Elf32_Phdr::PT_INTERP + + +/************************************************************************* +// +**************************************************************************/ + +static const +#include "stub/l_lx_pti86.h" +static const +#include "stub/fold_pti86.h" + +PackLinuxI386interp::PackLinuxI386interp(InputFile *f) : + super(f) +{ +} + +PackLinuxI386interp::~PackLinuxI386interp() +{ +} + +bool PackLinuxI386interp::canPack() +{ + if (opt->o_unix.make_ptinterp) { + return true; + } + if (!opt->o_unix.use_ptinterp) { + return false; + } + return super::canPack(); +} + +void PackLinuxI386interp::pack1(OutputFile *fo, Filter &) +{ + fi->seek(0, SEEK_SET); + fi->readx(&ehdri, sizeof(ehdri)); + assert(ehdri.e_phoff == sizeof(Elf32_Ehdr)); // checked by canPack() + sz_phdrs = ehdri.e_phnum * ehdri.e_phentsize; + + phdri = new Elf32_Phdr[(unsigned)ehdri.e_phnum]; + fi->seek(ehdri.e_phoff, SEEK_SET); + fi->readx(phdri, sz_phdrs); + +#define EI_ABIVERSION 8 /* ABI version */ + +#define EI_OSABI 7 /* OS ABI identification */ +#define ELFOSABI_LINUX 3 /* Linux. */ + +#define EI_VERSION 6 /* File version byte index */ +#define EV_CURRENT 1 /* Current version */ + +#define EI_DATA 5 /* Data encoding byte index */ +#define ELFDATA2LSB 1 /* 2's complement, little endian */ + +#define EI_CLASS 4 /* File class byte index */ +#define ELFCLASS32 1 /* 32-bit objects */ + +#define ET_EXEC 2 +#define EM_386 3 + + cprElfHdr3 h3; + memset(&h3, 0, sizeof(h3)); + memcpy(h3.ehdr.e_ident, "\177ELF", 4); + h3.ehdr.e_ident[EI_CLASS] = ELFCLASS32; + h3.ehdr.e_ident[EI_DATA] = ELFDATA2LSB; + h3.ehdr.e_ident[EI_VERSION] = EV_CURRENT; + h3.ehdr.e_ident[EI_OSABI] = ELFOSABI_LINUX; + h3.ehdr.e_ident[EI_ABIVERSION] = EV_CURRENT; + h3.ehdr.e_type = ET_EXEC; + h3.ehdr.e_machine = EM_386; + h3.ehdr.e_version = 1; + h3.ehdr.e_phoff = sizeof(Elf32_Ehdr); + h3.ehdr.e_ehsize = sizeof(Elf32_Ehdr); + h3.ehdr.e_phentsize = sizeof(Elf32_Phdr); + h3.ehdr.e_phnum = 3; + h3.phdr[0].p_type = PT_LOAD; + h3.phdr[0].p_flags = Elf32_Phdr::PF_X | Elf32_Phdr::PF_R; + h3.phdr[0].p_align = 0x1000; + h3.phdr[1].p_type = PT_LOAD; + h3.phdr[1].p_flags = Elf32_Phdr::PF_W | Elf32_Phdr::PF_R; + h3.phdr[1].p_align = 1; + h3.phdr[2].p_type = PT_INTERP; + h3.phdr[2].p_offset = (char *)&h3.phdr[2].p_vaddr - (char *)&h3; + memcpy(&h3.phdr[2].p_vaddr, "/upxrun", h3.phdr[2].p_filesz = 8); + h3.phdr[2].p_align = 1; + + if (opt->o_unix.make_ptinterp) { // unusual "once per release" + elfout = h3; + elfout.ehdr.e_phnum = 1; + fo->write(&elfout, elfout.ehdr.e_ehsize + elfout.ehdr.e_phentsize); + } + else { // usual case + generateElfHdr(fo, &h3, getbrk(phdri, ehdri.e_phnum)); + } +} + +void PackLinuxI386interp::pack2(OutputFile *fo, Filter &ft) +{ + if (opt->o_unix.make_ptinterp) { + return; // ignore current input file! + } + super::pack2(fo, ft); +} + +#define PAGE_MASK (~0u<<12) + +void PackLinuxI386interp::pack3(OutputFile *fo, Filter &/*ft*/) +{ + unsigned long base = getbase(phdri, ehdri.e_phnum); + unsigned long sz = PAGE_MASK & (~PAGE_MASK + elfout.phdr[0].p_filesz); + if (base < (0x11000 + sz)) { + base = 0x11000 + sz; + } + if (opt->o_unix.make_ptinterp) { + base = 0x10000; + } + elfout.phdr[0].p_paddr = elfout.phdr[0].p_vaddr = base - sz; + if (opt->o_unix.make_ptinterp) { + initLoader(linux_i386pti_loader, sizeof(linux_i386pti_loader)); + linker->addSection("FOLDEXEC", linux_i386pti_fold, sizeof(linux_i386pti_fold)); + + addLoader("LXPTI000", 0); + + addLoader("LXPTI040", 0); + ph.method = M_NRV2B_LE32; addLoader(getDecompressor(), 0); + addLoader("LXPTI090", 0); + + addLoader("LXPTI041", 0); + ph.method = M_NRV2D_LE32; addLoader(getDecompressor(), 0); + addLoader("LXPTI090", 0); + + addLoader("LXPTI042", 0); + ph.method = M_NRV2E_LE32; addLoader(getDecompressor(), 0); + addLoader("LXPTI090", 0); + + addLoader("LXPTI043", 0); + ph.method = M_CL1B_LE32; addLoader(getDecompressor(), 0); + addLoader("LXPTI090", 0); + + addLoader("LXPTI091", 0); + + addLoader("LXPTI140", 0); + + addLoader("LXUNF002""LXUNF008""LXUNF010", 0); + addFilter32(0x46); + addLoader("LXUNF042""LXUNF035", 0); + + addLoader("LXUNF002""LXUNF008""LXUNF010", 0); + addFilter32(0x49); + addLoader("LXUNF042""LXUNF035", 0); + + addLoader("LXPTI200", 0); + addLoader("FOLDEXEC", 0); + upx_byte const *p = getLoader(); + lsize = getLoaderSize(); + updateLoader(fo); + fo->write(p, lsize); + elfout.phdr[0].p_filesz = fo->getBytesWritten(); + } + else { + updateLoader(fo); + } +} + + +void PackLinuxI386interp::unpack(OutputFile *fo) +{ +#define MAX_INTERP_HDR 512 + char bufehdr[MAX_INTERP_HDR]; + Elf32_Ehdr *const ehdr = (Elf32_Ehdr *)bufehdr; + Elf32_Phdr const *phdr = (Elf32_Phdr *)(1+ehdr); + + unsigned szb_info = sizeof(b_info); + { + fi->seek(0, SEEK_SET); + fi->readx(bufehdr, MAX_INTERP_HDR); + unsigned const e_entry = get_native32(&ehdr->e_entry); + if (e_entry < 0x401180) { /* old style, 8-byte b_info */ + szb_info = 2*sizeof(unsigned); + } + } + + fi->seek(overlay_offset, SEEK_SET); + p_info hbuf; + fi->readx(&hbuf, sizeof(hbuf)); + unsigned orig_file_size = get_native32(&hbuf.p_filesize); + blocksize = get_native32(&hbuf.p_blocksize); + if (file_size > (off_t)orig_file_size || blocksize > orig_file_size) + throwCantUnpack("file header corrupted"); + + ibuf.alloc(blocksize + OVERHEAD); + b_info bhdr; memset(&bhdr, 0, sizeof(bhdr)); + fi->readx(&bhdr, szb_info); + ph.u_len = get_native32(&bhdr.sz_unc); + ph.c_len = get_native32(&bhdr.sz_cpr); + ph.filter_cto = bhdr.b_cto8; + + // Uncompress Ehdr and Phdrs. + fi->readx(ibuf, ph.c_len); + decompress(ibuf, (upx_byte *)ehdr, false); + + unsigned total_in = 0; + unsigned total_out = 0; + unsigned c_adler = upx_adler32(NULL, 0); + unsigned u_adler = upx_adler32(NULL, 0); + off_t ptload0hi=0, ptload1lo=0, ptload1sz=0; + + // decompress PT_LOAD + bool first_PF_X = true; + fi->seek(- (off_t) (szb_info + ph.c_len), SEEK_CUR); + for (unsigned j=0; j < ehdr->e_phnum; ++phdr, ++j) { + if (PT_LOAD==phdr->p_type) { + if (0==ptload0hi) { + ptload0hi = phdr->p_filesz + phdr->p_offset; + } + else if (0==ptload1lo) { + ptload1lo = phdr->p_offset; + ptload1sz = phdr->p_filesz; + } + if (fo) + fo->seek(phdr->p_offset, SEEK_SET); + if (Elf32_Phdr::PF_X & phdr->p_flags) { + unpackExtent(phdr->p_filesz, fo, total_in, total_out, + c_adler, u_adler, first_PF_X, szb_info); + first_PF_X = false; + } + else { + unpackExtent(phdr->p_filesz, fo, total_in, total_out, + c_adler, u_adler, false, szb_info); + } + } + } + + if (0!=ptload1sz && ptload0hi < ptload1lo) { // alignment hole? + if (fo) + fo->seek(ptload0hi, SEEK_SET); + unpackExtent(ptload1lo - ptload0hi, fo, total_in, total_out, + c_adler, u_adler, false, szb_info); + } + if (total_out != orig_file_size) { // non-PT_LOAD stuff + if (fo) + fo->seek(0, SEEK_END); + unpackExtent(orig_file_size - total_out, fo, total_in, total_out, + c_adler, u_adler, false, szb_info); + } + + // check for end-of-file + fi->readx(&bhdr, szb_info); + unsigned const sz_unc = ph.u_len = get_native32(&bhdr.sz_unc); + + if (sz_unc == 0) { // uncompressed size 0 -> EOF + // note: magic is always stored le32 + unsigned const sz_cpr = get_le32(&bhdr.sz_cpr); + if (sz_cpr != UPX_MAGIC_LE32) // sz_cpr must be h->magic + throwCompressedDataViolation(); + } + else { // extra bytes after end? + throwCompressedDataViolation(); + } + + // update header with totals + ph.c_len = total_in; + ph.u_len = total_out; + + // all bytes must be written + if (total_out != orig_file_size) + throwEOFException(); + + // finally test the checksums + if (ph.c_adler != c_adler || ph.u_adler != u_adler) + throwChecksumError(); +#undef MAX_INTERP_HDR +} + + +/* +vi:ts=4:et +*/ + diff --git a/src/stub/fold_pti86.asm b/src/stub/fold_pti86.asm new file mode 100644 index 00000000..22690414 --- /dev/null +++ b/src/stub/fold_pti86.asm @@ -0,0 +1,119 @@ +; 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 + +; vi:ts=8:et:nowrap + diff --git a/src/stub/fold_pti86.h b/src/stub/fold_pti86.h new file mode 100644 index 00000000..922f4f96 --- /dev/null +++ b/src/stub/fold_pti86.h @@ -0,0 +1,138 @@ +/* fold_pti86.h -- created from fold_pti86.bin, 1680 (0x690) bytes + + 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 LINUX_I386PTI_FOLD_ADLER32 0x5c03df14 +#define LINUX_I386PTI_FOLD_CRC32 0xd346f507 + +unsigned char linux_i386pti_fold[1680] = { +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,144, 6, 0, 0,144, 6, 0, 0, 5, 0, 0, 0, /* 0x 40 */ + 0, 16, 0, 0, 1, 0, 0, 0,144, 6, 0, 0,144, 6, 1, 0, /* 0x 50 */ +144, 6, 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,170, 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, 0, 0, 85, 87, 86, 83,139,124, 36, 20, /* 0x e0 */ +139,108, 36, 28, 57, 47,139,119, 4,139, 76, 36, 24,115, 10,187, /* 0x f0 */ +127, 0, 0, 0,106, 1, 88,205,128,141, 85,255,131,250,255,116, /* 0x 100 */ + 12,138, 6, 74,136, 1, 70, 65,131,250,255,117,244, 1,111, 4, /* 0x 110 */ + 41, 47, 91, 94, 95, 93,195, 83,139, 92, 36, 8,106, 45, 88,205, /* 0x 120 */ +128, 91,195, 83,141, 92, 36, 8,106, 90, 88,205,128, 91,195, 85, /* 0x 130 */ +137,229, 87, 86, 83,131,236, 20,139,117, 12,131, 62, 0,139,125, /* 0x 140 */ + 8,117, 8,141,101,244, 91, 94, 95,201,195,106, 12,141, 69,228, /* 0x 150 */ + 80, 87,232,129,255,255,255,131,196, 12,131,125,228, 0, 15,133, /* 0x 160 */ +177, 0, 0, 0,129,125,232, 85, 80, 88, 33, 15,132,150, 0, 0, /* 0x 170 */ + 0,187,127, 0, 0, 0,106, 1, 88,205,128,139, 85,232,139, 69, /* 0x 180 */ +228, 57,194,119,236, 59, 6,119,232, 57,194,115,107, 15,182, 69, /* 0x 190 */ +236, 80,255, 85, 16,141, 85,224,137, 20, 36,255,118, 4,255,117, /* 0x 1a0 */ +232,255,119, 4,255, 16,131,196, 16,133,192,117,196,139, 69,228, /* 0x 1b0 */ + 57, 69,224,117,188,138, 69,237,132,192,117, 33,139, 69,232, 1, /* 0x 1c0 */ + 71, 4, 41, 7,139, 85,228,139, 6, 41,208, 1, 86, 4,133,192, /* 0x 1d0 */ +137, 6, 15,133,115,255,255,255,233,102,255,255,255, 15,182,192, /* 0x 1e0 */ + 80,255, 85, 20, 15,182, 85,238,137, 20, 36,255,117,224,255,118, /* 0x 1f0 */ + 4,255, 16,131,196, 12,235,196, 82,255,118, 4, 87,232,214,254, /* 0x 200 */ +255,255,131,196, 12,235,189,131, 63, 0, 15,132, 51,255,255,255, /* 0x 210 */ +233, 92,255,255,255,131,125,232, 0, 15,133, 92,255,255,255,233, /* 0x 220 */ + 77,255,255,255, 83,139, 84, 36, 8, 49,201,131, 58, 1,116, 4, /* 0x 230 */ +137,200, 91,195,246, 66, 24, 1,116,246,139, 66, 20,139, 90, 8, /* 0x 240 */ + 59, 66, 16,141, 12, 3,116, 26,131,122, 4, 0,141, 75, 12,117, /* 0x 250 */ +223,139, 1, 61,205,128, 97,195,116,214,199, 1,205,128, 97,195, /* 0x 260 */ +235,206,137,200,247,216, 37,255, 15, 0, 0,131,248, 3,119,225, /* 0x 270 */ +235,214,133,210,116, 7,198, 0, 0, 64, 74,117,249,195,133,192, /* 0x 280 */ + 83,137,211,116, 30,169, 1, 0, 0, 0,117, 23,139, 16, 57,218, /* 0x 290 */ +116, 12, 74,116, 5,131,192, 8,235,242,133,219,116,247,137, 24, /* 0x 2a0 */ +137, 72, 4, 91,195, 85,137,229, 87, 86, 83, 83,137,195, 49,246, /* 0x 2b0 */ + 49,255,131,195, 34, 73,199, 69,240,255,255,255,255,120, 11,131, /* 0x 2c0 */ + 58, 1,116,101,131,194, 32, 73,121,245,139, 69,240, 37,255, 15, /* 0x 2d0 */ + 0, 0,106, 0, 41, 69,240,106, 0, 43,117,240, 83,129,198,255, /* 0x 2e0 */ + 15, 0, 0,106, 7,129,230, 0,240,255,255, 86,255,117,240,141, /* 0x 2f0 */ +188, 56,255, 15, 0, 0,129,231, 0,240,255,255,232, 34,254,255, /* 0x 300 */ +255,141, 20, 6,137,195, 41,254,139, 69, 8,137, 16, 86,141, 4, /* 0x 310 */ + 31, 80,232, 89, 3, 0, 0, 43, 93,240,131,196, 32,141,101,244, /* 0x 320 */ +137,216, 91, 94, 95,201,194, 4, 0,139, 66, 8, 59, 69,240,115, /* 0x 330 */ + 6,137, 69,240,139,122, 16, 3, 66, 20, 57,198,115,134,137,198, /* 0x 340 */ +235,130, 85,137,229, 87, 86, 83,131,236, 36,139, 69, 16, 3, 64, /* 0x 350 */ + 28,139, 85, 16,137, 69,228, 49,192,102,131,122, 16, 3, 15,183, /* 0x 360 */ + 74, 44, 15,149,192,141, 85,240,193,224, 4, 82,139, 85,228,232, /* 0x 370 */ + 49,255,255,255,139, 77, 16,102,131,121, 44, 0,137, 69,224,199, /* 0x 380 */ + 69,220, 0, 0, 0, 0,116, 40,139, 93,228,139, 3,131,248, 6, /* 0x 390 */ + 15,132,174, 1, 0, 0, 72, 15,132,167, 0, 0, 0,139, 77, 16, /* 0x 3a0 */ +255, 69,220, 15,183, 65, 44,131, 69,228, 32, 57, 69,220,124,216, /* 0x 3b0 */ +131,125, 20, 0,116, 39,139, 69, 16,102,131,120, 16, 3,116, 9, /* 0x 3c0 */ +255,117,240,232, 79,253,255,255, 94,139, 85, 16,139, 82, 24, 1, /* 0x 3d0 */ + 85,224,139, 69,224,141,101,244, 91, 94, 95,201,195,139, 93, 8, /* 0x 3e0 */ +106, 6, 88,205,128,133,192,116,224,187,127, 0, 0, 0,106, 1, /* 0x 3f0 */ + 88,205,128,139, 85,208,141, 4, 58, 1,198, 59,117,212,114, 34, /* 0x 400 */ +131,125, 20, 0,116,151,131,199, 3,129,231,255, 15, 0, 0,131, /* 0x 410 */ +255, 3,119,137, 87, 86,232, 85, 2, 0, 0, 88, 90,233,123,255, /* 0x 420 */ +255,255,106, 0,106, 0,106, 50,139, 69,212,255,117,216, 41,240, /* 0x 430 */ + 80, 86,232,236,252,255,255,131,196, 24, 57,198, 15,132, 91,255, /* 0x 440 */ +255,255,235,165,139, 69,228,139, 72, 24,131,225, 7,193,225, 2, /* 0x 450 */ +139, 85,228,199, 69,216, 64, 98, 81,115,139, 90, 8,211,109,216, /* 0x 460 */ +139, 74, 20,139, 64, 16, 1,217,137,222,137, 93,236,129,227,255, /* 0x 470 */ + 15, 0, 0,137, 69,232,141, 60, 3,139, 69,224, 1,193,139, 66, /* 0x 480 */ + 4, 41,216, 41,222, 80,131,101,216, 7, 3,117,224,131,125, 20, /* 0x 490 */ + 0,137, 93,208,137, 77,212,255,117, 8,184, 50, 0, 0, 0, 15, /* 0x 4a0 */ +132,149, 0, 0, 0, 80,131,125, 20, 0,106, 3,137,248,116, 3, /* 0x 4b0 */ +141, 71, 3, 80, 86,232,105,252,255,255,131,196, 24, 57,198, 15, /* 0x 4c0 */ +133, 36,255,255,255,131,125, 20, 0,116, 21,255,117, 12,255,117, /* 0x 4d0 */ + 8,141, 69,232, 80,255,117, 20,232, 82,252,255,255,131,196, 16, /* 0x 4e0 */ +139, 85,208,137,240,232,136,253,255,255,137,250,247,218,129,226, /* 0x 4f0 */ +255, 15, 0, 0,141, 4, 55,137, 85,208,232,115,253,255,255,131, /* 0x 500 */ +125, 20, 0,116, 28,255,117,228,232, 23,253,255,255,133,192,137, /* 0x 510 */ +193, 91,116, 13,139, 69, 24,131,224,254, 49,210,232, 93,253,255, /* 0x 520 */ +255,137,243,137,249,139, 85,216,106,125, 88,205,128,133,192, 15, /* 0x 530 */ +132,190,254,255,255,233,175,254,255,255,184, 18, 0, 0, 0,233, /* 0x 540 */ + 97,255,255,255,139, 77,224, 3, 75, 8,186, 3, 0, 0, 0,139, /* 0x 550 */ + 69, 24,232, 39,253,255,255,233, 65,254,255,255, 85,137,229, 87, /* 0x 560 */ + 86, 83,131,236, 20,139, 69, 24,139,125, 20,137, 69,236,139, 69, /* 0x 570 */ + 32,255,117, 40,139, 85, 28,137, 69,228,141, 71, 52,255,117, 16, /* 0x 580 */ +137, 85,240,137, 69,224,139, 85, 36,141, 69,236, 80,137, 85,232, /* 0x 590 */ +141, 85,228, 82,139, 93, 8,139,117,228,232,144,251,255,255,139, /* 0x 5a0 */ + 69, 12,137, 69,228,139, 69,224,139, 72, 8,131,193, 52,137,216, /* 0x 5b0 */ +186, 3, 0, 0, 0, 41,117,232,232,193,252,255,255,137,216, 15, /* 0x 5c0 */ +183, 79, 42,186, 4, 0, 0, 0,232,177,252,255,255,137,216, 15, /* 0x 5d0 */ +183, 79, 44,186, 5, 0, 0, 0,232,161,252,255,255,139, 79, 24, /* 0x 5e0 */ +137,216,186, 9, 0, 0, 0,232,146,252,255,255, 83,141, 85,228, /* 0x 5f0 */ + 82, 87,255,117, 40,255,117, 16,232, 69,253,255,255,102,139, 79, /* 0x 600 */ + 44,131,196, 36, 49,210,102,133,201,137,195,116, 20,139, 69,224, /* 0x 610 */ +131, 56, 3,116, 22, 66, 15,183,193,131, 69,224, 32, 57,194,124, /* 0x 620 */ +236,141,101,244,137,216, 91, 94, 95,201,195, 49,201,139, 88, 8, /* 0x 630 */ +137,202,106, 5, 88,205,128,133,192,137,195,120, 19,186, 0, 2, /* 0x 640 */ + 0, 0,137,249,106, 3, 88,205,128, 61, 0, 2, 0, 0,116, 12, /* 0x 650 */ +187,127, 0, 0, 0,106, 1, 88,205,128,235,244,106, 0,106, 0, /* 0x 660 */ + 87,106, 0, 83,232,217,252,255,255,137,195,131,196, 20,235,177, /* 0x 670 */ + 83,139, 92, 36, 8,139, 76, 36, 12,106, 91, 88,205,128, 91,195 /* 0x 680 */ +}; diff --git a/src/stub/l_lx_pti.c b/src/stub/l_lx_pti.c new file mode 100644 index 00000000..4b51de93 --- /dev/null +++ b/src/stub/l_lx_pti.c @@ -0,0 +1,434 @@ +/* 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 "linux.hh" + + +/************************************************************************* +// 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); +} + +static char * +__attribute_cdecl +do_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset) +{ + (void)len; (void)prot; (void)flags; (void)fd; (void)offset; + return mmap((void *)&addr); +} + + +/************************************************************************* +// 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 * +); + +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))(xi->buf, h.sz_cpr, xo->buf, &out_len); + if (j != 0 || out_len != (nrv_uint)h.sz_unc) + err_exit(7); + if (h.b_ftid!=0) { + (*get_funf(h.b_ftid))(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, int 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 = do_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 *)&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 != do_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 != do_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/l_lx_pti86.asm b/src/stub/l_lx_pti86.asm new file mode 100644 index 00000000..77162064 --- /dev/null +++ b/src/stub/l_lx_pti86.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 "n2b_d32.ash" +%include "n2d_d32.ash" +%include "n2e_d32.ash" +%include "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 "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/l_lx_pti86.h b/src/stub/l_lx_pti86.h new file mode 100644 index 00000000..83985309 --- /dev/null +++ b/src/stub/l_lx_pti86.h @@ -0,0 +1,422 @@ +/* l_lx_pti86.h -- created from l_lx_pti86.bin, 6218 (0x184a) bytes + + 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 LINUX_I386PTI_LOADER_ADLER32 0x65bfcf1f +#define LINUX_I386PTI_LOADER_CRC32 0x261c0a89 + +unsigned char linux_i386pti_loader[6218] = { +204,232, 28, 0, 0, 0,131,248, 70,185,210, 5, 0, 0,116, 15, /* 0x 0 */ +131,248, 73,185,210, 5, 0, 0,116, 5,185, 33, 0, 0, 0,137, /* 0x 10 */ +200,195,232, 0, 0, 0, 0,131,248, 2,185, 84, 0, 0, 0,116, /* 0x 20 */ +238,131,248, 5,185, 84, 0, 0, 0,116,228,131,248, 8,185, 84, /* 0x 30 */ + 0, 0, 0,116,218,131,248, 11,185, 84, 0, 0, 0,116,208,233, /* 0x 40 */ +198,255,255,255, 96,131,205,255,139,116, 36, 36,139,124, 36, 44, /* 0x 50 */ +235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, /* 0x 60 */ + 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, /* 0x 70 */ + 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 80 */ +192, 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219, /* 0x 90 */ +115, 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 49,201,131, /* 0x a0 */ +232, 3,114, 13,193,224, 8,138, 6, 70,131,240,255,116, 0,137, /* 0x b0 */ +197, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219, /* 0x c0 */ +117, 7,139, 30,131,238,252, 17,219, 17,201,117, 0, 65, 1,219, /* 0x d0 */ +117, 7,139, 30,131,238,252, 17,219, 17,201, 1,219,117, 7,139, /* 0x e0 */ + 30,131,238,252, 17,219,115, 0, 1,219,115, 0,117, 9,139, 30, /* 0x f0 */ +131,238,252, 17,219,115, 0, 65, 65,131,193, 2,129,253, 0,243, /* 0x 100 */ +255,255,131,209, 1, 86,141, 52, 47,243,164, 94,233, 0, 0, 0, /* 0x 110 */ + 0,141, 20, 47,131,253,252,138, 4, 15,118, 0,138, 2, 66,136, /* 0x 120 */ + 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2,131,194, 4,137, /* 0x 130 */ + 7,131,199, 4,131,233, 4,119,241, 1,207,233, 0, 0, 0, 0, /* 0x 140 */ +235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219,117, 7,139, /* 0x 150 */ + 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7,114, 0,184, /* 0x 160 */ + 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17, /* 0x 170 */ +192, 1,219,117, 7,139, 30,131,238,252, 17,219,114, 0, 1,219, /* 0x 180 */ +115, 11,117, 0,139, 30,131,238,252, 17,219,114, 0, 72, 1,219, /* 0x 190 */ +117, 7,139, 30,131,238,252, 17,219, 17,192,235, 0, 49,201,131, /* 0x 1a0 */ +232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255,116, 0,209, /* 0x 1b0 */ +248,137,197,235, 11, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 1c0 */ + 17,201, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,117, /* 0x 1d0 */ + 0, 65, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, 1, /* 0x 1e0 */ +219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, 0, /* 0x 1f0 */ +117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, 2, /* 0x 200 */ +129,253, 0,251,255,255,131,209, 1, 86,141, 52, 47,243,164, 94, /* 0x 210 */ +233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, 0, /* 0x 220 */ +138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, 2, /* 0x 230 */ +131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207,233, /* 0x 240 */ + 0, 0, 0, 0,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1, /* 0x 250 */ +219,117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, /* 0x 260 */ + 7,114, 0,184, 1, 0, 0, 0, 1,219,117, 7,139, 30,131,238, /* 0x 270 */ +252, 17,219, 17,192, 1,219,117, 7,139, 30,131,238,252, 17,219, /* 0x 280 */ +114, 0, 1,219,115, 11,117, 0,139, 30,131,238,252, 17,219,114, /* 0x 290 */ + 0, 72, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,192,235, /* 0x 2a0 */ + 0, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201,235, 0, /* 0x 2b0 */ + 49,201,131,232, 3,114, 17,193,224, 8,138, 6, 70,131,240,255, /* 0x 2c0 */ +116, 0,209,248,137,197,235, 11, 1,219,117, 7,139, 30,131,238, /* 0x 2d0 */ +252, 17,219,114,204, 65, 1,219,117, 7,139, 30,131,238,252, 17, /* 0x 2e0 */ +219,114,190, 1,219,117, 7,139, 30,131,238,252, 17,219, 17,201, /* 0x 2f0 */ + 1,219,117, 7,139, 30,131,238,252, 17,219,115, 0, 1,219,115, /* 0x 300 */ + 0,117, 9,139, 30,131,238,252, 17,219,115, 0, 65, 65,131,193, /* 0x 310 */ + 2,129,253, 0,251,255,255,131,209, 2, 86,141, 52, 47,243,164, /* 0x 320 */ + 94,233, 0, 0, 0, 0,141, 20, 47,131,253,252,138, 4, 15,118, /* 0x 330 */ + 0,138, 2, 66,136, 7, 71, 73,117,247,233, 0, 0, 0, 0,139, /* 0x 340 */ + 2,131,194, 4,137, 7,131,199, 4,131,233, 4,119,241, 1,207, /* 0x 350 */ +233, 0, 0, 0, 0,255,210, 1,219,117, 2,255,210,144,232, 0, /* 0x 360 */ + 0, 0, 0, 1,219,116, 0,195,139, 30,131,238,252, 17,219,195, /* 0x 370 */ + 41,201, 17,201,114, 0, 17,201,114, 0, 17,201, 17,192, 72, 17, /* 0x 380 */ +192,131,233, 1,115, 0,141, 72, 15, 61,240,255, 0, 0,114, 0, /* 0x 390 */ +141, 4, 14, 80,233, 0, 0, 0, 0, 17,201, 17,201,131,193, 13, /* 0x 3a0 */ +235, 0,133,201,116, 0, 65,131,193, 8,235, 0, 41,201, 90, 41, /* 0x 3b0 */ +219,141, 65, 1,115, 0,114, 0,114, 0,114, 0,131,193, 2,114, /* 0x 3c0 */ + 0, 65,114, 5,233, 0, 0, 0, 0, 17,201,209,233,115, 1,164, /* 0x 3d0 */ +209,233,115, 2,102,165,243,165,141, 65, 1,235, 3,164,164,164, /* 0x 3e0 */ + 17,192,115, 0,131,232, 3,114, 11,193,224, 8,172,131,240,255, /* 0x 3f0 */ +116, 0,137,197, 17,201, 17,201,117, 0, 65, 17,201,115, 0,131, /* 0x 400 */ +193, 2,129,253, 0,243,255,255,131,209, 1, 86,141, 52, 47,131, /* 0x 410 */ +253,252,119, 19,209,233,115, 1,164,209,233,115, 2,102,165,243, /* 0x 420 */ +165, 94,233, 0, 0, 0, 0,131,253,255,117, 5,172,243,170,235, /* 0x 430 */ +240,243,164,235,236,233, 0, 0, 0, 0,139, 84, 36, 36, 3, 84, /* 0x 440 */ + 36, 40, 57,214,116, 1, 72, 43,124, 36, 44,139, 84, 36, 48,137, /* 0x 450 */ + 58,137, 68, 36, 28, 97,195,185, 84, 69, 88, 76,138, 7, 71, 44, /* 0x 460 */ +232, 60, 1,119,247,128, 63, 63,117, 0,139, 7,138, 95, 4,102, /* 0x 470 */ +193,232, 8,134,196,193,192, 16,134,196, 41,248,128,235,232,137, /* 0x 480 */ + 7,131,199, 5,136,216,226, 0,185, 84, 69, 88, 76,176,232,176, /* 0x 490 */ +233,242,174,117, 0,128, 63, 63,117, 0,139, 7,102,193,232, 8, /* 0x 4a0 */ +134,196,193,192, 16,134,196, 41,248,171,235, 0,235, 0, 90, 88, /* 0x 4b0 */ + 89,151, 96, 49,219,187, 78, 77, 82, 85,106, 15, 88,138,100, 36, /* 0x 4c0 */ + 32,106, 15, 91,138,124, 36, 32,138, 84, 36, 32,233, 0, 0, 0, /* 0x 4d0 */ + 0, 15,183, 47, 43,110, 12, 41,221,117, 0,131,237, 1,115, 0, /* 0x 4e0 */ +136, 95,255, 73,136, 7, 71,139, 7,156,102,193,232, 8,193,192, /* 0x 4f0 */ + 16,134,196,157,115, 0,176, 0, 15,200,115, 0,209,232,115, 0, /* 0x 500 */ +254,203, 75, 35, 30,125, 2, 3, 30,137, 4,156,235, 0,141, 20, /* 0x 510 */ + 24, 15,182,210, 35, 22, 59, 22,114, 2, 43, 22,139, 4,148,254, /* 0x 520 */ +203, 75, 35, 30,125, 2, 3, 30,139, 44,156,133,237,117, 0, 80, /* 0x 530 */ +139, 70, 4,254,200, 72, 35, 6,125, 2, 3, 6, 49,237,137, 70, /* 0x 540 */ + 4,135,108,132, 4, 88,137, 44,148,137, 4,156, 41,248,131,233, /* 0x 550 */ + 4, 3, 70, 16, 1,240,137, 7,131,199, 4,235, 0,235, 0, 80, /* 0x 560 */ +176,233,176,232, 80,106, 0, 83,137,230, 94,137,218,178,233,178, /* 0x 570 */ +232, 67,106, 0,254,203, 75,117, 0, 15,183, 7,131,199, 1, 60, /* 0x 580 */ +128,114, 4, 60,143,118, 0, 41,208, 43, 70, 8,131,232, 2,116, /* 0x 590 */ + 0,131,232, 1,114, 0,115, 0,122, 0,123, 0,248,235, 0,131, /* 0x 5a0 */ +233, 1,127, 0,137,231,185, 4, 1, 0, 0,139, 14,131,193, 5, /* 0x 5b0 */ +139, 14,131,193, 4, 49,192,243,171,137,252, 86, 97,151, 81, 80, /* 0x 5c0 */ + 82,195, 96,139,124, 36, 36,139, 76, 36, 40,139, 84, 36, 44,137, /* 0x 5d0 */ +254,235, 0,138, 7,131,199, 1, 60,128,114, 10, 60,143,119, 6, /* 0x 5e0 */ +128,127,254, 15,116, 0, 44,232, 60, 1,119, 0, 56, 23,117, 0, /* 0x 5f0 */ +139, 7,102,193,232, 8,193,192, 16,134,196, 41,248, 1,240,137, /* 0x 600 */ + 7,131,199, 4,131,233, 4,138, 7,131,199, 1,226, 0,131,233, /* 0x 610 */ + 1,127, 0, 97,195, 0, 0, 0, 76, 88, 80, 84, 73, 48, 48, 48, /* 0x 620 */ + 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 76, 88, 80, 84, /* 0x 630 */ + 73, 50, 48, 48, 0, 0, 0, 0, 76, 88, 80, 84, 73, 48, 52, 48, /* 0x 640 */ + 84, 0, 0, 0, 76, 88, 80, 84, 73, 48, 52, 49, 84, 0, 0, 0, /* 0x 650 */ + 76, 88, 80, 84, 73, 48, 52, 50, 84, 0, 0, 0, 76, 88, 80, 84, /* 0x 660 */ + 73, 48, 52, 51, 84, 0, 0, 0, 76, 88, 80, 84, 73, 48, 53, 48, /* 0x 670 */ + 84, 0, 0, 0, 78, 50, 66, 83, 77, 65, 49, 48, 96, 0, 0, 0, /* 0x 680 */ + 0, 0, 0, 0, 98, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, /* 0x 690 */ + 4, 0, 0, 0, 78, 50, 66, 70, 65, 83, 49, 48, 99, 0, 0, 0, /* 0x 6a0 */ + 0, 0, 0, 0,101, 0, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, /* 0x 6b0 */ + 4, 0, 0, 0, 78, 50, 66, 70, 65, 83, 49, 49,101, 0, 0, 0, /* 0x 6c0 */ + 78, 50, 66, 68, 69, 67, 49, 48,107, 0, 0, 0, 78, 50, 66, 83, /* 0x 6d0 */ + 77, 65, 50, 48,118, 0, 0, 0, 0, 0, 0, 0,120, 0, 0, 0, /* 0x 6e0 */ + 78, 50, 66, 83, 77, 65, 49, 48, 2, 0, 0, 0, 78, 50, 66, 70, /* 0x 6f0 */ + 65, 83, 50, 48,123, 0, 0, 0, 0, 0, 0, 0,127, 0, 0, 0, /* 0x 700 */ + 78, 50, 66, 70, 65, 83, 49, 49, 0, 0, 0, 0, 78, 50, 66, 68, /* 0x 710 */ + 69, 67, 50, 48,132, 0, 0, 0, 78, 50, 66, 83, 77, 65, 51, 48, /* 0x 720 */ +145, 0, 0, 0, 0, 0, 0, 0,158, 0, 0, 0, 78, 50, 66, 68, /* 0x 730 */ + 69, 67, 50, 48, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 51, 48, /* 0x 740 */ +158, 0, 0, 0, 0, 0, 0, 0,162, 0, 0, 0, 78, 50, 66, 68, /* 0x 750 */ + 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0,173, 0, 0, 0, /* 0x 760 */ + 78, 50, 66, 68, 69, 67, 50, 48, 0, 0, 0, 0, 78, 50, 66, 68, /* 0x 770 */ + 69, 67, 51, 48,173, 0, 0, 0, 0, 0, 0, 0,191, 0, 0, 0, /* 0x 780 */ + 78, 50, 66, 68, 69, 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 790 */ +221, 0, 0, 0, 78, 50, 66, 68, 69, 67, 53, 48, 0, 0, 0, 0, /* 0x 7a0 */ + 78, 50, 66, 83, 77, 65, 52, 48,235, 0, 0, 0, 0, 0, 0, 0, /* 0x 7b0 */ +248, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 49, 0, 0, 0, /* 0x 7c0 */ + 78, 50, 66, 70, 65, 83, 52, 48,248, 0, 0, 0, 0, 0, 0, 0, /* 0x 7d0 */ +252, 0, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, 49, 0, 0, 0, /* 0x 7e0 */ + 0, 0, 0, 0, 7, 1, 0, 0, 78, 50, 66, 68, 69, 67, 51, 48, /* 0x 7f0 */ + 49, 0, 0, 0, 78, 50, 66, 68, 85, 77, 77, 49, 7, 1, 0, 0, /* 0x 800 */ + 78, 50, 66, 83, 77, 65, 53, 48, 7, 1, 0, 0, 78, 50, 66, 70, /* 0x 810 */ + 65, 83, 53, 48, 9, 1, 0, 0, 78, 50, 66, 68, 69, 67, 53, 48, /* 0x 820 */ + 12, 1, 0, 0, 78, 50, 66, 83, 77, 65, 54, 48, 21, 1, 0, 0, /* 0x 830 */ + 0, 0, 0, 0, 33, 1, 0, 0, 78, 50, 66, 68, 69, 67, 49, 48, /* 0x 840 */ + 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 54, 48, 33, 1, 0, 0, /* 0x 850 */ + 0, 0, 0, 0, 44, 1, 0, 0, 78, 50, 66, 70, 65, 83, 54, 49, /* 0x 860 */ + 0, 0, 0, 0, 0, 0, 0, 0, 58, 1, 0, 0, 78, 50, 66, 68, /* 0x 870 */ + 69, 67, 49, 48, 0, 0, 0, 0, 78, 50, 66, 70, 65, 83, 54, 49, /* 0x 880 */ + 58, 1, 0, 0, 0, 0, 0, 0, 80, 1, 0, 0, 78, 50, 66, 68, /* 0x 890 */ + 69, 67, 49, 48, 0, 0, 0, 0, 78, 50, 66, 68, 69, 67, 54, 48, /* 0x 8a0 */ + 80, 1, 0, 0, 78, 82, 86, 50, 66, 69, 78, 68, 80, 1, 0, 0, /* 0x 8b0 */ + 78, 50, 68, 83, 77, 65, 49, 48, 80, 1, 0, 0, 0, 0, 0, 0, /* 0x 8c0 */ + 82, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 4, 0, 0, 0, /* 0x 8d0 */ + 78, 50, 68, 70, 65, 83, 49, 48, 83, 1, 0, 0, 0, 0, 0, 0, /* 0x 8e0 */ + 85, 1, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, 4, 0, 0, 0, /* 0x 8f0 */ + 78, 50, 68, 70, 65, 83, 49, 49, 85, 1, 0, 0, 78, 50, 68, 68, /* 0x 900 */ + 69, 67, 49, 48, 91, 1, 0, 0, 78, 50, 68, 83, 77, 65, 50, 48, /* 0x 910 */ +102, 1, 0, 0, 0, 0, 0, 0,104, 1, 0, 0, 78, 50, 68, 83, /* 0x 920 */ + 77, 65, 49, 48, 2, 0, 0, 0, 78, 50, 68, 70, 65, 83, 50, 48, /* 0x 930 */ +107, 1, 0, 0, 0, 0, 0, 0,111, 1, 0, 0, 78, 50, 68, 70, /* 0x 940 */ + 65, 83, 49, 49, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 50, 48, /* 0x 950 */ +116, 1, 0, 0, 78, 50, 68, 83, 77, 65, 51, 48,129, 1, 0, 0, /* 0x 960 */ + 0, 0, 0, 0,142, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x 970 */ + 16, 0, 0, 0, 78, 50, 68, 70, 65, 83, 51, 48,142, 1, 0, 0, /* 0x 980 */ + 0, 0, 0, 0,148, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x 990 */ + 16, 0, 0, 0, 0, 0, 0, 0,157, 1, 0, 0, 78, 50, 68, 68, /* 0x 9a0 */ + 69, 67, 51, 48, 16, 0, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x 9b0 */ +157, 1, 0, 0, 0, 0, 0, 0,173, 1, 0, 0, 78, 50, 68, 68, /* 0x 9c0 */ + 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0,191, 1, 0, 0, /* 0x 9d0 */ + 78, 50, 68, 68, 69, 67, 54, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 9e0 */ +225, 1, 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, 0, 0, 0, 0, /* 0x 9f0 */ + 78, 50, 68, 83, 77, 65, 52, 48,239, 1, 0, 0, 0, 0, 0, 0, /* 0x a00 */ +252, 1, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 69, 0, 0, 0, /* 0x a10 */ + 78, 50, 68, 70, 65, 83, 52, 48,252, 1, 0, 0, 0, 0, 0, 0, /* 0x a20 */ + 0, 2, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, 69, 0, 0, 0, /* 0x a30 */ + 0, 0, 0, 0, 11, 2, 0, 0, 78, 50, 68, 68, 69, 67, 51, 48, /* 0x a40 */ + 69, 0, 0, 0, 78, 50, 68, 68, 85, 77, 77, 49, 11, 2, 0, 0, /* 0x a50 */ + 78, 50, 68, 83, 77, 65, 53, 48, 11, 2, 0, 0, 78, 50, 68, 70, /* 0x a60 */ + 65, 83, 53, 48, 13, 2, 0, 0, 78, 50, 68, 68, 69, 67, 53, 48, /* 0x a70 */ + 16, 2, 0, 0, 78, 50, 68, 83, 77, 65, 54, 48, 25, 2, 0, 0, /* 0x a80 */ + 0, 0, 0, 0, 37, 2, 0, 0, 78, 50, 68, 68, 69, 67, 49, 48, /* 0x a90 */ + 0, 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 48, 37, 2, 0, 0, /* 0x aa0 */ + 0, 0, 0, 0, 48, 2, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, /* 0x ab0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 62, 2, 0, 0, 78, 50, 68, 68, /* 0x ac0 */ + 69, 67, 49, 48, 0, 0, 0, 0, 78, 50, 68, 70, 65, 83, 54, 49, /* 0x ad0 */ + 62, 2, 0, 0, 0, 0, 0, 0, 84, 2, 0, 0, 78, 50, 68, 68, /* 0x ae0 */ + 69, 67, 49, 48, 0, 0, 0, 0, 78, 50, 68, 68, 69, 67, 54, 48, /* 0x af0 */ + 84, 2, 0, 0, 78, 82, 86, 50, 68, 69, 78, 68, 84, 2, 0, 0, /* 0x b00 */ + 78, 50, 69, 83, 77, 65, 49, 48, 84, 2, 0, 0, 0, 0, 0, 0, /* 0x b10 */ + 86, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 4, 0, 0, 0, /* 0x b20 */ + 78, 50, 69, 70, 65, 83, 49, 48, 87, 2, 0, 0, 0, 0, 0, 0, /* 0x b30 */ + 89, 2, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, 4, 0, 0, 0, /* 0x b40 */ + 78, 50, 69, 70, 65, 83, 49, 49, 89, 2, 0, 0, 78, 50, 69, 68, /* 0x b50 */ + 69, 67, 49, 48, 95, 2, 0, 0, 78, 50, 69, 83, 77, 65, 50, 48, /* 0x b60 */ +106, 2, 0, 0, 0, 0, 0, 0,108, 2, 0, 0, 78, 50, 69, 83, /* 0x b70 */ + 77, 65, 49, 48, 2, 0, 0, 0, 78, 50, 69, 70, 65, 83, 50, 48, /* 0x b80 */ +111, 2, 0, 0, 0, 0, 0, 0,115, 2, 0, 0, 78, 50, 69, 70, /* 0x b90 */ + 65, 83, 49, 49, 0, 0, 0, 0, 78, 50, 69, 68, 69, 67, 50, 48, /* 0x ba0 */ +120, 2, 0, 0, 78, 50, 69, 83, 77, 65, 51, 48,133, 2, 0, 0, /* 0x bb0 */ + 0, 0, 0, 0,146, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, /* 0x bc0 */ + 31, 0, 0, 0, 78, 50, 69, 70, 65, 83, 51, 48,146, 2, 0, 0, /* 0x bd0 */ + 0, 0, 0, 0,152, 2, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, /* 0x be0 */ + 31, 0, 0, 0, 0, 0, 0, 0,161, 2, 0, 0, 78, 50, 69, 68, /* 0x bf0 */ + 69, 67, 51, 48, 31, 0, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, /* 0x c00 */ +161, 2, 0, 0, 0, 0, 0, 0,177, 2, 0, 0, 78, 50, 69, 68, /* 0x c10 */ + 69, 67, 50, 48, 0, 0, 0, 0, 0, 0, 0, 0,192, 2, 0, 0, /* 0x c20 */ + 78, 50, 69, 68, 69, 67, 53, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x c30 */ +210, 2, 0, 0, 78, 50, 69, 68, 69, 67, 54, 48, 0, 0, 0, 0, /* 0x c40 */ + 78, 50, 69, 83, 77, 65, 52, 48, 0, 3, 0, 0, 0, 0, 0, 0, /* 0x c50 */ + 13, 3, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 82, 0, 0, 0, /* 0x c60 */ + 78, 50, 69, 70, 65, 83, 52, 48, 13, 3, 0, 0, 0, 0, 0, 0, /* 0x c70 */ + 17, 3, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, 82, 0, 0, 0, /* 0x c80 */ + 0, 0, 0, 0, 28, 3, 0, 0, 78, 50, 69, 68, 69, 67, 51, 48, /* 0x c90 */ + 82, 0, 0, 0, 78, 50, 69, 68, 85, 77, 77, 49, 28, 3, 0, 0, /* 0x ca0 */ + 78, 50, 69, 83, 77, 65, 53, 48, 28, 3, 0, 0, 78, 50, 69, 70, /* 0x cb0 */ + 65, 83, 53, 48, 30, 3, 0, 0, 78, 50, 69, 68, 69, 67, 53, 48, /* 0x cc0 */ + 33, 3, 0, 0, 78, 50, 69, 83, 77, 65, 54, 48, 42, 3, 0, 0, /* 0x cd0 */ + 0, 0, 0, 0, 54, 3, 0, 0, 78, 50, 69, 68, 69, 67, 49, 48, /* 0x ce0 */ + 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, 48, 54, 3, 0, 0, /* 0x cf0 */ + 0, 0, 0, 0, 65, 3, 0, 0, 78, 50, 69, 70, 65, 83, 54, 49, /* 0x d00 */ + 0, 0, 0, 0, 0, 0, 0, 0, 79, 3, 0, 0, 78, 50, 69, 68, /* 0x d10 */ + 69, 67, 49, 48, 0, 0, 0, 0, 78, 50, 69, 70, 65, 83, 54, 49, /* 0x d20 */ + 79, 3, 0, 0, 0, 0, 0, 0,101, 3, 0, 0, 78, 50, 69, 68, /* 0x d30 */ + 69, 67, 49, 48, 0, 0, 0, 0, 78, 50, 69, 68, 69, 67, 54, 48, /* 0x d40 */ +101, 3, 0, 0, 78, 82, 86, 50, 69, 69, 78, 68,101, 3, 0, 0, /* 0x d50 */ + 67, 76, 49, 83, 77, 65, 49, 66,101, 3, 0, 0, 67, 76, 49, 70, /* 0x d60 */ + 65, 83, 49, 66,103, 3, 0, 0, 67, 76, 49, 71, 69, 84, 49, 66, /* 0x d70 */ +109, 3, 0, 0, 67, 76, 49, 69, 78, 84, 69, 82,109, 3, 0, 0, /* 0x d80 */ + 0, 0, 0, 0,115, 3, 0, 0, 67, 76, 49, 83, 84, 65, 82, 84, /* 0x d90 */ + 0, 0, 0, 0, 67, 76, 49, 83, 77, 65, 49, 48,115, 3, 0, 0, /* 0x da0 */ + 0, 0, 0, 0,119, 3, 0, 0, 67, 76, 49, 82, 76, 79, 65, 68, /* 0x db0 */ + 0, 0, 0, 0, 67, 76, 49, 82, 76, 79, 65, 68,120, 3, 0, 0, /* 0x dc0 */ + 67, 76, 49, 87, 73, 68, 48, 49,128, 3, 0, 0, 67, 76, 49, 87, /* 0x dd0 */ + 73, 68, 48, 50,130, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 51, /* 0x de0 */ +132, 3, 0, 0, 0, 0, 0, 0,134, 3, 0, 0, 67, 76, 49, 87, /* 0x df0 */ + 73, 68, 49, 48, 12, 0, 0, 0, 67, 76, 49, 87, 73, 68, 48, 52, /* 0x e00 */ +134, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 53,136, 3, 0, 0, /* 0x e10 */ + 0, 0, 0, 0,138, 3, 0, 0, 67, 76, 49, 87, 73, 68, 49, 48, /* 0x e20 */ + 7, 0, 0, 0, 67, 76, 49, 87, 73, 68, 48, 54,138, 3, 0, 0, /* 0x e30 */ + 67, 76, 49, 87, 73, 68, 48, 55,140, 3, 0, 0, 67, 76, 49, 87, /* 0x e40 */ + 73, 68, 48, 56,143, 3, 0, 0, 0, 0, 0, 0,150, 3, 0, 0, /* 0x e50 */ + 67, 76, 49, 87, 73, 68, 48, 54, 2, 0, 0, 0, 0, 0, 0, 0, /* 0x e60 */ +160, 3, 0, 0, 67, 76, 49, 87, 73, 68, 49, 48, 15, 0, 0, 0, /* 0x e70 */ + 0, 0, 0, 0,169, 3, 0, 0, 67, 76, 49, 67, 79, 80, 89, 48, /* 0x e80 */ + 18, 0, 0, 0, 67, 76, 49, 87, 73, 68, 48, 57,169, 3, 0, 0, /* 0x e90 */ + 67, 76, 49, 87, 73, 68, 49, 48,171, 3, 0, 0, 0, 0, 0, 0, /* 0x ea0 */ +178, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 55, 2, 0, 0, 0, /* 0x eb0 */ + 0, 0, 0, 0,182, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 56, /* 0x ec0 */ + 26, 0, 0, 0, 0, 0, 0, 0,188, 3, 0, 0, 67, 76, 49, 84, /* 0x ed0 */ + 79, 80, 48, 55, 2, 0, 0, 0, 67, 76, 49, 83, 84, 65, 82, 84, /* 0x ee0 */ +188, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 48,193, 3, 0, 0, /* 0x ef0 */ + 67, 76, 49, 84, 79, 80, 48, 49,196, 3, 0, 0, 0, 0, 0, 0, /* 0x f00 */ +198, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 55, 23, 0, 0, 0, /* 0x f10 */ + 67, 76, 49, 84, 79, 80, 48, 50,198, 3, 0, 0, 0, 0, 0, 0, /* 0x f20 */ +200, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 55, 22, 0, 0, 0, /* 0x f30 */ + 67, 76, 49, 84, 79, 80, 48, 51,200, 3, 0, 0, 0, 0, 0, 0, /* 0x f40 */ +202, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 55, 21, 0, 0, 0, /* 0x f50 */ + 67, 76, 49, 84, 79, 80, 48, 52,202, 3, 0, 0, 0, 0, 0, 0, /* 0x f60 */ +204, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 55, 20, 0, 0, 0, /* 0x f70 */ + 67, 76, 49, 84, 79, 80, 48, 53,207, 3, 0, 0, 0, 0, 0, 0, /* 0x f80 */ +209, 3, 0, 0, 67, 76, 49, 84, 79, 80, 48, 54, 7, 0, 0, 0, /* 0x f90 */ + 67, 76, 49, 84, 79, 80, 48, 54,210, 3, 0, 0, 0, 0, 0, 0, /* 0x fa0 */ +217, 3, 0, 0, 67, 76, 49, 87, 73, 68, 48, 49, 0, 0, 0, 0, /* 0x fb0 */ + 67, 76, 49, 84, 79, 80, 48, 55,217, 3, 0, 0, 67, 76, 49, 79, /* 0x fc0 */ + 70, 70, 48, 49,240, 3, 0, 0, 67, 76, 49, 79, 70, 70, 48, 50, /* 0x fd0 */ +242, 3, 0, 0, 0, 0, 0, 0,244, 3, 0, 0, 67, 76, 49, 84, /* 0x fe0 */ + 79, 80, 48, 55, 23, 0, 0, 0, 0, 0, 0, 0, 2, 4, 0, 0, /* 0x ff0 */ + 67, 76, 49, 67, 79, 80, 89, 48, 51, 0, 0, 0, 67, 76, 49, 79, /* 0x1000 */ + 70, 70, 48, 51, 4, 4, 0, 0, 67, 76, 49, 79, 70, 70, 48, 52, /* 0x1010 */ + 6, 4, 0, 0, 0, 0, 0, 0, 10, 4, 0, 0, 67, 76, 49, 67, /* 0x1020 */ + 79, 80, 89, 48, 0, 0, 0, 0, 67, 76, 49, 76, 69, 78, 48, 48, /* 0x1030 */ + 10, 4, 0, 0, 67, 76, 49, 76, 69, 78, 48, 49, 11, 4, 0, 0, /* 0x1040 */ + 67, 76, 49, 76, 69, 78, 48, 50, 13, 4, 0, 0, 0, 0, 0, 0, /* 0x1050 */ + 15, 4, 0, 0, 67, 76, 49, 76, 69, 78, 48, 48, 1, 0, 0, 0, /* 0x1060 */ + 67, 76, 49, 67, 79, 80, 89, 48, 18, 4, 0, 0, 0, 0, 0, 0, /* 0x1070 */ + 55, 4, 0, 0, 67, 76, 49, 84, 79, 80, 48, 48, 0, 0, 0, 0, /* 0x1080 */ + 76, 88, 80, 84, 73, 48, 57, 48, 69, 4, 0, 0, 0, 0, 0, 0, /* 0x1090 */ + 74, 4, 0, 0, 76, 88, 80, 84, 73, 48, 57, 49, 0, 0, 0, 0, /* 0x10a0 */ + 76, 88, 80, 84, 73, 48, 57, 49, 74, 4, 0, 0, 67, 65, 76, 76, /* 0x10b0 */ + 84, 82, 48, 48,103, 4, 0, 0, 67, 84, 67, 76, 69, 86, 69, 49, /* 0x10c0 */ +117, 4, 0, 0, 0, 0, 0, 0,122, 4, 0, 0, 67, 65, 76, 76, /* 0x10d0 */ + 84, 82, 48, 48, 5, 0, 0, 0, 67, 65, 76, 76, 84, 82, 48, 49, /* 0x10e0 */ +122, 4, 0, 0, 67, 84, 68, 85, 77, 77, 89, 49,127, 4, 0, 0, /* 0x10f0 */ + 67, 84, 66, 83, 72, 82, 48, 49,127, 4, 0, 0, 67, 84, 66, 82, /* 0x1100 */ + 79, 82, 48, 49,131, 4, 0, 0, 67, 84, 66, 83, 87, 65, 48, 49, /* 0x1110 */ +133, 4, 0, 0, 67, 65, 76, 76, 84, 82, 48, 50,138, 4, 0, 0, /* 0x1120 */ + 0, 0, 0, 0,152, 4, 0, 0, 67, 65, 76, 76, 84, 82, 48, 48, /* 0x1130 */ + 10, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48,152, 4, 0, 0, /* 0x1140 */ + 67, 65, 76, 76, 84, 82, 69, 56,157, 4, 0, 0, 67, 65, 76, 76, /* 0x1150 */ + 84, 82, 69, 57,159, 4, 0, 0, 67, 65, 76, 76, 84, 82, 49, 49, /* 0x1160 */ +161, 4, 0, 0, 0, 0, 0, 0,165, 4, 0, 0, 67, 65, 76, 76, /* 0x1170 */ + 84, 82, 49, 51, 5, 0, 0, 0, 67, 84, 67, 76, 69, 86, 69, 50, /* 0x1180 */ +165, 4, 0, 0, 0, 0, 0, 0,170, 4, 0, 0, 67, 65, 76, 76, /* 0x1190 */ + 84, 82, 49, 49, 0, 0, 0, 0, 67, 65, 76, 76, 84, 82, 49, 50, /* 0x11a0 */ +170, 4, 0, 0, 67, 84, 68, 85, 77, 77, 89, 50,172, 4, 0, 0, /* 0x11b0 */ + 67, 84, 66, 83, 72, 82, 49, 49,172, 4, 0, 0, 67, 84, 66, 82, /* 0x11c0 */ + 79, 82, 49, 49,176, 4, 0, 0, 67, 84, 66, 83, 87, 65, 49, 49, /* 0x11d0 */ +178, 4, 0, 0, 67, 65, 76, 76, 84, 82, 49, 51,183, 4, 0, 0, /* 0x11e0 */ + 0, 0, 0, 0,188, 4, 0, 0, 67, 65, 76, 76, 84, 82, 49, 48, /* 0x11f0 */ + 5, 0, 0, 0, 67, 84, 84, 72, 69, 69, 78, 68,188, 4, 0, 0, /* 0x1200 */ + 76, 88, 85, 78, 70, 48, 48, 48,188, 4, 0, 0, 0, 0, 0, 0, /* 0x1210 */ +190, 4, 0, 0, 76, 88, 85, 78, 70, 48, 49, 48, 5, 0, 0, 0, /* 0x1220 */ + 76, 88, 85, 78, 70, 48, 48, 50,190, 4, 0, 0, 77, 82, 85, 66, /* 0x1230 */ + 89, 84, 69, 48,195, 4, 0, 0, 76, 88, 77, 82, 85, 48, 48, 53, /* 0x1240 */ +197, 4, 0, 0, 76, 88, 77, 82, 85, 48, 48, 54,202, 4, 0, 0, /* 0x1250 */ + 76, 88, 77, 82, 85, 48, 48, 55,209, 4, 0, 0, 76, 88, 85, 78, /* 0x1260 */ + 70, 48, 48, 56,216, 4, 0, 0, 76, 88, 85, 78, 70, 48, 49, 48, /* 0x1270 */ +220, 4, 0, 0, 0, 0, 0, 0,225, 4, 0, 0, 76, 88, 85, 78, /* 0x1280 */ + 70, 48, 52, 50, 0, 0, 0, 0, 76, 88, 74, 67, 67, 48, 49, 48, /* 0x1290 */ +225, 4, 0, 0, 76, 88, 77, 82, 85, 48, 52, 53,228, 4, 0, 0, /* 0x12a0 */ + 76, 88, 77, 82, 85, 48, 52, 54,231, 4, 0, 0, 76, 88, 74, 67, /* 0x12b0 */ + 67, 48, 50, 48,233, 4, 0, 0, 0, 0, 0, 0,235, 4, 0, 0, /* 0x12c0 */ + 76, 88, 85, 78, 70, 48, 51, 52, 0, 0, 0, 0, 76, 88, 74, 67, /* 0x12d0 */ + 67, 48, 50, 49,235, 4, 0, 0, 0, 0, 0, 0,240, 4, 0, 0, /* 0x12e0 */ + 76, 88, 85, 78, 70, 48, 51, 52, 0, 0, 0, 0, 76, 88, 74, 67, /* 0x12f0 */ + 67, 48, 50, 51,240, 4, 0, 0, 76, 88, 85, 78, 70, 48, 51, 55, /* 0x1300 */ +247, 4, 0, 0, 76, 88, 85, 78, 70, 51, 56, 54,249, 4, 0, 0, /* 0x1310 */ + 76, 88, 85, 78, 70, 51, 56, 55,250, 4, 0, 0, 76, 88, 85, 78, /* 0x1320 */ + 70, 51, 56, 56, 3, 5, 0, 0, 0, 0, 0, 0, 6, 5, 0, 0, /* 0x1330 */ + 76, 88, 85, 78, 70, 48, 52, 48, 0, 0, 0, 0, 76, 88, 85, 78, /* 0x1340 */ + 70, 52, 56, 54, 6, 5, 0, 0, 76, 88, 85, 78, 70, 52, 56, 55, /* 0x1350 */ + 10, 5, 0, 0, 0, 0, 0, 0, 12, 5, 0, 0, 76, 88, 85, 78, /* 0x1360 */ + 70, 48, 52, 48, 0, 0, 0, 0, 76, 88, 77, 82, 85, 48, 54, 53, /* 0x1370 */ + 12, 5, 0, 0, 0, 0, 0, 0, 16, 5, 0, 0, 76, 88, 77, 82, /* 0x1380 */ + 85, 48, 55, 48, 5, 0, 0, 0, 77, 82, 85, 66, 89, 84, 69, 51, /* 0x1390 */ + 16, 5, 0, 0, 77, 82, 85, 65, 82, 66, 51, 48, 18, 5, 0, 0, /* 0x13a0 */ + 77, 82, 85, 66, 73, 84, 83, 51, 19, 5, 0, 0, 77, 82, 85, 65, /* 0x13b0 */ + 82, 66, 52, 48, 21, 5, 0, 0, 76, 88, 77, 82, 85, 48, 55, 48, /* 0x13c0 */ + 25, 5, 0, 0, 0, 0, 0, 0, 30, 5, 0, 0, 76, 88, 85, 78, /* 0x13d0 */ + 70, 48, 52, 48, 0, 0, 0, 0, 77, 82, 85, 66, 89, 84, 69, 52, /* 0x13e0 */ + 33, 5, 0, 0, 77, 82, 85, 66, 73, 84, 83, 52, 36, 5, 0, 0, /* 0x13f0 */ + 77, 82, 85, 65, 82, 66, 53, 48, 38, 5, 0, 0, 76, 88, 77, 82, /* 0x1400 */ + 85, 48, 56, 48, 44, 5, 0, 0, 77, 82, 85, 66, 89, 84, 69, 53, /* 0x1410 */ + 47, 5, 0, 0, 77, 82, 85, 65, 82, 66, 54, 48, 49, 5, 0, 0, /* 0x1420 */ + 77, 82, 85, 66, 73, 84, 83, 53, 50, 5, 0, 0, 77, 82, 85, 65, /* 0x1430 */ + 82, 66, 55, 48, 52, 5, 0, 0, 76, 88, 77, 82, 85, 48, 57, 48, /* 0x1440 */ + 56, 5, 0, 0, 0, 0, 0, 0, 63, 5, 0, 0, 76, 88, 77, 82, /* 0x1450 */ + 85, 49, 48, 48, 10, 0, 0, 0, 77, 82, 85, 66, 89, 84, 69, 54, /* 0x1460 */ + 67, 5, 0, 0, 77, 82, 85, 65, 82, 66, 56, 48, 69, 5, 0, 0, /* 0x1470 */ + 77, 82, 85, 66, 73, 84, 83, 54, 70, 5, 0, 0, 77, 82, 85, 65, /* 0x1480 */ + 82, 66, 57, 48, 72, 5, 0, 0, 76, 88, 77, 82, 85, 49, 48, 48, /* 0x1490 */ + 76, 5, 0, 0, 76, 88, 85, 78, 70, 48, 52, 48, 92, 5, 0, 0, /* 0x14a0 */ + 76, 88, 77, 82, 85, 49, 49, 48, 97, 5, 0, 0, 76, 88, 77, 82, /* 0x14b0 */ + 85, 49, 49, 49,100, 5, 0, 0, 76, 88, 85, 78, 70, 48, 52, 49, /* 0x14c0 */ +102, 5, 0, 0, 0, 0, 0, 0,109, 5, 0, 0, 76, 88, 85, 78, /* 0x14d0 */ + 70, 48, 51, 52, 0, 0, 0, 0, 76, 88, 85, 78, 70, 48, 52, 50, /* 0x14e0 */ +109, 5, 0, 0, 76, 69, 88, 69, 67, 48, 49, 54,109, 5, 0, 0, /* 0x14f0 */ + 0, 0, 0, 0,111, 5, 0, 0, 76, 88, 85, 78, 70, 48, 52, 50, /* 0x1500 */ + 0, 0, 0, 0, 76, 88, 77, 82, 85, 48, 49, 48,111, 5, 0, 0, /* 0x1510 */ + 76, 88, 74, 77, 80, 65, 48, 48,112, 5, 0, 0, 76, 88, 67, 65, /* 0x1520 */ + 76, 76, 66, 48,114, 5, 0, 0, 76, 88, 85, 78, 70, 48, 50, 49, /* 0x1530 */ +116, 5, 0, 0, 76, 88, 77, 82, 85, 48, 50, 50,122, 5, 0, 0, /* 0x1540 */ + 76, 88, 74, 77, 80, 65, 48, 49,125, 5, 0, 0, 76, 88, 67, 65, /* 0x1550 */ + 76, 76, 66, 49,127, 5, 0, 0, 77, 82, 85, 66, 73, 84, 83, 49, /* 0x1560 */ +129, 5, 0, 0, 76, 88, 77, 82, 85, 48, 51, 48,130, 5, 0, 0, /* 0x1570 */ + 77, 82, 85, 66, 89, 84, 69, 49,132, 5, 0, 0, 77, 82, 85, 65, /* 0x1580 */ + 82, 66, 49, 48,134, 5, 0, 0, 76, 88, 77, 82, 85, 48, 52, 48, /* 0x1590 */ +135, 5, 0, 0, 0, 0, 0, 0,137, 5, 0, 0, 76, 88, 77, 82, /* 0x15a0 */ + 85, 48, 51, 48, 0, 0, 0, 0, 76, 88, 85, 78, 70, 48, 51, 48, /* 0x15b0 */ +137, 5, 0, 0, 76, 88, 74, 67, 67, 48, 48, 48,143, 5, 0, 0, /* 0x15c0 */ + 0, 0, 0, 0,151, 5, 0, 0, 76, 88, 74, 67, 67, 48, 49, 48, /* 0x15d0 */ + 0, 0, 0, 0, 76, 88, 67, 74, 48, 77, 82, 85,151, 5, 0, 0, /* 0x15e0 */ + 76, 88, 67, 74, 49, 77, 82, 85,153, 5, 0, 0, 76, 88, 67, 65, /* 0x15f0 */ + 76, 74, 77, 80,156, 5, 0, 0, 76, 88, 67, 65, 76, 76, 48, 48, /* 0x1600 */ +159, 5, 0, 0, 0, 0, 0, 0,161, 5, 0, 0, 76, 88, 85, 78, /* 0x1610 */ + 70, 48, 51, 55, 0, 0, 0, 0, 76, 88, 67, 65, 76, 76, 48, 49, /* 0x1620 */ +161, 5, 0, 0, 76, 88, 67, 74, 50, 77, 82, 85,164, 5, 0, 0, /* 0x1630 */ + 0, 0, 0, 0,166, 5, 0, 0, 76, 88, 85, 78, 70, 48, 51, 55, /* 0x1640 */ + 0, 0, 0, 0, 76, 88, 67, 74, 52, 77, 82, 85,166, 5, 0, 0, /* 0x1650 */ + 0, 0, 0, 0,168, 5, 0, 0, 76, 88, 85, 78, 70, 48, 51, 52, /* 0x1660 */ + 0, 0, 0, 0, 76, 88, 67, 74, 54, 77, 82, 85,168, 5, 0, 0, /* 0x1670 */ + 0, 0, 0, 0,170, 5, 0, 0, 76, 88, 67, 74, 56, 77, 82, 85, /* 0x1680 */ + 1, 0, 0, 0, 76, 88, 67, 74, 55, 77, 82, 85,170, 5, 0, 0, /* 0x1690 */ + 0, 0, 0, 0,172, 5, 0, 0, 76, 88, 67, 74, 56, 77, 82, 85, /* 0x16a0 */ + 1, 0, 0, 0, 76, 88, 67, 74, 56, 77, 82, 85,172, 5, 0, 0, /* 0x16b0 */ + 0, 0, 0, 0,175, 5, 0, 0, 76, 88, 85, 78, 70, 48, 51, 55, /* 0x16c0 */ + 0, 0, 0, 0, 76, 88, 85, 78, 70, 48, 51, 52,175, 5, 0, 0, /* 0x16d0 */ + 0, 0, 0, 0,180, 5, 0, 0, 76, 88, 85, 78, 70, 48, 51, 48, /* 0x16e0 */ + 0, 0, 0, 0, 76, 88, 77, 82, 85, 48, 53, 53,180, 5, 0, 0, /* 0x16f0 */ + 77, 82, 85, 66, 89, 84, 69, 50,182, 5, 0, 0, 77, 82, 85, 66, /* 0x1700 */ + 73, 84, 83, 50,187, 5, 0, 0, 77, 82, 85, 65, 82, 66, 50, 48, /* 0x1710 */ +192, 5, 0, 0, 76, 88, 77, 82, 85, 48, 53, 55,197, 5, 0, 0, /* 0x1720 */ + 76, 88, 77, 82, 85, 48, 53, 56,203, 5, 0, 0, 76, 88, 85, 78, /* 0x1730 */ + 70, 48, 51, 53,204, 5, 0, 0, 76, 88, 80, 84, 73, 49, 52, 48, /* 0x1740 */ +210, 5, 0, 0, 76, 88, 80, 84, 73, 49, 52, 49,210, 5, 0, 0, /* 0x1750 */ + 76, 88, 80, 84, 73, 49, 53, 48,210, 5, 0, 0, 67, 75, 76, 76, /* 0x1760 */ + 84, 82, 48, 48,223, 5, 0, 0, 0, 0, 0, 0,227, 5, 0, 0, /* 0x1770 */ + 67, 75, 76, 76, 84, 82, 50, 48, 30, 0, 0, 0, 67, 75, 76, 76, /* 0x1780 */ + 84, 82, 49, 48,232, 5, 0, 0, 0, 0, 0, 0,246, 5, 0, 0, /* 0x1790 */ + 67, 75, 76, 76, 84, 82, 50, 48, 6, 0, 0, 0, 67, 75, 76, 76, /* 0x17a0 */ + 84, 82, 50, 48,246, 5, 0, 0, 0, 0, 0, 0,252, 5, 0, 0, /* 0x17b0 */ + 67, 75, 76, 76, 84, 82, 52, 48, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x17c0 */ + 0, 6, 0, 0, 67, 75, 76, 76, 84, 82, 52, 48, 0, 0, 0, 0, /* 0x17d0 */ + 67, 75, 76, 76, 84, 82, 51, 48, 23, 6, 0, 0, 0, 0, 0, 0, /* 0x17e0 */ + 30, 6, 0, 0, 67, 75, 76, 76, 84, 82, 49, 48, 14, 0, 0, 0, /* 0x17f0 */ + 67, 75, 76, 76, 84, 82, 52, 48, 30, 6, 0, 0, 0, 0, 0, 0, /* 0x1800 */ + 35, 6, 0, 0, 67, 75, 76, 76, 84, 82, 48, 48, 4, 0, 0, 0, /* 0x1810 */ + 76, 88, 80, 84, 73, 49, 54, 48, 35, 6, 0, 0, 76, 88, 80, 84, /* 0x1820 */ + 73, 50, 48, 48, 37, 6, 0, 0, 88, 84, 72, 69, 69, 78, 68, 88, /* 0x1830 */ + 37, 6, 0, 0,255,255,255,255, 37, 6 /* 0x1840 */ +}; diff --git a/src/stub/l_lx_pti86.lds b/src/stub/l_lx_pti86.lds new file mode 100644 index 00000000..e03b1047 --- /dev/null +++ b/src/stub/l_lx_pti86.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 +}