blob: d70cf714994c78e388a0843458a671128227ddab [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6
7int
8mtfsf(unsigned int FM, u32 *frB)
9{
10 u32 mask;
11
12 if (FM == 0)
13 return 0;
14
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;
35 }
36
37 __FPU_FPSCR &= ~(mask);
38 __FPU_FPSCR |= (frB[1] & mask);
39
40#ifdef DEBUG
41 printk("%s: %02x %p: %08lx\n", __FUNCTION__, FM, frB, __FPU_FPSCR);
42#endif
43
44 return 0;
45}