xref: /csrg-svn/sys/pmax/stand/start.s (revision 65812)
152132Smckusick/*
263227Sbostic * Copyright (c) 1992, 1993
3*65812Sbostic *	The Regents of the University of California.  All rights reserved.
452132Smckusick *
552132Smckusick * This code is derived from software contributed to Berkeley by
652132Smckusick * Ralph Campbell.
752132Smckusick *
852132Smckusick * %sccs.include.redist.c%
952132Smckusick *
10*65812Sbostic *	@(#)start.s	8.2 (Berkeley) 01/21/94
1163227Sbostic */
1263227Sbostic
1363227Sbostic/*
1452132Smckusick * start.s -
1552132Smckusick *
1652132Smckusick *     Contains code that is the first executed at boot time.
1752132Smckusick *
1852132Smckusick *	Copyright (C) 1989 Digital Equipment Corporation.
1952132Smckusick *	Permission to use, copy, modify, and distribute this software and
2052132Smckusick *	its documentation for any purpose and without fee is hereby granted,
2152132Smckusick *	provided that the above copyright notice appears in all copies.
2252132Smckusick *	Digital Equipment Corporation makes no representations about the
2352132Smckusick *	suitability of this software for any purpose.  It is provided "as is"
2452132Smckusick *	without express or implied warranty.
2552132Smckusick *
2652132Smckusick * from: $Header: /sprite/src/boot/decprom/ds3100.md/RCS/start.s,
2752132Smckusick *	v 1.1 90/02/16 16:19:39 shirriff Exp $ SPRITE (DECWRL)
2852132Smckusick */
2952132Smckusick
3056526Sbostic#include <machine/regdef.h>
3156526Sbostic#include <machine/machConst.h>
3258007Sralph#include <machine/machAsmDefs.h>
3358007Sralph#include <pmax/stand/dec_prom.h>
3452132Smckusick
3552132Smckusick/*
3652132Smckusick * Amount to take off of the stack for the benefit of the debugger.
3752132Smckusick */
3852132Smckusick#define START_FRAME	((4 * 4) + 4 + 4)
3952132Smckusick
4056233Sralph	.globl	start
4152132Smckusickstart:
4256233Sralph	.set	noreorder
4358007Sralph	la	sp, start - START_FRAME
4456233Sralph	sw	zero, START_FRAME - 4(sp)	# Zero out old ra for debugger
4556233Sralph	sw	zero, START_FRAME - 8(sp)	# Zero out old fp for debugger
4658007Sralph	move	s0, a0				# save argc
4758007Sralph	move	s1, a1				# save argv
4858981Sralph	beq	a3, 0x30464354, 1f		# jump if boot from DS5000
4958659Sralph	move	s3, a3				# save call vector
5058981Sralph	la	s3, callvec			# init call vector
5158981Sralph1:
5258007Sralph	la	a0, edata			# clear BSS
5358007Sralph	la	a1, end
5458007Sralph	jal	bzero				# bzero(edata, end - edata)
5558007Sralph	subu	a1, a1, a0
5658659Sralph	sw	s3, callv			# save call vector
5758007Sralph	move	a0, s0				# restore argc
5858007Sralph	jal	main				# main(argc, argv)
5958007Sralph	move	a1, s1				# restore argv
6058007Sralph	li	v0, DEC_PROM_RESTART		# done, so call prom
6158007Sralph	j	v0
6256233Sralph	nop
6352132Smckusick
6456233Sralph/* dummy routine for gcc2 */
6556233Sralph	.globl	__main
6656233Sralph__main:
6756233Sralph	j	ra
6856233Sralph	nop
6956233Sralph
7058007SralphLEAF(prom_restart)
7158007Sralph	li	v0, DEC_PROM_RESTART
7258007Sralph	j	v0
7356233Sralph	nop
7458007SralphEND(prom_restart)
7558007Sralph
7658007SralphLEAF(prom_open)
7758007Sralph	li	v0, DEC_PROM_OPEN
7858007Sralph	j	v0
7958007Sralph	nop
8058007SralphEND(prom_open)
8158007Sralph
8258007SralphLEAF(prom_lseek)
8358007Sralph	li	v0, DEC_PROM_LSEEK
8458007Sralph	j	v0
8558007Sralph	nop
8658007SralphEND(prom_lseek)
8758007Sralph
8858007SralphLEAF(prom_read)
8958007Sralph	li	v0, DEC_PROM_READ
9058007Sralph	j	v0
9158007Sralph	nop
9258007SralphEND(prom_read)
9358007Sralph
9458007SralphLEAF(printf)
9558007Sralph	lw	v0, callv	# get pointer to call back vectors
9658007Sralph	sw	a1, 4(sp)	# store args on stack for printf
9758007Sralph	lw	v0, 48(v0)	# offset for callv->printf
9858007Sralph	sw	a2, 8(sp)
9958007Sralph	j	v0		# call PROM printf
10058007Sralph	sw	a3, 12(sp)
10158007SralphEND(printf)
102