Commit bfc32ad0 authored by Michal Simek's avatar Michal Simek

microblaze: Don't be noisy when userspace causes hardware exceptions

Signed-off-by: default avatarMichal Simek <monstr@monstr.eu>
parent 7ba3fe55
...@@ -72,7 +72,8 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, ...@@ -72,7 +72,8 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
#endif #endif
#if 0 #if 0
printk(KERN_WARNING "Exception %02x in %s mode, FSR=%08x PC=%08x ESR=%08x\n", printk(KERN_WARNING "Exception %02x in %s mode, FSR=%08x PC=%08x " \
"ESR=%08x\n",
type, user_mode(regs) ? "user" : "kernel", fsr, type, user_mode(regs) ? "user" : "kernel", fsr,
(unsigned int) regs->pc, (unsigned int) regs->esr); (unsigned int) regs->pc, (unsigned int) regs->esr);
#endif #endif
...@@ -80,42 +81,50 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, ...@@ -80,42 +81,50 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
switch (type & 0x1F) { switch (type & 0x1F) {
case MICROBLAZE_ILL_OPCODE_EXCEPTION: case MICROBLAZE_ILL_OPCODE_EXCEPTION:
if (user_mode(regs)) { if (user_mode(regs)) {
printk(KERN_WARNING "Illegal opcode exception in user mode.\n"); pr_debug(KERN_WARNING "Illegal opcode exception " \
"in user mode.\n");
_exception(SIGILL, regs, ILL_ILLOPC, addr); _exception(SIGILL, regs, ILL_ILLOPC, addr);
return; return;
} }
printk(KERN_WARNING "Illegal opcode exception in kernel mode.\n"); printk(KERN_WARNING "Illegal opcode exception " \
"in kernel mode.\n");
die("opcode exception", regs, SIGBUS); die("opcode exception", regs, SIGBUS);
break; break;
case MICROBLAZE_IBUS_EXCEPTION: case MICROBLAZE_IBUS_EXCEPTION:
if (user_mode(regs)) { if (user_mode(regs)) {
printk(KERN_WARNING "Instruction bus error exception in user mode.\n"); pr_debug(KERN_WARNING "Instruction bus error " \
"exception in user mode.\n");
_exception(SIGBUS, regs, BUS_ADRERR, addr); _exception(SIGBUS, regs, BUS_ADRERR, addr);
return; return;
} }
printk(KERN_WARNING "Instruction bus error exception in kernel mode.\n"); printk(KERN_WARNING "Instruction bus error exception " \
"in kernel mode.\n");
die("bus exception", regs, SIGBUS); die("bus exception", regs, SIGBUS);
break; break;
case MICROBLAZE_DBUS_EXCEPTION: case MICROBLAZE_DBUS_EXCEPTION:
if (user_mode(regs)) { if (user_mode(regs)) {
printk(KERN_WARNING "Data bus error exception in user mode.\n"); pr_debug(KERN_WARNING "Data bus error exception " \
"in user mode.\n");
_exception(SIGBUS, regs, BUS_ADRERR, addr); _exception(SIGBUS, regs, BUS_ADRERR, addr);
return; return;
} }
printk(KERN_WARNING "Data bus error exception in kernel mode.\n"); printk(KERN_WARNING "Data bus error exception " \
"in kernel mode.\n");
die("bus exception", regs, SIGBUS); die("bus exception", regs, SIGBUS);
break; break;
case MICROBLAZE_DIV_ZERO_EXCEPTION: case MICROBLAZE_DIV_ZERO_EXCEPTION:
if (user_mode(regs)) { if (user_mode(regs)) {
printk(KERN_WARNING "Divide by zero exception in user mode\n"); pr_debug(KERN_WARNING "Divide by zero exception " \
"in user mode\n");
_exception(SIGILL, regs, ILL_ILLOPC, addr); _exception(SIGILL, regs, ILL_ILLOPC, addr);
return; return;
} }
printk(KERN_WARNING "Divide by zero exception in kernel mode.\n"); printk(KERN_WARNING "Divide by zero exception " \
"in kernel mode.\n");
die("Divide by exception", regs, SIGBUS); die("Divide by exception", regs, SIGBUS);
break; break;
case MICROBLAZE_FPU_EXCEPTION: case MICROBLAZE_FPU_EXCEPTION:
printk(KERN_WARNING "FPU exception\n"); pr_debug(KERN_WARNING "FPU exception\n");
/* IEEE FP exception */ /* IEEE FP exception */
/* I removed fsr variable and use code var for storing fsr */ /* I removed fsr variable and use code var for storing fsr */
if (fsr & FSR_IO) if (fsr & FSR_IO)
...@@ -133,7 +142,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, ...@@ -133,7 +142,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
case MICROBLAZE_PRIVILEGED_EXCEPTION: case MICROBLAZE_PRIVILEGED_EXCEPTION:
printk(KERN_WARNING "Privileged exception\n"); pr_debug(KERN_WARNING "Privileged exception\n");
/* "brk r0,r0" - used as debug breakpoint */ /* "brk r0,r0" - used as debug breakpoint */
if (get_user(code, (unsigned long *)regs->pc) == 0 if (get_user(code, (unsigned long *)regs->pc) == 0
&& code == 0x980c0000) { && code == 0x980c0000) {
......
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