malloc/Makefile: Split and sort tests
[glibc.git] / sysdeps / alpha / setjmp.S
blobc987af502564befb9c35825e44bc24cbdcfccb62
1 /* Copyright (C) 1992-2024 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
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.
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.
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    <https://www.gnu.org/licenses/>.  */
18 #define __ASSEMBLY__
20 #include <sysdep.h>
21 #include <pointer_guard.h>
22 #include <jmpbuf-offsets.h>
24         .ent __sigsetjmp
25         .global __sigsetjmp
26 __sigsetjmp:
27         ldgp    gp, 0(pv)
29 $sigsetjmp_local:
30 #ifndef PIC
31 #define FRAME   16
32         subq    sp, FRAME, sp
33         .frame  sp, FRAME, ra, 0
34         stq     ra, 0(sp)
35         .mask   0x04000000, -FRAME
36 #else
37 #define FRAME   0
38         .frame  sp, FRAME, ra, 0
39 #endif
40 #ifdef PROF
41         .set noat
42         lda     AT, _mcount
43         jsr     AT, (AT), _mcount
44         .set at
45 #endif
46         .prologue 1
48         stq     s0, JB_S0*8(a0)
49         stq     s1, JB_S1*8(a0)
50         stq     s2, JB_S2*8(a0)
51         stq     s3, JB_S3*8(a0)
52         stq     s4, JB_S4*8(a0)
53         stq     s5, JB_S5*8(a0)
54 #ifdef PTR_MANGLE
55         PTR_MANGLE(t1, ra, t0)
56         stq     t1, JB_PC*8(a0)
57 #else
58         stq     ra, JB_PC*8(a0)
59 #endif
60 #if defined(PTR_MANGLE) && FRAME == 0
61         PTR_MANGLE2(t1, sp, t0)
62 #else
63         addq    sp, FRAME, t1
64 # ifdef PTR_MANGLE
65         PTR_MANGLE2(t1, t1, t0)
66 # endif
67 #endif
68         stq     t1, JB_SP*8(a0)
69 #ifdef PTR_MANGLE
70         PTR_MANGLE2(t1, fp, t0)
71         stq     t1, JB_FP*8(a0)
72 #else
73         stq     fp, JB_FP*8(a0)
74 #endif
75         stt     $f2, JB_F2*8(a0)
76         stt     $f3, JB_F3*8(a0)
77         stt     $f4, JB_F4*8(a0)
78         stt     $f5, JB_F5*8(a0)
79         stt     $f6, JB_F6*8(a0)
80         stt     $f7, JB_F7*8(a0)
81         stt     $f8, JB_F8*8(a0)
82         stt     $f9, JB_F9*8(a0)
84 #ifndef PIC
85         /* Call to C to (potentially) save our signal mask.  */
86         jsr     ra, __sigjmp_save
87         ldq     ra, 0(sp)
88         addq    sp, 16, sp
89         ret
90 #elif IS_IN (rtld)
91         /* In ld.so we never save the signal mask.  */
92         mov     0, v0
93         ret
94 #else
95         /* Tailcall to save the signal mask.  */
96         br      $31, __sigjmp_save      !samegp
97 #endif
99 END(__sigsetjmp)
100 hidden_def (__sigsetjmp)
102 /* Put these traditional entry points in the same file so that we can
103    elide much of the nonsense in trying to jmp to the real function.  */
105 ENTRY(_setjmp)
106         ldgp    gp, 0(pv)
107         .prologue 1
108         mov     0, a1
109         br      $sigsetjmp_local
110 END(_setjmp)
111 libc_hidden_def (_setjmp)
113 ENTRY(setjmp)
114         ldgp    gp, 0(pv)
115         .prologue 1
116         mov     1, a1
117         br      $sigsetjmp_local
118 END(setjmp)
120 weak_extern(_setjmp)
121 weak_extern(setjmp)