1/* setjmp for ARC.
2   Copyright (C) 2020-2022 Free Software Foundation, Inc.
3   This file is part of the GNU C Library.
4
5   The GNU C Library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9
10   The GNU C Library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Lesser General Public License for more details.
14
15   You should have received a copy of the GNU Lesser General Public
16   License along with the GNU C Library.  If not, see
17   <https://www.gnu.org/licenses/>.  */
18
19
20#include <sysdep.h>
21
22/* Upon entry r0 = jump buffer into which regs will be saved.  */
23ENTRY (setjmp)
24	b.d	__sigsetjmp
25	mov	r1, 1		/* save signals.  */
26END (setjmp)
27
28/* Upon entry r0 = jump buffer into which regs will be saved.  */
29ENTRY (_setjmp)
30	b.d	__sigsetjmp
31	mov	r1, 0		/* don't save signals.  */
32END (_setjmp)
33libc_hidden_def (_setjmp)
34
35/* Upon entry
36   r0 = jump buffer into which regs will be saved
37   r1 = do we need to save signals.  */
38ENTRY (__sigsetjmp)
39
40	/* Make a note of where longjmp will return to.
41	   that will be right next to this setjmp call-site in BLINK
42	   since "C" caller of this routine will do a branch-n-link.  */
43
44	STR (blink, r0,  0)
45	STR (sp,    r0,  1)
46	STR (fp,    r0,  2)
47	STR (gp,    r0,  3)
48
49	STR (r13,   r0,  4)
50	STR (r14,   r0,  5)
51	STR (r15,   r0,  6)
52	STR (r16,   r0,  7)
53	STR (r17,   r0,  8)
54	STR (r18,   r0,  9)
55	STR (r19,   r0, 10)
56	STR (r20,   r0, 11)
57	STR (r21,   r0, 12)
58	STR (r22,   r0, 13)
59	STR (r23,   r0, 14)
60	STR (r24,   r0, 15)
61
62	b    __sigjmp_save
63
64END (__sigsetjmp)
65
66libc_hidden_def (__sigsetjmp)
67