2.9
[glibc/nacl-glibc.git] / sysdeps / sh / sh4 / setjmp.S
blobf9a4f0a8cec0b559496adb7669dd72495339a3a2
1 /* setjmp for SH4.
2    Copyright (C) 1999, 2000, 2005, 2006 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, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
20 #include <sysdep.h>
21 #include <jmpbuf-offsets.h>
23 ENTRY (__sigsetjmp)
24         /* Save registers */
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         stc.l   gbr, @-r4
32 #ifdef PTR_MANGLE
33         sts     pr, r2
34         PTR_MANGLE (r2, r1)
35         mov.l   r2, @-r4
36         mov     r15, r2
37         PTR_MANGLE2 (r2, r1)
38         mov.l   r2, @-r4
39         mov     r14, r2
40         PTR_MANGLE2 (r2, r1)
41         mov.l   r2, @-r4
42         mov     #0, r1
43 #else
44         sts.l   pr, @-r4
45         mov.l   r15, @-r4
46         mov.l   r14, @-r4
47 #endif
48         mov.l   r13, @-r4
49         mov.l   r12, @-r4
50         mov.l   r11, @-r4
51         mov.l   r10, @-r4
52         mov.l   r9, @-r4
53         mov.l   r8, @-r4
55 #if defined NOT_IN_libc && defined IS_IN_rtld
56         /* In ld.so we never save the signal mask.  */
57         rts
58          mov    #0, r0
59 #else
60         /* Make a tail call to __sigjmp_save; it takes the same args.  */
61 # ifdef SHARED
62         mov.l   1f, r1
63         mova    1f, r0
64         bra     2f
65          add    r1, r0
66         .align  2
68         .long   _GLOBAL_OFFSET_TABLE_
70         mov.l   .L1, r1
71         mov.l   @(r0,r1), r1
72         jmp     @r1
73          nop
74         .align  2
75 .L1:
76         .long   C_SYMBOL_NAME(__sigjmp_save@GOT)
77 # else
78         mov.l   .L1, r1
79         jmp     @r1
80          nop
81         .align  2
82 .L1:
83         .long   C_SYMBOL_NAME(__sigjmp_save)
84 # endif
85 #endif
86 END (__sigsetjmp)