diff options
author | Johannes Weiner <jw@emlix.com> | 2009-03-04 10:21:29 -0500 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2009-04-03 02:38:57 -0400 |
commit | 28a0ce7f642f503dde866f763e8144a517fdf74a (patch) | |
tree | e898e20dd046957a1598da24802c1d8630f21146 | |
parent | 35f9cd083b350ad4eb3b5f159c7738fa9ddff40a (diff) |
xtensa: use correct stack pointer for stack traces
Right now, the xtensa stacktrace code reads the _current_ kernel stack
pointer if nothing is supplied. With debugging facilities like sysrq
this means that the backtrace of the sysrq-handler is printed instead
of a trace of the given task's stack.
When no stack pointer is specified in show_trace() and show_stack(),
use the stack pointer that comes with the handed in task descriptor to
make stack traces more useful.
Signed-off-by: Johannes Weiner <jw@emlix.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
-rw-r--r-- | arch/xtensa/kernel/traps.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index c44f830b6c7a..6b4a9d79e7be 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c | |||
@@ -372,11 +372,10 @@ void show_trace(struct task_struct *task, unsigned long *sp) | |||
372 | unsigned long a0, a1, pc; | 372 | unsigned long a0, a1, pc; |
373 | unsigned long sp_start, sp_end; | 373 | unsigned long sp_start, sp_end; |
374 | 374 | ||
375 | a1 = (unsigned long)sp; | 375 | if (sp) |
376 | 376 | a1 = (unsigned long)sp; | |
377 | if (a1 == 0) | 377 | else |
378 | __asm__ __volatile__ ("mov %0, a1\n" : "=a"(a1)); | 378 | a1 = task->thread.sp; |
379 | |||
380 | 379 | ||
381 | sp_start = a1 & ~(THREAD_SIZE-1); | 380 | sp_start = a1 & ~(THREAD_SIZE-1); |
382 | sp_end = sp_start + THREAD_SIZE; | 381 | sp_end = sp_start + THREAD_SIZE; |
@@ -418,9 +417,8 @@ void show_stack(struct task_struct *task, unsigned long *sp) | |||
418 | int i = 0; | 417 | int i = 0; |
419 | unsigned long *stack; | 418 | unsigned long *stack; |
420 | 419 | ||
421 | if (sp == 0) | 420 | if (!sp) |
422 | __asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp)); | 421 | sp = (unsigned long *)task->thread.sp; |
423 | |||
424 | stack = sp; | 422 | stack = sp; |
425 | 423 | ||
426 | printk("\nStack: "); | 424 | printk("\nStack: "); |