xref: /original-bsd/sys/pmax/stand/start.s (revision 5f97f134)
1/*
2 * Copyright (c) 1992 Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Ralph Campbell.
7 *
8 * %sccs.include.redist.c%
9 *
10 *	@(#)start.s	7.5 (Berkeley) 02/15/93
11 *
12 * start.s -
13 *
14 *     Contains code that is the first executed at boot time.
15 *
16 *	Copyright (C) 1989 Digital Equipment Corporation.
17 *	Permission to use, copy, modify, and distribute this software and
18 *	its documentation for any purpose and without fee is hereby granted,
19 *	provided that the above copyright notice appears in all copies.
20 *	Digital Equipment Corporation makes no representations about the
21 *	suitability of this software for any purpose.  It is provided "as is"
22 *	without express or implied warranty.
23 *
24 * from: $Header: /sprite/src/boot/decprom/ds3100.md/RCS/start.s,
25 *	v 1.1 90/02/16 16:19:39 shirriff Exp $ SPRITE (DECWRL)
26 */
27
28#include <machine/regdef.h>
29#include <machine/machConst.h>
30#include <machine/machAsmDefs.h>
31#include <pmax/stand/dec_prom.h>
32
33/*
34 * Amount to take off of the stack for the benefit of the debugger.
35 */
36#define START_FRAME	((4 * 4) + 4 + 4)
37
38	.globl	start
39start:
40	.set	noreorder
41	li	v0, MACH_SR_BOOT_EXC_VEC
42	mtc0	v0, MACH_COP_0_STATUS_REG	# Disable interrupts
43	la	sp, start - START_FRAME
44	sw	zero, START_FRAME - 4(sp)	# Zero out old ra for debugger
45	sw	zero, START_FRAME - 8(sp)	# Zero out old fp for debugger
46#ifdef DS3100
47	la	a3, callvec			# init call vector
48#endif
49	sw	a3, callv			# save call vector
50	move	s0, a0				# save argc
51	move	s1, a1				# save argv
52	la	a0, edata			# clear BSS
53	la	a1, end
54	jal	bzero				# bzero(edata, end - edata)
55	subu	a1, a1, a0
56	move	a0, s0				# restore argc
57	jal	main				# main(argc, argv)
58	move	a1, s1				# restore argv
59	li	v0, DEC_PROM_RESTART		# done, so call prom
60	j	v0
61	nop
62
63/* dummy routine for gcc2 */
64	.globl	__main
65__main:
66	j	ra
67	nop
68
69LEAF(prom_restart)
70	li	v0, DEC_PROM_RESTART
71	j	v0
72	nop
73END(prom_restart)
74
75LEAF(prom_open)
76	li	v0, DEC_PROM_OPEN
77	j	v0
78	nop
79END(prom_open)
80
81LEAF(prom_lseek)
82	li	v0, DEC_PROM_LSEEK
83	j	v0
84	nop
85END(prom_lseek)
86
87LEAF(prom_read)
88	li	v0, DEC_PROM_READ
89	j	v0
90	nop
91END(prom_read)
92
93LEAF(printf)
94	lw	v0, callv	# get pointer to call back vectors
95	sw	a1, 4(sp)	# store args on stack for printf
96	lw	v0, 48(v0)	# offset for callv->printf
97	sw	a2, 8(sp)
98	j	v0		# call PROM printf
99	sw	a3, 12(sp)
100END(printf)
101