From 4431aea778ca4dd9c14ad1ed7edfa92aed80a0df Mon Sep 17 00:00:00 2001 From: funman Date: Sat, 12 Jun 2010 16:55:51 +0000 Subject: [PATCH] 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 --- firmware/target/arm/crt0.S | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/firmware/target/arm/crt0.S b/firmware/target/arm/crt0.S index 53b8a67ea..6def9a1a8 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 -- 2.11.4.GIT