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

PackLinuxElf32ppc conversion; alignment in *::Section

This commit is contained in:
John Reiser 2006-07-16 15:04:16 -07:00
parent 755d990dfd
commit b34e204676
13 changed files with 456 additions and 257 deletions

View File

@ -71,6 +71,7 @@ struct DefaultLinker::Section
int istart; int istart;
int ostart; int ostart;
int len; int len;
unsigned char align;
DefaultLinker::Label name; DefaultLinker::Label name;
}; };
@ -196,13 +197,14 @@ int DefaultLinker::addSection(const char *sname)
} }
void DefaultLinker::addSection(const char *sname, const void *sdata, int slen) void DefaultLinker::addSection(const char *sname, const void *sdata, int slen, int align)
{ {
assert(!frozen); assert(!frozen);
// add a new section - can be used for adding stuff like ident or header // add a new section - can be used for adding stuff like ident or header
sections[nsections].name.set(sname); sections[nsections].name.set(sname);
sections[nsections].istart = ilen; sections[nsections].istart = ilen;
sections[nsections].len = slen; sections[nsections].len = slen;
sections[nsections].align = align;
sections[nsections++].ostart = olen; sections[nsections++].ostart = olen;
assert(nsections < NSECTIONS); assert(nsections < NSECTIONS);
memcpy(iloader+ilen, sdata, slen); memcpy(iloader+ilen, sdata, slen);
@ -314,10 +316,10 @@ int SimpleLinker::addSection(const char *sname)
} }
void SimpleLinker::addSection(const char *sname, const void *sdata, int slen) void SimpleLinker::addSection(const char *sname, const void *sdata, int slen, int align)
{ {
assert(!frozen); assert(!frozen);
UNUSED(sname); UNUSED(sdata); UNUSED(slen); UNUSED(sname); UNUSED(sdata); UNUSED(slen); UNUSED(align);
assert(0); assert(0);
} }
@ -350,8 +352,8 @@ unsigned char *SimpleLinker::getLoader(int *llen)
// //
**************************************************************************/ **************************************************************************/
ElfLinker::Section::Section(const char *n, const void *i, unsigned s) : ElfLinker::Section::Section(const char *n, const void *i, unsigned s, unsigned a) :
name(strdup(n)), output(NULL), size(s), offset(0), next(NULL) name(strdup(n)), output(NULL), size(s), offset(0), align(a), next(NULL)
{ {
assert(name); assert(name);
input = malloc(s + 1); input = malloc(s + 1);
@ -388,24 +390,24 @@ void ElfLinker::preprocessSections(char *start, const char *end)
while (start < end) while (start < end)
{ {
char name[1024]; char name[1024];
unsigned offset, size; unsigned offset, size, align;
char *nextl = strchr(start, '\n'); char *nextl = strchr(start, '\n');
assert(nextl != NULL); assert(nextl != NULL);
if (sscanf(start, "%*d %1023s %x %*d %*d %x", if (sscanf(start, "%*d %1023s %x %*d %*d %x 2**%d",
name, &size, &offset) == 3) name, &size, &offset, &align) == 4)
{ {
char *n = strstr(start, name); char *n = strstr(start, name);
n[strlen(name)] = 0; n[strlen(name)] = 0;
addSection(n, input + offset, size); addSection(n, input + offset, size, align);
//printf("section %s preprocessed\n", n); //printf("section %s preprocessed\n", n);
} }
start = nextl + 1; start = nextl + 1;
} }
addSection("*ABS*", NULL, 0); addSection("*ABS*", NULL, 0, 0);
addSection("*UND*", NULL, 0); addSection("*UND*", NULL, 0, 0);
} }
void ElfLinker::preprocessSymbols(char *start, const char *end) void ElfLinker::preprocessSymbols(char *start, const char *end)
@ -614,6 +616,15 @@ int ElfLinker::addSection(const char *sname)
else else
{ {
Section *section = findSection(sect); Section *section = findSection(sect);
if (section->align) {
unsigned const v = ~0u << section->align;
assert(tail);
if (unsigned const l = ~v & -(tail->offset + tail->size)) {
align(l);
tail->size += l;
outputlen += l;
}
}
memcpy(output + outputlen, section->input, section->size); memcpy(output + outputlen, section->input, section->size);
section->output = output + outputlen; section->output = output + outputlen;
outputlen += section->size; outputlen += section->size;
@ -634,13 +645,13 @@ int ElfLinker::addSection(const char *sname)
return outputlen; return outputlen;
} }
void ElfLinker::addSection(const char *sname, const void *sdata, int slen) void ElfLinker::addSection(const char *sname, const void *sdata, int slen, int align)
{ {
assert(!frozen); assert(!frozen);
sections = static_cast<Section **>(realloc(sections, (nsections + 1) sections = static_cast<Section **>(realloc(sections, (nsections + 1)
* sizeof(Section *))); * sizeof(Section *)));
assert(sections); assert(sections);
sections[nsections++] = new Section(sname, sdata, slen); sections[nsections++] = new Section(sname, sdata, slen, align);
} }
void ElfLinker::freeze() void ElfLinker::freeze()
@ -823,12 +834,25 @@ void ElfLinkerPpc32::relocate1(Relocation *rel, upx_byte *location,
// FIXME: more relocs // FIXME: more relocs
if (strcmp(type, "8") == 0) // Note that original (*location).displ is ignored.
*location += value; if (strcmp(type, "24") == 0) {
else if (strcmp(type, "16") == 0) if (3& value) {
set_le16(location, get_le16(location) + value); printf("unaligned word diplacement");
else if (strcmp(type, "32") == 0) abort();
set_le32(location, get_le32(location) + value); }
// FIXME: displacment overflow?
set_be32(location, (0xfc000003 & get_be32(location)) +
(0x03fffffc & (rel->add + value)));
}
else if (strcmp(type, "14") == 0) {
if (3& value) {
printf("unaligned word diplacement");
abort();
}
// FIXME: displacment overflow?
set_be32(location, (0xffff0003 & get_be32(location)) +
(0x0000fffc & (rel->add + value)));
}
else else
super::relocate1(rel, location, value, type); super::relocate1(rel, location, value, type);
} }

View File

@ -49,7 +49,7 @@ public:
virtual void init(const void *pdata, int plen, int pinfo) = 0; virtual void init(const void *pdata, int plen, int pinfo) = 0;
virtual void setLoaderAlignOffset(int phase) = 0; virtual void setLoaderAlignOffset(int phase) = 0;
virtual int addSection(const char *sname) = 0; virtual int addSection(const char *sname) = 0;
virtual void addSection(const char *sname, const void *sdata, int slen) = 0; virtual void addSection(const char *sname, const void *sdata, int slen, int align) = 0;
virtual void freeze() = 0; virtual void freeze() = 0;
virtual int getSection(const char *sname, int *slen=NULL) = 0; virtual int getSection(const char *sname, int *slen=NULL) = 0;
virtual unsigned char *getLoader(int *llen=NULL) = 0; virtual unsigned char *getLoader(int *llen=NULL) = 0;
@ -83,7 +83,7 @@ public:
virtual void init(const void *pdata, int plen, int pinfo); virtual void init(const void *pdata, int plen, int pinfo);
virtual void setLoaderAlignOffset(int phase); virtual void setLoaderAlignOffset(int phase);
virtual int addSection(const char *sname); virtual int addSection(const char *sname);
virtual void addSection(const char *sname, const void *sdata, int slen); virtual void addSection(const char *sname, const void *sdata, int slen, int align);
virtual void freeze(); virtual void freeze();
virtual int getSection(const char *sname, int *slen=NULL); virtual int getSection(const char *sname, int *slen=NULL);
virtual unsigned char *getLoader(int *llen=NULL); virtual unsigned char *getLoader(int *llen=NULL);
@ -130,7 +130,7 @@ public:
virtual void init(const void *pdata, int plen, int pinfo); virtual void init(const void *pdata, int plen, int pinfo);
virtual void setLoaderAlignOffset(int phase); virtual void setLoaderAlignOffset(int phase);
virtual int addSection(const char *sname); virtual int addSection(const char *sname);
virtual void addSection(const char *sname, const void *sdata, int slen); virtual void addSection(const char *sname, const void *sdata, int slen, int align);
virtual void freeze(); virtual void freeze();
virtual int getSection(const char *sname, int *slen=NULL); virtual int getSection(const char *sname, int *slen=NULL);
virtual unsigned char *getLoader(int *llen=NULL); virtual unsigned char *getLoader(int *llen=NULL);
@ -199,7 +199,7 @@ protected:
virtual void init(const void *pdata, int plen, int); virtual void init(const void *pdata, int plen, int);
virtual void setLoaderAlignOffset(int phase); virtual void setLoaderAlignOffset(int phase);
virtual int addSection(const char *sname); virtual int addSection(const char *sname);
virtual void addSection(const char *sname, const void *sdata, int slen); virtual void addSection(const char *sname, const void *sdata, int slen, int align);
virtual void freeze(); virtual void freeze();
virtual int getSection(const char *sname, int *slen=NULL); virtual int getSection(const char *sname, int *slen=NULL);
virtual upx_byte *getLoader(int *llen=NULL); virtual upx_byte *getLoader(int *llen=NULL);
@ -225,9 +225,10 @@ struct ElfLinker::Section : private nocopy
upx_byte *output; upx_byte *output;
unsigned size; unsigned size;
unsigned offset; unsigned offset;
unsigned char align; // log2
Section *next; Section *next;
Section(const char *n, const void *i, unsigned s); Section(const char *n, const void *i, unsigned s, unsigned a=0);
~Section(); ~Section();
}; };

