start.c revision 124139
1/* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */ 2/* 3 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 4 * Copyright (C) 1995, 1996 TooLs GmbH. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by TooLs GmbH. 18 * 4. The name of TooLs GmbH may not be used to endorse or promote products 19 * derived from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> 34__FBSDID("$FreeBSD: head/sys/boot/powerpc/ofw/start.c 124139 2004-01-04 23:21:18Z obrien $"); 35 36#include <stand.h> 37#include "libofw.h" 38 39void startup(void *, int, int (*)(void *), char *, int); 40 41#ifdef XCOFF_GLUE 42asm(" \n\ 43 .text \n\ 44 .globl _entry \n\ 45_entry: \n\ 46 .long _start,0,0 \n\ 47"); 48#endif 49 50__asm(" \n\ 51 .data \n\ 52stack: \n\ 53 .space 16388 \n\ 54 \n\ 55 .text \n\ 56 .globl _start \n\ 57_start: \n\ 58 li %r8,0 \n\ 59 li %r9,0x100 \n\ 60 mtctr %r9 \n\ 611: \n\ 62 dcbf %r0,%r8 \n\ 63 icbi %r0,%r8 \n\ 64 addi %r8,%r8,0x20 \n\ 65 bdnz 1b \n\ 66 sync \n\ 67 isync \n\ 68 \n\ 69 lis %r1,stack@ha \n\ 70 addi %r1,%r1,stack@l \n\ 71 addi %r1,%r1,8192 \n\ 72 \n\ 73 mfmsr %r8 \n\ 74 li %r0,0 \n\ 75 mtmsr %r0 \n\ 76 isync \n\ 77 \n\ 78 mtibatu 0,%r0 \n\ 79 mtibatu 1,%r0 \n\ 80 mtibatu 2,%r0 \n\ 81 mtibatu 3,%r0 \n\ 82 mtdbatu 0,%r0 \n\ 83 mtdbatu 1,%r0 \n\ 84 mtdbatu 2,%r0 \n\ 85 mtdbatu 3,%r0 \n\ 86 \n\ 87 li %r9,0x12 /* BATL(0, BAT_M, BAT_PP_RW) */ \n\ 88 mtibatl 0,%r9 \n\ 89 mtdbatl 0,%r9 \n\ 90 li %r9,0x1ffe /* BATU(0, BAT_BL_256M, BAT_Vs) */ \n\ 91 mtibatu 0,%r9 \n\ 92 mtdbatu 0,%r9 \n\ 93 isync \n\ 94 \n\ 95 mtmsr %r8 \n\ 96 isync \n\ 97 \n\ 98 b startup \n\ 99"); 100 101void 102startup(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl) 103{ 104 main(openfirm); 105} 106