aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/dumpstack.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-23 22:05:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-23 22:05:53 -0400
commit47b170af84d18b736bb35932823ec01cfcfe1967 (patch)
treed52acd411c4c2e05b9db553e9b6f4a6bf59f5ca4 /arch/sh/kernel/dumpstack.c
parent83c7f72259ea4bd0561e2f2762d97ee2888126ce (diff)
parent9ff561fdf73493d757bbc74aa58627e1381650fb (diff)
Merge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh
Pull SuperH updates from Paul Mundt: - Migration off of old-style dynamic IRQ API. - irqdomain and generic irq chip propagation. - div4/6 clock consolidation, another step towards co-existing with the common struct clk infrastructure. - Extensive PFC rework - Decoupling GPIO from pin state. - Initial pinctrl support to facilitate incremental migration off of legacy pinmux. - gpiolib support made optional, and made pinctrl-backed. * tag 'sh-for-linus' of git://github.com/pmundt/linux-sh: (38 commits) sh: pfc: pin config get/set support. sh: pfc: Prefer DRV_NAME over KBUILD_MODNAME. sh: pfc: pinctrl legacy group support. sh: pfc: Ignore pinmux GPIOs with invalid enum IDs. sh: pfc: Export pinctrl binding init symbol. sh: pfc: Error out on pinctrl init resolution failure. sh: pfc: Make pr_fmt consistent across pfc drivers. sh: pfc: pinctrl legacy function support. sh: pfc: Rudimentary pinctrl-backed GPIO support. sh: pfc: Dumb GPIO stringification. sh: pfc: Shuffle PFC support core. sh: pfc: Verify pin type encoding size at build time. sh: pfc: Kill off unused pinmux bias flags. sh: pfc: Make gpio chip support optional where possible. sh: pfc: Split out gpio chip support. sh64: Fix up section mismatch warnings. sh64: Attempt to make reserved insn trap handler resemble C. sh: Consolidate die definitions for trap handlers. sh64: Kill off old exception debugging helpers. sh64: Use generic unaligned access control/counters. ...
Diffstat (limited to 'arch/sh/kernel/dumpstack.c')
-rw-r--r--arch/sh/kernel/dumpstack.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
index 694158b9a50..7617dc4129a 100644
--- a/arch/sh/kernel/dumpstack.c
+++ b/arch/sh/kernel/dumpstack.c
@@ -2,13 +2,48 @@
2 * Copyright (C) 1991, 1992 Linus Torvalds 2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs 3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
4 * Copyright (C) 2009 Matt Fleming 4 * Copyright (C) 2009 Matt Fleming
5 * Copyright (C) 2002 - 2012 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
5 */ 10 */
6#include <linux/kallsyms.h> 11#include <linux/kallsyms.h>
7#include <linux/ftrace.h> 12#include <linux/ftrace.h>
8#include <linux/debug_locks.h> 13#include <linux/debug_locks.h>
14#include <linux/kdebug.h>
15#include <linux/export.h>
16#include <linux/uaccess.h>
9#include <asm/unwinder.h> 17#include <asm/unwinder.h>
10#include <asm/stacktrace.h> 18#include <asm/stacktrace.h>
11 19
20void dump_mem(const char *str, unsigned long bottom, unsigned long top)
21{
22 unsigned long p;
23 int i;
24
25 printk("%s(0x%08lx to 0x%08lx)\n", str, bottom, top);
26
27 for (p = bottom & ~31; p < top; ) {
28 printk("%04lx: ", p & 0xffff);
29
30 for (i = 0; i < 8; i++, p += 4) {
31 unsigned int val;
32
33 if (p < bottom || p >= top)
34 printk(" ");
35 else {
36 if (__get_user(val, (unsigned int __user *)p)) {
37 printk("\n");
38 return;
39 }
40 printk("%08x ", val);
41 }
42 }
43 printk("\n");
44 }
45}
46
12void printk_address(unsigned long address, int reliable) 47void printk_address(unsigned long address, int reliable)
13{ 48{
14 printk(" [<%p>] %s%pS\n", (void *) address, 49 printk(" [<%p>] %s%pS\n", (void *) address,
@@ -106,3 +141,26 @@ void show_trace(struct task_struct *tsk, unsigned long *sp,
106 141
107 debug_show_held_locks(tsk); 142 debug_show_held_locks(tsk);
108} 143}
144
145void show_stack(struct task_struct *tsk, unsigned long *sp)
146{
147 unsigned long stack;
148
149 if (!tsk)
150 tsk = current;
151 if (tsk == current)
152 sp = (unsigned long *)current_stack_pointer;
153 else
154 sp = (unsigned long *)tsk->thread.sp;
155
156 stack = (unsigned long)sp;
157 dump_mem("Stack: ", stack, THREAD_SIZE +
158 (unsigned long)task_stack_page(tsk));
159 show_trace(tsk, sp, NULL);
160}
161
162void dump_stack(void)
163{
164 show_stack(NULL, NULL);
165}
166EXPORT_SYMBOL(dump_stack);