NetBSD/sys/arch/mipsco/stand/common/start.S
wdk a3ec172607 Initial commit of a 2 stage bootloader for NetBSD/mipsco. Based on pmax
and alpha ports.

Uses PROM standalone I/O functions but due to the lack of a lseek function
it currently only works with version 5.40 of the firmware.  A more portable
solution is being worked on.

installboot utility requires several changes in order to correctly install
the bootstrap code - there is a "volume directory" which contains a list
of filenames, start sectors and length.  We need to add a "boot" entry of
the correct length starting at block 2.  The boot file has to be ecoff
which means we waste another 0.5k

Normally the Mips filesystem has a ~500k partition for this purpose but it
should be possible to squeeze it all into the first 7k "BSD Style" (1k is
required for 2 different copies of the partition table)

Only the bootxx_ffs first stage bootstrap has been tested via bootp() which
loads the second stage off disk and then boots the kernel.
2000-09-18 11:40:46 +00:00

68 lines
2.6 KiB
ArmAsm

/* $NetBSD: start.S,v 1.1 2000/09/18 11:40:48 wdk Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Wayne Knowles
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <mips/asm.h>
#include <mips/cpuregs.h>
#include <machine/prom.h>
.set noreorder
LEAF(start)
#ifdef __GP_SUPPORT__
la gp, _C_LABEL (_gp)
#endif
la sp, start - CALLFRAME_SIZ
sw zero, CALLFRAME_RA(sp) # clear ra for debugger
sw zero, CALLFRAME_SP(sp) # clear fp for debugger
move s0, a0 # save argc
move s1, a1 # save argv
la a0, _C_LABEL (edata) # clear BSS
move a1, zero
la a2, _C_LABEL (end)
jal _C_LABEL(memset) # memset(edata, 0, end - edata)
subu a2, a2, a0
move a0, s0 # restore argc
jal _C_LABEL(main) # main(argc, argv)
move a1, s1 # restore argv
XLEAF(_rtt)
j _C_LABEL(prom_restart) # restart...
nop
END(start)