]> git.ipfire.org Git - thirdparty/kernel/linux.git/blob - arch/powerpc/math-emu/mcrfs.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[thirdparty/kernel/linux.git] / arch / powerpc / math-emu / mcrfs.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/types.h>
3 #include <linux/errno.h>
4 #include <linux/uaccess.h>
5
6 #include <asm/sfp-machine.h>
7 #include <math-emu/soft-fp.h>
8
9 int
10 mcrfs(u32 *ccr, u32 crfD, u32 crfS)
11 {
12 u32 value, clear;
13
14 #ifdef DEBUG
15 printk("%s: %p (%08x) %d %d\n", __func__, ccr, *ccr, crfD, crfS);
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
29 printk("CR: %08x\n", __func__, *ccr);
30 #endif
31
32 return 0;
33 }