summaryrefslogtreecommitdiff
path: root/Debugger/undef_handler.S
diff options
context:
space:
mode:
authorTC Wan2010-12-16 16:59:26 +0800
committerTC Wan2010-12-16 16:59:26 +0800
commit7da686d7774215a4d66e0b522e548bce5b70d189 (patch)
tree221f448221f1ed074acfc1252fbae50cfca3f774 /Debugger/undef_handler.S
parente0a7c25e589c3a7cc694eb28dfa687a0901f0757 (diff)
fix undef handler instruction address calculation, arm7 does not recognize bkpt instruction coding
The Undef handler was adding to instead of subtracting from PC to get the BKPT instruction address. ARM7 does not recognize BKPT instruction coding. Modified instruction code to use UNDEF instruction prefix instead. Refer Steve Furber, ARM SOC Architecture, 2nd Ed, pg 143
Diffstat (limited to 'Debugger/undef_handler.S')
-rw-r--r--Debugger/undef_handler.S4
1 files changed, 2 insertions, 2 deletions
diff --git a/Debugger/undef_handler.S b/Debugger/undef_handler.S
index 385bf0c..61b8a5d 100644
--- a/Debugger/undef_handler.S
+++ b/Debugger/undef_handler.S
@@ -41,7 +41,7 @@ undef_handler:
tst r1, #CPSR_THUMB /* Check for Thumb Mode */
beq _is_arm /* Clear, so it's ARM mode */
_is_thumb:
- sub r0, lr, #-2 /* LR points to instruction after UNDEF instruction */
+ sub r0, lr, #2 /* LR points to instruction after UNDEF instruction */
stmfd sp!, {r0,r1} /* Save UNDEF instruction addr and previous mode's CPSR to stack */
ldrh r0, [r0] /* load UNDEF instruction into r0 */
ldr r1, =BKPT16_ENUM_MASK /* Thumb BKPT enum mask */
@@ -55,7 +55,7 @@ _is_thumb:
ldr lr, =dbg__thumb_bkpt_handler /* handle BKPT, BKPT index in r0 */
mov pc, lr /* Invoke Debugger State (Supervisor Mode) */
_is_arm:
- sub r0, lr, #-4 /* LR points to instruction after UNDEF instruction */
+ sub r0, lr, #4 /* LR points to instruction after UNDEF instruction */
stmfd sp!, {r0,r1} /* Save UNDEF instruction addr and previous mode's CPSR to stack */
ldr r0, [r0] /* load UNDEF instruction into r0 */
ldr r1, =BKPT32_ENUM_MASK /* ARM BKPT enum mask */