summaryrefslogtreecommitdiff
path: root/utils/hwstub/stub/jz4760b/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/jz4760b/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/jz4760b/crt0.S')
-rw-r--r--utils/hwstub/stub/jz4760b/crt0.S15
1 files changed, 10 insertions, 5 deletions
diff --git a/utils/hwstub/stub/jz4760b/crt0.S b/utils/hwstub/stub/jz4760b/crt0.S
index 94d95b3e73..4e1bcc5dbc 100644
--- a/utils/hwstub/stub/jz4760b/crt0.S
+++ b/utils/hwstub/stub/jz4760b/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
@@ -137,26 +138,30 @@ die_blink:
137 j .blink_loop 138 j .blink_loop
138 nop 139 nop
139 140
140/* restore_data_abort_jmp restores the context and returns from exception */ 141/* restore_exception_jmp restores the context and returns from exception, it takes
141 .extern restore_data_abort_jmp 142 * as argument the type of exception */
143 .extern restore_exception_jmp
142 144
143 .global tlb_refill_handler 145 .global tlb_refill_handler
144 .section .exception.tlb_refill,"ax",%progbits 146 .section .exception.tlb_refill,"ax",%progbits
145tlb_refill_handler: 147tlb_refill_handler:
146 la k0, restore_data_abort_jmp 148 li a0, EXCEPTION_ADDR
149 la k0, restore_exception_jmp
147 jr k0 150 jr k0
148 nop 151 nop
149 152
150 .global cache_error_handler 153 .global cache_error_handler
151 .section .exception.cache_error,"ax",%progbits 154 .section .exception.cache_error,"ax",%progbits
152cache_error_handler: 155cache_error_handler:
153 la k0, restore_data_abort_jmp 156 li a0, EXCEPTION_ADDR
157 la k0, restore_exception_jmp
154 jr k0 158 jr k0
155 nop 159 nop
156 160
157 .global general_exception_handler 161 .global general_exception_handler
158 .section .exception.general_exception,"ax",%progbits 162 .section .exception.general_exception,"ax",%progbits
159general_exception_handler: 163general_exception_handler:
160 la k0, restore_data_abort_jmp 164 li a0, EXCEPTION_UNSP
165 la k0, restore_exception_jmp
161 jr k0 166 jr k0
162 nop 167 nop