diff options
author | David S. Miller <davem@davemloft.net> | 2007-11-02 22:56:18 +0100 |
---|---|---|
committer | Adrian Bunk <bunk@kernel.org> | 2007-11-02 22:56:18 +0100 |
commit | a52dfa535d04a5246927b9863a5e6209c5832582 (patch) | |
tree | c38ee69ed81685f50b80e2be369d2a601f4a9e51 | |
parent | 4c94bf7f6f414af1ac449d3d6741522311b1fc07 (diff) | |
download | lwn-a52dfa535d04a5246927b9863a5e6209c5832582.tar.gz lwn-a52dfa535d04a5246927b9863a5e6209c5832582.zip |
[SPARC64]: Fix show_stack() when stack argument is NULL.
It didn't handle that case at all, and now dump_stack()
can be implemented directly as show_stack(current, NULL)
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
-rw-r--r-- | arch/sparc64/kernel/traps.c | 18 | ||||
-rw-r--r-- | arch/sparc64/mm/fault.c | 5 |
2 files changed, 12 insertions, 11 deletions
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 8d44ae5a15e3..73e729e363eb 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c @@ -1808,12 +1808,20 @@ static void user_instruction_dump (unsigned int __user *pc) void show_stack(struct task_struct *tsk, unsigned long *_ksp) { unsigned long pc, fp, thread_base, ksp; - void *tp = task_stack_page(tsk); + struct thread_info *tp; struct reg_window *rw; int count = 0; ksp = (unsigned long) _ksp; - + if (!tsk) + tsk = current; + tp = task_thread_info(tsk); + if (ksp == 0UL) { + if (tsk == current) + asm("mov %%fp, %0" : "=r" (ksp)); + else + ksp = tp->ksp; + } if (tp == current_thread_info()) flushw_all(); @@ -1842,11 +1850,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); diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 6f0539aa44d0..efc2c9d26c2c 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c @@ -93,12 +93,9 @@ static void __kprobes unhandled_fault(unsigned long address, static void bad_kernel_pc(struct pt_regs *regs) { - unsigned long *ksp; - printk(KERN_CRIT "OOPS: Bogus kernel PC [%016lx] in fault handler\n", regs->tpc); - __asm__("mov %%sp, %0" : "=r" (ksp)); - show_stack(current, ksp); + dump_stack(); unhandled_fault(regs->tpc, current, regs); } |