summaryrefslogtreecommitdiff
path: root/utils/hwstub/stub/atj213x/crt0.S
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-01-18 14:36:27 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2017-01-24 15:34:19 +0100
commit9bb6050d40b9936beda5cb1cd15040f6c1b07179 (patch)
tree03fa1ad2b5d20db4cae1d8f7b75deb4d98fbdeee /utils/hwstub/stub/atj213x/crt0.S
parentf3cce72269703e983e4a4e6ec8dc9217b0c2b6fe (diff)
downloadrockbox-9bb6050d40b9936beda5cb1cd15040f6c1b07179.tar.gz
rockbox-9bb6050d40b9936beda5cb1cd15040f6c1b07179.zip
hwstub: rewrite exception catching
Since we can catch exceptions like data aborts on read/write, it takes very little to also catch exceptions in calls. When extending this with the catching of illegal instructions, the call instruction now becomes much more robust and also for address and instruction probing. Since we can catch several types of exception, rename set_data_abort_jmp to set_exception_jmp. At the same time, simplify the logic in read/write request handlers. Also fix a bug in ARM jump code: it was using stmia r1, {..., pc} as if pc would get current pc + 8 but this is actually implementation defined on older ARMs (typically pc + 12) and deprecated on newer ARMs, so rewrite the code avoid that. The set_exception_jmp() function now also reports the exception type. Change-Id: Icd0dd52d2456b361b27c4776be09c3d13528ed93
Diffstat (limited to 'utils/hwstub/stub/atj213x/crt0.S')
-rw-r--r--utils/hwstub/stub/atj213x/crt0.S15
1 files changed, 8 insertions, 7 deletions
diff --git a/utils/hwstub/stub/atj213x/crt0.S b/utils/hwstub/stub/atj213x/crt0.S
index 93cc57fc5e..5a3c81dc78 100644
--- a/utils/hwstub/stub/atj213x/crt0.S
+++ b/utils/hwstub/stub/atj213x/crt0.S
@@ -1,4 +1,5 @@
1#include "mips.h" 1#include "mips.h"
2#include "system.h"
2 3
3 .extern main 4 .extern main
4 .global start 5 .global start
@@ -134,12 +135,12 @@ stack_munge_loop:
134 jr.hb t0 135 jr.hb t0
135 ei 136 ei
136 137
137 .extern data_abort_jmp_ctx_ptr 138 .extern exception_jmp_ctx_ptr
138 .global tlb_refill_handler 139 .global tlb_refill_handler
139 .section .exception.tlb_refill,"ax",%progbits 140 .section .exception.tlb_refill,"ax",%progbits
140 141
141tlb_refill_handler: 142tlb_refill_handler:
142 la k1, data_abort_jmp_ctx_ptr 143 la k1, exception_jmp_ctx_ptr
143 lw s0, 0(k1) 144 lw s0, 0(k1)
144 lw s1, 4(k1) 145 lw s1, 4(k1)
145 lw s2, 8(k1) 146 lw s2, 8(k1)
@@ -153,7 +154,7 @@ tlb_refill_handler:
153 lw k1, 40(k1) 154 lw k1, 40(k1)
154 mtc0 k1, C0_EPC 155 mtc0 k1, C0_EPC
155 ehb 156 ehb
156 li v0, 1 157 li v0, EXCEPTION_ADDR
157 eret 158 eret
158 nop 159 nop
159 160
@@ -161,7 +162,7 @@ tlb_refill_handler:
161 .section .exception.cache_error,"ax",%progbits 162 .section .exception.cache_error,"ax",%progbits
162 163
163cache_error_handler: 164cache_error_handler:
164 la k1, data_abort_jmp_ctx_ptr 165 la k1, exception_jmp_ctx_ptr
165 lw s0, 0(k1) 166 lw s0, 0(k1)
166 lw s1, 4(k1) 167 lw s1, 4(k1)
167 lw s2, 8(k1) 168 lw s2, 8(k1)
@@ -175,7 +176,7 @@ cache_error_handler:
175 lw k1, 40(k1) 176 lw k1, 40(k1)
176 mtc0 k1, C0_EPC 177 mtc0 k1, C0_EPC
177 ehb 178 ehb
178 li v0, 1 179 li v0, EXCEPTION_ADDR
179 eret 180 eret
180 nop 181 nop
181 182
@@ -183,7 +184,7 @@ cache_error_handler:
183 .section .exception.general_exception,"ax",%progbits 184 .section .exception.general_exception,"ax",%progbits
184 185
185general_exception_handler: 186general_exception_handler:
186 la k1, data_abort_jmp_ctx_ptr 187 la k1, exception_jmp_ctx_ptr
187 lw s0, 0(k1) 188 lw s0, 0(k1)
188 lw s1, 4(k1) 189 lw s1, 4(k1)
189 lw s2, 8(k1) 190 lw s2, 8(k1)
@@ -197,7 +198,7 @@ general_exception_handler:
197 lw k1, 40(k1) 198 lw k1, 40(k1)
198 mtc0 k1, C0_EPC 199 mtc0 k1, C0_EPC
199 ehb 200 ehb
200 li v0, 1 201 li v0, EXCEPTION_UNSP
201 eret 202 eret
202 nop 203 nop
203 204