diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-10-15 20:38:50 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-11-29 20:14:50 -0500 |
commit | 63dc68a8cf60cb110b147dab1704d990808b39e2 (patch) | |
tree | 48dbc7a170eff5e16c3a1f6bf4fe53ab168c4e83 /arch/mips | |
parent | 005985609ff72df3257fde6b29aa9d71342c2a6b (diff) |
[MIPS] Use conditional traps for BUG_ON on MIPS II and better.
This shaves of around 4kB and a few cycles for the average kernel that
has CONFIG_BUG enabled.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/kernel/traps.c | 14 |
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 | ||