View File

@ -390,6 +390,7 @@ void PackLinuxElf32x86::addStubEntrySections(Filter const *ft)
sizeof(p_info) + sizeof(p_info) +
// compressed data // compressed data
b_len + ph.c_len ); b_len + ph.c_len );
// entry to stub // entry to stub
addLoader("LEXEC000", NULL); addLoader("LEXEC000", NULL);
@ -510,7 +511,7 @@ PackLinuxElf32::buildLinuxLoader(
memcpy(cprLoader, &h, sizeof(h)); memcpy(cprLoader, &h, sizeof(h));
// This adds the definition to the "library", to be used later. // This adds the definition to the "library", to be used later.
linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + sz_cpr); linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + sz_cpr, 0);
delete [] cprLoader; delete [] cprLoader;
addStubEntrySections(ft); addStubEntrySections(ft);
@ -560,7 +561,7 @@ PackLinuxElf64::buildLinuxLoader(
memcpy(cprLoader, &h, sizeof(h)); memcpy(cprLoader, &h, sizeof(h));
// This adds the definition to the "library", to be used later. // This adds the definition to the "library", to be used later.
linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + sz_cpr); linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + sz_cpr, 0);
delete [] cprLoader; delete [] cprLoader;
addStubEntrySections(ft); addStubEntrySections(ft);
@ -814,6 +815,14 @@ void
PackLinuxElf32ppc::addStubEntrySections(Filter const *) PackLinuxElf32ppc::addStubEntrySections(Filter const *)
{ {
addLoader("ELFMAINX", NULL); addLoader("ELFMAINX", NULL);
//addLoader(getDecompressorSections(), NULL);
addLoader(
( M_IS_NRV2E(ph.method) ? "NRV_COMMON,NRV2E"
: M_IS_NRV2D(ph.method) ? "NRV_COMMON,NRV2D"
: M_IS_NRV2B(ph.method) ? "NRV_COMMON,NRV2B"
: M_IS_LZMA(ph.method) ? "LZMA_ELF00,LZMA_DEC20,LZMA_DEC30"
: NULL), NULL);
addLoader("ELFMAINY,IDENTSTR,ELFMAINZ,FOLDEXEC", NULL);
} }
void void

View File

@ -280,7 +280,7 @@ PackLinuxI386::buildLinuxLoader(
} }
// This adds the definition to the "library", to be used later. // This adds the definition to the "library", to be used later.
// NOTE: the stub is NOT compressed! The savings is not worth it. // NOTE: the stub is NOT compressed! The savings is not worth it.
linker->addSection("FOLDEXEC", fold + fold_hdrlen, szfold - fold_hdrlen); linker->addSection("FOLDEXEC", fold + fold_hdrlen, szfold - fold_hdrlen, 0);
n_mru = ft->n_mru; n_mru = ft->n_mru;

View File

@ -148,7 +148,7 @@ void PackLinuxElf32x86interp::pack3(OutputFile *fo, Filter &/*ft*/)
elfout.phdr[0].p_paddr = elfout.phdr[0].p_vaddr = base - sz; elfout.phdr[0].p_paddr = elfout.phdr[0].p_vaddr = base - sz;
if (opt->o_unix.make_ptinterp) { if (opt->o_unix.make_ptinterp) {
initLoader(linux_i386pti_loader, sizeof(linux_i386pti_loader)); initLoader(linux_i386pti_loader, sizeof(linux_i386pti_loader));
linker->addSection("FOLDEXEC", linux_i386pti_fold, sizeof(linux_i386pti_fold)); linker->addSection("FOLDEXEC", linux_i386pti_fold, sizeof(linux_i386pti_fold), 0);
addLoader("LXPTI000", NULL); addLoader("LXPTI000", NULL);

View File

@ -98,13 +98,13 @@ PackMachPPC32::buildMachLoader(
memcpy(cprLoader, &h, sizeof(h)); memcpy(cprLoader, &h, sizeof(h));
// This adds the definition to the "library", to be used later. // This adds the definition to the "library", to be used later.
linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + h.sz_cpr); linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + h.sz_cpr, 0);
delete [] cprLoader; delete [] cprLoader;
int const GAP = 128; // must match stub/l_mac_ppc.S int const GAP = 128; // must match stub/l_mac_ppc.S
segcmdo.vmsize += h.sz_unc - h.sz_cpr + GAP + 64; segcmdo.vmsize += h.sz_unc - h.sz_cpr + GAP + 64;
linker->addSection("MACOS000", proto, szproto); linker->addSection("MACOS000", proto, szproto, 0);
addLoader("MACOS000", NULL); addLoader("MACOS000", NULL);
addLoader("FOLDEXEC", NULL); addLoader("FOLDEXEC", NULL);

View File

@ -1069,7 +1069,7 @@ void Packer::initLoader(const void *pdata, int plen, int pinfo, int small)
unsigned size; unsigned size;
char const * const ident = getIdentstr(&size, small); char const * const ident = getIdentstr(&size, small);
linker->addSection("IDENTSTR", ident, size); linker->addSection("IDENTSTR", ident, size, 0);
} }

View File

@ -686,9 +686,11 @@ tc.powerpc-linux.elf.objdump = $(call tc,m-objdump)
tc.powerpc-linux.elf.objstrip = $(call tc,objcopy) -R .comment -R .note tc.powerpc-linux.elf.objstrip = $(call tc,objcopy) -R .comment -R .note
powerpc-linux.elf-entry.h : $(srcdir)/src/$$T.S powerpc-linux.elf-entry.h : $(srcdir)/src/$$T.S
$(call tc,gcc) -c $< -o tmp/$T.o $(call tc,gcc) -c $< -o tmp/$T.bin
$(call tc,objstrip) tmp/$T.o $(call tc,m-objcopy) --strip-unneeded tmp/$T.bin
$(call tc,ld) --oformat binary tmp/$T.o -o tmp/$T.bin $(call tc,m-objcopy) -R .text -R .data -R .bss tmp/$T.bin
$(call tc,m-objcopy) -R .note -R .comment tmp/$T.bin
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
$(call tc,bin2h) --ident=linux_elfppc32_loader 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 $(srcdir)/src/$$T.lds powerpc-linux.elf-fold.h : tmp/$$T.o tmp/powerpc-linux.elf-main.o $(srcdir)/src/$$T.lds

View File

