1*ca987d46SWarner Losh /* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */ 2*ca987d46SWarner Losh /*- 3*ca987d46SWarner Losh * Copyright (C) 1995, 1996 Wolfgang Solfrank. 4*ca987d46SWarner Losh * Copyright (C) 1995, 1996 TooLs GmbH. 5*ca987d46SWarner Losh * All rights reserved. 6*ca987d46SWarner Losh * 7*ca987d46SWarner Losh * Redistribution and use in source and binary forms, with or without 8*ca987d46SWarner Losh * modification, are permitted provided that the following conditions 9*ca987d46SWarner Losh * are met: 10*ca987d46SWarner Losh * 1. Redistributions of source code must retain the above copyright 11*ca987d46SWarner Losh * notice, this list of conditions and the following disclaimer. 12*ca987d46SWarner Losh * 2. Redistributions in binary form must reproduce the above copyright 13*ca987d46SWarner Losh * notice, this list of conditions and the following disclaimer in the 14*ca987d46SWarner Losh * documentation and/or other materials provided with the distribution. 15*ca987d46SWarner Losh * 3. All advertising materials mentioning features or use of this software 16*ca987d46SWarner Losh * must display the following acknowledgement: 17*ca987d46SWarner Losh * This product includes software developed by TooLs GmbH. 18*ca987d46SWarner Losh * 4. The name of TooLs GmbH may not be used to endorse or promote products 19*ca987d46SWarner Losh * derived from this software without specific prior written permission. 20*ca987d46SWarner Losh * 21*ca987d46SWarner Losh * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 22*ca987d46SWarner Losh * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23*ca987d46SWarner Losh * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24*ca987d46SWarner Losh * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25*ca987d46SWarner Losh * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26*ca987d46SWarner Losh * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27*ca987d46SWarner Losh * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28*ca987d46SWarner Losh * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29*ca987d46SWarner Losh * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 30*ca987d46SWarner Losh * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31*ca987d46SWarner Losh */ 32*ca987d46SWarner Losh 33*ca987d46SWarner Losh #include <sys/cdefs.h> 34*ca987d46SWarner Losh __FBSDID("$FreeBSD$"); 35*ca987d46SWarner Losh 36*ca987d46SWarner Losh #include <stand.h> 37*ca987d46SWarner Losh #include "libofw.h" 38*ca987d46SWarner Losh 39*ca987d46SWarner Losh void startup(void *, int, int (*)(void *), char *, int); 40*ca987d46SWarner Losh 41*ca987d46SWarner Losh __asm(" \n\ 42*ca987d46SWarner Losh .data \n\ 43*ca987d46SWarner Losh .align 4 \n\ 44*ca987d46SWarner Losh stack: \n\ 45*ca987d46SWarner Losh .space 16388 \n\ 46*ca987d46SWarner Losh \n\ 47*ca987d46SWarner Losh .text \n\ 48*ca987d46SWarner Losh .globl _start \n\ 49*ca987d46SWarner Losh _start: \n\ 50*ca987d46SWarner Losh lis %r1,stack@ha \n\ 51*ca987d46SWarner Losh addi %r1,%r1,stack@l \n\ 52*ca987d46SWarner Losh addi %r1,%r1,8192 \n\ 53*ca987d46SWarner Losh \n\ 54*ca987d46SWarner Losh /* Clear the .bss!!! */ \n\ 55*ca987d46SWarner Losh li %r0,0 \n\ 56*ca987d46SWarner Losh lis %r8,_edata@ha \n\ 57*ca987d46SWarner Losh addi %r8,%r8,_edata@l\n\ 58*ca987d46SWarner Losh lis %r9,_end@ha \n\ 59*ca987d46SWarner Losh addi %r9,%r9,_end@l \n\ 60*ca987d46SWarner Losh \n\ 61*ca987d46SWarner Losh 1: cmpw 0,%r8,%r9 \n\ 62*ca987d46SWarner Losh bge 2f \n\ 63*ca987d46SWarner Losh stw %r0,0(%r8) \n\ 64*ca987d46SWarner Losh addi %r8,%r8,4 \n\ 65*ca987d46SWarner Losh b 1b \n\ 66*ca987d46SWarner Losh \n\ 67*ca987d46SWarner Losh 2: b startup \n\ 68*ca987d46SWarner Losh "); 69*ca987d46SWarner Losh 70*ca987d46SWarner Losh void 71*ca987d46SWarner Losh startup(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl) 72*ca987d46SWarner Losh { 73*ca987d46SWarner Losh main(openfirm); 74*ca987d46SWarner Losh } 75