Annotation of 42BSD/sys/mdec/hkboot.s, revision 1.1.1.1

1.1       root        1: /*     hkboot.s        6.1     83/07/29        */
                      2: 
                      3: /*
                      4:  * RK07 1st level boot program: loads next 7.5Kbytes from
                      5:  * boot sector of file system and sets it up to run.
                      6:  * Always reads from drive 0.
                      7:  */
                      8:        .set    RELOC,0x50000
                      9:        .set    BOOTSIZE,15             /* size of boot in sectors */
                     10:        .set    SID,62                  /* system ID register */
                     11: /* UBA registers */
                     12:        .set    UBA_CNFGR,0             /* UBA configuration register */
                     13:        .set    UBA_CR,4                /* UBA control register offset */
                     14:        .set    UBA_MAP,0x800           /* UBA offset to map reg's */
                     15:        .set    UBAinit,1               /* UBA init bit in UBA control reg */
                     16:        .set    pUBIC,16                /* Unibus init complete */
                     17: /* RK611 registers and bits */
                     18:        .set    HK,0177440-0160000      /* address of RK611 */
                     19:        .set    HK_cs1,HK+0             /* control and status */
                     20:        .set    HK_wc,HK+2              /* word count */
                     21:        .set    HK_ba,HK+4              /* bus address */
                     22:        .set    HK_da,HK+6              /* disk address */
                     23:        .set    HK_dc,HK+020            /* desired cylinder */
                     24:        .set    HKBPSECT,512            /* bytes per sector */
                     25:        .set    HK_GO,1                 /* go bit */
                     26:        .set    HK_PACK,2               /* pack acknowledge */
                     27:        .set    HK_RCOM,020             /* read command */
                     28:        .set    HK_SEL7,02000           /* select RK07 disk */
                     29:        .set    HK_pRDY,7               /* position of ready bit */
                     30:        .set    HK_pERR,15              /* position of error bit */
                     31: 
                     32: init:
                     33: /* r9  UBA address */
                     34: /* r10 umem addr */
                     35:        .word   0                       /* entry mask for dec monitor */
                     36:        nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
                     37:        nop;nop;
                     38: /* get cpu type and find the first uba */
                     39:        mfpr    $SID,r0
                     40:        extzv   $24,$8,r0,r0            /* get cpu type */
                     41:        ashl    $2,r0,r1
                     42:        movab   physUBA,r2              /* get physUBA[cpu] */
                     43:        addl2   r1,r2
                     44:        movl    (r2),r9
                     45:        movab   physUMEM,r2             /* get physUMEM[cpu] */
                     46:        addl2   r1,r2
                     47:        movl    (r2),r10
                     48: /* if 780, init uba */
                     49:        cmpl    r0,$1
                     50:        bneq    2f
                     51:        movl    $UBAinit,UBA_CR(r9)
                     52: 1:
                     53:        bbc     $pUBIC,UBA_CNFGR(r9),1b
                     54: 2:
                     55: /* init rk611, set vv in drive 0; if any errors, give up */
                     56:        movw    $HK_SEL7+HK_GO,HK_cs1(r10)
                     57: 1:
                     58:        movw    HK_cs1(r10),r0
                     59:        bbc     $HK_pRDY,r0,1b
                     60:        bbs     $HK_pERR,r0,9f
                     61:        movw    $HK_SEL7+HK_PACK+HK_GO,HK_cs1(r10)
                     62: 1:
                     63:        movw    HK_cs1(r10),r0
                     64:        bbc     $HK_pRDY,r0,1b
                     65:        bbc     $HK_pERR,r0,start
                     66: 9:
                     67:        halt
                     68: /* relocate to high core */
                     69: start:
                     70:        movl    r5,r11                  /* boot flags */
                     71:        movl    $RELOC,sp
                     72:        moval   init,r6
                     73:        movc3   $end,(r6),(sp)
                     74:        jmp     *$RELOC+start2
                     75: /* now running relocated */
                     76: /* bring in the boot program */
                     77:        .set    PROGSIZE,(BOOTSIZE*HKBPSECT)
                     78: start2:
                     79:        movw    $0,HK_dc(r10)
                     80:        movw    $1,HK_da(r10)
                     81:        movw    $-PROGSIZE/2,HK_wc(r10)
                     82:        clrl    r0
                     83: 1:
                     84:        bisl3   $0x80000000,r0,UBA_MAP(r9)
                     85:        addl2   $4,r9
                     86:        aobleq  $BOOTSIZE,r0,1b
                     87:        clrw    HK_ba(r10)
                     88:        movw    $HK_SEL7+HK_RCOM+HK_GO,HK_cs1(r10)
                     89: hkrdy:
                     90:        movw    HK_cs1(r10),r0
                     91:        bbc     $HK_pRDY,r0,hkrdy
                     92:        bbs     $HK_pERR,r0,hkerr
                     93:        brw     done
                     94: hkerr:
                     95:        halt                    /* ungraceful */
                     96: done:
                     97:        movl    $PROGSIZE,r3
                     98: clrcor:
                     99:        clrq    (r3)
                    100:        acbl    $RELOC,$8,r3,clrcor
                    101: /* start loaded program */
                    102:        movl    $3,r10                  /* major("/dev/hk0a") */
                    103:        calls   $0,*$0
                    104:        brw     start2
                    105: physUBA:
                    106:        .long   0
                    107:        .long   0x20006000      /* 11/780 */
                    108:        .long   0xf30000        /* 11/750 */
                    109:        .long   0xf26000        /* 11/730 */
                    110: physUMEM:
                    111:        .long   0
                    112:        .long   0x2013e000      /* 11/780 */
                    113:        .long   0xffe000        /* 11/750 */
                    114:        .long   0xffe000        /* 11/730 */
                    115: end:

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.