.
[glibc-ports.git] / sysdeps / arm / eabi / setjmp.S
blobd9ad26a916728b109a77bfa6237377ae259dabb1
1 /* setjmp for ARM.
2    Copyright (C) 1997, 1998, 2005 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 General Public License
16    along with GCC; see the file COPYING.  If not, write to the Free
17    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
18    02110-1301, USA.  */
20 #include <sysdep.h>
21 #define _SETJMP_H
22 #define _ASM
23 #include <bits/setjmp.h>
24 #define __ASSEMBLY__
25 #include <asm/procinfo.h>
26 #include <rtld-global-offsets.h>
28 ENTRY (__sigsetjmp)
29         mov     ip, r0
31         /* Save registers */
32         stmia   ip!, {v1-v6, sl, fp, sp, lr}
34         /* Check if we have a VFP unit.  */
35 #ifdef IS_IN_rtld
36         ldr     a3, 1f
37         ldr     a4, Lrtld_local_ro
38 0:      add     a3, pc, a3
39         add     a3, a3, a4
40         ldr     a3, [a3, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
41 #else
42 #ifdef PIC
43         ldr     a3, 1f
44         ldr     a4, Lrtld_global_ro
45 0:      add     a3, pc, a3
46         ldr     a3, [a3, a4]
47         ldr     a3, [a3, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
48 #else
49         ldr     a3, Lhwcap
50         ldr     a3, [a3, #0]
51 #endif
52 #endif
54         tst     a3, #HWCAP_VFP
55         beq     Lno_vfp
57         /* Store the VFP registers.  */
58         /* Following instruction is fstmiax ip!, {d8-d15}.  */
59         stc     p11, cr8, [r12], #68
60         /* Store the floating-point status register.  */
61         /* Following instruction is fmrx r2, fpscr.  */
62         mrc     p10, 7, r2, cr1, cr0, 0
63         str     r2, [ip], #4
64 Lno_vfp:
66         /* Make a tail call to __sigjmp_save; it takes the same args.  */
67         B       PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
69 #ifdef IS_IN_rtld
70 1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - 8
71 Lrtld_local_ro:
72         .long   C_SYMBOL_NAME(_rtld_local_ro)(GOTOFF)
73 #else
74 #ifdef PIC
75 1:      .long   _GLOBAL_OFFSET_TABLE_ - 0b - 8
76 Lrtld_global_ro:
77         .long   C_SYMBOL_NAME(_rtld_global_ro)(GOT)
78 #else
79 Lhwcap:
80         .long   C_SYMBOL_NAME(_dl_hwcap)
81 #endif
82 #endif
84 END (__sigsetjmp)