xref: /csrg-svn/sys/pmax/stand/start.s (revision 58007)
152132Smckusick/*
252132Smckusick * Copyright (c) 1992 Regents of the University of California.
352132Smckusick * 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*58007Sralph *	@(#)start.s	7.5 (Berkeley) 02/15/93
1152132Smckusick *
1252132Smckusick * start.s -
1352132Smckusick *
1452132Smckusick *     Contains code that is the first executed at boot time.
1552132Smckusick *
1652132Smckusick *	Copyright (C) 1989 Digital Equipment Corporation.
1752132Smckusick *	Permission to use, copy, modify, and distribute this software and
1852132Smckusick *	its documentation for any purpose and without fee is hereby granted,
1952132Smckusick *	provided that the above copyright notice appears in all copies.
2052132Smckusick *	Digital Equipment Corporation makes no representations about the
2152132Smckusick *	suitability of this software for any purpose.  It is provided "as is"
2252132Smckusick *	without express or implied warranty.
2352132Smckusick *
2452132Smckusick * from: $Header: /sprite/src/boot/decprom/ds3100.md/RCS/start.s,
2552132Smckusick *	v 1.1 90/02/16 16:19:39 shirriff Exp $ SPRITE (DECWRL)
2652132Smckusick */
2752132Smckusick
2856526Sbostic#include <machine/regdef.h>
2956526Sbostic#include <machine/machConst.h>
30*58007Sralph#include <machine/machAsmDefs.h>
31*58007Sralph#include <pmax/stand/dec_prom.h>
3252132Smckusick
3352132Smckusick/*
3452132Smckusick * Amount to take off of the stack for the benefit of the debugger.
3552132Smckusick */
3652132Smckusick#define START_FRAME	((4 * 4) + 4 + 4)
3752132Smckusick
3856233Sralph	.globl	start
3952132Smckusickstart:
4056233Sralph	.set	noreorder
41*58007Sralph	li	v0, MACH_SR_BOOT_EXC_VEC
42*58007Sralph	mtc0	v0, MACH_COP_0_STATUS_REG	# Disable interrupts
43*58007Sralph	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
46*58007Sralph#ifdef DS3100
47*58007Sralph	la	a3, callvec			# init call vector
48*58007Sralph#endif
49*58007Sralph	sw	a3, callv			# save call vector
50*58007Sralph	move	s0, a0				# save argc
51*58007Sralph	move	s1, a1				# save argv
52*58007Sralph	la	a0, edata			# clear BSS
53*58007Sralph	la	a1, end
54*58007Sralph	jal	bzero				# bzero(edata, end - edata)
55*58007Sralph	subu	a1, a1, a0
56*58007Sralph	move	a0, s0				# restore argc
57*58007Sralph	jal	main				# main(argc, argv)
58*58007Sralph	move	a1, s1				# restore argv
59*58007Sralph	li	v0, DEC_PROM_RESTART		# done, so call prom
60*58007Sralph	j	v0
6156233Sralph	nop
6252132Smckusick
6356233Sralph/* dummy routine for gcc2 */
6456233Sralph	.globl	__main
6556233Sralph__main:
6656233Sralph	j	ra
6756233Sralph	nop
6856233Sralph
69*58007SralphLEAF(prom_restart)
70*58007Sralph	li	v0, DEC_PROM_RESTART
71*58007Sralph	j	v0
7256233Sralph	nop
73*58007SralphEND(prom_restart)
74*58007Sralph
75*58007SralphLEAF(prom_open)
76*58007Sralph	li	v0, DEC_PROM_OPEN
77*58007Sralph	j	v0
78*58007Sralph	nop
79*58007SralphEND(prom_open)
80*58007Sralph
81*58007SralphLEAF(prom_lseek)
82*58007Sralph	li	v0, DEC_PROM_LSEEK
83*58007Sralph	j	v0
84*58007Sralph	nop
85*58007SralphEND(prom_lseek)
86*58007Sralph
87*58007SralphLEAF(prom_read)
88*58007Sralph	li	v0, DEC_PROM_READ
89*58007Sralph	j	v0
90*58007Sralph	nop
91*58007SralphEND(prom_read)
92*58007Sralph
93*58007SralphLEAF(printf)
94*58007Sralph	lw	v0, callv	# get pointer to call back vectors
95*58007Sralph	sw	a1, 4(sp)	# store args on stack for printf
96*58007Sralph	lw	v0, 48(v0)	# offset for callv->printf
97*58007Sralph	sw	a2, 8(sp)
98*58007Sralph	j	v0		# call PROM printf
99*58007Sralph	sw	a3, 12(sp)
100*58007SralphEND(printf)
101