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