xref: /original-bsd/sys/pmax/stand/start.s (revision d9657196)
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.7 (Berkeley) 04/05/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	la	sp, start - START_FRAME
42	sw	zero, START_FRAME - 4(sp)	# Zero out old ra for debugger
43	sw	zero, START_FRAME - 8(sp)	# Zero out old fp for debugger
44	move	s0, a0				# save argc
45	move	s1, a1				# save argv
46	beq	a3, 0x30464354, 1f		# jump if boot from DS5000
47	move	s3, a3				# save call vector
48	la	s3, callvec			# init call vector
491:
50	la	a0, edata			# clear BSS
51	la	a1, end
52	jal	bzero				# bzero(edata, end - edata)
53	subu	a1, a1, a0
54	sw	s3, callv			# save call vector
55	move	a0, s0				# restore argc
56	jal	main				# main(argc, argv)
57	move	a1, s1				# restore argv
58	li	v0, DEC_PROM_RESTART		# done, so call prom
59	j	v0
60	nop
61
62/* dummy routine for gcc2 */
63	.globl	__main
64__main:
65	j	ra
66	nop
67
68LEAF(prom_restart)
69	li	v0, DEC_PROM_RESTART
70	j	v0
71	nop
72END(prom_restart)
73
74LEAF(prom_open)
75	li	v0, DEC_PROM_OPEN
76	j	v0
77	nop
78END(prom_open)
79
80LEAF(prom_lseek)
81	li	v0, DEC_PROM_LSEEK
82	j	v0
83	nop
84END(prom_lseek)
85
86LEAF(prom_read)
87	li	v0, DEC_PROM_READ
88	j	v0
89	nop
90END(prom_read)
91
92LEAF(printf)
93	lw	v0, callv	# get pointer to call back vectors
94	sw	a1, 4(sp)	# store args on stack for printf
95	lw	v0, 48(v0)	# offset for callv->printf
96	sw	a2, 8(sp)
97	j	v0		# call PROM printf
98	sw	a3, 12(sp)
99END(printf)
100