diff --git a/TODO b/TODO index 05a8e19c..52794a60 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,7 @@ UPX TODO list. Last updated 2002-07-16. - resync stub with UPX 1.2 branch -- p_psx.cpp (psx/exe) needs some work +- p_ps1.cpp (ps1/exe) needs some work - src/stub/l_lx_elf86.lds does not work with current binutils (generates a several MB file) diff --git a/doc/upx.pod b/doc/upx.pod index cf23e8dc..ef46a28f 100644 --- a/doc/upx.pod +++ b/doc/upx.pod @@ -13,7 +13,7 @@ B S<[ I ]> S<[ I ]> I... =head1 ABSTRACT The Ultimate Packer for eXecutables - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Markus F.X.J. Oberhumer, Laszlo Molnar & John F. Reiser http://wildsau.idv.uni-linz.ac.at/mfx/upx.html http://upx.tsx.org @@ -76,7 +76,7 @@ B is a versatile executable packer with the following features: * linux/386 * linux/elf386 * linux/sh386 - * ps/exe + * ps1/exe * rtm32/pe * tmt/adam * vmlinuz/386 [bootable Linux kernel] @@ -676,7 +676,7 @@ Extra options available for this executable format: -=head2 NOTES FOR PS/EXE +=head2 NOTES FOR PS1/EXE This is the executable format used by the Sony PlayStation (PSone), a Mips R3000 based gaming console which is popular since the late '90s. @@ -891,6 +891,8 @@ Please report all bugs immediately to the authors. John F. Reiser + Jens Medoch + =head1 COPYRIGHT @@ -901,6 +903,8 @@ Copyright (C) 1996-2001 Laszlo Molnar Copyright (C) 2000-2001 John F. Reiser +Copyright (C) 2002 Jens Medoch + This program may be used freely, and you are welcome to redistribute it under certain conditions. diff --git a/src/Makefile b/src/Makefile index d5efc24d..03016e58 100644 --- a/src/Makefile +++ b/src/Makefile @@ -77,7 +77,7 @@ OBJECTS1 = \ packer$o packerf$o packhead$o packmast$o \ p_com$o p_djgpp2$o p_elks$o p_exe$o \ p_lx_elf$o p_lx_exc$o p_lx_sep$o p_lx_sh$o \ - p_psx$o p_sys$o p_tmt$o p_tos$o \ + p_ps1$o p_sys$o p_tmt$o p_tos$o \ p_unix$o p_vmlinz$o p_w16ne$o p_w32pe$o p_wcle$o # no exceptions or RTTI diff --git a/src/conf.h b/src/conf.h index 4eb219fa..5ad1ecff 100644 --- a/src/conf.h +++ b/src/conf.h @@ -517,7 +517,7 @@ inline void operator delete[](void *p) #define UPX_F_VMLINUZ_i386 15 #define UPX_F_BVMLINUZ_i386 16 #define UPX_F_ELKS_8086 17 -#define UPX_F_PSX_EXE 18 +#define UPX_F_PS1_EXE 18 #define UPX_F_ATARI_TOS 129 #define UPX_F_SOLARIS_SPARC 130 diff --git a/src/help.cpp b/src/help.cpp index 49287ccd..a8cf7eda 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -192,7 +192,7 @@ void show_help(int x) #endif #if 1 fg = con_fg(f,FG_YELLOW); - con_fprintf(f,"Options for psx/exe:\n"); + con_fprintf(f,"Options for ps1/exe:\n"); fg = con_fg(f,fg); con_fprintf(f, " --all-methods try all available compression methods\n" @@ -257,7 +257,7 @@ void show_help(int x) "linux/386, " "linux/elf386, " "linux/sh386, " - "psx/exe, " + "ps1/exe, " "rtm32/pe, " "tmt/adam,\n " "vmlinuz/386, " @@ -346,6 +346,7 @@ void show_version(int x) fprintf(f,"Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer\n"); fprintf(f,"Copyright (C) 1996-2002 Laszlo Molnar\n"); fprintf(f,"Copyright (C) 2000-2002 John F. Reiser\n"); + fprintf(f,"Copyright (C) 2002 Jens Medoch\n"); fprintf(f,"UPX comes with ABSOLUTELY NO WARRANTY; for details type `%s -L'.\n", progname); } diff --git a/src/main.cpp b/src/main.cpp index db57160b..b7b3590d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -696,7 +696,7 @@ static int do_option(int optc, const char *arg) opt->unix.ptinterp = true; break; case 670: - opt->psx.no_align = true; + opt->ps1.no_align = true; break; case '\0': @@ -813,7 +813,7 @@ static const struct mfx_option longopts[] = {"compress-icons", 2, 0, 631}, {"compress-resources", 2, 0, 632}, {"strip-relocs", 2, 0, 633}, - // psx/exe + // ps1/exe {"no-align", 0x10, 0, 670}, { NULL, 0, NULL, 0 } diff --git a/src/options.h b/src/options.h index 659e9ce9..4b2f54a2 100644 --- a/src/options.h +++ b/src/options.h @@ -107,7 +107,7 @@ struct options_t { } djgpp2; struct { bool no_align; - } psx; + } ps1; struct { bool split_segments; } tos; diff --git a/src/p_psx.cpp b/src/p_ps1.cpp similarity index 74% rename from src/p_psx.cpp rename to src/p_ps1.cpp index f185598b..0e032d33 100644 --- a/src/p_psx.cpp +++ b/src/p_ps1.cpp @@ -1,9 +1,10 @@ -/* p_psx.cpp -- +/* p_ps1.cpp -- This file is part of the UPX executable compressor. Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1996-2001 Laszlo Molnar + Copyright (C) 2002 Jens Medoch 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 @@ -20,8 +21,11 @@ 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 - markus@oberhumer.com ml1050@cdata.tvnet.hu + Markus F.X.J. Oberhumer Laszlo Molnar + + + Jens Medoch + */ @@ -29,10 +33,10 @@ #include "file.h" #include "filter.h" #include "packer.h" -#include "p_psx.h" +#include "p_ps1.h" static const -#include "stub/l_psx.h" +#include "stub/l_ps1.h" #define MIPS_HI(a) (((a) >> 16) /*+(((a)&0x8000)>>15)*/) @@ -44,35 +48,40 @@ static const #define PS_MAX_SIZE 0x1e8000 #define IH_BKUP (10*sizeof(LE32)) +#define EIGHTBIT /************************************************************************* // **************************************************************************/ -PackPsx::PackPsx(InputFile *f) : +PackPs1::PackPs1(InputFile *f) : super(f) { - COMPILE_TIME_ASSERT(sizeof(psx_exe_t) == 188); + COMPILE_TIME_ASSERT(sizeof(ps1_exe_t) == 188); COMPILE_TIME_ASSERT(IH_BKUP == 40); - cfile_size = 0; - scan_count = 0; + fdata_size = cfile_size = 0; + sa_cnt = 0; } -const int *PackPsx::getCompressionMethods(int method, int level) const +const int *PackPs1::getCompressionMethods(int method, int level) const { +#ifdef EIGHTBIT + return Packer::getDefaultCompressionMethods_8(method, level); +#else return Packer::getDefaultCompressionMethods_LE32(method, level); +#endif } -const int *PackPsx::getFilters() const +const int *PackPs1::getFilters() const { return NULL; } // functions for marker handling -int PackPsx::patch_mips_le16(void *b, int blen, const void *old, unsigned new_) +int PackPs1::patch_mips_le16(void *b, int blen, const void *old, unsigned new_) { unsigned char w[2]; @@ -80,7 +89,7 @@ int PackPsx::patch_mips_le16(void *b, int blen, const void *old, unsigned new_) return patch_le16(b, blen, &w, new_); } -int PackPsx::patch_mips_le32(void *b, int blen, const void *old, unsigned new_) +int PackPs1::patch_mips_le32(void *b, int blen, const void *old, unsigned new_) { unsigned char w[4]; @@ -88,7 +97,7 @@ int PackPsx::patch_mips_le32(void *b, int blen, const void *old, unsigned new_) return patch_le32(b, blen, &w, new_); } -int PackPsx::patch_hi_lo(void *b, int blen, const void *old_hi, const void *old_lo, unsigned new_) +int PackPs1::patch_hi_lo(void *b, int blen, const void *old_hi, const void *old_lo, unsigned new_) { patch_mips_le16(b, blen, old_lo, MIPS_LO(new_)); patch_mips_le16(b, blen, old_hi, MIPS_HI(new_)); @@ -100,7 +109,7 @@ int PackPsx::patch_hi_lo(void *b, int blen, const void *old_hi, const void *old_ // **************************************************************************/ -bool PackPsx::canPack() +bool PackPs1::canPack() { unsigned char buf[256]; fdata_size = file_size-PS_HDR_SIZE; @@ -130,27 +139,34 @@ bool PackPsx::canPack() // **************************************************************************/ -int PackPsx::buildLoader(const Filter *) +int PackPs1::buildLoader(const Filter *) { initLoader(nrv_loader,sizeof(nrv_loader)); - addLoader("PSXMAIN0", "PSXDECO0", NULL); - if (ph.method == M_NRV2B_LE32) + addLoader("PSXPREP0","PSXSTSZ0","PSXMAIN0", + ih.tx_ptr&0xffff ? "PSXJSTA0" : "PSXJSTH0", + "PSXDECO0", + NULL); +#ifdef EIGHTBIT + if (ph.method == M_NRV2B_8) + addLoader("PSXN2BD0", NULL); + else if (ph.method == M_NRV2D_8) + addLoader("PSXN2DD0", NULL); + else if (ph.method == M_NRV2E_8) + addLoader("PSXN2ED0", NULL); +#else + if (ph.method == M_NRV2B_LE32) addLoader("PSXN2BD0", NULL); else if (ph.method == M_NRV2D_LE32) addLoader("PSXN2DD0", NULL); + else if (ph.method == M_NRV2E_LE32) + addLoader("PSXN2ED0", NULL); +#endif else throwInternalError("unknown compression method"); - if (scan_count) - { - if (scan_count > 0xfffc) - addLoader("MSETBIG0", NULL); // set big memset - else - addLoader("MSETSML0", NULL); // set small memset - if ((ih.tx_len & 3)) - addLoader("MSETUAL0", NULL); // unaligned memset - else - addLoader("MSETALG0", NULL); // aligned memset - } + if (sa_cnt) + addLoader((sa_cnt > 0xfffc) ? "MSETBIG0" : "MSETSML0", // set small/big memset + (ih.tx_len & 3) ? "MSETUAL0" : "MSETALG0", // un/aligned memset + NULL); addLoader("PSXEXIT0", "IDENTSTR", "PSXPHDR0", NULL); return getLoaderSize(); } @@ -160,7 +176,7 @@ int PackPsx::buildLoader(const Filter *) // **************************************************************************/ -void PackPsx::pack(OutputFile *fo) +void PackPs1::pack(OutputFile *fo) { ibuf.alloc(fdata_size); @@ -173,21 +189,21 @@ void PackPsx::pack(OutputFile *fo) // this scans the end of file for 2048 bytes sector alignment // this should be padded with zeros - while (!(*p_scan--)) { if ((scan_count += 1) > (0xfffc<<3)) break; } - if (scan_count > 0xfffc) - scan_count = ALIGN_DOWN(scan_count,8); + while (!(*p_scan--)) { if ((sa_cnt += 1) > (0xfffc<<3)) break; } + if (sa_cnt > 0xfffc) + sa_cnt = ALIGN_DOWN(sa_cnt,8); else - scan_count = ALIGN_DOWN(scan_count,4); + sa_cnt = ALIGN_DOWN(sa_cnt,4); // prepare packheader - ph.u_len = (fdata_size - scan_count); + ph.u_len = (fdata_size - sa_cnt); ph.filter = 0; Filter ft(ph.level); // compress (max_match = 65535) compressWithFilters(&ft, 512, 0, NULL, 0, 65535, 0, 0); - if (ph.overlap_overhead <= scan_count) + if (ph.overlap_overhead <= sa_cnt) overlap = 0; else { @@ -195,7 +211,7 @@ void PackPsx::pack(OutputFile *fo) throwCantPack("packed data overlap (try --force)"); else { - overlap = ALIGN_UP((ph.overlap_overhead-scan_count),4); + overlap = ALIGN_UP((ph.overlap_overhead-sa_cnt),4); opt->info_mode += !opt->info_mode ? 1 : 0; infoWarning("%s will load to a %d bytes higher offset",fi->getName(),overlap); } @@ -209,6 +225,8 @@ void PackPsx::pack(OutputFile *fo) const int h_len = lsize-getLoaderSectionStart("IDENTSTR"); const int e_len = lsize-h_len; const int d_len = e_len-getLoaderSectionStart("PSXDECO0"); + int s_len; + getLoaderSection("PSXSTSZ0",&s_len); // get size of pushed/poped regs MemBuffer loader(lsize); memcpy(loader,getLoader(),lsize); @@ -224,21 +242,23 @@ void PackPsx::pack(OutputFile *fo) unsigned comp_data_start = (decomp_data_start+pad)-ph.c_len+(overlap ? overlap : 0); pad = 0; - if (!opt->psx.no_align) + if (!opt->ps1.no_align) // align the packed file to mode 2 data sector size (2048) pad = CHK_ALIGNED(ph.c_len+pad_code+e_len, 2048); const int entry = comp_data_start - e_len - pad_code; patchPackHeader(loader,lsize); patch_mips_le32(loader,e_len,"JPEP",MIPS_JP(ih.epc)); - if (scan_count) + if (sa_cnt) patch_mips_le16(loader,e_len,"SC", - MIPS_LO(scan_count > 0xfffc ? scan_count >> 3 : scan_count)); - patch_hi_lo(loader,e_len,"OH","OL",decomp_data_start); -// patch_hi_lo(loader,e_len,"LH","LL",ph.u_len+pad_code+pad); + MIPS_LO(sa_cnt > 0xfffc ? sa_cnt >> 3 : sa_cnt)); + if (ih.tx_ptr & 0xffff) + patch_hi_lo(loader,e_len,"OH","OL",decomp_data_start); + else + patch_mips_le16(loader,e_len,"OH",decomp_data_start>>16); patch_hi_lo(loader,e_len,"CH","CL",comp_data_start); patch_hi_lo(loader,e_len,"DH","DL",entry+(e_len-d_len)); - patch_mips_le16(loader,e_len,"LS",d_len); + patch_mips_le16(loader,e_len,"LS",d_len+s_len); // set the file load address oh.tx_ptr = entry-pad; @@ -277,9 +297,12 @@ void PackPsx::pack(OutputFile *fo) #if 0 printf("%-13s: compressed : %8ld bytes\n", getName(), (long) ph.c_len); printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) e_len); - printf("%-13s: code entry : %8ld bytes\n", getName(), (long) oh.epc); - printf("%-13s: load address : %8ld bytes\n", getName(), (long) oh.tx_ptr); + + printf("%-13s: code entry :%0X8 bytes\n", getName(), (unsigned int) oh.epc); + printf("%-13s: load address :%0X8 bytes\n", getName(), (unsigned int) oh.tx_ptr); printf("%-13s: section size : %8ld bytes\n", getName(), (long) oh.tx_len); + printf("%-13s: eof in mem IF:%0X8 bytes\n", getName(), (unsigned int) ih.tx_ptr+ih.tx_len); + printf("%-13s: eof in mem OF:%0X8 bytes\n", getName(), (unsigned int) oh.tx_ptr+oh.tx_len); #endif } @@ -288,7 +311,7 @@ void PackPsx::pack(OutputFile *fo) // **************************************************************************/ -int PackPsx::canUnpack() +int PackPs1::canUnpack() { if (!readPackHeader(0x400)) return false; @@ -302,7 +325,7 @@ int PackPsx::canUnpack() // **************************************************************************/ -void PackPsx::unpack(OutputFile *fo) +void PackPs1::unpack(OutputFile *fo) { fdata_size = file_size-PS_HDR_SIZE; ibuf.alloc(file_size); diff --git a/src/p_psx.h b/src/p_ps1.h similarity index 83% rename from src/p_psx.h rename to src/p_ps1.h index f9d033cd..9c180e02 100644 --- a/src/p_psx.h +++ b/src/p_ps1.h @@ -1,9 +1,10 @@ -/* p_psx.cpp -- +/* p_ps1.h -- This file is part of the UPX executable compressor. Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1996-2001 Laszlo Molnar + Copyright (C) 2002 Jens Medoch 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 @@ -20,27 +21,30 @@ 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 - markus@oberhumer.com ml1050@cdata.tvnet.hu + Markus F.X.J. Oberhumer Laszlo Molnar + + + Jens Medoch + */ -#ifndef __UPX_P_PSX_H -#define __UPX_P_PSX_H +#ifndef __UPX_P_PS1_H +#define __UPX_P_PS1_H /************************************************************************* -// psx/exe +// ps1/exe **************************************************************************/ -class PackPsx : public Packer +class PackPs1 : public Packer { typedef Packer super; public: - PackPsx(InputFile *f); + PackPs1(InputFile *f); virtual int getVersion() const { return 13; } - virtual int getFormat() const { return UPX_F_PSX_EXE; } - virtual const char *getName() const { return "ps/exe"; } + virtual int getFormat() const { return UPX_F_PS_EXE; } + virtual const char *getName() const { return "ps1/exe"; } virtual const int *getCompressionMethods(int method, int level) const; virtual const int *getFilters() const; @@ -56,7 +60,7 @@ protected: virtual int patch_mips_le32(void *b, int blen, const void *old, unsigned new_); virtual int patch_hi_lo(void *b, int blen, const void *old_hi, const void *old_lo, unsigned new_); - struct psx_exe_t + struct ps1_exe_t { char id[8]; LE32 text; @@ -86,10 +90,10 @@ protected: } __attribute_packed; - psx_exe_t ih, oh; + ps1_exe_t ih, oh; upx_uint overlap; - upx_uint scan_count; + upx_uint sa_cnt; // filesize-PS_HDR_SIZE upx_uint fdata_size; diff --git a/src/packmast.cpp b/src/packmast.cpp index 946be2b4..2685bf23 100644 --- a/src/packmast.cpp +++ b/src/packmast.cpp @@ -49,7 +49,7 @@ #include "p_w16ne.h" #include "p_w32pe.h" #include "p_vmlinz.h" -#include "p_psx.h" +#include "p_ps1.h" /************************************************************************* @@ -214,7 +214,7 @@ static Packer* try_packers(InputFile *f, try_function func) // // psone // - if ((p = func(new PackPsx(f),f)) != NULL) + if ((p = func(new PackPs1(f),f)) != NULL) return p; // diff --git a/src/stub/.cvsignore b/src/stub/.cvsignore index e90af4b7..4d89a1d0 100644 --- a/src/stub/.cvsignore +++ b/src/stub/.cvsignore @@ -15,7 +15,7 @@ l_exe.h l_lx_elf86.h l_lx_exec86.h l_lx_sh86.h -l_psx.h +l_ps1.h l_sys.h l_t_n2b.h l_t_n2bs.h diff --git a/src/stub/Makefile b/src/stub/Makefile index 7b118fa9..14c1fce7 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -26,7 +26,7 @@ STUBS = \ l_com.h \ l_djgpp2.h stubify.h \ l_exe.h \ - l_psx.h \ + l_ps1.h \ l_sys.h \ l_t_n2b.h l_t_n2bs.h l_t_n2d.h l_t_n2ds.h l_t_n2e.h l_t_n2es.h \ l_tmt.h \ @@ -108,8 +108,11 @@ ASM_M68K = sh $(srcdir)/scripts/asl_m68k.sh endif # MIPS R3000 +CPP_MR3K = gcc -I$(UCL_UPX) -I$(srcdir) -E -x assembler-with-cpp -Wall -Wp,-P,-C,-traditional APP_MR3K = perl -w $(srcdir)/scripts/app_mr3k.pl -ASM_MR3K = asm5900 --nologo -q -I$(UCL_UPX) -I$(srcdir) +ASM_MR3K = asm5900 --nologo -q +#APP_MR3K = perl -w $(srcdir)/scripts/app_mr3k.pl +#ASM_MR3K = asm5900 --nologo -q -I$(UCL_UPX) -I$(srcdir) # /*********************************************************************** @@ -271,6 +274,17 @@ l_t_x2ds.h: l_tos2.s $(BIN2H) $T.bin nrv2d_loader_small $@ +# /*********************************************************************** +# // ps1/exe +# ************************************************************************/ + +l_ps1.h: l_ps1.asm + $(CPP_MR3K) -o $T.asx $< + $(APP_MR3K) $T.asx $T.asy + $(ASM_MR3K) $T.asy -o$T.bin -l$T.lst + $(BIN2H) $T.bin nrv_loader $@ + + # /*********************************************************************** # // linux rules (exec, elf, sh, sep) # ************************************************************************/ @@ -344,16 +358,6 @@ upxd: l_lx_sep.o l_lx_sep86.asm $(BRANDELF) $@ -# /*********************************************************************** -# // psx/exe -# ************************************************************************/ - -l_psx.h: l_psx.asm - $(APP_MR3K) $< $T.asx - $(ASM_MR3K) $T.asx -o$T.bin -l$T.lst - $(BIN2H) $T.bin nrv_loader $@ - - # /*********************************************************************** # // dependencies # ************************************************************************/ diff --git a/src/stub/l_psx.asm b/src/stub/l_ps1.asm similarity index 67% rename from src/stub/l_psx.asm rename to src/stub/l_ps1.asm index 5076b308..5d3d2914 100644 --- a/src/stub/l_psx.asm +++ b/src/stub/l_ps1.asm @@ -1,9 +1,11 @@ -; l_psx.asm -- psx/exe program entry & decompressor +; l_ps1.asm -- ps1/exe program entry & decompressor ; ; This file is part of the UPX executable compressor. ; -; Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer -; Copyright (C) 1996-2002 Laszlo Molnar +; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer +; Copyright (C) 1996-2001 Laszlo Molnar +; Copyright (C) 2002 Jens Medoch +; All Rights Reserved. ; ; UPX and the UCL library are free software; you can redistribute them ; and/or modify them under the terms of the GNU General Public License as @@ -23,9 +25,25 @@ ; Markus F.X.J. Oberhumer Laszlo Molnar ; ; -; psOne r3k v1.2 by ssg +; Jens Medoch +; +; -INCLUDE "mr3k/macros.asm" + +#include "mr3k/macros.ash" + +do_regs MACRO _w + _w at,0(sp) + _w a0,4(sp) + _w a1,8(sp) + _w a2,12(sp) + _w a3,16(sp) + _w v0,20(sp) + _w v1,24(sp) + _w ra,28(sp) +do_regs ENDM + +DEFINE REG_SZ = (8*4) ORG 0 @@ -33,56 +51,67 @@ INCLUDE "mr3k/macros.asm" ; ============= ENTRY POINT ; ============= -; __PSXMAIN0__ entry: +; __PSXPREP0__ ; needed by packer to calc the LS value addiu at,zero,'LS' ; size of decomp. routine sub sp,at ; adjust the stack with this size - addi sp,-(8*4) - sw at,0(sp) - sw a0,4(sp) - sw a1,8(sp) - sw a2,12(sp) - sw a3,16(sp) - sw v0,20(sp) - sw v1,24(sp) - sw ra,28(sp) - move a0,at - lui a2,'DH' ; load DECOMPRESSION HI offset - ori a2,'DL' ; and the LO part - addiu a3,sp,(8*4) +; __PSXPREPZ__ ; needed by packer to calc the LS value +; __PSXSTSZ0__ ; needed by packer to calc the LS value + do_regs sw ; push used regs +; __PSXSTSZZ__ +; __PSXMAIN0__ + subiu a0,at,REG_SZ ; a0 = counter copyloop + addiu a3,sp,REG_SZ ; get offset for decomp. routine move a1,a3 + lui a2,'DH' ; load decomp routine HI offset + ori a2,'DL' ; and the LO offset copyloop: + addi a0,-4 lw at,0(a2) ; memcpy *a2 -> at -> *a1 addiu a2,4 - addi a0,-4 sw at,0(a1) bnez a0,copyloop addiu a1,4 lui a0,'CH' ; load COMPDATA HI offset ori a0,'CL' ; and the LO part -; lui a1,'LH' ; length of compressed data -; ori a1,'LL' ; HI and LO, but disabled +; lui a1,'LH' ; compressed data length +; ori a1,'LL' ; HI and LO !disabled +; __PSXMAINZ__ +; __PSXJSTA0__ lui a2,'OH' ; load DECOMPDATA HI offset jr a3 ori a2,'OL' ; load DECOMPDATA LO offset -; __PSXMAINZ__ +; __PSXJSTAZ__ +; __PSXJSTH0__ + jr a3 ; + lui a2,'OH' ; same for HI only !(offset&0xffff) +; __PSXJSTHZ__ ; ============= ; ============= DECOMPRESSION ; ============= +#if 1 +# define NRV_BB 8 +#else +# define NRV_BB 32 +#endif + +#if 1 +# define SMALL +#endif ; __PSXDECO0__ ; __PSXDECOZ__ ; __PSXN2BD0__ - INCLUDE "mr3k/n2b_d32.asm" +#include "mr3k/n2b_d.ash" ; __PSXN2BDZ__ ; __PSXN2DD0__ - INCLUDE "mr3k/n2d_d32.asm" +#include "mr3k/n2d_d.ash" ; __PSXN2DDZ__ -; ;_PSXN2ED0__ -; ;;;;;INCLUDE "mr3k/n2e_d32.asm" -; ;_PSXN2EDZ__ +; __PSXN2ED0__ +#include "mr3k/n2e_d.ash" +; __PSXN2EDZ__ ; __MSETBIG0__ @@ -108,15 +137,7 @@ memset_unaligned: addiu a2,4 ; __MSETUALZ__ ; __PSXEXIT0__ - lw a0,4(sp) - lw a1,8(sp) - lw a2,12(sp) - lw a3,16(sp) - lw v0,20(sp) - lw v1,24(sp) - lw ra,28(sp) - lw at,0(sp) - addiu sp,(8*4) + do_regs lw ; pop used regs DW 'JPEP' ; marker for the entry jump addu sp,at ; __PSXEXITZ__ diff --git a/src/stub/mr3k/macros.asm b/src/stub/mr3k/macros.ash similarity index 100% rename from src/stub/mr3k/macros.asm rename to src/stub/mr3k/macros.ash diff --git a/src/stub/mr3k/n2b_d32.asm b/src/stub/mr3k/n2b_d.ash similarity index 100% rename from src/stub/mr3k/n2b_d32.asm rename to src/stub/mr3k/n2b_d.ash diff --git a/src/stub/mr3k/n2d_d32.asm b/src/stub/mr3k/n2d_d.ash similarity index 100% rename from src/stub/mr3k/n2d_d32.asm rename to src/stub/mr3k/n2d_d.ash diff --git a/src/stub/mr3k/n2e_d32.asm b/src/stub/mr3k/n2e_d.ash similarity index 100% rename from src/stub/mr3k/n2e_d32.asm rename to src/stub/mr3k/n2e_d.ash diff --git a/src/version.h b/src/version.h index 7c20946a..012b495b 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,4 @@ #define UPX_VERSION_HEX 0x019001 /* 01.90.01 */ #define UPX_VERSION_STRING "1.90.1" #define UPX_VERSION_STRING4 "1.90" -#define UPX_VERSION_DATE "Sep 12th 2002" +#define UPX_VERSION_DATE "Oct 14th 2002"