From 1d74f6bc85cbdc4601e5aea1e67ccbd259f0c7f4 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Mon, 9 May 2005 13:16:07 +0000 Subject: __compute_return_epc() uses CFC1 instruction which might result in a coprocessor unusable exception since the process can lose its fpu context by preemption. Signed-off-by: Ralf Baechle --- arch/mips/kernel/branch.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'arch/mips/kernel/branch.c') diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c index 01117e977a7..56aea5f526a 100644 --- a/arch/mips/kernel/branch.c +++ b/arch/mips/kernel/branch.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -161,10 +162,13 @@ int __compute_return_epc(struct pt_regs *regs) * And now the FPA/cp1 branch instructions. */ case cop1_op: - if (!cpu_has_fpu) - fcr31 = current->thread.fpu.soft.fcr31; - else + preempt_disable(); + if (is_fpu_owner()) asm volatile("cfc1\t%0,$31" : "=r" (fcr31)); + else + fcr31 = current->thread.fpu.hard.fcr31; + preempt_enable(); + bit = (insn.i_format.rt >> 2); bit += (bit != 0); bit += 23; -- cgit v1.2.3