@ -1,4 +1,4 @@
/* powerpc-linux.elf-entry.h -- created from powerpc-linux.elf-entry.bin, 604 (0x25c) bytes /* powerpc-linux.elf-entry.h -- created from powerpc-linux.elf-entry.bin, 3251 (0xcb3) bytes
This file is part of the UPX executable compressor. This file is part of the UPX executable compressor.
@ -27,47 +27,213 @@
*/ */
#define LINUX_ELFPPC32_LOADER_SIZE 604 #define LINUX_ELFPPC32_LOADER_SIZE 3251
#define LINUX_ELFPPC32_LOADER_ADLER32 0x0a8bbdb5 #define LINUX_ELFPPC32_LOADER_ADLER32 0xbb8d8b77
#define LINUX_ELFPPC32_LOADER_CRC32 0xcfe347e7 #define LINUX_ELFPPC32_LOADER_CRC32 0xf2bf619c
unsigned char linux_elfppc32_loader[604] = { unsigned char linux_elfppc32_loader[3251] = {
72, 0, 2, 77,124, 0, 41,236,144,166, 0, 0,124,132, 26, 20, /* 0x 0 */ 127, 69, 76, 70, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */
60, 0,128, 0, 61, 32,128, 0, 56, 99,255,255, 56,165,255,255, /* 0x 10 */ 0, 1, 0, 20, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 10 */
57, 64,255,255,125,168, 2,166, 72, 0, 1, 12, 57, 32, 0, 1, /* 0x 20 */ 0, 0, 3,144, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 40, /* 0x 20 */
125, 41, 28, 44, 56, 99, 0, 4,124, 9, 0, 64,125, 41, 72, 20, /* 0x 30 */ 0, 15, 0, 12, 72, 0, 0,117,124, 0, 41,236,144,166, 0, 0, /* 0x 30 */
97, 41, 0, 1, 78,128, 0, 32,141, 3, 0, 1,157, 5, 0, 1, /* 0x 40 */ 124,132, 26, 20, 60, 0,128, 0, 61, 32,128, 0, 56, 99,255,255, /* 0x 40 */
124, 9, 0, 64,125, 41, 74, 20, 65,162,255,213, 65,129,255,236, /* 0x 50 */ 56,165,255,255, 57, 64,255,255,125,168, 2,166, 72, 0, 1, 12, /* 0x 50 */
56,224, 0, 1, 72, 0, 0, 20, 56,231,255,255,125, 41, 72, 21, /* 0x 60 */ 57, 32, 0, 1,125, 41, 28, 44, 56, 99, 0, 4,124, 9, 0, 64, /* 0x 60 */
65,162,255,189,124,231, 57, 20,125, 41, 72, 21, 65,162,255,177, /* 0x 70 */ 125, 41, 72, 20, 97, 41, 0, 1, 78,128, 0, 32,141, 3, 0, 1, /* 0x 70 */
124,231, 57, 20,124, 9, 0, 64,125, 41, 74, 20, 65,162,255,161, /* 0x 80 */ 157, 5, 0, 1,124, 9, 0, 64,125, 41, 74, 20, 65,162,255,213, /* 0x 80 */
65,160,255,216, 57, 0, 0, 0, 52,231,255,253, 84,231, 64, 46, /* 0x 90 */ 65,129,255,236, 56,224, 0, 1, 72, 0, 0, 20, 56,231,255,255, /* 0x 90 */
65,128, 0, 32,140, 67, 0, 1,124,234, 16,249,125, 74, 14,112, /* 0x a0 */ 125, 41, 72, 21, 65,162,255,189,124,231, 57, 20,125, 41, 72, 21, /* 0x a0 */
65,130, 0,148,112, 66, 0, 1, 65,162, 0, 80, 72, 0, 0, 20, /* 0x b0 */ 65,162,255,177,124,231, 57, 20,124, 9, 0, 64,125, 41, 74, 20, /* 0x b0 */
124, 9, 0, 64,125, 41, 74, 20, 65,162,255,101, 65,161, 0, 60, /* 0x c0 */ 65,162,255,161, 65,160,255,216, 57, 0, 0, 0, 52,231,255,253, /* 0x c0 */
57, 0, 0, 1,124, 9, 0, 64,125, 41, 74, 20, 65,162,255, 81, /* 0x d0 */ 84,231, 64, 46, 65,128, 0, 32,140, 67, 0, 1,124,234, 16,249, /* 0x d0 */
65,161, 0, 40,125, 41, 72, 21, 65,162,255, 69,125, 8, 65, 20, /* 0x e0 */ 125, 74, 14,112, 65,130, 0, 0,112, 66, 0, 1, 65,162, 0, 80, /* 0x e0 */
124, 9, 0, 64,125, 41, 74, 20, 65,162,255, 53, 65,160,255,232, /* 0x f0 */ 72, 0, 0, 20,124, 9, 0, 64,125, 41, 74, 20, 65,162,255,101, /* 0x f0 */
57, 8, 0, 2, 72, 0, 0, 16,125, 41, 72, 21, 65,162,255, 33, /* 0x 100 */ 65,161, 0, 60, 57, 0, 0, 1,124, 9, 0, 64,125, 41, 74, 20, /* 0x 100 */
125, 8, 65, 20, 32,234,250,255, 57, 8, 0, 2,125, 8, 1,148, /* 0x 110 */ 65,162,255, 81, 65,161, 0, 40,125, 41, 72, 21, 65,162,255, 69, /* 0x 110 */
124,234, 42, 20,125, 9, 3,166,141, 7, 0, 1,157, 5, 0, 1, /* 0x 120 */ 125, 8, 65, 20,124, 9, 0, 64,125, 41, 74, 20, 65,162,255, 53, /* 0x 120 */
66, 0,255,248, 56,224, 1, 0,124, 7, 41,236,124, 7, 26, 44, /* 0x 130 */ 65,160,255,232, 57, 8, 0, 2, 72, 0, 0, 16,125, 41, 72, 21, /* 0x 130 */
75,255,255, 16,128, 6, 0, 0,125,168, 3,166, 56,165, 0, 1, /* 0x 140 */ 65,162,255, 33,125, 8, 65, 20, 32,234,250,255, 57, 8, 0, 2, /* 0x 140 */
56, 99, 0, 1,124,160, 40, 80,124,100, 24, 80,144,166, 0, 0, /* 0x 150 */ 125, 8, 1,148,124,234, 42, 20,125, 9, 3,166,141, 7, 0, 1, /* 0x 150 */
78,128, 0, 32, 10, 36, 73,100, 58, 32, 85, 80, 88, 32, 40, 67, /* 0x 160 */ 157, 5, 0, 1, 66, 0,255,248, 56,224, 1, 0,124, 7, 41,236, /* 0x 160 */
41, 32, 49, 57, 57, 54, 45, 50, 48, 48, 54, 32,116,104,101, 32, /* 0x 170 */ 124, 7, 26, 44, 75,255,255, 16,124, 0, 41,236,144,166, 0, 0, /* 0x 170 */
85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108,108, 32, 82,105, /* 0x 180 */ 124,132, 26, 20, 60, 0,128, 0, 61, 32,128, 0, 56, 99,255,255, /* 0x 180 */
103,104,116,115, 32, 82,101,115,101,114,118,101,100, 46, 32,104, /* 0x 190 */ 56,165,255,255, 57, 64,255,255,125,168, 2,166, 72, 0, 0,180, /* 0x 190 */
116,116,112, 58, 47, 47,117,112,120, 46,115,102, 46,110,101,116, /* 0x 1a0 */ 124, 9, 0, 64,125, 41, 72, 20, 76,162, 0, 32, 57, 32, 0, 1, /* 0x 1a0 */
32, 36, 10, 0, 72, 0, 0, 37, 80, 82, 79, 84, 95, 69, 88, 69, /* 0x 1b0 */ 125, 41, 28, 44, 56, 99, 0, 4,124, 9, 0, 64,125, 41, 73, 20, /* 0x 1b0 */
67,124, 80, 82, 79, 84, 95, 87, 82, 73, 84, 69, 32,102, 97,105, /* 0x 1c0 */ 78,128, 0, 32,141, 3, 0, 1,157, 5, 0, 1, 75,255,255,213, /* 0x 1c0 */
108,101,100, 46, 10, 0, 0, 0, 56,160, 0, 32,124,136, 2,166, /* 0x 1d0 */ 65,129,255,244, 56,224, 0, 1, 75,255,255,201,124,231, 57, 21, /* 0x 1d0 */
56, 96, 0, 2, 56, 0, 0, 4, 68, 0, 0, 2, 56, 96, 0,127, /* 0x 1e0 */ 75,255,255,193, 65,160,255,244, 52,231,255,253, 57, 0, 0, 0, /* 0x 1e0 */
56, 0, 0, 1, 68, 0, 0, 2,127,200, 2,166, 57, 0, 0, 0, /* 0x 1f0 */ 65,128, 0, 20,140, 67, 0, 1, 84,231, 64, 46,124,234, 16,249, /* 0x 1f0 */
56,224,255,255,128,126, 0, 4, 56,192, 0, 50, 56,160, 0, 7, /* 0x 200 */ 65,130, 0, 0, 75,255,255,157,125, 8, 65, 21, 75,255,255,149, /* 0x 200 */
56,128, 16, 0,124, 99,242, 20, 56, 0, 0, 90, 56, 99, 16, 11, /* 0x 210 */ 125, 8, 65, 21, 56,224, 0, 1, 64,130, 0, 28, 56,224, 0, 3, /* 0x 210 */
84, 99, 0, 38, 68, 0, 0, 2, 65,163,255,140,127,233, 3,166, /* 0x 220 */ 57, 0, 0, 1, 75,255,255,125,125, 8, 65, 21, 75,255,255,117, /* 0x 220 */
136,254, 0, 8, 56,193, 0,124,124,101, 27,120,124,104, 3,166, /* 0x 230 */ 65,160,255,244, 32, 74,242,255,125, 8, 57, 20,124,234, 42, 20, /* 0x 230 */
128,158, 0, 4, 56,126, 0, 12, 78,128, 4, 32,148, 33,255,128, /* 0x 240 */ 125, 9, 3,166,141, 7, 0, 1,157, 5, 0, 1, 66, 0,255,248, /* 0x 240 */
188, 65, 0, 4,127,232, 2,166, 75,255,255,161 /* 0x 250 */ 56,224, 1, 0,124, 7, 41,236,124, 7, 26, 44, 75,255,255,112, /* 0x 250 */
128, 6, 0, 0,125,168, 3,166, 56,165, 0, 1, 56, 99, 0, 1, /* 0x 260 */
124,160, 40, 80,124,100, 24, 80,144,166, 0, 0, 78,128, 0, 32, /* 0x 270 */
72, 0, 0, 1, 80, 82, 79, 84, 95, 69, 88, 69, 67,124, 80, 82, /* 0x 280 */
79, 84, 95, 87, 82, 73, 84, 69, 32,102, 97,105,108,101,100, 46, /* 0x 290 */
10, 0, 0, 0, 56,160, 0, 30,124,136, 2,166, 56, 96, 0, 2, /* 0x 2a0 */
56, 0, 0, 4, 68, 0, 0, 2, 56, 96, 0,127, 56, 0, 0, 1, /* 0x 2b0 */
68, 0, 0, 2,127,200, 2,166, 57, 0, 0, 0, 56,224,255,255, /* 0x 2c0 */
128,126, 0, 4, 56,192, 0, 50, 56,160, 0, 7, 56,128, 16, 0, /* 0x 2d0 */
124, 99,242, 20, 56, 0, 0, 90, 56, 99, 16, 11, 84, 99, 0, 38, /* 0x 2e0 */
68, 0, 0, 2, 65,131, 0, 32,127,233, 3,166,136,254, 0, 8, /* 0x 2f0 */
56,193, 0,124,124,101, 27,120,124,104, 3,166,128,158, 0, 4, /* 0x 300 */
56,126, 0, 12, 78,128, 4, 32,148, 33,255,128,188, 65, 0, 4, /* 0x 310 */
127,232, 2,166, 75,255,255,161, 0, 46,115,121,109,116, 97, 98, /* 0x 320 */
0, 46,115,116,114,116, 97, 98, 0, 46,115,104,115,116,114,116, /* 0x 330 */
97, 98, 0, 46,114,101,108, 97, 69, 76, 70, 77, 65, 73, 78, 88, /* 0x 340 */
0, 78, 82, 86, 95, 67, 79, 77, 77, 79, 78, 0, 46,114,101,108, /* 0x 350 */
97, 78, 82, 86, 50, 69, 0, 46,114,101,108, 97, 78, 82, 86, 50, /* 0x 360 */
66, 0, 46,114,101,108, 97, 69, 76, 70, 77, 65, 73, 78, 89, 0, /* 0x 370 */
46,114,101,108, 97, 69, 76, 70, 77, 65, 73, 78, 90, 0, 0, 0, /* 0x 380 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 390 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 3a0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 1, /* 0x 3b0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 4, /* 0x 3c0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, /* 0x 3d0 */
0, 0, 0, 27, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 3e0 */
0, 0, 6,112, 0, 0, 0, 12, 0, 0, 0, 13, 0, 0, 0, 1, /* 0x 3f0 */
0, 0, 0, 4, 0, 0, 0, 12, 0, 0, 0, 41, 0, 0, 0, 1, /* 0x 400 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, /* 0x 410 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, /* 0x 420 */
0, 0, 0, 57, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 430 */
0, 0, 0, 56, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 440 */
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 4, /* 0x 450 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,124, 0, 0, 0, 12, /* 0x 460 */
0, 0, 0, 13, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 12, /* 0x 470 */
0, 0, 0, 68, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 480 */
0, 0, 1,120, 0, 0, 0,232, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 490 */
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 4, /* 0x 4a0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,136, 0, 0, 0, 12, /* 0x 4b0 */
0, 0, 0, 13, 0, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0, 12, /* 0x 4c0 */
0, 0, 0, 79, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 4d0 */
0, 0, 2, 96, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 4e0 */
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 4, /* 0x 4f0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,148, 0, 0, 0, 12, /* 0x 500 */
0, 0, 0, 13, 0, 0, 0, 8, 0, 0, 0, 4, 0, 0, 0, 12, /* 0x 510 */
0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 520 */
0, 0, 2,164, 0, 0, 0,132, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 530 */
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 88, 0, 0, 0, 4, /* 0x 540 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,160, 0, 0, 0, 12, /* 0x 550 */
0, 0, 0, 13, 0, 0, 0, 10, 0, 0, 0, 4, 0, 0, 0, 12, /* 0x 560 */
0, 0, 0, 17, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 570 */
0, 0, 3, 40, 0, 0, 0,102, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 580 */
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, /* 0x 590 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,232, 0, 0, 0,128, /* 0x 5a0 */
0, 0, 0, 14, 0, 0, 0, 7, 0, 0, 0, 4, 0, 0, 0, 16, /* 0x 5b0 */
0, 0, 0, 9, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 5c0 */
0, 0, 6,104, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 5d0 */
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 5e0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 5f0 */
0, 0, 0, 0, 3, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 600 */
0, 0, 0, 0, 3, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 610 */
0, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 620 */
0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 630 */
0, 0, 0, 0, 3, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 640 */
0, 0, 0, 0, 3, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, /* 0x 650 */
0, 0, 0, 0, 16, 0, 0, 1, 0, 95,115,116, 97,114,116, 0, /* 0x 660 */
0, 0, 0, 0, 0, 0, 2, 10, 0, 0, 0,116, 0, 0, 0,172, /* 0x 670 */
0, 0, 1, 11, 0, 0, 0, 0, 0, 0, 0,136, 0, 0, 1, 11, /* 0x 680 */
0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 2, 10, 0, 0, 0, 0, /* 0x 690 */
0, 0, 0, 80, 0, 0, 1, 11, 0, 0, 0, 32, 10,116,109,112, /* 0x 6a0 */
47,112,111,119,101,114,112, 99, 45,108,105,110,117,120, 46,101, /* 0x 6b0 */
108,102, 45,101,110,116,114,121, 46, 98,105,110, 58, 32, 32, 32, /* 0x 6c0 */
32, 32,102,105,108,101, 32,102,111,114,109, 97,116, 32,101,108, /* 0x 6d0 */
102, 51, 50, 45,112,111,119,101,114,112, 99, 10, 10, 83,101, 99, /* 0x 6e0 */
116,105,111,110,115, 58, 10, 73,100,120, 32, 78, 97,109,101, 32, /* 0x 6f0 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 83,105,122,101, 32, 32, 32, /* 0x 700 */
32, 32, 32, 86, 77, 65, 32, 32, 32, 32, 32, 32, 32, 76, 77, 65, /* 0x 710 */
32, 32, 32, 32, 32, 32, 32, 70,105,108,101, 32,111,102,102, 32, /* 0x 720 */
32, 65,108,103,110, 32, 32, 70,108, 97,103,115, 10, 32, 32, 48, /* 0x 730 */
32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 32, 32, 32, 32, 32, 48, /* 0x 740 */
48, 48, 48, 48, 48, 48, 52, 32, 32, 48, 48, 48, 48, 48, 48, 48, /* 0x 750 */
48, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, /* 0x 760 */
48, 48, 48, 51, 52, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, /* 0x 770 */
84, 69, 78, 84, 83, 44, 32, 82, 69, 76, 79, 67, 44, 32, 82, 69, /* 0x 780 */
65, 68, 79, 78, 76, 89, 10, 32, 32, 49, 32, 78, 82, 86, 95, 67, /* 0x 790 */
79, 77, 77, 79, 78, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48, 48, /* 0x 7a0 */
48, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, /* 0x 7b0 */
48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 51, 56, 32, /* 0x 7c0 */
32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, /* 0x 7d0 */
32, 82, 69, 65, 68, 79, 78, 76, 89, 10, 32, 32, 50, 32, 78, 82, /* 0x 7e0 */
86, 50, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, /* 0x 7f0 */
48, 49, 52, 48, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, /* 0x 800 */
48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, /* 0x 810 */
51, 56, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, 69, 78, /* 0x 820 */
84, 83, 44, 32, 82, 69, 76, 79, 67, 44, 32, 82, 69, 65, 68, 79, /* 0x 830 */
78, 76, 89, 10, 32, 32, 51, 32, 78, 82, 86, 50, 66, 32, 32, 32, /* 0x 840 */
32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48,101, 56, 32, 32, /* 0x 850 */
48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, /* 0x 860 */
48, 48, 32, 32, 48, 48, 48, 48, 48, 49, 55, 56, 32, 32, 50, 42, /* 0x 870 */
42, 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, 32, 82, 69, /* 0x 880 */
76, 79, 67, 44, 32, 82, 69, 65, 68, 79, 78, 76, 89, 10, 32, 32, /* 0x 890 */
52, 32, 69, 76, 70, 77, 65, 73, 78, 89, 32, 32, 32, 32, 32, 32, /* 0x 8a0 */
48, 48, 48, 48, 48, 48, 52, 52, 32, 32, 48, 48, 48, 48, 48, 48, /* 0x 8b0 */
48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, /* 0x 8c0 */
48, 48, 48, 50, 54, 48, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, /* 0x 8d0 */
78, 84, 69, 78, 84, 83, 44, 32, 82, 69, 76, 79, 67, 44, 32, 82, /* 0x 8e0 */
69, 65, 68, 79, 78, 76, 89, 10, 32, 32, 53, 32, 69, 76, 70, 77, /* 0x 8f0 */
65, 73, 78, 90, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48, /* 0x 900 */
56, 52, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, /* 0x 910 */
48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 50, 97, 52, /* 0x 920 */
32, 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, /* 0x 930 */
44, 32, 82, 69, 76, 79, 67, 44, 32, 82, 69, 65, 68, 79, 78, 76, /* 0x 940 */
89, 10, 83, 89, 77, 66, 79, 76, 32, 84, 65, 66, 76, 69, 58, 10, /* 0x 950 */
48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, /* 0x 960 */
32, 69, 76, 70, 77, 65, 73, 78, 89, 9, 48, 48, 48, 48, 48, 48, /* 0x 970 */
48, 48, 32, 69, 76, 70, 77, 65, 73, 78, 89, 10, 48, 48, 48, 48, /* 0x 980 */
48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, /* 0x 990 */
77, 65, 73, 78, 90, 9, 48, 48, 48, 48, 48, 48, 48, 48, 32, 69, /* 0x 9a0 */
76, 70, 77, 65, 73, 78, 90, 10, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x 9b0 */
32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, /* 0x 9c0 */
88, 9, 48, 48, 48, 48, 48, 48, 48, 48, 32, 69, 76, 70, 77, 65, /* 0x 9d0 */
73, 78, 88, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, /* 0x 9e0 */
32, 32,100, 32, 32, 78, 82, 86, 95, 67, 79, 77, 77, 79, 78, 9, /* 0x 9f0 */
48, 48, 48, 48, 48, 48, 48, 48, 32, 78, 82, 86, 95, 67, 79, 77, /* 0x a00 */
77, 79, 78, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, /* 0x a10 */
32, 32,100, 32, 32, 78, 82, 86, 50, 69, 9, 48, 48, 48, 48, 48, /* 0x a20 */
48, 48, 48, 32, 78, 82, 86, 50, 69, 10, 48, 48, 48, 48, 48, 48, /* 0x a30 */
48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 78, 82, 86, 50, 66, /* 0x a40 */
9, 48, 48, 48, 48, 48, 48, 48, 48, 32, 78, 82, 86, 50, 66, 10, /* 0x a50 */
48, 48, 48, 48, 48, 48, 48, 48, 32,103, 32, 32, 32, 32, 32, 32, /* 0x a60 */
32, 69, 76, 70, 77, 65, 73, 78, 88, 9, 48, 48, 48, 48, 48, 48, /* 0x a70 */
48, 48, 32, 95,115,116, 97,114,116, 10, 10, 10, 82, 69, 76, 79, /* 0x a80 */
67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, /* 0x a90 */
79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 88, 93, 58, 10, 79, /* 0x aa0 */
70, 70, 83, 69, 84, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, /* 0x ab0 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 32, /* 0x ac0 */
10, 48, 48, 48, 48, 48, 48, 48, 48, 32, 82, 95, 80, 80, 67, 95, /* 0x ad0 */
82, 69, 76, 50, 52, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, /* 0x ae0 */
65, 73, 78, 90, 43, 48,120, 48, 48, 48, 48, 48, 48, 55, 52, 10, /* 0x af0 */
10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, /* 0x b00 */
79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 78, 82, 86, 50, 69, 93, /* 0x b10 */
58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 84, 89, 80, 69, 32, /* 0x b20 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, /* 0x b30 */
85, 69, 32, 10, 48, 48, 48, 48, 48, 48, 97, 99, 32, 82, 95, 80, /* 0x b40 */
80, 67, 95, 82, 69, 76, 49, 52, 32, 32, 32, 32, 32, 32, 32, 69, /* 0x b50 */
76, 70, 77, 65, 73, 78, 89, 10, 10, 10, 82, 69, 76, 79, 67, 65, /* 0x b60 */
84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, /* 0x b70 */
32, 91, 78, 82, 86, 50, 66, 93, 58, 10, 79, 70, 70, 83, 69, 84, /* 0x b80 */
32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 0x b90 */
32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 32, 10, 48, 48, 48, 48, /* 0x ba0 */
48, 48, 56, 56, 32, 82, 95, 80, 80, 67, 95, 82, 69, 76, 49, 52, /* 0x bb0 */
32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 89, 10, /* 0x bc0 */
10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, /* 0x bd0 */
79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, /* 0x be0 */
78, 89, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 84, 89, /* 0x bf0 */
80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 0x c00 */
86, 65, 76, 85, 69, 32, 10, 48, 48, 48, 48, 48, 48, 50, 48, 32, /* 0x c10 */
82, 95, 80, 80, 67, 95, 82, 69, 76, 50, 52, 32, 32, 32, 32, 32, /* 0x c20 */
32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10, 10, 10, 82, 69, 76, /* 0x c30 */
79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, /* 0x c40 */
70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 90, 93, 58, 10, /* 0x c50 */
79, 70, 70, 83, 69, 84, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, /* 0x c60 */
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, /* 0x c70 */
32, 10, 48, 48, 48, 48, 48, 48, 53, 48, 32, 82, 95, 80, 80, 67, /* 0x c80 */
95, 82, 69, 76, 49, 52, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, /* 0x c90 */
77, 65, 73, 78, 89, 43, 48,120, 48, 48, 48, 48, 48, 48, 50, 48, /* 0x ca0 */
10, 10, 10 /* 0x cb0 */
}; };

