# 2.11BSD#431 - /usr/src/sys/pdp/mch_dump.s

##### Functions

    _saveregs         X
    _savestate        X
    dump              X

##### Variables

    suprsav           X

       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_dump.s	1.3 (2.11BSD GTE) 12/24/92
       7:  */
       8: #include "DEFS.h"
       9: #include "../machine/mch_iopage.h"
      10:
      11: /*
      12:  * Save regs r0, r1, r2, r3, r4, r5, r6, K[DI]SA6
      13:  * starting at data location 0300, in preparation for dumping core.
      14:  */
      15: ENTRY(saveregs)
      16: #ifdef KERN_NONSEP
      17:         movb    $RW, KISD0              / write enable
      18: #endif KERN_NONSEP
      19:         mov     r0,300
      20:         mov     $302,r0
      21:         mov     r1,(r0)+
      22:         mov     r2,(r0)+
      23:         mov     r3,(r0)+
      24:         mov     r4,(r0)+
      25:         mov     r5,(r0)+
      26:         mov     sp,(r0)+
      27:         mov     KDSA6,(r0)+
      28:         mov     KDSA5,(r0)+
      29:         rts     pc
      30:
      31: #ifdef  INET
      32:
      33: SPACE(GLOBAL, suprsav, 32)
      34:
      35: /*
      36:  * Save ALL registers, KDSA[5,6], SDSA[5,6], SSR3.  Expressly for
      37:  * network crashes where the state at the time of initial trap is
      38:  * desired rather than after thrashing about on the way to a 'panic'.
      39:  * Also, this is extensible so that as much volatile information as
      40:  * required may be saved.  Currently 14 of the 16 words allocated are used.
      41:  * Multiple entries into this routine should be blocked by making the
      42:  * call to this routine conditional on 'netoff' being set and
      43:  * setting 'netoff' on the first call.  Must be at splhigh upon entry.
      44: */
      45:
      46: ENTRY(savestate)
      47:         mov     r0,suprsav
      48:         mov     $suprsav+2,r0
      49:         mov     r1,(r0)+
      50:         mov     r2,(r0)+
      51:         mov     r3,(r0)+
      52:         mov     r4,(r0)+
      53:         mov     r5,(r0)+
      54:         mov     sp,(r0)+
      55:         mov     PS,-(sp)
      56:         mov     $010340,PS      /previous super, spl7
      57:         mfpd    sp              /fetch supervisor stack pointer
      58:         mov     (sp)+,(r0)+
      59:         mov     $030340,PS      /previous user, spl7
      60:         mfpd    sp              /fetch user stack pointer
      61:         mov     (sp)+,(r0)+
      62:         mov     (sp)+,PS
      63:         mov     KDSA5,(r0)+
      64:         mov     KDSA6,(r0)+
      65:         mov     SDSA5,(r0)+
      66:         mov     SDSA6,(r0)+
      67:         mov     SSR3,(r0)+
      68:         rts     pc
      69: #endif
      70:
      71: #include "ht.h"
      72: #include "tm.h"
      73: #include "ts.h"
      74:
      75: /*
      76:  * Mag tape dump -- save registers in low core and write core (up to 248K)
      77:  * onto mag tape.  Entry is through 044 (physical) with memory management off.
      78:  */
      79:
      80: #ifndef KERN_NONSEP
      81: .data
      82: #endif !KERN_NONSEP
      83:
      84: ASENTRY(dump)
      85: #if NHT > 0 || NTM > 0 || NTS > 0
      86:         /*
      87: 	 * save regs r0, r1, r2, r3, r4, r5, r6, KIA6
      88: 	 * starting at location 4 (physical)
      89: 	 */
      90:         inc     $-1                     / check for first time
      91:         bne     1f                      / if not, don't save registers again
      92:         mov     r0,300
      93:         mov     $302,r0
      94:         mov     r1,(r0)+
      95:         mov     r2,(r0)+
      96:         mov     r3,(r0)+
      97:         mov     r4,(r0)+
      98:         mov     r5,(r0)+
      99:         mov     sp,(r0)+
     100:         mov     KDSA6,(r0)+
     101: 1:
     102:
     103:         /*
     104: 	 * dump all of core (i.e. to first mt error)
     105: 	 * onto mag tape. (9 track or 7 track 'binary')
     106: 	 */
     107:
     108: #if NHT > 0
     109:
     110: HT      = 0172440
     111: HTCS1   = HT+0
     112: HTWC    = HT+2
     113: HTBA    = HT+4
     114: HTFC    = HT+6
     115: HTCS2   = HT+10
     116: HTTC    = HT+32
     117:
     118:         mov     $HTCS1,r0
     119:         mov     $40,*$HTCS2
     120:         mov     $2300,*$HTTC
     121:         clr     *$HTBA
     122:         mov     $1,(r0)
     123: 1:
     124:         mov     $-512.,*$HTFC
     125:         mov     $-256.,*$HTWC
     126:         movb    $61,(r0)
     127: 2:
     128:         tstb    (r0)
     129:         bge     2b
     130:         bit     $1,(r0)
     131:         bne     2b
     132:         bit     $40000,(r0)
     133:         beq     1b
     134:         mov     $27,(r0)
     135: #else !NHT > 0
     136:
     137: #if NTM > 0
     138:
     139: MTC     = 172522
     140: IO      = 0177600
     141: UBMR0   = 0170200
     142:
     143:         /*
     144: 	 * register usage is as follows:
     145: 	 *
     146: 	 * reg 0 -- holds the tm11 CSR address
     147: 	 * reg 1 -- points to UBMAP register 0 low
     148: 	 * reg 2 -- is used to contain and calculate memory pointer
     149: 	 *	    for UBMAP register 0 low
     150: 	 * reg 3 -- is used to contain and calculate memory pointer
     151: 	 *	    for UBMAP register 0 high
     152: 	 * reg 4 -- r4 = 1 for map used, r4 = 0 for map not used
     153: 	 * reg 5 -- is used as an interation counter when mapping is enabled
     154: 	 */
     155:
     156:         movb    _ubmap,r4               / UB map used indicator
     157:         beq     2f                      / no UBMAP - br
     158: 1:
     159:         /*
     160: 	 * This section of code initializes the Unibus map registers and
     161: 	 * and the memory management registers.
     162: 	 * UBMAP reg 0 gets updated to point to the current memory area.
     163: 	 * Kernal I space 0 points to low memory
     164: 	 * Kernal I space 7 points to the I/O page.
     165: 	 */
     166:
     167:         mov     $UBMR0,r1               / point to  map register 0
     168:         clr     r2                      / init for low map reg
     169:         clr     r3                      / init for high map reg
     170:         mov     $77406,*$KISD0          / set KISDR0
     171:         mov     $77406,*$KISD7          / set KISDR7
     172:         clr     *$KISA0                 / point KISAR0 to low memory
     173:         mov     $IO,*$KISA7             / point KISAR7 to IO page
     174:         inc     *$SSR0                  / turn on memory mngt
     175:         mov     $60,*$SSR3              / enable 22 bit mapping
     176:         mov     r2,(r1)                 / load map reg 1 low
     177:         mov     r3,2(r1)                / load map reg 1 high
     178: 2:
     179:         / this section of code initializes the TM11
     180:
     181:         mov     $MTC,r0
     182:         mov     $60004,(r0)
     183:         clr     4(r0)
     184:         mov     $20,r5                  / set up SOB counter for UBMAP
     185:
     186:         /*
     187: 	 * This section does the write; if mapping is needed the sob loop
     188: 	 * comes in play here.  When the sob falls through the UBMAP reg
     189: 	 * will be updated by 20000 to point to next loop section.
     190: 	 * If mapping not needed then just let bus address register increment.
     191: 	 */
     192: 3:
     193:         mov     $-512.,2(r0)            / set byte count
     194:         inc     (r0)                    / start xfer
     195: 1:
     196:         tstb    (r0)                    / wait for tm11 ready
     197:         bge     1b */
     198:         tst     (r0)                    / any error
     199:         bge     2f                      / no, continue xfer
     200:         bit     $200,-2(r0)             / yes, must be NXM error
     201:         beq     .                       / hang if not
     202:         reset                           / error was NXM
     203:         mov     $60007,(r0)             / write EOF
     204:         halt                            / halt on good dump
     205: 2:
     206:         tst     r4                      / mapping
     207:         beq     3b                      / branch if not
     208:         sob     r5,3b                   / yes, continue loop
     209:         mov     $20,r5                  / reset loop count
     210:         add     $20000,r2               / bump low map
     211:         adc     r3                      / carry to high map
     212:         mov     r2,(r1)                 / load map reg 0 low
     213:         mov     r3,2(r1)                / load map reg 0 high
     214:         clr     4(r0)                   / set bus address to 0
     215:         br      3b                      / do some more
     216:
     217: #else !NTM > 0
     218:
     219: #if NTS > 0
     220:
     221: TSDB    = 0172520
     222: TSSR    = 0172522
     223: IO      = 0177600
     224: UBMR0   = 0170200
     225:
     226:         /*
     227: 	 * register usage is as follows:
     228: 	 *
     229: 	 * reg 0 -- points to UBMAP register 1 low
     230: 	 * reg 1 -- is used to calculate the current memory address
     231: 	 *	    for each 512 byte transfer.
     232: 	 * reg 2 -- is used to contain and calculate memory pointer
     233: 	 *	    for UBMAP register 1 low
     234: 	 * reg 3 -- is used to contain and calculate memory pointer
     235: 	 *	    for UBMAP register 1 high
     236: 	 * reg 4 -- points to the command packet
     237: 	 * reg 5 -- is used as an interation counter when mapping is enabled
     238: 	 */
     239:
     240:         movb    _ubmap,setmap           / unibus map present?
     241:         beq     2f                      / no, skip map init
     242:
     243:         /*
     244: 	 * This section of code initializes the Unibus map registers and
     245: 	 * and the memory management registers.
     246: 	 * UBMAP reg 0 points to low memory for the TS11 command,
     247: 	 * characteristics, and message buffers.
     248: 	 * UBMAP reg 1 gets updated to point to the current memory area.
     249: 	 * Kernal I space 0 points to low memory
     250: 	 * Kernal I space 7 points to the I/O page.
     251: 	 */
     252:
     253:         mov     $UBMR0,r0               / point to  map register 0
     254:         clr     r2                      / init for low map reg
     255:         clr     r3                      / init for high map reg
     256:         clr     (r0)+                   / load map reg 0 low
     257:         clr     (r0)+                   / load map reg 0 high
     258:         mov     $77406,*$KISD0          / set KISDR0
     259:         mov     $77406,*$KISD7          / set KISDR7
     260:         clr     *$KISA0                 / point KISAR0 to low memory
     261:         mov     $IO,*$KISA7             / point KISAR7 to IO page
     262:         inc     *$SSR0                  / turn on memory mngt
     263:         mov     $60,*$SSR3              / enable 22 bit mapping
     264:         mov     r2,(r0)                 / load map reg 1 low
     265:         mov     r3,2(r0)                / load map reg 1 high
     266: 2:
     267:         / this section of code initializes the TS11
     268:
     269:         tstb    *$TSSR                  / make sure
     270:         bpl     2b                      / drive is ready
     271:         mov     $comts,r4               / point to command packet
     272:         add     $2,r4                   / set up mod 4
     273:         bic     $3,r4                   / alignment
     274:         mov     $140004,(r4)            / write characteristics command
     275:         mov     $chrts,2(r4)            / characteristics buffer
     276:         clr     4(r4)                   / clear ext mem addr (packet)
     277:         clr     tsxma                   / clear extended memory save loc
     278:         mov     $10,6(r4)               / set byte count for command
     279:         mov     $mests,*$chrts          / show where message buffer is
     280:         clr     *$chrts+2               / clear extended memory bits here too
     281:         mov     $16,*$chrts+4           / set message buffer length
     282:         mov     r4,*$TSDB               / start command
     283:         mov     $20,r5                  / set up SOB counter for UBMAP
     284:         clr     r1                      / init r1 beginning memory address
     285: 1:
     286:         tstb    *$TSSR                  / wait for ready
     287:         bpl     1b                      / not yet
     288:         mov     *$TSSR,tstcc            / error condition (SC)?
     289:         bpl     2f                      / no error
     290:         bic     $!16,tstcc              / yes error, get TCC
     291:         cmp     tstcc,$10               / recoverable error?
     292:         bne     8f                      / no
     293:         mov     $101005,(r4)            / yes, load write data retry command
     294:         clr     4(r4)                   / clear packet ext mem addr
     295:         mov     r4,*$TSDB               / start retry
     296:         br      1b
     297: 8:
     298:         bit     $4000,*$TSSR            / is error NXM?
     299:         beq     .                       / no, hang (not sure of good dump)
     300:         mov     $140013,(r4)            / load a TS init command
     301:         mov     r4,*$TSDB               / to clear NXM error
     302: 6:
     303:         tstb    *$TSSR                  / wait for ready
     304:         bpl     6b
     305:         mov     $1,6(r4)                / set word count = 1
     306:         mov     $100011,(r4)            / load write EOF command
     307:         mov     r4,*$TSDB               / do write EOF
     308: 7:
     309:         tstb    *$TSSR                  / wait for ready
     310:         bpl     7b
     311:         halt                            / halt after good dump
     312: 9:
     313:         br      1b
     314: 2:
     315:         /*
     316: 	 * If mapping is needed this section calculates the base address to
     317: 	 * be loaded into map reg 1; the algorithm is (!(r5 - 21))*1000) |
     318: 	 * 20000.  The complement is required because an SOB loop is being
     319: 	 * used for the counter.  This loop causes 20000 bytes to be written
     320: 	 * before the UBMAP is updated.
     321: 	 */
     322:
     323:         tst     setmap                  / UBMAP?
     324:         beq     3f                      / no map
     325:         mov     r2,(r0)                 / load map reg 1 low
     326:         mov     r3,2(r0)                / load map reg 1 high
     327:         mov     r5,r1                   / calculate
     328:         sub     $21,r1                  / address for this pass
     329:         com     r1                      / based on current
     330:         mul     $1000,r1                / interation
     331:         bis     $20000,r1               / select map register 1
     332:         clr     4(r4)                   / clear extended memory bits
     333: 3:
     334:         /*
     335: 	 * This section does the write.  If mapping is needed the sob loop
     336: 	 * comes in play here.  When the sob falls through the UBAMP reg will
     337: 	 * be updated by 20000 to point to next loop section.  If mapping not
     338: 	 * needed then just calculate the next 512 byte address pointer.
     339: 	 */
     340:
     341:         mov     r1,2(r4)                / load mem address
     342:         mov     tsxma,4(r4)             / load ext mem address
     343:         mov     $512.,6(r4)             / set byte count
     344:         mov     $100005,(r4)            / set write command
     345:         mov     r4,*$TSDB               / initiate xfer
     346:         tst     setmap                  / mapping?
     347:         beq     4f                      / branch if not
     348:         sob     r5,9b                   / yes continue loop
     349:         mov     $20,r5                  / reset loop count
     350:         add     $20000,r2               / bump low map
     351:         adc     r3                      / carry to high map
     352:         br      1b                      / do some more
     353: 4:
     354:         add     $512.,r1                / bump address for no mapping
     355:         adc     tsxma                   / carry to extended memory bits
     356:         br      1b                      / do again
     357:
     358: /*
     359:  * The following TS11 command and message buffers, must be in initialized data
     360:  * space instead of bss space.  This allows them to be mapped by the first
     361:  * M/M mapping register, which is the only one used durring a core dump.
     362:  */
     363:
     364: tsxma:  0                               / ts11 extended memory address bits
     365: setmap: 0                               / UB map usage indicator
     366: tstcc:  0                               / ts11 temp location for TCC
     367: comts:                                  / ts11 command packet
     368:         0 ; 0 ; 0 ; 0 ; 0
     369: chrts:                                  / ts11 characteristics
     370:         0 ; 0 ; 0 ; 0
     371: mests:                                  / ts11 message buffer
     372:         0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0
     373:
     374: #endif NTS
     375: #endif NTM
     376: #endif NHT
     377: #endif NHT || NTM || NTS
     378:
     379: br      .                               / If no tape drive, fall through to here

