summaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/stacktrace.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-04-24 03:28:52 -0700
committerDavid S. Miller <davem@davemloft.net>2008-04-24 03:28:52 -0700
commit77c664fa58624079f7a0fc29b46e8a32883633a5 (patch)
tree8a672a6af5d461e1f95d1a41f52dac3d95edb6ae /arch/sparc64/kernel/stacktrace.c
parent7697daaa894ca2bc5cd652269c316bcdc3ec441b (diff)
[SPARC64]: Detect trap frames in stack backtraces.
Now that we have a magic cookie in the pt_regs, we can properly detect trap frames in stack bactraces. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/stacktrace.c')
-rw-r--r--arch/sparc64/kernel/stacktrace.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c
index 84d39e873e8..01b52f561af 100644
--- a/arch/sparc64/kernel/stacktrace.c
+++ b/arch/sparc64/kernel/stacktrace.c
@@ -20,6 +20,8 @@ void save_stack_trace(struct stack_trace *trace)
thread_base = (unsigned long) tp;
do {
struct reg_window *rw;
+ struct pt_regs *regs;
+ unsigned long pc;
/* Bogus frame pointer? */
if (fp < (thread_base + sizeof(struct thread_info)) ||
@@ -27,11 +29,19 @@ void save_stack_trace(struct stack_trace *trace)
break;
rw = (struct reg_window *) fp;
+ regs = (struct pt_regs *) (rw + 1);
+
+ if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
+ pc = regs->tpc;
+ fp = regs->u_regs[UREG_I6] + STACK_BIAS;
+ } else {
+ pc = rw->ins[7];
+ fp = rw->ins[6] + 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);
}