mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-12 05:24:12 +08:00
arm64: rename dump_instr as dump_kernel_instr
In traps.c, only __die calls dump_instr. However, this function has sub-function as __dump_instr. dump_kernel_instr can replace those functions. By using aarch64_insn_read, it does not have to change fs to KERNEL_DS. Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: jinho lim <jordan.lim@samsung.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This commit is contained in:
parent
d9db691d3c
commit
7b71665603
@ -66,16 +66,19 @@ static void dump_backtrace_entry(unsigned long where)
|
|||||||
printk(" %pS\n", (void *)where);
|
printk(" %pS\n", (void *)where);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __dump_instr(const char *lvl, struct pt_regs *regs)
|
static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
unsigned long addr = instruction_pointer(regs);
|
unsigned long addr = instruction_pointer(regs);
|
||||||
char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
|
char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (user_mode(regs))
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = -4; i < 1; i++) {
|
for (i = -4; i < 1; i++) {
|
||||||
unsigned int val, bad;
|
unsigned int val, bad;
|
||||||
|
|
||||||
bad = get_user(val, &((u32 *)addr)[i]);
|
bad = aarch64_insn_read(&((u32 *)addr)[i], &val);
|
||||||
|
|
||||||
if (!bad)
|
if (!bad)
|
||||||
p += sprintf(p, i == 0 ? "(%08x) " : "%08x ", val);
|
p += sprintf(p, i == 0 ? "(%08x) " : "%08x ", val);
|
||||||
@ -84,19 +87,8 @@ static void __dump_instr(const char *lvl, struct pt_regs *regs)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printk("%sCode: %s\n", lvl, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dump_instr(const char *lvl, struct pt_regs *regs)
|
printk("%sCode: %s\n", lvl, str);
|
||||||
{
|
|
||||||
if (!user_mode(regs)) {
|
|
||||||
mm_segment_t fs = get_fs();
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
__dump_instr(lvl, regs);
|
|
||||||
set_fs(fs);
|
|
||||||
} else {
|
|
||||||
__dump_instr(lvl, regs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
|
void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
|
||||||
@ -182,8 +174,7 @@ static int __die(const char *str, int err, struct pt_regs *regs)
|
|||||||
print_modules();
|
print_modules();
|
||||||
show_regs(regs);
|
show_regs(regs);
|
||||||
|
|
||||||
if (!user_mode(regs))
|
dump_kernel_instr(KERN_EMERG, regs);
|
||||||
dump_instr(KERN_EMERG, regs);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user