View File

@ -29,41 +29,29 @@
<jreiser@users.sourceforge.net> <jreiser@users.sourceforge.net>
*/ */
#include "ppc_regs.h" #define M_NRV2B_LE32 2
rlwinm r0,meth,8,25,31 // .b_method (hi byte of meth)
cmpli cr0,r0,M_NRV2B_LE32
bne cr0,not_nrv2b
SZ_DLINE=128 # size of data cache line in Apple G5 dcbtst 0,dst // prime dcache for store
/* Returns 0 on success; non-zero on failure. */ stw dst,0(ldst) // original dst
decompress: # (uchar const *src, size_t lsrc, uchar *dst, size_t &ldst, uint method) add lsrc,lsrc,src // input eof
/* PowerPC has no 'cmplis': compare logical [unsigned] immediate shifted [by 16] */ lis hibit,0x8000 // 0x80000000 for detecting next bit
#define hibit r0 /* holds 0x80000000 during decompress */ 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
#define src a0 mflr t3 // return address
#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 b bot_n2b
#undef jnextb0y
#undef jnextb0n
#undef jnextb1y
#undef jnextb1n
/* jump on next bit, with branch prediction: y==>likely; n==>unlikely /* jump on next bit, with branch prediction: y==>likely; n==>unlikely
cr0 is set by the cmpl ["compare logical"==>unsigned]: cr0 is set by the cmpl ["compare logical"==>unsigned]:
lt next bit is 0 lt next bit is 0
@ -75,66 +63,67 @@ decompress: # (uchar const *src, size_t lsrc, uchar *dst, size_t &ldst, uint me
#define jnextb1y call get1; bgt+ cr0, #define jnextb1y call get1; bgt+ cr0,
#define jnextb1n call get1; bgt- cr0, #define jnextb1n call get1; bgt- cr0,
#undef getnextb
/* rotate next bit into bottom bit of reg; set cr0 based on entire result reg */ /* rotate next bit into bottom bit of reg; set cr0 based on entire result reg */
#define getnextb(reg) call get1; adde. reg,reg,reg #define getnextb(reg) call get1; adde. reg,reg,reg
get1: get1:
cmpl cr0,bits,hibit # cr0 for jnextb cmpl cr0,bits,hibit // cr0 for jnextb
addc bits,bits,bits # CArry for getnextb addc bits,bits,bits // CArry for getnextb
bnelr+ cr0 # return if reload not needed; likely 31/32 bnelr+ cr0 // return if reload not needed; likely 31/32
/* CArry has been set from adding 0x80000000 to itself; preserve for 'adde' */ /* CArry has been set from adding 0x80000000 to itself; preserve for 'adde' */
# fetch 4 bytes unaligned and LITTLE ENDIAN // fetch 4 bytes unaligned and LITTLE ENDIAN
#if 0 /*{ clean; but 4 instr larger, and 3 cycles longer */ #if 0 /*{ clean; but 4 instr larger, and 3 cycles longer */
lbz bits,1(src) # lo8 lbz bits,1(src) // lo8
lbz t0,2(src); rlwimi bits,t0, 8,16,23 lbz t0,2(src); rlwimi bits,t0, 8,16,23
lbz t0,3(src); rlwimi bits,t0,16, 8,15 lbz t0,3(src); rlwimi bits,t0,16, 8,15
lbzu t0,4(src); rlwimi bits,t0,24, 0, 7 lbzu t0,4(src); rlwimi bits,t0,24, 0, 7
#else /*}{ pray for no unalignment trap or slowdown */ #else /*}{ pray for no unalignment trap or slowdown */
li bits,1 # compensate for 'lbzu' li bits,1 // compensate for 'lbzu'
lwbrx bits,bits,src # bits= fetch_le32(bits+src) lwbrx bits,bits,src // bits= fetch_le32(bits+src)
addi src,src,4 addi src,src,4
#endif /*}*/ #endif /*}*/
cmpl cr0,bits,hibit # cr0 for jnextb cmpl cr0,bits,hibit // cr0 for jnextb
adde bits,bits,bits # CArry for getnextb; set lo bit from CarryIn adde bits,bits,bits // CArry for getnextb; set lo bit from CarryIn
ret ret
lit_n2b: lit_n2b:
#define tmp len #define tmp len
lbzu tmp,1(src) # tmp= *++src; lbzu tmp,1(src) // tmp= *++src;
stbu tmp,1(dst) # *++dst= tmp; stbu tmp,1(dst) // *++dst= tmp;
#undef tmp #undef tmp
top_n2b: top_n2b:
jnextb1y lit_n2b jnextb1y lit_n2b
li off,1 # "the msb" li off,1 // "the msb"
offmore_n2b: offmore_n2b:
getnextb(off) getnextb(off)
jnextb0n offmore_n2b jnextb0n offmore_n2b
addic. off,off,-3 # CArry set [and ignored], but no 'addi.' addic. off,off,-3 // CArry set [and ignored], but no 'addi.'
li len,0 li len,0
blt- offprev_n2b blt- offprev_n2b
lbzu t0,1(src) lbzu t0,1(src)
rlwinm off,off,8,0,31-8 # off<<=8; rlwinm off,off,8,0,31-8 // off<<=8;
nor. disp,off,t0 # disp = -(1+ (off|t0)); nor. disp,off,t0 // disp = -(1+ (off|t0));
beq- eof_n2b beq- eof_nrv
offprev_n2b: # In: 0==len offprev_n2b: // In: 0==len
getnextb(len); getnextb(len) # two bits; cr0 set on result 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,1; bne- gotlen_n2b // raw 1,2,3 ==> 2,3,4
li off,3 # raw 2.. ==> 5.. li off,3 // raw 2.. ==> 5..
li len,1 # "the msb" li len,1 // "the msb"
lenmore_n2b: lenmore_n2b:
getnextb(len) getnextb(len)
jnextb0n lenmore_n2b jnextb0n lenmore_n2b
gotlen_n2b: gotlen_n2b:
subfic t0,disp,(~0)+(-0xd00) # want CArry only subfic t0,disp,(~0)+(-0xd00) // want CArry only
adde len,len,off # len += off + (disp < -0xd00); adde len,len,off // len += off + (disp < -0xd00);
copy: copy:
#define back off #define back off
add back,disp,dst # point back to match in dst add back,disp,dst // point back to match in dst
mtctr len mtctr len
short_n2b: short_n2b:
#define tmp len #define tmp len
@ -151,21 +140,10 @@ short_n2b:
*/ */
bot_n2b: bot_n2b:
li back,2*SZ_DLINE li back,2*SZ_DLINE
dcbtst back,dst # 2 lines ahead [-1 for stbu] dcbtst back,dst // 2 lines ahead [-1 for stbu]
dcbt back,src # jump start auto prefetch at page boundary dcbt back,src // jump start auto prefetch at page boundary
/* Auto prefetch for Read quits at page boundary; needs 2 misses to restart. */ /* Auto prefetch for Read quits at page boundary; needs 2 misses to restart. */
#undef back #undef back
b top_n2b b top_n2b
eof_n2b: not_nrv2b:
#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

