123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include "fenv_libc.h"
- #include <syscall.h>
- #include <sys/prctl.h>
- int
- __feupdateenv (const fenv_t *envp)
- {
- unsigned long fpescr, old, new, pflags;
- fenv_union_t u;
- INTERNAL_SYSCALL_DECL (err);
-
- u.fenv = *envp;
- new = u.l[1];
- old = fegetenv_register ();
- new |= (old & FE_ALL_EXCEPT);
- INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
- pflags |= u.l[0];
- INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, pflags);
-
- fesetenv_register (new);
- feraiseexcept (new & FE_ALL_EXCEPT);
-
- return 0;
- }
|