1183651Sjhay/*-
2183651Sjhay * Copyright (c) 2008 John Hay.  All rights reserved.
3183651Sjhay *
4183651Sjhay * Redistribution and use in source and binary forms, with or without
5183651Sjhay * modification, are permitted provided that the following conditions
6183651Sjhay * are met:
7183651Sjhay * 1. Redistributions of source code must retain the above copyright
8183651Sjhay *    notice, this list of conditions and the following disclaimer.
9183651Sjhay * 2. Redistributions in binary form must reproduce the above copyright
10183651Sjhay *    notice, this list of conditions and the following disclaimer in the
11183651Sjhay *    documentation and/or other materials provided with the distribution.
12183651Sjhay *
13183651Sjhay * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14183651Sjhay * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15183651Sjhay * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16183651Sjhay * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17183651Sjhay * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18183651Sjhay * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19183651Sjhay * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20183651Sjhay * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21183651Sjhay * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22183651Sjhay * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23183651Sjhay *
24183651Sjhay * $FreeBSD: releng/10.2/sys/boot/arm/ixp425/boot2/arm_init.S 186352 2008-12-20 03:26:09Z sam $
25183651Sjhay */
26183651Sjhay
27186352Ssam#include <machine/asm.h>
28183651Sjhay
29186352SsamASENTRY_NP(start)
30183651Sjhay/* Initialise bss and sp */
31183651Sjhay	nop
32183651Sjhay	adr	r1, .Lstart
33183651Sjhay	ldmia	r1, {r1, r2, sp}	/* Set initial stack and */
34183651Sjhay	sub	r2, r2, r1		/* get zero init data */
35183651Sjhay	mov	r3, #0
36183651Sjhay.L1:
37183651Sjhay	str	r3, [r1], #0x0004	/* get zero init data */
38183651Sjhay	subs	r2, r2, #4
39183651Sjhay	bgt	.L1
40183651Sjhay
41183651Sjhay	.extern	main
42183651Sjhay	bl	main
43183651Sjhay/* main should not return.  If it does, spin forever		*/
44183651SjhayinfiniteLoop:
45183651Sjhay	b	infiniteLoop
46183651Sjhay
47183651Sjhay.Lstart:
48183651Sjhay	.word	_edata
49183651Sjhay	.word	_end
50183651Sjhay	.word	BOOT_STACK
51186352Ssam
52186352SsamENTRY(cpu_id)
53186352Ssam	mrc	p15, 0, r0, c0, c0, 0
54186352Ssam	RET
55186352Ssam
56183651Sjhay/* End */
57