eabi.asm revision 90075
1219820Sjeff/*
2219820Sjeff * Special support for eabi and SVR4
3219820Sjeff *
4219820Sjeff *   Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
5219820Sjeff *   Written By Michael Meissner
6219820Sjeff *   64-bit support written by David Edelsohn
7219820Sjeff * 
8219820Sjeff * This file is free software; you can redistribute it and/or modify it
9219820Sjeff * under the terms of the GNU General Public License as published by the
10219820Sjeff * Free Software Foundation; either version 2, or (at your option) any
11219820Sjeff * later version.
12219820Sjeff * 
13219820Sjeff * In addition to the permissions in the GNU General Public License, the
14219820Sjeff * Free Software Foundation gives you unlimited permission to link the
15219820Sjeff * compiled version of this file with other programs, and to distribute
16219820Sjeff * those programs without any restriction coming from the use of this
17219820Sjeff * file.  (The General Public License restrictions do apply in other
18219820Sjeff * respects; for example, they cover modification of the file, and
19219820Sjeff * distribution when not linked into another program.)
20219820Sjeff * 
21219820Sjeff * This file is distributed in the hope that it will be useful, but
22219820Sjeff * WITHOUT ANY WARRANTY; without even the implied warranty of
23219820Sjeff * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24219820Sjeff * General Public License for more details.
25219820Sjeff * 
26219820Sjeff * You should have received a copy of the GNU General Public License
27219820Sjeff * along with this program; see the file COPYING.  If not, write to
28219820Sjeff * the Free Software Foundation, 59 Temple Place - Suite 330,
29219820Sjeff * Boston, MA 02111-1307, USA.
30219820Sjeff * 
31219820Sjeff *    As a special exception, if you link this library with files
32219820Sjeff *    compiled with GCC to produce an executable, this does not cause
33219820Sjeff *    the resulting executable to be covered by the GNU General Public License.
34219820Sjeff *    This exception does not however invalidate any other reasons why
35219820Sjeff *    the executable file might be covered by the GNU General Public License.
36219820Sjeff */ 
37219820Sjeff
38219820Sjeff/* Do any initializations needed for the eabi environment */
39219820Sjeff
40219820Sjeff	.file	"eabi.asm"
41219820Sjeff	.section ".text"
42219820Sjeff	#include "ppc-asm.h"
43219820Sjeff
44219820Sjeff#ifndef __powerpc64__
45219820Sjeff
46219820Sjeff	 .section ".got2","aw"
47219820Sjeff	.align	2
48219820Sjeff.LCTOC1 = . /* +32768 */
49219820Sjeff
50219820Sjeff/* Table of addresses */
51219820Sjeff.Ltable = .-.LCTOC1
52219820Sjeff	.long	.LCTOC1				/* address we are really at */
53219820Sjeff
54219820Sjeff.Lsda = .-.LCTOC1
55219820Sjeff	.long	_SDA_BASE_			/* address of the first small data area */
56219820Sjeff
57219820Sjeff.Lsdas = .-.LCTOC1
58219820Sjeff	.long	__SDATA_START__			/* start of .sdata/.sbss section */
59219820Sjeff
60219820Sjeff.Lsdae = .-.LCTOC1
61219820Sjeff	.long	__SBSS_END__			/* end of .sdata/.sbss section */
62219820Sjeff
63219820Sjeff.Lsda2 = .-.LCTOC1
64219820Sjeff	.long	_SDA2_BASE_			/* address of the second small data area */
65219820Sjeff
66219820Sjeff.Lsda2s = .-.LCTOC1
67219820Sjeff	.long	__SDATA2_START__		/* start of .sdata2/.sbss2 section */
68219820Sjeff
69219820Sjeff.Lsda2e = .-.LCTOC1
70219820Sjeff	.long	__SBSS2_END__			/* end of .sdata2/.sbss2 section */
71219820Sjeff
72219820Sjeff#ifdef _RELOCATABLE
73219820Sjeff.Lgots = .-.LCTOC1
74219820Sjeff	.long	__GOT_START__			/* Global offset table start */
75219820Sjeff
76219820Sjeff.Lgotm1 = .-.LCTOC1
77219820Sjeff	.long	_GLOBAL_OFFSET_TABLE_-4		/* end of GOT ptrs before BLCL + 3 reserved words */
78219820Sjeff
79219820Sjeff.Lgotm2 = .-.LCTOC1
80219820Sjeff	.long	_GLOBAL_OFFSET_TABLE_+12	/* start of GOT ptrs after BLCL + 3 reserved words */
81219820Sjeff
82219820Sjeff.Lgote = .-.LCTOC1
83219820Sjeff	.long	__GOT_END__			/* Global offset table end */
84219820Sjeff
85219820Sjeff.Lgot2s = .-.LCTOC1
86219820Sjeff	.long	__GOT2_START__			/* -mrelocatable GOT pointers start */
87219820Sjeff
88219820Sjeff.Lgot2e = .-.LCTOC1
89219820Sjeff	.long	__GOT2_END__			/* -mrelocatable GOT pointers end */
90219820Sjeff
91219820Sjeff.Lfixups = .-.LCTOC1
92219820Sjeff	.long	__FIXUP_START__			/* start of .fixup section */
93219820Sjeff
94219820Sjeff.Lfixupe = .-.LCTOC1
95219820Sjeff	.long	__FIXUP_END__			/* end of .fixup section */
96219820Sjeff
97219820Sjeff.Lctors = .-.LCTOC1
98219820Sjeff	.long	__CTOR_LIST__			/* start of .ctor section */
99219820Sjeff
100219820Sjeff.Lctore = .-.LCTOC1
101219820Sjeff	.long	__CTOR_END__			/* end of .ctor section */
102219820Sjeff
103219820Sjeff.Ldtors = .-.LCTOC1
104219820Sjeff	.long	__DTOR_LIST__			/* start of .dtor section */
105219820Sjeff
106219820Sjeff.Ldtore = .-.LCTOC1
107219820Sjeff	.long	__DTOR_END__			/* end of .dtor section */
108219820Sjeff
109219820Sjeff.Lexcepts = .-.LCTOC1
110219820Sjeff	.long	__EXCEPT_START__		/* start of .gcc_except_table section */
111219820Sjeff
112219820Sjeff.Lexcepte = .-.LCTOC1
113219820Sjeff	.long	__EXCEPT_END__			/* end of .gcc_except_table section */
114219820Sjeff
115219820Sjeff.Linit = .-.LCTOC1
116219820Sjeff	.long	.Linit_p			/* address of variable to say we've been called */
117219820Sjeff
118219820Sjeff	.text
119219820Sjeff	.align	2
120219820Sjeff.Lptr:
121219820Sjeff	.long	.LCTOC1-.Laddr			/* PC relative pointer to .got2 */
122219820Sjeff#endif
123219820Sjeff
124219820Sjeff	.data
125219820Sjeff	.align	2
126219820Sjeff.Linit_p:
127219820Sjeff	.long	0
128219820Sjeff
129219820Sjeff	.text
130219820Sjeff
131219820SjeffFUNC_START(__eabi)
132219820Sjeff
133219820Sjeff/* Eliminate -mrelocatable code if not -mrelocatable, so that this file can
134219820Sjeff   be assembled with other assemblers than GAS.  */
135219820Sjeff
136219820Sjeff#ifndef _RELOCATABLE
137219820Sjeff	addis	10,0,.Linit_p@ha		/* init flag */
138219820Sjeff	addis	11,0,.LCTOC1@ha			/* load address of .LCTOC1 */
139219820Sjeff	lwz	9,.Linit_p@l(10)		/* init flag */
140219820Sjeff	addi	11,11,.LCTOC1@l
141219820Sjeff	cmplwi	2,9,0				/* init flag != 0? */
142219820Sjeff	bnelr	2				/* return now, if we've been called already */
143219820Sjeff	stw	1,.Linit_p@l(10)		/* store a non-zero value in the done flag */
144219820Sjeff
145219820Sjeff#else /* -mrelocatable */
146219820Sjeff	mflr	0
147219820Sjeff	bl	.Laddr				/* get current address */
148219820Sjeff.Laddr:
149219820Sjeff	mflr	12				/* real address of .Laddr */
150219820Sjeff	lwz	11,(.Lptr-.Laddr)(12)		/* linker generated address of .LCTOC1 */
151219820Sjeff	add	11,11,12			/* correct to real pointer */
152219820Sjeff	lwz	12,.Ltable(11)			/* get linker's idea of where .Laddr is */
153219820Sjeff	lwz	10,.Linit(11)			/* address of init flag */
154219820Sjeff	subf.	12,12,11			/* calculate difference */
155219820Sjeff	lwzx	9,10,12				/* done flag */
156219820Sjeff	cmplwi	2,9,0				/* init flag != 0? */
157219820Sjeff	mtlr	0				/* restore in case branch was taken */
158219820Sjeff	bnelr	2				/* return now, if we've been called already */
159219820Sjeff	stwx	1,10,12				/* store a non-zero value in the done flag */
160219820Sjeff	beq+	0,.Lsdata			/* skip if we don't need to relocate */
161219820Sjeff
162219820Sjeff/* We need to relocate the .got2 pointers.  */
163219820Sjeff
164219820Sjeff	lwz	3,.Lgot2s(11)			/* GOT2 pointers start */
165219820Sjeff	lwz	4,.Lgot2e(11)			/* GOT2 pointers end */
166219820Sjeff	add	3,12,3				/* adjust pointers */
167219820Sjeff	add	4,12,4
168219820Sjeff	bl	FUNC_NAME(__eabi_convert)	/* convert pointers in .got2 section */
169219820Sjeff
170219820Sjeff/* Fixup the .ctor section for static constructors */
171219820Sjeff
172219820Sjeff	lwz	3,.Lctors(11)			/* constructors pointers start */
173219820Sjeff	lwz	4,.Lctore(11)			/* constructors pointers end */
174219820Sjeff	bl	FUNC_NAME(__eabi_convert)	/* convert constructors */
175219820Sjeff
176219820Sjeff/* Fixup the .dtor section for static destructors */
177219820Sjeff
178219820Sjeff	lwz	3,.Ldtors(11)			/* destructors pointers start */
179219820Sjeff	lwz	4,.Ldtore(11)			/* destructors pointers end */
180219820Sjeff	bl	FUNC_NAME(__eabi_convert)	/* convert destructors */
181219820Sjeff
182219820Sjeff/* Fixup the .gcc_except_table section for G++ exceptions */
183219820Sjeff
184219820Sjeff	lwz	3,.Lexcepts(11)			/* exception table pointers start */
185219820Sjeff	lwz	4,.Lexcepte(11)			/* exception table pointers end */
186219820Sjeff	bl	FUNC_NAME(__eabi_convert)	/* convert exceptions */
187219820Sjeff
188219820Sjeff/* Fixup the addresses in the GOT below _GLOBAL_OFFSET_TABLE_-4 */
189219820Sjeff
190219820Sjeff	lwz	3,.Lgots(11)			/* GOT table pointers start */
191219820Sjeff	lwz	4,.Lgotm1(11)			/* GOT table pointers below _GLOBAL_OFFSET_TABLE-4 */
192219820Sjeff	bl	FUNC_NAME(__eabi_convert)	/* convert lower GOT */
193219820Sjeff
194219820Sjeff/* Fixup the addresses in the GOT above _GLOBAL_OFFSET_TABLE_+12 */
195219820Sjeff
196219820Sjeff	lwz	3,.Lgotm2(11)			/* GOT table pointers above _GLOBAL_OFFSET_TABLE+12 */
197219820Sjeff	lwz	4,.Lgote(11)			/* GOT table pointers end */
198219820Sjeff	bl	FUNC_NAME(__eabi_convert)	/* convert lower GOT */
199219820Sjeff
200219820Sjeff/* Fixup any user initialized pointers now (the compiler drops pointers to */
201219820Sjeff/* each of the relocs that it does in the .fixup section).  */
202219820Sjeff
203219820Sjeff.Lfix:
204219820Sjeff	lwz	3,.Lfixups(11)			/* fixup pointers start */
205219820Sjeff	lwz	4,.Lfixupe(11)			/* fixup pointers end */
206219820Sjeff	bl	FUNC_NAME(__eabi_uconvert)	/* convert user initialized pointers */
207219820Sjeff
208219820Sjeff.Lsdata:
209219820Sjeff	mtlr	0				/* restore link register */
210219820Sjeff#endif /* _RELOCATABLE */
211219820Sjeff
212219820Sjeff/* Only load up register 13 if there is a .sdata and/or .sbss section */
213219820Sjeff	lwz	3,.Lsdas(11)			/* start of .sdata/.sbss section */
214219820Sjeff	lwz	4,.Lsdae(11)			/* end of .sdata/.sbss section */
215219820Sjeff	cmpw	1,3,4				/* .sdata/.sbss section non-empty? */
216219820Sjeff	beq-	1,.Lsda2l			/* skip loading r13 */
217219820Sjeff
218219820Sjeff	lwz	13,.Lsda(11)			/* load r13 with _SDA_BASE_ address */
219219820Sjeff
220219820Sjeff/* Only load up register 2 if there is a .sdata2 and/or .sbss2 section */
221219820Sjeff
222219820Sjeff.Lsda2l:	
223219820Sjeff	lwz	3,.Lsda2s(11)			/* start of .sdata/.sbss section */
224219820Sjeff	lwz	4,.Lsda2e(11)			/* end of .sdata/.sbss section */
225219820Sjeff	cmpw	1,3,4				/* .sdata/.sbss section non-empty? */
226219820Sjeff	beq+	1,.Ldone			/* skip loading r2 */
227219820Sjeff
228219820Sjeff	lwz	2,.Lsda2(11)			/* load r2 with _SDA2_BASE_ address */
229219820Sjeff
230219820Sjeff/* Done adjusting pointers, return by way of doing the C++ global constructors.  */
231219820Sjeff
232219820Sjeff.Ldone:
233219820Sjeff	b	FUNC_NAME(__init)	/* do any C++ global constructors (which returns to caller) */
234219820SjeffFUNC_END(__eabi)
235219820Sjeff
236219820Sjeff/* Special subroutine to convert a bunch of pointers directly.
237219820Sjeff   r0		has original link register
238219820Sjeff   r3		has low pointer to convert
239219820Sjeff   r4		has high pointer to convert
240219820Sjeff   r5 .. r10	are scratch registers
241219820Sjeff   r11		has the address of .LCTOC1 in it.
242219820Sjeff   r12		has the value to add to each pointer
243219820Sjeff   r13 .. r31	are unchanged */
244219820Sjeff	
245219820SjeffFUNC_START(__eabi_convert)
246219820Sjeff        cmplw	1,3,4				/* any pointers to convert? */
247219820Sjeff        subf	5,3,4				/* calculate number of words to convert */
248219820Sjeff        bclr	4,4				/* return if no pointers */
249219820Sjeff
250219820Sjeff        srawi	5,5,2
251219820Sjeff	addi	3,3,-4				/* start-4 for use with lwzu */
252219820Sjeff        mtctr	5
253219820Sjeff
254219820Sjeff.Lcvt:
255219820Sjeff	lwzu	6,4(3)				/* pointer to convert */
256219820Sjeff	cmpi	0,6,0
257219820Sjeff	beq-	.Lcvt2				/* if pointer is null, don't convert */
258219820Sjeff
259219820Sjeff        add	6,6,12				/* convert pointer */
260219820Sjeff        stw	6,0(3)
261219820Sjeff.Lcvt2:
262219820Sjeff        bdnz+	.Lcvt
263219820Sjeff        blr
264219820Sjeff
265219820SjeffFUNC_END(__eabi_convert)
266219820Sjeff
267219820Sjeff/* Special subroutine to convert the pointers the user has initialized.  The
268219820Sjeff   compiler has placed the address of the initialized pointer into the .fixup
269219820Sjeff   section.
270219820Sjeff
271219820Sjeff   r0		has original link register
272219820Sjeff   r3		has low pointer to convert
273219820Sjeff   r4		has high pointer to convert
274219820Sjeff   r5 .. r10	are scratch registers
275219820Sjeff   r11		has the address of .LCTOC1 in it.
276219820Sjeff   r12		has the value to add to each pointer
277219820Sjeff   r13 .. r31	are unchanged */
278219820Sjeff	
279219820SjeffFUNC_START(__eabi_uconvert)
280219820Sjeff        cmplw	1,3,4				/* any pointers to convert? */
281219820Sjeff        subf	5,3,4				/* calculate number of words to convert */
282219820Sjeff        bclr	4,4				/* return if no pointers */
283219820Sjeff
284219820Sjeff        srawi	5,5,2
285219820Sjeff	addi	3,3,-4				/* start-4 for use with lwzu */
286219820Sjeff        mtctr	5
287219820Sjeff
288219820Sjeff.Lucvt:
289219820Sjeff	lwzu	6,4(3)				/* next pointer to pointer to convert */
290219820Sjeff	add	6,6,12				/* adjust pointer */
291219820Sjeff	lwz	7,0(6)				/* get the pointer it points to */
292219820Sjeff	stw	6,0(3)				/* store adjusted pointer */
293219820Sjeff	add	7,7,12				/* adjust */
294219820Sjeff	stw	7,0(6)
295219820Sjeff        bdnz+	.Lucvt
296219820Sjeff        blr
297219820Sjeff
298219820SjeffFUNC_END(__eabi_uconvert)
299219820Sjeff
300219820Sjeff/* Routines for saving floating point registers, called by the compiler.  */
301219820Sjeff/* Called with r11 pointing to the stack header word of the caller of the */
302219820Sjeff/* function, just beyond the end of the floating point save area.  */
303219820Sjeff
304219820SjeffFUNC_START(_savefpr_14)	stfd	14,-144(11)	/* save fp registers */
305219820SjeffFUNC_START(_savefpr_15)	stfd	15,-136(11)
306219820SjeffFUNC_START(_savefpr_16)	stfd	16,-128(11)
307219820SjeffFUNC_START(_savefpr_17)	stfd	17,-120(11)
308219820SjeffFUNC_START(_savefpr_18)	stfd	18,-112(11)
309219820SjeffFUNC_START(_savefpr_19)	stfd	19,-104(11)
310219820SjeffFUNC_START(_savefpr_20)	stfd	20,-96(11)
311219820SjeffFUNC_START(_savefpr_21)	stfd	21,-88(11)
312219820SjeffFUNC_START(_savefpr_22)	stfd	22,-80(11)
313219820SjeffFUNC_START(_savefpr_23)	stfd	23,-72(11)
314219820SjeffFUNC_START(_savefpr_24)	stfd	24,-64(11)
315219820SjeffFUNC_START(_savefpr_25)	stfd	25,-56(11)
316219820SjeffFUNC_START(_savefpr_26)	stfd	26,-48(11)
317219820SjeffFUNC_START(_savefpr_27)	stfd	27,-40(11)
318219820SjeffFUNC_START(_savefpr_28)	stfd	28,-32(11)
319219820SjeffFUNC_START(_savefpr_29)	stfd	29,-24(11)
320219820SjeffFUNC_START(_savefpr_30)	stfd	30,-16(11)
321219820SjeffFUNC_START(_savefpr_31)	stfd	31,-8(11)
322219820Sjeff			blr
323219820SjeffFUNC_END(_savefpr_31)
324219820SjeffFUNC_END(_savefpr_30)
325219820SjeffFUNC_END(_savefpr_29)
326219820SjeffFUNC_END(_savefpr_28)
327219820SjeffFUNC_END(_savefpr_27)
328219820SjeffFUNC_END(_savefpr_26)
329219820SjeffFUNC_END(_savefpr_25)
330219820SjeffFUNC_END(_savefpr_24)
331219820SjeffFUNC_END(_savefpr_23)
332219820SjeffFUNC_END(_savefpr_22)
333219820SjeffFUNC_END(_savefpr_21)
334219820SjeffFUNC_END(_savefpr_20)
335219820SjeffFUNC_END(_savefpr_19)
336219820SjeffFUNC_END(_savefpr_18)
337219820SjeffFUNC_END(_savefpr_17)
338219820SjeffFUNC_END(_savefpr_16)
339219820SjeffFUNC_END(_savefpr_15)
340219820SjeffFUNC_END(_savefpr_14)
341219820Sjeff
342219820Sjeff/* Routines for saving integer registers, called by the compiler.  */
343219820Sjeff/* Called with r11 pointing to the stack header word of the caller of the */
344219820Sjeff/* function, just beyond the end of the integer save area.  */
345219820Sjeff
346219820SjeffFUNC_START(_savegpr_14)	stw	14,-72(11)	/* save gp registers */
347219820SjeffFUNC_START(_savegpr_15)	stw	15,-68(11)
348219820SjeffFUNC_START(_savegpr_16)	stw	16,-64(11)
349219820SjeffFUNC_START(_savegpr_17)	stw	17,-60(11)
350219820SjeffFUNC_START(_savegpr_18)	stw	18,-56(11)
351219820SjeffFUNC_START(_savegpr_19)	stw	19,-52(11)
352219820SjeffFUNC_START(_savegpr_20)	stw	20,-48(11)
353219820SjeffFUNC_START(_savegpr_21)	stw	21,-44(11)
354219820SjeffFUNC_START(_savegpr_22)	stw	22,-40(11)
355219820SjeffFUNC_START(_savegpr_23)	stw	23,-36(11)
356219820SjeffFUNC_START(_savegpr_24)	stw	24,-32(11)
357219820SjeffFUNC_START(_savegpr_25)	stw	25,-28(11)
358219820SjeffFUNC_START(_savegpr_26)	stw	26,-24(11)
359219820SjeffFUNC_START(_savegpr_27)	stw	27,-20(11)
360219820SjeffFUNC_START(_savegpr_28)	stw	28,-16(11)
361219820SjeffFUNC_START(_savegpr_29)	stw	29,-12(11)
362219820SjeffFUNC_START(_savegpr_30)	stw	30,-8(11)
363219820SjeffFUNC_START(_savegpr_31)	stw	31,-4(11)
364219820Sjeff			blr
365219820SjeffFUNC_END(_savegpr_31)
366219820SjeffFUNC_END(_savegpr_30)
367219820SjeffFUNC_END(_savegpr_29)
368219820SjeffFUNC_END(_savegpr_28)
369219820SjeffFUNC_END(_savegpr_27)
370219820SjeffFUNC_END(_savegpr_26)
371219820SjeffFUNC_END(_savegpr_25)
372219820SjeffFUNC_END(_savegpr_24)
373219820SjeffFUNC_END(_savegpr_23)
374219820SjeffFUNC_END(_savegpr_22)
375219820SjeffFUNC_END(_savegpr_21)
376219820SjeffFUNC_END(_savegpr_20)
377219820SjeffFUNC_END(_savegpr_19)
378219820SjeffFUNC_END(_savegpr_18)
379219820SjeffFUNC_END(_savegpr_17)
380219820SjeffFUNC_END(_savegpr_16)
381219820SjeffFUNC_END(_savegpr_15)
382219820SjeffFUNC_END(_savegpr_14)
383219820Sjeff
384219820Sjeff/* Routines for restoring floating point registers, called by the compiler.  */
385219820Sjeff/* Called with r11 pointing to the stack header word of the caller of the */
386219820Sjeff/* function, just beyond the end of the floating point save area.  */
387219820Sjeff
388219820SjeffFUNC_START(_restfpr_14)	lfd	14,-144(11)	/* restore fp registers */
389219820SjeffFUNC_START(_restfpr_15)	lfd	15,-136(11)
390219820SjeffFUNC_START(_restfpr_16)	lfd	16,-128(11)
391219820SjeffFUNC_START(_restfpr_17)	lfd	17,-120(11)
392219820SjeffFUNC_START(_restfpr_18)	lfd	18,-112(11)
393219820SjeffFUNC_START(_restfpr_19)	lfd	19,-104(11)
394219820SjeffFUNC_START(_restfpr_20)	lfd	20,-96(11)
395219820SjeffFUNC_START(_restfpr_21)	lfd	21,-88(11)
396219820SjeffFUNC_START(_restfpr_22)	lfd	22,-80(11)
397219820SjeffFUNC_START(_restfpr_23)	lfd	23,-72(11)
398219820SjeffFUNC_START(_restfpr_24)	lfd	24,-64(11)
399219820SjeffFUNC_START(_restfpr_25)	lfd	25,-56(11)
400219820SjeffFUNC_START(_restfpr_26)	lfd	26,-48(11)
401219820SjeffFUNC_START(_restfpr_27)	lfd	27,-40(11)
402219820SjeffFUNC_START(_restfpr_28)	lfd	28,-32(11)
403219820SjeffFUNC_START(_restfpr_29)	lfd	29,-24(11)
404219820SjeffFUNC_START(_restfpr_30)	lfd	30,-16(11)
405219820SjeffFUNC_START(_restfpr_31)	lfd	31,-8(11)
406219820Sjeff			blr
407219820SjeffFUNC_END(_restfpr_31)
408219820SjeffFUNC_END(_restfpr_30)
409219820SjeffFUNC_END(_restfpr_29)
410219820SjeffFUNC_END(_restfpr_28)
411219820SjeffFUNC_END(_restfpr_27)
412219820SjeffFUNC_END(_restfpr_26)
413219820SjeffFUNC_END(_restfpr_25)
414219820SjeffFUNC_END(_restfpr_24)
415219820SjeffFUNC_END(_restfpr_23)
416219820SjeffFUNC_END(_restfpr_22)
417219820SjeffFUNC_END(_restfpr_21)
418219820SjeffFUNC_END(_restfpr_20)
419219820SjeffFUNC_END(_restfpr_19)
420219820SjeffFUNC_END(_restfpr_18)
421219820SjeffFUNC_END(_restfpr_17)
422219820SjeffFUNC_END(_restfpr_16)
423219820SjeffFUNC_END(_restfpr_15)
424219820SjeffFUNC_END(_restfpr_14)
425219820Sjeff
426219820Sjeff/* Routines for restoring integer registers, called by the compiler.  */
427219820Sjeff/* Called with r11 pointing to the stack header word of the caller of the */
428219820Sjeff/* function, just beyond the end of the integer restore area.  */
429219820Sjeff
430219820SjeffFUNC_START(_restgpr_14)	lwz	14,-72(11)	/* restore gp registers */
431219820SjeffFUNC_START(_restgpr_15)	lwz	15,-68(11)
432219820SjeffFUNC_START(_restgpr_16)	lwz	16,-64(11)
433219820SjeffFUNC_START(_restgpr_17)	lwz	17,-60(11)
434219820SjeffFUNC_START(_restgpr_18)	lwz	18,-56(11)
435219820SjeffFUNC_START(_restgpr_19)	lwz	19,-52(11)
436219820SjeffFUNC_START(_restgpr_20)	lwz	20,-48(11)
437219820SjeffFUNC_START(_restgpr_21)	lwz	21,-44(11)
438219820SjeffFUNC_START(_restgpr_22)	lwz	22,-40(11)
439219820SjeffFUNC_START(_restgpr_23)	lwz	23,-36(11)
440219820SjeffFUNC_START(_restgpr_24)	lwz	24,-32(11)
441219820SjeffFUNC_START(_restgpr_25)	lwz	25,-28(11)
442219820SjeffFUNC_START(_restgpr_26)	lwz	26,-24(11)
443219820SjeffFUNC_START(_restgpr_27)	lwz	27,-20(11)
444219820SjeffFUNC_START(_restgpr_28)	lwz	28,-16(11)
445219820SjeffFUNC_START(_restgpr_29)	lwz	29,-12(11)
446219820SjeffFUNC_START(_restgpr_30)	lwz	30,-8(11)
447219820SjeffFUNC_START(_restgpr_31)	lwz	31,-4(11)
448219820Sjeff			blr
449219820SjeffFUNC_END(_restgpr_31)
450219820SjeffFUNC_END(_restgpr_30)
451219820SjeffFUNC_END(_restgpr_29)
452219820SjeffFUNC_END(_restgpr_28)
453219820SjeffFUNC_END(_restgpr_27)
454219820SjeffFUNC_END(_restgpr_26)
455219820SjeffFUNC_END(_restgpr_25)
456219820SjeffFUNC_END(_restgpr_24)
457219820SjeffFUNC_END(_restgpr_23)
458219820SjeffFUNC_END(_restgpr_22)
459219820SjeffFUNC_END(_restgpr_21)
460219820SjeffFUNC_END(_restgpr_20)
461219820SjeffFUNC_END(_restgpr_19)
462219820SjeffFUNC_END(_restgpr_18)
463219820SjeffFUNC_END(_restgpr_17)
464219820SjeffFUNC_END(_restgpr_16)
465219820SjeffFUNC_END(_restgpr_15)
466219820SjeffFUNC_END(_restgpr_14)
467219820Sjeff
468219820Sjeff/* Routines for restoring floating point registers, called by the compiler.  */
469219820Sjeff/* Called with r11 pointing to the stack header word of the caller of the */
470219820Sjeff/* function, just beyond the end of the floating point save area.  */
471219820Sjeff/* In addition to restoring the fp registers, it will return to the caller's */
472219820Sjeff/* caller */
473219820Sjeff
474219820SjeffFUNC_START(_restfpr_14_x)	lfd	14,-144(11)	/* restore fp registers */
475219820SjeffFUNC_START(_restfpr_15_x)	lfd	15,-136(11)
476219820SjeffFUNC_START(_restfpr_16_x)	lfd	16,-128(11)
477219820SjeffFUNC_START(_restfpr_17_x)	lfd	17,-120(11)
478219820SjeffFUNC_START(_restfpr_18_x)	lfd	18,-112(11)
479219820SjeffFUNC_START(_restfpr_19_x)	lfd	19,-104(11)
480219820SjeffFUNC_START(_restfpr_20_x)	lfd	20,-96(11)
481219820SjeffFUNC_START(_restfpr_21_x)	lfd	21,-88(11)
482219820SjeffFUNC_START(_restfpr_22_x)	lfd	22,-80(11)
483219820SjeffFUNC_START(_restfpr_23_x)	lfd	23,-72(11)
484219820SjeffFUNC_START(_restfpr_24_x)	lfd	24,-64(11)
485219820SjeffFUNC_START(_restfpr_25_x)	lfd	25,-56(11)
486219820SjeffFUNC_START(_restfpr_26_x)	lfd	26,-48(11)
487219820SjeffFUNC_START(_restfpr_27_x)	lfd	27,-40(11)
488219820SjeffFUNC_START(_restfpr_28_x)	lfd	28,-32(11)
489219820SjeffFUNC_START(_restfpr_29_x)	lfd	29,-24(11)
490219820SjeffFUNC_START(_restfpr_30_x)	lfd	30,-16(11)
491219820SjeffFUNC_START(_restfpr_31_x)	lwz	0,4(11)
492219820Sjeff				lfd	31,-8(11)
493219820Sjeff				mtlr	0
494219820Sjeff				mr	1,11
495219820Sjeff				blr
496219820SjeffFUNC_END(_restfpr_31_x)
497219820SjeffFUNC_END(_restfpr_30_x)
498219820SjeffFUNC_END(_restfpr_29_x)
499219820SjeffFUNC_END(_restfpr_28_x)
500219820SjeffFUNC_END(_restfpr_27_x)
501219820SjeffFUNC_END(_restfpr_26_x)
502219820SjeffFUNC_END(_restfpr_25_x)
503219820SjeffFUNC_END(_restfpr_24_x)
504219820SjeffFUNC_END(_restfpr_23_x)
505219820SjeffFUNC_END(_restfpr_22_x)
506219820SjeffFUNC_END(_restfpr_21_x)
507219820SjeffFUNC_END(_restfpr_20_x)
508219820SjeffFUNC_END(_restfpr_19_x)
509219820SjeffFUNC_END(_restfpr_18_x)
510219820SjeffFUNC_END(_restfpr_17_x)
511219820SjeffFUNC_END(_restfpr_16_x)
512219820SjeffFUNC_END(_restfpr_15_x)
513219820SjeffFUNC_END(_restfpr_14_x)
514219820Sjeff
515219820Sjeff/* Routines for restoring integer registers, called by the compiler.  */
516219820Sjeff/* Called with r11 pointing to the stack header word of the caller of the */
517219820Sjeff/* function, just beyond the end of the integer restore area.  */
518219820Sjeff
519219820SjeffFUNC_START(_restgpr_14_x)	lwz	14,-72(11)	/* restore gp registers */
520219820SjeffFUNC_START(_restgpr_15_x)	lwz	15,-68(11)
521219820SjeffFUNC_START(_restgpr_16_x)	lwz	16,-64(11)
522219820SjeffFUNC_START(_restgpr_17_x)	lwz	17,-60(11)
523219820SjeffFUNC_START(_restgpr_18_x)	lwz	18,-56(11)
524219820SjeffFUNC_START(_restgpr_19_x)	lwz	19,-52(11)
525219820SjeffFUNC_START(_restgpr_20_x)	lwz	20,-48(11)
526219820SjeffFUNC_START(_restgpr_21_x)	lwz	21,-44(11)
527219820SjeffFUNC_START(_restgpr_22_x)	lwz	22,-40(11)
528219820SjeffFUNC_START(_restgpr_23_x)	lwz	23,-36(11)
529219820SjeffFUNC_START(_restgpr_24_x)	lwz	24,-32(11)
530219820SjeffFUNC_START(_restgpr_25_x)	lwz	25,-28(11)
531219820SjeffFUNC_START(_restgpr_26_x)	lwz	26,-24(11)
532219820SjeffFUNC_START(_restgpr_27_x)	lwz	27,-20(11)
533219820SjeffFUNC_START(_restgpr_28_x)	lwz	28,-16(11)
534219820SjeffFUNC_START(_restgpr_29_x)	lwz	29,-12(11)
535219820SjeffFUNC_START(_restgpr_30_x)	lwz	30,-8(11)
536219820SjeffFUNC_START(_restgpr_31_x)	lwz	0,4(11)
537219820Sjeff				lwz	31,-4(11)
538219820Sjeff				mtlr	0
539219820Sjeff				mr	1,11
540219820Sjeff				blr
541219820SjeffFUNC_END(_restgpr_31_x)
542219820SjeffFUNC_END(_restgpr_30_x)
543219820SjeffFUNC_END(_restgpr_29_x)
544219820SjeffFUNC_END(_restgpr_28_x)
545219820SjeffFUNC_END(_restgpr_27_x)
546219820SjeffFUNC_END(_restgpr_26_x)
547219820SjeffFUNC_END(_restgpr_25_x)
548219820SjeffFUNC_END(_restgpr_24_x)
549219820SjeffFUNC_END(_restgpr_23_x)
550219820SjeffFUNC_END(_restgpr_22_x)
551219820SjeffFUNC_END(_restgpr_21_x)
552219820SjeffFUNC_END(_restgpr_20_x)
553219820SjeffFUNC_END(_restgpr_19_x)
554219820SjeffFUNC_END(_restgpr_18_x)
555219820SjeffFUNC_END(_restgpr_17_x)
556219820SjeffFUNC_END(_restgpr_16_x)
557219820SjeffFUNC_END(_restgpr_15_x)
558219820SjeffFUNC_END(_restgpr_14_x)
559219820Sjeff
560219820Sjeff#else /* __powerpc64__ */
561219820Sjeff
562219820Sjeff	.section ".text"
563219820Sjeff	.align 2
564219820Sjeff
565219820Sjeff/* Routines for saving floating point registers, called by the compiler.  */
566219820Sjeff
567219820Sjeff.fsav:
568219820SjeffFUNC_START(_savef14)	stfd	14,-144(1)	/* save fp registers */
569219820SjeffFUNC_START(_savef15)	stfd	15,-136(1)
570219820SjeffFUNC_START(_savef16)	stfd	16,-128(1)
571219820SjeffFUNC_START(_savef17)	stfd	17,-120(1)
572219820SjeffFUNC_START(_savef18)	stfd	18,-112(1)
573219820SjeffFUNC_START(_savef19)	stfd	19,-104(1)
574219820SjeffFUNC_START(_savef20)	stfd	20,-96(1)
575219820SjeffFUNC_START(_savef21)	stfd	21,-88(1)
576219820SjeffFUNC_START(_savef22)	stfd	22,-80(1)
577219820SjeffFUNC_START(_savef23)	stfd	23,-72(1)
578219820SjeffFUNC_START(_savef24)	stfd	24,-64(1)
579219820SjeffFUNC_START(_savef25)	stfd	25,-56(1)
580219820SjeffFUNC_START(_savef26)	stfd	26,-48(1)
581219820SjeffFUNC_START(_savef27)	stfd	27,-40(1)
582219820SjeffFUNC_START(_savef28)	stfd	28,-32(1)
583219820SjeffFUNC_START(_savef29)	stfd	29,-24(1)
584219820SjeffFUNC_START(_savef30)	stfd	30,-16(1)
585219820SjeffFUNC_START(_savef31)	stfd	31,-8(1)
586219820Sjeff			blr
587219820Sjeff.LTfsav:
588219820Sjeff			.long 0
589219820Sjeff			.byte 0,12,0,0,0,0,0,0
590219820Sjeff			.long 0
591219820Sjeff			.long .LTfsav-.fsav
592219820Sjeff			.short 4
593219820Sjeff			.ascii "fsav"
594219820SjeffFUNC_END(_savef31)
595FUNC_END(_savef30)
596FUNC_END(_savef29)
597FUNC_END(_savef28)
598FUNC_END(_savef27)
599FUNC_END(_savef26)
600FUNC_END(_savef25)
601FUNC_END(_savef24)
602FUNC_END(_savef23)
603FUNC_END(_savef22)
604FUNC_END(_savef21)
605FUNC_END(_savef20)
606FUNC_END(_savef19)
607FUNC_END(_savef18)
608FUNC_END(_savef17)
609FUNC_END(_savef16)
610FUNC_END(_savef15)
611FUNC_END(_savef14)
612
613/* Routines for restoring floating point registers, called by the compiler.  */
614
615.fres:
616FUNC_START(_restf14)	lfd	14,-144(1)	/* restore fp registers */
617FUNC_START(_restf15)	lfd	15,-136(1)
618FUNC_START(_restf16)	lfd	16,-128(1)
619FUNC_START(_restf17)	lfd	17,-120(1)
620FUNC_START(_restf18)	lfd	18,-112(1)
621FUNC_START(_restf19)	lfd	19,-104(1)
622FUNC_START(_restf20)	lfd	20,-96(1)
623FUNC_START(_restf21)	lfd	21,-88(1)
624FUNC_START(_restf22)	lfd	22,-80(1)
625FUNC_START(_restf23)	lfd	23,-72(1)
626FUNC_START(_restf24)	lfd	24,-64(1)
627FUNC_START(_restf25)	lfd	25,-56(1)
628FUNC_START(_restf26)	lfd	26,-48(1)
629FUNC_START(_restf27)	lfd	27,-40(1)
630FUNC_START(_restf28)	lfd	28,-32(1)
631FUNC_START(_restf29)	lfd	29,-24(1)
632FUNC_START(_restf30)	lfd	30,-16(1)
633FUNC_START(_restf31)	lfd	31,-8(1)
634			blr
635.LTfres:
636			.long 0
637			.byte 0,12,0,0,0,0,0,0
638			.long 0
639			.long .LTfres-.fres
640			.short 4
641			.ascii "fres"
642FUNC_END(_restf31)
643FUNC_END(_restf30)
644FUNC_END(_restf29)
645FUNC_END(_restf28)
646FUNC_END(_restf27)
647FUNC_END(_restf26)
648FUNC_END(_restf25)
649FUNC_END(_restf24)
650FUNC_END(_restf23)
651FUNC_END(_restf22)
652FUNC_END(_restf21)
653FUNC_END(_restf20)
654FUNC_END(_restf19)
655FUNC_END(_restf18)
656FUNC_END(_restf17)
657FUNC_END(_restf16)
658FUNC_END(_restf15)
659FUNC_END(_restf14)
660
661#endif
662