View File

@ -29,26 +29,10 @@
<jreiser@users.sourceforge.net> <jreiser@users.sourceforge.net>
*/ */
#include "regs.h" #define M_NRV2E_LE32 8
rlwinm r0,meth,8,25,31 // .b_method (hi byte of meth)
SZ_DLINE=128 # size of data cache line in Apple G5 cmpli cr0,r0,M_NRV2E_LE32
bne cr0,not_nrv2e
/* 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 dcbtst 0,dst # prime dcache for store
@ -64,6 +48,10 @@ decompress: # (uchar const *src, size_t lsrc, uchar *dst, size_t &ldst, uint me
mflr t3 # return address mflr t3 # return address
b bot_n2e b bot_n2e
#undef jnextb0y
#undef jnextb0n
#undef jnextb1y
#undef jnextb1n
/* jump on next bit, with branch prediction: y==>likely; n==>unlikely /* jump on next bit, with branch prediction: y==>likely; n==>unlikely
cr0 is set by the cmpl ["compare logical"==>unsigned]: cr0 is set by the cmpl ["compare logical"==>unsigned]:
lt next bit is 0 lt next bit is 0
@ -77,31 +65,32 @@ decompress: # (uchar const *src, size_t lsrc, uchar *dst, size_t &ldst, uint me
#define jnextb1y cmpl 0,bits,hibit; add bits,bits,bits; beql- get32; bgt+ #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- #define jnextb1n cmpl 0,bits,hibit; add bits,bits,bits; beql- get32; bgt-
#undef getnextb
/* rotate next bit into bottom bit of reg */ /* rotate next bit into bottom bit of reg */
#define getnextb(reg) addc. bits,bits,bits; beql- get32; adde reg,reg,reg #define getnextb(reg) addc. bits,bits,bits; beql- get32; adde reg,reg,reg
get32: get32:
# fetch 4 bytes unaligned and LITTLE ENDIAN // fetch 4 bytes unaligned and LITTLE ENDIAN
#if 0 /*{ clean; but 4 instr larger, and 3 cycles longer */ #if 0 /*{ clean; but 4 instr larger, and 3 cycles longer */
lbz bits,1(src) # lo8 lbz bits,1(src) // lo8
lbz t0,2(src); rlwimi bits,t0, 8,16,23 lbz t0,2(src); rlwimi bits,t0, 8,16,23
lbz t0,3(src); rlwimi bits,t0,16, 8,15 lbz t0,3(src); rlwimi bits,t0,16, 8,15
lbzu t0,4(src); rlwimi bits,t0,24, 0, 7 lbzu t0,4(src); rlwimi bits,t0,24, 0, 7
#else /*}{ pray for no unalignment trap or slowdown */ #else /*}{ pray for no unalignment trap or slowdown */
li bits,1 # compensate for 'lbzu' li bits,1 // compensate for 'lbzu'
lwbrx bits,bits,src # bits= fetch_le32(bits+src) lwbrx bits,bits,src // bits= fetch_le32(bits+src)
addi src,src,4 addi src,src,4
#endif /*}*/ #endif /*}*/
cmpl 0,bits,hibit # cr0 for jnextb cmpl 0,bits,hibit // cr0 for jnextb
addc bits,bits,bits # CArry for getnextb addc bits,bits,bits // CArry for getnextb
ori bits,bits,1 # the flag bit ori bits,bits,1 // the flag bit
ret ret
lit_n2e: lit_n2e:
#define tmp len #define tmp len
lbzu tmp,1(src) # tmp= *++src; lbzu tmp,1(src) // tmp= *++src;
stbu tmp,1(dst) # *++dst= tmp; stbu tmp,1(dst) // *++dst= tmp;
#undef tmp #undef tmp
top_n2e: top_n2e:
jnextb1y lit_n2e jnextb1y lit_n2e
@ -116,21 +105,21 @@ getoff_n2e:
jnextb0n off_n2e jnextb0n off_n2e
li len,0 li len,0
addic. off,off,-3 # CArry set [and ignored], but no 'addi.' addic. off,off,-3 // CArry set [and ignored], but no 'addi.'
rlwinm off,off,8,0,31-8 # off<<=8; rlwinm off,off,8,0,31-8 // off<<=8;
blt- offprev_n2e blt- offprev_n2e
lbzu t0,1(src) lbzu t0,1(src)
nor. disp,off,t0 # disp = -(1+ (off|t0)); nor. disp,off,t0 // disp = -(1+ (off|t0));
srawi disp,disp,1 # shift off low bit (sets CArry; ignored) srawi disp,disp,1 // shift off low bit (sets CArry; ignored)
beq- eof_n2e beq- eof_nrv
andi. t0,t0,1 # complement of low bit of unshifted disp andi. t0,t0,1 // complement of low bit of unshifted disp
beq+ lenlast_n2e # low bit was 1 beq+ lenlast_n2e // low bit was 1
b lenmore_n2e # low bit was 0 b lenmore_n2e // low bit was 0
offprev_n2e: offprev_n2e:
jnextb1y lenlast_n2e jnextb1y lenlast_n2e
lenmore_n2e: lenmore_n2e:
li len,1 # 1: "the msb" li len,1 // 1: "the msb"
jnextb1y lenlast_n2e jnextb1y lenlast_n2e
len_n2e: len_n2e:
getnextb(len) getnextb(len)
@ -139,16 +128,16 @@ len_n2e:
b gotlen_n2e b gotlen_n2e
lenlast_n2e: lenlast_n2e:
getnextb(len) # 0,1,2,3 getnextb(len) // 0,1,2,3
gotlen_n2e: gotlen_n2e:
#define tmp off #define tmp off
subfic tmp,disp,(~0)+(-0x500) # want CArry only subfic tmp,disp,(~0)+(-0x500) // want CArry only
#undef tmp #undef tmp
addi len,len,2 addi len,len,2
addze len,len # len += (disp < -0x500); addze len,len // len += (disp < -0x500);
#define back off #define back off
add back,disp,dst # point back to match in dst add back,disp,dst // point back to match in dst
mtctr len mtctr len
short_n2e: short_n2e:
#define tmp len #define tmp len
@ -164,21 +153,10 @@ bot_n2e:
pace the dcbtst optimally; but that takes 7 or 8 instructions of space. pace the dcbtst optimally; but that takes 7 or 8 instructions of space.
*/ */
li back,2*SZ_DLINE li back,2*SZ_DLINE
dcbtst back,dst # 2 lines ahead [-1 for stbu] dcbtst back,dst // 2 lines ahead [-1 for stbu]
dcbt back,src # jump start auto prefetch at page boundary dcbt back,src // jump start auto prefetch at page boundary
/* Auto prefetch for Read quits at page boundary; needs 2 misses to restart. */ /* Auto prefetch for Read quits at page boundary; needs 2 misses to restart. */
b top_n2e b top_n2e
#undef back #undef back
eof_n2e: not_nrv2e:
#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

