1
0
mirror of https://github.com/upx/upx.git synced 2025-08-11 22:52:30 +08:00

arm64 clear_cache at end of de-compress

https://github.com/upx/upx/issues/441
	modified:   stub/src/arch/arm64/v8/macros.S

	modified:   stub/src/arch/arm64/v8/lzma_d.S
	modified:   stub/src/arch/arm64/v8/nrv2b_d32.S
	modified:   stub/src/arch/arm64/v8/nrv2d_d32.S
	modified:   stub/src/arch/arm64/v8/nrv2e_d32.S

	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/tmp/arm64-darwin.macho-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
This commit is contained in:
John Reiser
2021-05-16 09:53:03 -07:00
committed by Markus F.X.J. Oberhumer
parent d55746f62d
commit 504839951a
11 changed files with 1686 additions and 1601 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -108,18 +108,15 @@ State= 0
eof_lzma:
mov sp,fp
mov x4,x0 // save result value
mov x5,x0 // save result value
POP4(x0,x1, fp,lr) // x0= orig_dst; x1= plen_dst
ldr x1,[x1] // outSizeProcessed
add x1,x1,x0 // last
cache_lzma:
dc cvau,x0 // Clean by VA to point of Unification
ic ivau,x0 // Invalidate by VA to point of Unification
add x0,x0,#64 // next line
cmp x0,x1; blo cache_lzma
clear_cache // x0= lo; x1= hi; uses x2-x4
mov x0,x4 // result value
mov x0,x5 // result value
ret
#undef t0

View File

@ -61,5 +61,39 @@ fp .req x29
// orrcs r0,r0,#(1<<31) // force negative on error; FIXME: needed?
.endm
.macro clear_cache // In: x0= lo; x1= hi; uses x2,x3,x4
mrs x3, ctr_el0
tbnz w3, #28, 1f // not needed
ubfx x2, x3, #16, #4
mov x4, -4 // word mask (why not 8?)
lsl x4, x4, x2 // Dline_mask
and x2, x0, x4 // round down
cmp x2, x1
bhs 1f // empty range
0:
dc cvau, x2
sub x2, x2, x4
cmp x1, x2
bhi 0b
1:
dsb ish
tbnz w3, #29, 3f // not needed
and x3, x3, #0xf
mov x2, -4 // word mask (why not 8?)
lsl x2, x2, x3 // Iline_mask
and x0, x0, x2 // round down
cmp x1, x0
bls 3f // empty range
2:
ic ivau, x0
sub x0, x0, x2
cmp x1, x0
bhi 2b
3:
dsb ish
isb
.endm
#endif //}
// vi:ts=8:et:nowrap

View File

@ -74,17 +74,14 @@ eof_n2b:
SUB2(src,x1) // 0 if actual src length equals expected length
SUB2(dst,x3) // actual dst length
str dstw,[x4]
mov x4,x0 // save result value
mov x5,x0 // save result value
mov x0,x3 // orig_dst
add x1,x3,dst // orig_dst + dst_len
cache_n2b:
dc cvau,x0 // Clean by VA to point of Unification
ic ivau,x0 // Invalidate by VA to point of Unification
add x0,x0,#64 // next line
cmp x0,x1; blo cache_n2b
clear_cache // x0= lo; x1= hi; uses x2-x4
mov x0,x4 // result value
mov x0,x5 // result value
ret
get1_n2b:

View File

@ -114,17 +114,14 @@ eof_n2d:
SUB2(src,srclim) // 0 if actual src length equals expected length
SUB2(dst,x3) // actual dst length
str dstw,[x4]
mov x4,x0 // save result value
mov x5,x0 // save result value
mov x0,x3 // orig_dst
add x1,x3,dst // orig_dst + dst_len
cache_n2d:
dc cvau,x0 // Clean by VA to point of Unification
ic ivau,x0 // Invalidate by VA to point of Unification
add x0,x0,#64 // next line
cmp x0,x1; blo cache_n2d
clear_cache // x0= lo; x1= hi; uses x2-x4
mov x0,x4 // result value
mov x0,x5 // result value
POP1(lr)
ret

View File

