Update ARM ulps for VFPv4 (bug 16600).
[glibc.git] / sysdeps / arm / __longjmp.S
blob27c57a12df49686e9481de4852a98c5d6c5d00a7
1 /* longjmp 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 /* __longjmp(jmpbuf, val) */
26 ENTRY (__longjmp)
27         mov     ip, r0
28         movs    r0, r1          /* get the return value in place */
29         it      eq
30         moveq   r0, #1          /* can't let setjmp() return zero! */
32 #ifdef CHECK_SP
33         sfi_breg ip, \
34         ldr     r4, [\B, #32]   /* jmpbuf's sp */
35         cfi_undefined (r4)
36 #ifdef PTR_DEMANGLE
37         PTR_DEMANGLE (r4, r4, a3, a4)
38 #endif
39         CHECK_SP (r4)
40 #endif
41         sfi_sp sfi_breg ip, \
42         ldmia   \B!, JMP_BUF_REGLIST
43 #ifdef PTR_DEMANGLE
44         ldr     a4, [ip], #4
45         PTR_DEMANGLE (a4, a4, a3, a2)
46         mov     sp, a4
47         ldr     a4, [ip], #4
48         PTR_DEMANGLE2 (lr, a4, a3)
49 #else
50         ldr     sp, [ip], #4
51         ldr     lr, [ip], #4
52 #endif
53         cfi_restore (v1)
54         cfi_restore (v2)
55         cfi_restore (v3)
56         cfi_restore (v4)
57         cfi_restore (v5)
58         cfi_restore (v6)
59         cfi_restore (sl)
60         cfi_restore (fp)
61         cfi_restore (sp)
62         cfi_restore (lr)
64 #if !defined ARM_ASSUME_NO_IWMMXT || defined __SOFTFP__
65 # define NEED_HWCAP 1
66 #endif
68 #ifdef NEED_HWCAP
69 # ifdef IS_IN_rtld
70         ldr     a2, 1f
71         ldr     a3, .Lrtld_local_ro
72 0:      add     a2, pc, a2
73         add     a2, a2, a3
74         ldr     a2, [a2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
75 # else
76 #  ifdef PIC
77         ldr     a2, 1f
78         ldr     a3, .Lrtld_global_ro
79 0:      add     a2, pc, a2
80         ldr     a2, [a2, a3]
81         ldr     a2, [a2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
82 #  else
83         ldr     a2, .Lhwcap
84         ldr     a2, [a2, #0]
85 #  endif
86 # endif
87 #endif
89 #ifdef __SOFTFP__
90         tst     a2, #HWCAP_ARM_VFP
91         beq     .Lno_vfp
92 #endif
94         /* Restore the VFP registers.  */
95         /* Following instruction is vldmia ip!, {d8-d15}.  */
96         sfi_breg r12, \
97         ldc     p11, cr8, [\B], #64
98 .Lno_vfp:
100 #ifndef ARM_ASSUME_NO_IWMMXT
101         tst     a2, #HWCAP_ARM_IWMMXT
102         beq     .Lno_iwmmxt
104         /* Restore the call-preserved iWMMXt registers.  */
105         /* Following instructions are wldrd wr10, [ip], #8 (etc.)  */
106         sfi_breg r12, \
107         ldcl    p1, cr10, [\B], #8
108         sfi_breg r12, \
109         ldcl    p1, cr11, [\B], #8
110         sfi_breg r12, \
111         ldcl    p1, cr12, [\B], #8
112         sfi_breg r12, \
113         ldcl    p1, cr13, [\B], #8
114         sfi_breg r12, \
115         ldcl    p1, cr14, [\B], #8
116         sfi_breg r12, \
117         ldcl    p1, cr15, [\B], #8
118 .Lno_iwmmxt:
119 #endif
121         DO_RET(lr)
123 #ifdef NEED_HWCAP
124 # ifdef IS_IN_rtld
125 1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
126 .Lrtld_local_ro:
127         .long   C_SYMBOL_NAME(_rtld_local_ro)(GOTOFF)
128 # else
129 #  ifdef PIC
130 1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS
131 .Lrtld_global_ro:
132         .long   C_SYMBOL_NAME(_rtld_global_ro)(GOT)
133 #  else
134 .Lhwcap:
135         .long   C_SYMBOL_NAME(_dl_hwcap)
136 #  endif
137 # endif
138 #endif
140 END (__longjmp)