aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/math-emu/mcrfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/math-emu/mcrfs.c')
-rw-r--r--arch/powerpc/math-emu/mcrfs.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/powerpc/math-emu/mcrfs.c b/arch/powerpc/math-emu/mcrfs.c
new file mode 100644
index 000000000000..106dd912914b
--- /dev/null
+++ b/arch/powerpc/math-emu/mcrfs.c
@@ -0,0 +1,31 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5#include "soft-fp.h"
6
7int
8mcrfs(u32 *ccr, u32 crfD, u32 crfS)
9{
10 u32 value, clear;
11
12#ifdef DEBUG
13 printk("%s: %p (%08x) %d %d\n", __FUNCTION__, ccr, *ccr, crfD, crfS);
14#endif
15
16 clear = 15 << ((7 - crfS) << 2);
17 if (!crfS)
18 clear = 0x90000000;
19
20 value = (__FPU_FPSCR >> ((7 - crfS) << 2)) & 15;
21 __FPU_FPSCR &= ~(clear);
22
23 *ccr &= ~(15 << ((7 - crfD) << 2));
24 *ccr |= (value << ((7 - crfD) << 2));
25
26#ifdef DEBUG
27 printk("CR: %08x\n", __FUNCTION__, *ccr);
28#endif
29
30 return 0;
31}