1f14fb602SLionel Sambuc/*- 2f14fb602SLionel Sambuc * Copyright (c) 2011 The NetBSD Foundation, Inc. 3f14fb602SLionel Sambuc * All rights reserved. 4f14fb602SLionel Sambuc * 5f14fb602SLionel Sambuc * This code is derived from software contributed to The NetBSD Foundation 6f14fb602SLionel Sambuc * by Matt Thomas of 3am Software Foundry. 7f14fb602SLionel Sambuc * 8f14fb602SLionel Sambuc * Redistribution and use in source and binary forms, with or without 9f14fb602SLionel Sambuc * modification, are permitted provided that the following conditions 10f14fb602SLionel Sambuc * are met: 11f14fb602SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 12f14fb602SLionel Sambuc * notice, this list of conditions and the following disclaimer. 13f14fb602SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 14f14fb602SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 15f14fb602SLionel Sambuc * documentation and/or other materials provided with the distribution. 16f14fb602SLionel Sambuc * 17f14fb602SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18f14fb602SLionel Sambuc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19f14fb602SLionel Sambuc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20f14fb602SLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21f14fb602SLionel Sambuc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22f14fb602SLionel Sambuc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23f14fb602SLionel Sambuc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24f14fb602SLionel Sambuc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25f14fb602SLionel Sambuc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26f14fb602SLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27f14fb602SLionel Sambuc * POSSIBILITY OF SUCH DAMAGE. 28f14fb602SLionel Sambuc */ 29f14fb602SLionel Sambuc 30f14fb602SLionel Sambuc#include <powerpc/asm.h> 31f14fb602SLionel Sambuc 32*0a6a1f1dSLionel SambucRCSID("$NetBSD: crt0.S,v 1.6 2014/02/27 18:01:51 matt Exp $") 33f14fb602SLionel Sambuc 34f14fb602SLionel SambucSTRONG_ALIAS(_start,__start) 35f14fb602SLionel Sambuc 36f14fb602SLionel Sambuc .hidden ___start 37f14fb602SLionel Sambuc 38*0a6a1f1dSLionel Sambuc#ifndef _LP64 39f14fb602SLionel Sambuc .weak _SDA_BASE_ 40*0a6a1f1dSLionel Sambuc#endif 41f14fb602SLionel Sambuc 42f14fb602SLionel SambucENTRY_NOPROFILE(__start) 43*0a6a1f1dSLionel Sambuc#ifndef _LP64 44f14fb602SLionel Sambuc bcl 20,31,1f 45f14fb602SLionel Sambuc1: 46f14fb602SLionel Sambuc mflr %r11 47f14fb602SLionel Sambuc /* SVR4 ABI says small data is in r13 */ 48f14fb602SLionel Sambuc addis %r13,%r11,_SDA_BASE_-1b@ha 49f14fb602SLionel Sambuc addi %r13,%r13,_SDA_BASE_-1b@l 50*0a6a1f1dSLionel Sambuc#endif 51f14fb602SLionel Sambuc 52f14fb602SLionel Sambuc mr %r3,%r7 /* cleanup */ 53f14fb602SLionel Sambuc mr %r4,%r6 /* obj */ 54f14fb602SLionel Sambuc mr %r5,%r8 /* ps_strings */ 55f14fb602SLionel Sambuc 56*0a6a1f1dSLionel Sambuc CALL(___start) 57f14fb602SLionel SambucEND(__start) 58