Merge git://git.infradead.org/battery-2.6
[pandora-kernel.git] / arch / arm / kernel / traps.c
index 10ff36e..4764bd9 100644 (file)
@@ -181,9 +181,7 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
 
 void dump_stack(void)
 {
-#ifdef CONFIG_DEBUG_ERRORS
        __backtrace();
-#endif
 }
 
 EXPORT_SYMBOL(dump_stack);
@@ -204,16 +202,28 @@ void show_stack(struct task_struct *tsk, unsigned long *sp)
        barrier();
 }
 
+#ifdef CONFIG_PREEMPT
+#define S_PREEMPT " PREEMPT"
+#else
+#define S_PREEMPT ""
+#endif
+#ifdef CONFIG_SMP
+#define S_SMP " SMP"
+#else
+#define S_SMP ""
+#endif
+
 static void __die(const char *str, int err, struct thread_info *thread, struct pt_regs *regs)
 {
        struct task_struct *tsk = thread->task;
        static int die_counter;
 
-       printk("Internal error: %s: %x [#%d]\n", str, err, ++die_counter);
+       printk("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n",
+              str, err, ++die_counter);
        print_modules();
        __show_regs(regs);
        printk("Process %s (pid: %d, stack limit = 0x%p)\n",
-               tsk->comm, tsk->pid, thread + 1);
+               tsk->comm, task_pid_nr(tsk), thread + 1);
 
        if (!user_mode(regs) || in_interrupt()) {
                dump_mem("Stack: ", regs->ARM_sp,
@@ -232,16 +242,23 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
 {
        struct thread_info *thread = current_thread_info();
 
+       oops_enter();
+
        console_verbose();
        spin_lock_irq(&die_lock);
        bust_spinlocks(1);
        __die(str, err, thread, regs);
        bust_spinlocks(0);
+       add_taint(TAINT_DIE);
        spin_unlock_irq(&die_lock);
 
+       if (in_interrupt())
+               panic("Fatal exception in interrupt");
+
        if (panic_on_oops)
                panic("Fatal exception");
 
+       oops_exit();
        do_exit(SIGSEGV);
 }
 
@@ -320,7 +337,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
 #ifdef CONFIG_DEBUG_USER
        if (user_debug & UDBG_UNDEFINED) {
                printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
-                       current->comm, current->pid, pc);
+                       current->comm, task_pid_nr(current), pc);
                dump_instr(regs);
        }
 #endif
@@ -335,10 +352,8 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
 
 asmlinkage void do_unexp_fiq (struct pt_regs *regs)
 {
-#ifndef CONFIG_IGNORE_FIQ
        printk("Hmm.  Unexpected FIQ received, but trying to continue\n");
        printk("You may have a hardware problem...\n");
-#endif
 }
 
 /*
@@ -373,7 +388,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
 #ifdef CONFIG_DEBUG_USER
        if (user_debug & UDBG_SYSCALL) {
                printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n",
-                       current->pid, current->comm, n);
+                       task_pid_nr(current), current->comm, n);
                dump_instr(regs);
        }
 #endif
@@ -550,7 +565,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
         */
        if (user_debug & UDBG_SYSCALL) {
                printk("[%d] %s: arm syscall %d\n",
-                      current->pid, current->comm, no);
+                      task_pid_nr(current), current->comm, no);
                dump_instr(regs);
                if (user_mode(regs)) {
                        __show_regs(regs);
@@ -627,7 +642,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
 #ifdef CONFIG_DEBUG_USER
        if (user_debug & UDBG_BADABORT) {
                printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n",
-                       current->pid, current->comm, code, instr);
+                       task_pid_nr(current), current->comm, code, instr);
                dump_instr(regs);
                show_pte(current->mm, addr);
        }