@ -113,17 +113,14 @@ eof_n2e:
SUB2(src,srclim) // 0 if actual src length equals expected length
SUB2(dst,x3) // actual dst length
str dstw,[x4]
mov x4,x0 // save result value
mov x5,x0 // save result value
mov x0,x3 // orig_dst
add x1,x3,dst // orig_dst + dst_len
cache_n2e:
dc cvau,x0 // Clean by VA to point of Unification
ic ivau,x0 // Invalidate by VA to point of Unification
add x0,x0,#64 // next line
cmp x0,x1; blo cache_n2e
clear_cache // x0= lo; x1= hi; uses x2-x4
mov x0,x4 // result value
mov x0,x5 // result value
POP1(lr)
ret

View File

@ -4,16 +4,16 @@ Sections:
Idx Name Size VMA LMA File off Algn Flags
0 MACHMAINX 00000008 0000000000000000 0000000000000000 00000040 2**0 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 0000000000000000 0000000000000000 00000048 2**0 CONTENTS, READONLY
2 NRV2E 00000128 0000000000000000 0000000000000000 00000048 2**0 CONTENTS, READONLY
3 NRV2D 0000011c 0000000000000000 0000000000000000 00000170 2**0 CONTENTS, READONLY
4 NRV2B 000000f0 0000000000000000 0000000000000000 0000028c 2**0 CONTENTS, READONLY
5 NRV_TAIL 00000000 0000000000000000 0000000000000000 0000037c 2**0 CONTENTS, READONLY
6 LZMA_ELF00 000000b8 0000000000000000 0000000000000000 0000037c 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000968 0000000000000000 0000000000000000 00000434 2**0 CONTENTS, READONLY
8 LZMA_DEC10 0000049c 0000000000000000 0000000000000000 00000d9c 2**0 CONTENTS, READONLY
9 LZMA_DEC30 00000000 0000000000000000 0000000000000000 00001238 2**0 CONTENTS, READONLY
10 MACHMAINY 00000000 0000000000000000 0000000000000000 00001238 2**0 CONTENTS, READONLY
11 MACHMAINZ 00000150 0000000000000000 0000000000000000 00001238 2**0 CONTENTS, RELOC, READONLY
2 NRV2E 0000017c 0000000000000000 0000000000000000 00000048 2**0 CONTENTS, READONLY
3 NRV2D 00000170 0000000000000000 0000000000000000 000001c4 2**0 CONTENTS, READONLY
4 NRV2B 00000144 0000000000000000 0000000000000000 00000334 2**0 CONTENTS, READONLY
5 NRV_TAIL 00000000 0000000000000000 0000000000000000 00000478 2**0 CONTENTS, READONLY
6 LZMA_ELF00 0000010c 0000000000000000 0000000000000000 00000478 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000968 0000000000000000 0000000000000000 00000584 2**0 CONTENTS, READONLY
8 LZMA_DEC10 0000049c 0000000000000000 0000000000000000 00000eec 2**0 CONTENTS, READONLY
9 LZMA_DEC30 00000000 0000000000000000 0000000000000000 00001388 2**0 CONTENTS, READONLY
10 MACHMAINY 00000000 0000000000000000 0000000000000000 00001388 2**0 CONTENTS, READONLY
11 MACHMAINZ 00000150 0000000000000000 0000000000000000 00001388 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
0000000000000000 l d LZMA_DEC30 0000000000000000 LZMA_DEC30
0000000000000000 l d MACHMAINZ 0000000000000000 MACHMAINZ
@ -28,9 +28,9 @@ SYMBOL TABLE:
0000000000000000 l d LZMA_DEC10 0000000000000000 LZMA_DEC10
0000000000000000 l d MACHMAINY 0000000000000000 MACHMAINY
0000000000000000 g MACHMAINX 0000000000000000 _start
0000000000000000 g F NRV2E 0000000000000128 ucl_nrv2e_decompress_32
0000000000000000 g F NRV2D 000000000000011c ucl_nrv2d_decompress_32
0000000000000000 g F NRV2B 00000000000000f0 ucl_nrv2b_decompress_32
0000000000000000 g F NRV2E 000000000000017c ucl_nrv2e_decompress_32
0000000000000000 g F NRV2D 0000000000000170 ucl_nrv2d_decompress_32
0000000000000000 g F NRV2B 0000000000000144 ucl_nrv2b_decompress_32
0000000000000000 g LZMA_DEC10 0000000000000000 LzmaDecode
0000000000000000 g MACHMAINY 0000000000000000 end_decompress

