2 * Special support for eabi and SVR4
4 * Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
5 * Copyright 2008 Freescale Semiconductor, Inc.
6 * Written By Michael Meissner
8 * Based on gcc/config/rs6000/crtsavres.asm from gcc
9 * 64 bit additions from reading the PPC elf64abi document.
11 * This file is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2, or (at your option) any
16 * In addition to the permissions in the GNU General Public License, the
17 * Free Software Foundation gives you unlimited permission to link the
18 * compiled version of this file with other programs, and to distribute
19 * those programs without any restriction coming from the use of this
20 * file. (The General Public License restrictions do apply in other
21 * respects; for example, they cover modification of the file, and
22 * distribution when not linked into another program.)
24 * This file is distributed in the hope that it will be useful, but
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; see the file COPYING. If not, write to
31 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
32 * Boston, MA 02110-1301, USA.
34 * As a special exception, if you link this library with files
35 * compiled with GCC to produce an executable, this does not cause
36 * the resulting executable to be covered by the GNU General Public License.
37 * This exception does not however invalidate any other reasons why
38 * the executable file might be covered by the GNU General Public License.
41 /* taken from Linux arch/powerpc/lib/crtsavres.S */
43 /* arch/powerpc/include/asm/ppc_asm.h */
46 #define XGLUE(a,b) a##b
47 #define GLUE(a,b) XGLUE(a,b)
49 #define _GLOBAL(name) \
53 .globl GLUE(.,name); \
54 .section ".opd","aw"; \
57 .quad .TOC.@tocbase; \
60 .type GLUE(.,name),@function; \
65 /* include/linux/stringify.h */
67 /* Indirect stringification. Doing two levels allows the parameter to be a
68 * macro itself. For example, compile with -DFOO=bar, __stringify(FOO)
72 #define __stringify_1(x...) #x
73 #define __stringify(x...) __stringify_1(x)
75 /* arch/powerpc/include/asm/ppc_asm.h continues */
79 .stabs __stringify(n:F-1),N_FUN,0,0,n;\
88 /* arch/powerpc/lib/crtsavres.S continues */
95 /* Routines for saving integer registers, called by the compiler. */
96 /* Called with r11 pointing to the stack header word of the caller of the */
97 /* function, just beyond the end of the integer save area. */
100 _GLOBAL(_save32gpr_14)
101 stw 14,-72(11) /* save gp registers */
103 _GLOBAL(_save32gpr_15)
106 _GLOBAL(_save32gpr_16)
109 _GLOBAL(_save32gpr_17)
112 _GLOBAL(_save32gpr_18)
115 _GLOBAL(_save32gpr_19)
118 _GLOBAL(_save32gpr_20)
121 _GLOBAL(_save32gpr_21)
124 _GLOBAL(_save32gpr_22)
127 _GLOBAL(_save32gpr_23)
130 _GLOBAL(_save32gpr_24)
133 _GLOBAL(_save32gpr_25)
136 _GLOBAL(_save32gpr_26)
139 _GLOBAL(_save32gpr_27)
142 _GLOBAL(_save32gpr_28)
145 _GLOBAL(_save32gpr_29)
148 _GLOBAL(_save32gpr_30)
151 _GLOBAL(_save32gpr_31)
155 /* Routines for restoring integer registers, called by the compiler. */
156 /* Called with r11 pointing to the stack header word of the caller of the */
157 /* function, just beyond the end of the integer restore area. */
160 _GLOBAL(_rest32gpr_14)
161 lwz 14,-72(11) /* restore gp registers */
163 _GLOBAL(_rest32gpr_15)
166 _GLOBAL(_rest32gpr_16)
169 _GLOBAL(_rest32gpr_17)
172 _GLOBAL(_rest32gpr_18)
175 _GLOBAL(_rest32gpr_19)
178 _GLOBAL(_rest32gpr_20)
181 _GLOBAL(_rest32gpr_21)
184 _GLOBAL(_rest32gpr_22)
187 _GLOBAL(_rest32gpr_23)
190 _GLOBAL(_rest32gpr_24)
193 _GLOBAL(_rest32gpr_25)
196 _GLOBAL(_rest32gpr_26)
199 _GLOBAL(_rest32gpr_27)
202 _GLOBAL(_rest32gpr_28)
205 _GLOBAL(_rest32gpr_29)
208 _GLOBAL(_rest32gpr_30)
211 _GLOBAL(_rest32gpr_31)
215 /* Routines for restoring integer registers, called by the compiler. */
216 /* Called with r11 pointing to the stack header word of the caller of the */
217 /* function, just beyond the end of the integer restore area. */
219 _GLOBAL(_restgpr_14_x)
220 _GLOBAL(_rest32gpr_14_x)
221 lwz 14,-72(11) /* restore gp registers */
222 _GLOBAL(_restgpr_15_x)
223 _GLOBAL(_rest32gpr_15_x)
225 _GLOBAL(_restgpr_16_x)
226 _GLOBAL(_rest32gpr_16_x)
228 _GLOBAL(_restgpr_17_x)
229 _GLOBAL(_rest32gpr_17_x)
231 _GLOBAL(_restgpr_18_x)
232 _GLOBAL(_rest32gpr_18_x)
234 _GLOBAL(_restgpr_19_x)
235 _GLOBAL(_rest32gpr_19_x)
237 _GLOBAL(_restgpr_20_x)
238 _GLOBAL(_rest32gpr_20_x)
240 _GLOBAL(_restgpr_21_x)
241 _GLOBAL(_rest32gpr_21_x)
243 _GLOBAL(_restgpr_22_x)
244 _GLOBAL(_rest32gpr_22_x)
246 _GLOBAL(_restgpr_23_x)
247 _GLOBAL(_rest32gpr_23_x)
249 _GLOBAL(_restgpr_24_x)
250 _GLOBAL(_rest32gpr_24_x)
252 _GLOBAL(_restgpr_25_x)
253 _GLOBAL(_rest32gpr_25_x)
255 _GLOBAL(_restgpr_26_x)
256 _GLOBAL(_rest32gpr_26_x)
258 _GLOBAL(_restgpr_27_x)
259 _GLOBAL(_rest32gpr_27_x)
261 _GLOBAL(_restgpr_28_x)
262 _GLOBAL(_rest32gpr_28_x)
264 _GLOBAL(_restgpr_29_x)
265 _GLOBAL(_rest32gpr_29_x)
267 _GLOBAL(_restgpr_30_x)
268 _GLOBAL(_rest32gpr_30_x)
270 _GLOBAL(_restgpr_31_x)
271 _GLOBAL(_rest32gpr_31_x)
278 #else /* CONFIG_PPC64 */
401 #endif /* CONFIG_PPC64 */