OSDN Git Service

Replace FSF snail mail address with URLs
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / arm / __longjmp.S
1 /* longjmp for ARM.
2    Copyright (C) 1997, 1998 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
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.
9
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.
14
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/>.  */
18
19 #include <features.h>
20 #include <bits/arm_asm.h>
21
22 .global __longjmp
23 .type __longjmp,%function
24 .align 2
25 #if defined(THUMB1_ONLY)
26 .thumb_func
27 __longjmp:
28         mov     r2, r0
29         movs    r0, r1
30         /* can't let setjmp() return zero! */
31         bne     1f
32         mov     r0, #1
33 1:
34         mov     r1, r2
35         /* Restore registers, shuffling them through low regs.  */
36         add     r2, #(4 * 4)
37         ldmia   r2!, {r4, r5, r6, r7}
38         mov     r8, r4
39         mov     r9, r5
40         mov     sl, r6
41         mov     fp, r7
42         ldmia   r2!, {r4, r5}
43         mov     sp, r4
44         mov     lr, r5
45         ldmia   r1!, {r4, r5, r6, r7}
46         bx      lr
47 #else
48 __longjmp:
49         mov     ip, r0          /* save jmp_buf pointer */
50         
51         movs    r0, r1          /* get the return value in place */
52         IT(t, eq)
53         moveq   r0, #1          /* can't let setjmp() return zero! */
54
55 #if defined(__thumb2__)
56         /* Thumb-2 does not allow loading sp with ldm.  */
57         ldmia     ip!,  {v1-v6, sl, fp}
58         ldr       sp, [ip], #4
59         ldr       lr, [ip], #4
60 #else
61         ldmia     ip!,  {v1-v6, sl, fp, sp, lr}
62 #endif
63
64 #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
65 #ifdef __VFP_FP__
66         /* Restore the VFP registers.  */
67         /* Following instruction is fldmiax ip!, {d8-d15}.  */
68         ldc     p11, cr8, [r12], #68
69         /* Restore the floating-point status register.  */
70         ldr     r1, [ip], #4
71         /* Following instruction is fmxr fpscr, r1.  */
72         mcr     p10, 7, r1, cr1, cr0, 0
73 # elif defined __MAVERICK__
74         cfldrd  mvd4,  [ip], #8 ; nop
75         cfldrd  mvd5,  [ip], #8 ; nop
76         cfldrd  mvd6,  [ip], #8 ; nop
77         cfldrd  mvd7,  [ip], #8 ; nop
78         cfldrd  mvd8,  [ip], #8 ; nop
79         cfldrd  mvd9,  [ip], #8 ; nop
80         cfldrd  mvd10, [ip], #8 ; nop
81         cfldrd  mvd11, [ip], #8 ; nop
82         cfldrd  mvd12, [ip], #8 ; nop
83         cfldrd  mvd13, [ip], #8 ; nop
84         cfldrd  mvd14, [ip], #8 ; nop
85         cfldrd  mvd15, [ip], #8
86 # else
87         lfmfd   f4, 4, [ip] !   /* load the floating point regs */
88 # endif
89 #endif  
90 #ifdef __IWMMXT__
91         /* Restore the call-preserved iWMMXt registers.  */
92         /* Following instructions are wldrd wr10, [ip], #8 (etc.)  */
93         ldcl    p1, cr10, [r12], #8
94         ldcl    p1, cr11, [r12], #8
95         ldcl    p1, cr12, [r12], #8
96         ldcl    p1, cr13, [r12], #8
97         ldcl    p1, cr14, [r12], #8
98         ldcl    p1, cr15, [r12], #8
99 #endif
100
101 #if defined(__USE_BX__)
102         bx      lr
103 #else
104         mov pc, lr
105 #endif
106 #endif
107
108 .size __longjmp,.-__longjmp
109 libc_hidden_def(__longjmp)