Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/types.h>
0003 #include <linux/errno.h>
0004 #include <linux/uaccess.h>
0005 
0006 #include <asm/sfp-machine.h>
0007 #include <math-emu/soft-fp.h>
0008 
0009 int
0010 mcrfs(u32 *ccr, u32 crfD, u32 crfS)
0011 {
0012     u32 value, clear;
0013 
0014 #ifdef DEBUG
0015     printk("%s: %p (%08x) %d %d\n", __func__, ccr, *ccr, crfD, crfS);
0016 #endif
0017 
0018     clear = 15 << ((7 - crfS) << 2);
0019     if (!crfS)
0020         clear = 0x90000000;
0021 
0022     value = (__FPU_FPSCR >> ((7 - crfS) << 2)) & 15;
0023     __FPU_FPSCR &= ~(clear);
0024 
0025     *ccr &= ~(15 << ((7 - crfD) << 2));
0026     *ccr |= (value << ((7 - crfD) << 2));
0027 
0028 #ifdef DEBUG
0029     printk("CR: %08x\n", __func__, *ccr);
0030 #endif
0031 
0032     return 0;
0033 }