1ad84aae1Smckusick /* 2fc410730Skarels * Copyright (c) 1980,1986 Regents of the University of California. 3ad84aae1Smckusick * All rights reserved. The Berkeley software License Agreement 4ad84aae1Smckusick * specifies the terms and conditions for redistribution. 5ad84aae1Smckusick */ 6ad84aae1Smckusick 7*8f26171aSkarels /* "@(#)raboot.c 7.2 (Berkeley) 08/28/86" */ 8*8f26171aSkarels #include <sys/disklabel.h> 9fc410730Skarels 10fc410730Skarels .set MAJOR,9 /* major("/dev/ra0a") */ 114011ea92Ssam 124011ea92Ssam /* 13fc410730Skarels * 1st level boot program: loads next 7.5Kbytes from 140e27f701Ssam * boot sector of file system and sets it up to run. 15fc410730Skarels * Except for MAJOR definition above, should work 16fc410730Skarels * with any disk using 750 boot rom. 174011ea92Ssam */ 180e27f701Ssam .set RELOC,0x50000 1984655d2bSsam .set BOOTLAST,15 /* last boot sector */ 200e27f701Ssam .set RABPSECT,512 /* bytes per sector */ 214011ea92Ssam 224011ea92Ssam init: 230e27f701Ssam .word 0 /* entry mask for dec monitor */ 240e27f701Ssam nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */ 250e27f701Ssam nop;nop; 264011ea92Ssam start: 27fc410730Skarels movl $MAJOR,r10 /* major("/dev/xx0a") */ 28fc410730Skarels extzv $18,$1,r1,r4 /* get UBA number from R1 */ 29fc410730Skarels xorb2 $0x01,r4 /* complement bit */ 30fc410730Skarels insv r4,$24,$8,r10 /* set UBA number */ 31fc410730Skarels insv r3,$16,$8,r10 /* drive number */ 32fc410730Skarels extzv $12,$4,r5,r4 /* get partition from r5 */ 33fc410730Skarels bicw2 $0xf000,r5 /* remove from r5 */ 34fc410730Skarels insv r4,$8,$8,r10 /* set partition */ 350e27f701Ssam movl r5,r11 /* boot flags */ 36fc410730Skarels movl r1,r9 /* UNIBUS I/O page address */ 37fc410730Skarels movl r2,r8 /* boot device CSR */ 38fc410730Skarels movl r3,r7 /* unit number */ 39*8f26171aSkarels brw start0 40*8f26171aSkarels 41*8f26171aSkarels /* 42*8f26171aSkarels * Leave space for pack label. 43*8f26171aSkarels */ 44*8f26171aSkarels pad: 45*8f26171aSkarels .space LABELOFFSET - (pad - init) 46*8f26171aSkarels packlabel: 47*8f26171aSkarels .space d_end_ 48*8f26171aSkarels 49*8f26171aSkarels start0: 500e27f701Ssam movl $RELOC,sp 51fc410730Skarels moval init,r4 52fc410730Skarels movc3 $end,(r4),(sp) 53fc410730Skarels movl r9,r1 /* UNIBUS I/O page address */ 5484655d2bSsam movl r8,r2 /* boot device CSR */ 55fc410730Skarels movl r7,r3 /* unit number */ 560e27f701Ssam jmp *$RELOC+start2 570e27f701Ssam /* now running relocated */ 580e27f701Ssam /* bring in the boot program */ 594011ea92Ssam start2: /* running relocated */ 600e27f701Ssam pushr $0xffff /* BEGIN FIREWALL */ 6184655d2bSsam movl $1,r4 /* first boot sector */ 6284655d2bSsam clrl r5 /* transfer address */ 6384655d2bSsam clrl -(sp) /* transfer address */ 6484655d2bSsam 1: 6584655d2bSsam movl r4,r8 /* requested sector # */ 6684655d2bSsam jsb (r6) /* call ROM-based driver */ 670e27f701Ssam blbs r0,2f 680e27f701Ssam halt /* read error */ 694011ea92Ssam 2: 7084655d2bSsam addl2 $RABPSECT,r5 /* bump address */ 7184655d2bSsam movl r5,(sp) 7284655d2bSsam aobleq $BOOTLAST,r4,1b 734011ea92Ssam 74fc410730Skarels .set PROGSIZE,(BOOTLAST*RABPSECT) 750e27f701Ssam done: 7684655d2bSsam tstl (sp)+ /* pop address */ 7784655d2bSsam popr $0xffff /* END FIREWALL */ 78fc410730Skarels movl $PROGSIZE,r4 790e27f701Ssam clrcor: 80fc410730Skarels clrq (r4) 81fc410730Skarels acbl $RELOC,$8,r4,clrcor 820e27f701Ssam /* start loaded program */ 830e27f701Ssam calls $0,*$0 840e27f701Ssam brw start2 854011ea92Ssam end: 86