Annotation of 43BSDReno/sys/mdec/hkboot.c, revision 1.1

1.1     ! root        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: /* @(#)hkboot.c        7.2 (Berkeley) 8/28/86 */
        !             8: #include <sys/disklabel.h>
        !             9: 
        !            10:        .set    MAJOR,3         /* major("/dev/hk0a") */
        !            11: 
        !            12: /*
        !            13:  * RK07 1st level boot program: loads next 7.5Kbytes from
        !            14:  * boot sector of file system and sets it up to run.
        !            15:  */
        !            16:        .set    RELOC,0x50000
        !            17:        .set    BOOTSIZE,15             /* size of boot in sectors */
        !            18: /* UBA registers */
        !            19:        .set    UBA_CNFGR,0             /* UBA configuration register */
        !            20:        .set    UBA_CR,4                /* UBA control register offset */
        !            21:        .set    UBA_MAP,0x800           /* UBA offset to map reg's */
        !            22: /* RK611 registers and bits */
        !            23:        .set    HK_cs1,0                /* control and status */
        !            24:        .set    HK_wc,2                 /* word count */
        !            25:        .set    HK_ba,4                 /* bus address */
        !            26:        .set    HK_da,6                 /* disk address */
        !            27:        .set    HK_cs2,8                /* control and status */
        !            28:        .set    HK_dc,020               /* desired cylinder */
        !            29:        .set    HKBPSECT,512            /* bytes per sector */
        !            30:        .set    HK_GO,1                 /* go bit */
        !            31:        .set    HK_PACK,2               /* pack acknowledge */
        !            32:        .set    HK_RCOM,020             /* read command */
        !            33:        .set    HK_SEL7,02000           /* select RK07 disk */
        !            34:        .set    HK_pRDY,7               /* position of ready bit */
        !            35:        .set    HK_pERR,15              /* position of error bit */
        !            36: 
        !            37: init:
        !            38: /* r9  UBA address */
        !            39: /* r8  HK addr */
        !            40:        .word   0                       /* entry mask for dec monitor */
        !            41:        nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
        !            42:        nop;nop;
        !            43:        movl    $MAJOR,r10              /* major("/dev/xx0a") */
        !            44:        extzv   $18,$1,r1,r9            /* get UBA number from R1 */
        !            45:        xorb2   $0x01,r9                /* complement bit */
        !            46:        insv    r9,$24,$8,r10           /* set UBA number */
        !            47:        insv    r3,$16,$8,r10           /* drive number */
        !            48:        extzv   $12,$4,r5,r4            /* get partition from r5 */
        !            49:        bicw2   $0xf000,r5              /* remove from r5 */
        !            50:        insv    r4,$8,$8,r10            /* set partition */
        !            51:        movl    r5,r11                  /* boot flags */
        !            52:        brw     start0
        !            53: 
        !            54: /*
        !            55:  * Leave space for pack label.
        !            56:  */
        !            57: pad:
        !            58:        .space  LABELOFFSET - (pad - init)
        !            59: packlabel:
        !            60:        .space  d_end_
        !            61: 
        !            62: start0:
        !            63:        movl    physUBA[r9],r9          /* UNIBUS adaptor address */
        !            64:        movl    r2,r8                   /* boot device CSR */
        !            65:        movl    r3,r7                   /* unit number */
        !            66: 
        !            67: /* select unit, init rk611, set vv in drive; if any errors, give up */
        !            68:        movw    r7,HK_cs2(r8)
        !            69:        movw    $HK_SEL7+HK_GO,HK_cs1(r8)
        !            70: 1:
        !            71:        movw    HK_cs1(r8),r0
        !            72:        bbc     $HK_pRDY,r0,1b
        !            73:        bbs     $HK_pERR,r0,9f
        !            74:        movw    $HK_SEL7+HK_PACK+HK_GO,HK_cs1(r8)
        !            75: 1:
        !            76:        movw    HK_cs1(r8),r0
        !            77:        bbc     $HK_pRDY,r0,1b
        !            78:        bbc     $HK_pERR,r0,start
        !            79: 9:
        !            80:        halt
        !            81: /* relocate to high core */
        !            82: start:
        !            83:        movl    r5,r11                  /* boot flags */
        !            84:        movl    $RELOC,sp
        !            85:        moval   init,r6
        !            86:        movc3   $end,(r6),(sp)
        !            87:        jmp     *$RELOC+start2
        !            88: /* now running relocated */
        !            89: /* bring in the boot program */
        !            90:        .set    PROGSIZE,(BOOTSIZE*HKBPSECT)
        !            91: start2:
        !            92:        movw    $0,HK_dc(r8)
        !            93:        movw    $1,HK_da(r8)
        !            94:        movw    $-PROGSIZE/2,HK_wc(r8)
        !            95:        clrl    r0
        !            96: 1:
        !            97: /*     bisl3   $0x80000000,r0,UBA_MAP(r9) */
        !            98: /*     addl2   $4,r9 */
        !            99: /*     aobleq  $BOOTSIZE,r0,1b */
        !           100:        clrw    HK_ba(r8)
        !           101:        movw    $HK_SEL7+HK_RCOM+HK_GO,HK_cs1(r8)
        !           102: hkrdy:
        !           103:        movw    HK_cs1(r8),r0
        !           104:        bbc     $HK_pRDY,r0,hkrdy
        !           105:        bbs     $HK_pERR,r0,hkerr
        !           106:        brw     done
        !           107: hkerr:
        !           108:        halt                    /* ungraceful */
        !           109: done:
        !           110:        movl    $PROGSIZE,r3
        !           111: clrcor:
        !           112:        clrq    (r3)
        !           113:        acbl    $RELOC,$8,r3,clrcor
        !           114: /* start loaded program */
        !           115:        calls   $0,*$0
        !           116:        brw     start2
        !           117: physUBA:
        !           118:        .long   0xf30000                /* uba0 */
        !           119:        .long   0xf32000                /* uba1 */
        !           120: end:

unix.superglobalmegacorp.com

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