1/* Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
2   This file is part of the GNU C Library.
3
4   The GNU C Library is free software; you can redistribute it and/or
5   modify it under the terms of the GNU Lesser General Public
6   License as published by the Free Software Foundation; either
7   version 2.1 of the License, or (at your option) any later version.
8
9   The GNU C Library is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public
15   License along with the GNU C Library; if not, see
16   <http://www.gnu.org/licenses/>.  */
17
18#include <jmpbuf-offsets.h>
19
20#define a0  $16
21
22       .ent __sigsetjmp
23       .global __sigsetjmp
24__sigsetjmp:
25       ldgp    $29, 0($27)
26
27$sigsetjmp_local:
28#ifndef __PIC__
29# define FRAME 16
30	subq    $30, FRAME, $30
31	.frame  $30, FRAME, $26, 0
32	stq     $26, 0($30)
33	.mask   0x04000000, -FRAME
34#else
35# define FRAME 0
36	.frame	$30, FRAME, $26, 0
37#endif
38	.prologue 1
39
40	stq	$9, JB_S0*8(a0)
41	stq	$10, JB_S1*8(a0)
42	stq	$11, JB_S2*8(a0)
43	stq	$12, JB_S3*8(a0)
44	stq	$13, JB_S4*8(a0)
45	stq	$14, JB_S5*8(a0)
46	stq	$26, JB_PC*8(a0)
47	addq	$30, FRAME, $1
48	stq	$1, JB_SP*8(a0)
49	stq	$15, JB_FP*8(a0)
50	stt	$f2, JB_F2*8(a0)
51	stt	$f3, JB_F3*8(a0)
52	stt	$f4, JB_F4*8(a0)
53	stt	$f5, JB_F5*8(a0)
54	stt	$f6, JB_F6*8(a0)
55	stt	$f7, JB_F7*8(a0)
56	stt	$f8, JB_F8*8(a0)
57	stt	$f9, JB_F9*8(a0)
58
59#ifndef __PIC__
60	/* Call to C to (potentially) save our signal mask.  */
61	jsr	$26, __sigjmp_save
62	ldq	$26, 0($30)
63	addq	$30, 16, $30
64	ret
65#else
66	/* Tailcall to save the signal mask.  */
67	br	$31, __sigjmp_save	!samegp
68#endif
69
70.end __sigsetjmp
71
72/* Put these traditional entry points in the same file so that we can
73   elide much of the nonsense in trying to jmp to the real function.  */
74
75.globl  _setjmp;
76.align 3;
77.ent  _setjmp , 0;
78_setjmp:
79	ldgp	$29, 0($27)
80	mov	0, $17
81	br	$sigsetjmp_local
82.end _setjmp
83
84.globl  setjmp;
85.align 3;
86.ent  setjmp , 0;
87setjmp:
88	ldgp	$29, 0($27)
89	mov	1, $17
90	br	$sigsetjmp_local
91.end setjmp
92