]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/nios2/setjmp.S
5e48e68528047712a9c4d2be04890c02e0801c9f
[thirdparty/glibc.git] / sysdeps / nios2 / setjmp.S
1 /* setjmp for Nios II.
2 Copyright (C) 1991-2018 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 <http://www.gnu.org/licenses/>. */
18
19 #include <sysdep.h>
20 #include <jmpbuf-offsets.h>
21
22 .text
23 ENTRY(setjmp)
24 movi r5, 1
25 br __sigsetjmp
26 END(setjmp)
27
28 ENTRY(_setjmp)
29 mov r5, zero
30 br __sigsetjmp
31 END(_setjmp)
32 libc_hidden_def (_setjmp)
33
34 /* Save the current program position in ENV and return 0. */
35 ENTRY(__sigsetjmp)
36 #ifdef PTR_MANGLE
37 PTR_MANGLE_GUARD (r9)
38 #endif
39 stw r16, (JB_R16*4)(r4)
40 stw r17, (JB_R17*4)(r4)
41 stw r18, (JB_R18*4)(r4)
42 stw r19, (JB_R19*4)(r4)
43 stw r20, (JB_R20*4)(r4)
44 stw r21, (JB_R21*4)(r4)
45 stw r22, (JB_R22*4)(r4)
46 stw fp, (JB_FP*4)(r4)
47 #ifdef PTR_MANGLE
48 PTR_MANGLE (r6, ra, r9)
49 PTR_MANGLE (r7, sp, r9)
50 stw r6, (JB_RA*4)(r4)
51 stw r7, (JB_SP*4)(r4)
52 #else
53 stw ra, (JB_RA*4)(r4)
54 stw sp, (JB_SP*4)(r4)
55 #endif
56 #if IS_IN (rtld)
57 /* In ld.so we never save the signal mask. */
58 mov r2, zero
59 ret
60 #else
61 /* Save the signal mask if requested. */
62 #if defined(__PIC__) || defined(PIC)
63 nextpc r2
64 1: movhi r3, %hiadj(__sigjmp_save - 1b)
65 addi r3, r3, %lo(__sigjmp_save - 1b)
66 add r2, r2, r3
67 jmp r2
68 #else
69 jmpi __sigjmp_save
70 #endif
71 #endif
72 END (__sigsetjmp)
73 libc_hidden_def (__sigsetjmp)