]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sparc64/kernel/stacktrace.c
stacktrace: fix build failure on sparc64
[linux-2.6-omap-h63xx.git] / arch / sparc64 / kernel / stacktrace.c
index 84d39e873e880655d32b4b1ceb05ea32ddc9cf79..b3e3737750d8bfb49701a862a6c57a821303fc18 100644 (file)
@@ -1,6 +1,7 @@
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
 #include <linux/thread_info.h>
+#include <linux/module.h>
 #include <asm/ptrace.h>
 #include <asm/stacktrace.h>
 
@@ -19,19 +20,32 @@ void save_stack_trace(struct stack_trace *trace)
        fp = ksp + STACK_BIAS;
        thread_base = (unsigned long) tp;
        do {
-               struct reg_window *rw;
+               struct sparc_stackf *sf;
+               struct pt_regs *regs;
+               unsigned long pc;
 
                /* Bogus frame pointer? */
                if (fp < (thread_base + sizeof(struct thread_info)) ||
                    fp >= (thread_base + THREAD_SIZE))
                        break;
 
-               rw = (struct reg_window *) fp;
+               sf = (struct sparc_stackf *) fp;
+               regs = (struct pt_regs *) (sf + 1);
+
+               if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
+                       if (!(regs->tstate & TSTATE_PRIV))
+                               break;
+                       pc = regs->tpc;
+                       fp = regs->u_regs[UREG_I6] + STACK_BIAS;
+               } else {
+                       pc = sf->callers_pc;
+                       fp = (unsigned long)sf->fp + STACK_BIAS;
+               }
+
                if (trace->skip > 0)
                        trace->skip--;
                else
-                       trace->entries[trace->nr_entries++] = rw->ins[7];
-
-               fp = rw->ins[6] + STACK_BIAS;
+                       trace->entries[trace->nr_entries++] = pc;
        } while (trace->nr_entries < trace->max_entries);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace);