summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/crt0.S
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-06-12 16:55:51 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-06-12 16:55:51 +0000
commit646a999e35f5724affaa06fbfac183ca4d80d0c9 (patch)
treef749a36ae22b680f3ba86b40461afa468b6ba5b7 /firmware/target/arm/crt0.S
parenta331e0d3fb5b108abc0ac78ba061f70831b06645 (diff)
downloadrockbox-646a999e35f5724affaa06fbfac183ca4d80d0c9.tar.gz
rockbox-646a999e35f5724affaa06fbfac183ca4d80d0c9.zip
Sansa AMS: call the exception handler with the correct address when the exception happened in Thumb state
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26818 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/crt0.S')
-rw-r--r--firmware/target/arm/crt0.S7
1 files changed, 6 insertions, 1 deletions
diff --git a/firmware/target/arm/crt0.S b/firmware/target/arm/crt0.S
index 53b8a67ea1..6def9a1a88 100644
--- a/firmware/target/arm/crt0.S
+++ b/firmware/target/arm/crt0.S
@@ -181,7 +181,12 @@ newstart:
* we're in. Second parameter is exception number, used for a string lookup
* in UIE. */
undef_instr_handler:
- sub r0, lr, #4
+ sub r0, lr, #4 @ r0 points to the faulty ARM instruction
+#ifdef USE_THUMB
+ mrs r1, spsr
+ tst r1, #(1<<5) @ T bit set ?
+ subne r0, lr, #2 @ if yes, r0 points to the faulty THUMB instruction
+#endif /* USE_THUMB */
mov r1, #0
b UIE