Commit 67a94c23 authored by Catalin Marinas's avatar Catalin Marinas Committed by Russell King

[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: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent a12370f1
...@@ -25,5 +25,6 @@ static inline int in_exception_text(unsigned long ptr) ...@@ -25,5 +25,6 @@ static inline int in_exception_text(unsigned long ptr)
} }
extern void __init early_trap_init(void); extern void __init early_trap_init(void);
extern void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame);
#endif #endif
...@@ -152,11 +152,25 @@ static void dump_instr(struct pt_regs *regs) ...@@ -152,11 +152,25 @@ static void dump_instr(struct pt_regs *regs)
static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
{ {
unsigned int fp; unsigned int fp, mode;
int ok = 1; int ok = 1;
printk("Backtrace: "); printk("Backtrace: ");
if (!tsk)
tsk = current;
if (regs) {
fp = regs->ARM_fp; 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) { if (!fp) {
printk("no frame pointer"); printk("no frame pointer");
ok = 0; ok = 0;
...@@ -168,29 +182,19 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) ...@@ -168,29 +182,19 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
printk("\n"); printk("\n");
if (ok) if (ok)
c_backtrace(fp, processor_mode(regs)); c_backtrace(fp, mode);
} }
void dump_stack(void) void dump_stack(void)
{ {
__backtrace(); dump_backtrace(NULL, NULL);
} }
EXPORT_SYMBOL(dump_stack); EXPORT_SYMBOL(dump_stack);
void show_stack(struct task_struct *tsk, unsigned long *sp) void show_stack(struct task_struct *tsk, unsigned long *sp)
{ {
unsigned long fp; dump_backtrace(NULL, tsk);
if (!tsk)
tsk = current;
if (tsk != current)
fp = thread_saved_fp(tsk);
else
asm("mov %0, fp" : "=r" (fp) : : "cc");
c_backtrace(fp, 0x10);
barrier(); barrier();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment