Blame sysdeps/hppa/__longjmp.c

Packit 6c4009
/* longjmp for PA-RISC.
Packit 6c4009
   Copyright (C) 1997-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library.  If not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <setjmp.h>
Packit 6c4009
#include <stdlib.h>
Packit 6c4009
Packit 6c4009
/* Jump to the position specified by ENV, causing the
Packit 6c4009
   setjmp call there to return VAL, or 1 if VAL is 0.  */
Packit 6c4009
void
Packit 6c4009
__longjmp (__jmp_buf env, int val)
Packit 6c4009
{
Packit 6c4009
#ifdef CHECK_SP
Packit 6c4009
  CHECK_SP (env[0].__jmp_buf.__sp);
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
  /* We must use one of the non-callee saves registers
Packit 6c4009
     for env.  */
Packit 6c4009
  register unsigned long r26 asm ("r26") = (unsigned long)&env[0];
Packit 6c4009
  register unsigned long r25 asm ("r25") = (unsigned long)(val == 0 ? 1 : val);
Packit 6c4009
Packit 6c4009
  asm volatile(
Packit 6c4009
	/* Set return value.  */
Packit 6c4009
	"copy	%0, %%r28\n\t"
Packit 6c4009
	/* Load callee saves from r3 to r18.  */
Packit 6c4009
	"ldw	0(%1), %%r3\n\t"
Packit 6c4009
	"ldw	8(%1), %%r4\n\t"
Packit 6c4009
	"ldw	12(%1), %%r5\n\t"
Packit 6c4009
	"ldw	16(%1), %%r6\n\t"
Packit 6c4009
	"ldw	20(%1), %%r7\n\t"
Packit 6c4009
	"ldw	24(%1), %%r8\n\t"
Packit 6c4009
	"ldw	28(%1), %%r9\n\t"
Packit 6c4009
	"ldw	32(%1), %%r10\n\t"
Packit 6c4009
	"ldw	36(%1), %%r11\n\t"
Packit 6c4009
	"ldw	40(%1), %%r12\n\t"
Packit 6c4009
	"ldw	44(%1), %%r13\n\t"
Packit 6c4009
	"ldw	48(%1), %%r14\n\t"
Packit 6c4009
	"ldw	52(%1), %%r15\n\t"
Packit 6c4009
	"ldw	56(%1), %%r16\n\t"
Packit 6c4009
	"ldw	60(%1), %%r17\n\t"
Packit 6c4009
	"ldw	64(%1), %%r18\n\t"
Packit 6c4009
	/* Load PIC register.  */
Packit 6c4009
	"ldw	68(%1), %%r19\n\t"
Packit 6c4009
	/* Load static link register.  */
Packit 6c4009
	"ldw	72(%1), %%r27\n\t"
Packit 6c4009
	/* Load stack pointer.  */
Packit 6c4009
	"ldw	76(%1), %%r30\n\t"
Packit 6c4009
	/* Load return pointer. */
Packit 6c4009
	"ldw	80(%1), %%rp\n\t"
Packit 6c4009
	/* Ues a spare caller saves register.  */
Packit 6c4009
	"ldo	88(%1),%%r25\n\t"
Packit 6c4009
	/* Load callee saves from fr12 to fr21.  */
Packit 6c4009
	"fldds,ma 8(%%r25), %%fr12\n\t"
Packit 6c4009
	"fldds,ma 8(%%r25), %%fr13\n\t"
Packit 6c4009
	"fldds,ma 8(%%r25), %%fr14\n\t"
Packit 6c4009
	"fldds,ma 8(%%r25), %%fr15\n\t"
Packit 6c4009
	"fldds,ma 8(%%r25), %%fr16\n\t"
Packit 6c4009
	"fldds,ma 8(%%r25), %%fr17\n\t"
Packit 6c4009
	"fldds,ma 8(%%r25), %%fr18\n\t"
Packit 6c4009
	"fldds,ma 8(%%r25), %%fr19\n\t"
Packit 6c4009
	"fldds,ma 8(%%r25), %%fr20\n\t"
Packit 6c4009
	"fldds	 0(%%r25), %%fr21\n\t"
Packit 6c4009
	/* Jump back to stored return address.  */
Packit 6c4009
	"bv,n	%%r0(%%r2)\n\t"
Packit 6c4009
	: /* No outputs.  */
Packit 6c4009
	: "r" (r25), "r" (r26)
Packit 6c4009
	: /* No point in clobbers.  */ );
Packit 6c4009
Packit 6c4009
  /* Avoid `volatile function does return' warnings.  */
Packit 6c4009
  for (;;);
Packit 6c4009
}