[SPARC64]: Fix show_stack() when stack argument is NULL.
authorDavid S. Miller <davem@sunset.davemloft.net>
Mon, 30 Jul 2007 07:17:12 +0000 (00:17 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 30 Jul 2007 07:27:38 +0000 (00:27 -0700)
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>
arch/sparc64/kernel/traps.c
arch/sparc64/mm/fault.c

index 6ef2d299fb10c4527687d323f89154c4dbce9f4d..6ef42b8e53d84dff82b67797d81764f0d9d1a359 100644 (file)
@@ -2134,12 +2134,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();
 
@@ -2168,11 +2176,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);
index 17123e9ecf78dcdb8547f6dc51b9be8900a59bca..9f7740eee8d2957eeaf6170648f390a08e8a4268 100644 (file)
@@ -112,15 +112,12 @@ static void __kprobes unhandled_fault(unsigned long address,
 
 static void bad_kernel_pc(struct pt_regs *regs, unsigned long vaddr)
 {
-       unsigned long *ksp;
-
        printk(KERN_CRIT "OOPS: Bogus kernel PC [%016lx] in fault handler\n",
               regs->tpc);
        printk(KERN_CRIT "OOPS: RPC [%016lx]\n", regs->u_regs[15]);
        print_symbol("RPC: <%s>\n", regs->u_regs[15]);
        printk(KERN_CRIT "OOPS: Fault was to vaddr[%lx]\n", vaddr);
-       __asm__("mov %%sp, %0" : "=r" (ksp));
-       show_stack(current, ksp);
+       dump_stack();
        unhandled_fault(regs->tpc, current, regs);
 }