/* raboot.c 4.1 83/02/16 */
* From 4.1 boot sector code by Scott Comer (Rice University).
.set BOOTBASE
, 0xfe00 /* relocated home of boot block */
* These three hold the register contents needed by the
* ROM driver subroutine to access the boot device.
.set driver_r2
, driver_r1
+4
.set driver_r3
, driver_r2
+4
.set driver
, driver_r3
+4 /* addr of driver routine */
.set NOT_FIRST_64K
, 0x1001
.set UNSUPPORTED_DEVICE
, 0x1002
.set RETURN_FROM_BOOT
, 0x1003
.set COULD_NOT_FIND_BOOT
, 0x1004
.set FILE_TOO_LARGE
, 0x1005
.set FILE_READ_ERROR
, 0x1006
.long 0 /* boot block parameters */
.long 0 /* (all unused, hence 0) */
* The registers are set by the console subsystem as follows.
* Those marked with stars are saved by the driver subroutine.
* Those marked with a "d" are used by the driver subroutine,
* and must contain the indicated values before calling the driver.
* r0 = type of boot device (see 750 hardware reference, console)
* ds r1 = address of the unibus i/o page
* ds r2 = boot device CSR address
* ds r3 = boot device unit number
* ds r5 = software boot flags (driver: offset to buffer for read)
* s r6 = driver subroutine address
* d r8 = LBN of block to read from disk
* Memory is mapped as follows:
* 0000 to 01ff Boot block program
* fa00 to fdff Drivers and control routines
movl r0
, r10
/* save the device type */
moval init
, r11
/* base address of good memory */
movl r5
, ap
/* save the boot flags */
tstl r11
/* see if it is zero */
movzwl $NOT_FIRST_64K
, r7
halt
/* not in first 64k of memory */
1: moval
STACK(r11
), sp
/* put the stack somewhere good */
/* save the register contents needed by the boot driver */
/* relocate the boot program */
movc3 $end
, (r11
), BOOTBASE(r11
)
start2
: /* running relocated */
calls $
0, BOOTBASE
+read_file(r11
)
movl r11
, r9
/* save the base pointer */
/* boot strap device codes from microcode routines */
movzbl $
0, r10
/* massbus disk */
movzbl $
3, r10
/* rk07 disk */
movzbl $
9, r10
/* uda50 */
movzwl $UNSUPPORTED_DEVICE
, r7
halt
/* unsupported device */
movl ap
, r11
/* software boot flags */
addl3
di_size(r9
), r9
, r2
/* address to start clear */
moval
BOOTBASE(r9
), r1
/* address to stop clearing */
movzwl $RETURN_FROM_BOOT
, r7
halt
/* end of program */
clrq
-(sp
) /* make room for the buf addr */
mull3 $
2, 4(ap
), r4
/* mult by 2 to get lbn */
addl3 r5
, r11
, (sp
) /* for massbus babies */
jsb
*driver(r11
) /* read the first block */
movzwl $FILE_READ_ERROR
, r7
halt
/* error reading file */
addl3 r5
, r11
, (sp
) /* for massbus babies */
jsb
*driver(r11
) /* read the second block */
movzwl $FILE_READ_ERROR
, r7
halt
/* error reading file */