summaryrefslogtreecommitdiff
path: root/AT91SAM7S256/armdebug
diff options
context:
space:
mode:
authorTC Wan2010-12-17 09:59:03 +0800
committerTC Wan2010-12-17 09:59:03 +0800
commita097bcca3e556df8d2c473016cf3734bb9defdb8 (patch)
tree6b66950785bbfd03105e629b43c84eeea31c948c /AT91SAM7S256/armdebug
parent2e32cda30ad266069ecb9b8c93229b0269ba1547 (diff)
parente3a7c6a9da89b96f2b7026e71d8e3beb1f5bd140 (diff)
Merge branch 'master' of ssh://svc.cs.usm.my/~/gitrepo-bare/armdebug
Diffstat (limited to 'AT91SAM7S256/armdebug')
-rw-r--r--AT91SAM7S256/armdebug/Debugger/debug_stub.h24
-rw-r--r--AT91SAM7S256/armdebug/Debugger/undef_handler.S3
2 files changed, 26 insertions, 1 deletions
diff --git a/AT91SAM7S256/armdebug/Debugger/debug_stub.h b/AT91SAM7S256/armdebug/Debugger/debug_stub.h
index 0b1fee4..b090572 100644
--- a/AT91SAM7S256/armdebug/Debugger/debug_stub.h
+++ b/AT91SAM7S256/armdebug/Debugger/debug_stub.h
@@ -168,18 +168,42 @@ FUNCDEF void dbg__bkpt_handler(void);
* Equivalent to GDB breakpoint() routine for ARM code
*/
FUNCDEF void dbg_breakpoint_arm(void);
+inline void dbg_breakpoint_arm(void)
+{
+ asm volatile (".word %a0"
+ : /* Output (empty) */
+ : "X" (BKPT32_INSTR | BKPT32_MANUAL_BKPT)
+ );
+}
+
+#if 0 /* Old asm definitions, in case gas does not recognize %a0 operand */
+
#ifdef __ARM6OR7__
inline void dbg_breakpoint_arm(void) { asm volatile (".word 0xE727FF7F" /* (BKPT32_INSTR | BKPT32_MANUAL_BKPT) */ ); }
#else
inline void dbg_breakpoint_arm(void) { asm volatile (".word 0xE127FF7F" /* (BKPT32_INSTR | BKPT32_MANUAL_BKPT) */ ); }
#endif
+#endif
+
/** dbg_breakpoint_thumb.
* Equivalent to GDB breakpoint() routine for Thumb code
*/
FUNCDEF void dbg_breakpoint_thumb(void);
+inline void dbg_breakpoint_thumb(void)
+{
+ asm volatile (".hword %a0"
+ : /* Output (empty) */
+ : "X" (BKPT16_INSTR | BKPT16_MANUAL_BKPT)
+ );
+}
+
+#if 0 /* Old asm definitions, in case gas does not recognize %a0 operand */
+
inline void dbg_breakpoint_thumb(void) { asm volatile (".hword 0xBE7F" /* (BKPT16_INSTR | BKPT16_MANUAL_BKPT) */); }
+#endif
+
/*@}*/
#else
diff --git a/AT91SAM7S256/armdebug/Debugger/undef_handler.S b/AT91SAM7S256/armdebug/Debugger/undef_handler.S
index 61b8a5d..34154f7 100644
--- a/AT91SAM7S256/armdebug/Debugger/undef_handler.S
+++ b/AT91SAM7S256/armdebug/Debugger/undef_handler.S
@@ -35,7 +35,8 @@ undef_handler:
On entry, LR_undef points to one instruction past the UNDEF instruction
*/
ldr sp, =__debugger_stack__
- stmfd sp, {r0-r15}^ /* Save workspace, user mode's pc via 'S' flag */
+ stmfd sp, {r0-r15}^ /* Save workspace, user mode's pc via 'S' flag, R15: placeholder */
+ str lr, [sp, #-4] /* Keep User's Next Instr Pointer (in UNDEF SP) in user mode R15 */
sub sp, sp, #(4*16) /* Need to manually update SP(undef) */
mrs r1, spsr /* Copy SPSR to r0 */
tst r1, #CPSR_THUMB /* Check for Thumb Mode */