lfs.c 632 B

12345678910111213141516171819202122232425262728293031323334353637
  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. lfs(void *frD, void *ea)
  9. {
  10. FP_DECL_D(R);
  11. FP_DECL_S(A);
  12. float f;
  13. #ifdef DEBUG
  14. printk("%s: D %p, ea %p\n", __FUNCTION__, frD, ea);
  15. #endif
  16. if (copy_from_user(&f, ea, sizeof(float)))
  17. return -EFAULT;
  18. __FP_UNPACK_S(A, &f);
  19. #ifdef DEBUG
  20. printk("A: %ld %lu %ld (%ld) [%08lx]\n", A_s, A_f, A_e, A_c,
  21. *(unsigned long *)&f);
  22. #endif
  23. FP_CONV(D, S, 2, 1, R, A);
  24. #ifdef DEBUG
  25. printk("R: %ld %lu %lu %ld (%ld)\n", R_s, R_f1, R_f0, R_e, R_c);
  26. #endif
  27. return __FP_PACK_D(frD, R);
  28. }