aboutsummaryrefslogtreecommitdiff
path: root/Debugger/debug_stub.S
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-03-18 12:51:07 +0800
committerTat-Chee Wan (USM)2011-03-18 12:51:07 +0800
commit51cf36077885f26e325739a60d45f822287a551f (patch)
treef6f29affa256088e57b95f7b065619c7b80310b4 /Debugger/debug_stub.S
parentd7e6d01799a0465c024bb0025476ffdfbbedfa93 (diff)
we should only invoke bkpt in ccommhandledebug in normal operation mode
Before invoking Breakpoint in cCommHandleDebug, we need to check if we're already in Abort (Debug) mode. Refactored header files to allow access to Mode Bit definitions from other files.
Diffstat (limited to 'Debugger/debug_stub.S')
-rw-r--r--Debugger/debug_stub.S9
1 files changed, 8 insertions, 1 deletions
diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S
index 29e7814..5633db5 100644
--- a/Debugger/debug_stub.S
+++ b/Debugger/debug_stub.S
@@ -400,9 +400,16 @@ debug_armComplexCCTable:
*/
cCommHandleDebug:
push {r0-r3} /* store all argX registers */
- bl dbg__copyNxtDebugMsg /* setup Debugger Message Buffers, validate input */
+ bl dbg__copyNxtDebugMsg /* setup Debugger Message Buffers, validate input, CPSR returned in R0 */
+ and r0, r0, #CPSR_MODE /* Check Current Mode */
+ cmp r0, #MODE_ABT /* Debug Mode Check (Flags set) */
pop {r0-r3} /* restore all values */
+
+ /* If we're in ABT (Abort) mode, this means that we're already running the Debugger */
+ beq _in_debug
+ /* Else, we're in normal operation mode (SVC), or other mode (??!) and need to force a switch to Debug mode */
dbg__bkpt_thumb
+_in_debug:
mov r0, #0 /* FIXME: Return Status */
bx lr
#endif