1: /*
   2:  * Copyright (c) 1987 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:  *	@(#)mch_start.s	1.4 (2.11BSD GTE) 8/23/93
   7:  */
   8: 
   9: #include "DEFS.h"
  10: #include "../machine/mch_iopage.h"
  11: #include "../machine/mch_cpu.h"
  12: #include "../machine/trap.h"
  13: 
  14: ASENTRY(start)
  15:         bit     $1,SSR0                 / is memory management enabled?
  16:         beq     .                       / better be !!!
  17: 
  18:         mov     r0,_cputype             / save cpu type passed by boot
  19:         /*
  20: 	 * The following two instructions change the contents of the "sys"
  21: 	 * instruction vector (034-037) to read:
  22: 	 *	syscall; br0+T_SYSCALL
  23: 	 */
  24:         mov     $syscall,34
  25:         mov     $0+T_SYSCALL,36
  26: 
  27: #ifdef KERN_NONSEP
  28:         movb    $RO,KISD0               / Turn off write permission on kernel
  29:                                         /   low text
  30: #endif
  31: 
  32:         mov     $USIZE-1\<8|RW,KDSD6    / Get a stack pointer (_u + 64*USIZE)
  33:         mov     $_u+[USIZE*64.],sp
  34: 
  35: #ifdef INET
  36:         /*
  37: 	 * Initial set up for SUPERVISOR space networking: set SUPERVISOR
  38: 	 * space as split I&D, set stack pointer and map user area and I/O
  39: 	 * page.
  40: 	 */
  41:         bis     $2,SSR3                 / split i/d for supervisor network
  42:         mov     PS,-(sp)                / set SUPERVISOR sp to NET_STOP
  43:         mov     $010340,PS
  44:         mov     $NET_STOP,-(sp)
  45:         mtpd    sp
  46:         mov     (sp)+,PS
  47:         mov     KDSA6,SDSA6             / map user area and I/O page
  48:         mov     KDSD6,SDSD6
  49:         mov     KDSD7,SDSD7
  50:         mov     KDSA7,SDSA7
  51: #endif
  52: 
  53:         mov     $_u,r0                  / Clear user block
  54: 1:
  55:         clr     (r0)+
  56:         cmp     r0,sp
  57:         blo     1b
  58: 
  59:         /*
  60: 	 * Get bootflags and leave them in _initflags; the bootstrap leaves
  61:  	 * them in r4.  R2 should be the complement of bootflags.
  62: 	 */
  63:         com     r2                      / if r4 != ~r2
  64:         cmp     r4,r2
  65:         beq     1f
  66:         mov     $RB_SINGLE,r4           /   r4 = RB_SINGLE
  67: 1:
  68:         mov     r1,_bootcsr             / save boot controller csr
  69:         mov     r3,_bootdev             / save boot device major,unit
  70:         mov     r4,_boothowto           / save boot flags
  71:         mov     $_initflags+6,r2        / get a pointer to the \0 in _initflags
  72:         mov     r4,r1                   / r1 = boot options
  73: 1:
  74:         clr     r0                      / r0:r1 = (long)r1
  75:         div     $10.,r0                 / r0 = r0:r1 / 10; r1 = r0:r1 % 10
  76:         add     $'0,r1                  / bias by ASCII '0'
  77:         movb    r1,-(r2)                /   and stuff into _initflags
  78:         mov     r0,r1                   / shift quotient and continue
  79:         bne     1b                      /   if non-zero
  80: 
  81:         /* Check out (and if necessary, set up) the hardware. */
  82:         jsr     pc,hardprobe
  83: 
  84:         /*
  85: 	 * Set up previous mode and call main.  On return, set user stack
  86: 	 * pointer and enter user mode at location zero to execute the
  87: 	 * init thunk _icode copied out in main.
  88: 	 */
  89:         mov     $30340,PS               / set current kernel mode, previous
  90:                                         /   mode to user, spl7, make adb
  91:         clr     r5                      /   find end of kernel stack frames
  92:         jsr     pc,_main                / call main
  93:         mov     $177776,-(sp)           / set init thunk stack pointer to top
  94:         mtpd    sp                      /   of memory ...
  95:         mov     $170000,-(sp)           / set up pseudo trap frame: user/user
  96:         clr     -(sp)                   /   mode, location zero,
  97:         rtt                             /   and book ...
  98: 
  99:         .data
 100: /*
 101:  * Icode is copied out to process 1 to exec /etc/init.
 102:  * If the exec fails, process 1 exits.
 103:  */
 104: .globl  _initflags, _szicode, _boothowto, _bootcsr, _bootdev
 105: 
 106: ENTRY(icode)
 107:         mov     $argv-_icode,-(sp)
 108:         mov     $init-_icode,-(sp)
 109:         tst     -(sp)                   / simulate return address stack spacing
 110:         sys     SYS_execv
 111:         sys     SYS_exit
 112: init:
 113:         </etc/init\0>
 114: _initflags:
 115:         <-00000\0>                      / decimal ASCII initflags
 116:         .even
 117: argv:
 118:         init+5-_icode                   / address of "init\0"
 119:         _initflags-_icode
 120:         0
 121: _szicode:
 122:         _szicode-_icode
 123: _boothowto:
 124:         0                               / boot flags passed by boot
 125: _bootdev:
 126:         0                               / boot major#,unit
 127: _bootcsr:
 128:         0                               / csr of booting controller
 129:         .text
 130: 
 131: /*
 132:  * Determine a couple of facts about the hardware and finishing setting
 133:  * up what 'boot' hasn't done already.
 134: 
 135:  * We use the cpu type passed thru from /boot.  No sense in duplicating
 136:  * that code here in the kernel.  We do have to repeat the KDJ-11 test
 137:  * (for use in trap.c) though.  /boot also stuffed the right bits into
 138:  * the MSCR register to disable cache and unibus traps.
 139:  */
 140: hardprobe:
 141:         mov     $1f,nofault
 142:         setd
 143:         inc     _fpp
 144: 1:
 145: 
 146:         /*
 147: 	 * Test for SSR3 and UNIBUS map capability.  If there is no SSR3, the
 148: 	 * first test of SSR3 will trap and we skip past the separate I/D test.
 149: 	 * 2.11BSD will be _seriously_ upset if I/D is not available!
 150: 	 */
 151:         mov     $2f,nofault
 152:         bit     $40,SSR3
 153:         beq     1f
 154:         incb    _ubmap
 155: 1:
 156:         bit     $1,SSR3                 / Test for separate I/D capability
 157:         beq     2f
 158:         incb    _sep_id
 159: 2:
 160:                 / Test for stack limit register; set it if present.
 161:         mov     $1f,nofault
 162:         mov     $intstk-256.,STACKLIM
 163: 1:
 164:         clr     _kdj11
 165:         mov     $1f,nofault
 166:         mfpt
 167:         cmp     r0,$5                   / KDJ-11 returns 5 (11/44 returns 1)
 168:         bne     1f
 169:         mov     r0,_kdj11
 170: 1:
 171: #ifdef ENABLE34
 172:         /*
 173: 	 * Test for an ENABLE/34.  We are very cautious since the ENABLE's
 174: 	 * PARs are in the range of the floating addresses.
 175: 	 */
 176:         tstb    _ubmap
 177:         bne     2f
 178:         mov     $2f,nofault
 179:         mov     $32.,r0
 180:         mov     $ENABLE_KISA0,r1
 181: 1:
 182:         tst     (r1)+
 183:         sob     r0,1b
 184: 
 185:         tst     *$PDP1170_LEAR
 186:         tst     *$ENABLE_SSR3
 187:         tst     *$ENABLE_SSR4
 188:         incb    _enable34
 189:         incb    _ubmap
 190: 
 191:         /*
 192: 	 * Turn on an ENABLE/34.  Enableon() is a C routine which does a PAR
 193: 	 * shuffle and turns mapping on.
 194: 	 */
 195: 
 196: .data
 197: _UISA:  DEC_UISA
 198: _UDSA:  DEC_UDSA
 199: _KISA0: DEC_KISA0
 200: _KISA6: DEC_KISA6
 201: _KDSA1: DEC_KDSA1
 202: _KDSA2: DEC_KDSA2
 203: _KDSA5: DEC_KDSA5
 204: _KDSA6: DEC_KDSA6
 205: 
 206: .text
 207:         mov     $ENABLE_UISA, _UISA
 208:         mov     $ENABLE_UDSA, _UDSA
 209:         mov     $ENABLE_KISA0, _KISA0
 210:         mov     $ENABLE_KISA6, _KISA6
 211:         mov     $ENABLE_KDSA1, _KDSA1
 212:         mov     $ENABLE_KDSA2, _KDSA2
 213:         mov     $ENABLE_KDSA5, _KDSA5
 214:         mov     $ENABLE_KDSA6, _KDSA6
 215:         mov     $ENABLE_KDSA6, _ka6
 216:         jsr     pc, _enableon
 217: 
 218: 2:
 219: #endif ENABLE34
 220: 
 221:         clr     nofault                 / clear fault trap and return
 222:         rts     pc

Defined functions

_icode defined in line 106; used 6 times
hardprobe defined in line 140; used 1 times
  • in line 82
start defined in line 14; used 1 times

Defined variables

_KDSA1 defined in line 201; used 1 times
_KDSA2 defined in line 202; used 1 times
_KDSA5 defined in line 203; used 1 times
_KDSA6 defined in line 204; used 1 times
_KISA0 defined in line 199; used 1 times
_KISA6 defined in line 200; used 1 times
_UDSA defined in line 198; used 1 times
_UISA defined in line 197; used 1 times
_bootdev declared in line 104; defined in line 125; used 3 times
_boothowto declared in line 104; defined in line 123; used 2 times
_initflags declared in line 104; defined in line 114; used 3 times
_szicode declared in line 104; defined in line 121; used 5 times
argv defined in line 117; used 1 times
init defined in line 112; used 2 times
Last modified: 1993-08-24
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3260
Valid CSS Valid XHTML 1.0 Strict