aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/traps.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/traps.c')
-rw-r--r--arch/mips/kernel/traps.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 0ae19e1fa867..2a932cada244 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -669,8 +669,6 @@ asmlinkage void do_bp(struct pt_regs *regs)
669 unsigned int opcode, bcode; 669 unsigned int opcode, bcode;
670 siginfo_t info; 670 siginfo_t info;
671 671
672 die_if_kernel("Break instruction in kernel code", regs);
673
674 if (get_user(opcode, (unsigned int __user *) exception_epc(regs))) 672 if (get_user(opcode, (unsigned int __user *) exception_epc(regs)))
675 goto out_sigsegv; 673 goto out_sigsegv;
676 674
@@ -693,6 +691,7 @@ asmlinkage void do_bp(struct pt_regs *regs)
693 switch (bcode) { 691 switch (bcode) {
694 case BRK_OVERFLOW << 10: 692 case BRK_OVERFLOW << 10:
695 case BRK_DIVZERO << 10: 693 case BRK_DIVZERO << 10:
694 die_if_kernel("Break instruction in kernel code", regs);
696 if (bcode == (BRK_DIVZERO << 10)) 695 if (bcode == (BRK_DIVZERO << 10))
697 info.si_code = FPE_INTDIV; 696 info.si_code = FPE_INTDIV;
698 else 697 else
@@ -702,7 +701,11 @@ asmlinkage void do_bp(struct pt_regs *regs)
702 info.si_addr = (void __user *) regs->cp0_epc; 701 info.si_addr = (void __user *) regs->cp0_epc;
703 force_sig_info(SIGFPE, &info, current); 702 force_sig_info(SIGFPE, &info, current);
704 break; 703 break;
704 case BRK_BUG:
705 die("Kernel bug detected", regs);
706 break;
705 default: 707 default:
708 die_if_kernel("Break instruction in kernel code", regs);
706 force_sig(SIGTRAP, current); 709 force_sig(SIGTRAP, current);
707 } 710 }
708 711
@@ -715,8 +718,6 @@ asmlinkage void do_tr(struct pt_regs *regs)
715 unsigned int opcode, tcode = 0; 718 unsigned int opcode, tcode = 0;
716 siginfo_t info; 719 siginfo_t info;
717 720
718 die_if_kernel("Trap instruction in kernel code", regs);
719
720 if (get_user(opcode, (unsigned int __user *) exception_epc(regs))) 721 if (get_user(opcode, (unsigned int __user *) exception_epc(regs)))
721 goto out_sigsegv; 722 goto out_sigsegv;
722 723
@@ -733,6 +734,7 @@ asmlinkage void do_tr(struct pt_regs *regs)
733 switch (tcode) { 734 switch (tcode) {
734 case BRK_OVERFLOW: 735 case BRK_OVERFLOW:
735 case BRK_DIVZERO: 736 case BRK_DIVZERO:
737 die_if_kernel("Trap instruction in kernel code", regs);
736 if (tcode == BRK_DIVZERO) 738 if (tcode == BRK_DIVZERO)
737 info.si_code = FPE_INTDIV; 739 info.si_code = FPE_INTDIV;
738 else 740 else
@@ -742,7 +744,11 @@ asmlinkage void do_tr(struct pt_regs *regs)
742 info.si_addr = (void __user *) regs->cp0_epc; 744 info.si_addr = (void __user *) regs->cp0_epc;
743 force_sig_info(SIGFPE, &info, current); 745 force_sig_info(SIGFPE, &info, current);
744 break; 746 break;
747 case BRK_BUG:
748 die("Kernel bug detected", regs);
749 break;
745 default: 750 default:
751 die_if_kernel("Trap instruction in kernel code", regs);
746 force_sig(SIGTRAP, current); 752 force_sig(SIGTRAP, current);
747 } 753 }
748 754