aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/math-emu/mtfsf.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/math-emu/mtfsf.c')
-rw-r--r--arch/powerpc/math-emu/mtfsf.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/powerpc/math-emu/mtfsf.c b/arch/powerpc/math-emu/mtfsf.c
index 48014d8e3af1..dbce92e4f046 100644
--- a/arch/powerpc/math-emu/mtfsf.c
+++ b/arch/powerpc/math-emu/mtfsf.c
@@ -2,12 +2,14 @@
2#include <linux/errno.h> 2#include <linux/errno.h>
3#include <asm/uaccess.h> 3#include <asm/uaccess.h>
4 4
5#include "soft-fp.h" 5#include <asm/sfp-machine.h>
6#include <math-emu/soft-fp.h>
6 7
7int 8int
8mtfsf(unsigned int FM, u32 *frB) 9mtfsf(unsigned int FM, u32 *frB)
9{ 10{
10 u32 mask; 11 u32 mask;
12 u32 fpscr;
11 13
12 if (FM == 0) 14 if (FM == 0)
13 return 0; 15 return 0;
@@ -37,6 +39,22 @@ mtfsf(unsigned int FM, u32 *frB)
37 __FPU_FPSCR &= ~(mask); 39 __FPU_FPSCR &= ~(mask);
38 __FPU_FPSCR |= (frB[1] & mask); 40 __FPU_FPSCR |= (frB[1] & mask);
39 41
42 __FPU_FPSCR &= ~(FPSCR_VX);
43 if (__FPU_FPSCR & (FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI |
44 FPSCR_VXZDZ | FPSCR_VXIMZ | FPSCR_VXVC |
45 FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI))
46 __FPU_FPSCR |= FPSCR_VX;
47
48 fpscr = __FPU_FPSCR;
49 fpscr &= ~(FPSCR_FEX);
50 if (((fpscr & FPSCR_VX) && (fpscr & FPSCR_VE)) ||
51 ((fpscr & FPSCR_OX) && (fpscr & FPSCR_OE)) ||
52 ((fpscr & FPSCR_UX) && (fpscr & FPSCR_UE)) ||
53 ((fpscr & FPSCR_ZX) && (fpscr & FPSCR_ZE)) ||
54 ((fpscr & FPSCR_XX) && (fpscr & FPSCR_XE)))
55 fpscr |= FPSCR_FEX;
56 __FPU_FPSCR = fpscr;
57
40#ifdef DEBUG 58#ifdef DEBUG
41 printk("%s: %02x %p: %08lx\n", __func__, FM, frB, __FPU_FPSCR); 59 printk("%s: %02x %p: %08lx\n", __func__, FM, frB, __FPU_FPSCR);
42#endif 60#endif