168548Sbenno/* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */ 2139738Simp/*- 368548Sbenno * Copyright (C) 1995, 1996 Wolfgang Solfrank. 468548Sbenno * Copyright (C) 1995, 1996 TooLs GmbH. 568548Sbenno * All rights reserved. 668548Sbenno * 768548Sbenno * Redistribution and use in source and binary forms, with or without 868548Sbenno * modification, are permitted provided that the following conditions 968548Sbenno * are met: 1068548Sbenno * 1. Redistributions of source code must retain the above copyright 1168548Sbenno * notice, this list of conditions and the following disclaimer. 1268548Sbenno * 2. Redistributions in binary form must reproduce the above copyright 1368548Sbenno * notice, this list of conditions and the following disclaimer in the 1468548Sbenno * documentation and/or other materials provided with the distribution. 1568548Sbenno * 3. All advertising materials mentioning features or use of this software 1668548Sbenno * must display the following acknowledgement: 1768548Sbenno * This product includes software developed by TooLs GmbH. 1868548Sbenno * 4. The name of TooLs GmbH may not be used to endorse or promote products 1968548Sbenno * derived from this software without specific prior written permission. 2068548Sbenno * 2168548Sbenno * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 2268548Sbenno * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2368548Sbenno * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2468548Sbenno * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2568548Sbenno * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2668548Sbenno * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 2768548Sbenno * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2868548Sbenno * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 2968548Sbenno * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 3068548Sbenno * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3168548Sbenno */ 3268548Sbenno 33124139Sobrien#include <sys/cdefs.h> 34124139Sobrien__FBSDID("$FreeBSD: stable/11/stand/powerpc/ofw/start.c 329175 2018-02-12 17:44:35Z kevans $"); 35124139Sobrien 3668548Sbenno#include <stand.h> 3768548Sbenno#include "libofw.h" 3868548Sbenno 3968548Sbennovoid startup(void *, int, int (*)(void *), char *, int); 4068548Sbenno 41118485Sgrehan__asm(" \n\ 42118485Sgrehan .data \n\ 43218822Sdim .align 4 \n\ 44118485Sgrehanstack: \n\ 45118485Sgrehan .space 16388 \n\ 46118485Sgrehan \n\ 47118485Sgrehan .text \n\ 48118485Sgrehan .globl _start \n\ 49118485Sgrehan_start: \n\ 50118485Sgrehan lis %r1,stack@ha \n\ 51118485Sgrehan addi %r1,%r1,stack@l \n\ 52215441Sandreast addi %r1,%r1,8192 \n\ 53118485Sgrehan \n\ 54215436Sandreast /* Clear the .bss!!! */ \n\ 55215436Sandreast li %r0,0 \n\ 56215436Sandreast lis %r8,_edata@ha \n\ 57215436Sandreast addi %r8,%r8,_edata@l\n\ 58215436Sandreast lis %r9,_end@ha \n\ 59215436Sandreast addi %r9,%r9,_end@l \n\ 60215436Sandreast \n\ 61215436Sandreast1: cmpw 0,%r8,%r9 \n\ 62215436Sandreast bge 2f \n\ 63215436Sandreast stw %r0,0(%r8) \n\ 64215436Sandreast addi %r8,%r8,4 \n\ 65215436Sandreast b 1b \n\ 66215436Sandreast \n\ 67215436Sandreast2: b startup \n\ 6868548Sbenno"); 6968548Sbenno 70329175Skevansvoid main(int (*openfirm)(void *)); 71329175Skevans 7268548Sbennovoid 7368548Sbennostartup(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl) 7468548Sbenno{ 7568548Sbenno main(openfirm); 7668548Sbenno} 77