1 1.23 tsutsui /* $NetBSD: start.S,v 1.23 2011/03/26 15:49:26 tsutsui Exp $ */ 2 1.11 simonb 3 1.11 simonb /*- 4 1.11 simonb * Copyright (c) 1999 The NetBSD Foundation, Inc. 5 1.11 simonb * All rights reserved. 6 1.11 simonb * 7 1.11 simonb * This code is derived from software contributed to The NetBSD Foundation 8 1.11 simonb * by Jonathan Stone, Michael Hitch and Simon Burge. 9 1.11 simonb * 10 1.11 simonb * Redistribution and use in source and binary forms, with or without 11 1.11 simonb * modification, are permitted provided that the following conditions 12 1.11 simonb * are met: 13 1.11 simonb * 1. Redistributions of source code must retain the above copyright 14 1.11 simonb * notice, this list of conditions and the following disclaimer. 15 1.11 simonb * 2. Redistributions in binary form must reproduce the above copyright 16 1.11 simonb * notice, this list of conditions and the following disclaimer in the 17 1.11 simonb * documentation and/or other materials provided with the distribution. 18 1.11 simonb * 19 1.11 simonb * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 1.11 simonb * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.11 simonb * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.11 simonb * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 1.11 simonb * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.11 simonb * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.11 simonb * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.11 simonb * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.11 simonb * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.11 simonb * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.11 simonb * POSSIBILITY OF SUCH DAMAGE. 30 1.11 simonb */ 31 1.1 mellon 32 1.1 mellon /* 33 1.1 mellon * Copyright (c) 1992, 1993 34 1.1 mellon * The Regents of the University of California. All rights reserved. 35 1.1 mellon * 36 1.1 mellon * This code is derived from software contributed to Berkeley by 37 1.1 mellon * Ralph Campbell. 38 1.1 mellon * 39 1.1 mellon * Redistribution and use in source and binary forms, with or without 40 1.1 mellon * modification, are permitted provided that the following conditions 41 1.1 mellon * are met: 42 1.1 mellon * 1. Redistributions of source code must retain the above copyright 43 1.1 mellon * notice, this list of conditions and the following disclaimer. 44 1.1 mellon * 2. Redistributions in binary form must reproduce the above copyright 45 1.1 mellon * notice, this list of conditions and the following disclaimer in the 46 1.1 mellon * documentation and/or other materials provided with the distribution. 47 1.17 agc * 3. Neither the name of the University nor the names of its contributors 48 1.1 mellon * may be used to endorse or promote products derived from this software 49 1.1 mellon * without specific prior written permission. 50 1.1 mellon * 51 1.1 mellon * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 52 1.1 mellon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 1.1 mellon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 54 1.1 mellon * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 55 1.1 mellon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 56 1.1 mellon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 57 1.1 mellon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 58 1.1 mellon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 59 1.1 mellon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 60 1.1 mellon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 61 1.1 mellon * SUCH DAMAGE. 62 1.1 mellon * 63 1.1 mellon * @(#)start.s 8.2 (Berkeley) 1/21/94 64 1.1 mellon */ 65 1.1 mellon 66 1.1 mellon /* 67 1.1 mellon * start.s - 68 1.1 mellon * 69 1.1 mellon * Contains code that is the first executed at boot time. 70 1.1 mellon * 71 1.1 mellon * Copyright (C) 1989 Digital Equipment Corporation. 72 1.1 mellon * Permission to use, copy, modify, and distribute this software and 73 1.1 mellon * its documentation for any purpose and without fee is hereby granted, 74 1.1 mellon * provided that the above copyright notice appears in all copies. 75 1.1 mellon * Digital Equipment Corporation makes no representations about the 76 1.1 mellon * suitability of this software for any purpose. It is provided "as is" 77 1.1 mellon * without express or implied warranty. 78 1.1 mellon * 79 1.1 mellon * from: Header: /sprite/src/boot/decprom/ds3100.md/RCS/start.s, 80 1.1 mellon * v 1.1 90/02/16 16:19:39 shirriff Exp SPRITE (DECWRL) 81 1.1 mellon */ 82 1.1 mellon 83 1.2 jonathan #include <mips/asm.h> 84 1.2 jonathan #include <mips/cpuregs.h> 85 1.5 simonb #include <machine/dec_prom.h> 86 1.1 mellon 87 1.12 simonb .extern callv, 4 88 1.14 simonb 89 1.1 mellon .globl start 90 1.1 mellon start: 91 1.1 mellon .set noreorder 92 1.1 mellon #ifdef __GP_SUPPORT__ 93 1.1 mellon la gp, _C_LABEL (_gp) 94 1.1 mellon #endif 95 1.14 simonb la sp, start - CALLFRAME_SIZ 96 1.14 simonb sw zero, CALLFRAME_RA(sp) # Zero out old ra for debugger 97 1.14 simonb sw zero, CALLFRAME_SP(sp) # Zero out old fp for debugger 98 1.1 mellon move s0, a0 # save argc 99 1.1 mellon move s1, a1 # save argv 100 1.6 simonb beq a2, DEC_REX_MAGIC, 1f # jump if boot from DS5000 101 1.21 tsutsui move s3, a3 # BDslot: save call vector 102 1.1 mellon la s3, _C_LABEL(callvec) # init call vector 103 1.1 mellon 1: 104 1.7 simonb la a0, _C_LABEL (edata) # clear BSS 105 1.7 simonb move a1, zero 106 1.7 simonb la a2, _C_LABEL (end) 107 1.7 simonb jal _C_LABEL(memset) # memset(edata, 0, end - edata) 108 1.21 tsutsui subu a2, a2, a0 109 1.1 mellon sw s3, _C_LABEL(callv) # save call vector 110 1.1 mellon move a0, s0 # restore argc 111 1.9 simonb jal _C_LABEL(main) # main(argc, argv) 112 1.21 tsutsui move a1, s1 # restore argv 113 1.1 mellon j _C_LABEL(prom_restart) # restart... 114 1.21 tsutsui nop 115 1.1 mellon 116 1.23 tsutsui .set reorder # make as(1) handle hazard and BDslot 117 1.1 mellon LEAF(prom_restart) 118 1.16 simonb XLEAF(_rtt) 119 1.1 mellon lw v0, _C_LABEL (callv) 120 1.1 mellon lw v0, 0x9C(v0) /* halt */ 121 1.1 mellon move a0, zero /* Don't print anything. */ 122 1.23 tsutsui move a1, zero 123 1.1 mellon j v0 124 1.1 mellon END(prom_restart) 125 1.1 mellon 126 1.1 mellon LEAF(prom_open) 127 1.1 mellon li v0, DEC_PROM_OPEN 128 1.1 mellon j v0 129 1.1 mellon END(prom_open) 130 1.13 simonb 131 1.13 simonb #ifndef LIBSA_NO_DEV_CLOSE 132 1.13 simonb LEAF(prom_close) 133 1.13 simonb li v0, DEC_PROM_CLOSE 134 1.13 simonb j v0 135 1.13 simonb END(prom_close) 136 1.13 simonb #endif 137 1.1 mellon 138 1.1 mellon LEAF(prom_lseek) 139 1.1 mellon li v0, DEC_PROM_LSEEK 140 1.1 mellon j v0 141 1.1 mellon END(prom_lseek) 142 1.1 mellon 143 1.1 mellon LEAF(prom_read) 144 1.1 mellon li v0, DEC_PROM_READ 145 1.16 simonb j v0 146 1.16 simonb END(prom_read) 147 1.16 simonb 148 1.16 simonb LEAF(prom_write) 149 1.16 simonb li v0, DEC_PROM_WRITE 150 1.1 mellon j v0 151 1.19 simonb END(prom_write) 152