aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2009-02-11 07:06:53 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-12 08:21:15 -0500
commit67a94c23bb7338c321ae71aa33f8d398c94e1d0c (patch)
treebe05d534ffcadf1542f17e5833977341af91bdf7 /arch
parenta12370f12fdc6a35463842e41eaf04299167eb12 (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')
-rw-r--r--arch/arm/include/asm/traps.h1
-rw-r--r--arch/arm/kernel/traps.c34
2 files changed, 20 insertions, 15 deletions
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h
index aa399aec568e..491960bf4260 100644
--- a/arch/arm/include/asm/traps.h
+++ b/arch/arm/include/asm/traps.h
@@ -25,5 +25,6 @@ static inline int in_exception_text(unsigned long ptr)
25} 25}
26 26
27extern void __init early_trap_init(void); 27extern void __init early_trap_init(void);
28extern void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame);
28 29
29#endif 30#endif
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)
152 152
153static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) 153static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
154{ 154{
155 unsigned int fp; 155 unsigned int fp, mode;
156 int ok = 1; 156 int ok = 1;
157 157
158 printk("Backtrace: "); 158 printk("Backtrace: ");
159 fp = regs->ARM_fp; 159
160 if (!tsk)
161 tsk = current;
162
163 if (regs) {
164 fp = regs->ARM_fp;
165 mode = processor_mode(regs);
166 } else if (tsk != current) {
167 fp = thread_saved_fp(tsk);
168 mode = 0x10;
169 } else {
170 asm("mov %0, fp" : "=r" (fp) : : "cc");
171 mode = 0x10;
172 }
173
160 if (!fp) { 174 if (!fp) {
161 printk("no frame pointer"); 175 printk("no frame pointer");
162 ok = 0; 176 ok = 0;
@@ -168,29 +182,19 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
168 printk("\n"); 182 printk("\n");
169 183
170 if (ok) 184 if (ok)
171 c_backtrace(fp, processor_mode(regs)); 185 c_backtrace(fp, mode);
172} 186}
173 187
174void dump_stack(void) 188void dump_stack(void)
175{ 189{
176 __backtrace(); 190 dump_backtrace(NULL, NULL);
177} 191}
178 192
179EXPORT_SYMBOL(dump_stack); 193EXPORT_SYMBOL(dump_stack);
180 194
181void show_stack(struct task_struct *tsk, unsigned long *sp) 195void show_stack(struct task_struct *tsk, unsigned long *sp)
182{ 196{
183 unsigned long fp; 197 dump_backtrace(NULL, tsk);
184
185 if (!tsk)
186 tsk = current;
187
188 if (tsk != current)
189 fp = thread_saved_fp(tsk);
190 else
191 asm("mov %0, fp" : "=r" (fp) : : "cc");
192
193 c_backtrace(fp, 0x10);
194 barrier(); 198 barrier();
195} 199}
196 200