Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / sh / sh4 / setjmp.S
blobd5ac02e3bdbc4f2bc15b4cc688ead05aca86ab63
1 /* setjmp for SH4.
2    Copyright (C) 1999-2014 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <http://www.gnu.org/licenses/>.  */
19 #include <sysdep.h>
20 #include <jmpbuf-offsets.h>
22 ENTRY (__sigsetjmp)
23         /* Save registers */
24 #ifdef __SH_FPU_ANY__
25         add     #JB_SIZE, r4
26         fmov.s  fr15, @-r4
27         fmov.s  fr14, @-r4
28         fmov.s  fr13, @-r4
29         fmov.s  fr12, @-r4
30         sts.l   fpscr, @-r4
31 #else
32         add     #(JB_SIZE - 4 * 5), r4
33 #endif /* __SH_FPU_ANY__ */
34         stc.l   gbr, @-r4
35 #ifdef PTR_MANGLE
36         sts     pr, r2
37         PTR_MANGLE (r2, r1)
38         mov.l   r2, @-r4
39         mov     r15, r2
40         PTR_MANGLE2 (r2, r1)
41         mov.l   r2, @-r4
42         mov     r14, r2
43         PTR_MANGLE2 (r2, r1)
44         mov.l   r2, @-r4
45         mov     #0, r1
46 #else
47         sts.l   pr, @-r4
48         mov.l   r15, @-r4
49         mov.l   r14, @-r4
50 #endif
51         mov.l   r13, @-r4
52         mov.l   r12, @-r4
53         mov.l   r11, @-r4
54         mov.l   r10, @-r4
55         mov.l   r9, @-r4
56         mov.l   r8, @-r4
58 #if defined NOT_IN_libc && defined IS_IN_rtld
59         /* In ld.so we never save the signal mask.  */
60         rts
61          mov    #0, r0
62 #else
63         /* Make a tail call to __sigjmp_save; it takes the same args.  */
64 # ifdef SHARED
65         mov.l   1f, r1
66         mova    1f, r0
67         bra     2f
68          add    r1, r0
69         .align  2
71         .long   _GLOBAL_OFFSET_TABLE_
73         mov.l   .L1, r1
74         mov.l   @(r0,r1), r1
75         jmp     @r1
76          nop
77         .align  2
78 .L1:
79         .long   C_SYMBOL_NAME(__sigjmp_save@GOT)
80 # else
81         mov.l   .L1, r1
82         jmp     @r1
83          nop
84         .align  2
85 .L1:
86         .long   C_SYMBOL_NAME(__sigjmp_save)
87 # endif
88 #endif
89 END (__sigsetjmp)