stfs.c 693 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <linux/types.h>
  2. #include <linux/errno.h>
  3. #include <asm/uaccess.h>
  4. #include "soft-fp.h"
  5. #include "double.h"
  6. #include "single.h"
  7. int
  8. stfs(void *frS, void *ea)
  9. {
  10. FP_DECL_D(A);
  11. FP_DECL_S(R);
  12. float f;
  13. int err;
  14. #ifdef DEBUG
  15. printk("%s: S %p, ea %p\n", __FUNCTION__, frS, ea);
  16. #endif
  17. __FP_UNPACK_D(A, frS);
  18. #ifdef DEBUG
  19. printk("A: %ld %lu %lu %ld (%ld)\n", A_s, A_f1, A_f0, A_e, A_c);
  20. #endif
  21. FP_CONV(S, D, 1, 2, R, A);
  22. #ifdef DEBUG
  23. printk("R: %ld %lu %ld (%ld)\n", R_s, R_f, R_e, R_c);
  24. #endif
  25. err = _FP_PACK_CANONICAL(S, 1, R);
  26. if (!err || !__FPU_TRAP_P(err)) {
  27. __FP_PACK_RAW_1(S, &f, R);
  28. if (copy_to_user(ea, &f, sizeof(float)))
  29. return -EFAULT;
  30. }
  31. return err;
  32. }