]>
Commit | Line | Data |
---|---|---|
f10eff58 | 1 | /* longjmp for ARM. |
01b32e73 TS |
2 | Copyright (C) 1997, 1998, 2005, 2006, 2009, 2010 |
3 | Free Software Foundation, Inc. | |
f10eff58 DJ |
4 | This file is part of the GNU C Library. |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Lesser General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
10 | ||
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GCC; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA | |
19 | 02110-1301, USA. */ | |
20 | ||
21 | #include <sysdep.h> | |
22 | #define _SETJMP_H | |
23 | #define _ASM | |
24 | #include <bits/setjmp.h> | |
f10eff58 DJ |
25 | #include <rtld-global-offsets.h> |
26 | ||
27 | /* __longjmp(jmpbuf, val) */ | |
28 | ||
29 | ENTRY (__longjmp) | |
30 | mov ip, r0 | |
31 | movs r0, r1 /* get the return value in place */ | |
32 | moveq r0, #1 /* can't let setjmp() return zero! */ | |
33 | ||
ef889ffe | 34 | #ifdef CHECK_SP |
01b32e73 TS |
35 | ldr r4, [ip, #32] /* jmpbuf's sp */ |
36 | cfi_undefined (r4) | |
53df8bce | 37 | CHECK_SP (r4) |
ef889ffe | 38 | #endif |
f10eff58 | 39 | LOADREGS(ia, ip!, {v1-v6, sl, fp, sp, lr}) |
01b32e73 TS |
40 | cfi_restore (v1) |
41 | cfi_restore (v2) | |
42 | cfi_restore (v3) | |
43 | cfi_restore (v4) | |
44 | cfi_restore (v5) | |
45 | cfi_restore (v6) | |
46 | cfi_restore (sl) | |
47 | cfi_restore (fp) | |
48 | cfi_restore (sp) | |
49 | cfi_restore (lr) | |
f10eff58 DJ |
50 | |
51 | #ifdef IS_IN_rtld | |
52 | ldr a2, 1f | |
53 | ldr a3, Lrtld_local_ro | |
54 | 0: add a2, pc, a2 | |
55 | add a2, a2, a3 | |
56 | ldr a2, [a2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET] | |
57 | #else | |
58 | #ifdef PIC | |
59 | ldr a2, 1f | |
60 | ldr a3, Lrtld_global_ro | |
61 | 0: add a2, pc, a2 | |
62 | ldr a2, [a2, a3] | |
63 | ldr a2, [a2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET] | |
64 | #else | |
65 | ldr a2, Lhwcap | |
66 | ldr a2, [a2, #0] | |
67 | #endif | |
68 | #endif | |
69 | ||
4b860fb9 | 70 | tst a2, #HWCAP_ARM_VFP |
f10eff58 DJ |
71 | beq Lno_vfp |
72 | ||
73 | /* Restore the VFP registers. */ | |
fbc4c20a AS |
74 | /* Following instruction is vldmia ip!, {d8-d15}. */ |
75 | ldc p11, cr8, [r12], #64 | |
f10eff58 | 76 | /* Restore the floating-point status register. */ |
fbc4c20a AS |
77 | ldr a3, [ip], #4 |
78 | /* Following instruction is fmxr fpscr, a3. */ | |
79 | mcr p10, 7, a3, cr1, cr0, 0 | |
f10eff58 DJ |
80 | Lno_vfp: |
81 | ||
4b860fb9 DJ |
82 | tst a2, #HWCAP_ARM_IWMMXT |
83 | beq Lno_iwmmxt | |
84 | ||
85 | /* Restore the call-preserved iWMMXt registers. */ | |
86 | /* Following instructions are wldrd wr10, [ip], #8 (etc.) */ | |
87 | ldcl p1, cr10, [r12], #8 | |
88 | ldcl p1, cr11, [r12], #8 | |
89 | ldcl p1, cr12, [r12], #8 | |
90 | ldcl p1, cr13, [r12], #8 | |
91 | ldcl p1, cr14, [r12], #8 | |
92 | ldcl p1, cr15, [r12], #8 | |
93 | Lno_iwmmxt: | |
94 | ||
f10eff58 DJ |
95 | DO_RET(lr) |
96 | ||
97 | #ifdef IS_IN_rtld | |
98 | 1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8 | |
99 | Lrtld_local_ro: | |
100 | .long C_SYMBOL_NAME(_rtld_local_ro)(GOTOFF) | |
101 | #else | |
102 | #ifdef PIC | |
103 | 1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8 | |
104 | Lrtld_global_ro: | |
105 | .long C_SYMBOL_NAME(_rtld_global_ro)(GOT) | |
106 | #else | |
107 | Lhwcap: | |
108 | .long C_SYMBOL_NAME(_dl_hwcap) | |
109 | #endif | |
110 | #endif | |
111 | ||
112 | END (__longjmp) |