From 1a219e62ba03f9c0d389cc46d6cad98f91e512a2 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Mon, 21 Aug 2006 14:26:42 -0700 Subject: [PATCH] Bvmlinuz: linker->defineSymbol() instead of patchDecompressor() --- src/p_vmlinz.cpp | 14 +++++++++++++- src/stub/src/arch/i386/lzma_d.S | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/p_vmlinz.cpp b/src/p_vmlinz.cpp index 337e2690..88bc5091 100644 --- a/src/p_vmlinz.cpp +++ b/src/p_vmlinz.cpp @@ -397,7 +397,19 @@ void PackBvmlinuzI386::pack(OutputFile *fo) const unsigned lsize = getLoaderSize(); - // FIXME patchDecompressor(loader, lsize); + if (ph.method == M_LZMA) { + const lzma_compress_result_t *res = &ph.compress_result.result_lzma; + unsigned const properties = // lc, lp, pb, dummy + (res->lit_context_bits << 0) | + (res->lit_pos_bits << 8) | + (res->pos_bits << 16); + linker->defineSymbol("UPXd", properties); + // -2 for properties + linker->defineSymbol("UPXc", ph.c_len - 2); + linker->defineSymbol("UPXb", ph.u_len); + unsigned const stack = getDecompressorWrkmemSize(); + linker->defineSymbol("UPXa", 0u - stack); + } const int e_len = getLoaderSectionStart("LZCUTPOI"); assert(e_len > 0); diff --git a/src/stub/src/arch/i386/lzma_d.S b/src/stub/src/arch/i386/lzma_d.S index 40cc56e0..02c4b187 100644 --- a/src/stub/src/arch/i386/lzma_d.S +++ b/src/stub/src/arch/i386/lzma_d.S @@ -76,7 +76,7 @@ section LZMA_DEC00 section LZMA_ELF00 -// Preceded by LEXEC010 which tunes for NRV, including "pusha; push $cto" +// Preceded by LEXEC010 which tunes for NRV, including 'pusha' #define LZMA_BASE_SIZE 1846 #define LZMA_LIT_SIZE 768