]>
Commit | Line | Data |
---|---|---|
2b778ceb | 1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc. |
3c7b2587 | 2 | This file is part of the GNU C Library. |
1608c2cc | 3 | |
3c7b2587 | 4 | The GNU C Library is free software; you can redistribute it and/or |
3214b89b AJ |
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. | |
1608c2cc | 8 | |
3c7b2587 UD |
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 | |
3214b89b | 12 | Lesser General Public License for more details. |
1608c2cc | 13 | |
3214b89b | 14 | You should have received a copy of the GNU Lesser General Public |
ab84e3ff | 15 | License along with the GNU C Library. If not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
1608c2cc | 17 | |
38a2fc1c UD |
18 | #define __ASSEMBLY__ |
19 | ||
1608c2cc | 20 | #include <sysdep.h> |
c07312e9 | 21 | #include <jmpbuf-offsets.h> |
38a2fc1c | 22 | |
8470e5f2 UD |
23 | .ent __sigsetjmp |
24 | .global __sigsetjmp | |
38a2fc1c | 25 | __sigsetjmp: |
8470e5f2 | 26 | ldgp gp, 0(pv) |
1608c2cc | 27 | |
38a2fc1c | 28 | $sigsetjmp_local: |
8470e5f2 | 29 | #ifndef PIC |
9847c5cb | 30 | #define FRAME 16 |
8470e5f2 UD |
31 | subq sp, FRAME, sp |
32 | .frame sp, FRAME, ra, 0 | |
33 | stq ra, 0(sp) | |
34 | .mask 0x04000000, -FRAME | |
35 | #else | |
36 | #define FRAME 0 | |
37 | .frame sp, FRAME, ra, 0 | |
38 | #endif | |
60c74cf0 | 39 | #ifdef PROF |
3c7b2587 | 40 | .set noat |
60c74cf0 UD |
41 | lda AT, _mcount |
42 | jsr AT, (AT), _mcount | |
3c7b2587 | 43 | .set at |
60c74cf0 | 44 | #endif |
bccfffdb RM |
45 | .prologue 1 |
46 | ||
38a2fc1c UD |
47 | stq s0, JB_S0*8(a0) |
48 | stq s1, JB_S1*8(a0) | |
49 | stq s2, JB_S2*8(a0) | |
50 | stq s3, JB_S3*8(a0) | |
51 | stq s4, JB_S4*8(a0) | |
52 | stq s5, JB_S5*8(a0) | |
8470e5f2 UD |
53 | #ifdef PTR_MANGLE |
54 | PTR_MANGLE(t1, ra, t0) | |
55 | stq t1, JB_PC*8(a0) | |
56 | #else | |
38a2fc1c | 57 | stq ra, JB_PC*8(a0) |
8470e5f2 UD |
58 | #endif |
59 | #if defined(PTR_MANGLE) && FRAME == 0 | |
60 | PTR_MANGLE2(t1, sp, t0) | |
61 | #else | |
62 | addq sp, FRAME, t1 | |
63 | # ifdef PTR_MANGLE | |
64 | PTR_MANGLE2(t1, t1, t0) | |
65 | # endif | |
66 | #endif | |
67 | stq t1, JB_SP*8(a0) | |
68 | #ifdef PTR_MANGLE | |
69 | PTR_MANGLE2(t1, fp, t0) | |
70 | stq t1, JB_FP*8(a0) | |
71 | #else | |
38a2fc1c | 72 | stq fp, JB_FP*8(a0) |
8470e5f2 | 73 | #endif |
38a2fc1c UD |
74 | stt $f2, JB_F2*8(a0) |
75 | stt $f3, JB_F3*8(a0) | |
76 | stt $f4, JB_F4*8(a0) | |
77 | stt $f5, JB_F5*8(a0) | |
78 | stt $f6, JB_F6*8(a0) | |
79 | stt $f7, JB_F7*8(a0) | |
80 | stt $f8, JB_F8*8(a0) | |
81 | stt $f9, JB_F9*8(a0) | |
82 | ||
8470e5f2 | 83 | #ifndef PIC |
38a2fc1c UD |
84 | /* Call to C to (potentially) save our signal mask. */ |
85 | jsr ra, __sigjmp_save | |
38a2fc1c UD |
86 | ldq ra, 0(sp) |
87 | addq sp, 16, sp | |
88 | ret | |
a3848485 | 89 | #elif IS_IN (rtld) |
8470e5f2 UD |
90 | /* In ld.so we never save the signal mask. */ |
91 | mov 0, v0 | |
92 | ret | |
93 | #else | |
94 | /* Tailcall to save the signal mask. */ | |
95 | br $31, __sigjmp_save !samegp | |
96 | #endif | |
38a2fc1c UD |
97 | |
98 | END(__sigsetjmp) | |
2314a29b | 99 | hidden_def (__sigsetjmp) |
38a2fc1c UD |
100 | |
101 | /* Put these traditional entry points in the same file so that we can | |
102 | elide much of the nonsense in trying to jmp to the real function. */ | |
103 | ||
0abafb20 | 104 | ENTRY(_setjmp) |
38a2fc1c | 105 | ldgp gp, 0(pv) |
1bb08f15 | 106 | .prologue 1 |
38a2fc1c UD |
107 | mov 0, a1 |
108 | br $sigsetjmp_local | |
0abafb20 | 109 | END(_setjmp) |
db160231 | 110 | libc_hidden_def (_setjmp) |
38a2fc1c UD |
111 | |
112 | ENTRY(setjmp) | |
113 | ldgp gp, 0(pv) | |
1bb08f15 | 114 | .prologue 1 |
38a2fc1c UD |
115 | mov 1, a1 |
116 | br $sigsetjmp_local | |
117 | END(setjmp) | |
bccfffdb | 118 | |
0abafb20 | 119 | weak_extern(_setjmp) |
38a2fc1c | 120 | weak_extern(setjmp) |