xref: /netbsd-src/lib/csu/arch/arm/crt0.S (revision 463db15fc5682db56ff220ac07095d19ef907554)
1*463db15fSjoerg/*	$NetBSD: crt0.S,v 1.4 2018/11/26 17:37:44 joerg Exp $	*/
201bc9d50Sjoerg
37f3cb3d1Smatt/*-
47f3cb3d1Smatt * Copyright (c) 2012 The NetBSD Foundation, Inc.
501bc9d50Sjoerg * All rights reserved.
601bc9d50Sjoerg *
77f3cb3d1Smatt * This code is derived from software contributed to The NetBSD Foundation
87f3cb3d1Smatt * by Matt Thomas of 3am Software Foundry.
97f3cb3d1Smatt *
1001bc9d50Sjoerg * Redistribution and use in source and binary forms, with or without
1101bc9d50Sjoerg * modification, are permitted provided that the following conditions
1201bc9d50Sjoerg * are met:
1301bc9d50Sjoerg * 1. Redistributions of source code must retain the above copyright
1401bc9d50Sjoerg *    notice, this list of conditions and the following disclaimer.
1501bc9d50Sjoerg * 2. Redistributions in binary form must reproduce the above copyright
1601bc9d50Sjoerg *    notice, this list of conditions and the following disclaimer in the
1701bc9d50Sjoerg *    documentation and/or other materials provided with the distribution.
1801bc9d50Sjoerg *
197f3cb3d1Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
207f3cb3d1Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
217f3cb3d1Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
227f3cb3d1Smatt * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
237f3cb3d1Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
247f3cb3d1Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
257f3cb3d1Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
267f3cb3d1Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
277f3cb3d1Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
287f3cb3d1Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
297f3cb3d1Smatt * POSSIBILITY OF SUCH DAMAGE.
3001bc9d50Sjoerg */
3101bc9d50Sjoerg
327f3cb3d1Smatt#include <arm/asm.h>
337f3cb3d1Smatt
34*463db15fSjoergRCSID("$NetBSD: crt0.S,v 1.4 2018/11/26 17:37:44 joerg Exp $")
3501bc9d50Sjoerg
3601bc9d50SjoergSTRONG_ALIAS(_start,__start)
3701bc9d50Sjoerg
3801bc9d50Sjoerg_ENTRY(__start)
39c135af1cSmatt	/*
40*463db15fSjoerg	 * ps_strings is passed in r0 and cleanup in r2.
41*463db15fSjoerg	 * It should be ps_string in r1 and cleanup in r0.
42c135af1cSmatt 	 */
43*463db15fSjoerg	mov	r1, r0
44*463db15fSjoerg	mov	r0, r2
4501bc9d50Sjoerg
4601bc9d50Sjoerg	/* Ensure the stack is properly aligned before calling C code. */
4701bc9d50Sjoerg	bic	sp, sp, #7
48c135af1cSmatt
49c135af1cSmatt	/*
50c135af1cSmatt	 * void ___start(void (*cleanup)(void),
51c135af1cSmatt	 *    struct ps_strings *ps_strings);
52c135af1cSmatt	 */
5301bc9d50Sjoerg
5401bc9d50Sjoerg	b	___start
55