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 #include <math-emu/double.h>
0009 #include <math-emu/single.h>
0010 
0011 int
0012 stfs(void *frS, void *ea)
0013 {
0014     FP_DECL_D(A);
0015     FP_DECL_S(R);
0016     FP_DECL_EX;
0017     float f;
0018 
0019 #ifdef DEBUG
0020     printk("%s: S %p, ea %p\n", __func__, frS, ea);
0021 #endif
0022 
0023     FP_UNPACK_DP(A, frS);
0024 
0025 #ifdef DEBUG
0026     printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
0027 #endif
0028 
0029     FP_CONV(S, D, 1, 2, R, A);
0030 
0031 #ifdef DEBUG
0032     printk("R: %ld %lu %ld (%ld)\n", R_s, R_f, R_e, R_c);
0033 #endif
0034 
0035     _FP_PACK_CANONICAL(S, 1, R);
0036     if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) {
0037         _FP_PACK_RAW_1_P(S, &f, R);
0038         if (copy_to_user(ea, &f, sizeof(float)))
0039             return -EFAULT;
0040     }
0041 
0042     return FP_CUR_EXCEPTIONS;
0043 }