Merge branch 'fix/asoc' into for-linus
[pandora-kernel.git] / arch / arm / kernel / traps.c
index 79abc4d..57eb0f6 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/system.h>
 #include <asm/unistd.h>
 #include <asm/traps.h>
+#include <asm/unwind.h>
 
 #include "ptrace.h"
 #include "signal.h"
@@ -61,6 +62,7 @@ void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long
                dump_mem("Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs));
 }
 
+#ifndef CONFIG_ARM_UNWIND
 /*
  * Stack pointers should always be within the kernels view of
  * physical memory.  If it is not there, then we can't dump
@@ -74,6 +76,7 @@ static int verify_stack(unsigned long sp)
 
        return 0;
 }
+#endif
 
 /*
  * Dump out the contents of some memory nicely...
@@ -150,13 +153,33 @@ static void dump_instr(struct pt_regs *regs)
        set_fs(fs);
 }
 
+#ifdef CONFIG_ARM_UNWIND
+static inline void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
+{
+       unwind_backtrace(regs, tsk);
+}
+#else
 static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
 {
-       unsigned int fp;
+       unsigned int fp, mode;
        int ok = 1;
 
        printk("Backtrace: ");
-       fp = regs->ARM_fp;
+
+       if (!tsk)
+               tsk = current;
+
+       if (regs) {
+               fp = regs->ARM_fp;
+               mode = processor_mode(regs);
+       } else if (tsk != current) {
+               fp = thread_saved_fp(tsk);
+               mode = 0x10;
+       } else {
+               asm("mov %0, fp" : "=r" (fp) : : "cc");
+               mode = 0x10;
+       }
+
        if (!fp) {
                printk("no frame pointer");
                ok = 0;
@@ -168,29 +191,20 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
        printk("\n");
 
        if (ok)
-               c_backtrace(fp, processor_mode(regs));
+               c_backtrace(fp, mode);
 }
+#endif
 
 void dump_stack(void)
 {
-       __backtrace();
+       dump_backtrace(NULL, NULL);
 }
 
 EXPORT_SYMBOL(dump_stack);
 
 void show_stack(struct task_struct *tsk, unsigned long *sp)
 {
-       unsigned long fp;
-
-       if (!tsk)
-               tsk = current;
-
-       if (tsk != current)
-               fp = thread_saved_fp(tsk);
-       else
-               asm("mov %0, fp" : "=r" (fp) : : "cc");
-
-       c_backtrace(fp, 0x10);
+       dump_backtrace(NULL, tsk);
        barrier();
 }