Big-endian MIPS must fetch NRV 32-bit "control" words as little endian.

This commit is contained in:
John Reiser
2008-04-01 20:06:27 -07:00
parent 271031128e
commit 2a6f90c5f3
7 changed files with 714 additions and 674 deletions
File diff suppressed because it is too large Load Diff
+77 -9
View File
@@ -133,7 +133,7 @@
;// init decompressor
;//////////////////////////////////////
.macro init
.macro init gb_subr
init_sz = .
@@ -154,10 +154,48 @@ init_sz = .
move bb,bc
.endif
.endif
li last_m_off,1
.if (src != src_ilen)
move src_ilen,src
.endif
.ifnb gb_subr
.if (BIG_ENDIAN == 1)
.if (JOHN != 1) || (UCL_SMALL != 1) || (ALT_SMALL != 1)
.error "assume 1==JOHN==UCL_SMALL==ALT_SMALL"
.endif
local around, refill
gb_e = gb_subr
b around
li last_m_off,1
refill:
// "lw bb,0(src_ilen)" of little-endian, unaligned data
lbu bb,3(src_ilen)
lbu var,2(src_ilen)
sll bb,bb,8
or bb,bb,var
lbu var,1(src_ilen)
sll bb,bb,8
or bb,bb,var
lbu var,0(src_ilen)
sll bb,bb,8
or bb,bb,var
addiu src_ilen,4
srl var,bb,31 # var= most significant bit of bb
sll bb,1
jr ra
addiu bb,1 # the flag bit
gb_subr:
beq bc,bb,refill # detect empty
srl var,bb,31 # var= most significant bit of bb
jr ra
sll bb,1
around:
.else
li last_m_off,1
.endif
.else
li last_m_off,1
.endif
init_sz = . - init_sz
@@ -262,27 +300,57 @@ init_sz = . - init_sz
.endm
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 0
#endif
.macro FILLBYTES_32
.if (JOHN == 0)
.if (UCL_SMALL == 1)
li bc,32
.else
li bc,31
.endif
.if (BIG_ENDIAN == 1)
// "lw bb,0(src_ilen)" of little-endian, unaligned data
lbu bb,3(src_ilen)
lbu tmp,2(src_ilen)
sll bb,bb,8
or bb,bb,tmp
lbu tmp,1(src_ilen)
sll bb,bb,8
or bb,bb,tmp
lbu tmp,0(src_ilen)
sll bb,bb,8
or bb,bb,tmp
.else // LITTLE_ENDIAN
lwr bb,0(src_ilen)
lwl bb,3(src_ilen)
.endif
addiu src_ilen,4
.if (UCL_SMALL == 1)
li bc,32
.else
li bc,31
.endif
.else // John's method
.if (ALT_SMALL == 0)
.if (UCL_SMALL == 1)
li bc,32
.endif
.endif
.if (BIG_ENDIAN == 1)
// "lw bb,0(src_ilen)" of little-endian, unaligned data
lbu bb,3(src_ilen)
lbu tmp,2(src_ilen)
sll bb,bb,8
or bb,bb,tmp
lbu tmp,1(src_ilen)
sll bb,bb,8
or bb,bb,tmp
lbu tmp,0(src_ilen)
sll bb,bb,8
or bb,bb,tmp
.else // LITTLE_ENDIAN
lwr bb,0(src_ilen)
lwl bb,3(src_ilen)
.endif
addiu src_ilen,4
.if ((ALT_SMALL == 1) && (UCL_SMALL == 1))
srl var,bb,31 # var= most significant bit of bb
@@ -43,7 +43,7 @@
local n2b_1, n2b_2, n2b_3
local n2b_4, n2b_5, n2b_6
init
init gb_nrv2b
n2b_1:
GETBIT
li m_off,1
@@ -43,7 +43,7 @@
local n2d_1, n2d_2, n2d_3, n2d_4
local n2d_5, n2d_6, n2d_7
init
init gb_nrv2d
n2d_1:
GETBIT
li m_off,1
@@ -43,7 +43,7 @@
local n2e_1, n2e_2, n2e_3, n2e_4
local n2e_5, n2e_6, n2e_7
init
init gb_nrv2e
n2e_1:
GETBIT
li m_off,1
@@ -1 +1,5 @@
#define BIG_ENDIAN 1
WITHOUT_SUB = 1
UCL_SMALL = 1
#include "mipsel.r3000-linux.elf-entry.S"
@@ -3,18 +3,18 @@ file format elf32-bigmips
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 00000020 00000000 00000000 00000034 2**0 CONTENTS, RELOC, READONLY
1 NRV2E 00000218 00000000 00000000 00000054 2**0 CONTENTS, RELOC, READONLY
2 NRV2D 000001f0 00000000 00000000 0000026c 2**0 CONTENTS, RELOC, READONLY
3 NRV2B 000001b4 00000000 00000000 0000045c 2**0 CONTENTS, RELOC, READONLY
4 LZMA_ELF00 0000009c 00000000 00000000 00000610 2**0 CONTENTS, READONLY
5 LZMA_DEC20 00000ad8 00000000 00000000 000006ac 2**0 CONTENTS, READONLY
6 LZMA_DEC10 00000ad8 00000000 00000000 00001184 2**0 CONTENTS, READONLY
7 LZMA_DEC30 00000004 00000000 00000000 00001c5c 2**0 CONTENTS, READONLY
8 NRV_HEAD 00000008 00000000 00000000 00001c60 2**0 CONTENTS, READONLY
9 NRV_TAIL 00000010 00000000 00000000 00001c68 2**0 CONTENTS, READONLY
10 CFLUSH 00000024 00000000 00000000 00001c78 2**0 CONTENTS, READONLY
11 ELFMAINY 0000002a 00000000 00000000 00001c9c 2**0 CONTENTS, RELOC, READONLY
12 ELFMAINZ 000000bc 00000000 00000000 00001cc6 2**0 CONTENTS, READONLY
1 NRV2E 00000150 00000000 00000000 00000054 2**0 CONTENTS, RELOC, READONLY
2 NRV2D 00000140 00000000 00000000 000001a4 2**0 CONTENTS, RELOC, READONLY
3 NRV2B 00000128 00000000 00000000 000002e4 2**0 CONTENTS, RELOC, READONLY
4 LZMA_ELF00 0000009c 00000000 00000000 0000040c 2**0 CONTENTS, READONLY
5 LZMA_DEC20 00000ad8 00000000 00000000 000004a8 2**0 CONTENTS, READONLY
6 LZMA_DEC10 00000ad8 00000000 00000000 00000f80 2**0 CONTENTS, READONLY
7 LZMA_DEC30 00000004 00000000 00000000 00001a58 2**0 CONTENTS, READONLY
8 NRV_HEAD 00000008 00000000 00000000 00001a5c 2**0 CONTENTS, READONLY
9 NRV_TAIL 00000010 00000000 00000000 00001a64 2**0 CONTENTS, READONLY
10 CFLUSH 00000024 00000000 00000000 00001a74 2**0 CONTENTS, READONLY
11 ELFMAINY 0000002a 00000000 00000000 00001a98 2**0 CONTENTS, RELOC, READONLY
12 ELFMAINZ 000000bc 00000000 00000000 00001ac2 2**0 CONTENTS, READONLY
SYMBOL TABLE:
00000000 l d NRV_TAIL 00000000 NRV_TAIL
00000000 l d ELFMAINZ 00000000 ELFMAINZ
@@ -49,15 +49,15 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
0000011c R_MIPS_PC16 NRV_TAIL
000000cc R_MIPS_PC16 NRV_TAIL
RELOCATION RECORDS FOR [NRV2D]:
OFFSET TYPE VALUE
0000011c R_MIPS_PC16 NRV_TAIL
000000cc R_MIPS_PC16 NRV_TAIL
RELOCATION RECORDS FOR [NRV2B]:
OFFSET TYPE VALUE
000000c4 R_MIPS_PC16 NRV_TAIL
000000b4 R_MIPS_PC16 NRV_TAIL
RELOCATION RECORDS FOR [ELFMAINY]:
OFFSET TYPE VALUE