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