PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/arch/ppc/math-emu/mtfsf.c

https://bitbucket.org/evzijst/gittest
C | 45 lines | 38 code | 7 blank | 0 comment | 13 complexity | 5ce2a387c4107546b3d523950776e428 MD5 | raw file
 1#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}