fegetenv.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Store current floating-point environment.
  2. Copyright (C) 1997-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library. If not, see
  15. <http://www.gnu.org/licenses/>. */
  16. #include <fenv.h>
  17. int
  18. __fegetenv (fenv_t *envp)
  19. {
  20. #ifdef __mcoldfire__
  21. __asm__ ("fmove%.l %/fpcr,%0" : "=dm" (envp->__control_register));
  22. __asm__ ("fmove%.l %/fpsr,%0" : "=dm" (envp->__status_register));
  23. __asm__ ("fmove%.l %/fpiar,%0" : "=dm" (envp->__instruction_address));
  24. #else
  25. __asm__ ("fmovem%.l %/fpcr/%/fpsr/%/fpiar,%0" : "=m" (*envp));
  26. #endif
  27. /* Success. */
  28. return 0;
  29. }
  30. #include <shlib-compat.h>
  31. #if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
  32. strong_alias (__fegetenv, __old_fegetenv)
  33. compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
  34. #endif
  35. libm_hidden_def (__fegetenv)
  36. libm_hidden_ver (__fegetenv, fegetenv)
  37. versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);