* add p cc
[mascara-docs.git] / i386 / linux / linux-2.3.21 / arch / ppc / math-emu / stfs.c
blob5cb576cd547fd38ac5a562771adfad7a570c65f5
1 /* $Id: stfs.c,v 1.1 1999/08/23 19:00:35 cort Exp $
2 */
4 #include <linux/types.h>
5 #include <linux/errno.h>
6 #include <asm/uaccess.h>
8 #include "soft-fp.h"
9 #include "double.h"
10 #include "single.h"
12 int
13 stfs(void *frS, void *ea)
15 FP_DECL_D(A);
16 FP_DECL_S(R);
17 float f;
18 int err;
20 #ifdef DEBUG
21 printk("%s: S %p, ea %p\n", __FUNCTION__, frS, ea);
22 #endif
24 __FP_UNPACK_D(A, frS);
26 #ifdef DEBUG
27 printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
28 #endif
30 FP_CONV(S, D, 1, 2, R, A);
32 #ifdef DEBUG
33 printk("R: %ld %lu %ld (%ld)\n", R_s, R_f, R_e, R_c);
34 #endif
36 err = _FP_PACK_CANONICAL(S, 1, R);
37 if (!err || !__FPU_TRAP_P(err)) {
38 __FP_PACK_RAW_1(S, &f, R);
39 if (copy_to_user(ea, &f, sizeof(float)))
40 return -EFAULT;
43 return err;