diff --git a/src/stub/src/arch/arm/v8a/lzma_d.S b/src/stub/src/arch/arm/v8a/lzma_d.S index f27e04f2..51cbd717 100644 --- a/src/stub/src/arch/arm/v8a/lzma_d.S +++ b/src/stub/src/arch/arm/v8a/lzma_d.S @@ -1,471 +1,150 @@ -rcGetBit.2736: - mov w3, 16777215 - cmp w28, w3 - bhi .L2 - ldp x4, x3, [x18] - cmp x3, x4 - beq .L5 - add x4, x3, 1 - str x4, [x18, 8] - lsl w28, w28, 8 - ldrb w2, [x3] - orr w27, w2, w27, lsl 8 -.L2: - ldrh w3, [x1] - lsr w2, w28, 11 - mul w2, w2, w3 - cmp w2, w27 - bhi .L7 - lsl w0, w0, 1 - sub w3, w3, w3, lsr 5 - sub w27, w27, w2 - sub w28, w28, w2 - strh w3, [x1] - add w0, w0, 1 - ret -.L7: - mov w4, 2048 - mov w28, w2 - sub w2, w4, w3 - lsl w0, w0, 1 - add w3, w3, w2, asr 5 - strh w3, [x1] - ret -.L5: - mov w0, 1 - ret +/* lzma_d.S -- ARM decompressor for LZMA -LzmaDecodeProperties: - cmp w2, 4 - ble .L14 - ldrb w1, [x1] - mov w2, 1 - cmp w1, 224 - bhi .L9 - cmp w1, 44 - str wzr, [x0, 8] - bls .L10 - mov w2, 0 -.L11: - sub w1, w1, #45 - add w2, w2, 1 - uxtb w1, w1 - cmp w1, 44 - bhi .L11 - str w2, [x0, 8] -.L10: - cmp w1, 8 - str wzr, [x0, 4] - bls .L12 - mov w2, 1 -.L13: - sub w1, w1, #9 - mov w3, w2 - add w2, w2, 1 - uxtb w1, w1 - cmp w1, 8 - bhi .L13 - str w3, [x0, 4] -.L12: - mov w2, 0 - str w1, [x0] -.L9: - mov w0, w2 - ret -.L14: - mov w2, 1 - mov w0, w2 - ret + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2015 Laszlo Molnar + Copyright (C) 2000-2015 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 + + + John F. Reiser + +*/ + +#define section .section + + section LZMA_ELF00 +//decompress: // (uchar const *src, size_t lsrc, uchar *dst, u32 &ldst, uint method) +/* Arguments according to calling convention */ +#define src x0 +#define lsrc w1 +#define dst x2 +#define ldst x3 /* Out: actually a reference: &len_dst */ +#define meth w4 + + // bkpt // debugging + +#define M_LZMA 14 + cmp meth,#M_LZMA; bne not_lzma + +#if defined(LINUX_ARM_CACHEFLUSH)||defined(DARWIN_ARM_CACHEFLUSH) /*{*/ + PUSH4(dst,ldst, fp,lr) // dst,ldst for cache flush +#else /*}{*/ + PUSH2( fp,lr) +#endif /*}*/ + +#define a0 x0 +#define a1 x1 +#define a2 w2 +#define a3 x3 +#define a4 x4 /* outp */ +#define a5 w5 /* outSize */ +#define a6 x6 /* &outSizeProcessed */ +#define inSzP 3*4 /* inSizeprocessed */ +#define State 4*4 /* CLzmaDecoderState */ +#define t0 w7 +#define t1 w8 +#define t1x x8 + +//LzmaDecode( // from lzmaSDK/C/7zip/Compress/LZMA_C/LzmaDecode.h +// a0= &CLzmaDecoderState, +// a1= inp, a2= inSize, a3= &inSizeProcessed, +// a4= outp, a5= outSize, a6= &outSizeProcessed +//) +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 768 + + ldrb t0,[src,#0] // first byte, replaces LzmaDecodeProperties() + mov t1,#2*LZMA_LIT_SIZE + lsr t0,t0,#3 // lit_context_bits + lit_pos_bits + lsl t1,t1,t0 // 2*LZMA_LIT_SIZE << (lit_context_bits + lit_pos_bits) + mov t0,sp +#define W 4 /* even #bits to round up so that 8 bits span all the 1's */ + add t1,t1,#((~(~0<>W)<