Skip to content

Commit

Permalink
sparc32: make show_stack() acquire %fp if @_ksp is not specified
Browse files Browse the repository at this point in the history
show_stack(current or NULL, NULL) is used by arch-independent code to dump
backtrace of the current task; however, sparc32 show_stack() doesn't
implement it and wouldn't print any backtrace when NULL @_ksp is specfied.

Make show_stack() acquire and use %fp if @tsk is NULL or current and @_ksp
is NULL.  This makes %fp fetching in dump_stack() unnecessary.  Make it
use NULL for @_ksp instead.

Only compile tested.

Signed-off-by: Tejun Heo <[email protected]>
Acked-by: David S. Miller <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Fengguang Wu <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Jesper Nilsson <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Mike Frysinger <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
htejun authored and torvalds committed May 1, 2013
1 parent a77f2a4 commit 89e3f23
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions arch/sparc/kernel/process_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
struct reg_window32 *rw;
int count = 0;

if (tsk != NULL)
task_base = (unsigned long) task_stack_page(tsk);
else
task_base = (unsigned long) current_thread_info();
if (!tsk)
tsk = current;

if (tsk == current && !_ksp)
__asm__ __volatile__("mov %%fp, %0" : "=r" (_ksp));

task_base = (unsigned long) task_stack_page(tsk);
fp = (unsigned long) _ksp;
do {
/* Bogus frame pointer? */
Expand All @@ -164,11 +166,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)

void dump_stack(void)
{
unsigned long *ksp;

__asm__ __volatile__("mov %%fp, %0"
: "=r" (ksp));
show_stack(current, ksp);
show_stack(current, NULL);
}

EXPORT_SYMBOL(dump_stack);
Expand Down

0 comments on commit 89e3f23

Please sign in to comment.