crt0.S revision 1.3 1 1.3 matt /* $NetBSD: crt0.S,v 1.3 2012/08/11 07:25:44 matt Exp $ */
2 1.1 joerg
3 1.3 matt /*-
4 1.3 matt * Copyright (c) 2012 The NetBSD Foundation, Inc.
5 1.1 joerg * All rights reserved.
6 1.1 joerg *
7 1.3 matt * This code is derived from software contributed to The NetBSD Foundation
8 1.3 matt * by Matt Thomas of 3am Software Foundry.
9 1.3 matt *
10 1.1 joerg * Redistribution and use in source and binary forms, with or without
11 1.1 joerg * modification, are permitted provided that the following conditions
12 1.1 joerg * are met:
13 1.1 joerg * 1. Redistributions of source code must retain the above copyright
14 1.1 joerg * notice, this list of conditions and the following disclaimer.
15 1.1 joerg * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 joerg * notice, this list of conditions and the following disclaimer in the
17 1.1 joerg * documentation and/or other materials provided with the distribution.
18 1.1 joerg *
19 1.3 matt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.3 matt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.3 matt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.3 matt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.3 matt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.3 matt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.3 matt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.3 matt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.3 matt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.3 matt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.3 matt * POSSIBILITY OF SUCH DAMAGE.
30 1.1 joerg */
31 1.1 joerg
32 1.3 matt #include <arm/asm.h>
33 1.3 matt
34 1.3 matt RCSID("$NetBSD: crt0.S,v 1.3 2012/08/11 07:25:44 matt Exp $")
35 1.1 joerg
36 1.1 joerg STRONG_ALIAS(_start,__start)
37 1.1 joerg
38 1.1 joerg _ENTRY(__start)
39 1.2 matt /*
40 1.2 matt * We need to swap ps_strings and cleanup
41 1.2 matt */
42 1.2 matt mov ip, r0 /* ps_strings -> tmp */
43 1.2 matt mov r0, r2 /* cleanup -> ps_strings */
44 1.2 matt mov r2, ip /* tmp -> ps_strings */
45 1.1 joerg
46 1.1 joerg /* Ensure the stack is properly aligned before calling C code. */
47 1.1 joerg bic sp, sp, #7
48 1.2 matt
49 1.2 matt /*
50 1.2 matt * void ___start(void (*cleanup)(void),
51 1.2 matt * const Obj_Entry *obj,
52 1.2 matt * struct ps_strings *ps_strings);
53 1.2 matt */
54 1.1 joerg
55 1.1 joerg b ___start
56