diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-02-11 07:06:53 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-12 08:21:15 -0500 |
commit | 67a94c23bb7338c321ae71aa33f8d398c94e1d0c (patch) | |
tree | be05d534ffcadf1542f17e5833977341af91bdf7 /arch/arm/kernel/traps.c | |
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/traps.c')
-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) | |||
152 | 152 | ||
153 | static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) | 153 | static 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 | ||
174 | void dump_stack(void) | 188 | void dump_stack(void) |
175 | { | 189 | { |
176 | __backtrace(); | 190 | dump_backtrace(NULL, NULL); |
177 | } | 191 | } |
178 | 192 | ||
179 | EXPORT_SYMBOL(dump_stack); | 193 | EXPORT_SYMBOL(dump_stack); |
180 | 194 | ||
181 | void show_stack(struct task_struct *tsk, unsigned long *sp) | 195 | void 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 | ||