aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt@console-pimps.org>2009-08-11 17:43:20 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-08-13 06:52:53 -0400
commit0eff9f66de79a0707a9c3a2f8528ccfd62100f0b (patch)
tree72c2cdbda141faec9950438b7e7cd02ddcd59705
parentbf61ad1f870be88676a07bfef69acd59ce10172e (diff)
sh: Use the new stack unwinder API
Instead of implementing our own stack unwinder via dump_trace() we should use the new stack unwinder API because it is more modular. This change allows us to decouple the interface for generating stacktraces from the implementation of a stack unwinder. Signed-off-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/kernel/dumpstack.c17
-rw-r--r--arch/sh/kernel/stacktrace.c5
-rw-r--r--arch/sh/oprofile/backtrace.c5
3 files changed, 12 insertions, 15 deletions
diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
index 6ab996fc6121..005dc1d11460 100644
--- a/arch/sh/kernel/dumpstack.c
+++ b/arch/sh/kernel/dumpstack.c
@@ -6,7 +6,7 @@
6#include <linux/kallsyms.h> 6#include <linux/kallsyms.h>
7#include <linux/ftrace.h> 7#include <linux/ftrace.h>
8#include <linux/debug_locks.h> 8#include <linux/debug_locks.h>
9 9#include <asm/unwinder.h>
10#include <asm/stacktrace.h> 10#include <asm/stacktrace.h>
11 11
12void printk_address(unsigned long address, int reliable) 12void printk_address(unsigned long address, int reliable)
@@ -46,13 +46,10 @@ print_ftrace_graph_addr(unsigned long addr, void *data,
46{ } 46{ }
47#endif 47#endif
48 48
49/* 49void
50 * Unwind the call stack and pass information to the stacktrace_ops 50stack_reader_dump(struct task_struct *task, struct pt_regs *regs,
51 * functions. 51 unsigned long *sp, const struct stacktrace_ops *ops,
52 */ 52 void *data)
53void dump_trace(struct task_struct *task, struct pt_regs *regs,
54 unsigned long *sp, const struct stacktrace_ops *ops,
55 void *data)
56{ 53{
57 struct thread_info *context; 54 struct thread_info *context;
58 int graph = 0; 55 int graph = 0;
@@ -71,8 +68,6 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
71 } 68 }
72 } 69 }
73} 70}
74EXPORT_SYMBOL(dump_trace);
75
76 71
77static void 72static void
78print_trace_warning_symbol(void *data, char *msg, unsigned long symbol) 73print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
@@ -117,7 +112,7 @@ void show_trace(struct task_struct *tsk, unsigned long *sp,
117 112
118 printk("\nCall trace:\n"); 113 printk("\nCall trace:\n");
119 114
120 dump_trace(tsk, regs, sp, &print_trace_ops, ""); 115 unwind_stack(tsk, regs, sp, &print_trace_ops, "");
121 116
122 printk("\n"); 117 printk("\n");
123 118
diff --git a/arch/sh/kernel/stacktrace.c b/arch/sh/kernel/stacktrace.c
index 6c24a400b05e..45b1adde3abe 100644
--- a/arch/sh/kernel/stacktrace.c
+++ b/arch/sh/kernel/stacktrace.c
@@ -13,6 +13,7 @@
13#include <linux/stacktrace.h> 13#include <linux/stacktrace.h>
14#include <linux/thread_info.h> 14#include <linux/thread_info.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <asm/unwinder.h>
16#include <asm/ptrace.h> 17#include <asm/ptrace.h>
17#include <asm/stacktrace.h> 18#include <asm/stacktrace.h>
18 19
@@ -57,7 +58,7 @@ void save_stack_trace(struct stack_trace *trace)
57{ 58{
58 unsigned long *sp = (unsigned long *)current_stack_pointer; 59 unsigned long *sp = (unsigned long *)current_stack_pointer;
59 60
60 dump_trace(current, NULL, sp, &save_stack_ops, trace); 61 unwind_stack(current, NULL, sp, &save_stack_ops, trace);
61} 62}
62EXPORT_SYMBOL_GPL(save_stack_trace); 63EXPORT_SYMBOL_GPL(save_stack_trace);
63 64
@@ -89,6 +90,6 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
89{ 90{
90 unsigned long *sp = (unsigned long *)tsk->thread.sp; 91 unsigned long *sp = (unsigned long *)tsk->thread.sp;
91 92
92 dump_trace(current, NULL, sp, &save_stack_ops_nosched, trace); 93 unwind_stack(current, NULL, sp, &save_stack_ops_nosched, trace);
93} 94}
94EXPORT_SYMBOL_GPL(save_stack_trace_tsk); 95EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
diff --git a/arch/sh/oprofile/backtrace.c b/arch/sh/oprofile/backtrace.c
index 62e4e4d0273e..37cd75d7930e 100644
--- a/arch/sh/oprofile/backtrace.c
+++ b/arch/sh/oprofile/backtrace.c
@@ -17,6 +17,7 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/kallsyms.h> 18#include <linux/kallsyms.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <asm/unwinder.h>
20#include <asm/ptrace.h> 21#include <asm/ptrace.h>
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
22#include <asm/sections.h> 23#include <asm/sections.h>
@@ -120,8 +121,8 @@ void sh_backtrace(struct pt_regs * const regs, unsigned int depth)
120 stackaddr = (unsigned long *)regs->regs[15]; 121 stackaddr = (unsigned long *)regs->regs[15];
121 if (!user_mode(regs)) { 122 if (!user_mode(regs)) {
122 if (depth) 123 if (depth)
123 dump_trace(NULL, regs, stackaddr, 124 unwind_stack(NULL, regs, stackaddr,
124 &backtrace_ops, &depth); 125 &backtrace_ops, &depth);
125 return; 126 return;
126 } 127 }
127 128