xref: /openbmc/linux/arch/powerpc/boot/crtsavres.S (revision 7c868b66)
1143580ecSKumar Gala/*
2143580ecSKumar Gala * Special support for eabi and SVR4
3143580ecSKumar Gala *
4143580ecSKumar Gala *   Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
5143580ecSKumar Gala *   Copyright 2008 Freescale Semiconductor, Inc.
6143580ecSKumar Gala *   Written By Michael Meissner
7143580ecSKumar Gala *
8143580ecSKumar Gala * Based on gcc/config/rs6000/crtsavres.asm from gcc
9143580ecSKumar Gala *
10143580ecSKumar Gala * This file is free software; you can redistribute it and/or modify it
11143580ecSKumar Gala * under the terms of the GNU General Public License as published by the
12143580ecSKumar Gala * Free Software Foundation; either version 2, or (at your option) any
13143580ecSKumar Gala * later version.
14143580ecSKumar Gala *
15143580ecSKumar Gala * In addition to the permissions in the GNU General Public License, the
16143580ecSKumar Gala * Free Software Foundation gives you unlimited permission to link the
17143580ecSKumar Gala * compiled version of this file with other programs, and to distribute
18143580ecSKumar Gala * those programs without any restriction coming from the use of this
19143580ecSKumar Gala * file.  (The General Public License restrictions do apply in other
20143580ecSKumar Gala * respects; for example, they cover modification of the file, and
21143580ecSKumar Gala * distribution when not linked into another program.)
22143580ecSKumar Gala *
23143580ecSKumar Gala * This file is distributed in the hope that it will be useful, but
24143580ecSKumar Gala * WITHOUT ANY WARRANTY; without even the implied warranty of
25143580ecSKumar Gala * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26143580ecSKumar Gala * General Public License for more details.
27143580ecSKumar Gala *
28143580ecSKumar Gala * You should have received a copy of the GNU General Public License
29143580ecSKumar Gala * along with this program; see the file COPYING.  If not, write to
30143580ecSKumar Gala * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
31143580ecSKumar Gala * Boston, MA 02110-1301, USA.
32143580ecSKumar Gala *
33143580ecSKumar Gala *    As a special exception, if you link this library with files
34143580ecSKumar Gala *    compiled with GCC to produce an executable, this does not cause
35143580ecSKumar Gala *    the resulting executable to be covered by the GNU General Public License.
36143580ecSKumar Gala *    This exception does not however invalidate any other reasons why
37143580ecSKumar Gala *    the executable file might be covered by the GNU General Public License.
38143580ecSKumar Gala */
39143580ecSKumar Gala
407c868b66SNicholas Piggin#ifdef __powerpc64__
417c868b66SNicholas Piggin#error "On PPC64, FPR save/restore functions are provided by the linker."
427c868b66SNicholas Piggin#endif
437c868b66SNicholas Piggin
44143580ecSKumar Gala	.file	"crtsavres.S"
45143580ecSKumar Gala	.section ".text"
46143580ecSKumar Gala
47143580ecSKumar Gala#define _GLOBAL(name) \
48143580ecSKumar Gala	.type name,@function; \
49143580ecSKumar Gala	.globl name; \
50143580ecSKumar Galaname:
51143580ecSKumar Gala
52143580ecSKumar Gala/* Routines for saving integer registers, called by the compiler.  */
53143580ecSKumar Gala/* Called with r11 pointing to the stack header word of the caller of the */
54143580ecSKumar Gala/* function, just beyond the end of the integer save area.  */
55143580ecSKumar Gala
56143580ecSKumar Gala_GLOBAL(_savegpr_14)
57143580ecSKumar Gala_GLOBAL(_save32gpr_14)
58143580ecSKumar Gala	stw	14,-72(11)	/* save gp registers */
59143580ecSKumar Gala_GLOBAL(_savegpr_15)
60143580ecSKumar Gala_GLOBAL(_save32gpr_15)
61143580ecSKumar Gala	stw	15,-68(11)
62143580ecSKumar Gala_GLOBAL(_savegpr_16)
63143580ecSKumar Gala_GLOBAL(_save32gpr_16)
64143580ecSKumar Gala	stw	16,-64(11)
65143580ecSKumar Gala_GLOBAL(_savegpr_17)
66143580ecSKumar Gala_GLOBAL(_save32gpr_17)
67143580ecSKumar Gala	stw	17,-60(11)
68143580ecSKumar Gala_GLOBAL(_savegpr_18)
69143580ecSKumar Gala_GLOBAL(_save32gpr_18)
70143580ecSKumar Gala	stw	18,-56(11)
71143580ecSKumar Gala_GLOBAL(_savegpr_19)
72143580ecSKumar Gala_GLOBAL(_save32gpr_19)
73143580ecSKumar Gala	stw	19,-52(11)
74143580ecSKumar Gala_GLOBAL(_savegpr_20)
75143580ecSKumar Gala_GLOBAL(_save32gpr_20)
76143580ecSKumar Gala	stw	20,-48(11)
77143580ecSKumar Gala_GLOBAL(_savegpr_21)
78143580ecSKumar Gala_GLOBAL(_save32gpr_21)
79143580ecSKumar Gala	stw	21,-44(11)
80143580ecSKumar Gala_GLOBAL(_savegpr_22)
81143580ecSKumar Gala_GLOBAL(_save32gpr_22)
82143580ecSKumar Gala	stw	22,-40(11)
83143580ecSKumar Gala_GLOBAL(_savegpr_23)
84143580ecSKumar Gala_GLOBAL(_save32gpr_23)
85143580ecSKumar Gala	stw	23,-36(11)
86143580ecSKumar Gala_GLOBAL(_savegpr_24)
87143580ecSKumar Gala_GLOBAL(_save32gpr_24)
88143580ecSKumar Gala	stw	24,-32(11)
89143580ecSKumar Gala_GLOBAL(_savegpr_25)
90143580ecSKumar Gala_GLOBAL(_save32gpr_25)
91143580ecSKumar Gala	stw	25,-28(11)
92143580ecSKumar Gala_GLOBAL(_savegpr_26)
93143580ecSKumar Gala_GLOBAL(_save32gpr_26)
94143580ecSKumar Gala	stw	26,-24(11)
95143580ecSKumar Gala_GLOBAL(_savegpr_27)
96143580ecSKumar Gala_GLOBAL(_save32gpr_27)
97143580ecSKumar Gala	stw	27,-20(11)
98143580ecSKumar Gala_GLOBAL(_savegpr_28)
99143580ecSKumar Gala_GLOBAL(_save32gpr_28)
100143580ecSKumar Gala	stw	28,-16(11)
101143580ecSKumar Gala_GLOBAL(_savegpr_29)
102143580ecSKumar Gala_GLOBAL(_save32gpr_29)
103143580ecSKumar Gala	stw	29,-12(11)
104143580ecSKumar Gala_GLOBAL(_savegpr_30)
105143580ecSKumar Gala_GLOBAL(_save32gpr_30)
106143580ecSKumar Gala	stw	30,-8(11)
107143580ecSKumar Gala_GLOBAL(_savegpr_31)
108143580ecSKumar Gala_GLOBAL(_save32gpr_31)
109143580ecSKumar Gala	stw	31,-4(11)
110143580ecSKumar Gala	blr
111143580ecSKumar Gala
112143580ecSKumar Gala/* Routines for restoring integer registers, called by the compiler.  */
113143580ecSKumar Gala/* Called with r11 pointing to the stack header word of the caller of the */
114143580ecSKumar Gala/* function, just beyond the end of the integer restore area.  */
115143580ecSKumar Gala
116143580ecSKumar Gala_GLOBAL(_restgpr_14)
117143580ecSKumar Gala_GLOBAL(_rest32gpr_14)
118143580ecSKumar Gala	lwz	14,-72(11)	/* restore gp registers */
119143580ecSKumar Gala_GLOBAL(_restgpr_15)
120143580ecSKumar Gala_GLOBAL(_rest32gpr_15)
121143580ecSKumar Gala	lwz	15,-68(11)
122143580ecSKumar Gala_GLOBAL(_restgpr_16)
123143580ecSKumar Gala_GLOBAL(_rest32gpr_16)
124143580ecSKumar Gala	lwz	16,-64(11)
125143580ecSKumar Gala_GLOBAL(_restgpr_17)
126143580ecSKumar Gala_GLOBAL(_rest32gpr_17)
127143580ecSKumar Gala	lwz	17,-60(11)
128143580ecSKumar Gala_GLOBAL(_restgpr_18)
129143580ecSKumar Gala_GLOBAL(_rest32gpr_18)
130143580ecSKumar Gala	lwz	18,-56(11)
131143580ecSKumar Gala_GLOBAL(_restgpr_19)
132143580ecSKumar Gala_GLOBAL(_rest32gpr_19)
133143580ecSKumar Gala	lwz	19,-52(11)
134143580ecSKumar Gala_GLOBAL(_restgpr_20)
135143580ecSKumar Gala_GLOBAL(_rest32gpr_20)
136143580ecSKumar Gala	lwz	20,-48(11)
137143580ecSKumar Gala_GLOBAL(_restgpr_21)
138143580ecSKumar Gala_GLOBAL(_rest32gpr_21)
139143580ecSKumar Gala	lwz	21,-44(11)
140143580ecSKumar Gala_GLOBAL(_restgpr_22)
141143580ecSKumar Gala_GLOBAL(_rest32gpr_22)
142143580ecSKumar Gala	lwz	22,-40(11)
143143580ecSKumar Gala_GLOBAL(_restgpr_23)
144143580ecSKumar Gala_GLOBAL(_rest32gpr_23)
145143580ecSKumar Gala	lwz	23,-36(11)
146143580ecSKumar Gala_GLOBAL(_restgpr_24)
147143580ecSKumar Gala_GLOBAL(_rest32gpr_24)
148143580ecSKumar Gala	lwz	24,-32(11)
149143580ecSKumar Gala_GLOBAL(_restgpr_25)
150143580ecSKumar Gala_GLOBAL(_rest32gpr_25)
151143580ecSKumar Gala	lwz	25,-28(11)
152143580ecSKumar Gala_GLOBAL(_restgpr_26)
153143580ecSKumar Gala_GLOBAL(_rest32gpr_26)
154143580ecSKumar Gala	lwz	26,-24(11)
155143580ecSKumar Gala_GLOBAL(_restgpr_27)
156143580ecSKumar Gala_GLOBAL(_rest32gpr_27)
157143580ecSKumar Gala	lwz	27,-20(11)
158143580ecSKumar Gala_GLOBAL(_restgpr_28)
159143580ecSKumar Gala_GLOBAL(_rest32gpr_28)
160143580ecSKumar Gala	lwz	28,-16(11)
161143580ecSKumar Gala_GLOBAL(_restgpr_29)
162143580ecSKumar Gala_GLOBAL(_rest32gpr_29)
163143580ecSKumar Gala	lwz	29,-12(11)
164143580ecSKumar Gala_GLOBAL(_restgpr_30)
165143580ecSKumar Gala_GLOBAL(_rest32gpr_30)
166143580ecSKumar Gala	lwz	30,-8(11)
167143580ecSKumar Gala_GLOBAL(_restgpr_31)
168143580ecSKumar Gala_GLOBAL(_rest32gpr_31)
169143580ecSKumar Gala	lwz	31,-4(11)
170143580ecSKumar Gala	blr
171143580ecSKumar Gala
172143580ecSKumar Gala/* Routines for restoring integer registers, called by the compiler.  */
173143580ecSKumar Gala/* Called with r11 pointing to the stack header word of the caller of the */
174143580ecSKumar Gala/* function, just beyond the end of the integer restore area.  */
175143580ecSKumar Gala
176143580ecSKumar Gala_GLOBAL(_restgpr_14_x)
177143580ecSKumar Gala_GLOBAL(_rest32gpr_14_x)
178143580ecSKumar Gala	lwz	14,-72(11)	/* restore gp registers */
179143580ecSKumar Gala_GLOBAL(_restgpr_15_x)
180143580ecSKumar Gala_GLOBAL(_rest32gpr_15_x)
181143580ecSKumar Gala	lwz	15,-68(11)
182143580ecSKumar Gala_GLOBAL(_restgpr_16_x)
183143580ecSKumar Gala_GLOBAL(_rest32gpr_16_x)
184143580ecSKumar Gala	lwz	16,-64(11)
185143580ecSKumar Gala_GLOBAL(_restgpr_17_x)
186143580ecSKumar Gala_GLOBAL(_rest32gpr_17_x)
187143580ecSKumar Gala	lwz	17,-60(11)
188143580ecSKumar Gala_GLOBAL(_restgpr_18_x)
189143580ecSKumar Gala_GLOBAL(_rest32gpr_18_x)
190143580ecSKumar Gala	lwz	18,-56(11)
191143580ecSKumar Gala_GLOBAL(_restgpr_19_x)
192143580ecSKumar Gala_GLOBAL(_rest32gpr_19_x)
193143580ecSKumar Gala	lwz	19,-52(11)
194143580ecSKumar Gala_GLOBAL(_restgpr_20_x)
195143580ecSKumar Gala_GLOBAL(_rest32gpr_20_x)
196143580ecSKumar Gala	lwz	20,-48(11)
197143580ecSKumar Gala_GLOBAL(_restgpr_21_x)
198143580ecSKumar Gala_GLOBAL(_rest32gpr_21_x)
199143580ecSKumar Gala	lwz	21,-44(11)
200143580ecSKumar Gala_GLOBAL(_restgpr_22_x)
201143580ecSKumar Gala_GLOBAL(_rest32gpr_22_x)
202143580ecSKumar Gala	lwz	22,-40(11)
203143580ecSKumar Gala_GLOBAL(_restgpr_23_x)
204143580ecSKumar Gala_GLOBAL(_rest32gpr_23_x)
205143580ecSKumar Gala	lwz	23,-36(11)
206143580ecSKumar Gala_GLOBAL(_restgpr_24_x)
207143580ecSKumar Gala_GLOBAL(_rest32gpr_24_x)
208143580ecSKumar Gala	lwz	24,-32(11)
209143580ecSKumar Gala_GLOBAL(_restgpr_25_x)
210143580ecSKumar Gala_GLOBAL(_rest32gpr_25_x)
211143580ecSKumar Gala	lwz	25,-28(11)
212143580ecSKumar Gala_GLOBAL(_restgpr_26_x)
213143580ecSKumar Gala_GLOBAL(_rest32gpr_26_x)
214143580ecSKumar Gala	lwz	26,-24(11)
215143580ecSKumar Gala_GLOBAL(_restgpr_27_x)
216143580ecSKumar Gala_GLOBAL(_rest32gpr_27_x)
217143580ecSKumar Gala	lwz	27,-20(11)
218143580ecSKumar Gala_GLOBAL(_restgpr_28_x)
219143580ecSKumar Gala_GLOBAL(_rest32gpr_28_x)
220143580ecSKumar Gala	lwz	28,-16(11)
221143580ecSKumar Gala_GLOBAL(_restgpr_29_x)
222143580ecSKumar Gala_GLOBAL(_rest32gpr_29_x)
223143580ecSKumar Gala	lwz	29,-12(11)
224143580ecSKumar Gala_GLOBAL(_restgpr_30_x)
225143580ecSKumar Gala_GLOBAL(_rest32gpr_30_x)
226143580ecSKumar Gala	lwz	30,-8(11)
227143580ecSKumar Gala_GLOBAL(_restgpr_31_x)
228143580ecSKumar Gala_GLOBAL(_rest32gpr_31_x)
229143580ecSKumar Gala	lwz	0,4(11)
230143580ecSKumar Gala	lwz	31,-4(11)
231143580ecSKumar Gala	mtlr	0
232143580ecSKumar Gala	mr	1,11
233143580ecSKumar Gala	blr
234