xref: /csrg-svn/sys/vax/mdec/raboot.c (revision 29324)
1 /*
2  * Copyright (c) 1980,1986 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 /* "@(#)raboot.c	7.1 (Berkeley) 06/05/86" */
8 
9 	.set	MAJOR,9			/* major("/dev/ra0a") */
10 
11 /*
12  * 1st level boot program: loads next 7.5Kbytes from
13  * boot sector of file system and sets it up to run.
14  * Except for MAJOR definition above, should work
15  * with any disk using 750 boot rom.
16  */
17 	.set	RELOC,0x50000
18 	.set	BOOTLAST,15		/* last boot sector */
19 	.set	RABPSECT,512		/* bytes per sector */
20 
21 init:
22 	.word	0  			/* entry mask for dec monitor */
23 	nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
24 	nop;nop;
25 start:
26 	movl	$MAJOR,r10		/* major("/dev/xx0a") */
27 	extzv	$18,$1,r1,r4		/* get UBA number from R1 */
28 	xorb2	$0x01,r4		/* complement bit */
29 	insv	r4,$24,$8,r10		/* set UBA number */
30 	insv	r3,$16,$8,r10		/* drive number */
31 	extzv	$12,$4,r5,r4		/* get partition from r5 */
32 	bicw2	$0xf000,r5		/* remove from r5 */
33 	insv	r4,$8,$8,r10		/* set partition */
34 	movl	r5,r11			/* boot flags */
35 	movl	r1,r9			/* UNIBUS I/O page address */
36 	movl	r2,r8			/* boot device CSR */
37 	movl	r3,r7			/* unit number */
38 	movl	$RELOC,sp
39 	moval	init,r4
40 	movc3	$end,(r4),(sp)
41 	movl	r9,r1			/* UNIBUS I/O page address */
42 	movl	r8,r2			/* boot device CSR */
43 	movl	r7,r3			/* unit number */
44 	jmp	*$RELOC+start2
45 /* now running relocated */
46 /* bring in the boot program */
47 start2:					/* running relocated */
48 	pushr	$0xffff			/* BEGIN FIREWALL */
49 	movl	$1,r4			/* first boot sector */
50 	clrl	r5			/* transfer address */
51 	clrl	-(sp)			/* transfer address */
52 1:
53 	movl	r4,r8			/* requested sector # */
54 	jsb	(r6)			/* call ROM-based driver */
55 	blbs	r0,2f
56 	halt				/* read error */
57 2:
58 	addl2	$RABPSECT,r5		/* bump address */
59 	movl	r5,(sp)
60 	aobleq	$BOOTLAST,r4,1b
61 
62 	.set	PROGSIZE,(BOOTLAST*RABPSECT)
63 done:
64 	tstl	(sp)+			/* pop address */
65 	popr	$0xffff			/* END FIREWALL */
66 	movl	$PROGSIZE,r4
67 clrcor:
68 	clrq	(r4)
69 	acbl	$RELOC,$8,r4,clrcor
70 /* start loaded program */
71 	calls	$0,*$0
72 	brw	start2
73 end:
74