blob: 1c893f05d224cab5ae36cff82e3eeb30cd46171c [file] [log] [blame]
Kumar Galada3de6d2008-06-13 07:20:58 +10001/*
2 * Special support for eabi and SVR4
3 *
4 * Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
5 * Copyright 2008 Freescale Semiconductor, Inc.
6 * Written By Michael Meissner
7 *
8 * Based on gcc/config/rs6000/crtsavres.asm from gcc
Stephen Rothwell7fca5dc2010-06-29 20:08:42 +00009 * 64 bit additions from reading the PPC elf64abi document.
Kumar Galada3de6d2008-06-13 07:20:58 +100010 *
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
14 * later version.
15 *
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.)
23 *
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.
28 *
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.
33 *
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.
39 */
40
41#include <asm/ppc_asm.h>
42
43 .file "crtsavres.S"
44 .section ".text"
45
46#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
47
Stephen Rothwell7fca5dc2010-06-29 20:08:42 +000048#ifndef CONFIG_PPC64
49
Kumar Galada3de6d2008-06-13 07:20:58 +100050/* Routines for saving integer registers, called by the compiler. */
51/* Called with r11 pointing to the stack header word of the caller of the */
52/* function, just beyond the end of the integer save area. */
53
54_GLOBAL(_savegpr_14)
55_GLOBAL(_save32gpr_14)
56 stw 14,-72(11) /* save gp registers */
57_GLOBAL(_savegpr_15)
58_GLOBAL(_save32gpr_15)
59 stw 15,-68(11)
60_GLOBAL(_savegpr_16)
61_GLOBAL(_save32gpr_16)
62 stw 16,-64(11)
63_GLOBAL(_savegpr_17)
64_GLOBAL(_save32gpr_17)
65 stw 17,-60(11)
66_GLOBAL(_savegpr_18)
67_GLOBAL(_save32gpr_18)
68 stw 18,-56(11)
69_GLOBAL(_savegpr_19)
70_GLOBAL(_save32gpr_19)
71 stw 19,-52(11)
72_GLOBAL(_savegpr_20)
73_GLOBAL(_save32gpr_20)
74 stw 20,-48(11)
75_GLOBAL(_savegpr_21)
76_GLOBAL(_save32gpr_21)
77 stw 21,-44(11)
78_GLOBAL(_savegpr_22)
79_GLOBAL(_save32gpr_22)
80 stw 22,-40(11)
81_GLOBAL(_savegpr_23)
82_GLOBAL(_save32gpr_23)
83 stw 23,-36(11)
84_GLOBAL(_savegpr_24)
85_GLOBAL(_save32gpr_24)
86 stw 24,-32(11)
87_GLOBAL(_savegpr_25)
88_GLOBAL(_save32gpr_25)
89 stw 25,-28(11)
90_GLOBAL(_savegpr_26)
91_GLOBAL(_save32gpr_26)
92 stw 26,-24(11)
93_GLOBAL(_savegpr_27)
94_GLOBAL(_save32gpr_27)
95 stw 27,-20(11)
96_GLOBAL(_savegpr_28)
97_GLOBAL(_save32gpr_28)
98 stw 28,-16(11)
99_GLOBAL(_savegpr_29)
100_GLOBAL(_save32gpr_29)
101 stw 29,-12(11)
102_GLOBAL(_savegpr_30)
103_GLOBAL(_save32gpr_30)
104 stw 30,-8(11)
105_GLOBAL(_savegpr_31)
106_GLOBAL(_save32gpr_31)
107 stw 31,-4(11)
108 blr
109
110/* Routines for restoring integer registers, called by the compiler. */
111/* Called with r11 pointing to the stack header word of the caller of the */
112/* function, just beyond the end of the integer restore area. */
113
114_GLOBAL(_restgpr_14)
115_GLOBAL(_rest32gpr_14)
116 lwz 14,-72(11) /* restore gp registers */
117_GLOBAL(_restgpr_15)
118_GLOBAL(_rest32gpr_15)
119 lwz 15,-68(11)
120_GLOBAL(_restgpr_16)
121_GLOBAL(_rest32gpr_16)
122 lwz 16,-64(11)
123_GLOBAL(_restgpr_17)
124_GLOBAL(_rest32gpr_17)
125 lwz 17,-60(11)
126_GLOBAL(_restgpr_18)
127_GLOBAL(_rest32gpr_18)
128 lwz 18,-56(11)
129_GLOBAL(_restgpr_19)
130_GLOBAL(_rest32gpr_19)
131 lwz 19,-52(11)
132_GLOBAL(_restgpr_20)
133_GLOBAL(_rest32gpr_20)
134 lwz 20,-48(11)
135_GLOBAL(_restgpr_21)
136_GLOBAL(_rest32gpr_21)
137 lwz 21,-44(11)
138_GLOBAL(_restgpr_22)
139_GLOBAL(_rest32gpr_22)
140 lwz 22,-40(11)
141_GLOBAL(_restgpr_23)
142_GLOBAL(_rest32gpr_23)
143 lwz 23,-36(11)
144_GLOBAL(_restgpr_24)
145_GLOBAL(_rest32gpr_24)
146 lwz 24,-32(11)
147_GLOBAL(_restgpr_25)
148_GLOBAL(_rest32gpr_25)
149 lwz 25,-28(11)
150_GLOBAL(_restgpr_26)
151_GLOBAL(_rest32gpr_26)
152 lwz 26,-24(11)
153_GLOBAL(_restgpr_27)
154_GLOBAL(_rest32gpr_27)
155 lwz 27,-20(11)
156_GLOBAL(_restgpr_28)
157_GLOBAL(_rest32gpr_28)
158 lwz 28,-16(11)
159_GLOBAL(_restgpr_29)
160_GLOBAL(_rest32gpr_29)
161 lwz 29,-12(11)
162_GLOBAL(_restgpr_30)
163_GLOBAL(_rest32gpr_30)
164 lwz 30,-8(11)
165_GLOBAL(_restgpr_31)
166_GLOBAL(_rest32gpr_31)
167 lwz 31,-4(11)
168 blr
169
170/* Routines for restoring integer registers, called by the compiler. */
171/* Called with r11 pointing to the stack header word of the caller of the */
172/* function, just beyond the end of the integer restore area. */
173
174_GLOBAL(_restgpr_14_x)
175_GLOBAL(_rest32gpr_14_x)
176 lwz 14,-72(11) /* restore gp registers */
177_GLOBAL(_restgpr_15_x)
178_GLOBAL(_rest32gpr_15_x)
179 lwz 15,-68(11)
180_GLOBAL(_restgpr_16_x)
181_GLOBAL(_rest32gpr_16_x)
182 lwz 16,-64(11)
183_GLOBAL(_restgpr_17_x)
184_GLOBAL(_rest32gpr_17_x)
185 lwz 17,-60(11)
186_GLOBAL(_restgpr_18_x)
187_GLOBAL(_rest32gpr_18_x)
188 lwz 18,-56(11)
189_GLOBAL(_restgpr_19_x)
190_GLOBAL(_rest32gpr_19_x)
191 lwz 19,-52(11)
192_GLOBAL(_restgpr_20_x)
193_GLOBAL(_rest32gpr_20_x)
194 lwz 20,-48(11)
195_GLOBAL(_restgpr_21_x)
196_GLOBAL(_rest32gpr_21_x)
197 lwz 21,-44(11)
198_GLOBAL(_restgpr_22_x)
199_GLOBAL(_rest32gpr_22_x)
200 lwz 22,-40(11)
201_GLOBAL(_restgpr_23_x)
202_GLOBAL(_rest32gpr_23_x)
203 lwz 23,-36(11)
204_GLOBAL(_restgpr_24_x)
205_GLOBAL(_rest32gpr_24_x)
206 lwz 24,-32(11)
207_GLOBAL(_restgpr_25_x)
208_GLOBAL(_rest32gpr_25_x)
209 lwz 25,-28(11)
210_GLOBAL(_restgpr_26_x)
211_GLOBAL(_rest32gpr_26_x)
212 lwz 26,-24(11)
213_GLOBAL(_restgpr_27_x)
214_GLOBAL(_rest32gpr_27_x)
215 lwz 27,-20(11)
216_GLOBAL(_restgpr_28_x)
217_GLOBAL(_rest32gpr_28_x)
218 lwz 28,-16(11)
219_GLOBAL(_restgpr_29_x)
220_GLOBAL(_rest32gpr_29_x)
221 lwz 29,-12(11)
222_GLOBAL(_restgpr_30_x)
223_GLOBAL(_rest32gpr_30_x)
224 lwz 30,-8(11)
225_GLOBAL(_restgpr_31_x)
226_GLOBAL(_rest32gpr_31_x)
227 lwz 0,4(11)
228 lwz 31,-4(11)
229 mtlr 0
230 mr 1,11
231 blr
Stephen Rothwell7fca5dc2010-06-29 20:08:42 +0000232
233#else /* CONFIG_PPC64 */
234
235.globl _savegpr0_14
236_savegpr0_14:
237 std r14,-144(r1)
238.globl _savegpr0_15
239_savegpr0_15:
240 std r15,-136(r1)
241.globl _savegpr0_16
242_savegpr0_16:
243 std r16,-128(r1)
244.globl _savegpr0_17
245_savegpr0_17:
246 std r17,-120(r1)
247.globl _savegpr0_18
248_savegpr0_18:
249 std r18,-112(r1)
250.globl _savegpr0_19
251_savegpr0_19:
252 std r19,-104(r1)
253.globl _savegpr0_20
254_savegpr0_20:
255 std r20,-96(r1)
256.globl _savegpr0_21
257_savegpr0_21:
258 std r21,-88(r1)
259.globl _savegpr0_22
260_savegpr0_22:
261 std r22,-80(r1)
262.globl _savegpr0_23
263_savegpr0_23:
264 std r23,-72(r1)
265.globl _savegpr0_24
266_savegpr0_24:
267 std r24,-64(r1)
268.globl _savegpr0_25
269_savegpr0_25:
270 std r25,-56(r1)
271.globl _savegpr0_26
272_savegpr0_26:
273 std r26,-48(r1)
274.globl _savegpr0_27
275_savegpr0_27:
276 std r27,-40(r1)
277.globl _savegpr0_28
278_savegpr0_28:
279 std r28,-32(r1)
280.globl _savegpr0_29
281_savegpr0_29:
282 std r29,-24(r1)
283.globl _savegpr0_30
284_savegpr0_30:
285 std r30,-16(r1)
286.globl _savegpr0_31
287_savegpr0_31:
288 std r31,-8(r1)
289 std r0,16(r1)
290 blr
291
292.globl _restgpr0_14
293_restgpr0_14:
294 ld r14,-144(r1)
295.globl _restgpr0_15
296_restgpr0_15:
297 ld r15,-136(r1)
298.globl _restgpr0_16
299_restgpr0_16:
300 ld r16,-128(r1)
301.globl _restgpr0_17
302_restgpr0_17:
303 ld r17,-120(r1)
304.globl _restgpr0_18
305_restgpr0_18:
306 ld r18,-112(r1)
307.globl _restgpr0_19
308_restgpr0_19:
309 ld r19,-104(r1)
310.globl _restgpr0_20
311_restgpr0_20:
312 ld r20,-96(r1)
313.globl _restgpr0_21
314_restgpr0_21:
315 ld r21,-88(r1)
316.globl _restgpr0_22
317_restgpr0_22:
318 ld r22,-80(r1)
319.globl _restgpr0_23
320_restgpr0_23:
321 ld r23,-72(r1)
322.globl _restgpr0_24
323_restgpr0_24:
324 ld r24,-64(r1)
325.globl _restgpr0_25
326_restgpr0_25:
327 ld r25,-56(r1)
328.globl _restgpr0_26
329_restgpr0_26:
330 ld r26,-48(r1)
331.globl _restgpr0_27
332_restgpr0_27:
333 ld r27,-40(r1)
334.globl _restgpr0_28
335_restgpr0_28:
336 ld r28,-32(r1)
337.globl _restgpr0_29
338_restgpr0_29:
339 ld r0,16(r1)
340 ld r29,-24(r1)
341 mtlr r0
342 ld r30,-16(r1)
343 ld r31,-8(r1)
344 blr
345
346.globl _restgpr0_30
347_restgpr0_30:
348 ld r30,-16(r1)
349.globl _restgpr0_31
350_restgpr0_31:
351 ld r0,16(r1)
352 ld r31,-8(r1)
353 mtlr r0
354 blr
355
356#endif /* CONFIG_PPC64 */
357
Kumar Galada3de6d2008-06-13 07:20:58 +1000358#endif