diff options
Diffstat (limited to 'arch/mips/kernel/traps.c')
-rw-r--r-- | arch/mips/kernel/traps.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 7d76a85422b2..6b356f62289e 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -757,11 +757,12 @@ asmlinkage void do_cpu(struct pt_regs *regs) | |||
757 | { | 757 | { |
758 | unsigned int cpid; | 758 | unsigned int cpid; |
759 | 759 | ||
760 | die_if_kernel("do_cpu invoked from kernel context!", regs); | ||
761 | |||
760 | cpid = (regs->cp0_cause >> CAUSEB_CE) & 3; | 762 | cpid = (regs->cp0_cause >> CAUSEB_CE) & 3; |
761 | 763 | ||
762 | switch (cpid) { | 764 | switch (cpid) { |
763 | case 0: | 765 | case 0: |
764 | die_if_kernel("do_cpu invoked from kernel context!", regs); | ||
765 | if (!cpu_has_llsc) | 766 | if (!cpu_has_llsc) |
766 | if (!simulate_llsc(regs)) | 767 | if (!simulate_llsc(regs)) |
767 | return; | 768 | return; |
@@ -772,9 +773,6 @@ asmlinkage void do_cpu(struct pt_regs *regs) | |||
772 | break; | 773 | break; |
773 | 774 | ||
774 | case 1: | 775 | case 1: |
775 | if (!test_thread_flag(TIF_ALLOW_FP_IN_KERNEL)) | ||
776 | die_if_kernel("do_cpu invoked from kernel context!", | ||
777 | regs); | ||
778 | if (used_math()) /* Using the FPU again. */ | 776 | if (used_math()) /* Using the FPU again. */ |
779 | own_fpu(1); | 777 | own_fpu(1); |
780 | else { /* First time FPU user. */ | 778 | else { /* First time FPU user. */ |
@@ -782,19 +780,7 @@ asmlinkage void do_cpu(struct pt_regs *regs) | |||
782 | set_used_math(); | 780 | set_used_math(); |
783 | } | 781 | } |
784 | 782 | ||
785 | if (raw_cpu_has_fpu) { | 783 | if (!raw_cpu_has_fpu) { |
786 | if (test_thread_flag(TIF_ALLOW_FP_IN_KERNEL)) { | ||
787 | local_irq_disable(); | ||
788 | if (cpu_has_fpu) | ||
789 | regs->cp0_status |= ST0_CU1; | ||
790 | /* | ||
791 | * We must return without enabling | ||
792 | * interrupts to ensure keep FPU | ||
793 | * ownership until resume. | ||
794 | */ | ||
795 | return; | ||
796 | } | ||
797 | } else { | ||
798 | int sig; | 784 | int sig; |
799 | sig = fpu_emulator_cop1Handler(regs, | 785 | sig = fpu_emulator_cop1Handler(regs, |
800 | ¤t->thread.fpu, 0); | 786 | ¤t->thread.fpu, 0); |
@@ -836,7 +822,6 @@ asmlinkage void do_cpu(struct pt_regs *regs) | |||
836 | 822 | ||
837 | case 2: | 823 | case 2: |
838 | case 3: | 824 | case 3: |
839 | die_if_kernel("do_cpu invoked from kernel context!", regs); | ||
840 | break; | 825 | break; |
841 | } | 826 | } |
842 | 827 | ||