aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-05-21 21:15:53 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-21 21:15:53 -0400
commit14d2c68baa659cfd15dc782dd229ea304330c4f6 (patch)
tree73e9b2e3a5496333d41bf85894b0b0cfa779ad34 /arch
parenta051bc5bb1ac6dc138d529077fa20cbbc6622d95 (diff)
sparc64: Fix stack tracing through trap frames.
The offset to the pt_regs area was wrong, so we weren't looking at the right location for the magic cookie. A trap frame is composed of a "struct sparc_stackf" then a "struct pt_regs", the code was using "struct reg_window" instead of "struct sparc_stackf". Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc64/kernel/stacktrace.c12
-rw-r--r--arch/sparc64/kernel/traps.c12
2 files changed, 14 insertions, 10 deletions
diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c
index 01b52f561af4..c73ce3f4197e 100644
--- a/arch/sparc64/kernel/stacktrace.c
+++ b/arch/sparc64/kernel/stacktrace.c
@@ -19,7 +19,7 @@ void save_stack_trace(struct stack_trace *trace)
19 fp = ksp + STACK_BIAS; 19 fp = ksp + STACK_BIAS;
20 thread_base = (unsigned long) tp; 20 thread_base = (unsigned long) tp;
21 do { 21 do {
22 struct reg_window *rw; 22 struct sparc_stackf *sf;
23 struct pt_regs *regs; 23 struct pt_regs *regs;
24 unsigned long pc; 24 unsigned long pc;
25 25
@@ -28,15 +28,17 @@ void save_stack_trace(struct stack_trace *trace)
28 fp >= (thread_base + THREAD_SIZE)) 28 fp >= (thread_base + THREAD_SIZE))
29 break; 29 break;
30 30
31 rw = (struct reg_window *) fp; 31 sf = (struct sparc_stackf *) fp;
32 regs = (struct pt_regs *) (rw + 1); 32 regs = (struct pt_regs *) (sf + 1);
33 33
34 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) { 34 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
35 if (!(regs->tstate & TSTATE_PRIV))
36 break;
35 pc = regs->tpc; 37 pc = regs->tpc;
36 fp = regs->u_regs[UREG_I6] + STACK_BIAS; 38 fp = regs->u_regs[UREG_I6] + STACK_BIAS;
37 } else { 39 } else {
38 pc = rw->ins[7]; 40 pc = sf->callers_pc;
39 fp = rw->ins[6] + STACK_BIAS; 41 fp = (unsigned long)sf->fp + STACK_BIAS;
40 } 42 }
41 43
42 if (trace->skip > 0) 44 if (trace->skip > 0)
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index d9b8d46707d1..369749262653 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -2116,7 +2116,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
2116 printk("\n"); 2116 printk("\n");
2117#endif 2117#endif
2118 do { 2118 do {
2119 struct reg_window *rw; 2119 struct sparc_stackf *sf;
2120 struct pt_regs *regs; 2120 struct pt_regs *regs;
2121 unsigned long pc; 2121 unsigned long pc;
2122 2122
@@ -2124,15 +2124,17 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
2124 if (fp < (thread_base + sizeof(struct thread_info)) || 2124 if (fp < (thread_base + sizeof(struct thread_info)) ||
2125 fp >= (thread_base + THREAD_SIZE)) 2125 fp >= (thread_base + THREAD_SIZE))
2126 break; 2126 break;
2127 rw = (struct reg_window *)fp; 2127 sf = (struct sparc_stackf *) fp;
2128 regs = (struct pt_regs *) (rw + 1); 2128 regs = (struct pt_regs *) (sf + 1);
2129 2129
2130 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) { 2130 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
2131 if (!(regs->tstate & TSTATE_PRIV))
2132 break;
2131 pc = regs->tpc; 2133 pc = regs->tpc;
2132 fp = regs->u_regs[UREG_I6] + STACK_BIAS; 2134 fp = regs->u_regs[UREG_I6] + STACK_BIAS;
2133 } else { 2135 } else {
2134 pc = rw->ins[7]; 2136 pc = sf->callers_pc;
2135 fp = rw->ins[6] + STACK_BIAS; 2137 fp = (unsigned long)sf->fp + STACK_BIAS;
2136 } 2138 }
2137 2139
2138 printk(" [%016lx] ", pc); 2140 printk(" [%016lx] ", pc);