]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/ia64/setjmp.S
50a9137abd71229204e1946c65bf913ef85f60dd
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / ia64 / setjmp.S
1 /* Copyright (C) 1999-2019 Free Software Foundation, Inc.
2 Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
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 The layout of the jmp_buf is as follows. This is subject to change
19 and user-code should never depend on the particular layout of
20 jmp_buf!
21
22
23 offset: description:
24 ------- ------------
25 0x000 stack pointer (r12) ; unchangeable (see _JMPBUF_UNWINDS)
26 0x008 r1 (gp)
27 0x010 caller's unat
28 0x018 fpsr ; disabled per the C standard; BZ 16379
29 0x020 r4
30 0x028 r5
31 0x030 r6
32 0x038 r7
33 0x040 rp (b0)
34 0x048 b1
35 0x050 b2
36 0x058 b3
37 0x060 b4
38 0x068 b5
39 0x070 ar.pfs
40 0x078 ar.lc
41 0x080 pr
42 0x088 ar.bsp ; unchangeable (see __longjmp.S)
43 0x090 ar.unat
44 0x098 &__jmp_buf ; address of the jmpbuf (needed to locate NaT bits in unat)
45 0x0a0 f2
46 0x0b0 f3
47 0x0c0 f4
48 0x0d0 f5
49 0x0e0 f16
50 0x0f0 f17
51 0x100 f18
52 0x110 f19
53 0x120 f20
54 0x130 f21
55 0x130 f22
56 0x140 f23
57 0x150 f24
58 0x160 f25
59 0x170 f26
60 0x180 f27
61 0x190 f28
62 0x1a0 f29
63 0x1b0 f30
64 0x1c0 f31 */
65
66 #include <sysdep.h>
67 #include <features.h>
68
69 /* The following two entry points are the traditional entry points: */
70
71 LEAF(setjmp)
72 alloc r8=ar.pfs,2,0,0,0
73 mov in1=1
74 br.cond.sptk.many HIDDEN_JUMPTARGET(__sigsetjmp)
75 END(setjmp)
76
77 LEAF(_setjmp)
78 alloc r8=ar.pfs,2,0,0,0
79 mov in1=0
80 br.cond.sptk.many HIDDEN_JUMPTARGET(__sigsetjmp)
81 END(_setjmp)
82 libc_hidden_def (_setjmp)
83
84 /* __sigsetjmp(__jmp_buf buf, int savemask) */
85
86 ENTRY(__sigsetjmp)
87 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
88 alloc loc1=ar.pfs,2,5,2,0
89 .save ar.unat, loc2
90 mov loc2=ar.unat
91 ;;
92 // mov r17=ar.fpsr
93 mov r2=in0
94 add r3=8,in0
95 ;;
96 .mem.offset 8,0; st8.spill.nta [r2]=sp,16 // r12 (sp)
97 .mem.offset 0,0; st8.spill.nta [r3]=gp,32 // r1 (gp)
98 ;;
99 st8.nta [r2]=loc2,16 // save caller's unat
100 // st8.nta [r3]=r17,16 // save fpsr
101 add r8=0xa0,in0
102 ;;
103 .mem.offset 8,0; st8.spill.nta [r2]=r4,16 // r4
104 .mem.offset 0,0; st8.spill.nta [r3]=r5,16 // r5
105 add r9=0xb0,in0
106 ;;
107 stf.spill.nta [r8]=f2,32
108 stf.spill.nta [r9]=f3,32
109 mov loc0=rp
110 .body
111 ;;
112 stf.spill.nta [r8]=f4,32
113 stf.spill.nta [r9]=f5,32
114 mov r17=b1
115 ;;
116 stf.spill.nta [r8]=f16,32
117 stf.spill.nta [r9]=f17,32
118 mov r18=b2
119 ;;
120 stf.spill.nta [r8]=f18,32
121 stf.spill.nta [r9]=f19,32
122 mov r19=b3
123 ;;
124 stf.spill.nta [r8]=f20,32
125 stf.spill.nta [r9]=f21,32
126 mov r20=b4
127 ;;
128 stf.spill.nta [r8]=f22,32
129 stf.spill.nta [r9]=f23,32
130 mov r21=b5
131 ;;
132 stf.spill.nta [r8]=f24,32
133 stf.spill.nta [r9]=f25,32
134 mov r22=ar.lc
135 ;;
136 stf.spill.nta [r8]=f26,32
137 stf.spill.nta [r9]=f27,32
138 mov r24=pr
139 ;;
140 stf.spill.nta [r8]=f28,32
141 stf.spill.nta [r9]=f29,32
142 #ifdef PTR_MANGLE
143 mov loc3=loc0
144 ;;
145 PTR_MANGLE (loc3, loc4)
146 #else
147 ;;
148 #endif
149 stf.spill.nta [r8]=f30
150 stf.spill.nta [r9]=f31
151
152 .mem.offset 8,0; st8.spill.nta [r2]=r6,16 // r6
153 .mem.offset 0,0; st8.spill.nta [r3]=r7,16 // r7
154 ;;
155 mov r23=ar.bsp
156 mov r25=ar.unat
157 mov out0=in0
158
159 #ifdef PTR_MANGLE
160 st8.nta [r2]=loc3,16 // b0
161 #else
162 st8.nta [r2]=loc0,16 // b0
163 #endif
164 st8.nta [r3]=r17,16 // b1
165 mov out1=in1
166 ;;
167 st8.nta [r2]=r18,16 // b2
168 st8.nta [r3]=r19,16 // b3
169 ;;
170 st8.nta [r2]=r20,16 // b4
171 st8.nta [r3]=r21,16 // b5
172 ;;
173 st8.nta [r2]=loc1,16 // ar.pfs
174 st8.nta [r3]=r22,16 // ar.lc
175 ;;
176 st8.nta [r2]=r24,16 // pr
177 st8.nta [r3]=r23,16 // ar.bsp
178 ;;
179 st8.nta [r2]=r25 // ar.unat
180 st8.nta [r3]=in0 // &__jmp_buf
181 #if IS_IN (rtld)
182 /* In ld.so we never save the signal mask. */
183 ;;
184 #else
185 br.call.dpnt.few rp=__sigjmp_save
186 #endif
187 .ret0: // force a new bundle ::q
188 mov.m ar.unat=loc2 // restore caller's unat
189 mov rp=loc0
190 mov ar.pfs=loc1
191 mov r8=0
192 ret
193 END(__sigsetjmp)
194 libc_hidden_def (__sigsetjmp)
195 rtld_hidden_def (__sigsetjmp)
196
197 weak_extern(_setjmp)
198 weak_extern(setjmp)