aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/xmon/xmon.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc/xmon/xmon.c')
-rw-r--r--arch/ppc/xmon/xmon.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/arch/ppc/xmon/xmon.c b/arch/ppc/xmon/xmon.c
index 37d234f93394..b1a91744fd2d 100644
--- a/arch/ppc/xmon/xmon.c
+++ b/arch/ppc/xmon/xmon.c
@@ -153,6 +153,12 @@ static int xmon_trace[NR_CPUS];
153#define SSTEP 1 /* stepping because of 's' command */ 153#define SSTEP 1 /* stepping because of 's' command */
154#define BRSTEP 2 /* stepping over breakpoint */ 154#define BRSTEP 2 /* stepping over breakpoint */
155 155
156#ifdef CONFIG_4xx
157#define MSR_SSTEP_ENABLE 0x200
158#else
159#define MSR_SSTEP_ENABLE 0x400
160#endif
161
156static struct pt_regs *xmon_regs[NR_CPUS]; 162static struct pt_regs *xmon_regs[NR_CPUS];
157 163
158extern inline void sync(void) 164extern inline void sync(void)
@@ -211,6 +217,14 @@ static void get_tb(unsigned *p)
211 p[1] = lo; 217 p[1] = lo;
212} 218}
213 219
220static inline void xmon_enable_sstep(struct pt_regs *regs)
221{
222 regs->msr |= MSR_SSTEP_ENABLE;
223#ifdef CONFIG_4xx
224 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
225#endif
226}
227
214int xmon(struct pt_regs *excp) 228int xmon(struct pt_regs *excp)
215{ 229{
216 struct pt_regs regs; 230 struct pt_regs regs;
@@ -254,10 +268,10 @@ int xmon(struct pt_regs *excp)
254 cmd = cmds(excp); 268 cmd = cmds(excp);
255 if (cmd == 's') { 269 if (cmd == 's') {
256 xmon_trace[smp_processor_id()] = SSTEP; 270 xmon_trace[smp_processor_id()] = SSTEP;
257 excp->msr |= 0x400; 271 xmon_enable_sstep(excp);
258 } else if (at_breakpoint(excp->nip)) { 272 } else if (at_breakpoint(excp->nip)) {
259 xmon_trace[smp_processor_id()] = BRSTEP; 273 xmon_trace[smp_processor_id()] = BRSTEP;
260 excp->msr |= 0x400; 274 xmon_enable_sstep(excp);
261 } else { 275 } else {
262 xmon_trace[smp_processor_id()] = 0; 276 xmon_trace[smp_processor_id()] = 0;
263 insert_bpts(); 277 insert_bpts();
@@ -298,7 +312,7 @@ xmon_bpt(struct pt_regs *regs)
298 remove_bpts(); 312 remove_bpts();
299 excprint(regs); 313 excprint(regs);
300 xmon_trace[smp_processor_id()] = BRSTEP; 314 xmon_trace[smp_processor_id()] = BRSTEP;
301 regs->msr |= 0x400; 315 xmon_enable_sstep(regs);
302 } else { 316 } else {
303 xmon(regs); 317 xmon(regs);
304 } 318 }
@@ -385,7 +399,7 @@ insert_bpts(void)
385 } 399 }
386 store_inst((void *) bp->address); 400 store_inst((void *) bp->address);
387 } 401 }
388#if !defined(CONFIG_8xx) 402#if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx))
389 if (dabr.enabled) 403 if (dabr.enabled)
390 set_dabr(dabr.address); 404 set_dabr(dabr.address);
391 if (iabr.enabled) 405 if (iabr.enabled)
@@ -400,7 +414,7 @@ remove_bpts(void)
400 struct bpt *bp; 414 struct bpt *bp;
401 unsigned instr; 415 unsigned instr;
402 416
403#if !defined(CONFIG_8xx) 417#if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx))
404 set_dabr(0); 418 set_dabr(0);
405 set_iabr(0); 419 set_iabr(0);
406#endif 420#endif
@@ -677,7 +691,7 @@ bpt_cmds(void)
677 691
678 cmd = inchar(); 692 cmd = inchar();
679 switch (cmd) { 693 switch (cmd) {
680#if !defined(CONFIG_8xx) 694#if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx))
681 case 'd': 695 case 'd':
682 mode = 7; 696 mode = 7;
683 cmd = inchar(); 697 cmd = inchar();
@@ -792,7 +806,7 @@ backtrace(struct pt_regs *excp)
792 for (; sp != 0; sp = stack[0]) { 806 for (; sp != 0; sp = stack[0]) {
793 if (mread(sp, stack, sizeof(stack)) != sizeof(stack)) 807 if (mread(sp, stack, sizeof(stack)) != sizeof(stack))
794 break; 808 break;
795 printf("[%.8lx] ", stack); 809 printf("[%.8lx] ", stack[0]);
796 xmon_print_symbol(stack[1], " ", "\n"); 810 xmon_print_symbol(stack[1], " ", "\n");
797 if (stack[1] == (unsigned) &ret_from_except 811 if (stack[1] == (unsigned) &ret_from_except
798 || stack[1] == (unsigned) &ret_from_except_full 812 || stack[1] == (unsigned) &ret_from_except_full