OSDN Git Service

* arm/predicates.md (alignable_memory_operand): Delete.
[pf3gnuchains/gcc-fork.git] / gcc / config / arm / libunwind.S
1 /* Support functions for the unwinder.
2    Copyright (C) 2003, 2004  Free Software Foundation, Inc.
3    Contributed by Paul Brook
4
5    This file is free software; you can redistribute it and/or modify it
6    under the terms of the GNU General Public License as published by the
7    Free Software Foundation; either version 2, or (at your option) any
8    later version.
9
10    In addition to the permissions in the GNU General Public License, the
11    Free Software Foundation gives you unlimited permission to link the
12    compiled version of this file into combinations with other programs,
13    and to distribute those combinations without any restriction coming
14    from the use of this file.  (The General Public License restrictions
15    do apply in other respects; for example, they cover modification of
16    the file, and distribution when not linked into a combine
17    executable.)
18
19    This file is distributed in the hope that it will be useful, but
20    WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22    General Public License for more details.
23
24    You should have received a copy of the GNU General Public License
25    along with this program; see the file COPYING.  If not, write to
26    the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27    Boston, MA 02110-1301, USA.  */
28
29 #ifdef L_unwind
30
31 .macro UNPREFIX name
32         .global SYM (\name)
33         EQUIV SYM (\name), SYM (__\name)
34 .endm
35
36 /* r0 points to a 16-word block.  Upload these values to the actual core
37    state.  */
38 ARM_FUNC_START restore_core_regs
39         /* We must use sp as the base register when restoring sp.  Push the
40            last 3 registers onto the top of the current stack to achieve
41            this.  */
42         add r1, r0, #52
43         ldmia r1, {r3, r4, r5}  /* {sp, lr, pc}.  */
44 #ifdef __INTERWORKING__
45         /* Restore pc into ip.  */
46         mov r2, r5
47         stmfd sp!, {r2, r3, r4}
48 #else
49         stmfd sp!, {r3, r4, r5}
50 #endif
51         /* Don't bother restoring ip.  */
52         ldmia r0, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp}
53         /* Pop the three registers we pushed earlier.  */
54 #ifdef __INTERWORKING__
55         ldmfd sp, {ip, sp, lr}
56         bx ip
57 #else
58         ldmfd sp, {sp, lr, pc}
59 #endif
60         FUNC_END restore_core_regs
61         UNPREFIX restore_core_regs
62
63 /* Load VFP registers d0-d15 from the address in r0.  */
64 ARM_FUNC_START gnu_Unwind_Restore_VFP
65         /* Use the generic coprocessor form so that gas doesn't complain
66            on soft-float targets.  */
67         ldc   p11,cr0,[r0],{0x21} /* fldmiax r0, {d0-d15} */
68         RET
69
70 /* Store VFR regsters d0-d15 to the address in r0.  */
71 ARM_FUNC_START gnu_Unwind_Save_VFP
72         /* Use the generic coprocessor form so that gas doesn't complain
73            on soft-float targets.  */
74         stc   p11,cr0,[r0],{0x21} /* fstmiax r0, {d0-d15} */
75         RET
76
77 /* Wrappers to save core registers, then call the real routine.   */
78
79 .macro  UNWIND_WRAPPER name
80         ARM_FUNC_START \name
81         /* Create a phase2_vrs structure.  */
82         /* Split reg push in two to ensure the correct value for sp.  */
83         stmfd sp!, {sp, lr, pc}
84         stmfd sp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip}
85         
86         /* Demand-save flags, plus an extra word for alignment.  */
87         mov r3, #0
88         stmfd sp!, {r2, r3}
89
90         /* Point r1 at the block.  Pass r0 unchanged.  */
91         add r1, sp, #4
92 #if defined(__thumb__)
93         /* Switch back to thumb mode to avoid interworking hassle.  */
94         adr ip, .L1_\name
95         orr ip, ip, #1
96         bx ip
97         .thumb
98 .L1_\name:
99         bl SYM (__gnu\name) __PLT__
100         ldr r3, [sp, #64]
101         add sp, #72
102         bx r3
103 #else
104         bl SYM (__gnu\name) __PLT__
105         ldr lr, [sp, #64]
106         add sp, sp, #72
107         RET
108 #endif
109         FUNC_END \name
110         UNPREFIX \name
111 .endm
112
113 UNWIND_WRAPPER _Unwind_RaiseException
114 UNWIND_WRAPPER _Unwind_Resume
115
116 #endif  /* L_unwind */