View File

@ -5,15 +5,15 @@ Idx Name Size VMA LMA File off Algn
0 ELFMAINX 00000008 0000000000000000 0000000000000000 00000040 2**0 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 0000000000000000 0000000000000000 00000048 2**0 CONTENTS, READONLY
2 NRV_TAIL 00000000 0000000000000000 0000000000000000 00000048 2**0 CONTENTS, READONLY
3 NRV2E 00000128 0000000000000000 0000000000000000 00000048 2**0 CONTENTS, READONLY
4 NRV2D 0000011c 0000000000000000 0000000000000000 00000170 2**0 CONTENTS, READONLY
5 NRV2B 000000f0 0000000000000000 0000000000000000 0000028c 2**0 CONTENTS, READONLY
6 LZMA_ELF00 000000b8 0000000000000000 0000000000000000 0000037c 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000968 0000000000000000 0000000000000000 00000434 2**0 CONTENTS, READONLY
8 LZMA_DEC10 0000049c 0000000000000000 0000000000000000 00000d9c 2**0 CONTENTS, READONLY
9 LZMA_DEC30 00000000 0000000000000000 0000000000000000 00001238 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 0000000000000000 0000000000000000 00001238 2**0 CONTENTS, READONLY
11 ELFMAINZ 00000138 0000000000000000 0000000000000000 00001278 2**2 CONTENTS, RELOC, READONLY
3 NRV2E 0000017c 0000000000000000 0000000000000000 00000048 2**0 CONTENTS, READONLY
4 NRV2D 00000170 0000000000000000 0000000000000000 000001c4 2**0 CONTENTS, READONLY
5 NRV2B 00000144 0000000000000000 0000000000000000 00000334 2**0 CONTENTS, READONLY
6 LZMA_ELF00 0000010c 0000000000000000 0000000000000000 00000478 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000968 0000000000000000 0000000000000000 00000584 2**0 CONTENTS, READONLY
8 LZMA_DEC10 0000049c 0000000000000000 0000000000000000 00000eec 2**0 CONTENTS, READONLY
9 LZMA_DEC30 00000000 0000000000000000 0000000000000000 00001388 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 0000000000000000 0000000000000000 00001388 2**0 CONTENTS, READONLY
11 ELFMAINZ 00000138 0000000000000000 0000000000000000 000013c8 2**2 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
0000000000000000 l d LZMA_DEC30 0000000000000000 LZMA_DEC30
0000000000000000 l d ELFMAINZ 0000000000000000 ELFMAINZ
@ -29,9 +29,9 @@ SYMBOL TABLE:
0000000000000000 l d ELFMAINY 0000000000000000 ELFMAINY
0000000000000000 *UND* 0000000000000000 MFLG
0000000000000004 g ELFMAINX 0000000000000000 _start
0000000000000000 g F NRV2E 0000000000000128 ucl_nrv2e_decompress_32
0000000000000000 g F NRV2D 000000000000011c ucl_nrv2d_decompress_32
0000000000000000 g F NRV2B 00000000000000f0 ucl_nrv2b_decompress_32
0000000000000000 g F NRV2E 000000000000017c ucl_nrv2e_decompress_32
0000000000000000 g F NRV2D 0000000000000170 ucl_nrv2d_decompress_32
0000000000000000 g F NRV2B 0000000000000144 ucl_nrv2b_decompress_32
0000000000000000 g LZMA_DEC10 0000000000000000 LzmaDecode
0000000000000000 g ELFMAINY 0000000000000000 end_decompress
0000000000000000 *UND* 0000000000000000 O_BINFO

View File

