Annotation of 43BSDTahoe/sys/mdec/upboot.c, revision 1.1.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: /* "@(#)upboot.c       7.3 (Berkeley) 2/21/87" */
                      8: #include <sys/disklabel.h>
                      9: 
                     10:        .set    MAJOR,2                 /* major("/dev/up0a") */
                     11: 
                     12: /*
                     13:  * UP 1st level boot program: loads next 7.5Kbytes from
                     14:  * boot sector of file system and sets it up to run.
                     15:  * Always reads from drive 0.
                     16:  */
                     17:        .set    BOOTSIZE,15             /* size of boot in sectors */
                     18:        .set    RELOC,0x50000
                     19:        .set    UPBPSECT,512            /* bytes per sector */
                     20: /* UBA registers */
                     21:        .set    UBA_CNFGR,0             /* UBA configuration register */
                     22:        .set    UBA_CR,4                /* UBA control register offset */
                     23:        .set    UBA_MAP,0x800           /* UBA offset to map reg's */
                     24: /* UP registers and bits */
                     25:        .set    UP_cs1,0                /* control and status */
                     26:        .set    UP_wc,2                 /* word count */
                     27:        .set    UP_ba,4                 /* bus address */
                     28:        .set    UP_da,6                 /* disk address */
                     29:        .set    UP_cs2,010              /* cs2 register */
                     30:        .set    UP_of,032               /* offset register */
                     31:        .set    UP_dc,034               /* desired cylinder */
                     32:        .set    UP_hr,036               /* holding register */
                     33:        .set    UP_GO,1                 /* go bit */
                     34:        .set    UP_PACK,022             /* pack acknowledge */
                     35:        .set    UP_DCLR,010             /* drive clear */
                     36:        .set    UP_PRESET,020           /* read-in-preset */
                     37:        .set    UP_RCOM,070             /* read command */
                     38:        .set    UPCS2_CLR,040
                     39:        .set    UP_pRDY,7               /* position of ready bit */
                     40:        .set    UP_pERR,15              /* position of error bit */
                     41:        .set    UP_FMT22,010000
                     42: 
                     43: init:
                     44: /* r9   UBA address */
                     45: /* r8  UP addr */
                     46:        .word   0                       /* entry mask for dec monitor */
                     47:        nop;nop;nop;nop;nop;nop;nop;nop /* some no-ops for 750 boot to skip */
                     48:        nop;nop;
                     49:        movl    $MAJOR,r10              /* major("/dev/xx0a") */
                     50:        extzv   $18,$1,r1,r9            /* get UBA number from R1 */
                     51:        xorb2   $0x01,r9                /* complement bit */
                     52:        insv    r9,$24,$8,r10           /* set UBA number */
                     53:        insv    r3,$16,$8,r10           /* drive number */
                     54:        extzv   $12,$4,r5,r4            /* get partition from r5 */
                     55:        bicw2   $0xf000,r5              /* remove from r5 */
                     56:        insv    r4,$8,$8,r10            /* set partition */
                     57:        movl    r5,r11                  /* boot flags */
                     58: 
                     59:        movl    r2,r8                   /* boot device CSR */
                     60:        brw     start0
                     61: 
                     62: /*
                     63:  * Leave space for pack label.
                     64:  */
                     65: pad:
                     66:        .space  LABELOFFSET - (pad - init)
                     67: packlabel:
                     68:        .space  d_end_
                     69: 
                     70: start0:
                     71:        movl    physUBA[r9],r9          /* UNIBUS adaptor address */
                     72:        movl    r3,r7                   /* unit number */
                     73:        movl    $RELOC,sp
                     74:        moval   init,r4
                     75:        movc3   $end,(r4),(sp)
                     76: /* init up, set vv in drive; if any errors, give up */
                     77: /* probably unneeded: rom should have already done this */
                     78:        bisw3   r7,$UPCS2_CLR,UP_cs2(r8)
                     79:        movw    $UP_DCLR+UP_GO,UP_cs1(r8)
                     80:        movw    $UP_PRESET+UP_GO,UP_cs1(r8)
                     81:        movw    $UP_FMT22,UP_of(r8)
                     82: 1:
                     83:        movw    UP_cs1(r8),r0
                     84:        bbc     $UP_pRDY,r0,1b
                     85: /* relocate to high core */
                     86: start:
                     87:        movl    $RELOC,sp
                     88:        moval   init,r6
                     89:        movc3   $end,(r6),(sp)
                     90:        jmp     *$RELOC+start2
                     91: /* now running relocated */
                     92:        .set    PROGSIZE,(BOOTSIZE*UPBPSECT)
                     93: start2:
                     94:        movw    $0,UP_dc(r8)
                     95:        movw    $1,UP_da(r8)
                     96:        movw    $-PROGSIZE/2,UP_wc(r8)
                     97:        clrl    r0
                     98: 1:
                     99:        bisl3   $0x80000000,r0,UBA_MAP(r9)
                    100:        addl2   $4,r9
                    101:        aobleq  $BOOTSIZE,r0,1b
                    102:        clrw    UP_ba(r8)
                    103:        movw    $UP_RCOM+UP_GO,UP_cs1(r8)
                    104: uprdy:
                    105:        movw    UP_cs1(r8),r0
                    106:        bbc     $UP_pRDY,r0,uprdy
                    107: clear:
                    108:        movl    $PROGSIZE,r3
                    109: clrcor:
                    110:        clrq    (r3)
                    111:        acbl    $RELOC,$8,r3,clrcor
                    112: /* run loaded program */
                    113:        calls   $0,*$0
                    114:        brw     start2
                    115: physUBA:
                    116:        .long   0xf30000                /* uba0 */
                    117:        .long   0xf32000                /* uba1 */
                    118: end:

unix.superglobalmegacorp.com

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