nrv2d decompressor for PackLinuxElf64amd
This commit is contained in:
@@ -244,32 +244,6 @@ PackLinuxElf::getCompressionMethods(int method, int level) const
|
|||||||
return Packer::getDefaultCompressionMethods_le32(method, level);
|
return Packer::getDefaultCompressionMethods_le32(method, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
int const *
|
|
||||||
PackLinuxElf32ppc::getCompressionMethods(int method, int level) const
|
|
||||||
{
|
|
||||||
// No real dependency on LE32.
|
|
||||||
return Packer::getDefaultCompressionMethods_le32(method, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
int const *
|
|
||||||
PackLinuxElf64amd::getCompressionMethods(int method, int level) const
|
|
||||||
{
|
|
||||||
// No real dependency on LE32.
|
|
||||||
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2E_LE32, M_LZMA, -1 };
|
|
||||||
static const int m_nrv2e[] = { M_NRV2E_LE32, M_NRV2B_LE32, M_LZMA, -1 };
|
|
||||||
static const int m_lzma[] = { M_LZMA,-1 };
|
|
||||||
|
|
||||||
if (M_IS_NRV2B(method))
|
|
||||||
return m_nrv2b;
|
|
||||||
if (M_IS_NRV2E(method))
|
|
||||||
return m_nrv2e;
|
|
||||||
if (M_IS_LZMA(method))
|
|
||||||
return m_lzma;
|
|
||||||
if (1==level)
|
|
||||||
return m_nrv2b;
|
|
||||||
return m_nrv2e;
|
|
||||||
}
|
|
||||||
|
|
||||||
int const *
|
int const *
|
||||||
PackLinuxElf32armLe::getCompressionMethods(int /*method*/, int /*level*/) const
|
PackLinuxElf32armLe::getCompressionMethods(int /*method*/, int /*level*/) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -287,7 +287,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
//virtual void pack3(OutputFile *, Filter &); // append loader
|
//virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
virtual const int *getCompressionMethods(int method, int level) const;
|
|
||||||
virtual int buildLoader(const Filter *);
|
virtual int buildLoader(const Filter *);
|
||||||
virtual void addStubEntrySections(Filter const *);
|
virtual void addStubEntrySections(Filter const *);
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
@@ -309,7 +308,6 @@ public:
|
|||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
protected:
|
protected:
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual const int *getCompressionMethods(int method, int level) const;
|
|
||||||
virtual int buildLoader(const Filter *);
|
virtual int buildLoader(const Filter *);
|
||||||
virtual void addStubEntrySections(Filter const *);
|
virtual void addStubEntrySections(Filter const *);
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
|
|||||||
+789
-745
File diff suppressed because it is too large
Load Diff
@@ -62,6 +62,7 @@ PAGE_MASK= (~0<<PAGE_SHIFT)
|
|||||||
PAGE_SIZE= -PAGE_MASK
|
PAGE_SIZE= -PAGE_MASK
|
||||||
|
|
||||||
M_NRV2B_LE32=2 // ../conf.h
|
M_NRV2B_LE32=2 // ../conf.h
|
||||||
|
M_NRV2D_LE32=5
|
||||||
M_NRV2E_LE32=8
|
M_NRV2E_LE32=8
|
||||||
|
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ ra_setup:
|
|||||||
#define getnextbp(reg) call *%r11; adcl reg,reg
|
#define getnextbp(reg) call *%r11; adcl reg,reg
|
||||||
#define getnextb(reg) getnextbp(reg)
|
#define getnextb(reg) getnextbp(reg)
|
||||||
|
|
||||||
.p2align 3
|
|
||||||
getbit:
|
getbit:
|
||||||
addl bits,bits; jz refill // Carry= next bit
|
addl bits,bits; jz refill // Carry= next bit
|
||||||
rep; ret
|
rep; ret
|
||||||
@@ -169,6 +170,9 @@ setup:
|
|||||||
section NRV2E
|
section NRV2E
|
||||||
#include "arch/amd64/nrv2e_d.S"
|
#include "arch/amd64/nrv2e_d.S"
|
||||||
|
|
||||||
|
section NRV2D
|
||||||
|
#include "arch/amd64/nrv2d_d.S"
|
||||||
|
|
||||||
section NRV2B
|
section NRV2B
|
||||||
#include "arch/amd64/nrv2b_d.S"
|
#include "arch/amd64/nrv2b_d.S"
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
cmpb $ M_NRV2B_LE32,methb; je top_n2b; jmp not_n2b
|
cmpb $ M_NRV2B_LE32,methb; je top_n2b; jmp not_n2b
|
||||||
.p2align 3
|
|
||||||
lit_n2b:
|
lit_n2b:
|
||||||
incq %rsi; movb %dl,(%rdi)
|
incq %rsi; movb %dl,(%rdi)
|
||||||
incq %rdi
|
incq %rdi
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/* nrv2d_d.S -- AMD64 decompressor for NRV2D
|
||||||
|
|
||||||
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996-2006 Laszlo Molnar
|
||||||
|
Copyright (C) 2000-2006 John F. Reiser
|
||||||
|
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
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING.
|
||||||
|
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
|
||||||
|
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
|
John F. Reiser
|
||||||
|
<jreiser@users.sourceforge.net>
|
||||||
|
*/
|
||||||
|
|
||||||
|
cmpb $ M_NRV2D_LE32,methb; je top_n2d; jmp not_n2d
|
||||||
|
|
||||||
|
lit_n2d:
|
||||||
|
incq %rsi; movb %dl,(%rdi)
|
||||||
|
incq %rdi
|
||||||
|
top_n2d:
|
||||||
|
movb (%rsi),%dl // speculate: literal, or bottom 8 bits of offset
|
||||||
|
jnextb1yp lit_n2d
|
||||||
|
lea 1(lenq),off // [len= 0] off= 1
|
||||||
|
jmp getoff_n2d
|
||||||
|
|
||||||
|
off_n2d:
|
||||||
|
dec off
|
||||||
|
getnextbp(off)
|
||||||
|
getoff_n2d:
|
||||||
|
getnextbp(off)
|
||||||
|
jnextb0np off_n2d
|
||||||
|
|
||||||
|
subl $ 3,off; jc offprev_n2d
|
||||||
|
shll $ 8,off; movzbl %dl,%edx
|
||||||
|
orl %edx,off; incq %rsi
|
||||||
|
xorl $~0,off; jz eof
|
||||||
|
sarl off // Carry= original low bit
|
||||||
|
movslq off,disp // XXX: 2GB
|
||||||
|
jmp len_n2d-2 // CHEAT: assume tail of getnextb is "adcl len,len"
|
||||||
|
offprev_n2d:
|
||||||
|
getnextb(len)
|
||||||
|
len_n2d:
|
||||||
|
getnextb(len); jne gotlen_n2d
|
||||||
|
inc len // len= 1
|
||||||
|
lenmore_n2d:
|
||||||
|
getnextb(len)
|
||||||
|
jnextb0n lenmore_n2d
|
||||||
|
addl $2,len
|
||||||
|
gotlen_n2d:
|
||||||
|
cmpq $-0x500,disp
|
||||||
|
adcl $1,len // len += 1+ (disp < -0x500);
|
||||||
|
call copy
|
||||||
|
bot_n2d: // In: 0==len
|
||||||
|
jmp top_n2d
|
||||||
|
|
||||||
|
not_n2d:
|
||||||
|
|
||||||
|
/*
|
||||||
|
vi:ts=8:et:nowrap
|
||||||
|
*/
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* amd_d_nrv2e.S -- AMD64 decompressor for NRV2E
|
/* nrv2e_d.S -- AMD64 decompressor for NRV2E
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
cmpb $ M_NRV2E_LE32,methb; je top_n2e; jmp not_n2e
|
cmpb $ M_NRV2E_LE32,methb; je top_n2e; jmp not_n2e
|
||||||
.p2align 3
|
|
||||||
lit_n2e:
|
lit_n2e:
|
||||||
incq %rsi; movb %dl,(%rdi)
|
incq %rsi; movb %dl,(%rdi)
|
||||||
incq %rdi
|
incq %rdi
|
||||||
|
|||||||
Reference in New Issue
Block a user