Blame sysdeps/m68k/__longjmp.c

Packit Service 82fcde
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library.  If not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#include <setjmp.h>
Packit Service 82fcde
#include <stdlib.h>
Packit Service 82fcde
Packit Service 82fcde
/* Jump to the position specified by ENV, causing the
Packit Service 82fcde
   setjmp call there to return VAL, or 1 if VAL is 0.  */
Packit Service 82fcde
void
Packit Service 82fcde
__longjmp (__jmp_buf env, int val)
Packit Service 82fcde
{
Packit Service 82fcde
  /* This restores the FP and SP that setjmp's caller had,
Packit Service 82fcde
     and puts the return address into A0 and VAL into D0. */
Packit Service 82fcde
Packit Service 82fcde
#ifdef CHECK_SP
Packit Service 82fcde
  CHECK_SP (env[0].__sp);
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
#if	defined(__HAVE_68881__) || defined(__HAVE_FPU__)
Packit Service 82fcde
  /* Restore the floating-point registers.  */
Packit Service 82fcde
  asm volatile("fmovem%.x %0, %/fp0-%/fp7" :
Packit Service 82fcde
	       /* No outputs.  */ : "g" (env[0].__fpregs[0]));
Packit Service 82fcde
#elif defined (__mcffpu__)
Packit Service 82fcde
  asm volatile("fmovem %0, %/fp0-%/fp7" :
Packit Service 82fcde
	       /* No outputs.  */ : "m" (env[0].__fpregs[0]));
Packit Service 82fcde
#endif
Packit Service 82fcde
Packit Service 82fcde
  /* Put VAL in D0.  */
Packit Service 82fcde
  asm volatile("move%.l %0, %/d0" : /* No outputs.  */ :
Packit Service 82fcde
	       "g" (val == 0 ? 1 : val) : "d0");
Packit Service 82fcde
Packit Service 82fcde
  asm volatile(/* Restore the data and address registers.  */
Packit Service 82fcde
	       "movem%.l %0, %/d1-%/d7/%/a0-%/a7\n"
Packit Service 82fcde
	       /* Return to setjmp's caller.  */
Packit Service 82fcde
#ifdef __motorola__
Packit Service 82fcde
	       "jmp (%/a0)"
Packit Service 82fcde
#else
Packit Service 82fcde
	       "jmp %/a0@"
Packit Service 82fcde
#endif
Packit Service 82fcde
	       : /* No outputs.  */ : "g" (env[0].__dregs[0])
Packit Service 82fcde
	       /* We don't bother with the clobbers,
Packit Service 82fcde
		  because this code always jumps out anyway.  */
Packit Service 82fcde
	       );
Packit Service 82fcde
Packit Service 82fcde
  /* Avoid `volatile function does return' warnings.  */
Packit Service 82fcde
  for (;;);
Packit Service 82fcde
}