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