mirror of https://gitee.com/openkylin/linux.git
[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>
This commit is contained in:
parent
7697daaa89
commit
77c664fa58
|
@ -20,6 +20,8 @@ void save_stack_trace(struct stack_trace *trace)
|
||||||
thread_base = (unsigned long) tp;
|
thread_base = (unsigned long) tp;
|
||||||
do {
|
do {
|
||||||
struct reg_window *rw;
|
struct reg_window *rw;
|
||||||
|
struct pt_regs *regs;
|
||||||
|
unsigned long pc;
|
||||||
|
|
||||||
/* Bogus frame pointer? */
|
/* Bogus frame pointer? */
|
||||||
if (fp < (thread_base + sizeof(struct thread_info)) ||
|
if (fp < (thread_base + sizeof(struct thread_info)) ||
|
||||||
|
@ -27,11 +29,19 @@ void save_stack_trace(struct stack_trace *trace)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
rw = (struct reg_window *) fp;
|
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)
|
if (trace->skip > 0)
|
||||||
trace->skip--;
|
trace->skip--;
|
||||||
else
|
else
|
||||||
trace->entries[trace->nr_entries++] = rw->ins[7];
|
trace->entries[trace->nr_entries++] = pc;
|
||||||
|
|
||||||
fp = rw->ins[6] + STACK_BIAS;
|
|
||||||
} while (trace->nr_entries < trace->max_entries);
|
} while (trace->nr_entries < trace->max_entries);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2091,9 +2091,8 @@ static void user_instruction_dump(unsigned int __user *pc)
|
||||||
|
|
||||||
void show_stack(struct task_struct *tsk, unsigned long *_ksp)
|
void show_stack(struct task_struct *tsk, unsigned long *_ksp)
|
||||||
{
|
{
|
||||||
unsigned long pc, fp, thread_base, ksp;
|
unsigned long fp, thread_base, ksp;
|
||||||
struct thread_info *tp;
|
struct thread_info *tp;
|
||||||
struct reg_window *rw;
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
ksp = (unsigned long) _ksp;
|
ksp = (unsigned long) _ksp;
|
||||||
|
@ -2117,15 +2116,27 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
|
||||||
printk("\n");
|
printk("\n");
|
||||||
#endif
|
#endif
|
||||||
do {
|
do {
|
||||||
|
struct reg_window *rw;
|
||||||
|
struct pt_regs *regs;
|
||||||
|
unsigned long pc;
|
||||||
|
|
||||||
/* Bogus frame pointer? */
|
/* Bogus frame pointer? */
|
||||||
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;
|
rw = (struct reg_window *)fp;
|
||||||
pc = rw->ins[7];
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
printk(" [%016lx] ", pc);
|
printk(" [%016lx] ", pc);
|
||||||
print_symbol("%s\n", pc);
|
print_symbol("%s\n", pc);
|
||||||
fp = rw->ins[6] + STACK_BIAS;
|
|
||||||
} while (++count < 16);
|
} while (++count < 16);
|
||||||
#ifndef CONFIG_KALLSYMS
|
#ifndef CONFIG_KALLSYMS
|
||||||
printk("\n");
|
printk("\n");
|
||||||
|
|
Loading…
Reference in New Issue