Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / arm / setjmp.S
blob96657071dd1d8999f6aa5cbdd597333df09573fd
1 /* setjmp for ARM.
2    Copyright (C) 1997-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 <bits/setjmp.h>
21 #include <rtld-global-offsets.h>
22 #include <arm-features.h>
24 ENTRY (__sigsetjmp)
25 #ifdef PTR_MANGLE
26         PTR_MANGLE (a4, fp, a3, ip)
27 #else
28         mov     a4, fp
29 #endif
30         mov     ip, r0
32         /* Save registers */
33         sfi_breg ip, \
34         stmia   \B!, JMP_BUF_REGLIST
35 #ifdef PTR_MANGLE
36         mov     a4, sp
37         PTR_MANGLE2 (a4, a4, a3)
38         str     a4, [ip], #4
39         PTR_MANGLE2 (a4, lr, a3)
40         str     a4, [ip], #4
41 #else
42         str     sp, [ip], #4
43         str     lr, [ip], #4
44 #endif
46 #if !defined ARM_ASSUME_NO_IWMMXT || defined __SOFTFP__
47 # define NEED_HWCAP 1
48 #endif
50 #ifdef NEED_HWCAP
51         /* Check if we have a VFP unit.  */
52 # ifdef IS_IN_rtld
53         ldr     a3, 1f
54         ldr     a4, .Lrtld_local_ro
55 0:      add     a3, pc, a3
56         add     a3, a3, a4
57         ldr     a3, [a3, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
58 # else
59 #  ifdef PIC
60         ldr     a3, 1f
61         ldr     a4, .Lrtld_global_ro
62 0:      add     a3, pc, a3
63         ldr     a3, [a3, a4]
64         ldr     a3, [a3, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
65 #  else
66         ldr     a3, .Lhwcap
67         ldr     a3, [a3, #0]
68 #  endif
69 # endif
70 #endif
72 #ifdef __SOFTFP__
73         tst     a3, #HWCAP_ARM_VFP
74         beq     .Lno_vfp
75 #endif
77         /* Store the VFP registers.
78            Don't use VFP instructions directly because this code
79            is used in non-VFP multilibs.  */
80         /* Following instruction is vstmia ip!, {d8-d15}.  */
81         sfi_breg ip, \
82         stc     p11, cr8, [\B], #64
83 .Lno_vfp:
85 #ifndef ARM_ASSUME_NO_IWMMXT
86         tst     a3, #HWCAP_ARM_IWMMXT
87         beq     .Lno_iwmmxt
89         /* Save the call-preserved iWMMXt registers.  */
90         /* Following instructions are wstrd wr10, [ip], #8 (etc.)  */
91         sfi_breg r12, \
92         stcl    p1, cr10, [\B], #8
93         sfi_breg r12, \
94         stcl    p1, cr11, [\B], #8
95         sfi_breg r12, \
96         stcl    p1, cr12, [\B], #8
97         sfi_breg r12, \
98         stcl    p1, cr13, [\B], #8
99         sfi_breg r12, \
100         stcl    p1, cr14, [\B], #8
101         sfi_breg r12, \
102         stcl    p1, cr15, [\B], #8
103 .Lno_iwmmxt:
104 #endif
106         /* Make a tail call to __sigjmp_save; it takes the same args.  */
107         B       PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
109 #ifdef NEED_HWCAP
110 # ifdef IS_IN_rtld
111 1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
112 .Lrtld_local_ro:
113         .long   C_SYMBOL_NAME(_rtld_local_ro)(GOTOFF)
114 # else
115 #  ifdef PIC
116 1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
117 .Lrtld_global_ro:
118         .long   C_SYMBOL_NAME(_rtld_global_ro)(GOT)
119 #  else
120 .Lhwcap:
121         .long   C_SYMBOL_NAME(_dl_hwcap)
122 #  endif
123 # endif
124 #endif
126 END (__sigsetjmp)
128 hidden_def (__sigsetjmp)