aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-10-30 14:01:43 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-10-30 14:01:43 -0500
commitd362979aa2b031b91ee12122e5c4cad89577d8d3 (patch)
tree45b418415e77f104f8d90f2fb4c99b1acc9fb365 /arch
parentdc07845d0ce20d771fb96b0a5db57ffec2a89d3e (diff)
[ARM] Re-organise die()
Provide __die() which can be called from various contexts to provide an oops report. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/traps.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 66e5a0516f23..45e9ea6cd2a5 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -198,25 +198,16 @@ void show_stack(struct task_struct *tsk, unsigned long *sp)
198 barrier(); 198 barrier();
199} 199}
200 200
201DEFINE_SPINLOCK(die_lock); 201static void __die(const char *str, int err, struct thread_info *thread, struct pt_regs *regs)
202
203/*
204 * This function is protected against re-entrancy.
205 */
206NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
207{ 202{
208 struct task_struct *tsk = current; 203 struct task_struct *tsk = thread->task;
209 static int die_counter; 204 static int die_counter;
210 205
211 console_verbose();
212 spin_lock_irq(&die_lock);
213 bust_spinlocks(1);
214
215 printk("Internal error: %s: %x [#%d]\n", str, err, ++die_counter); 206 printk("Internal error: %s: %x [#%d]\n", str, err, ++die_counter);
216 print_modules(); 207 print_modules();
217 __show_regs(regs); 208 __show_regs(regs);
218 printk("Process %s (pid: %d, stack limit = 0x%p)\n", 209 printk("Process %s (pid: %d, stack limit = 0x%p)\n",
219 tsk->comm, tsk->pid, tsk->thread_info + 1); 210 tsk->comm, tsk->pid, thread + 1);
220 211
221 if (!user_mode(regs) || in_interrupt()) { 212 if (!user_mode(regs) || in_interrupt()) {
222 dump_mem("Stack: ", regs->ARM_sp, 213 dump_mem("Stack: ", regs->ARM_sp,
@@ -224,7 +215,21 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
224 dump_backtrace(regs, tsk); 215 dump_backtrace(regs, tsk);
225 dump_instr(regs); 216 dump_instr(regs);
226 } 217 }
218}
227 219
220DEFINE_SPINLOCK(die_lock);
221
222/*
223 * This function is protected against re-entrancy.
224 */
225NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
226{
227 struct thread_info *thread = current_thread_info();
228
229 console_verbose();
230 spin_lock_irq(&die_lock);
231 bust_spinlocks(1);
232 __die(str, err, thread, regs);
228 bust_spinlocks(0); 233 bust_spinlocks(0);
229 spin_unlock_irq(&die_lock); 234 spin_unlock_irq(&die_lock);
230 do_exit(SIGSEGV); 235 do_exit(SIGSEGV);