mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 06:49:52 +00:00
LoongArch: Refactor bug_handler() implementation
1. Early return for user mode triggered exception with all types. 2. Give a chance to call fixup_exception() for default types (like S390). Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
0816b2ea18
commit
5d0cc7e585
@ -597,17 +597,24 @@ int is_valid_bugaddr(unsigned long addr)
|
||||
|
||||
static void bug_handler(struct pt_regs *regs)
|
||||
{
|
||||
if (user_mode(regs)) {
|
||||
force_sig(SIGTRAP);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (report_bug(regs->csr_era, regs)) {
|
||||
case BUG_TRAP_TYPE_BUG:
|
||||
case BUG_TRAP_TYPE_NONE:
|
||||
die_if_kernel("Oops - BUG", regs);
|
||||
force_sig(SIGTRAP);
|
||||
die("Oops - BUG", regs);
|
||||
break;
|
||||
|
||||
case BUG_TRAP_TYPE_WARN:
|
||||
/* Skip the BUG instruction and continue */
|
||||
regs->csr_era += LOONGARCH_INSN_SIZE;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!fixup_exception(regs))
|
||||
die("Oops - BUG", regs);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user