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*58981Sralph * @(#)start.s 7.7 (Berkeley) 04/05/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*58981Sralph beq a3, 0x30464354, 1f # jump if boot from DS5000 4758659Sralph move s3, a3 # save call vector 48*58981Sralph la s3, callvec # init call vector 49*58981Sralph1: 5058007Sralph la a0, edata # clear BSS 5158007Sralph la a1, end 5258007Sralph jal bzero # bzero(edata, end - edata) 5358007Sralph subu a1, a1, a0 5458659Sralph sw s3, callv # save call vector 5558007Sralph move a0, s0 # restore argc 5658007Sralph jal main # main(argc, argv) 5758007Sralph move a1, s1 # restore argv 5858007Sralph li v0, DEC_PROM_RESTART # done, so call prom 5958007Sralph j v0 6056233Sralph nop 6152132Smckusick 6256233Sralph/* dummy routine for gcc2 */ 6356233Sralph .globl __main 6456233Sralph__main: 6556233Sralph j ra 6656233Sralph nop 6756233Sralph 6858007SralphLEAF(prom_restart) 6958007Sralph li v0, DEC_PROM_RESTART 7058007Sralph j v0 7156233Sralph nop 7258007SralphEND(prom_restart) 7358007Sralph 7458007SralphLEAF(prom_open) 7558007Sralph li v0, DEC_PROM_OPEN 7658007Sralph j v0 7758007Sralph nop 7858007SralphEND(prom_open) 7958007Sralph 8058007SralphLEAF(prom_lseek) 8158007Sralph li v0, DEC_PROM_LSEEK 8258007Sralph j v0 8358007Sralph nop 8458007SralphEND(prom_lseek) 8558007Sralph 8658007SralphLEAF(prom_read) 8758007Sralph li v0, DEC_PROM_READ 8858007Sralph j v0 8958007Sralph nop 9058007SralphEND(prom_read) 9158007Sralph 9258007SralphLEAF(printf) 9358007Sralph lw v0, callv # get pointer to call back vectors 9458007Sralph sw a1, 4(sp) # store args on stack for printf 9558007Sralph lw v0, 48(v0) # offset for callv->printf 9658007Sralph sw a2, 8(sp) 9758007Sralph j v0 # call PROM printf 9858007Sralph sw a3, 12(sp) 9958007SralphEND(printf) 100