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*58659Sralph * @(#)start.s 7.6 (Berkeley) 03/13/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> 3058007Sralph#include <machine/machAsmDefs.h> 3158007Sralph#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 4158007Sralph la sp, start - START_FRAME 4256233Sralph sw zero, START_FRAME - 4(sp) # Zero out old ra for debugger 4356233Sralph sw zero, START_FRAME - 8(sp) # Zero out old fp for debugger 4458007Sralph move s0, a0 # save argc 4558007Sralph move s1, a1 # save argv 46*58659Sralph#ifdef DS5000 47*58659Sralph move s3, a3 # save call vector 48*58659Sralph#endif 4958007Sralph la a0, edata # clear BSS 5058007Sralph la a1, end 5158007Sralph jal bzero # bzero(edata, end - edata) 5258007Sralph subu a1, a1, a0 53*58659Sralph#ifdef DS3100 54*58659Sralph la s3, callvec # init call vector 55*58659Sralph#endif 56*58659Sralph 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