Annotation of 43BSDReno/sys/vaxstand/srt0.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1982, 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:  *     @(#)srt0.c      7.6 (Berkeley) 11/8/88
                      7:  */
                      8: 
                      9: #include "../vax/mtpr.h"
                     10: #define        LOCORE
                     11: #include "../vax/cpu.h"
                     12: 
                     13: /*
                     14:  * Startup code for standalone system
                     15:  * Non-relocating version -- for programs which are loaded by boot
                     16:  * Relocating version for boot*
                     17:  */
                     18: 
                     19:        .globl  _end
                     20:        .globl  _edata
                     21:        .globl  _main
                     22:        .globl  __rtt
                     23:        .globl  _configure
                     24:        .globl  _cpu
                     25:        .globl  _openfirst
                     26:        .globl  _boothowto
                     27:        .globl  _bootdev
                     28: 
                     29:        .set    HIGH,31         # mask for total disable
                     30: 
                     31: entry: .globl  entry
                     32:        nop; nop                        # .word 0x0101
                     33:        mtpr    $HIGH,$IPL              # just in case
                     34: 
                     35: #ifdef REL
                     36:        # we need to do special stuff on microvaxen
                     37:        mfpr    $SID,r0
                     38:        cmpzv   $24,$8,r0,$VAX_630
                     39:        beql    1f
                     40:        cmpzv   $24,$8,r0,$VAX_650
                     41:        bneq    2f
                     42: 
                     43:        /*
                     44:         * Were we booted by VMB?  If so, r11 is not boothowto,
                     45:         * but rather the address of the `Extended RPB' (see KA630
                     46:         * User's Manual, pp 3-21).  These tests were devised by
                     47:         * richl@tektronix, 11/10/87.
                     48:         */
                     49: 1:
                     50:        cmpl    (r11),r11               # if boothowto, r11 will be small
                     51:        bneq    2f                      # and these will not fault
                     52:        cmpl    4(r11),$0
                     53:        bneq    2f
                     54:        cmpl    8(r11),$-1
                     55:        bneq    2f
                     56:        tstl    0xc(r11)
                     57:        bneq    2f
                     58: 
                     59:        /*
                     60:         * Booted by VMB: get flags from extended rpb.
                     61:         * We can only guess at the boot device (here ra(0,0)).
                     62:         */
                     63:        movl    0x30(r11),r11
                     64:        movl    $9,r10                  # device = ra(0,0)
                     65: 2:
                     66:        movl    $RELOC,sp
                     67: #else
                     68:        movl    $RELOC-0x2400,sp
                     69: #endif
                     70: start:
                     71: #ifndef REL
                     72:        /*
                     73:         * Clear bss segment
                     74:         */
                     75:        movl    aedata,r0
                     76: clr:
                     77:        clrl    (r0)+
                     78:        cmpl    r0,sp
                     79:        jlss    clr
                     80: #else
                     81:        /*
                     82:         * `entry' below generates a pc-relative reference to the
                     83:         * code, so this works no matter where we are now.
                     84:         * Clear bss segment *after* moving text and data.
                     85:         */
                     86:        movc3   aedata,entry,(sp)
                     87: dclr:
                     88:        clrl    (r3)+
                     89:        cmpl    r3,$_end
                     90:        jlss    dclr
                     91: /* this loop shouldn't be necessary, but is when booting from an ra81 */
                     92: xclr:  
                     93:        clrl    (r3)+
                     94:        cmpl    r3,$0x100000
                     95:        jlss    xclr
                     96:        jmp     *abegin
                     97: begin:
                     98: #endif
                     99:        movl    r11,_boothowto
                    100:        movl    r10,_bootdev
                    101: again:
                    102:        mtpr    $0,$SCBB
                    103:        calls   $0,_configure
                    104:        movl    $1,_openfirst
                    105:        calls   $0,_main
                    106: #ifdef REL
                    107:        jmp     again
                    108: #else
                    109:        ret
                    110: #endif
                    111: 
                    112:        .data
                    113: #ifdef REL
                    114: abegin:        .long   begin
                    115: aedata:        .long   _edata-RELOC
                    116: #else
                    117: aedata:        .long   _edata
                    118: #endif
                    119: _bootdev:      .long   0
                    120: _boothowto:    .long   0
                    121:        .text
                    122: 
                    123: __rtt:
                    124:        .word   0x0
                    125: #ifdef REL
                    126:        halt
                    127: #else
                    128:        jmp     start
                    129: #endif
                    130: 
                    131:        .globl  _badaddr
                    132: _badaddr:
                    133:        .word   0
                    134:        movl    $1,r0
                    135:        movl    4(ap),r3
                    136:        movl    8(ap),r4
                    137:        movl    $4,r2
                    138:        movab   9f,(r2)
                    139:        bbc     $0,r4,1f; tstb  (r3)
                    140: 1:     bbc     $1,r4,1f; tstw  (r3)
                    141: 1:     bbc     $2,r4,1f; tstl  (r3)
                    142: 1:     clrl    r0                      # made it w/o machine checks
                    143: 2:     movl    $4,r2
                    144:        clrl    (r2)
                    145:        ret
                    146:        .align  2
                    147: 9:
                    148:        casel   _cpu,$1,$VAX_MAX
                    149: 0:
                    150:        .word   8f-0b           # 1 is 780
                    151:        .word   5f-0b           # 2 is 750
                    152:        .word   5f-0b           # 3 is 730
                    153:        .word   6f-0b           # 4 is 8600
                    154:        .word   5f-0b           # 5 is 8200
                    155:        .word   1f-0b           # 6 is 8800
                    156:        .word   1f-0b           # 7 is 610
                    157:        .word   5f-0b           # 8 is 630
                    158:        .word   1f-0b           # 9 is ???
                    159:        .word   1f-0b           # 10 is 650
                    160: 5:
                    161:        mtpr    $0xf,$MCESR
                    162:        brb     1f
                    163: 6:
                    164:        mtpr    $0,$EHSR
                    165:        brb     1f
                    166: 8:
                    167:        mtpr    $0,$SBIFS
                    168: 1:
                    169:        addl2   (sp)+,sp                # discard mchchk trash
                    170:        movab   2b,(sp)
                    171:        rei
                    172: 
                    173: /*
                    174:  * Short assembly versions of strcmp, strcpy, and strlen
                    175:  * that do not use special instructions.
                    176:  */
                    177:        .globl  _strcmp
                    178: _strcmp:
                    179:        .word   0
                    180:        movq    4(ap),r0
                    181: 0:     cmpb    (r0),(r1)+
                    182:        bneq    1f
                    183:        tstb    (r0)+
                    184:        bneq    0b
                    185:        clrl    r0
                    186:        ret
                    187: 1:     cvtbl   (r0),r0
                    188:        cvtbl   -(r1),r1
                    189:        subl2   r1,r0
                    190:        ret
                    191: 
                    192:        .globl  _strcpy
                    193: _strcpy:
                    194:        .word   0
                    195:        movq    4(ap),r0
                    196: 0:     movb    (r1)+,(r0)+
                    197:        bneq    0b
                    198:        movl    4(ap),r0
                    199:        ret
                    200: 
                    201:        .globl  _strlen
                    202: _strlen:
                    203:        .word   0
                    204:        movl    4(ap),r0
                    205: 0:     tstb    (r0)+
                    206:        bneq    0b
                    207:        decl    r0
                    208:        subl2   4(ap),r0
                    209:        ret

unix.superglobalmegacorp.com

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