aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/traps.c
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2006-09-26 10:44:01 -0400
committerRalf Baechle <ralf@linux-mips.org>2006-10-01 18:16:57 -0400
commit1df0f0ff7e56f6dcb1351b9490d55ebf91ff4bd8 (patch)
treef309b9cf0293c973683b4fa3fab5bbb74e415d47 /arch/mips/kernel/traps.c
parenteae6c0da9df81300895949897c0451423340ac40 (diff)
[MIPS] lockdep: Add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT
Implement stacktrace interface by using unwind_stack() and enable lockdep support in Kconfig. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/traps.c')
-rw-r--r--arch/mips/kernel/traps.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index e51d8fd9a152..440b8651fd8b 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -41,6 +41,7 @@
41#include <asm/mmu_context.h> 41#include <asm/mmu_context.h>
42#include <asm/watch.h> 42#include <asm/watch.h>
43#include <asm/types.h> 43#include <asm/types.h>
44#include <asm/stacktrace.h>
44 45
45extern asmlinkage void handle_int(void); 46extern asmlinkage void handle_int(void);
46extern asmlinkage void handle_tlbm(void); 47extern asmlinkage void handle_tlbm(void);
@@ -92,16 +93,14 @@ static void show_raw_backtrace(unsigned long reg29)
92} 93}
93 94
94#ifdef CONFIG_KALLSYMS 95#ifdef CONFIG_KALLSYMS
95static int raw_show_trace; 96int raw_show_trace;
96static int __init set_raw_show_trace(char *str) 97static int __init set_raw_show_trace(char *str)
97{ 98{
98 raw_show_trace = 1; 99 raw_show_trace = 1;
99 return 1; 100 return 1;
100} 101}
101__setup("raw_show_trace", set_raw_show_trace); 102__setup("raw_show_trace", set_raw_show_trace);
102 103#endif
103extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
104 unsigned long pc, unsigned long ra);
105 104
106static void show_backtrace(struct task_struct *task, struct pt_regs *regs) 105static void show_backtrace(struct task_struct *task, struct pt_regs *regs)
107{ 106{
@@ -121,9 +120,6 @@ static void show_backtrace(struct task_struct *task, struct pt_regs *regs)
121 } while (pc); 120 } while (pc);
122 printk("\n"); 121 printk("\n");
123} 122}
124#else
125#define show_backtrace(task, r) show_raw_backtrace((r)->regs[29]);
126#endif
127 123
128/* 124/*
129 * This routine abuses get_user()/put_user() to reference pointers 125 * This routine abuses get_user()/put_user() to reference pointers
@@ -158,28 +154,6 @@ static void show_stacktrace(struct task_struct *task, struct pt_regs *regs)
158 show_backtrace(task, regs); 154 show_backtrace(task, regs);
159} 155}
160 156
161static __always_inline void prepare_frametrace(struct pt_regs *regs)
162{
163 __asm__ __volatile__(
164 ".set push\n\t"
165 ".set noat\n\t"
166#ifdef CONFIG_64BIT
167 "1: dla $1, 1b\n\t"
168 "sd $1, %0\n\t"
169 "sd $29, %1\n\t"
170 "sd $31, %2\n\t"
171#else
172 "1: la $1, 1b\n\t"
173 "sw $1, %0\n\t"
174 "sw $29, %1\n\t"
175 "sw $31, %2\n\t"
176#endif
177 ".set pop\n\t"
178 : "=m" (regs->cp0_epc),
179 "=m" (regs->regs[29]), "=m" (regs->regs[31])
180 : : "memory");
181}
182
183void show_stack(struct task_struct *task, unsigned long *sp) 157void show_stack(struct task_struct *task, unsigned long *sp)
184{ 158{
185 struct pt_regs regs; 159 struct pt_regs regs;
@@ -206,11 +180,6 @@ void dump_stack(void)
206{ 180{
207 struct pt_regs regs; 181 struct pt_regs regs;
208 182
209 /*
210 * Remove any garbage that may be in regs (specially func
211 * addresses) to avoid show_raw_backtrace() to report them
212 */
213 memset(&regs, 0, sizeof(regs));
214 prepare_frametrace(&regs); 183 prepare_frametrace(&regs);
215 show_backtrace(current, &regs); 184 show_backtrace(current, &regs);
216} 185}