Commit 14d2c68b authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parent a051bc5b
...@@ -19,7 +19,7 @@ void save_stack_trace(struct stack_trace *trace) ...@@ -19,7 +19,7 @@ void save_stack_trace(struct stack_trace *trace)
fp = ksp + STACK_BIAS; fp = ksp + STACK_BIAS;
thread_base = (unsigned long) tp; thread_base = (unsigned long) tp;
do { do {
struct reg_window *rw; struct sparc_stackf *sf;
struct pt_regs *regs; struct pt_regs *regs;
unsigned long pc; unsigned long pc;
...@@ -28,15 +28,17 @@ void save_stack_trace(struct stack_trace *trace) ...@@ -28,15 +28,17 @@ void save_stack_trace(struct stack_trace *trace)
fp >= (thread_base + THREAD_SIZE)) fp >= (thread_base + THREAD_SIZE))
break; break;
rw = (struct reg_window *) fp; sf = (struct sparc_stackf *) fp;
regs = (struct pt_regs *) (rw + 1); regs = (struct pt_regs *) (sf + 1);
if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) { if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
if (!(regs->tstate & TSTATE_PRIV))
break;
pc = regs->tpc; pc = regs->tpc;
fp = regs->u_regs[UREG_I6] + STACK_BIAS; fp = regs->u_regs[UREG_I6] + STACK_BIAS;
} else { } else {
pc = rw->ins[7]; pc = sf->callers_pc;
fp = rw->ins[6] + STACK_BIAS; fp = (unsigned long)sf->fp + STACK_BIAS;
} }
if (trace->skip > 0) if (trace->skip > 0)
......
...@@ -2116,7 +2116,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp) ...@@ -2116,7 +2116,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
printk("\n"); printk("\n");
#endif #endif
do { do {
struct reg_window *rw; struct sparc_stackf *sf;
struct pt_regs *regs; struct pt_regs *regs;
unsigned long pc; unsigned long pc;
...@@ -2124,15 +2124,17 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp) ...@@ -2124,15 +2124,17 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
if (fp < (thread_base + sizeof(struct thread_info)) || if (fp < (thread_base + sizeof(struct thread_info)) ||
fp >= (thread_base + THREAD_SIZE)) fp >= (thread_base + THREAD_SIZE))
break; break;
rw = (struct reg_window *)fp; sf = (struct sparc_stackf *) fp;
regs = (struct pt_regs *) (rw + 1); regs = (struct pt_regs *) (sf + 1);
if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) { if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
if (!(regs->tstate & TSTATE_PRIV))
break;
pc = regs->tpc; pc = regs->tpc;
fp = regs->u_regs[UREG_I6] + STACK_BIAS; fp = regs->u_regs[UREG_I6] + STACK_BIAS;
} else { } else {
pc = rw->ins[7]; pc = sf->callers_pc;
fp = rw->ins[6] + STACK_BIAS; fp = (unsigned long)sf->fp + STACK_BIAS;
} }
printk(" [%016lx] ", pc); printk(" [%016lx] ", pc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment