2.9
[glibc/nacl-glibc.git] / sysdeps / alpha / setjmp.S
blobbc5da0f5bc9f022e0b6961c63938c2a16485bc89
1 /* Copyright (C) 1992,1994,1996,1997,2002,2006 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, write to the Free
16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17    02111-1307 USA.  */
19 #define __ASSEMBLY__
21 #include <sysdep.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 defined NOT_IN_libc && defined 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)
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.  */
104 ENTRY(_setjmp)
105         ldgp    gp, 0(pv)
106         .prologue 1
107         mov     0, a1
108         br      $sigsetjmp_local
109 END(_setjmp)
110 libc_hidden_def (_setjmp)
112 ENTRY(setjmp)
113         ldgp    gp, 0(pv)
114         .prologue 1
115         mov     1, a1
116         br      $sigsetjmp_local
117 END(setjmp)
119 weak_extern(_setjmp)
120 weak_extern(setjmp)