View File

@ -29,12 +29,8 @@
* <jreiser@users.sourceforge.net> * <jreiser@users.sourceforge.net>
*/ */
#include "arch/powerpc/32/regs.h" #include "arch/powerpc/32/ppc_regs.h"
#define section .section
/*__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_b_info= 12
sz_unc= 0 sz_unc= 0
@ -49,29 +45,77 @@ MAP_PRIVATE= 2
MAP_FIXED= 0x10 MAP_FIXED= 0x10
MAP_ANONYMOUS= 0x20 MAP_ANONYMOUS= 0x20
__NR_mmap= 90
PAGE_SHIFT= 12 PAGE_SHIFT= 12
PAGE_SIZE = -(~0<<PAGE_SHIFT) PAGE_SIZE = -(~0<<PAGE_SHIFT)
/* 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)
/* /usr/include/asm-ppc/unistd.h */ /* /usr/include/asm-ppc/unistd.h */
__NR_write = 4 __NR_write = 4
__NR_exit = 1 __NR_exit = 1
__NR_mmap = 90
section ELFMAINX
.balign 4
_start: .globl _start
call main // must be exactly 1 instruction; link_register= &decompress
/* Returns 0 on success; non-zero on failure. */
decompress: // (uchar const *src, size_t lsrc, uchar *dst, size_t &ldst, uint method)
section NRV_COMMON
.balign 4
SZ_DLINE=128 # size of data cache line in Apple G5
/* 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
section NRV2E
.balign 4
#include "arch/powerpc/32/nrv2e_d.S"
section NRV2B
.balign 4
#include "arch/powerpc/32/nrv2b_d.S"
// #include "arch/powerpc/32/lzma_d.S"
section ELFMAINY
.balign 4
eof_nrv:
#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
msg_SELinux: msg_SELinux:
call L71 call L72
L70: L70:
.asciz "PROT_EXEC|PROT_WRITE failed.\n" .asciz "PROT_EXEC|PROT_WRITE failed.\n"
.p2align 2 # (1<<2)
L71: L71:
li a2,L71 - L70 # length // IDENTSTR goes here
mflr a1 # message text
li a0,2 # fd stderr section ELFMAINZ
.balign 4
L72:
li a2,L71 - L70 // length
mflr a1 // message text
li a0,2 // fd stderr
li 0,__NR_write; sc li 0,__NR_write; sc
die: die:
li a0,127 li a0,127
@ -79,10 +123,10 @@ die:
/* Decompress the rest of this loader, and jump to it. */ /* Decompress the rest of this loader, and jump to it. */
unfold: unfold:
mflr r30 # &{ b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...} mflr r30 // &{ b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...}
li a5,0 # off_t li a5,0 // off_t
li a4,-1 # fd; cater to *BSD for MAP_ANON li a4,-1 // fd; cater to *BSD for MAP_ANON
lwz a0,sz_cpr(r30) lwz a0,sz_cpr(r30)
li a3,MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS li a3,MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS
li a2,PROT_READ | PROT_WRITE | PROT_EXEC li a2,PROT_READ | PROT_WRITE | PROT_EXEC
@ -90,28 +134,25 @@ unfold:
add a0,a0,r30 add a0,a0,r30
li 0,__NR_mmap li 0,__NR_mmap
addi a0,a0,sz_b_info+PAGE_SIZE-1 addi a0,a0,sz_b_info+PAGE_SIZE-1
rlwinm a0,a0,0,0,31-PAGE_SHIFT # next page boundary after fold rlwinm a0,a0,0,0,31-PAGE_SHIFT // next page boundary after fold
sc; bso- msg_SELinux # Branch if SummaryOverflow (failure) sc; bso- msg_SELinux // Branch if SummaryOverflow (failure)
0: 0:
mtctr r31 mtctr r31
lbz meth,b_method(r30) lbz meth,b_method(r30)
la ldst,31*4(sp) # &do_not_care la ldst,31*4(sp) // &do_not_care
mr dst,a0 mr dst,a0
mtlr a0 # &continuation mtlr a0 // &continuation
lwz lsrc,sz_cpr(r30) lwz lsrc,sz_cpr(r30)
addi src,r30,sz_b_info addi src,r30,sz_b_info
bctr # goto decomrpess; return to link register (mmap'ed page) bctr // goto decomrpess; return to link register (mmap'ed page)
main: main:
stwu r1,-32*4(sp) # allocate space (keeping 0 mod 16), save r1 stwu r1,-32*4(sp) // allocate space (keeping 0 mod 16), save r1
stmw r2,4(sp) # save registers r2 thru r31 stmw r2,4(sp) // save registers r2 thru r31
mflr r31 # &decompress mflr r31 // &decompress
call unfold call unfold
/* { b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...} */ /* { b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...} */
eof:
/*__XTHEENDX__*/
/* /*
vi:ts=8:et:nowrap vi:ts=8:et:nowrap
*/ */

