From fb3375112ee05084482c96f835640f2aac475749 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Fri, 6 Dec 2002 03:09:20 +0000 Subject: [PATCH] [B]VMLINUZ for 0x40 series filters packerf.cpp p_vmlinz.cpp committer: jreiser 1039144160 +0000 --- src/p_vmlinz.cpp | 11 ++++++++--- src/packerf.cpp | 6 +++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/p_vmlinz.cpp b/src/p_vmlinz.cpp index ba2992d1..191f12e7 100644 --- a/src/p_vmlinz.cpp +++ b/src/p_vmlinz.cpp @@ -283,7 +283,7 @@ void PackVmlinuzI386::pack(OutputFile *fo) fo->write(setup_buf, setup_buf.getSize()); fo->write(loader, lsize); fo->write(obuf, ph.c_len); -#if 0 +#if 1 printf("%-13s: setup : %8ld bytes\n", getName(), (long) setup_buf.getSize()); printf("%-13s: loader : %8ld bytes\n", getName(), (long) lsize); printf("%-13s: compressed : %8ld bytes\n", getName(), (long) ph.c_len); @@ -307,7 +307,7 @@ int PackBvmlinuzI386::buildLoader(const Filter *ft) // prepare loader initLoader(nrv_loader, sizeof(nrv_loader)); addLoader("LINUZ000", - ft->id ? "LZCALLT1" : "", + (0x40==(0xf0 & ft->id)) ? "LZCKLLT1" : (ft->id ? "LZCALLT1" : ""), "LBZIMAGE""IDENTSTR", "+40D++++", // align the stuff to 4 byte boundary "UPX1HEAD", // 32 byte @@ -318,7 +318,12 @@ int PackBvmlinuzI386::buildLoader(const Filter *ft) if (ft->id) { assert(ft->calls > 0); - addLoader("LZCALLT9", NULL); + if (0x40==(0xf0 & ft->id)) { + addLoader("LZCKLLT9", NULL); + } + else { + addLoader("LZCALLT9", NULL); + } addFilter32(ft->id); } addLoader("LINUZ990", NULL); diff --git a/src/packerf.cpp b/src/packerf.cpp index 3918985c..2e9d6bef 100644 --- a/src/packerf.cpp +++ b/src/packerf.cpp @@ -371,9 +371,13 @@ bool Packer::patchFilter32(void *loader, int lsize, const Filter *ft) assert(ft->calls > 0); if (ft->id < 0x80) { - if (0x40 <= ft->id && ft->id < 0x50 && UPX_F_LINUX_i386==ph.format) { + if (0x40 <= ft->id && ft->id < 0x50 + && ( UPX_F_LINUX_i386 ==ph.format + || UPX_F_VMLINUZ_i386 ==ph.format + || UPX_F_BVMLINUZ_i386==ph.format ) ) { // "push byte '?'" patch_le16(loader, lsize, "\x6a?", 0x6a + (ft->cto << 8)); + checkPatch(NULL, 0, 0, 0); // reset } if (0x20 <= ft->id && ft->id < 0x40) { // 077==modr/m of "cmp [edi], byte '?'" (compare immediate 8 bits)