diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2015-04-04 01:27:10 +0300 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-08 02:10:17 +0300 |
commit | 443c44032a54f9acf027a8e688380fddc809bc19 (patch) | |
tree | 482d477dc139c712bec7f79212408c46e5e79409 /arch/mips/kernel/mips-r2-to-r6-emul.c | |
parent | ed2d72c1eb3643b7c109bdf387563d9b9a30c279 (diff) | |
download | linux-443c44032a54f9acf027a8e688380fddc809bc19.tar.xz |
MIPS: Always clear FCSR cause bits after emulation
Clear any FCSR cause bits recorded in the saved FPU context after
emulation in all cases rather than in `do_fpe' only, so that any
unmasked IEEE 754 exception left from emulation does not cause a fatal
kernel-mode FPE hardware exception with the CTC1 instruction used by the
kernel to subsequently restore FCSR hardware from the saved FPU context.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9704/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/mips-r2-to-r6-emul.c')
-rw-r--r-- | arch/mips/kernel/mips-r2-to-r6-emul.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c index f1d1b42d1902..6633fa97d431 100644 --- a/arch/mips/kernel/mips-r2-to-r6-emul.c +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c @@ -1170,6 +1170,12 @@ fpu_emul: &fault_addr); /* + * We can't allow the emulated instruction to leave any of + * the cause bits set in $fcr31. + */ + current->thread.fpu.fcr31 &= ~FPU_CSR_ALL_X; + + /* * this is a tricky issue - lose_fpu() uses LL/SC atomics * if FPU is owned and effectively cancels user level LL/SC. * So, it could be logical to don't restore FPU ownership here. |