#### Defined functions

_saveregs defined in line 15; used 1 times

- in /usr/src/sys/pdp/machdep2.c line 426

_savestate defined in line 46; used 1 times

- in /usr/src/sys/pdp/trap.c line 270

dump defined in line 84; used 1 times

- in /usr/src/sys/pdp/scb.s line 98

#### Defined variables

HT defined in line 110; used 6 times

- in line 111-116(6)

HTBA defined in line 113; used 1 times

- in line 121

HTCS1 defined in line 111; used 1 times

- in line 118

HTCS2 defined in line 115; used 1 times

- in line 119

HTFC defined in line 114; used 1 times

- in line 124

HTTC defined in line 116; used 1 times

- in line 120

HTWC defined in line 112; used 1 times

- in line 125

IO defined in line 223; used 2 times

- in line 173, 261

MTC defined in line 139; used 1 times

- in line 181

TSDB defined in line 221; used 5 times

- in line 282, 295, 301, 307, 345

TSSR defined in line 222; used 6 times

- in line 269, 286-288(2), 298-303(2), 309

UBMR0 defined in line 224; used 2 times

- in line 167, 253

chrts defined in line 369; used 4 times

- in line 275-281(4)

comts defined in line 367; used 1 times

- in line 271

mests defined in line 371; used 1 times

- in line 279

setmap defined in line 365; used 3 times

- in line 240, 323, 346

suprsav defined in line 33; used 2 times

- in line 47-48(2)

tstcc defined in line 366; used 3 times

- in line 288-291(3)

tsxma defined in line 364; used 3 times

- in line 277, 342, 355

Last modified: 1992-12-25 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 920 |