diff --git a/TODO b/TODO index 9c40c6f9..07edc4df 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -UPX TODO list. Last updated 2000-12-29. +UPX TODO list. Last updated 2001-01-03. @@ -26,7 +26,7 @@ ALL FORMATS - implement `--cpu=486' option to use bswap on the 32-bit formats (if cpu >= 486) -- consider removing "sbb bp,bp" or "or ebp,-1" when not needed +- consider removing "or ebp,-1" when not needed FORMAT DJGPP2/COFF diff --git a/src/p_com.cpp b/src/p_com.cpp index a807dac0..f158ccf7 100644 --- a/src/p_com.cpp +++ b/src/p_com.cpp @@ -118,7 +118,7 @@ void PackCom::patchLoader(OutputFile *fo, // NOTE: Depends on: decompr_start == cutpoint+1 !!! patch_le16(loader,e_len,"JM",upper_end - 0xff - d_len - getLoaderSection("UPX1HEAD")); - loader[getLoaderSection("COMSUBSI") - 1] = (upx_byte) -e_len; + loader[getLoaderSectionStart("COMSUBSI") - 1] = (upx_byte) -e_len; patch_le16(loader,e_len,"DI",upper_end); patch_le16(loader,e_len,"SI",ph.c_len + lsize + 0x100); patch_le16(loader,e_len,"CX",ph.c_len + lsize); @@ -141,6 +141,8 @@ int PackCom::buildLoader(const Filter *ft) const int filter_id = ft->id; initLoader(nrv2b_loader,sizeof(nrv2b_loader)); addLoader("COMMAIN1""COMSUBSI", + ph.first_offset_found == 1 ? "COMSBBBP" : "", + "COMPSHDI", filter_id ? "COMCALLT" : "", "COMMAIN2""UPX1HEAD""COMCUTPO""NRV2B160", filter_id ? "NRVDDONE" : "NRVDRETU", diff --git a/src/p_sys.cpp b/src/p_sys.cpp index 2f8a06b9..74f9202d 100644 --- a/src/p_sys.cpp +++ b/src/p_sys.cpp @@ -91,7 +91,7 @@ void PackSys::patchLoader(OutputFile *fo, const unsigned jmp_pos = find_le16(loader,e_len,get_le16("JM")); patch_le16(loader,e_len,"JM",ph.u_len+ph.overlap_overhead+2-jmp_pos-2); - loader[getLoaderSection("SYSSUBSI") - 1] = (upx_byte) -e_len; + loader[getLoaderSectionStart("SYSSUBSI") - 1] = (upx_byte) -e_len; patch_le16(loader,e_len,"DI",copy_to); patch_le16(loader,e_len,"SI",ph.c_len+e_len+d_len-1); @@ -109,6 +109,7 @@ int PackSys::buildLoader(const Filter *ft) addLoader("SYSMAIN1", opt->cpu == opt->CPU_8086 ? "SYSI0861" : "SYSI2861", "SYSMAIN2""SYSSUBSI", + ph.first_offset_found == 1 ? "SYSSBBBP" : "", filter_id ? "SYSCALLT" : "", "SYSMAIN3""UPX1HEAD""SYSCUTPO""NRV2B160""NRVDDONE""NRVDECO1", ph.max_offset_found <= 0xd00 ? "NRVLED00" : "NRVGTD00", diff --git a/src/stub/l_com.asm b/src/stub/l_com.asm index 931e9857..bf54c669 100644 --- a/src/stub/l_com.asm +++ b/src/stub/l_com.asm @@ -59,7 +59,9 @@ mem_ok: xchg si, di sub si, byte start - cutpoint ; __COMSUBSI__ +; __COMSBBBP__ sbb bp, bp +; __COMPSHDI__ push di %ifdef __COMCALLT__ push di diff --git a/src/stub/l_sys.asm b/src/stub/l_sys.asm index b44769ba..8280ede6 100644 --- a/src/stub/l_sys.asm +++ b/src/stub/l_sys.asm @@ -78,6 +78,7 @@ strategy: xchg si, di sub si, byte start - cutpoint ; __SYSSUBSI__ +; __SYSSBBBP__ sbb bp, bp %ifdef __SYSCALLT__ push di