1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Shorten runtime copying for armel-eabi-linux.shlib.

This commit is contained in:
John Reiser 2009-10-19 22:28:44 -07:00
parent 63da091d36
commit ba634118d7
5 changed files with 1387 additions and 1441 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,7 @@
#include "arch/arm/v5a/macros.S"
#define bkpt .long 0xe7f001f0 /* reserved instr; Linux GNU eabi breakpoint */
#define bkpt_th .short 0xde01 /* reserved instr; Linux GNU eabi breakpoint */
sz_Elf32_Ehdr = 13*4
sz_Elf32_Phdr = 8*4
@ -264,6 +265,9 @@ o_uncpr= -13*4
push esi // src; arglist ready for decompress step 6
p_uncpr= -17*4
and tmp,esi,#3 // length of prefix alignment
add ecx,ecx,#3 // allow suffix alignment
add ecx,ecx,tmp // prefix increases byte length
ldr tmp,[fp,#o_wfrag]; add edx,tmp,ecx,lsr #2 // w_srclen + w_frag
ldr tmp,[fp,#o_uncpr]; bl wlen_subr
ldr tmp,[fp,#o_unflt]; bl wlen_subr
@ -277,11 +281,12 @@ supervise:
mov arg3,#PROT_READ|PROT_WRITE
ldr arg2,[fp,#p_mprot+4] // dstlen
ldr arg1,[fp,#p_mprot ] // dst
do_sys __NR_mmap64; cmn r0,#4096; bcc 0f; bkpt; 0:
mov r6,arg1 // required result
do_sys __NR_mmap64; cmp r0,r6; beq 0f; bkpt; 0:
// Restore fragment of page below dst
ldr ecx,[fp,#o_wfrag]
mov edi,r0
//mov edi,r0 // NOP: edi==r0
ldr esi,[fp,#p_unmap]
bl movsl
@ -337,14 +342,20 @@ o_super= -18*4
str r0,[fp,#p_unmap+0*4] // address to unmap
ldr esi,[fp,#p_mprot]
mov edi,r0 // edi= dst
//mov edi,r0 // edi= dst NOP: edi==r0
ldr ecx,[fp,#o_wfrag] // w_fragment
bl movsl // copy the fragment
ldr ecx,[fp,#p_uncpr+1*4] // len
ldr esi,[fp,#p_uncpr+0*4] // src
str edi,[fp,#p_uncpr+0*4] // dst
bl memcpyW // copy compressed data
ldr ecx,[fp,#p_uncpr+1*4] // len
and tmp,esi,#3 // length of prefix alignment
sub esi,esi,tmp // down to word aligned
add ecx,ecx,tmp // prefix increases byte length
add tmp,tmp,edi // skip prefix at destination
str tmp,[fp,#p_uncpr+0*4] // dst
add ecx,ecx,#3 // round up to full words
lsr ecx,ecx,#2
bl movsl // copy all aligned words that contain compressed data
mov edx,edi // lo(dst) of copied code
@ -381,37 +392,6 @@ wlen_subr: // edx+= nwords of inline subr at *tmp
add edx,edx,tmp
ret
// dst (edi) is 4-byte aligned.
// src (esi) is unknown aligned
// cnt (ecx) is bytes
// Round up count to full words.
memcpyW:
add ecx,ecx,#3
lsr ecx,ecx,#2
tst esi,#3; beq movsl // 4-byte aligned
tst esi,#1; beq movsw2 // 2-byte aligned
movsb4:
ldrb tmp,[esi],#1
ldrb r6, [esi],#1
ldrb r12,[esi],#1
ldrb r7, [esi],#1
orr tmp,tmp,r6,lsl #8
orr r12,r12,r7,lsl #8
subs ecx,ecx,#1
orr tmp,tmp,r12,lsl #16
str tmp,[edi],#4
bne movsb4
ret
movsw2:
ldrh tmp,[esi],#2
ldrh r12,[esi],#2
subs ecx,ecx,#1
orr tmp,tmp,r12,lsl #16
str tmp,[edi],#4
bne movsw2
ret
/*__XTHEENDX__*/
/*
vi:ts=8:et:nowrap

View File

@ -13,7 +13,7 @@ Idx Name Size VMA LMA File off Algn Flags
8 LZMA_DEC10 00000478 00000000 00000000 00000d44 2**0 CONTENTS, RELOC, READONLY
9 LZMA_DEC30 00000000 00000000 00000000 000011bc 2**0 CONTENTS, READONLY
10 ELFMAINY 00000036 00000000 00000000 000011bc 2**0 CONTENTS, READONLY
11 ELFMAINZ 000002e4 00000000 00000000 000011f2 2**0 CONTENTS, RELOC, READONLY
11 ELFMAINZ 000002a4 00000000 00000000 000011f2 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
00000000 l d NRV2E 00000000 NRV2E
00000000 l d NRV2D 00000000 NRV2D
@ -251,21 +251,17 @@ OFFSET TYPE VALUE
000000b8 R_ARM_PC24 ELFMAINZ
000000dc R_ARM_PC24 ELFMAINZ
000000e4 R_ARM_PC24 ELFMAINZ
00000110 R_ARM_PC24 ELFMAINZ
00000118 R_ARM_PC24 ELFMAINZ
0000011c R_ARM_PC24 ELFMAINZ
0000013c R_ARM_PC24 ELFMAINZ
00000150 R_ARM_PC24 ELFMAINZ
00000168 R_ARM_PC24 ELFMAINZ
000001b4 R_ARM_PC24 ELFMAINZ
000001c4 R_ARM_PC24 ELFMAINZ
000001e8 R_ARM_PC24 ELFMAINZ
00000200 R_ARM_PC24 ELFMAINZ
00000210 R_ARM_PC24 ELFMAINZ
00000220 R_ARM_PC24 ELFMAINZ
0000022c R_ARM_PC24 ELFMAINZ
00000238 R_ARM_PC24 ELFMAINZ
00000290 R_ARM_PC24 ELFMAINZ
00000298 R_ARM_PC24 ELFMAINZ
000002c0 R_ARM_PC24 ELFMAINZ
000002dc R_ARM_PC24 ELFMAINZ
00000124 R_ARM_PC24 ELFMAINZ
00000128 R_ARM_PC24 ELFMAINZ
0000014c R_ARM_PC24 ELFMAINZ
0000015c R_ARM_PC24 ELFMAINZ
00000174 R_ARM_PC24 ELFMAINZ
000001c0 R_ARM_PC24 ELFMAINZ
000001d0 R_ARM_PC24 ELFMAINZ
000001f4 R_ARM_PC24 ELFMAINZ
00000208 R_ARM_PC24 ELFMAINZ
00000230 R_ARM_PC24 ELFMAINZ
00000240 R_ARM_PC24 ELFMAINZ
0000024c R_ARM_PC24 ELFMAINZ
00000258 R_ARM_PC24 ELFMAINZ

View File

@ -13,7 +13,7 @@ Idx Name Size VMA LMA File off Algn Flags
8 LZMA_DEC10 00000478 00000000 00000000 00000d84 2**0 CONTENTS, RELOC, READONLY
9 LZMA_DEC30 00000000 00000000 00000000 000011fc 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 00000000 00000000 000011fc 2**0 CONTENTS, READONLY
11 ELFMAINZ 00000328 00000000 00000000 0000123a 2**0 CONTENTS, RELOC, READONLY
11 ELFMAINZ 000002e8 00000000 00000000 0000123a 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
00000000 l d NRV2E 00000000 NRV2E
00000000 l d NRV2D 00000000 NRV2D
@ -251,21 +251,17 @@ OFFSET TYPE VALUE
000000b8 R_ARM_PC24 ELFMAINZ
000000dc R_ARM_PC24 ELFMAINZ
000000e4 R_ARM_PC24 ELFMAINZ
00000110 R_ARM_PC24 ELFMAINZ
00000118 R_ARM_PC24 ELFMAINZ
0000011c R_ARM_PC24 ELFMAINZ
00000148 R_ARM_PC24 ELFMAINZ
0000015c R_ARM_PC24 ELFMAINZ
00000174 R_ARM_PC24 ELFMAINZ
000001dc R_ARM_PC24 ELFMAINZ
000001ec R_ARM_PC24 ELFMAINZ
0000021c R_ARM_PC24 ELFMAINZ
00000234 R_ARM_PC24 ELFMAINZ
00000244 R_ARM_PC24 ELFMAINZ
00000254 R_ARM_PC24 ELFMAINZ
00000260 R_ARM_PC24 ELFMAINZ
0000026c R_ARM_PC24 ELFMAINZ
000002d4 R_ARM_PC24 ELFMAINZ
000002dc R_ARM_PC24 ELFMAINZ
00000304 R_ARM_PC24 ELFMAINZ
00000320 R_ARM_PC24 ELFMAINZ
00000124 R_ARM_PC24 ELFMAINZ
00000128 R_ARM_PC24 ELFMAINZ
00000158 R_ARM_PC24 ELFMAINZ
00000168 R_ARM_PC24 ELFMAINZ
00000180 R_ARM_PC24 ELFMAINZ
000001e8 R_ARM_PC24 ELFMAINZ
000001f8 R_ARM_PC24 ELFMAINZ
00000228 R_ARM_PC24 ELFMAINZ
0000023c R_ARM_PC24 ELFMAINZ
00000264 R_ARM_PC24 ELFMAINZ
00000274 R_ARM_PC24 ELFMAINZ
00000280 R_ARM_PC24 ELFMAINZ
0000028c R_ARM_PC24 ELFMAINZ