mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
PackLinuxElf32arm lzma cache flush; 5th arg to f_decompress is on stack
This commit is contained in:
parent
05872d7650
commit
cd1dec9fc7
File diff suppressed because it is too large
Load Diff
|
@ -28,7 +28,7 @@ lzma_d_c%.S : tc_bfdname = elf32-littlearm
|
|||
|
||||
tc.arm-lzma.gcc = $(tc.arm-linux.elf.gcc)
|
||||
tc.arm-lzma.gcc += -march=armv4 -fPIC
|
||||
tc.arm-lzma.gcc += -Os
|
||||
#tc.arm-lzma.gcc += -Os
|
||||
tc.arm-lzma.gcc += -ffunction-sections
|
||||
tc.arm-lzma.gcc += -I$(UPX_LZMADIR)
|
||||
tc.arm-lzma.gcc += -I$(top_srcdir)/src
|
||||
|
|
|
@ -45,7 +45,11 @@
|
|||
#define M_LZMA 14
|
||||
ldrb ip,meth; cmp ip,#M_LZMA; bne not_lzma
|
||||
|
||||
PUSH {fp,lr}
|
||||
#if defined(LINUX_ARM_CACHEFLUSH) /*{*/
|
||||
PUSH {dst,ldst, fp,lr} // dst,ldst for cache flush
|
||||
#else /*}{*/
|
||||
PUSH { fp,lr}
|
||||
#endif /*}*/
|
||||
|
||||
#define a0 r0
|
||||
#define a1 r1
|
||||
|
@ -70,8 +74,8 @@
|
|||
mov fp,fp,LSR #3 // lit_context_bits + lit_pos_bits
|
||||
mov ip,ip,LSL fp // 2*LZMA_LIT_SIZE << (lit_context_bits + lit_pos_bits)
|
||||
mov fp,sp
|
||||
add ip,ip,# ((State + 2*LZMA_BASE_SIZE)>>8)<<8
|
||||
add ip,ip,#0xff & (State + 2*LZMA_BASE_SIZE)
|
||||
#define W 4 /* even #bits to round up so that 8 bits span all the 1's */
|
||||
add ip,ip,#((~(~0<<W) + State + 2*LZMA_BASE_SIZE)>>W)<<W
|
||||
sub sp,sp,ip
|
||||
|
||||
ldr ip,[ldst]
|
||||
|
@ -102,6 +106,21 @@
|
|||
add a0,sp,#State
|
||||
bl 1f // the call
|
||||
mov sp,fp
|
||||
|
||||
#if defined(LINUX_ARM_CACHEFLUSH) /*{*/
|
||||
/* linux/include/asm-arm/unistd.h */
|
||||
#define __NR_SYSCALL_BASE 0x900000
|
||||
#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000)
|
||||
#define __ARM_NR_cacheflush (__ARM_NR_BASE+2)
|
||||
mov r4,r0 // save result value
|
||||
POP {r0,r1} // dst, ldst
|
||||
ldr r1,[r1] // ldst by reference
|
||||
add r1,r1,r0 // just beyond what was written
|
||||
mov r2,#0
|
||||
swi __ARM_NR_cacheflush // decompressed region
|
||||
mov r0,r4 // result value
|
||||
#endif /*}*/
|
||||
|
||||
POP {fp,pc}
|
||||
1:
|
||||
|
||||
|
|
|
@ -102,14 +102,17 @@ copy:
|
|||
sub r10,r12,r9 // &b_info
|
||||
add r10,r10,r4 // relocated &b_info
|
||||
|
||||
ldrb r0,[r11,# b_method ] // 5th param
|
||||
stmdb sp!,{r0,lr}
|
||||
ldr r3,[r11,# sz_unc]
|
||||
add r0, r11,# sz_b_info
|
||||
ldr r1,[r11,# sz_cpr ]
|
||||
mov r2,lr // dst
|
||||
str r3,[sp,#2*4] // sz_unc; lzma needs for EOF
|
||||
add r3, sp,#2*4 // &sz_unc
|
||||
ldrb r4,[r11,# b_method ]
|
||||
mov pc,r5 // decompress folded code; go there (lr)
|
||||
mov lr,pc; mov pc,r5 // decompress folded code [opcode 'bx' not in v4a]
|
||||
add sp,sp,#4 // discard 5th param
|
||||
ldmia sp!,{pc}
|
||||
|
||||
f_decompress:
|
||||
#define LINUX_ARM_CACHEFLUSH 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user