Back to index

glibc  2.9
Functions
feholdexcpt.c File Reference
#include <fenv.h>
#include <string.h>

Go to the source code of this file.

Functions

int feholdexcept (fenv_t *envp)

Function Documentation

int feholdexcept ( fenv_t envp)

Definition at line 25 of file feholdexcpt.c.

{
  union { unsigned long long buf[4]; fenv_t env; } clear;
  unsigned long long *bufptr;

  /* Store the environment.  */
  bufptr = clear.buf;
  __asm__ (
          "fstd,ma %%fr0,8(%1)\n"
          : "=m" (clear), "+r" (bufptr) : : "%r0");
  memcpy (envp, &clear.env, sizeof (fenv_t));

  /* Clear exception queues */
  memset (clear.env.__exception, 0, sizeof (clear.env.__exception));
  /* And set all exceptions to non-stop.  */
  clear.env.__status_word &= ~FE_ALL_EXCEPT;
  /* Now clear all flags  */
  clear.env.__status_word &= ~(FE_ALL_EXCEPT << 27);

  /* Load the new environment. Note: fr0 must load last to enable T-bit 
     Thus we start bufptr at the end and work backwards */
  bufptr = (unsigned int)(clear.buf) + sizeof(unsigned int)*4;
  __asm__ (
          "fldd,mb -8(%0),%%fr0\n"
          : : "r" (bufptr), "m" (clear) : "%r0");

  return 0;
}

Here is the call graph for this function: