提交 b3a5acc1 编写于 作者: H Harvey Harrison 提交者: Ingo Molnar

x86: use fixup_exception() in traps_64.c

Use the fixup_exception() helper instead of the open-coded
search_extable() users.
Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 318aa296
...@@ -601,19 +601,12 @@ static void __kprobes do_trap(int trapnr, int signr, char *str, ...@@ -601,19 +601,12 @@ static void __kprobes do_trap(int trapnr, int signr, char *str,
} }
/* kernel trap */ if (!fixup_exception(regs)) {
{ tsk->thread.error_code = error_code;
const struct exception_table_entry *fixup; tsk->thread.trap_no = trapnr;
fixup = search_exception_tables(regs->ip); die(str, regs, error_code);
if (fixup)
regs->ip = fixup->fixup;
else {
tsk->thread.error_code = error_code;
tsk->thread.trap_no = trapnr;
die(str, regs, error_code);
}
return;
} }
return;
} }
#define DO_ERROR(trapnr, signr, str, name) \ #define DO_ERROR(trapnr, signr, str, name) \
...@@ -703,22 +696,15 @@ asmlinkage void __kprobes do_general_protection(struct pt_regs * regs, ...@@ -703,22 +696,15 @@ asmlinkage void __kprobes do_general_protection(struct pt_regs * regs,
return; return;
} }
/* kernel gp */ if (fixup_exception(regs))
{ return;
const struct exception_table_entry *fixup;
fixup = search_exception_tables(regs->ip);
if (fixup) {
regs->ip = fixup->fixup;
return;
}
tsk->thread.error_code = error_code; tsk->thread.error_code = error_code;
tsk->thread.trap_no = 13; tsk->thread.trap_no = 13;
if (notify_die(DIE_GPF, "general protection fault", regs, if (notify_die(DIE_GPF, "general protection fault", regs,
error_code, 13, SIGSEGV) == NOTIFY_STOP) error_code, 13, SIGSEGV) == NOTIFY_STOP)
return; return;
die("general protection fault", regs, error_code); die("general protection fault", regs, error_code);
}
} }
static __kprobes void static __kprobes void
...@@ -910,12 +896,9 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs, ...@@ -910,12 +896,9 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr) static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr)
{ {
const struct exception_table_entry *fixup; if (fixup_exception(regs))
fixup = search_exception_tables(regs->ip);
if (fixup) {
regs->ip = fixup->fixup;
return 1; return 1;
}
notify_die(DIE_GPF, str, regs, 0, trapnr, SIGFPE); notify_die(DIE_GPF, str, regs, 0, trapnr, SIGFPE);
/* Illegal floating point operation in the kernel */ /* Illegal floating point operation in the kernel */
current->thread.trap_no = trapnr; current->thread.trap_no = trapnr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册