1*7acd15a3Sjoerg/* $NetBSD: crt0.S,v 1.4 2018/11/26 17:37:44 joerg Exp $ */ 2a192bc67Smatt 3a192bc67Smatt/*- 4a192bc67Smatt * Copyright (c) 2012 The NetBSD Foundation, Inc. 5a192bc67Smatt * All rights reserved. 6a192bc67Smatt * 7a192bc67Smatt * This code is derived from software contributed to The NetBSD Foundation 8a192bc67Smatt * by Matt Thomas of 3am Software Foundry. 9a192bc67Smatt * 10a192bc67Smatt * Redistribution and use in source and binary forms, with or without 11a192bc67Smatt * modification, are permitted provided that the following conditions 12a192bc67Smatt * are met: 13a192bc67Smatt * 1. Redistributions of source code must retain the above copyright 14a192bc67Smatt * notice, this list of conditions and the following disclaimer. 15a192bc67Smatt * 2. Redistributions in binary form must reproduce the above copyright 16a192bc67Smatt * notice, this list of conditions and the following disclaimer in the 17a192bc67Smatt * documentation and/or other materials provided with the distribution. 18a192bc67Smatt * 19a192bc67Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20a192bc67Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21a192bc67Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22a192bc67Smatt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23a192bc67Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24a192bc67Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25a192bc67Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26a192bc67Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27a192bc67Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28a192bc67Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29a192bc67Smatt * POSSIBILITY OF SUCH DAMAGE. 30a192bc67Smatt */ 31a192bc67Smatt 32a192bc67Smatt#include <arm/asm.h> 33a192bc67Smatt 34*7acd15a3SjoergRCSID("$NetBSD: crt0.S,v 1.4 2018/11/26 17:37:44 joerg Exp $") 35a192bc67Smatt 36a192bc67SmattSTRONG_ALIAS(_start,__start) 37a192bc67Smatt 38a192bc67Smatt_ENTRY(__start) 39a192bc67Smatt /* 40*7acd15a3Sjoerg * ps_strings is passed in r0 and cleanup in r2. 41*7acd15a3Sjoerg * It should be ps_string in r1 and cleanup in r0. 42a192bc67Smatt */ 43*7acd15a3Sjoerg mov r1, r0 44*7acd15a3Sjoerg mov r0, r2 45a192bc67Smatt 46a192bc67Smatt /* Ensure the stack is properly aligned before calling C code. */ 470e348f11Smatt#if !defined(__thumb__) 48a192bc67Smatt bic sp, sp, #7 4970dd985cSmatt#else 5070dd985cSmatt movs r6, #7 5170dd985cSmatt mov r7, sp 5270dd985cSmatt bics r7, r7, r6 5370dd985cSmatt mov sp, r7 5470dd985cSmatt#endif 55a192bc67Smatt 56a192bc67Smatt /* 57a192bc67Smatt * void ___start(void (*cleanup)(void), 58a192bc67Smatt * struct ps_strings *ps_strings); 59a192bc67Smatt */ 60a192bc67Smatt 61a192bc67Smatt b ___start 62