Linux 2.6.26-rc5
[linux-2.6/openmoko-kernel/knife-kernel.git] / arch / powerpc / math-emu / mtfsf.c
blob48014d8e3af1efa9e7c701c59140ec75f658180f
1 #include <linux/types.h>
2 #include <linux/errno.h>
3 #include <asm/uaccess.h>
5 #include "soft-fp.h"
7 int
8 mtfsf(unsigned int FM, u32 *frB)
10 u32 mask;
12 if (FM == 0)
13 return 0;
15 if (FM == 0xff)
16 mask = 0x9fffffff;
17 else {
18 mask = 0;
19 if (FM & (1 << 0))
20 mask |= 0x90000000;
21 if (FM & (1 << 1))
22 mask |= 0x0f000000;
23 if (FM & (1 << 2))
24 mask |= 0x00f00000;
25 if (FM & (1 << 3))
26 mask |= 0x000f0000;
27 if (FM & (1 << 4))
28 mask |= 0x0000f000;
29 if (FM & (1 << 5))
30 mask |= 0x00000f00;
31 if (FM & (1 << 6))
32 mask |= 0x000000f0;
33 if (FM & (1 << 7))
34 mask |= 0x0000000f;
37 __FPU_FPSCR &= ~(mask);
38 __FPU_FPSCR |= (frB[1] & mask);
40 #ifdef DEBUG
41 printk("%s: %02x %p: %08lx\n", __func__, FM, frB, __FPU_FPSCR);
42 #endif
44 return 0;