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

1.1       root        1: /*     upboot.s        6.1     83/07/29        */
                      2: 
                      3: /*
                      4:  * UP 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    BOOTSIZE,15             /* size of boot in sectors */
                      9:        .set    RELOC,0x50000
                     10:        .set    UPBPSECT,512            /* bytes per sector */
                     11:        .set    SID,62                  /* system ID register */
                     12: /* UBA registers */
                     13:        .set    UBA_CNFGR,0             /* UBA configuration register */
                     14:        .set    UBA_CR,4                /* UBA control register offset */
                     15:        .set    UBA_MAP,0x800           /* UBA offset to map reg's */
                     16:        .set    UBAinit,1               /* UBA init bit in UBA control reg */
                     17:        .set    pUBIC,16                /* Unibus init complete */
                     18: /* UP registers and bits */
                     19:        .set    UP,0176700-0160000      /* address of UP controller */
                     20:        .set    UP_cs1,UP+0             /* control and status */
                     21:        .set    UP_wc,UP+2              /* word count */
                     22:        .set    UP_ba,UP+4              /* bus address */
                     23:        .set    UP_da,UP+6              /* disk address */
                     24:        .set    UP_cs2,UP+010           /* cs2 register */
                     25:        .set    UP_of,UP+032            /* offset register */
                     26:        .set    UP_dc,UP+034            /* desired cylinder */
                     27:        .set    UP_hr,UP+036            /* holding register */
                     28:        .set    UP_GO,1                 /* go bit */
                     29:        .set    UP_PACK,022             /* pack acknowledge */
                     30:        .set    UP_DCLR,010             /* drive clear */
                     31:        .set    UP_PRESET,020           /* read-in-preset */
                     32:        .set    UP_RCOM,070             /* read command */
                     33:        .set    UPCS2_CLR,040
                     34:        .set    UP_pRDY,7               /* position of ready bit */
                     35:        .set    UP_pERR,15              /* position of error bit */
                     36:        .set    UP_FMT22,010000
                     37: 
                     38: init:
                     39:        .word   0                       /* entry mask for dec monitor */
                     40:        nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
                     41:        nop;nop;
                     42: /* get cpu type and find the first uba */
                     43:        mfpr    $SID,r0
                     44:        extzv   $24,$8,r0,r0            /* get cpu type */
                     45:        ashl    $2,r0,r1
                     46:        movab   physUBA,r2              /* get physUBA[cpu] */
                     47:        addl2   r1,r2
                     48:        movl    (r2),r9
                     49:        movab   physUMEM,r2             /* get physUMEM[cpu] */
                     50:        addl2   r1,r2
                     51:        movl    (r2),r10
                     52: /* if 780, init uba */
                     53:        cmpl    r0,$1
                     54:        bneq    2f
                     55:        movl    $UBAinit,UBA_CR(r9)
                     56: 1:
                     57:        bbc     $pUBIC,UBA_CNFGR(r9),1b
                     58: 2:
                     59:        movl    $5000000,r0
                     60: 1:
                     61:        sobgtr  r0,1b
                     62: /* init up, set vv in drive 0; if any errors, give up */
                     63:        movw    $UPCS2_CLR,UP_cs2(r10)
                     64:        movw    $UP_DCLR+UP_GO,UP_cs1(r10)
                     65:        movw    $UP_PRESET+UP_GO,UP_cs1(r10)
                     66:        movw    $UP_FMT22,UP_of(r10)
                     67: 1:
                     68:        movw    UP_cs1(r10),r0
                     69:        bbc     $UP_pRDY,r0,1b
                     70: /* relocate to high core */
                     71: start:
                     72:        movl    r5,r11                  /* boot flags */
                     73:        movl    $RELOC,sp
                     74:        moval   init,r6
                     75:        movc3   $end,(r6),(sp)
                     76:        jmp     *$RELOC+start2
                     77: /* now running relocated */
                     78:        .set    PROGSIZE,(BOOTSIZE*UPBPSECT)
                     79: start2:
                     80:        movw    $0,UP_dc(r10)
                     81:        movw    $1,UP_da(r10)
                     82:        movw    $-PROGSIZE/2,UP_wc(r10)
                     83:        clrl    r0
                     84: 1:
                     85:        bisl3   $0x80000000,r0,UBA_MAP(r9)
                     86:        addl2   $4,r9
                     87:        aobleq  $BOOTSIZE,r0,1b
                     88:        clrw    UP_ba(r10)
                     89:        movw    $UP_RCOM+UP_GO,UP_cs1(r10)
                     90: uprdy:
                     91:        movw    UP_cs1(r10),r0
                     92:        bbc     $UP_pRDY,r0,uprdy
                     93: clear:
                     94:        movl    $PROGSIZE,r3
                     95: clrcor:
                     96:        clrq    (r3)
                     97:        acbl    $RELOC,$8,r3,clrcor
                     98: /* run loaded program */
                     99:        movl    $2,r10                  /* major("/dev/up0a") */
                    100:        calls   $0,*$0
                    101:        brw     start2
                    102: physUBA:
                    103:        .long   0
                    104:        .long   0x20006000      /* 11/780 */
                    105:        .long   0xf30000        /* 11/750 */
                    106:        .long   0xf26000        /* 11/730 */
                    107: physUMEM:
                    108:        .long   0
                    109:        .long   0x2013e000      /* 11/780 */
                    110:        .long   0xffe000        /* 11/750 */
                    111:        .long   0xffe000        /* 11/730 */
                    112: end:

unix.superglobalmegacorp.com

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