]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - arch/parisc/kernel/traps.c
[PARISC] clean up show_stack
[linux-2.6.git] / arch / parisc / kernel / traps.c
index 745ff741490ae122ea9be8de1f3fa91bc690457a..9dc6dc42f9cfb151e5d827338c9e27431e40c58d 100644 (file)
@@ -51,6 +51,9 @@
 DEFINE_SPINLOCK(pa_dbit_lock);
 #endif
 
+void parisc_show_stack(struct task_struct *t, unsigned long *sp,
+       struct pt_regs *regs);
+
 static int printbinary(char *buf, unsigned long x, int nbits)
 {
        unsigned long mask = 1UL << (nbits - 1);
@@ -148,6 +151,8 @@ void show_regs(struct pt_regs *regs)
        print_symbol(" IAOQ[1]: %s\n", regs->iaoq[1]);
        printk(level);
        print_symbol(" RP(r2): %s\n", regs->gr[2]);
+
+       parisc_show_stack(current, NULL, regs);
 }
 
 
@@ -181,11 +186,19 @@ static void do_show_stack(struct unwind_frame_info *info)
        printk("\n");
 }
 
-void show_stack(struct task_struct *task, unsigned long *s)
+void parisc_show_stack(struct task_struct *task, unsigned long *sp,
+       struct pt_regs *regs)
 {
        struct unwind_frame_info info;
+       struct task_struct *t;
+
+       t = task ? task : current;
+       if (regs) {
+               unwind_frame_init(&info, t, regs);
+               goto show_stack;
+       }
 
-       if (!task) {
+       if (t == current) {
                unsigned long sp;
 
 HERE:
@@ -201,12 +214,18 @@ HERE:
                        unwind_frame_init(&info, current, &r);
                }
        } else {
-               unwind_frame_init_from_blocked_task(&info, task);
+               unwind_frame_init_from_blocked_task(&info, t);
        }
 
+show_stack:
        do_show_stack(&info);
 }
 
+void show_stack(struct task_struct *t, unsigned long *sp)
+{
+       return parisc_show_stack(t, sp, NULL);
+}
+
 int is_valid_bugaddr(unsigned long iaoq)
 {
        return 1;
@@ -219,7 +238,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
                        return; /* STFU */
 
                printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
-                       current->comm, current->pid, str, err, regs->iaoq[0]);
+                       current->comm, task_pid_nr(current), str, err, regs->iaoq[0]);
 #ifdef PRINT_USER_FAULTS
                /* XXX for debugging only */
                show_regs(regs);
@@ -252,7 +271,7 @@ KERN_CRIT "                     ||     ||\n");
        
        if (err)
                printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
-                       current->comm, current->pid, str, err);
+                       current->comm, task_pid_nr(current), str, err);
 
        /* Wot's wrong wif bein' racy? */
        if (current->thread.flags & PARISC_KERNEL_DEATH) {
@@ -264,6 +283,7 @@ KERN_CRIT "                     ||     ||\n");
 
        show_regs(regs);
        dump_stack();
+       add_taint(TAINT_DIE);
 
        if (in_interrupt())
                panic("Fatal exception in interrupt");
@@ -302,7 +322,7 @@ static void handle_break(struct pt_regs *regs)
        if (unlikely(iir == PARISC_BUG_BREAK_INSN && !user_mode(regs))) {
                /* check if a BUG() or WARN() trapped here.  */
                enum bug_trap_type tt;
-               tt = report_bug(regs->iaoq[0] & ~3);
+               tt = report_bug(regs->iaoq[0] & ~3, regs);
                if (tt == BUG_TRAP_TYPE_WARN) {
                        regs->iaoq[0] += 4;
                        regs->iaoq[1] += 4;
@@ -316,7 +336,7 @@ static void handle_break(struct pt_regs *regs)
        if (unlikely(iir != GDB_BREAK_INSN)) {
                printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n",
                        iir & 31, (iir>>13) & ((1<<13)-1),
-                       current->pid, current->comm);
+                       task_pid_nr(current), current->comm);
                show_regs(regs);
        }
 #endif
@@ -615,7 +635,7 @@ void handle_interruption(int code, struct pt_regs *regs)
                
        case 13:
                /* Conditional Trap
-                  The condition succees in an instruction which traps 
+                  The condition succeeds in an instruction which traps
                   on condition  */
                if(user_mode(regs)){
                        si.si_signo = SIGFPE;
@@ -746,7 +766,7 @@ void handle_interruption(int code, struct pt_regs *regs)
                if (user_mode(regs)) {
 #ifdef PRINT_USER_FAULTS
                        printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n",
-                           current->pid, current->comm);
+                           task_pid_nr(current), current->comm);
                        show_regs(regs);
 #endif
                        /* SIGBUS, for lack of a better one. */
@@ -771,7 +791,7 @@ void handle_interruption(int code, struct pt_regs *regs)
                else
                        printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ",
                               code);
-               printk("pid=%d command='%s'\n", current->pid, current->comm);
+               printk("pid=%d command='%s'\n", task_pid_nr(current), current->comm);
                show_regs(regs);
 #endif
                si.si_signo = SIGSEGV;
@@ -802,13 +822,14 @@ void handle_interruption(int code, struct pt_regs *regs)
 
 int __init check_ivt(void *iva)
 {
+       extern const u32 os_hpmc[];
+       extern const u32 os_hpmc_end[];
+
        int i;
        u32 check = 0;
        u32 *ivap;
        u32 *hpmcp;
        u32 length;
-       extern void os_hpmc(void);
-       extern void os_hpmc_end(void);
 
        if (strcmp((char *)iva, "cows can fly"))
                return -1;
@@ -820,7 +841,7 @@ int __init check_ivt(void *iva)
 
        /* Compute Checksum for HPMC handler */
 
-       length = (u32)((unsigned long)os_hpmc_end - (unsigned long)os_hpmc);
+       length = os_hpmc_end - os_hpmc;
        ivap[7] = length;
 
        hpmcp = (u32 *)os_hpmc;