blob: 21ecdf5e55f93d48f91e20a4f6341c8eb856de9a [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
Andreas Schwab7dff32e2013-12-30 15:31:17 +0100233#ifdef CONFIG_ALTIVEC
234/* Called with r0 pointing just beyond the end of the vector save area. */
235
236_GLOBAL(_savevr_20)
237 li r11,-192
238 stvx vr20,r11,r0
239_GLOBAL(_savevr_21)
240 li r11,-176
241 stvx vr21,r11,r0
242_GLOBAL(_savevr_22)
243 li r11,-160
244 stvx vr22,r11,r0
245_GLOBAL(_savevr_23)
246 li r11,-144
247 stvx vr23,r11,r0
248_GLOBAL(_savevr_24)
249 li r11,-128
250 stvx vr24,r11,r0
251_GLOBAL(_savevr_25)
252 li r11,-112
253 stvx vr25,r11,r0
254_GLOBAL(_savevr_26)
255 li r11,-96
256 stvx vr26,r11,r0
257_GLOBAL(_savevr_27)
258 li r11,-80
259 stvx vr27,r11,r0
260_GLOBAL(_savevr_28)
261 li r11,-64
262 stvx vr28,r11,r0
263_GLOBAL(_savevr_29)
264 li r11,-48
265 stvx vr29,r11,r0
266_GLOBAL(_savevr_30)
267 li r11,-32
268 stvx vr30,r11,r0
269_GLOBAL(_savevr_31)
270 li r11,-16
271 stvx vr31,r11,r0
272 blr
273
274_GLOBAL(_restvr_20)
275 li r11,-192
276 lvx vr20,r11,r0
277_GLOBAL(_restvr_21)
278 li r11,-176
279 lvx vr21,r11,r0
280_GLOBAL(_restvr_22)
281 li r11,-160
282 lvx vr22,r11,r0
283_GLOBAL(_restvr_23)
284 li r11,-144
285 lvx vr23,r11,r0
286_GLOBAL(_restvr_24)
287 li r11,-128
288 lvx vr24,r11,r0
289_GLOBAL(_restvr_25)
290 li r11,-112
291 lvx vr25,r11,r0
292_GLOBAL(_restvr_26)
293 li r11,-96
294 lvx vr26,r11,r0
295_GLOBAL(_restvr_27)
296 li r11,-80
297 lvx vr27,r11,r0
298_GLOBAL(_restvr_28)
299 li r11,-64
300 lvx vr28,r11,r0
301_GLOBAL(_restvr_29)
302 li r11,-48
303 lvx vr29,r11,r0
304_GLOBAL(_restvr_30)
305 li r11,-32
306 lvx vr30,r11,r0
307_GLOBAL(_restvr_31)
308 li r11,-16
309 lvx vr31,r11,r0
310 blr
311
312#endif /* CONFIG_ALTIVEC */
313
Stephen Rothwell7fca5dc2010-06-29 20:08:42 +0000314#else /* CONFIG_PPC64 */
315
316.globl _savegpr0_14
317_savegpr0_14:
318 std r14,-144(r1)
319.globl _savegpr0_15
320_savegpr0_15:
321 std r15,-136(r1)
322.globl _savegpr0_16
323_savegpr0_16:
324 std r16,-128(r1)
325.globl _savegpr0_17
326_savegpr0_17:
327 std r17,-120(r1)
328.globl _savegpr0_18
329_savegpr0_18:
330 std r18,-112(r1)
331.globl _savegpr0_19
332_savegpr0_19:
333 std r19,-104(r1)
334.globl _savegpr0_20
335_savegpr0_20:
336 std r20,-96(r1)
337.globl _savegpr0_21
338_savegpr0_21:
339 std r21,-88(r1)
340.globl _savegpr0_22
341_savegpr0_22:
342 std r22,-80(r1)
343.globl _savegpr0_23
344_savegpr0_23:
345 std r23,-72(r1)
346.globl _savegpr0_24
347_savegpr0_24:
348 std r24,-64(r1)
349.globl _savegpr0_25
350_savegpr0_25:
351 std r25,-56(r1)
352.globl _savegpr0_26
353_savegpr0_26:
354 std r26,-48(r1)
355.globl _savegpr0_27
356_savegpr0_27:
357 std r27,-40(r1)
358.globl _savegpr0_28
359_savegpr0_28:
360 std r28,-32(r1)
361.globl _savegpr0_29
362_savegpr0_29:
363 std r29,-24(r1)
364.globl _savegpr0_30
365_savegpr0_30:
366 std r30,-16(r1)
367.globl _savegpr0_31
368_savegpr0_31:
369 std r31,-8(r1)
370 std r0,16(r1)
371 blr
372
373.globl _restgpr0_14
374_restgpr0_14:
375 ld r14,-144(r1)
376.globl _restgpr0_15
377_restgpr0_15:
378 ld r15,-136(r1)
379.globl _restgpr0_16
380_restgpr0_16:
381 ld r16,-128(r1)
382.globl _restgpr0_17
383_restgpr0_17:
384 ld r17,-120(r1)
385.globl _restgpr0_18
386_restgpr0_18:
387 ld r18,-112(r1)
388.globl _restgpr0_19
389_restgpr0_19:
390 ld r19,-104(r1)
391.globl _restgpr0_20
392_restgpr0_20:
393 ld r20,-96(r1)
394.globl _restgpr0_21
395_restgpr0_21:
396 ld r21,-88(r1)
397.globl _restgpr0_22
398_restgpr0_22:
399 ld r22,-80(r1)
400.globl _restgpr0_23
401_restgpr0_23:
402 ld r23,-72(r1)
403.globl _restgpr0_24
404_restgpr0_24:
405 ld r24,-64(r1)
406.globl _restgpr0_25
407_restgpr0_25:
408 ld r25,-56(r1)
409.globl _restgpr0_26
410_restgpr0_26:
411 ld r26,-48(r1)
412.globl _restgpr0_27
413_restgpr0_27:
414 ld r27,-40(r1)
415.globl _restgpr0_28
416_restgpr0_28:
417 ld r28,-32(r1)
418.globl _restgpr0_29
419_restgpr0_29:
420 ld r0,16(r1)
421 ld r29,-24(r1)
422 mtlr r0
423 ld r30,-16(r1)
424 ld r31,-8(r1)
425 blr
426
427.globl _restgpr0_30
428_restgpr0_30:
429 ld r30,-16(r1)
430.globl _restgpr0_31
431_restgpr0_31:
432 ld r0,16(r1)
433 ld r31,-8(r1)
434 mtlr r0
435 blr
436
Andreas Schwab7dff32e2013-12-30 15:31:17 +0100437#ifdef CONFIG_ALTIVEC
438/* Called with r0 pointing just beyond the end of the vector save area. */
439
440.globl _savevr_20
441_savevr_20:
442 li r12,-192
443 stvx vr20,r12,r0
444.globl _savevr_21
445_savevr_21:
446 li r12,-176
447 stvx vr21,r12,r0
448.globl _savevr_22
449_savevr_22:
450 li r12,-160
451 stvx vr22,r12,r0
452.globl _savevr_23
453_savevr_23:
454 li r12,-144
455 stvx vr23,r12,r0
456.globl _savevr_24
457_savevr_24:
458 li r12,-128
459 stvx vr24,r12,r0
460.globl _savevr_25
461_savevr_25:
462 li r12,-112
463 stvx vr25,r12,r0
464.globl _savevr_26
465_savevr_26:
466 li r12,-96
467 stvx vr26,r12,r0
468.globl _savevr_27
469_savevr_27:
470 li r12,-80
471 stvx vr27,r12,r0
472.globl _savevr_28
473_savevr_28:
474 li r12,-64
475 stvx vr28,r12,r0
476.globl _savevr_29
477_savevr_29:
478 li r12,-48
479 stvx vr29,r12,r0
480.globl _savevr_30
481_savevr_30:
482 li r12,-32
483 stvx vr30,r12,r0
484.globl _savevr_31
485_savevr_31:
486 li r12,-16
487 stvx vr31,r12,r0
488 blr
489
490.globl _restvr_20
491_restvr_20:
492 li r12,-192
493 lvx vr20,r12,r0
494.globl _restvr_21
495_restvr_21:
496 li r12,-176
497 lvx vr21,r12,r0
498.globl _restvr_22
499_restvr_22:
500 li r12,-160
501 lvx vr22,r12,r0
502.globl _restvr_23
503_restvr_23:
504 li r12,-144
505 lvx vr23,r12,r0
506.globl _restvr_24
507_restvr_24:
508 li r12,-128
509 lvx vr24,r12,r0
510.globl _restvr_25
511_restvr_25:
512 li r12,-112
513 lvx vr25,r12,r0
514.globl _restvr_26
515_restvr_26:
516 li r12,-96
517 lvx vr26,r12,r0
518.globl _restvr_27
519_restvr_27:
520 li r12,-80
521 lvx vr27,r12,r0
522.globl _restvr_28
523_restvr_28:
524 li r12,-64
525 lvx vr28,r12,r0
526.globl _restvr_29
527_restvr_29:
528 li r12,-48
529 lvx vr29,r12,r0
530.globl _restvr_30
531_restvr_30:
532 li r12,-32
533 lvx vr30,r12,r0
534.globl _restvr_31
535_restvr_31:
536 li r12,-16
537 lvx vr31,r12,r0
538 blr
539
540#endif /* CONFIG_ALTIVEC */
541
Stephen Rothwell7fca5dc2010-06-29 20:08:42 +0000542#endif /* CONFIG_PPC64 */
543
Kumar Galada3de6d2008-06-13 07:20:58 +1000544#endif