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

1.1       root        1: /*
                      2:  * Copyright (c) 1988 University of Utah.
                      3:  * Copyright (c) 1982, 1990 The Regents of the University of California.
                      4:  * All rights reserved.
                      5:  *
                      6:  * This code is derived from software contributed to Berkeley by
                      7:  * the Systems Programming Group of the University of Utah Computer
                      8:  * Science Department.
                      9:  *
                     10:  * Redistribution is only permitted until one year after the first shipment
                     11:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
                     12:  * binary forms are permitted provided that: (1) source distributions retain
                     13:  * this entire copyright notice and comment, and (2) distributions including
                     14:  * binaries display the following acknowledgement:  This product includes
                     15:  * software developed by the University of California, Berkeley and its
                     16:  * contributors'' in the documentation or other materials provided with the
                     17:  * distribution and in all advertising materials mentioning features or use
                     18:  * of this software.  Neither the name of the University nor the names of
                     19:  * its contributors may be used to endorse or promote products derived from
                     20:  * this software without specific prior written permission.
                     21:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     22:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     23:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     24:  *
                     25:  * from: Utah $Hdr: srt0.c 1.8 88/12/03$
                     26:  *
                     27:  *     @(#)srt0.c      7.2 (Berkeley) 5/25/90
                     28:  */
                     29: 
                     30: /*
                     31:  * Startup code for standalone system
                     32:  */
                     33: 
                     34:        .globl  begin
                     35:        .globl  _end
                     36:        .globl  _edata
                     37:        .globl  _main
                     38:        .globl  _configure
                     39:        .globl  _openfirst
                     40:        .globl  __rtt
                     41:        .globl  _lowram,_howto,_devtype,_internalhpib
                     42: 
                     43:        STACK =    0xfffff000   | below the ROM page
                     44:        BOOTTYPE = 0xfffffdc0
                     45:        LOWRAM =   0xfffffdce
                     46:        SYSFLAG =  0xfffffed2   | system flags
                     47:        MSUS =     0xfffffedc   | MSUS (?) structure
                     48:        VECTORS =  0xfffffee0   | beginning of jump vectors
                     49:        NMIRESET = 0xffffff9c   | reset vector
                     50:        BUSERR =   0xfffffffc
                     51:        MAXADDR =  0xfffff000
                     52:        NBPG =     4096
                     53: 
                     54:        .data
                     55: _lowram:
                     56:        .long   0
                     57: _howto:
                     58:        .long   0
                     59: _devtype:
                     60:        .long   0
                     61: 
                     62:        .text
                     63: begin:
                     64:        movl    #STACK,sp
                     65:        moveq   #47,d0          | # of vectors - 1
                     66:        movl    #VECTORS+2,a0   | addr part of first vector
                     67: vecloop:
                     68:        movl    #trap,a0@       | make it direct to trap
                     69:        addql   #6,a0           | move to next vector addr
                     70:        dbf     d0,vecloop      | go til done
                     71:        movl    #NMIRESET,a0    | NMI keyboard reset addr
                     72:        movl    #nmi,a0@        | catch in reset routine
                     73:        btst    #5,SYSFLAG      | do we have an internal HP-IB?
                     74:        jeq     boottype        | yes, continue
                     75:        clrl    _internalhpib   | no, clear the internal address
                     76: boottype:
                     77:        cmpw    #12,BOOTTYPE    | is this a reboot (REQ_REBOOT)?
                     78:        jne     notreboot       | no, skip
                     79:        movl    #MAXADDR,a0     | find last page
                     80:        movl    a0@+,d7         | and extract howto, devtype
                     81:        movl    a0@+,d6         |   from where doboot() left them
                     82:        jra     boot1
                     83: /*
                     84:  * At this point we do not know which logical hpib the given select
                     85:  * code refers to.  So we just put the select code in the adaptor field
                     86:  * where hpibinit() can replace it with the logical hpib number.
                     87:  * Note that this may clobber the B_DEVMAGIC field but that isn't set
                     88:  * til later anyway.
                     89:  */
                     90: notreboot:
                     91:        cmpw    #18,BOOTTYPE    | does the user want to interact?
                     92:        jeq     askme           | yes, go to it
                     93:        movl    MSUS,d1         | no, get rom info
                     94:        movw    d1,d6           | MSUS comes with SC in upper, unit in lower
                     95:        swap    d6              | put in place
                     96:        movw    #2,d6           | assume 'a' partition of rd disk
                     97:        moveq   #0,d7           | default to RB_AUTOBOOT
                     98:        jra     boot1
                     99: askme:
                    100:        moveq   #7,d6           | default to HP-IB at sc7
                    101:        lslw    #8,d6           | position as adaptor number
                    102:        swap    d6              | put in place (note implied unit 0)
                    103:        movw    #2,d6           | assume 'a' partition of rd disk
                    104:        moveq   #3,d7           | default to RB_SINGLE|RB_ASKNAME
                    105: boot1:
                    106:        movl    d6,_devtype     | save devtype and howto
                    107:        movl    d7,_howto       |   globally so all can access
                    108:        movl    LOWRAM,d0       | read lowram value from bootrom
                    109:        addl    #NBPG,d0        | must preserve this for bootrom to reboot
                    110:        andl    #0xfffff000,d0  | round to next page
                    111:        movl    d0,_lowram      | stash that value
                    112: start:
                    113:        movl    #_edata,a2      | start of BSS
                    114:        movl    #_end,a3        | end
                    115: clr:
                    116:        clrb    a2@+            | clear BSS
                    117:        cmpl    a2,a3           | done?
                    118:        bne     clr             | no, keep going
                    119:        jsr     _configure      | configure critical devices
                    120:        movl    #1,_openfirst   | mark this as the first open
                    121:        jsr     _main           | lets go
                    122: __rtt:
                    123:        movl    #3,_howto       | restarts get RB_SINGLE|RB_ASKNAME
                    124:        jmp     start
                    125: 
                    126: /*
                    127:  * probe a location and see if it causes a bus error
                    128:  */
                    129:        .globl  _badaddr
                    130: _badaddr:
                    131:        movl    BUSERR,__bsave  | save ROM bus error handler address
                    132:        movl    sp,__ssave      | and current stack pointer
                    133:        movl    #catchbad,BUSERR| plug in our handler
                    134:        movl    sp@(4),a0       | address to probe
                    135:        movw    a0@,d1          | do it
                    136:        movl    __bsave,BUSERR  | if we got here, it didn't fault
                    137:        clrl    d0              | return that this was not a bad addr
                    138:        rts
                    139: 
                    140: catchbad:
                    141:        movl    __bsave,BUSERR  | got a bus error, so restore old handler
                    142:        movl    __ssave,sp      | manually restore stack
                    143:        moveq   #1,d0           | indicate that we got a fault
                    144:        rts                     | return to caller of badaddr()
                    145: 
                    146: __bsave:
                    147:        .long   0
                    148: __ssave:
                    149:        .long   0
                    150: 
                    151:        .globl  _trap
                    152: trap:
                    153:        moveml  #0xFFFF,sp@-    | save registers
                    154:        movl    sp,sp@-         | push pointer to frame
                    155:        jsr     _trap           | call C routine to deal with it
                    156:        stop    #0x2700         | stop cold
                    157: 
                    158: nmi:
                    159:        movw    #18,BOOTTYPE    | mark as system switch
                    160:        jsr     _kbdnmi         | clear the interrupt
                    161:        jra     begin           | start over
                    162: 
                    163: #ifdef ROMPRF
                    164:        .globl  _romout
                    165: _romout:
                    166:        movl    sp@(4),d0       | line number
                    167:        movl    sp@(8),a0       | string
                    168:        jsr     0x150           | do it
                    169:        rts
                    170: #endif

unix.superglobalmegacorp.com

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