]> Pileus Git - ~andy/linux/commitdiff
sparc32: make show_stack() acquire %fp if @_ksp is not specified
authorTejun Heo <tj@kernel.org>
Tue, 30 Apr 2013 22:27:10 +0000 (15:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 May 2013 00:04:01 +0000 (17:04 -0700)
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 <tj@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/sparc/kernel/process_32.c

index c85241006e32853a0cb71e768a99506aa2b9e246..2be4214b39052f4d6a2f463f9d1f1964e4d978b6 100644 (file)
@@ -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? */
@@ -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);