Back to index

glibc  2.9
Functions
__longjmp.c File Reference
#include <setjmp.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

void __longjmp (__jmp_buf env, int val)

Function Documentation

void __longjmp ( __jmp_buf  env,
int  val 
)

Definition at line 25 of file __longjmp.c.

{
  /* This restores the FP and SP that setjmp's caller had,
     and puts the return address into A0 and VAL into D0. */

#if    defined(__HAVE_68881__) || defined(__HAVE_FPU__)
  /* Restore the floating-point registers.  */
  asm volatile("fmovem%.x %0, %/fp0-%/fp7" :
              /* No outputs.  */ : "g" (env[0].__fpregs[0]));
#elif defined (__mcffpu__)
  asm volatile("fmovem %0, %/fp0-%/fp7" :
              /* No outputs.  */ : "m" (env[0].__fpregs[0]));
#endif

  /* Put VAL in D0.  */
  asm volatile("move%.l %0, %/d0" : /* No outputs.  */ :
              "g" (val == 0 ? 1 : val) : "d0");

  asm volatile(/* Restore the data and address registers.  */
              "movem%.l %0, %/d1-%/d7/%/a0-%/a7\n"
              /* Return to setjmp's caller.  */
#ifdef __motorola__
              "jmp (%/a0)"
#else
              "jmp %/a0@"
#endif
              : /* No outputs.  */ : "g" (env[0].__dregs[0])
              /* We don't bother with the clobbers,
                because this code always jumps out anyway.  */
              );

  /* Avoid `volatile function does return' warnings.  */
  for (;;);
}