1
0
mirror of https://github.com/upx/upx synced 2025-10-05 19:20:23 +08:00

dos/com and dos/sys: only add the `sbb bp,bp' section to the stub

if it is needed.

committer: mfx <mfx> 978538864 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2001-01-03 16:21:04 +00:00
parent 5ddec963d0
commit 25a6da5638
5 changed files with 10 additions and 4 deletions

4
TODO
View File

@ -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

View File

@ -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",

View File

@ -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",

View File

@ -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

View File

@ -78,6 +78,7 @@ strategy:
xchg si, di
sub si, byte start - cutpoint
; __SYSSUBSI__
; __SYSSBBBP__
sbb bp, bp
%ifdef __SYSCALLT__
push di