Commit 3158d289 authored by Guo Ren's avatar Guo Ren

csky: Fixup no panic in kernel for some traps

These traps couldn't be hanppen in kernel and we must panic there not
send a signal to userspace.
Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
Cc: Arnd Bergmann <arnd@arndb.de>
parent 1994cc49
...@@ -120,6 +120,7 @@ asmlinkage void trap_c(struct pt_regs *regs) ...@@ -120,6 +120,7 @@ asmlinkage void trap_c(struct pt_regs *regs)
switch (vector) { switch (vector) {
case VEC_ZERODIV: case VEC_ZERODIV:
die_if_kernel("Kernel mode ZERO DIV", regs, vector);
sig = SIGFPE; sig = SIGFPE;
break; break;
/* ptrace */ /* ptrace */
...@@ -128,6 +129,7 @@ asmlinkage void trap_c(struct pt_regs *regs) ...@@ -128,6 +129,7 @@ asmlinkage void trap_c(struct pt_regs *regs)
sig = SIGTRAP; sig = SIGTRAP;
break; break;
case VEC_ILLEGAL: case VEC_ILLEGAL:
die_if_kernel("Kernel mode ILLEGAL", regs, vector);
#ifndef CONFIG_CPU_NO_USER_BKPT #ifndef CONFIG_CPU_NO_USER_BKPT
if (*(uint16_t *)instruction_pointer(regs) != USR_BKPT) if (*(uint16_t *)instruction_pointer(regs) != USR_BKPT)
#endif #endif
...@@ -139,6 +141,7 @@ asmlinkage void trap_c(struct pt_regs *regs) ...@@ -139,6 +141,7 @@ asmlinkage void trap_c(struct pt_regs *regs)
case VEC_TRAP1: case VEC_TRAP1:
/* jtagserver breakpoint */ /* jtagserver breakpoint */
case VEC_BREAKPOINT: case VEC_BREAKPOINT:
die_if_kernel("Kernel mode BKPT", regs, vector);
info.si_code = TRAP_BRKPT; info.si_code = TRAP_BRKPT;
sig = SIGTRAP; sig = SIGTRAP;
break; break;
...@@ -150,8 +153,10 @@ asmlinkage void trap_c(struct pt_regs *regs) ...@@ -150,8 +153,10 @@ asmlinkage void trap_c(struct pt_regs *regs)
#endif #endif
#ifdef CONFIG_CPU_HAS_FPU #ifdef CONFIG_CPU_HAS_FPU
case VEC_FPE: case VEC_FPE:
die_if_kernel("Kernel mode FPE", regs, vector);
return fpu_fpe(regs); return fpu_fpe(regs);
case VEC_PRIV: case VEC_PRIV:
die_if_kernel("Kernel mode PRIV", regs, vector);
if (fpu_libc_helper(regs)) if (fpu_libc_helper(regs))
return; return;
#endif #endif
......
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