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