Fix vmlinux/ppc32 at compress time. Runtime needs work.

This commit is contained in:
John Reiser
2010-04-28 20:43:50 -07:00
parent 99a208110b
commit ffec71e0d8
4 changed files with 566 additions and 507 deletions
+6 -3
View File
@@ -986,11 +986,14 @@ void PackVmlinuxPPC32::buildLoader(const Filter *ft)
addFilter32(ft->id);
}
addLoader("LINUX030", NULL);
if (ph.method == M_NRV2E_LE32) addLoader("NRV2E", NULL);
else if (ph.method == M_NRV2B_LE32) addLoader("NRV2B", NULL);
else if (ph.method == M_NRV2D_LE32) addLoader("NRV2D", NULL);
if (ph.method == M_NRV2E_LE32) addLoader("NRV2E,NRV_TAIL", NULL);
else if (ph.method == M_NRV2B_LE32) addLoader("NRV2B,NRV_TAIL", NULL);
else if (ph.method == M_NRV2D_LE32) addLoader("NRV2D,NRV_TAIL", NULL);
else if (M_IS_LZMA(ph.method)) addLoader("LZMA_ELF00,LZMA_DEC10,LZMA_DEC30", NULL);
else throwBadLoader();
if (hasLoaderSection("CFLUSH"))
addLoader("CFLUSH");
addLoader("IDENTSTR,UPX1HEAD", NULL);
}
File diff suppressed because it is too large Load Diff
@@ -90,6 +90,42 @@ section NRV2D
section NRV2E
#include "arch/powerpc/32/nrv2e_d.S"
section NRV_TAIL
eof_nrv:
#define dst0 a4
#define tmp a1
lwz dst0,0(ldst) // original dst
mtlr t3 // return address
subf a0,lsrc,src
subf tmp,dst0,dst // -1+ dst length
addi a0,a0,1 // return 0: good; else: bad [+1: correct for lbzu]
addi tmp,tmp,1 // dst length
stw tmp,0(ldst)
#undef tmp
// CACHELINE=32 is the observed minimum line size of any cache.
// Some caches may have larger lines, but it is cumbersome to lookup
// {AT_DCACHEBSIZE, AT_ICACHEBSIZE, AT_UCACHEBSIZE: /usr/include/elf.h},
// then save the correct size in a variable {where to put it?}, or to modify
// the two instructions here. If a cache has larger lines, then we expect
// that the second dcbst (or icbi) on a the same line will be fast.
// If not, then too bad.
section CFLUSH // In: a2=dst= &highest stored byte; a4=dst0= &lowest stored byte
CACHELINE=32
ori dst0,dst0,-1+ CACHELINE // highest addr on cache line
cfl_nrv:
dcbst 0,dst0 // initiate store (modified) cacheline to memory
cmpl cr0,dst0,dst // did we cover the highest-addressed byte?
icbi 0,dst0 // discard instructions from cacheline
addi dst0,dst0,CACHELINE // highest addr on next line
blt cr0,cfl_nrv // not done yet
#undef dst0
sync // wait for all memory operations to finish
isync // discard prefetched instructions (if any)
cfl_ret:
ret
#undef hibit
#undef src
@@ -9,21 +9,25 @@ Idx Name Size VMA LMA File off Algn Flags
4 NRV2B 000000f0 00000000 00000000 000000a8 2**0 CONTENTS, RELOC, READONLY
5 NRV2D 0000012c 00000000 00000000 00000198 2**0 CONTENTS, RELOC, READONLY
6 NRV2E 00000148 00000000 00000000 000002c4 2**0 CONTENTS, RELOC, READONLY
7 LZMA 00000000 00000000 00000000 0000040c 2**0 CONTENTS, READONLY
8 LZMA_ELF00 0000008c 00000000 00000000 0000040c 2**0 CONTENTS, RELOC, READONLY
9 LZMA_DEC10 0000099c 00000000 00000000 00000498 2**0 CONTENTS, READONLY
10 LZMA_DEC20 0000099c 00000000 00000000 00000e34 2**0 CONTENTS, READONLY
11 LZMA_DEC30 00000020 00000000 00000000 000017d0 2**0 CONTENTS, READONLY
12 UPX1HEAD 00000020 00000000 00000000 000017f0 2**0 CONTENTS, READONLY
7 NRV_TAIL 0000001c 00000000 00000000 0000040c 2**0 CONTENTS, READONLY
8 CFLUSH 00000024 00000000 00000000 00000428 2**0 CONTENTS, READONLY
9 LZMA 00000000 00000000 00000000 0000044c 2**0 CONTENTS, READONLY
10 LZMA_ELF00 0000008c 00000000 00000000 0000044c 2**0 CONTENTS, RELOC, READONLY
11 LZMA_DEC10 0000099c 00000000 00000000 000004d8 2**0 CONTENTS, READONLY
12 LZMA_DEC20 0000099c 00000000 00000000 00000e74 2**0 CONTENTS, READONLY
13 LZMA_DEC30 00000020 00000000 00000000 00001810 2**0 CONTENTS, READONLY
14 UPX1HEAD 00000020 00000000 00000000 00001830 2**0 CONTENTS, READONLY
SYMBOL TABLE:
00000000 l d LINUX020 00000000 LINUX020
00000000 l d LINUX030 00000000 LINUX030
00000000 l d NRV_TAIL 00000000 NRV_TAIL
00000000 l d LZMA_DEC30 00000000 LZMA_DEC30
00000000 l d LINUX000 00000000 LINUX000
00000000 l d LINUX010 00000000 LINUX010
00000000 l d NRV2B 00000000 NRV2B
00000000 l d NRV2D 00000000 NRV2D
00000000 l d NRV2E 00000000 NRV2E
00000000 l d CFLUSH 00000000 CFLUSH
00000000 l d LZMA 00000000 LZMA
00000000 l d LZMA_ELF00 00000000 LZMA_ELF00
00000000 l d LZMA_DEC10 00000000 LZMA_DEC10
@@ -31,7 +35,6 @@ SYMBOL TABLE:
00000000 l d UPX1HEAD 00000000 UPX1HEAD
00000000 *UND* 00000000 filter_length
00000000 *UND* 00000000 filter_cto
00000000 *UND* 00000000 eof_nrv
RELOCATION RECORDS FOR [LINUX000]:
OFFSET TYPE VALUE
@@ -45,15 +48,15 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [NRV2B]:
OFFSET TYPE VALUE
00000090 R_PPC_REL14 eof_nrv
00000090 R_PPC_REL14 NRV_TAIL
RELOCATION RECORDS FOR [NRV2D]:
OFFSET TYPE VALUE
000000b4 R_PPC_REL14 eof_nrv
000000b4 R_PPC_REL14 NRV_TAIL
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
000000b4 R_PPC_REL14 eof_nrv
000000b4 R_PPC_REL14 NRV_TAIL
RELOCATION RECORDS FOR [LZMA_ELF00]:
OFFSET TYPE VALUE