View File

@ -8,7 +8,7 @@ sz_l_info= 12
sz_p_info= 12 sz_p_info= 12
OVERHEAD= 2048 OVERHEAD= 2048
LINKAREA= 4*4 # SysV C linkage area: (sp, lr); but 16-byte align LINKAREA= 4*4 // SysV C linkage area: (sp, lr); but 16-byte align
/* In: /* In:
r31= &decompress; also 8+ (char *)&(offset to {l_info; p_info; b_info}) r31= &decompress; also 8+ (char *)&(offset to {l_info; p_info; b_info})
*/ */
@ -22,9 +22,9 @@ fold_begin:
a2= envp a2= envp
a3= auxvp a3= auxvp
a4= fini a4= fini
sp= ~0xf & (-2*4 + (void *)&argc) # 0(sp): old_sp, pc sp= ~0xf & (-2*4 + (void *)&argc) // 0(sp): old_sp, pc
Instead, Linux gives only Instead, Linux gives only
sp= &{argc,argv...,0,env...,0,auxv...,strings} # 16-byte aligned? sp= &{argc,argv...,0,env...,0,auxv...,strings} // 16-byte aligned?
We must figure out the rest, particularly auxvp. We must figure out the rest, particularly auxvp.
*/ */
zfind: zfind:
@ -32,32 +32,32 @@ zfind:
cmpi cr7,t0,0; bne+ cr7,zfind cmpi cr7,t0,0; bne+ cr7,zfind
ret ret
L90: L90:
mflr a5 # &ppcbxx: f_unfilter mflr a5 // &ppcbxx: f_unfilter
lwz a6,0(sp) # sp at execve lwz a6,0(sp) // sp at execve
call zfind # a6= &env call zfind // a6= &env
call zfind # a6= &Elf32_auxv call zfind // a6= &Elf32_auxv
lwz a1,-8(r31) # total size = offset to {l_info; p_info; b_info} lwz a1,-8(r31) // total size = offset to {l_info; p_info; b_info}
rlwinm r30,a5,0,0,31-12 # r30= &this_page rlwinm r30,a5,0,0,31-12 // r30= &this_page
la a2,-OVERHEAD(sp) # &Elf32_Ehdr temporary space la a2,-OVERHEAD(sp) // &Elf32_Ehdr temporary space
mr a4,r31 # &decompress: f_expand mr a4,r31 // &decompress: f_expand
subf a0,a1,r31 # &l_info subf a0,a1,r31 // &l_info
addi sp,sp,-(LINKAREA+OVERHEAD) addi sp,sp,-(LINKAREA+OVERHEAD)
rlwinm r29,a0,0,0,31-12 # r29= &our_Elf32_Ehdr rlwinm r29,a0,0,0,31-12 // r29= &our_Elf32_Ehdr
lwz a3,sz_unc+sz_p_info+sz_l_info(a0) # sz_elf_headers lwz a3,sz_unc+sz_p_info+sz_l_info(a0) // sz_elf_headers
call upx_main # Out: a0= entry call upx_main // Out: a0= entry
/* entry= upx_main(l_info *a0, total_size a1, Elf32_Ehdr *a2, sz_ehdr a3, /* entry= upx_main(l_info *a0, total_size a1, Elf32_Ehdr *a2, sz_ehdr a3,
f_decomp a4, f_unf a5, Elf32_auxv_t *a6) f_decomp a4, f_unf a5, Elf32_auxv_t *a6)
*/ */
mr r31,a0 # save &entry mr r31,a0 // save &entry
mr a0,r29 # &our_Elf32_Ehdr mr a0,r29 // &our_Elf32_Ehdr
subf a1,r29,r30 # size subf a1,r29,r30 // size
call munmap # unmap compressed program; /proc/self/exe disappears call munmap // unmap compressed program; /proc/self/exe disappears
mtlr r31 # entry address mtlr r31 // entry address
lmw r2,4+LINKAREA+OVERHEAD(sp) # restore registers r2 thru r31 lmw r2,4+LINKAREA+OVERHEAD(sp) // restore registers r2 thru r31
lwz r1, LINKAREA+OVERHEAD(sp) # restore r1; deallocate space lwz r1, LINKAREA+OVERHEAD(sp) // restore r1; deallocate space
ret # enter /lib/ld.so.1 ret // enter /lib/ld.so.1
SYS_exit= 1 SYS_exit= 1
SYS_fork= 2 SYS_fork= 2
@ -75,8 +75,8 @@ mmap: .globl mmap
li 0,SYS_mmap li 0,SYS_mmap
sysgo: sysgo:
sc sc
bns+ no_fail # 'bns': branch if No Summary[Overflow] bns+ no_fail // 'bns': branch if No Summary[Overflow]
li a0,-1 # failure; IGNORE errno li a0,-1 // failure; IGNORE errno
no_fail: no_fail:
ret ret