190075Sobrien#   Copyright (C) 2001 Free Software Foundation, Inc.
290075Sobrien#   Written By Nick Clifton
390075Sobrien# 
490075Sobrien# This file is free software; you can redistribute it and/or modify it
590075Sobrien# under the terms of the GNU General Public License as published by the
690075Sobrien# Free Software Foundation; either version 2, or (at your option) any
790075Sobrien# later version.
890075Sobrien# 
990075Sobrien# In addition to the permissions in the GNU General Public License, the
1090075Sobrien# Free Software Foundation gives you unlimited permission to link the
1190075Sobrien# compiled version of this file with other programs, and to distribute
1290075Sobrien# those programs without any restriction coming from the use of this
1390075Sobrien# file.  (The General Public License restrictions do apply in other
1490075Sobrien# respects; for example, they cover modification of the file, and
1590075Sobrien# distribution when not linked into another program.)
1690075Sobrien# 
1790075Sobrien# This file is distributed in the hope that it will be useful, but
1890075Sobrien# WITHOUT ANY WARRANTY; without even the implied warranty of
1990075Sobrien# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2090075Sobrien# General Public License for more details.
2190075Sobrien# 
2290075Sobrien# You should have received a copy of the GNU General Public License
2390075Sobrien# along with this program; see the file COPYING.  If not, write to
24169689Skan# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
25169689Skan# Boston, MA 02110-1301, USA.
2690075Sobrien# 
2790075Sobrien#    As a special exception, if you link this library with files
2890075Sobrien#    compiled with GCC to produce an executable, this does not cause
2990075Sobrien#    the resulting executable to be covered by the GNU General Public License.
3090075Sobrien#    This exception does not however invalidate any other reasons why
3190075Sobrien#    the executable file might be covered by the GNU General Public License.
3290075Sobrien# 
3390075Sobrien
3490075Sobrien# This file just make a stack frame for the contents of the .fini and
3590075Sobrien# .init sections.  Users may put any desired instructions in those
3690075Sobrien# sections.
3790075Sobrien
38169689Skan#ifdef __ELF__
39169689Skan#define TYPE(x) .type x,function
40169689Skan#else
41169689Skan#define TYPE(x)
42169689Skan#endif
43169689Skan
44117395Skan	# Note - this macro is complemented by the FUNC_END macro
4590075Sobrien	# in crtn.asm.  If you change this macro you must also change
4690075Sobrien	# that macro match.
4790075Sobrien.macro FUNC_START
4890075Sobrien#ifdef __thumb__
4990075Sobrien	.thumb
5090075Sobrien	
51169689Skan	push	{r3, r4, r5, r6, r7, lr}
5290075Sobrien#else
5390075Sobrien	.arm
5490075Sobrien	#  Create a stack frame and save any call-preserved registers
5590075Sobrien	mov	ip, sp
56169689Skan	stmdb	sp!, {r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
5790075Sobrien	sub	fp, ip, #4
5890075Sobrien#endif
5990075Sobrien.endm
6090075Sobrien		
6190075Sobrien	.file		"crti.asm"
6290075Sobrien
6390075Sobrien	.section	".init"
6490075Sobrien	.align 2
6590075Sobrien	.global	_init
6690075Sobrien#ifdef __thumb__
6790075Sobrien	.thumb_func
6890075Sobrien#endif
69169689Skan	TYPE(_init)
7090075Sobrien_init:
7190075Sobrien	FUNC_START
7290075Sobrien	
7390075Sobrien		
7490075Sobrien	.section	".fini"
7590075Sobrien	.align	2
7690075Sobrien	.global	_fini
7790075Sobrien#ifdef __thumb__
7890075Sobrien	.thumb_func
7990075Sobrien#endif
80169689Skan	TYPE(_fini)
8190075Sobrien_fini:
8290075Sobrien	FUNC_START
8390075Sobrien	
8490075Sobrien# end of crti.asm
85