xref: /csrg-svn/sys/vax/mdec/raboot.c (revision 23146)
1*23146Smckusick /*
2*23146Smckusick  * Copyright (c) 1980 Regents of the University of California.
3*23146Smckusick  * All rights reserved.  The Berkeley software License Agreement
4*23146Smckusick  * specifies the terms and conditions for redistribution.
5*23146Smckusick  */
611087Ssam 
7*23146Smckusick #ifndef lint
8*23146Smckusick _sccsid:.asciz	"@(#)raboot.c	6.2 (Berkeley) 06/08/85"
9*23146Smckusick #endif not lint
10*23146Smckusick 
1111087Ssam /*
1211188Ssam  * UDA50 1st level boot program: loads next 7.5Kbytes from
1311188Ssam  * boot sector of file system and sets it up to run.
1411087Ssam  */
1511188Ssam 	.set	RELOC,0x50000
1612218Ssam 	.set	BOOTLAST,15		/* last boot sector */
1711188Ssam 	.set	RABPSECT,512		/* bytes per sector */
1811087Ssam 
1911087Ssam init:
2011188Ssam 	.word	0  			/* entry mask for dec monitor */
2111188Ssam 	nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
2211188Ssam 	nop;nop;
2311087Ssam start:
2412218Ssam 	movl	r1,r7			/* UNIBUS I/O page address */
2512218Ssam 	movl	r2,r8			/* boot device CSR */
2612218Ssam 	movl	r3,r9			/* unit number */
2711188Ssam 	movl	r5,r11			/* boot flags */
2811188Ssam 	movl	$RELOC,sp
2912218Ssam 	moval	init,r10
3012218Ssam 	movc3	$end,(r10),(sp)
3112218Ssam 	movl	r7,r1			/* UNIBUS I/O page address */
3212218Ssam 	movl	r8,r2			/* boot device CSR */
3312218Ssam 	movl	r9,r3			/* unit number */
3411188Ssam 	jmp	*$RELOC+start2
3511188Ssam /* now running relocated */
3611188Ssam /* bring in the boot program */
3711087Ssam start2:					/* running relocated */
3812218Ssam 	pushr	$0xffff			/* BEGIN FIREWALL */
3912218Ssam 	movl	$1,r4			/* first boot sector */
4011188Ssam 	clrl	r5			/* transfer address */
4112218Ssam 	clrl	-(sp)			/* transfer address */
4211087Ssam 1:
4312218Ssam 	movl	r4,r8			/* requested sector # */
4412218Ssam 	jsb	(r6)			/* call ROM-based driver */
4511188Ssam 	blbs	r0,2f
4611188Ssam 	halt				/* read error */
4711087Ssam 2:
4812218Ssam 	addl2	$RABPSECT,r5		/* bump address */
4912218Ssam 	movl	r5,(sp)
5012218Ssam 	aobleq	$BOOTLAST,r4,1b
5111087Ssam 
5212218Ssam 	.set	PROGSIZE,((BOOTLAST-1)*RABPSECT)
5311188Ssam done:
5412218Ssam 	tstl	(sp)+			/* pop address */
5512218Ssam 	popr	$0xffff			/* END FIREWALL */
5611188Ssam 	movl	$PROGSIZE,r3
5711188Ssam clrcor:
5811188Ssam 	clrq	(r3)
5911188Ssam 	acbl	$RELOC,$8,r3,clrcor
6011188Ssam /* start loaded program */
6111188Ssam 	movl	$9,r10			/* major("/dev/ra0a") */
6211188Ssam 	calls	$0,*$0
6311188Ssam 	brw	start2
6411087Ssam end:
65