Commit d9084455 authored by Paul Mackerras's avatar Paul Mackerras

PPC32: Implement 2-argument show_stack().

parent 4d4f47fc
...@@ -69,8 +69,6 @@ struct task_struct init_task = INIT_TASK(init_task); ...@@ -69,8 +69,6 @@ struct task_struct init_task = INIT_TASK(init_task);
/* only used to get secondary processor up */ /* only used to get secondary processor up */
struct task_struct *current_set[NR_CPUS] = {&init_task, }; struct task_struct *current_set[NR_CPUS] = {&init_task, };
static void show_tsk_stack(struct task_struct *tsk, unsigned long sp);
#undef SHOW_TASK_SWITCHES #undef SHOW_TASK_SWITCHES
#undef CHECK_STACK #undef CHECK_STACK
...@@ -296,7 +294,7 @@ void show_regs(struct pt_regs * regs) ...@@ -296,7 +294,7 @@ void show_regs(struct pt_regs * regs)
break; break;
} }
printk("\n"); printk("\n");
show_tsk_stack(current, regs->gpr[1]); show_stack(current, (unsigned long *) regs->gpr[1]);
} }
void exit_thread(void) void exit_thread(void)
...@@ -494,26 +492,29 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, ...@@ -494,26 +492,29 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
return error; return error;
} }
void show_trace_task(struct task_struct *tsk)
{
show_tsk_stack(tsk, tsk->thread.ksp);
}
void dump_stack(void) void dump_stack(void)
{ {
show_tsk_stack(current, _get_SP()); show_stack(current, NULL);
} }
static void show_tsk_stack(struct task_struct *tsk, unsigned long sp) void show_stack(struct task_struct *tsk, unsigned long *stack)
{ {
unsigned long stack_top, prev_sp, ret; unsigned long sp, stack_top, prev_sp, ret;
int count = 0; int count = 0;
unsigned long next_exc = 0; unsigned long next_exc = 0;
struct pt_regs *regs; struct pt_regs *regs;
extern char ret_from_except, ret_from_except_full, ret_from_syscall; extern char ret_from_except, ret_from_except_full, ret_from_syscall;
sp = (unsigned long) stack;
if (tsk == NULL) if (tsk == NULL)
return; tsk = current;
if (sp == 0) {
if (tsk == current)
asm("mr %0,1" : "=r" (sp));
else
sp = tsk->thread.ksp;
}
prev_sp = (unsigned long) (tsk->thread_info + 1); prev_sp = (unsigned long) (tsk->thread_info + 1);
stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE; stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) { while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) {
......
...@@ -104,7 +104,5 @@ do { \ ...@@ -104,7 +104,5 @@ do { \
extern void synchronize_irq(unsigned int irq); extern void synchronize_irq(unsigned int irq);
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
extern void show_stack(unsigned long *sp);
#endif /* __ASM_HARDIRQ_H */ #endif /* __ASM_HARDIRQ_H */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment