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: crtn.S,v 1.2 2014/02/27 16:47:48 matt Exp $") 33f14fb602SLionel Sambuc 34f14fb602SLionel Sambuc .section ".init", "ax", @progbits 35*0a6a1f1dSLionel Sambuc#ifdef _LP64 36*0a6a1f1dSLionel Sambuc ldreg %r0, (2*SZREG)(%r1) 37*0a6a1f1dSLionel Sambuc addi %r1, %r1, (6*SZREG) 38*0a6a1f1dSLionel Sambuc#else 39f14fb602SLionel Sambuc addi %r1, %r1, (4*SZREG) 40f14fb602SLionel Sambuc lwz %r0, (1*SZREG)(%r1) 41*0a6a1f1dSLionel Sambuc#endif 42f14fb602SLionel Sambuc mtlr %r0 43f14fb602SLionel Sambuc blr 44f14fb602SLionel Sambuc 45f14fb602SLionel Sambuc .section ".fini", "ax", @progbits 46*0a6a1f1dSLionel Sambuc#ifdef _LP64 47*0a6a1f1dSLionel Sambuc ldreg %r0, (2*SZREG)(%r1) 48*0a6a1f1dSLionel Sambuc addi %r1, %r1, (6*SZREG) 49*0a6a1f1dSLionel Sambuc#else 50f14fb602SLionel Sambuc addi %r1, %r1, (4*SZREG) 51f14fb602SLionel Sambuc lwz %r0, (1*SZREG)(%r1) 52*0a6a1f1dSLionel Sambuc#endif 53f14fb602SLionel Sambuc mtlr %r0 54f14fb602SLionel Sambuc blr 55