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