Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
1da177e4 LT |
2 | #include <linux/types.h> |
3 | #include <linux/errno.h> | |
7c0f6ba6 | 4 | #include <linux/uaccess.h> |
1da177e4 | 5 | |
d2b194ed KG |
6 | #include <asm/sfp-machine.h> |
7 | #include <math-emu/soft-fp.h> | |
1da177e4 LT |
8 | |
9 | int | |
10 | mcrfs(u32 *ccr, u32 crfD, u32 crfS) | |
11 | { | |
12 | u32 value, clear; | |
13 | ||
14 | #ifdef DEBUG | |
e48b1b45 | 15 | printk("%s: %p (%08x) %d %d\n", __func__, ccr, *ccr, crfD, crfS); |
1da177e4 LT |
16 | #endif |
17 | ||
18 | clear = 15 << ((7 - crfS) << 2); | |
19 | if (!crfS) | |
20 | clear = 0x90000000; | |
21 | ||
22 | value = (__FPU_FPSCR >> ((7 - crfS) << 2)) & 15; | |
23 | __FPU_FPSCR &= ~(clear); | |
24 | ||
25 | *ccr &= ~(15 << ((7 - crfD) << 2)); | |
26 | *ccr |= (value << ((7 - crfD) << 2)); | |
27 | ||
28 | #ifdef DEBUG | |
e48b1b45 | 29 | printk("CR: %08x\n", __func__, *ccr); |
1da177e4 LT |
30 | #endif |
31 | ||
32 | return 0; | |
33 | } |