Home | History | Annotate | Line # | Download | only in arm
      1  1.4  joerg /*	$NetBSD: crt0.S,v 1.4 2018/11/26 17:37:44 joerg 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.4  joerg RCSID("$NetBSD: crt0.S,v 1.4 2018/11/26 17:37:44 joerg 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.4  joerg 	 * ps_strings is passed in r0 and cleanup in r2.
     41  1.4  joerg 	 * It should be ps_string in r1 and cleanup in r0.
     42  1.2   matt  	 */
     43  1.4  joerg 	mov	r1, r0
     44  1.4  joerg 	mov	r0, r2
     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 	 *    struct ps_strings *ps_strings);
     52  1.2   matt 	 */
     53  1.1  joerg 
     54  1.1  joerg 	b	___start
     55