diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-02-11 13:06:53 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-12 13:21:15 +0000 |
commit | 67a94c23bb7338c321ae71aa33f8d398c94e1d0c (patch) | |
tree | be05d534ffcadf1542f17e5833977341af91bdf7 /arch/arm/kernel | |
parent | a12370f12fdc6a35463842e41eaf04299167eb12 (diff) |
[ARM] 5381/1: unwind: Reorganise the traps.c code
This patch moves code around in the arch/arm/kernel/traps.c file for
easier integration of the stack unwinding support.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/traps.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 79abc4ddc0cf..f68ca0fb0ed7 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -152,11 +152,25 @@ static void dump_instr(struct pt_regs *regs) static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) { - unsigned int fp; + unsigned int fp, mode; int ok = 1; printk("Backtrace: "); - fp = regs->ARM_fp; + + if (!tsk) + tsk = current; + + if (regs) { + fp = regs->ARM_fp; + mode = processor_mode(regs); + } else if (tsk != current) { + fp = thread_saved_fp(tsk); + mode = 0x10; + } else { + asm("mov %0, fp" : "=r" (fp) : : "cc"); + mode = 0x10; + } + if (!fp) { printk("no frame pointer"); ok = 0; @@ -168,29 +182,19 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) printk("\n"); if (ok) - c_backtrace(fp, processor_mode(regs)); + c_backtrace(fp, mode); } void dump_stack(void) { - __backtrace(); + dump_backtrace(NULL, NULL); } EXPORT_SYMBOL(dump_stack); void show_stack(struct task_struct *tsk, unsigned long *sp) { - unsigned long fp; - - if (!tsk) - tsk = current; - - if (tsk != current) - fp = thread_saved_fp(tsk); - else - asm("mov %0, fp" : "=r" (fp) : : "cc"); - - c_backtrace(fp, 0x10); + dump_backtrace(NULL, tsk); barrier(); } |