summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/traps.c
diff options
context:
space:
mode:
authorFranck Bui-Huu <vagabon.xyz@gmail.com>2006-08-03 09:29:21 +0200
committerRalf Baechle <ralf@linux-mips.org>2006-09-27 14:37:29 +0200
commit4d157d5eac29d7d5559fdcabf20f3961bc5cb3e7 (patch)
tree82662abbe473e5bd0be973e2a8ceb8b63082da55 /arch/mips/kernel/traps.c
parent[MIPS] Make get_frame_info() more robust (diff)
downloadlinux-4d157d5eac29d7d5559fdcabf20f3961bc5cb3e7.tar.xz
linux-4d157d5eac29d7d5559fdcabf20f3961bc5cb3e7.zip
[MIPS] Improve unwind_stack()
This patch allows unwind_stack() to return ra for leaf function. But it tries to detects cases where get_frame_info() wrongly consider nested function as a leaf one. It also pass 'unsinged long *sp' instead of 'unsigned long **sp' as second parameter. The code looks cleaner. Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/traps.c')
-rw-r--r--arch/mips/kernel/traps.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 303f00843021..ab77034921c4 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -74,8 +74,9 @@ void (*board_ejtag_handler_setup)(void);
void (*board_bind_eic_interrupt)(int irq, int regset);
-static void show_raw_backtrace(unsigned long *sp)
+static void show_raw_backtrace(unsigned long reg29)
{
+ unsigned long *sp = (unsigned long *)reg29;
unsigned long addr;
printk("Call Trace:");
@@ -99,30 +100,29 @@ static int __init set_raw_show_trace(char *str)
}
__setup("raw_show_trace", set_raw_show_trace);
-extern unsigned long unwind_stack(struct task_struct *task,
- unsigned long **sp, unsigned long pc);
+extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
+ unsigned long pc, unsigned long ra);
+
static void show_backtrace(struct task_struct *task, struct pt_regs *regs)
{
- unsigned long *sp = (long *)regs->regs[29];
+ unsigned long sp = regs->regs[29];
+ unsigned long ra = regs->regs[31];
unsigned long pc = regs->cp0_epc;
- int top = 1;
if (raw_show_trace || !__kernel_text_address(pc)) {
show_raw_backtrace(sp);
return;
}
printk("Call Trace:\n");
- while (__kernel_text_address(pc)) {
+ do {
print_ip_sym(pc);
- pc = unwind_stack(task, &sp, pc);
- if (top && pc == 0)
- pc = regs->regs[31]; /* leaf? */
- top = 0;
- }
+ pc = unwind_stack(task, &sp, pc, ra);
+ ra = 0;
+ } while (pc);
printk("\n");
}
#else
-#define show_backtrace(task, r) show_raw_backtrace((long *)(r)->regs[29]);
+#define show_backtrace(task, r) show_raw_backtrace((r)->regs[29]);
#endif
/*