@ -5,18 +5,18 @@ Idx Name Size VMA LMA File off Algn
0 ELFMAINX 00000010 0000000000000000 0000000000000000 00000040 2**0 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 0000000000000000 0000000000000000 00000050 2**0 CONTENTS, READONLY
2 NRV_TAIL 00000000 0000000000000000 0000000000000000 00000050 2**0 CONTENTS, READONLY
3 NRV2E 00000128 0000000000000000 0000000000000000 00000050 2**0 CONTENTS, READONLY
4 NRV2D 0000011c 0000000000000000 0000000000000000 00000178 2**0 CONTENTS, READONLY
5 NRV2B 000000f0 0000000000000000 0000000000000000 00000294 2**0 CONTENTS, READONLY
6 LZMA_ELF00 000000b8 0000000000000000 0000000000000000 00000384 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000968 0000000000000000 0000000000000000 0000043c 2**0 CONTENTS, READONLY
8 LZMA_DEC10 0000049c 0000000000000000 0000000000000000 00000da4 2**0 CONTENTS, READONLY
9 LZMA_DEC30 00000000 0000000000000000 0000000000000000 00001240 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 0000000000000000 0000000000000000 00001240 2**0 CONTENTS, READONLY
11 ELFMAINZ 00000000 0000000000000000 0000000000000000 0000127e 2**0 CONTENTS, READONLY
12 ELFMAJNZ 00000024 0000000000000000 0000000000000000 0000127e 2**0 CONTENTS, READONLY
13 ANDMAJNZ 00000004 0000000000000000 0000000000000000 000012a2 2**0 CONTENTS, READONLY
14 ELFMAKNZ 000002a0 0000000000000000 0000000000000000 000012a6 2**0 CONTENTS, READONLY
3 NRV2E 0000017c 0000000000000000 0000000000000000 00000050 2**0 CONTENTS, READONLY
4 NRV2D 00000170 0000000000000000 0000000000000000 000001cc 2**0 CONTENTS, READONLY
5 NRV2B 00000144 0000000000000000 0000000000000000 0000033c 2**0 CONTENTS, READONLY
6 LZMA_ELF00 0000010c 0000000000000000 0000000000000000 00000480 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000968 0000000000000000 0000000000000000 0000058c 2**0 CONTENTS, READONLY
8 LZMA_DEC10 0000049c 0000000000000000 0000000000000000 00000ef4 2**0 CONTENTS, READONLY
9 LZMA_DEC30 00000000 0000000000000000 0000000000000000 00001390 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 0000000000000000 0000000000000000 00001390 2**0 CONTENTS, READONLY
11 ELFMAINZ 00000000 0000000000000000 0000000000000000 000013ce 2**0 CONTENTS, READONLY
12 ELFMAJNZ 00000024 0000000000000000 0000000000000000 000013ce 2**0 CONTENTS, READONLY
13 ANDMAJNZ 00000004 0000000000000000 0000000000000000 000013f2 2**0 CONTENTS, READONLY
14 ELFMAKNZ 000002a0 0000000000000000 0000000000000000 000013f6 2**0 CONTENTS, READONLY
SYMBOL TABLE:
0000000000000000 l d LZMA_DEC30 0000000000000000 LZMA_DEC30
0000000000000000 l d ELFMAINZ 0000000000000000 ELFMAINZ
@ -34,9 +34,9 @@ SYMBOL TABLE:
0000000000000000 l d ANDMAJNZ 0000000000000000 ANDMAJNZ
0000000000000000 l d ELFMAKNZ 0000000000000000 ELFMAKNZ
0000000000000000 g ELFMAINX 0000000000000000 _start
0000000000000000 g F NRV2E 0000000000000128 ucl_nrv2e_decompress_32
0000000000000000 g F NRV2D 000000000000011c ucl_nrv2d_decompress_32
0000000000000000 g F NRV2B 00000000000000f0 ucl_nrv2b_decompress_32
0000000000000000 g F NRV2E 000000000000017c ucl_nrv2e_decompress_32
0000000000000000 g F NRV2D 0000000000000170 ucl_nrv2d_decompress_32
0000000000000000 g F NRV2B 0000000000000144 ucl_nrv2b_decompress_32
0000000000000000 g LZMA_DEC10 0000000000000000 LzmaDecode
0000000000000000 g ELFMAINY 0000000000000000 end_decompress