diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2023-09-27 22:29:10 +0200 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2023-09-27 22:49:33 +0200 |
commit | 609db995d5ac0fb6c538c5f4e9e4e449235f7c76 (patch) | |
tree | 030675f75d08c8a808c8f389477406b7b54ddea4 | |
parent | bf8191421701b62da4be9bbd3f2ce8ac4309e101 (diff) | |
download | rockbox-609db995d5ac0fb6c538c5f4e9e4e449235f7c76.tar.gz rockbox-609db995d5ac0fb6c538c5f4e9e4e449235f7c76.zip |
hwstub: Remove code duplication in ATJ213x exception handling
-rw-r--r-- | utils/hwstub/stub/atj213x/crt0.S | 57 |
1 files changed, 9 insertions, 48 deletions
diff --git a/utils/hwstub/stub/atj213x/crt0.S b/utils/hwstub/stub/atj213x/crt0.S index 5a3c81dc78..7d5bcde9b2 100644 --- a/utils/hwstub/stub/atj213x/crt0.S +++ b/utils/hwstub/stub/atj213x/crt0.S | |||
@@ -140,66 +140,27 @@ stack_munge_loop: | |||
140 | .section .exception.tlb_refill,"ax",%progbits | 140 | .section .exception.tlb_refill,"ax",%progbits |
141 | 141 | ||
142 | tlb_refill_handler: | 142 | tlb_refill_handler: |
143 | la k1, exception_jmp_ctx_ptr | 143 | li a0, EXCEPTION_ADDR |
144 | lw s0, 0(k1) | 144 | la k0, restore_exception_jmp |
145 | lw s1, 4(k1) | 145 | jr k0 |
146 | lw s2, 8(k1) | ||
147 | lw s3, 12(k1) | ||
148 | lw s4, 16(k1) | ||
149 | lw s5, 20(k1) | ||
150 | lw s6, 24(k1) | ||
151 | lw s7, 28(k1) | ||
152 | lw sp, 32(k1) | ||
153 | lw s8, 36(k1) | ||
154 | lw k1, 40(k1) | ||
155 | mtc0 k1, C0_EPC | ||
156 | ehb | ||
157 | li v0, EXCEPTION_ADDR | ||
158 | eret | ||
159 | nop | 146 | nop |
160 | 147 | ||
161 | .global cache_error_handler | 148 | .global cache_error_handler |
162 | .section .exception.cache_error,"ax",%progbits | 149 | .section .exception.cache_error,"ax",%progbits |
163 | 150 | ||
164 | cache_error_handler: | 151 | cache_error_handler: |
165 | la k1, exception_jmp_ctx_ptr | 152 | li a0, EXCEPTION_ADDR |
166 | lw s0, 0(k1) | 153 | la k0, restore_exception_jmp |
167 | lw s1, 4(k1) | 154 | jr k0 |
168 | lw s2, 8(k1) | ||
169 | lw s3, 12(k1) | ||
170 | lw s4, 16(k1) | ||
171 | lw s5, 20(k1) | ||
172 | lw s6, 24(k1) | ||
173 | lw s7, 28(k1) | ||
174 | lw sp, 32(k1) | ||
175 | lw s8, 36(k1) | ||
176 | lw k1, 40(k1) | ||
177 | mtc0 k1, C0_EPC | ||
178 | ehb | ||
179 | li v0, EXCEPTION_ADDR | ||
180 | eret | ||
181 | nop | 155 | nop |
182 | 156 | ||
183 | .global general_exception_handler | 157 | .global general_exception_handler |
184 | .section .exception.general_exception,"ax",%progbits | 158 | .section .exception.general_exception,"ax",%progbits |
185 | 159 | ||
186 | general_exception_handler: | 160 | general_exception_handler: |
187 | la k1, exception_jmp_ctx_ptr | 161 | li a0, EXCEPTION_UNSP |
188 | lw s0, 0(k1) | 162 | la k0, restore_exception_jmp |
189 | lw s1, 4(k1) | 163 | jr k0 |
190 | lw s2, 8(k1) | ||
191 | lw s3, 12(k1) | ||
192 | lw s4, 16(k1) | ||
193 | lw s5, 20(k1) | ||
194 | lw s6, 24(k1) | ||
195 | lw s7, 28(k1) | ||
196 | lw sp, 32(k1) | ||
197 | lw s8, 36(k1) | ||
198 | lw k1, 40(k1) | ||
199 | mtc0 k1, C0_EPC | ||
200 | ehb | ||
201 | li v0, EXCEPTION_UNSP | ||
202 | eret | ||
203 | nop | 164 | nop |
204 | 165 | ||
205 | /* s0-s7 not saved as this are callee saved registers | 166 | /* s0-s7 not saved as this are callee saved registers |