(ELF_MACHINE_NO_RELA): Define unconditionally to defined RTLD_BOOTSTRAP.
[glibc-ports.git] / sysdeps / hppa / fpu / fesetenv.c
blob526773214b73bfd75500c6c7ef13231028770156
1 /* Install given floating-point environment.
2 Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by David Huggins-Daines <dhd@debian.org>, 2000
5 Based on the m68k version by
6 Andreas Schwab <schwab@suse.de>
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the GNU C Library; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 02111-1307 USA. */
23 #include <fenv.h>
25 int
26 fesetenv (const fenv_t *envp)
28 fenv_t temp;
29 fenv_t * _regs = &temp;
31 /* Install the environment specified by ENVP. But there are a few
32 values which we do not want to come from the saved environment.
33 Therefore, we get the current environment and replace the values
34 we want to use from the environment specified by the parameter. */
35 __asm__ (
36 "fstd,ma %%fr0,8(%1)\n"
37 "fstd,ma %%fr1,8(%1)\n"
38 "fstd,ma %%fr2,8(%1)\n"
39 "fstd %%fr3,0(%1)\n"
40 : "=m" (*_regs), "+r" (_regs));
42 temp.__status_word &= ~(FE_ALL_EXCEPT
43 | (FE_ALL_EXCEPT << 27)
44 | FE_DOWNWARD);
45 if (envp == FE_DFL_ENV)
47 else if (envp == FE_NOMASK_ENV)
48 temp.__status_word |= FE_ALL_EXCEPT;
49 else
50 temp.__status_word |= (envp->__status_word
51 & (FE_ALL_EXCEPT
52 | FE_DOWNWARD
53 | (FE_ALL_EXCEPT << 27)));
55 /* Load the new environment. */
56 __asm__ (
57 "fldd,ma -8(%1),%%fr3\n"
58 "fldd,ma -8(%1),%%fr2\n"
59 "fldd,ma -8(%1),%%fr1\n"
60 "fldd 0(%1),%%fr0\n"
61 : "=m" (*_regs), "+r" (_regs));
63 /* Success. */
64 return 0;
66 libm_hidden_def (fesetenv)