diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2014-03-03 13:21:32 +0100 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2014-03-03 13:21:32 +0100 |
commit | 5900bf731518799d5a9bfb598a44d7a21155fa54 (patch) | |
tree | 890fcbb94f65bc586989915c613ff322b0af4849 /firmware/target/mips/ingenic_jz47xx/crt0.S | |
parent | 3ae07d48a2182fc3b1f8e9b15e6366ff32b92e25 (diff) | |
download | rockbox-5900bf731518799d5a9bfb598a44d7a21155fa54.tar.gz rockbox-5900bf731518799d5a9bfb598a44d7a21155fa54.zip |
ingenic: Tweak a few details in crt0.S
1) Avoid load/store delay slot by reorganizing instructions
in copy loops
2) Fix off-by-one error in cache initialization code.
This was harmless as it simply set line0 twice, now it sets
every cacheline only once.
3) Fix off-by-word error in .bss clearing loop.
The addiu in branch delay slot even if calculated is not seen
by the branch instruction itself, so the code did one word
too much in clearing.
4) Fix off-by-word error in deadbeefing stack.
See above.
Change-Id: Iabb09a55979de7aa2e2b9234273683fc7e9762c5
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/crt0.S')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/crt0.S | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/crt0.S b/firmware/target/mips/ingenic_jz47xx/crt0.S index 7035c5ab0b..16751ba0f6 100644 --- a/firmware/target/mips/ingenic_jz47xx/crt0.S +++ b/firmware/target/mips/ingenic_jz47xx/crt0.S | |||
@@ -60,10 +60,10 @@ | |||
60 | la t2, _bootend | 60 | la t2, _bootend |
61 | _relocate_loop: | 61 | _relocate_loop: |
62 | lw t3, 0(t0) | 62 | lw t3, 0(t0) |
63 | sw t3, 0(t1) | ||
64 | addiu t1, 4 | 63 | addiu t1, 4 |
65 | bne t1, t2, _relocate_loop | ||
66 | addiu t0, 4 | 64 | addiu t0, 4 |
65 | bne t1, t2, _relocate_loop | ||
66 | sw t3, 0(t1) | ||
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | _start: | 69 | _start: |
@@ -104,8 +104,8 @@ _start: | |||
104 | _cache_loop: | 104 | _cache_loop: |
105 | cache 0x8, 0(t0) # index store icache tag | 105 | cache 0x8, 0(t0) # index store icache tag |
106 | cache 0x9, 0(t0) # index store dcache tag | 106 | cache 0x9, 0(t0) # index store dcache tag |
107 | bne t0, t1, _cache_loop | ||
108 | addiu t0, t0, 0x20 # 32 bytes per cache line | 107 | addiu t0, t0, 0x20 # 32 bytes per cache line |
108 | bne t0, t1, _cache_loop | ||
109 | nop | 109 | nop |
110 | 110 | ||
111 | /* | 111 | /* |
@@ -131,11 +131,11 @@ _cache_loop: | |||
131 | la t2, _iramend | 131 | la t2, _iramend |
132 | _iram_loop: | 132 | _iram_loop: |
133 | lw t3, 0(t0) | 133 | lw t3, 0(t0) |
134 | sw t3, 0(t1) | ||
135 | addiu t1, 4 | 134 | addiu t1, 4 |
136 | bne t1, t2, _iram_loop | ||
137 | addiu t0, 4 | 135 | addiu t0, 4 |
138 | 136 | bne t1, t2, _iram_loop | |
137 | sw t3, 0(t1) | ||
138 | |||
139 | /* | 139 | /* |
140 | ---------------------------------------------------- | 140 | ---------------------------------------------------- |
141 | Clear BSS section | 141 | Clear BSS section |
@@ -144,9 +144,9 @@ _iram_loop: | |||
144 | la t0, _edata | 144 | la t0, _edata |
145 | la t1, _end | 145 | la t1, _end |
146 | _bss_loop: | 146 | _bss_loop: |
147 | sw zero, 0(t0) | 147 | addiu t1, -4 |
148 | bne t0, t1, _bss_loop | 148 | bne t0, t1, _bss_loop |
149 | addiu t0, 4 | 149 | sw zero, 0(t1) |
150 | 150 | ||
151 | /* | 151 | /* |
152 | ---------------------------------------------------- | 152 | ---------------------------------------------------- |
@@ -155,12 +155,13 @@ _bss_loop: | |||
155 | */ | 155 | */ |
156 | la sp, stackend | 156 | la sp, stackend |
157 | la t0, stackbegin | 157 | la t0, stackbegin |
158 | li t1, 0xDEADBEEF | 158 | move t1, sp |
159 | li t2, 0xDEADBEEF | ||
159 | 160 | ||
160 | _stack_loop: | 161 | _stack_loop: |
161 | sw t1, 0(t0) | 162 | addiu t1, -4 |
162 | bne t0, sp, _stack_loop | 163 | bne t0, t1, _stack_loop |
163 | addiu t0, t0, 4 | 164 | sw t2, 0(t1) |
164 | 165 | ||
165 | /* | 166 | /* |
166 | ---------------------------------------------------- | 167 | ---------------------------------------------------- |