1: #ifdef LOCORE
   2: #define P_LINK 0
   3: #define P_RLINK 4
   4: #define P_XLINK 108
   5: #define P_ADDR 16
   6: #define P_PRI 21
   7: #define P_STAT 23
   8: #define P_WCHAN 96
   9: #define P_TSIZE 68
  10: #define P_DSIZE 72
  11: #define P_SSIZE 76
  12: #define P_P0BR 104
  13: #define P_SZPT 66
  14: #define P_TEXTP 100
  15: #define P_FLAG 44
  16: #define SSLEEP 1
  17: #define SRUN 3
  18: #define UBA_BRRVR 48
  19: #define UH_UBA 0
  20: #define UH_VEC 8
  21: #define UH_SIZE 64
  22: #define RP_FLAG 12
  23: #define X_CADDR 64
  24: #define V_SWTCH 0
  25: #define V_TRAP 4
  26: #define V_SYSCALL 8
  27: #define V_INTR 12
  28: #define V_SOFT 16
  29: #define V_PDMA 20
  30: #define V_FAULTS 92
  31: #define V_PGREC 52
  32: #define V_FASTPGREC 112
  33: #define UPAGES 10
  34: #define CLSIZE 2
  35: #define SYSPTSIZE 3584
  36: #define USRPTSIZE 4096
  37: #define MSGBUFPTECNT 8
  38: #define NMBCLUSTERS 256
  39: #define U_PROCP 128
  40: #define U_RU 1640
  41: #define RU_MINFLT 32
  42: #else
  43: asm(".set	U_ARG,156");
  44: asm(".set	U_QSAVE,192");
  45: #endif
  46: /*
  47:  * Copyright (c) 1982, 1986 Regents of the University of California.
  48:  * All rights reserved.  The Berkeley software License Agreement
  49:  * specifies the terms and conditions for redistribution.
  50:  *
  51:  *	@(#)rpb.s	7.1 (Berkeley) 6/5/86
  52:  */
  53: 
  54: /*
  55:  * This has to get loaded first (physical 0) as 780 memory restart rom
  56:  * only looks for rpb on a 64K page boundary (doc isn't wrong,
  57:  * it never says what size "page boundary" rpb has to be on).
  58:  */
  59:     .globl  _rpb
  60: _rpb:
  61:     .space  508
  62: erpb:
  63:     .space  4
  64: /*
  65:  * Copyright (c) 1982, 1986 Regents of the University of California.
  66:  * All rights reserved.  The Berkeley software License Agreement
  67:  * specifies the terms and conditions for redistribution.
  68:  *
  69:  *	@(#)scb.s	7.1 (Berkeley) 6/5/86
  70:  */
  71: 
  72: #include "uba.h"
  73: 
  74: /*
  75:  * System control block
  76:  */
  77:     .set    INTSTK,1    # handle this interrupt on the interrupt stack
  78:     .set    HALT,3      # halt if this interrupt occurs
  79: 
  80: _scb:   .globl  _scb
  81: 
  82: #define STRAY   .long   _Xstray+INTSTK
  83: #define STRAY8  STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY
  84: #define STRAY15 STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY8
  85: #define KS(a)   .long   _X/**/a
  86: #define IS(a)   .long   _X/**/a+INTSTK
  87: #define STOP(a) .long   _X/**/a+HALT
  88: 
  89: /* 000 */   STRAY;      IS(machcheck);  IS(kspnotval);  STOP(powfail);
  90: /* 010 */   KS(privinflt);  KS(xfcflt); KS(resopflt);   KS(resadflt);
  91: /* 020 */   KS(protflt);    KS(transflt);   KS(tracep); KS(bptflt);
  92: /* 030 */   KS(compatflt);  KS(arithtrap);  STRAY;      STRAY;
  93: /* 040 */   KS(syscall);    KS(chme);   KS(chms);   KS(chmu);
  94: /* 050 */   STRAY;      IS(cmrd);   STRAY;      STRAY;
  95: /* 060 */   IS(wtime);  STRAY;      STRAY;      STRAY;
  96: /* 070 */   STRAY;      STRAY;      STRAY;      STRAY;
  97: /* 080 */   STRAY;      STRAY;      KS(astflt); STRAY;
  98: /* 090 */   STRAY;      STRAY;      STRAY;      STRAY;
  99: /* 0a0 */   IS(softclock);  STRAY;      STRAY;      STRAY;
 100: /* 0b0 */   IS(netintr);    STRAY;      STRAY;      STRAY;
 101: /* 0c0 */   IS(hardclock);  STRAY;      KS(emulate);    KS(emulateFPD);
 102: /* 0d0 */   STRAY;      STRAY;      STRAY;      STRAY;
 103: /* 0e0 */   STRAY;      STRAY;      STRAY;      STRAY;
 104: /* 0f0 */   IS(consdin);    IS(consdout);   IS(cnrint); IS(cnxint);
 105: /* 100 */   IS(nexzvec); STRAY15;       /* ipl 0x14, nexus 0-15 */
 106: /* 140 */   IS(nexzvec); STRAY15;       /* ipl 0x15, nexus 0-15 */
 107: /* 180 */   IS(nexzvec); STRAY15;       /* ipl 0x16, nexus 0-15 */
 108: /* 1c0 */   IS(nexzvec); STRAY15;       /* ipl 0x17, nexus 0-15 */
 109: 
 110:     .globl  _UNIvec
 111: _UNIvec:    .space  512     # 750 unibus intr vector
 112:                     # 1st UBA jump table on 780's
 113: #if NUBA > 1
 114:     .globl  _UNI1vec
 115: _UNI1vec:   .space  512     # 750 second unibus intr vector
 116:                     # 2nd UBA jump table on 780's
 117: #endif
 118: #define I_CLOCK 0
 119: #define I_CNR   4
 120: #define I_CNX   8
 121: #define I_TUR   12
 122: #define I_TUX   16
 123: #define I_MBA0  20
 124: #define I_MBA1  24
 125: #define I_MBA2  28
 126: #define I_MBA3  32
 127: #define I_UBA0  36
 128: #define I_UBA1  40
 129: #define I_UBA2  44
 130: #define I_UBA3  48
 131: /*
 132:  * Copyright (c) 1980, 1986 Regents of the University of California.
 133:  * All rights reserved.  The Berkeley software License Agreement
 134:  * specifies the terms and conditions for redistribution.
 135:  *
 136:  *	@(#)locore.s	7.1 (Berkeley) 6/5/86
 137:  */
 138: 
 139: #include "psl.h"
 140: #include "pte.h"
 141: 
 142: #include "errno.h"
 143: #include "cmap.h"
 144: 
 145: #include "mtpr.h"
 146: #include "trap.h"
 147: #include "cpu.h"
 148: #include "nexus.h"
 149: #include "cons.h"
 150: #include "clock.h"
 151: #include "ioa.h"
 152: #include "ka630.h"
 153: #include "../vaxuba/ubareg.h"
 154: 
 155: #include "dz.h"
 156: #include "uu.h"
 157: #include "ps.h"
 158: #include "mba.h"
 159: #include "uba.h"
 160: 
 161:     .set    HIGH,0x1f   # mask for total disable
 162:     .set    MCKVEC,4    # offset into scb of machine check vector
 163:     .set    NBPG,512
 164:     .set    PGSHIFT,9
 165: 
 166:     .set    NISP,3      # number of interrupt stack pages
 167: 
 168: /*
 169:  * User structure is UPAGES at top of user space.
 170:  */
 171:     .globl  _u
 172:     .set    _u,0x80000000 - UPAGES*NBPG
 173: 
 174:     .globl  _intstack
 175: _intstack:
 176:     .space  NISP*NBPG
 177: eintstack:
 178: 
 179: /*
 180:  * Do a dump.
 181:  * Called by auto-restart.
 182:  * May be called manually.
 183:  */
 184:     .align  2
 185:     .globl  _doadump
 186: _doadump:
 187:     nop; nop                # .word 0x0101
 188: #define _rpbmap _Sysmap             # rpb, scb, UNI*vec, istack*4
 189:     bicl2   $PG_PROT,_rpbmap
 190:     bisl2   $PG_KW,_rpbmap
 191:     mtpr    $0,$TBIA
 192:     tstl    _rpb+RP_FLAG            # dump only once!
 193:     bneq    1f
 194:     incl    _rpb+RP_FLAG
 195:     movl    sp,erpb
 196:     movab   erpb,sp
 197:     mfpr    $PCBB,-(sp)
 198:     mfpr    $MAPEN,-(sp)
 199:     mfpr    $IPL,-(sp)
 200:     mtpr    $0,$MAPEN
 201:     mtpr    $HIGH,$IPL
 202:     pushr   $0x3fff
 203:     calls   $0,_dumpsys
 204: 1:
 205:     pushl   $TXDB_BOOT
 206:     calls   $1,_tocons
 207:     halt
 208: 
 209: /*
 210:  * Interrupt vector routines
 211:  */
 212:     .globl  _waittime
 213: 
 214: #define SCBVEC(name)    .align 2; .globl _X/**/name; _X/**/name
 215: #define PANIC(msg)  clrl _waittime; pushab 1f; \
 216:             calls $1,_panic; 1: .asciz msg
 217: #define PRINTF(n,msg)   pushab 1f; calls $n+1,_printf; MSG(msg)
 218: #define MSG(msg)    .data; 1: .asciz msg; .text
 219: #define PUSHR       pushr $0x3f
 220: #define POPR        popr $0x3f
 221: 
 222:     .data
 223: nofault: .long  0   # where to go on predicted machcheck
 224:     .text
 225: SCBVEC(machcheck):
 226:     tstl    nofault
 227:     bneq    1f
 228:     PUSHR; pushab 6*4(sp); calls $1,_machinecheck; POPR;
 229:     addl2 (sp)+,sp; rei
 230:     .align  2
 231: 1:
 232:     casel   _cpu,$1,$VAX_MAX
 233: 0:
 234:     .word   8f-0b       # 1 is 780
 235:     .word   5f-0b       # 2 is 750
 236:     .word   5f-0b       # 3 is 730
 237:     .word   7f-0b       # 4 is 8600
 238:     .word   1f-0b       # ???
 239:     .word   1f-0b       # ???
 240:     .word   1f-0b       # ???
 241:     .word   1f-0b       # 8 is 630
 242: 5:
 243: #if defined(VAX750) || defined(VAX730)
 244:     mtpr    $0xf,$MCESR
 245: #endif
 246:     brb 1f
 247: 7:
 248: #if VAX8600
 249:     mtpr    $0,$EHSR
 250: #endif
 251:     brb 1f
 252: 8:
 253: #if VAX780
 254:     mtpr    $0,$SBIFS
 255: #endif
 256: 1:
 257:     addl2   (sp)+,sp        # discard mchchk trash
 258:     movl    nofault,(sp)
 259:     rei
 260: SCBVEC(kspnotval):
 261:     PUSHR; PANIC("KSP not valid");
 262: SCBVEC(powfail):
 263:     halt
 264: SCBVEC(chme): SCBVEC(chms): SCBVEC(chmu):
 265:     PUSHR; PANIC("CHM? in kernel");
 266: SCBVEC(stray):
 267:     PUSHR; PRINTF(0, "stray scb interrupt\n"); POPR;
 268:     rei
 269: SCBVEC(nexzvec):
 270:     PUSHR; mfpr $IPL,-(sp); PRINTF(1, "nexus stray intr ipl%x\n"); POPR; rei
 271: SCBVEC(cmrd):
 272:     PUSHR; calls $0,_memerr; POPR; rei
 273: SCBVEC(wtime):
 274:     PUSHR; pushl 6*4(sp); PRINTF(1,"write timeout %x\n"); POPR;
 275:     PANIC("wtimo");
 276: 
 277: #if NMBA > 0
 278: SCBVEC(mba3int):
 279:     PUSHR; incl _intrcnt+I_MBA3; pushl $3; brb 1f
 280: SCBVEC(mba2int):
 281:     PUSHR; incl _intrcnt+I_MBA2; pushl $2; brb 1f
 282: SCBVEC(mba1int):
 283:     PUSHR; incl _intrcnt+I_MBA1; pushl $1; brb 1f
 284: SCBVEC(mba0int):
 285:     PUSHR; incl _intrcnt+I_MBA0; pushl $0
 286: 1:  calls $1,_mbintr
 287:     POPR
 288:     incl    _cnt+V_INTR
 289:     rei
 290: #endif
 291: 
 292: #if defined(VAX780) || defined(VAX8600)
 293: /*
 294:  * Registers for the uba handling code
 295:  */
 296: #define rUBANUM r0
 297: #define rUBAHD  r1
 298: #define rUVEC   r3
 299: #define rUBA    r4
 300: /* r2,r5 are scratch */
 301: 
 302: #define I_UBA   I_UBA0      /* base of UBA interrupt counters */
 303: 
 304: #if NUBA > 4
 305: SCBVEC(ua7int):
 306:     PUSHR; movl $7,rUBANUM; moval _uba_hd+(7*UH_SIZE),rUBAHD; brb 1f
 307: SCBVEC(ua6int):
 308:     PUSHR; movl $6,rUBANUM; moval _uba_hd+(6*UH_SIZE),rUBAHD; brb 1f
 309: SCBVEC(ua5int):
 310:     PUSHR; movl $5,rUBANUM; moval _uba_hd+(5*UH_SIZE),rUBAHD; brb 1f
 311: SCBVEC(ua4int):
 312:     PUSHR; movl $4,rUBANUM; moval _uba_hd+(4*UH_SIZE),rUBAHD; brb 1f
 313: #endif
 314: SCBVEC(ua3int):
 315:     PUSHR; movl $3,rUBANUM; moval _uba_hd+(3*UH_SIZE),rUBAHD; brb 1f
 316: SCBVEC(ua2int):
 317:     PUSHR; movl $2,rUBANUM; moval _uba_hd+(2*UH_SIZE),rUBAHD; brb 1f
 318: SCBVEC(ua1int):
 319:     PUSHR; movl $1,rUBANUM; moval _uba_hd+(1*UH_SIZE),rUBAHD; brb 1f
 320: SCBVEC(ua0int):
 321:     PUSHR; movl $0,rUBANUM; moval _uba_hd+(0*UH_SIZE),rUBAHD;
 322: 1:
 323:     mfpr    $IPL,r2             /* r2 = mfpr(IPL); */
 324:     movl    UH_UBA(rUBAHD),rUBA     /* uba = uhp->uh_uba; */
 325:     movl    UBA_BRRVR-0x14*4(rUBA)[r2],rUVEC
 326:                     /* uvec = uba->uba_brrvr[r2-0x14] */
 327: ubanorm:
 328:     bleq    ubaerror
 329:     addl2   UH_VEC(rUBAHD),rUVEC        /* uvec += uh->uh_vec */
 330:     bicl3   $3,(rUVEC),r1
 331:     jmp 2(r1)               /* 2 skips ``pushr $0x3f'' */
 332: ubaerror:
 333:     PUSHR; calls $0,_ubaerror; POPR     /* ubaerror r/w's r0-r5 */
 334:     tstl rUVEC; jneq ubanorm        /* rUVEC contains result */
 335:     incl _intrcnt+I_UBA[rUBANUM]
 336:     incl    _cnt+V_INTR
 337:     POPR
 338:     rei
 339: #endif
 340: SCBVEC(cnrint):
 341:     PUSHR; calls $0,_cnrint; POPR
 342:     incl _cnt+V_INTR
 343:     incl _intrcnt+I_CNR
 344:     rei
 345: SCBVEC(cnxint):
 346:     PUSHR; calls $0,_cnxint; POPR
 347:     incl _cnt+V_INTR
 348:     incl _intrcnt+I_CNX
 349:     rei
 350: SCBVEC(hardclock):
 351:     PUSHR
 352:     mtpr $ICCS_RUN|ICCS_IE|ICCS_INT|ICCS_ERR,$ICCS
 353: #if NPS > 0
 354:     pushl   4+6*4(sp); pushl 4+6*4(sp);
 355:     calls   $2,_psextsync
 356: #endif
 357:     pushl 4+6*4(sp); pushl 4+6*4(sp);
 358:     calls $2,_hardclock         # hardclock(pc,psl)
 359:     POPR;
 360:     incl    _cnt+V_INTR
 361:     incl    _intrcnt+I_CLOCK
 362:     rei
 363: SCBVEC(softclock):
 364:     PUSHR
 365:     pushl   4+6*4(sp); pushl 4+6*4(sp);
 366:     calls   $2,_softclock           # softclock(pc,psl)
 367:     POPR;
 368:     incl    _cnt+V_SOFT
 369:     rei
 370: 
 371: #include "../net/netisr.h"
 372:     .globl  _netisr
 373: SCBVEC(netintr):
 374:     PUSHR
 375: #include "imp.h"
 376: #if NIMP > 0
 377:     bbcc    $NETISR_IMP,_netisr,1f; calls $0,_impintr; 1:
 378: #endif
 379: #ifdef INET
 380:     bbcc    $NETISR_IP,_netisr,1f; calls $0,_ipintr; 1:
 381: #endif
 382: #ifdef NS
 383:     bbcc    $NETISR_NS,_netisr,1f; calls $0,_nsintr; 1:
 384: #endif
 385:     bbcc    $NETISR_RAW,_netisr,1f; calls $0,_rawintr; 1:
 386:     POPR
 387:     incl    _cnt+V_SOFT
 388:     rei
 389: 
 390: #if defined(VAX750) || defined(VAX730) || defined(VAX8600)
 391: SCBVEC(consdin):
 392:     PUSHR;
 393:     incl _intrcnt+I_TUR
 394:     casel   _cpu,$VAX_750,$VAX_8600
 395: 0:
 396:     .word   5f-0b       # 2 is VAX_750
 397:     .word   3f-0b       # 3 is VAX_730
 398:     .word   6f-0b       # 4 is VAX_8600
 399:     halt
 400: 5:
 401: #if defined(VAX750) && !defined(MRSP)
 402:     jsb tudma
 403: #endif
 404: 3:
 405: #if defined(VAX750) || defined(VAX730)
 406:     calls $0,_turintr
 407:     brb 2f
 408: #else
 409:     halt
 410: #endif
 411: 6:
 412: #if VAX8600
 413:     calls $0, _crlintr
 414: #else
 415:     halt
 416: #endif
 417: 2:
 418:     POPR;
 419:     incl _cnt+V_INTR;
 420:     rei
 421: #else
 422: SCBVEC(consdin):
 423:     halt
 424: #endif
 425: 
 426: #if defined(VAX750) || defined(VAX730)
 427: SCBVEC(consdout):
 428:     PUSHR; calls $0,_tuxintr; POPR
 429:     incl _cnt+V_INTR
 430:     incl _intrcnt+I_TUX
 431:     rei
 432: #else
 433: SCBVEC(consdout):
 434:     halt
 435: #endif
 436: 
 437: #if NDZ > 0
 438: /*
 439:  * DZ pseudo dma routine:
 440:  *	r0 - controller number
 441:  */
 442:     .align  1
 443:     .globl  dzdma
 444: dzdma:
 445:     mull2   $8*20,r0
 446:     movab   _dzpdma(r0),r3      # pdma structure base
 447:                     # for this controller
 448: dzploop:
 449:     movl    r3,r0
 450:     movl    (r0)+,r1        # device register address
 451:     movzbl  1(r1),r2        # get line number
 452:     bitb    $0x80,r2        # TRDY on?
 453:     beql    dzprei          # no
 454:     bicb2   $0xf8,r2        # clear garbage bits
 455:     mull2   $20,r2
 456:     addl2   r2,r0           # point at line's pdma structure
 457:     movl    (r0)+,r2        # p_mem
 458:     cmpl    r2,(r0)+        # p_mem < p_end ?
 459:     bgequ   dzpcall         # no, go call dzxint
 460:     movb    (r2)+,6(r1)     # dztbuf = *p_mem++
 461:     movl    r2,-8(r0)
 462:     brb     dzploop         # check for another line
 463: dzprei:
 464:     POPR
 465:     incl    _cnt+V_PDMA
 466:     rei
 467: 
 468: dzpcall:
 469:     pushl   r3
 470:     pushl   (r0)+           # push tty address
 471:     calls   $1,*(r0)        # call interrupt rtn
 472:     movl    (sp)+,r3
 473:     brb     dzploop         # check for another line
 474: #endif
 475: 
 476: #if NUU > 0 && defined(UUDMA)
 477: /*
 478:  * Pseudo DMA routine for tu58 (on DL11)
 479:  *	r0 - controller number
 480:  */
 481:     .align  1
 482:     .globl  uudma
 483: uudma:
 484:     movl    _uudinfo[r0],r2
 485:     movl    16(r2),r2       # r2 = uuaddr
 486:     mull3   $48,r0,r3
 487:     movab   _uu_softc(r3),r5    # r5 = uuc
 488: 
 489:     cvtwl   2(r2),r1        # c = uuaddr->rdb
 490:     bbc $15,r1,1f       # if (c & UUDB_ERROR)
 491:     movl    $13,16(r5)      #	uuc->tu_state = TUC_RCVERR;
 492:     rsb             #	let uurintr handle it
 493: 1:
 494:     tstl    4(r5)           # if (uuc->tu_rcnt) {
 495:     beql    1f
 496:     movb    r1,*0(r5)       #	*uuc->tu_rbptr++ = r1
 497:     incl    (r5)
 498:     decl    4(r5)           #	if (--uuc->tu_rcnt)
 499:     beql    2f          #		done
 500:     tstl    (sp)+
 501:     POPR                # 	registers saved in ubglue.s
 502:     rei             # }
 503: 2:
 504:     cmpl    16(r5),$8       # if (uuc->tu_state != TUS_GETH)
 505:     beql    2f          # 	let uurintr handle it
 506: 1:
 507:     rsb
 508: 2:
 509:     mull2   $14,r0          # sizeof(uudata[ctlr]) = 14
 510:     movab   _uudata(r0),r4      # data = &uudata[ctlr];
 511:     cmpb    $1,(r4)         # if (data->pk_flag != TUF_DATA)
 512:     bneq    1b
 513: #ifdef notdef
 514:     /* this is for command packets */
 515:     beql    1f          # 	r0 = uuc->tu_rbptr
 516:     movl    (r5),r0
 517:     brb 2f
 518: 1:                  # else
 519: #endif
 520:     movl    24(r5),r0       # 	r0 = uuc->tu_addr
 521: 2:
 522:     movzbl  1(r4),r3        # counter to r3 (data->pk_count)
 523:     movzwl  (r4),r1         # first word of checksum (=header)
 524:     mfpr    $IPL,-(sp)      # s = spl5();
 525:     mtpr    $0x15,$IPL      # to keep disk interrupts out
 526:     clrw    (r2)            # disable receiver interrupts
 527: 3:  bbc $7,(r2),3b      # while ((uuaddr->rcs & UUCS_READY)==0);
 528:     cvtwb   2(r2),(r0)+     # *buffer = uuaddr->rdb & 0xff
 529:     sobgtr  r3,1f           # continue with next byte ...
 530:     addw2   2(r2),r1        # unless this was the last (odd count)
 531:     brb 2f
 532: 
 533: 1:  bbc $7,(r2),1b      # while ((uuaddr->rcs & UUCS_READY)==0);
 534:     cvtwb   2(r2),(r0)+     # *buffer = uuaddr->rdb & 0xff
 535:     addw2   -2(r0),r1       # add to checksum..
 536: 2:
 537:     adwc    $0,r1           # get the carry
 538:     sobgtr  r3,3b           # loop while r3 > 0
 539: /*
 540:  * We're ready to get the checksum
 541:  */
 542: 1:  bbc $7,(r2),1b      # while ((uuaddr->rcs & UUCS_READY)==0);
 543:     cvtwb   2(r2),12(r4)        # get first (lower) byte
 544: 1:  bbc $7,(r2),1b
 545:     cvtwb   2(r2),13(r4)        # ..and second
 546:     cmpw    12(r4),r1       # is checksum ok?
 547:     beql    1f
 548:     movl    $14,16(r5)      # uuc->tu_state = TUS_CHKERR
 549:     brb 2f          # exit
 550: 1:
 551:     movl    $11,16(r5)      # uuc->tu_state = TUS_GET (ok)
 552: 2:
 553:     movw    $0x40,(r2)      # enable receiver interrupts
 554:     mtpr    (sp)+,$IPL      # splx(s);
 555:     rsb             # continue processing in uurintr
 556: #endif
 557: 
 558: #if defined(VAX750) && !defined(MRSP)
 559: /*
 560:  * Pseudo DMA routine for VAX-11/750 console tu58
 561:  *   	    (without MRSP)
 562:  */
 563:     .align  1
 564:     .globl  tudma
 565: tudma:
 566:     movab   _tu,r5          # r5 = tu
 567:     tstl    4(r5)           # if (tu.tu_rcnt) {
 568:     beql    3f
 569:     mfpr    $CSRD,r1        # get data from tu58
 570:     movb    r1,*0(r5)       #	*tu.tu_rbptr++ = r1
 571:     incl    (r5)
 572:     decl    4(r5)           #	if (--tu.tu_rcnt)
 573:     beql    1f          #		done
 574:     tstl    (sp)+
 575:     POPR                # 	registers saved in ubglue.s
 576:     rei             # 	data handled, done
 577: 1:                  # }
 578:     cmpl    16(r5),$8       # if (tu.tu_state != TUS_GETH)
 579:     beql    2f          # 	let turintr handle it
 580: 3:
 581:     rsb
 582: 2:
 583:     movab   _tudata,r4      # r4 = tudata
 584:     cmpb    $1,(r4)         # if (tudata.pk_flag != TUF_DATA)
 585:     bneq    3b          # 	let turintr handle it
 586: 1:                  # else
 587:     movl    24(r5),r1       # get buffer pointer to r1
 588:     movzbl  1(r4),r3        # counter to r3
 589:     movzwl  (r4),r0         # first word of checksum (=header)
 590:     mtpr    $0,$CSRS        # disable receiver interrupts
 591: 3:
 592:     bsbw    5f          # wait for next byte
 593:     mfpr    $CSRD,r5
 594:     movb    r5,(r1)+        # *buffer = rdb
 595:     sobgtr  r3,1f           # continue with next byte ...
 596:     mfpr    $CSRD,r2        # unless this was the last (odd count)
 597:     brb 2f
 598: 
 599: 1:  bsbw    5f          # wait for next byte
 600:     mfpr    $CSRD,r5
 601:     movb    r5,(r1)+        # *buffer = rdb
 602:     movzwl  -2(r1),r2       # get the last word back from memory
 603: 2:
 604:     addw2   r2,r0           # add to checksum..
 605:     adwc    $0,r0           # get the carry
 606:     sobgtr  r3,3b           # loop while r3 > 0
 607: /*
 608:  * We're ready to get the checksum.
 609:  */
 610:     bsbw    5f
 611:     movab   _tudata,r4
 612:     mfpr    $CSRD,r5
 613:     movb    r5,12(r4)       # get first (lower) byte
 614:     bsbw    5f
 615:     mfpr    $CSRD,r5
 616:     movb    r5,13(r4)       # ..and second
 617:     movab   _tu,r5
 618:     cmpw    12(r4),r0       # is checksum ok?
 619:     beql    1f
 620:     movl    $14,16(r5)      # tu.tu_state = TUS_CHKERR
 621:     brb 2f          # exit
 622: 1:
 623:     movl    $11,16(r5)      # tu.tu_state = TUS_GET
 624: 2:
 625:     mtpr    $0x40,$CSRS     # enable receiver interrupts
 626:     rsb             # continue processing in turintr
 627: /*
 628:  * Loop until a new byte is ready from
 629:  * the tu58, make sure we don't loop forever
 630:  */
 631: 5:
 632:     movl    $5000,r5        # loop max 5000 times
 633: 1:
 634:     mfpr    $CSRS,r2
 635:     bbs $7,r2,1f
 636:     sobgtr  r5,1b
 637:     movab   _tu,r5
 638:     movl    $13,16(r5)      # return TUS_RCVERR
 639:     tstl    (sp)+           # and let turintr handle it
 640: 1:
 641:     rsb
 642: #endif
 643: 
 644: /*
 645:  * Stray UNIBUS interrupt catch routines
 646:  */
 647:     .data
 648:     .align  2
 649: #define PJ  PUSHR;jsb _Xustray
 650:     .globl  _catcher
 651: _catcher:
 652:     PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
 653:     PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
 654:     PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
 655:     PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
 656:     PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
 657:     PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
 658:     PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
 659:     PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
 660: 
 661:     .globl  _cold
 662: _cold:  .long   1
 663:     .data
 664: 
 665:     .text
 666: SCBVEC(ustray):
 667:     blbc    _cold,1f
 668:     mfpr    $IPL,r11
 669:     subl3   $_catcher+8,(sp)+,r10
 670:     ashl    $-1,r10,r10
 671:     POPR
 672:     rei
 673: 1:
 674:     subl3   $_catcher+8,(sp)+,r0
 675:     ashl    $-1,r0,-(sp)
 676:     mfpr    $IPL,-(sp)
 677:     PRINTF(2, "uba?: stray intr ipl %x vec %o\n")
 678:     POPR
 679:     rei
 680: 
 681: #ifdef VAX630
 682: /*
 683:  * Emulation OpCode jump table:
 684:  *	ONLY GOES FROM 0xf8 (-8) TO 0x3B (59)
 685:  */
 686: #define EMUTABLE    0x43
 687: #define NOEMULATE   .long noemulate
 688: #define EMULATE(a)  .long _EM/**/a
 689:     .globl  _emJUMPtable
 690: _emJUMPtable:
 691: /* f8 */    EMULATE(ashp);  EMULATE(cvtlp); NOEMULATE;  NOEMULATE
 692: /* fc */    NOEMULATE;  NOEMULATE;  NOEMULATE;  NOEMULATE
 693: /* 00 */    NOEMULATE;  NOEMULATE;  NOEMULATE;  NOEMULATE
 694: /* 04 */    NOEMULATE;  NOEMULATE;  NOEMULATE;  NOEMULATE
 695: /* 08 */    EMULATE(cvtps); EMULATE(cvtsp); NOEMULATE;  EMULATE(crc)
 696: /* 0c */    NOEMULATE;  NOEMULATE;  NOEMULATE;  NOEMULATE
 697: /* 10 */    NOEMULATE;  NOEMULATE;  NOEMULATE;  NOEMULATE
 698: /* 14 */    NOEMULATE;  NOEMULATE;  NOEMULATE;  NOEMULATE
 699: /* 18 */    NOEMULATE;  NOEMULATE;  NOEMULATE;  NOEMULATE
 700: /* 1c */    NOEMULATE;  NOEMULATE;  NOEMULATE;  NOEMULATE
 701: /* 20 */    EMULATE(addp4); EMULATE(addp6); EMULATE(subp4); EMULATE(subp6)
 702: /* 24 */    EMULATE(cvtpt); EMULATE(mulp);  EMULATE(cvttp); EMULATE(divp)
 703: /* 28 */    NOEMULATE;  EMULATE(cmpc3); EMULATE(scanc); EMULATE(spanc)
 704: /* 2c */    NOEMULATE;  EMULATE(cmpc5); EMULATE(movtc); EMULATE(movtuc)
 705: /* 30 */    NOEMULATE;  NOEMULATE;  NOEMULATE;  NOEMULATE
 706: /* 34 */    EMULATE(movp);  EMULATE(cmpp3); EMULATE(cvtpl); EMULATE(cmpp4)
 707: /* 38 */    EMULATE(editpc); EMULATE(matchc); EMULATE(locc); EMULATE(skpc)
 708: #endif
 709: 
 710: /*
 711:  * Trap and fault vector routines
 712:  */
 713: #define TRAP(a) pushl $T_/**/a; jbr alltraps
 714: 
 715: /*
 716:  * Ast delivery (profiling and/or reschedule)
 717:  */
 718: SCBVEC(astflt):
 719:     pushl $0; TRAP(ASTFLT)
 720: SCBVEC(privinflt):
 721:     pushl $0; TRAP(PRIVINFLT)
 722: SCBVEC(xfcflt):
 723:     pushl $0; TRAP(XFCFLT)
 724: SCBVEC(resopflt):
 725:     pushl $0; TRAP(RESOPFLT)
 726: SCBVEC(resadflt):
 727:     pushl $0; TRAP(RESADFLT)
 728: SCBVEC(bptflt):
 729:     pushl $0; TRAP(BPTFLT)
 730: SCBVEC(compatflt):
 731:     TRAP(COMPATFLT);
 732: SCBVEC(tracep):
 733:     pushl $0; TRAP(TRCTRAP)
 734: SCBVEC(arithtrap):
 735:     TRAP(ARITHTRAP)
 736: SCBVEC(protflt):
 737:     blbs    (sp)+,segflt
 738:     TRAP(PROTFLT)
 739: segflt:
 740:     TRAP(SEGFLT)
 741: 
 742: /*
 743:  * The following is called with the stack set up as follows:
 744:  *
 745:  *	  (sp):	Opcode
 746:  *	 4(sp):	Instruction PC
 747:  *	 8(sp):	Operand 1
 748:  *	12(sp):	Operand 2
 749:  *	16(sp):	Operand 3
 750:  *	20(sp):	Operand 4
 751:  *	24(sp):	Operand 5
 752:  *	28(sp):	Operand 6
 753:  *	32(sp):	Operand 7 (unused)
 754:  *	36(sp):	Operand 8 (unused)
 755:  *	40(sp):	Return PC
 756:  *	44(sp):	Return PSL
 757:  *	48(sp): TOS before instruction
 758:  *
 759:  * Each individual routine is called with the stack set up as follows:
 760:  *
 761:  *	  (sp):	Return address of trap handler
 762:  *	 4(sp):	Opcode (will get return PSL)
 763:  *	 8(sp):	Instruction PC
 764:  *	12(sp):	Operand 1
 765:  *	16(sp):	Operand 2
 766:  *	20(sp):	Operand 3
 767:  *	24(sp):	Operand 4
 768:  *	28(sp):	Operand 5
 769:  *	32(sp):	Operand 6
 770:  *	36(sp):	saved register 11
 771:  *	40(sp):	saved register 10
 772:  *	44(sp):	Return PC
 773:  *	48(sp):	Return PSL
 774:  *	52(sp): TOS before instruction
 775:  */
 776: 
 777: SCBVEC(emulate):
 778: #ifdef VAX630
 779:     movl    r11,32(sp)      # save register r11 in unused operand
 780:     movl    r10,36(sp)      # save register r10 in unused operand
 781:     cvtbl   (sp),r10        # get opcode
 782:     addl2   $8,r10          # shift negative opcodes
 783:     subl3   r10,$EMUTABLE,r11   # forget it if opcode is out of range
 784:     bcs noemulate
 785:     movl    _emJUMPtable[r10],r10   # call appropriate emulation routine
 786:     jsb (r10)       # routines put return values into regs 0-5
 787:     movl    32(sp),r11      # restore register r11
 788:     movl    36(sp),r10      # restore register r10
 789:     insv    (sp),$0,$4,44(sp)   # and condition codes in Opcode spot
 790:     addl2   $40,sp          # adjust stack for return
 791:     rei
 792: noemulate:
 793:     addl2   $48,sp          # adjust stack for
 794: #endif VAX630
 795:     .word   0xffff          # "reserved instruction fault"
 796: SCBVEC(emulateFPD):
 797:     .word   0xffff          # "reserved instruction fault"
 798: SCBVEC(transflt):
 799:     bitl    $2,(sp)+
 800:     bnequ   tableflt
 801:     jsb Fastreclaim     # try and avoid pagein
 802:     TRAP(PAGEFLT)
 803: tableflt:
 804:     TRAP(TABLEFLT)
 805: 
 806: alltraps:
 807:     mfpr    $USP,-(sp); calls $0,_trap; mtpr (sp)+,$USP
 808:     incl    _cnt+V_TRAP
 809:     addl2   $8,sp           # pop type, code
 810:     mtpr    $HIGH,$IPL      ## dont go to a higher IPL (GROT)
 811:     rei
 812: 
 813: SCBVEC(syscall):
 814:     pushl   $T_SYSCALL
 815:     mfpr    $USP,-(sp); calls $0,_syscall; mtpr (sp)+,$USP
 816:     incl    _cnt+V_SYSCALL
 817:     addl2   $8,sp           # pop type, code
 818:     mtpr    $HIGH,$IPL      ## dont go to a higher IPL (GROT)
 819:     rei
 820: 
 821: /*
 822:  * System page table
 823:  * Mbmap and Usrptmap are enlarged by CLSIZE entries
 824:  * as they are managed by resource maps starting with index 1 or CLSIZE.
 825:  */
 826: #define vaddr(x)    ((((x)-_Sysmap)/4)*NBPG+0x80000000)
 827: #define SYSMAP(mname, vname, npte)          \
 828: _/**/mname: .globl  _/**/mname;     \
 829:     .space  (npte)*4;               \
 830:     .globl  _/**/vname;         \
 831:     .set    _/**/vname,vaddr(_/**/mname)
 832: 
 833:     .data
 834:     .align  2
 835:     SYSMAP(Sysmap   ,Sysbase    ,SYSPTSIZE  )
 836:     SYSMAP(Forkmap  ,forkutl    ,UPAGES     )
 837:     SYSMAP(Xswapmap ,xswaputl   ,UPAGES     )
 838:     SYSMAP(Xswap2map,xswap2utl  ,UPAGES     )
 839:     SYSMAP(Swapmap  ,swaputl    ,UPAGES     )
 840:     SYSMAP(Pushmap  ,pushutl    ,UPAGES     )
 841:     SYSMAP(Vfmap    ,vfutl      ,UPAGES     )
 842:     SYSMAP(CMAP1    ,CADDR1     ,1      )
 843:     SYSMAP(CMAP2    ,CADDR2     ,1      )
 844:     SYSMAP(mmap ,vmmap      ,1      )
 845:     SYSMAP(alignmap ,alignutl   ,1      )   /* XXX */
 846:     SYSMAP(msgbufmap,msgbuf     ,MSGBUFPTECNT   )
 847:     SYSMAP(Mbmap    ,mbutl      ,NMBCLUSTERS*CLSIZE+CLSIZE )
 848:     SYSMAP(camap    ,cabase     ,16*CLSIZE  )
 849: #ifdef  GPROF
 850:     SYSMAP(profmap  ,profbase   ,600*CLSIZE )
 851: #endif
 852:     SYSMAP(ecamap   ,calimit    ,0      )
 853: 
 854:     SYSMAP(UMBAbeg  ,umbabeg    ,0      )
 855:     SYSMAP(Nexmap   ,nexus      ,16*MAXNNEXUS   )
 856:     SYSMAP(UMEMmap  ,umem       ,UBAPAGES*NUBA  )
 857:     SYSMAP(Ioamap   ,ioa        ,MAXNIOA*IOAMAPSIZ/NBPG )
 858:     SYSMAP(UMBAend  ,umbaend    ,0      )
 859: #if VAX630
 860:     SYSMAP(Clockmap ,cldevice   ,1      )
 861:     SYSMAP(Ka630map ,ka630cpu   ,1      )
 862: #endif
 863: 
 864:     SYSMAP(Usrptmap ,usrpt      ,USRPTSIZE+CLSIZE )
 865: 
 866: eSysmap:
 867:     .globl  _Syssize
 868:     .set    _Syssize,(eSysmap-_Sysmap)/4
 869:     .text
 870: 
 871: /*
 872:  * Initialization
 873:  *
 874:  * ipl 0x1f; mapen 0; scbb, pcbb, sbr, slr, isp, ksp not set
 875:  */
 876:     .data
 877:     .globl  _cpu
 878: _cpu:   .long   0
 879:     .text
 880:     .globl  start
 881: start:
 882:     .word   0
 883:     mtpr    $0,$ICCS
 884: /* set system control block base and system page table params */
 885:     mtpr    $_scb-0x80000000,$SCBB
 886:     mtpr    $_Sysmap-0x80000000,$SBR
 887:     mtpr    $_Syssize,$SLR
 888: /* double map the kernel into the virtual user addresses of phys mem */
 889:     mtpr    $_Sysmap,$P0BR
 890:     mtpr    $_Syssize,$P0LR
 891: /* set ISP and get cpu type */
 892:     movl    $_intstack+NISP*NBPG,sp
 893:     mfpr    $SID,r0
 894:     movab   _cpu,r1
 895:     extzv   $24,$8,r0,(r1)
 896: /* init RPB */
 897:     movab   _rpb,r0
 898:     movl    r0,(r0)+            # rp_selfref
 899:     movab   _doadump,r1
 900:     movl    r1,(r0)+            # rp_dumprout
 901:     movl    $0x1f,r2
 902:     clrl    r3
 903: 1:  addl2   (r1)+,r3; sobgtr r2,1b
 904:     movl    r3,(r0)+            # rp_chksum
 905: /* count up memory */
 906:     clrl    r7
 907: 1:  pushl   $4; pushl r7; calls $2,_badaddr; tstl r0; bneq 9f
 908:     acbl    $MAXMEM*1024-1,$64*1024,r7,1b
 909: 9:
 910: #ifdef  VAX630
 911: /* leave an area for uVAX II console scratch pad at the top */
 912:     cmpb    _cpu,$VAX_630
 913:     bneq    1f
 914:     subl2   $4096,r7
 915: 1:
 916: #endif
 917: /* clear memory from kernel bss and pages for proc 0 u. and page table */
 918:     movab   _edata,r6
 919:     movab   _end,r5
 920:     bbcc    $31,r5,0f; 0:
 921:     addl2   $(UPAGES*NBPG)+NBPG+NBPG,r5
 922: 1:  clrq    (r6); acbl r5,$8,r6,1b
 923: /* trap() and syscall() save r0-r11 in the entry mask (per ../h/reg.h) */
 924: /* panic() is convenient place to save all for debugging */
 925:     bisw2   $0x0fff,_trap
 926:     bisw2   $0x0fff,_syscall
 927:     bisw2   $0x0fff,_panic
 928:     calls   $0,_fixctlrmask
 929: /* initialize system page table: uba vectors and int stack writeable */
 930:     clrl    r2
 931:     movab   eintstack,r1; bbcc $31,r1,0f; 0: ashl $-PGSHIFT,r1,r1
 932: 1:  bisl3   $PG_V|PG_KW,r2,_Sysmap[r2]; aoblss r1,r2,1b
 933: /* make rpb, scb read-only as red zone for interrupt stack */
 934:     bicl2   $PG_PROT,_rpbmap
 935:     bisl2   $PG_KR,_rpbmap
 936: /* make kernel text space read-only */
 937:     movab   _etext+NBPG-1,r1; bbcc $31,r1,0f; 0: ashl $-PGSHIFT,r1,r1
 938: 1:  bisl3   $PG_V|PG_URKR,r2,_Sysmap[r2]; aoblss r1,r2,1b
 939: /* make kernel data, bss, read-write */
 940:     movab   _end+NBPG-1,r1; bbcc $31,r1,0f; 0:; ashl $-PGSHIFT,r1,r1
 941: 1:  bisl3   $PG_V|PG_KW,r2,_Sysmap[r2]; aoblss r1,r2,1b
 942: /* now go to mapped mode */
 943:     mtpr    $0,$TBIA; mtpr $1,$MAPEN; jmp *$0f; 0:
 944: /* init mem sizes */
 945:     ashl    $-PGSHIFT,r7,_maxmem
 946:     movl    _maxmem,_physmem
 947:     movl    _maxmem,_freemem
 948: /* setup context for proc[0] == Scheduler */
 949:     movab   _end+NBPG-1,r6
 950:     bicl2   $NBPG-1,r6      # make page boundary
 951: /* setup page table for proc[0] */
 952:     bbcc    $31,r6,0f; 0:
 953:     ashl    $-PGSHIFT,r6,r3         # r3 = btoc(r6)
 954:     bisl3   $PG_V|PG_KW,r3,_Usrptmap    # init first upt entry
 955:     incl    r3
 956:     movab   _usrpt,r0
 957:     mtpr    r0,$TBIS
 958: /* init p0br, p0lr */
 959:     mtpr    r0,$P0BR
 960:     mtpr    $0,$P0LR
 961: /* init p1br, p1lr */
 962:     movab   NBPG(r0),r0
 963:     movl    $0x200000-UPAGES,r1
 964:     mtpr    r1,$P1LR
 965:     mnegl   r1,r1
 966:     moval   -4*UPAGES(r0)[r1],r2
 967:     mtpr    r2,$P1BR
 968: /* setup mapping for UPAGES of _u */
 969:     movl    $UPAGES,r2; movab _u+NBPG*UPAGES,r1; addl2 $UPAGES,r3; jbr 2f
 970: 1:  decl    r3
 971:     moval   -NBPG(r1),r1;
 972:     bisl3   $PG_V|PG_URKW,r3,-(r0)
 973:     mtpr    r1,$TBIS
 974: 2:  sobgeq  r2,1b
 975: /* initialize (slightly) the pcb */
 976:     movab   UPAGES*NBPG(r1),PCB_KSP(r1)
 977:     mnegl   $1,PCB_ESP(r1)
 978:     mnegl   $1,PCB_SSP(r1)
 979:     movl    r1,PCB_USP(r1)
 980:     mfpr    $P0BR,PCB_P0BR(r1)
 981:     mfpr    $P0LR,PCB_P0LR(r1)
 982:     movb    $4,PCB_P0LR+3(r1)       # disable ast
 983:     mfpr    $P1BR,PCB_P1BR(r1)
 984:     mfpr    $P1LR,PCB_P1LR(r1)
 985:     movl    $CLSIZE,PCB_SZPT(r1)        # init u.u_pcb.pcb_szpt
 986:     movl    r10,PCB_R10(r1)
 987:     movl    r11,PCB_R11(r1)
 988:     movab   1f,PCB_PC(r1)           # initial pc
 989:     clrl    PCB_PSL(r1)         # mode(k,k), ipl=0
 990:     ashl    $PGSHIFT,r3,r3
 991:     mtpr    r3,$PCBB            # first pcbb
 992: /* set regs, p0br, p0lr, p1br, p1lr, astlvl, ksp and change to kernel mode */
 993:     ldpctx
 994:     rei
 995: /* put signal trampoline code in u. area */
 996: 1:  movab   _u,r0
 997:     movc3   $19,sigcode,PCB_SIGC(r0)
 998: /* save boot device in global _bootdev */
 999:     movl    r10,_bootdev
1000: /* save reboot flags in global _boothowto */
1001:     movl    r11,_boothowto
1002: /* calculate firstaddr, and call main() */
1003:     movab   _end+NBPG-1,r0; bbcc $31,r0,0f; 0:; ashl $-PGSHIFT,r0,-(sp)
1004:     addl2   $UPAGES+1,(sp); calls $1,_main
1005: /* proc[1] == /etc/init now running here; run icode */
1006:     pushl   $PSL_CURMOD|PSL_PRVMOD; pushl $0; rei
1007: 
1008: /* signal trampoline code: it is known that this code takes exactly 19 bytes */
1009: /* in ../vax/pcb.h and in the movc3 above */
1010: sigcode:
1011:     calls   $4,8(pc)    # params pushed by sendsig
1012:     movl    sp,ap       # calls frame built by sendsig
1013:     chmk    $103        # cleanup mask and onsigstack
1014:     halt            # sigreturn() does not return!
1015:     .word   0x3f        # registers 0-5
1016:     callg   (ap),*16(ap)    # call the signal handler
1017:     ret         # return to code above
1018: 
1019:     .set    exec,11
1020:     .set    exit,1
1021:     .globl  _icode
1022:     .globl  _initflags
1023:     .globl  _szicode
1024: /*
1025:  * Icode is copied out to process 1 to exec /etc/init.
1026:  * If the exec fails, process 1 exits.
1027:  */
1028: _icode:
1029:     pushab  b`argv-l0(pc)
1030: l0: pushab  b`init-l1(pc)
1031: l1: pushl   $2
1032:     movl    sp,ap
1033:     chmk    $exec
1034:     chmk    $exit
1035: 
1036: init:   .asciz  "/etc/init"
1037:     .align  2
1038: _initflags:
1039:     .long   0
1040: argv:   .long   init+5-_icode
1041:     .long   _initflags-_icode
1042:     .long   0
1043: _szicode:
1044:     .long   _szicode-_icode
1045: 
1046: /*
1047:  * Primitives
1048:  */
1049: 
1050: #ifdef GPROF
1051: #define ENTRY(name, regs) \
1052:     .globl _/**/name; .align 1; _/**/name: .word regs; jsb mcount
1053: #define JSBENTRY(name, regs) \
1054:     .globl _/**/name; _/**/name: \
1055:     movl fp,-(sp); movab -12(sp),fp; pushr $(regs); jsb mcount; \
1056:     popr $(regs); movl (sp)+,fp
1057: #else
1058: #define ENTRY(name, regs) \
1059:     .globl _/**/name; .align 1; _/**/name: .word regs
1060: #define JSBENTRY(name, regs) \
1061:     .globl _/**/name; _/**/name:
1062: #endif GPROF
1063: #define R0 0x01
1064: #define R1 0x02
1065: #define R2 0x04
1066: #define R3 0x08
1067: #define R4 0x10
1068: #define R5 0x20
1069: #define R6 0x40
1070: 
1071: /*
1072:  * badaddr(addr, len)
1073:  *	see if access addr with a len type instruction causes a machine check
1074:  *	len is length of access (1=byte, 2=short, 4=long)
1075:  */
1076:     .globl  _badaddr
1077: _badaddr:
1078:     .word   0
1079:     movl    $1,r0
1080:     mfpr    $IPL,r1
1081:     mtpr    $HIGH,$IPL
1082:     movl    4(ap),r3
1083:     movl    8(ap),r4
1084:     movab   2f,nofault      # jump to 2f on machcheck
1085:     bbc $0,r4,1f; tstb  (r3)
1086: 1:  bbc $1,r4,1f; tstw  (r3)
1087: 1:  bbc $2,r4,1f; tstl  (r3)
1088: 1:  clrl    r0          # made it w/o machine checks
1089: 2:  clrl    nofault
1090:     mtpr    r1,$IPL
1091:     ret
1092: 
1093: /*
1094:  * update profiling information for the user
1095:  * addupc(pc, &u.u_prof, ticks)
1096:  */
1097: ENTRY(addupc, 0)
1098:     movl    8(ap),r2        # &u.u_prof
1099:     subl3   8(r2),4(ap),r0      # corrected pc
1100:     blss    9f
1101:     extzv   $1,$31,r0,r0        # logical right shift
1102:     extzv   $1,$31,12(r2),r1    # ditto for scale
1103:     emul    r1,r0,$0,r0
1104:     ashq    $-14,r0,r0
1105:     tstl    r1
1106:     bneq    9f
1107:     bicl2   $1,r0
1108:     cmpl    r0,4(r2)        # length
1109:     bgequ   9f
1110:     addl2   (r2),r0         # base
1111:     probew  $3,$2,(r0)
1112:     beql    8f
1113:     addw2   12(ap),(r0)
1114: 9:
1115:     ret
1116: 8:
1117:     clrl    12(r2)
1118:     ret
1119: 
1120: /*
1121:  * Copy a null terminated string from the user address space into
1122:  * the kernel address space.
1123:  *
1124:  * copyinstr(fromaddr, toaddr, maxlength, &lencopied)
1125:  */
1126: ENTRY(copyinstr, R6)
1127:     movl    12(ap),r6       # r6 = max length
1128:     jlss    8f
1129:     movl    4(ap),r1        # r1 = user address
1130:     bicl3   $~(NBPG*CLSIZE-1),r1,r2 # r2 = bytes on first page
1131:     subl3   r2,$NBPG*CLSIZE,r2
1132:     movl    8(ap),r3        # r3 = kernel address
1133: 1:
1134:     cmpl    r6,r2           # r2 = min(bytes on page, length left);
1135:     jgeq    2f
1136:     movl    r6,r2
1137: 2:
1138:     prober  $3,r2,(r1)      # bytes accessible?
1139:     jeql    8f
1140:     subl2   r2,r6           # update bytes left count
1141: #ifdef NOSUBSINST
1142:     # fake the locc instr. for processors that don't have it
1143:     movl    r2,r0
1144: 6:
1145:     tstb    (r1)+
1146:     jeql    5f
1147:     sobgtr  r0,6b
1148:     jbr 7f
1149: 5:
1150:     decl    r1
1151:     jbr 3f
1152: 7:
1153: #else
1154:     locc    $0,r2,(r1)      # null byte found?
1155:     jneq    3f
1156: #endif
1157:     subl2   r2,r1           # back up pointer updated by `locc'
1158:     movc3   r2,(r1),(r3)        # copy in next piece
1159:     movl    $(NBPG*CLSIZE),r2   # check next page
1160:     tstl    r6          # run out of space?
1161:     jneq    1b
1162:     movl    $ENOENT,r0      # set error code and return
1163:     jbr 9f
1164: 3:
1165:     tstl    16(ap)          # return length?
1166:     beql    4f
1167:     subl3   r6,12(ap),r6        # actual len = maxlen - unused pages
1168:     subl2   r0,r6           #	- unused on this page
1169:     addl3   $1,r6,*16(ap)       #	+ the null byte
1170: 4:
1171:     subl2   r0,r2           # r2 = number of bytes to move
1172:     subl2   r2,r1           # back up pointer updated by `locc'
1173:     incl    r2          # copy null byte as well
1174:     movc3   r2,(r1),(r3)        # copy in last piece
1175:     clrl    r0          # redundant
1176:     ret
1177: 8:
1178:     movl    $EFAULT,r0
1179: 9:
1180:     tstl    16(ap)
1181:     beql    1f
1182:     subl3   r6,12(ap),*16(ap)
1183: 1:
1184:     ret
1185: 
1186: /*
1187:  * Copy a null terminated string from the kernel
1188:  * address space to the user address space.
1189:  *
1190:  * copyoutstr(fromaddr, toaddr, maxlength, &lencopied)
1191:  */
1192: ENTRY(copyoutstr, R6)
1193:     movl    12(ap),r6       # r6 = max length
1194:     jlss    8b
1195:     movl    4(ap),r1        # r1 = kernel address
1196:     movl    8(ap),r3        # r3 = user address
1197:     bicl3   $~(NBPG*CLSIZE-1),r3,r2 # r2 = bytes on first page
1198:     subl3   r2,$NBPG*CLSIZE,r2
1199: 1:
1200:     cmpl    r6,r2           # r2 = min(bytes on page, length left);
1201:     jgeq    2f
1202:     movl    r6,r2
1203: 2:
1204:     probew  $3,r2,(r3)      # bytes accessible?
1205:     jeql    8b
1206:     subl2   r2,r6           # update bytes left count
1207: #ifdef NOSUBSINST
1208:     # fake the locc instr. for processors that don't have it
1209:     movl    r2,r0
1210: 6:
1211:     tstb    (r1)+
1212:     jeql    5f
1213:     sobgtr  r0,6b
1214:     jbr 7f
1215: 5:
1216:     decl    r1
1217:     jbr 3b
1218: 7:
1219: #else
1220:     locc    $0,r2,(r1)      # null byte found?
1221:     jneq    3b
1222: #endif
1223:     subl2   r2,r1           # back up pointer updated by `locc'
1224:     movc3   r2,(r1),(r3)        # copy in next piece
1225:     movl    $(NBPG*CLSIZE),r2   # check next page
1226:     tstl    r6          # run out of space?
1227:     jneq    1b
1228:     movl    $ENOENT,r0      # set error code and return
1229:     jbr 9b
1230: 
1231: /*
1232:  * Copy a null terminated string from one point to another in
1233:  * the kernel address space.
1234:  *
1235:  * copystr(fromaddr, toaddr, maxlength, &lencopied)
1236:  */
1237: ENTRY(copystr, R6)
1238:     movl    12(ap),r6       # r6 = max length
1239:     jlss    8b
1240:     movl    4(ap),r1        # r1 = src address
1241:     movl    8(ap),r3        # r3 = dest address
1242: 1:
1243:     movzwl  $65535,r2       # r2 = bytes in first chunk
1244:     cmpl    r6,r2           # r2 = min(bytes in chunk, length left);
1245:     jgeq    2f
1246:     movl    r6,r2
1247: 2:
1248:     subl2   r2,r6           # update bytes left count
1249: #ifdef NOSUBSINST
1250:     # fake the locc instr. for processors that don't have it
1251:     movl    r2,r0
1252: 6:
1253:     tstb    (r1)+
1254:     jeql    5f
1255:     sobgtr  r0,6b
1256:     jbr 7f
1257: 5:
1258:     decl    r1
1259:     jbr 3b
1260: 7:
1261: #else
1262:     locc    $0,r2,(r1)      # null byte found?
1263:     jneq    3b
1264: #endif
1265:     subl2   r2,r1           # back up pointer updated by `locc'
1266:     movc3   r2,(r1),(r3)        # copy in next piece
1267:     tstl    r6          # run out of space?
1268:     jneq    1b
1269:     movl    $ENOENT,r0      # set error code and return
1270:     jbr 9b
1271: 
1272: /*
1273:  * Copy specified amount of data from user space into the kernel
1274:  * Copyin(from, to, len)
1275:  *	r1 == from (user source address)
1276:  *	r3 == to (kernel destination address)
1277:  *	r5 == length
1278:  */
1279:     .align  1
1280: JSBENTRY(Copyin, R1|R3|R5)
1281:     cmpl    r5,$(NBPG*CLSIZE)   # probing one page or less ?
1282:     bgtru   1f          # no
1283:     prober  $3,r5,(r1)      # bytes accessible ?
1284:     beql    ersb            # no
1285:     movc3   r5,(r1),(r3)
1286: /*	clrl	r0			# redundant */
1287:     rsb
1288: 1:
1289:     blss    ersb            # negative length?
1290:     pushl   r6          # r6 = length
1291:     movl    r5,r6
1292:     bicl3   $~(NBPG*CLSIZE-1),r1,r0 # r0 = bytes on first page
1293:     subl3   r0,$(NBPG*CLSIZE),r0
1294:     addl2   $(NBPG*CLSIZE),r0   # plus one additional full page
1295:     jbr 2f
1296: 
1297: ciloop:
1298:     movc3   r0,(r1),(r3)
1299:     movl    $(2*NBPG*CLSIZE),r0 # next amount to move
1300: 2:
1301:     cmpl    r0,r6
1302:     bleq    3f
1303:     movl    r6,r0
1304: 3:
1305:     prober  $3,r0,(r1)      # bytes accessible ?
1306:     beql    ersb1           # no
1307:     subl2   r0,r6           # last move?
1308:     bneq    ciloop          # no
1309: 
1310:     movc3   r0,(r1),(r3)
1311: /*	clrl	r0			# redundant */
1312:     movl    (sp)+,r6        # restore r6
1313:     rsb
1314: 
1315: ersb1:
1316:     movl    (sp)+,r6        # restore r6
1317: ersb:
1318:     movl    $EFAULT,r0
1319:     rsb
1320: 
1321: /*
1322:  * Copy specified amount of data from kernel to the user space
1323:  * Copyout(from, to, len)
1324:  *	r1 == from (kernel source address)
1325:  *	r3 == to (user destination address)
1326:  *	r5 == length
1327:  */
1328:     .align  1
1329: JSBENTRY(Copyout, R1|R3|R5)
1330:     cmpl    r5,$(NBPG*CLSIZE)   # moving one page or less ?
1331:     bgtru   1f          # no
1332:     probew  $3,r5,(r3)      # bytes writeable?
1333:     beql    ersb            # no
1334:     movc3   r5,(r1),(r3)
1335: /*	clrl	r0			# redundant */
1336:     rsb
1337: 1:
1338:     blss    ersb            # negative length?
1339:     pushl   r6          # r6 = length
1340:     movl    r5,r6
1341:     bicl3   $~(NBPG*CLSIZE-1),r3,r0 # r0 = bytes on first page
1342:     subl3   r0,$(NBPG*CLSIZE),r0
1343:     addl2   $(NBPG*CLSIZE),r0   # plus one additional full page
1344:     jbr 2f
1345: 
1346: coloop:
1347:     movc3   r0,(r1),(r3)
1348:     movl    $(2*NBPG*CLSIZE),r0 # next amount to move
1349: 2:
1350:     cmpl    r0,r6
1351:     bleq    3f
1352:     movl    r6,r0
1353: 3:
1354:     probew  $3,r0,(r3)      # bytes writeable?
1355:     beql    ersb1           # no
1356:     subl2   r0,r6           # last move?
1357:     bneq    coloop          # no
1358: 
1359:     movc3   r0,(r1),(r3)
1360: /*	clrl	r0			# redundant */
1361:     movl    (sp)+,r6        # restore r6
1362:     rsb
1363: 
1364: /*
1365:  * non-local goto's
1366:  */
1367: #ifdef notdef       /* this is now expanded completely inline */
1368:     .align  1
1369: JSBENTRY(Setjmp, R0)
1370:     movl    fp,(r0)+    # current stack frame
1371:     movl    (sp),(r0)   # resuming pc
1372:     clrl    r0
1373:     rsb
1374: #endif
1375: 
1376: #define PCLOC 16    /* location of pc in calls frame */
1377: #define APLOC 8     /* location of ap,fp in calls frame */
1378:     .align  1
1379: JSBENTRY(Longjmp, R0)
1380:     movl    (r0)+,newfp # must save parameters in memory as all
1381:     movl    (r0),newpc  # registers may be clobbered.
1382: 1:
1383:     cmpl    fp,newfp    # are we there yet?
1384:     bgequ   2f      # yes
1385:     moval   1b,PCLOC(fp)    # redirect return pc to us!
1386:     ret         # pop next frame
1387: 2:
1388:     beql    3f      # did we miss our frame?
1389:     pushab  4f      # yep ?!?
1390:     calls   $1,_panic
1391: 3:
1392:     movl    newpc,r0    # all done, just return to the `setjmp'
1393:     jmp (r0)        # ``rsb''
1394: 
1395:     .data
1396: newpc:  .space  4
1397: newfp:  .space  4
1398: 4:  .asciz  "longjmp"
1399:     .text
1400: /*
1401:  * setjmp that saves all registers as the call frame may not
1402:  * be available to recover them in the usual mannor by longjmp.
1403:  * Called before swapping out the u. area, restored by resume()
1404:  * below.
1405:  */
1406: ENTRY(savectx, 0)
1407:     movl    4(ap),r0
1408:     movq    r6,(r0)+
1409:     movq    r8,(r0)+
1410:     movq    r10,(r0)+
1411:     movq    APLOC(fp),(r0)+ # save ap, fp
1412:     addl3   $8,ap,(r0)+ # save sp
1413:     movl    PCLOC(fp),(r0)  # save pc
1414:     clrl    r0
1415:     ret
1416: 
1417:     .globl  _whichqs
1418:     .globl  _qs
1419:     .globl  _cnt
1420: 
1421:     .globl  _noproc
1422:     .comm   _noproc,4
1423:     .globl  _runrun
1424:     .comm   _runrun,4
1425: 
1426: /*
1427:  * The following primitives use the fancy VAX instructions
1428:  * much like VMS does.  _whichqs tells which of the 32 queues _qs
1429:  * have processes in them.  Setrq puts processes into queues, Remrq
1430:  * removes them from queues.  The running process is on no queue,
1431:  * other processes are on a queue related to p->p_pri, divided by 4
1432:  * actually to shrink the 0-127 range of priorities into the 32 available
1433:  * queues.
1434:  */
1435: 
1436: /*
1437:  * Setrq(p), using fancy VAX instructions.
1438:  *
1439:  * Call should be made at splclock(), and p->p_stat should be SRUN
1440:  */
1441:     .align  1
1442:  JSBENTRY(Setrq, R0)
1443:     tstl    P_RLINK(r0)     ## firewall: p->p_rlink must be 0
1444:     beql    set1            ##
1445:     pushab  set3            ##
1446:     calls   $1,_panic       ##
1447: set1:
1448:     movzbl  P_PRI(r0),r1        # put on queue which is p->p_pri / 4
1449:     ashl    $-2,r1,r1
1450:     movaq   _qs[r1],r2
1451:     insque  (r0),*4(r2)     # at end of queue
1452:     bbss    r1,_whichqs,set2    # mark queue non-empty
1453: set2:
1454:     rsb
1455: 
1456: set3:   .asciz  "setrq"
1457: 
1458: /*
1459:  * Remrq(p), using fancy VAX instructions
1460:  *
1461:  * Call should be made at splclock().
1462:  */
1463:     .align  1
1464:  JSBENTRY(Remrq, R0)
1465:     movzbl  P_PRI(r0),r1
1466:     ashl    $-2,r1,r1
1467:     bbsc    r1,_whichqs,rem1
1468:     pushab  rem3            # it wasn't recorded to be on its q
1469:     calls   $1,_panic
1470: rem1:
1471:     remque  (r0),r2
1472:     beql    rem2
1473:     bbss    r1,_whichqs,rem2
1474: rem2:
1475:     clrl    P_RLINK(r0)     ## for firewall checking
1476:     rsb
1477: 
1478: rem3:   .asciz  "remrq"
1479: 
1480: /*
1481:  * Masterpaddr is the p->p_addr of the running process on the master
1482:  * processor.  When a multiprocessor system, the slave processors will have
1483:  * an array of slavepaddr's.
1484:  */
1485:     .globl  _masterpaddr
1486:     .data
1487: _masterpaddr:
1488:     .long   0
1489: 
1490:     .set    ASTLVL_NONE,4
1491:     .text
1492: sw0:    .asciz  "swtch"
1493: 
1494: /*
1495:  * When no processes are on the runq, Swtch branches to idle
1496:  * to wait for something to come ready.
1497:  */
1498:     .globl  Idle
1499: Idle: idle:
1500:     mtpr    $0,$IPL         # must allow interrupts here
1501:     tstl    _whichqs        # look for non-empty queue
1502:     bneq    sw1
1503:     brb idle
1504: 
1505: badsw:  pushab  sw0
1506:     calls   $1,_panic
1507:     /*NOTREACHED*/
1508: 
1509: /*
1510:  * Swtch(), using fancy VAX instructions
1511:  */
1512:     .align  1
1513: JSBENTRY(Swtch, 0)
1514:     movl    $1,_noproc
1515:     incl    _cnt+V_SWTCH
1516: sw1:    ffs $0,$32,_whichqs,r0  # look for non-empty queue
1517:     beql    idle            # if none, idle
1518:     mtpr    $0x18,$IPL      # lock out all so _whichqs==_qs
1519:     bbcc    r0,_whichqs,sw1     # proc moved via lbolt interrupt
1520:     movaq   _qs[r0],r1
1521:     remque  *(r1),r2        # r2 = p = highest pri process
1522:     bvs badsw           # make sure something was there
1523: sw2:    beql    sw3
1524:     insv    $1,r0,$1,_whichqs   # still more procs in this queue
1525: sw3:
1526:     clrl    _noproc
1527:     clrl    _runrun
1528:     tstl    P_WCHAN(r2)     ## firewalls
1529:     bneq    badsw           ##
1530:     cmpb    P_STAT(r2),$SRUN    ##
1531:     bneq    badsw           ##
1532:     clrl    P_RLINK(r2)     ##
1533:     movl    *P_ADDR(r2),r0
1534: #ifdef notdef
1535:     cmpl    r0,_masterpaddr     # resume of current proc is easy
1536:     beql    res0
1537: #endif
1538:     movl    r0,_masterpaddr
1539:     ashl    $PGSHIFT,r0,r0      # r0 = pcbb(p)
1540: /* fall into... */
1541: 
1542: /*
1543:  * Resume(pf)
1544:  */
1545: JSBENTRY(Resume, R0)
1546:     mtpr    $HIGH,$IPL          # no interrupts, please
1547:     movl    _CMAP2,_u+PCB_CMAP2 # yech
1548:     svpctx
1549:     mtpr    r0,$PCBB
1550:     ldpctx
1551:     movl    _u+PCB_CMAP2,_CMAP2 # yech
1552:     mtpr    $_CADDR2,$TBIS
1553: res0:
1554:     tstl    _u+PCB_SSWAP
1555:     bneq    res1
1556:     rei
1557: res1:
1558:     movl    _u+PCB_SSWAP,r0         # longjmp to saved context
1559:     clrl    _u+PCB_SSWAP
1560:     movq    (r0)+,r6
1561:     movq    (r0)+,r8
1562:     movq    (r0)+,r10
1563:     movq    (r0)+,r12
1564:     movl    (r0)+,r1
1565:     cmpl    r1,sp               # must be a pop
1566:     bgequ   1f
1567:     pushab  2f
1568:     calls   $1,_panic
1569:     /* NOTREACHED */
1570: 1:
1571:     movl    r1,sp
1572:     movl    (r0),(sp)           # address to return to
1573:     movl    $PSL_PRVMOD,4(sp)       # ``cheating'' (jfr)
1574:     rei
1575: 
1576: 2:  .asciz  "ldctx"
1577: 
1578: /*
1579:  * {fu,su},{byte,word}, all massaged by asm.sed to jsb's
1580:  */
1581:     .align  1
1582: JSBENTRY(Fuword, R0)
1583:     prober  $3,$4,(r0)
1584:     beql    fserr
1585:     movl    (r0),r0
1586:     rsb
1587: fserr:
1588:     mnegl   $1,r0
1589:     rsb
1590: 
1591:     .align  1
1592: JSBENTRY(Fubyte, R0)
1593:     prober  $3,$1,(r0)
1594:     beql    fserr
1595:     movzbl  (r0),r0
1596:     rsb
1597: 
1598:     .align  1
1599: JSBENTRY(Suword, R0|R1)
1600:     probew  $3,$4,(r0)
1601:     beql    fserr
1602:     movl    r1,(r0)
1603:     clrl    r0
1604:     rsb
1605: 
1606:     .align  1
1607: JSBENTRY(Subyte, R0|R1)
1608:     probew  $3,$1,(r0)
1609:     beql    fserr
1610:     movb    r1,(r0)
1611:     clrl    r0
1612:     rsb
1613: 
1614: /*
1615:  * Copy 1 relocation unit (NBPG bytes)
1616:  * from user virtual address to physical address
1617:  */
1618: ENTRY(copyseg, 0)
1619:     bisl3   $PG_V|PG_KW,8(ap),_CMAP2
1620:     mtpr    $_CADDR2,$TBIS  # invalidate entry for copy
1621:     movc3   $NBPG,*4(ap),_CADDR2
1622:     ret
1623: 
1624: /*
1625:  * zero out physical memory
1626:  * specified in relocation units (NBPG bytes)
1627:  */
1628: ENTRY(clearseg, 0)
1629:     bisl3   $PG_V|PG_KW,4(ap),_CMAP1
1630:     mtpr    $_CADDR1,$TBIS
1631:     movc5   $0,(sp),$0,$NBPG,_CADDR1
1632:     ret
1633: 
1634: /*
1635:  * Check address.
1636:  * Given virtual address, byte count, and rw flag
1637:  * returns 0 on no access.
1638:  */
1639: ENTRY(useracc, 0)
1640:     movl    4(ap),r0        # get va
1641:     movl    8(ap),r1        # count
1642:     tstl    12(ap)          # test for read access ?
1643:     bneq    userar          # yes
1644:     cmpl    $NBPG,r1            # can we do it in one probe ?
1645:     bgeq    uaw2            # yes
1646: uaw1:
1647:     probew  $3,$NBPG,(r0)
1648:     beql    uaerr           # no access
1649:     addl2   $NBPG,r0
1650:     acbl    $NBPG+1,$-NBPG,r1,uaw1
1651: uaw2:
1652:     probew  $3,r1,(r0)
1653:     beql    uaerr
1654:     movl    $1,r0
1655:     ret
1656: 
1657: userar:
1658:     cmpl    $NBPG,r1
1659:     bgeq    uar2
1660: uar1:
1661:     prober  $3,$NBPG,(r0)
1662:     beql    uaerr
1663:     addl2   $NBPG,r0
1664:     acbl    $NBPG+1,$-NBPG,r1,uar1
1665: uar2:
1666:     prober  $3,r1,(r0)
1667:     beql    uaerr
1668:     movl    $1,r0
1669:     ret
1670: uaerr:
1671:     clrl    r0
1672:     ret
1673: 
1674: /*
1675:  * kernacc - check for kernel access privileges
1676:  *
1677:  * We can't use the probe instruction directly because
1678:  * it ors together current and previous mode.
1679:  */
1680:  ENTRY(kernacc, 0)
1681:     movl    4(ap),r0    # virtual address
1682:     bbcc    $31,r0,kacc1
1683:     bbs $30,r0,kacerr
1684:     mfpr    $SBR,r2     # address and length of page table (system)
1685:     bbss    $31,r2,0f; 0:
1686:     mfpr    $SLR,r3
1687:     brb kacc2
1688: kacc1:
1689:     bbsc    $30,r0,kacc3
1690:     mfpr    $P0BR,r2    # user P0
1691:     mfpr    $P0LR,r3
1692:     brb kacc2
1693: kacc3:
1694:     mfpr    $P1BR,r2    # user P1 (stack)
1695:     mfpr    $P1LR,r3
1696: kacc2:
1697:     addl3   8(ap),r0,r1 # ending virtual address
1698:     addl2   $NBPG-1,r1
1699:     ashl    $-PGSHIFT,r0,r0
1700:     ashl    $-PGSHIFT,r1,r1
1701:     bbs $31,4(ap),kacc6
1702:     bbc $30,4(ap),kacc6
1703:     cmpl    r0,r3       # user stack
1704:     blss    kacerr      # address too low
1705:     brb kacc4
1706: kacc6:
1707:     cmpl    r1,r3       # compare last page to P0LR or SLR
1708:     bgtr    kacerr      # address too high
1709: kacc4:
1710:     movl    (r2)[r0],r3
1711:     bbc $31,4(ap),kacc4a
1712:     bbc $31,r3,kacerr   # valid bit is off
1713: kacc4a:
1714:     cmpzv   $27,$4,r3,$1    # check protection code
1715:     bleq    kacerr      # no access allowed
1716:     tstb    12(ap)
1717:     bneq    kacc5       # only check read access
1718:     cmpzv   $27,$2,r3,$3    # check low 2 bits of prot code
1719:     beql    kacerr      # no write access
1720: kacc5:
1721:     aoblss  r1,r0,kacc4 # next page
1722:     movl    $1,r0       # no errors
1723:     ret
1724: kacerr:
1725:     clrl    r0      # error
1726:     ret
1727: /*
1728:  * Extracted and unrolled most common case of pagein (hopefully):
1729:  *	resident and not on free list (reclaim of page is purely
1730:  *	for the purpose of simulating a reference bit)
1731:  *
1732:  * Built in constants:
1733:  *	CLSIZE of 2, any bit fields in pte's
1734:  */
1735:     .text
1736:     .globl  Fastreclaim
1737: Fastreclaim:
1738:     PUSHR
1739: #ifdef GPROF
1740:     movl    fp,-(sp)
1741:     movab   12(sp),fp
1742:     jsb mcount
1743:     movl    (sp)+,fp
1744: #endif GPROF
1745:     extzv   $9,$23,28(sp),r3    # virtual address
1746:     bicl2   $1,r3           # v = clbase(btop(virtaddr));
1747:     movl    _u+U_PROCP,r5       # p = u.u_procp
1748:                     # from vtopte(p, v) ...
1749:     movl    $1,r2           # type = CTEXT;
1750:     cmpl    r3,P_TSIZE(r5)
1751:     jlssu   1f          # if (isatsv(p, v)) {
1752:     addl3   P_TSIZE(r5),P_DSIZE(r5),r0
1753:     cmpl    r3,r0
1754:     jgequ   2f
1755:     clrl    r2          #	type = !CTEXT;
1756: 1:
1757:     ashl    $2,r3,r4
1758:     addl2   P_P0BR(r5),r4       #	tptopte(p, vtotp(p, v));
1759:     jbr 3f
1760: 2:
1761:     cvtwl   P_SZPT(r5),r4       # } else (isassv(p, v)) {
1762:     ashl    $7,r4,r4
1763:     subl2   $0x400000,r4
1764:     addl2   r3,r4
1765:     ashl    $2,r4,r4
1766:     addl2   P_P0BR(r5),r4       #	sptopte(p, vtosp(p, v));
1767:     clrl    r2          # 	type = !CTEXT;
1768: 3:                  # }
1769:     bitb    $0x82,3(r4)
1770:     beql    2f          # if (pte->pg_v || pte->pg_fod)
1771:     POPR; rsb           #	let pagein handle it
1772: 2:
1773:     bicl3   $0xffe00000,(r4),r0
1774:     jneq    2f          # if (pte->pg_pfnum == 0)
1775:     POPR; rsb           # 	let pagein handle it
1776: 2:
1777:     subl2   _firstfree,r0
1778:     ashl    $-1,r0,r0
1779:     incl    r0          # pgtocm(pte->pg_pfnum)
1780:     mull2   $SZ_CMAP,r0
1781:     addl2   _cmap,r0        # &cmap[pgtocm(pte->pg_pfnum)]
1782:     tstl    r2
1783:     jeql    2f          # if (type == CTEXT &&
1784:     jbc $C_INTRANS,(r0),2f  #     c_intrans)
1785:     POPR; rsb           # 	let pagein handle it
1786: 2:
1787:     jbc $C_FREE,(r0),2f     # if (c_free)
1788:     POPR; rsb           # 	let pagein handle it
1789: 2:
1790:     bisb2   $0x80,3(r4)     # pte->pg_v = 1;
1791:     jbc $26,4(r4),2f        # if (anycl(pte, pg_m)
1792:     bisb2   $0x04,3(r4)     #	pte->pg_m = 1;
1793: 2:
1794:     bicw3   $0x7f,2(r4),r0
1795:     bicw3   $0xff80,6(r4),r1
1796:     bisw3   r0,r1,6(r4)     # distcl(pte);
1797:     ashl    $PGSHIFT,r3,r0
1798:     mtpr    r0,$TBIS
1799:     addl2   $NBPG,r0
1800:     mtpr    r0,$TBIS        # tbiscl(v);
1801:     tstl    r2
1802:     jeql    2f          # if (type == CTEXT)
1803:     movl    P_TEXTP(r5),r0
1804:     movl    X_CADDR(r0),r5      # for (p = p->p_textp->x_caddr; p; ) {
1805:     jeql    2f
1806:     ashl    $2,r3,r3
1807: 3:
1808:     addl3   P_P0BR(r5),r3,r0    #	tpte = tptopte(p, tp);
1809:     bisb2   $1,P_FLAG+3(r5)     #	p->p_flag |= SPTECHG;
1810:     movl    (r4),(r0)+      #	for (i = 0; i < CLSIZE; i++)
1811:     movl    4(r4),(r0)      #		tpte[i] = pte[i];
1812:     movl    P_XLINK(r5),r5      #	p = p->p_xlink;
1813:     jneq    3b          # }
1814: 2:                  # collect a few statistics...
1815:     incl    _u+U_RU+RU_MINFLT   # u.u_ru.ru_minflt++;
1816:     moval   _cnt,r0
1817:     incl    V_FAULTS(r0)        # cnt.v_faults++;
1818:     incl    V_PGREC(r0)     # cnt.v_pgrec++;
1819:     incl    V_FASTPGREC(r0)     # cnt.v_fastpgrec++;
1820:     incl    V_TRAP(r0)      # cnt.v_trap++;
1821:     POPR
1822:     addl2   $8,sp           # pop pc, code
1823:     mtpr    $HIGH,$IPL      ## dont go to a higher IPL (GROT)
1824:     rei
1825:     .globl  _Xrkintr0
1826:     .align  2
1827: _Xrkintr0:
1828:     pushr   $0x3f
1829:     incl    _fltintrcnt+(4*0)
1830:     pushl   $0
1831:     calls   $1,_rkintr
1832:     popr    $0x3f
1833:     incl    _cnt+V_INTR
1834:     rei
1835: 
1836:     .globl  _Xtmintr0
1837:     .align  2
1838: _Xtmintr0:
1839:     pushr   $0x3f
1840:     incl    _fltintrcnt+(4*1)
1841:     pushl   $0
1842:     calls   $1,_tmintr
1843:     popr    $0x3f
1844:     incl    _cnt+V_INTR
1845:     rei
1846: 
1847:     .globl  _Xutintr0
1848:     .align  2
1849: _Xutintr0:
1850:     pushr   $0x3f
1851:     incl    _fltintrcnt+(4*2)
1852:     pushl   $0
1853:     calls   $1,_utintr
1854:     popr    $0x3f
1855:     incl    _cnt+V_INTR
1856:     rei
1857: 
1858:     .globl  _Xtmscpintr0
1859:     .align  2
1860: _Xtmscpintr0:
1861:     pushr   $0x3f
1862:     incl    _fltintrcnt+(4*3)
1863:     pushl   $0
1864:     calls   $1,_tmscpintr
1865:     popr    $0x3f
1866:     incl    _cnt+V_INTR
1867:     rei
1868: 
1869:     .globl  _Xupintr0
1870:     .align  2
1871: _Xupintr0:
1872:     pushr   $0x3f
1873:     incl    _fltintrcnt+(4*4)
1874:     pushl   $0
1875:     calls   $1,_upintr
1876:     popr    $0x3f
1877:     incl    _cnt+V_INTR
1878:     rei
1879: 
1880:     .globl  _Xudintr0
1881:     .align  2
1882: _Xudintr0:
1883:     pushr   $0x3f
1884:     incl    _fltintrcnt+(4*5)
1885:     pushl   $0
1886:     calls   $1,_udintr
1887:     popr    $0x3f
1888:     incl    _cnt+V_INTR
1889:     rei
1890: 
1891:     .globl  _Xidcintr0
1892:     .align  2
1893: _Xidcintr0:
1894:     pushr   $0x3f
1895:     incl    _fltintrcnt+(4*6)
1896:     pushl   $0
1897:     calls   $1,_idcintr
1898:     popr    $0x3f
1899:     incl    _cnt+V_INTR
1900:     rei
1901: 
1902:     .globl  _Xrlintr0
1903:     .align  2
1904: _Xrlintr0:
1905:     pushr   $0x3f
1906:     incl    _fltintrcnt+(4*7)
1907:     pushl   $0
1908:     calls   $1,_rlintr
1909:     popr    $0x3f
1910:     incl    _cnt+V_INTR
1911:     rei
1912: 
1913:     .globl  _Xdhrint0
1914:     .align  2
1915: _Xdhrint0:
1916:     pushr   $0x3f
1917:     incl    _fltintrcnt+(4*8)
1918:     pushl   $0
1919:     calls   $1,_dhrint
1920:     popr    $0x3f
1921:     incl    _cnt+V_INTR
1922:     rei
1923: 
1924:     .globl  _Xdhxint0
1925:     .align  2
1926: _Xdhxint0:
1927:     pushr   $0x3f
1928:     incl    _fltintrcnt+(4*9)
1929:     pushl   $0
1930:     calls   $1,_dhxint
1931:     popr    $0x3f
1932:     incl    _cnt+V_INTR
1933:     rei
1934: 
1935:     .globl  _Xdmintr0
1936:     .align  2
1937: _Xdmintr0:
1938:     pushr   $0x3f
1939:     incl    _fltintrcnt+(4*10)
1940:     pushl   $0
1941:     calls   $1,_dmintr
1942:     popr    $0x3f
1943:     incl    _cnt+V_INTR
1944:     rei
1945: 
1946:     .globl  _Xdhrint1
1947:     .align  2
1948: _Xdhrint1:
1949:     pushr   $0x3f
1950:     incl    _fltintrcnt+(4*11)
1951:     pushl   $1
1952:     calls   $1,_dhrint
1953:     popr    $0x3f
1954:     incl    _cnt+V_INTR
1955:     rei
1956: 
1957:     .globl  _Xdhxint1
1958:     .align  2
1959: _Xdhxint1:
1960:     pushr   $0x3f
1961:     incl    _fltintrcnt+(4*12)
1962:     pushl   $1
1963:     calls   $1,_dhxint
1964:     popr    $0x3f
1965:     incl    _cnt+V_INTR
1966:     rei
1967: 
1968:     .globl  _Xdzrint0
1969:     .align  2
1970: _Xdzrint0:
1971:     pushr   $0x3f
1972:     incl    _fltintrcnt+(4*13)
1973:     pushl   $0
1974:     calls   $1,_dzrint
1975:     popr    $0x3f
1976:     incl    _cnt+V_INTR
1977:     rei
1978: 
1979:     .globl  _Xdzxint0
1980:     .align  2
1981: _Xdzxint0:
1982:     pushr   $0x3f
1983:     incl    _fltintrcnt+(4*14)
1984:     movl    $0,r0
1985:     jmp dzdma
1986: 
1987:     .globl  _Xdzrint1
1988:     .align  2
1989: _Xdzrint1:
1990:     pushr   $0x3f
1991:     incl    _fltintrcnt+(4*15)
1992:     pushl   $1
1993:     calls   $1,_dzrint
1994:     popr    $0x3f
1995:     incl    _cnt+V_INTR
1996:     rei
1997: 
1998:     .globl  _Xdzxint1
1999:     .align  2
2000: _Xdzxint1:
2001:     pushr   $0x3f
2002:     incl    _fltintrcnt+(4*16)
2003:     movl    $1,r0
2004:     jmp dzdma
2005: 
2006:     .globl  _Xdzrint2
2007:     .align  2
2008: _Xdzrint2:
2009:     pushr   $0x3f
2010:     incl    _fltintrcnt+(4*17)
2011:     pushl   $2
2012:     calls   $1,_dzrint
2013:     popr    $0x3f
2014:     incl    _cnt+V_INTR
2015:     rei
2016: 
2017:     .globl  _Xdzxint2
2018:     .align  2
2019: _Xdzxint2:
2020:     pushr   $0x3f
2021:     incl    _fltintrcnt+(4*18)
2022:     movl    $2,r0
2023:     jmp dzdma
2024: 
2025:     .globl  _Xdzrint3
2026:     .align  2
2027: _Xdzrint3:
2028:     pushr   $0x3f
2029:     incl    _fltintrcnt+(4*19)
2030:     pushl   $3
2031:     calls   $1,_dzrint
2032:     popr    $0x3f
2033:     incl    _cnt+V_INTR
2034:     rei
2035: 
2036:     .globl  _Xdzxint3
2037:     .align  2
2038: _Xdzxint3:
2039:     pushr   $0x3f
2040:     incl    _fltintrcnt+(4*20)
2041:     movl    $3,r0
2042:     jmp dzdma
2043: 
2044:     .globl  _Xdzrint4
2045:     .align  2
2046: _Xdzrint4:
2047:     pushr   $0x3f
2048:     incl    _fltintrcnt+(4*21)
2049:     pushl   $4
2050:     calls   $1,_dzrint
2051:     popr    $0x3f
2052:     incl    _cnt+V_INTR
2053:     rei
2054: 
2055:     .globl  _Xdzxint4
2056:     .align  2
2057: _Xdzxint4:
2058:     pushr   $0x3f
2059:     incl    _fltintrcnt+(4*22)
2060:     movl    $4,r0
2061:     jmp dzdma
2062: 
2063:     .globl  _Xdzrint5
2064:     .align  2
2065: _Xdzrint5:
2066:     pushr   $0x3f
2067:     incl    _fltintrcnt+(4*23)
2068:     pushl   $5
2069:     calls   $1,_dzrint
2070:     popr    $0x3f
2071:     incl    _cnt+V_INTR
2072:     rei
2073: 
2074:     .globl  _Xdzxint5
2075:     .align  2
2076: _Xdzxint5:
2077:     pushr   $0x3f
2078:     incl    _fltintrcnt+(4*24)
2079:     movl    $5,r0
2080:     jmp dzdma
2081: 
2082:     .globl  _Xdzrint6
2083:     .align  2
2084: _Xdzrint6:
2085:     pushr   $0x3f
2086:     incl    _fltintrcnt+(4*25)
2087:     pushl   $6
2088:     calls   $1,_dzrint
2089:     popr    $0x3f
2090:     incl    _cnt+V_INTR
2091:     rei
2092: 
2093:     .globl  _Xdzxint6
2094:     .align  2
2095: _Xdzxint6:
2096:     pushr   $0x3f
2097:     incl    _fltintrcnt+(4*26)
2098:     movl    $6,r0
2099:     jmp dzdma
2100: 
2101:     .globl  _Xdzrint7
2102:     .align  2
2103: _Xdzrint7:
2104:     pushr   $0x3f
2105:     incl    _fltintrcnt+(4*27)
2106:     pushl   $7
2107:     calls   $1,_dzrint
2108:     popr    $0x3f
2109:     incl    _cnt+V_INTR
2110:     rei
2111: 
2112:     .globl  _Xdzxint7
2113:     .align  2
2114: _Xdzxint7:
2115:     pushr   $0x3f
2116:     incl    _fltintrcnt+(4*28)
2117:     movl    $7,r0
2118:     jmp dzdma
2119: 
2120:     .globl  _Xtsintr0
2121:     .align  2
2122: _Xtsintr0:
2123:     pushr   $0x3f
2124:     incl    _fltintrcnt+(4*29)
2125:     pushl   $0
2126:     calls   $1,_tsintr
2127:     popr    $0x3f
2128:     incl    _cnt+V_INTR
2129:     rei
2130: 
2131:     .globl  _Xdmfsrint0
2132:     .align  2
2133: _Xdmfsrint0:
2134:     pushr   $0x3f
2135:     incl    _fltintrcnt+(4*30)
2136:     pushl   $0
2137:     calls   $1,_dmfsrint
2138:     popr    $0x3f
2139:     incl    _cnt+V_INTR
2140:     rei
2141: 
2142:     .globl  _Xdmfsxint0
2143:     .align  2
2144: _Xdmfsxint0:
2145:     pushr   $0x3f
2146:     incl    _fltintrcnt+(4*31)
2147:     pushl   $0
2148:     calls   $1,_dmfsxint
2149:     popr    $0x3f
2150:     incl    _cnt+V_INTR
2151:     rei
2152: 
2153:     .globl  _Xdmfdaint0
2154:     .align  2
2155: _Xdmfdaint0:
2156:     pushr   $0x3f
2157:     incl    _fltintrcnt+(4*32)
2158:     pushl   $0
2159:     calls   $1,_dmfdaint
2160:     popr    $0x3f
2161:     incl    _cnt+V_INTR
2162:     rei
2163: 
2164:     .globl  _Xdmfdbint0
2165:     .align  2
2166: _Xdmfdbint0:
2167:     pushr   $0x3f
2168:     incl    _fltintrcnt+(4*33)
2169:     pushl   $0
2170:     calls   $1,_dmfdbint
2171:     popr    $0x3f
2172:     incl    _cnt+V_INTR
2173:     rei
2174: 
2175:     .globl  _Xdmfrint0
2176:     .align  2
2177: _Xdmfrint0:
2178:     pushr   $0x3f
2179:     incl    _fltintrcnt+(4*34)
2180:     pushl   $0
2181:     calls   $1,_dmfrint
2182:     popr    $0x3f
2183:     incl    _cnt+V_INTR
2184:     rei
2185: 
2186:     .globl  _Xdmfxint0
2187:     .align  2
2188: _Xdmfxint0:
2189:     pushr   $0x3f
2190:     incl    _fltintrcnt+(4*35)
2191:     pushl   $0
2192:     calls   $1,_dmfxint
2193:     popr    $0x3f
2194:     incl    _cnt+V_INTR
2195:     rei
2196: 
2197:     .globl  _Xdmflint0
2198:     .align  2
2199: _Xdmflint0:
2200:     pushr   $0x3f
2201:     incl    _fltintrcnt+(4*36)
2202:     pushl   $0
2203:     calls   $1,_dmflint
2204:     popr    $0x3f
2205:     incl    _cnt+V_INTR
2206:     rei
2207: 
2208:     .globl  _Xdmzrinta0
2209:     .align  2
2210: _Xdmzrinta0:
2211:     pushr   $0x3f
2212:     incl    _fltintrcnt+(4*37)
2213:     pushl   $0
2214:     calls   $1,_dmzrinta
2215:     popr    $0x3f
2216:     incl    _cnt+V_INTR
2217:     rei
2218: 
2219:     .globl  _Xdmzxinta0
2220:     .align  2
2221: _Xdmzxinta0:
2222:     pushr   $0x3f
2223:     incl    _fltintrcnt+(4*38)
2224:     pushl   $0
2225:     calls   $1,_dmzxinta
2226:     popr    $0x3f
2227:     incl    _cnt+V_INTR
2228:     rei
2229: 
2230:     .globl  _Xdmzrintb0
2231:     .align  2
2232: _Xdmzrintb0:
2233:     pushr   $0x3f
2234:     incl    _fltintrcnt+(4*39)
2235:     pushl   $0
2236:     calls   $1,_dmzrintb
2237:     popr    $0x3f
2238:     incl    _cnt+V_INTR
2239:     rei
2240: 
2241:     .globl  _Xdmzxintb0
2242:     .align  2
2243: _Xdmzxintb0:
2244:     pushr   $0x3f
2245:     incl    _fltintrcnt+(4*40)
2246:     pushl   $0
2247:     calls   $1,_dmzxintb
2248:     popr    $0x3f
2249:     incl    _cnt+V_INTR
2250:     rei
2251: 
2252:     .globl  _Xdmzrintc0
2253:     .align  2
2254: _Xdmzrintc0:
2255:     pushr   $0x3f
2256:     incl    _fltintrcnt+(4*41)
2257:     pushl   $0
2258:     calls   $1,_dmzrintc
2259:     popr    $0x3f
2260:     incl    _cnt+V_INTR
2261:     rei
2262: 
2263:     .globl  _Xdmzxintc0
2264:     .align  2
2265: _Xdmzxintc0:
2266:     pushr   $0x3f
2267:     incl    _fltintrcnt+(4*42)
2268:     pushl   $0
2269:     calls   $1,_dmzxintc
2270:     popr    $0x3f
2271:     incl    _cnt+V_INTR
2272:     rei
2273: 
2274:     .globl  _Xdhurint0
2275:     .align  2
2276: _Xdhurint0:
2277:     pushr   $0x3f
2278:     incl    _fltintrcnt+(4*43)
2279:     pushl   $0
2280:     calls   $1,_dhurint
2281:     popr    $0x3f
2282:     incl    _cnt+V_INTR
2283:     rei
2284: 
2285:     .globl  _Xdhuxint0
2286:     .align  2
2287: _Xdhuxint0:
2288:     pushr   $0x3f
2289:     incl    _fltintrcnt+(4*44)
2290:     pushl   $0
2291:     calls   $1,_dhuxint
2292:     popr    $0x3f
2293:     incl    _cnt+V_INTR
2294:     rei
2295: 
2296:     .globl  _Xlpintr0
2297:     .align  2
2298: _Xlpintr0:
2299:     pushr   $0x3f
2300:     incl    _fltintrcnt+(4*45)
2301:     pushl   $0
2302:     calls   $1,_lpintr
2303:     popr    $0x3f
2304:     incl    _cnt+V_INTR
2305:     rei
2306: 
2307:     .globl  _Xenxint0
2308:     .align  2
2309: _Xenxint0:
2310:     pushr   $0x3f
2311:     incl    _fltintrcnt+(4*46)
2312:     pushl   $0
2313:     calls   $1,_enxint
2314:     popr    $0x3f
2315:     incl    _cnt+V_INTR
2316:     rei
2317: 
2318:     .globl  _Xenrint0
2319:     .align  2
2320: _Xenrint0:
2321:     pushr   $0x3f
2322:     incl    _fltintrcnt+(4*47)
2323:     pushl   $0
2324:     calls   $1,_enrint
2325:     popr    $0x3f
2326:     incl    _cnt+V_INTR
2327:     rei
2328: 
2329:     .globl  _Xencollide0
2330:     .align  2
2331: _Xencollide0:
2332:     pushr   $0x3f
2333:     incl    _fltintrcnt+(4*48)
2334:     pushl   $0
2335:     calls   $1,_encollide
2336:     popr    $0x3f
2337:     incl    _cnt+V_INTR
2338:     rei
2339: 
2340:     .globl  _Xecrint0
2341:     .align  2
2342: _Xecrint0:
2343:     pushr   $0x3f
2344:     incl    _fltintrcnt+(4*49)
2345:     pushl   $0
2346:     calls   $1,_ecrint
2347:     popr    $0x3f
2348:     incl    _cnt+V_INTR
2349:     rei
2350: 
2351:     .globl  _Xeccollide0
2352:     .align  2
2353: _Xeccollide0:
2354:     pushr   $0x3f
2355:     incl    _fltintrcnt+(4*50)
2356:     pushl   $0
2357:     calls   $1,_eccollide
2358:     popr    $0x3f
2359:     incl    _cnt+V_INTR
2360:     rei
2361: 
2362:     .globl  _Xecxint0
2363:     .align  2
2364: _Xecxint0:
2365:     pushr   $0x3f
2366:     incl    _fltintrcnt+(4*51)
2367:     pushl   $0
2368:     calls   $1,_ecxint
2369:     popr    $0x3f
2370:     incl    _cnt+V_INTR
2371:     rei
2372: 
2373:     .globl  _Xdeintr0
2374:     .align  2
2375: _Xdeintr0:
2376:     pushr   $0x3f
2377:     incl    _fltintrcnt+(4*52)
2378:     pushl   $0
2379:     calls   $1,_deintr
2380:     popr    $0x3f
2381:     incl    _cnt+V_INTR
2382:     rei
2383: 
2384:     .globl  _Xilrint0
2385:     .align  2
2386: _Xilrint0:
2387:     pushr   $0x3f
2388:     incl    _fltintrcnt+(4*53)
2389:     pushl   $0
2390:     calls   $1,_ilrint
2391:     popr    $0x3f
2392:     incl    _cnt+V_INTR
2393:     rei
2394: 
2395:     .globl  _Xilcint0
2396:     .align  2
2397: _Xilcint0:
2398:     pushr   $0x3f
2399:     incl    _fltintrcnt+(4*54)
2400:     pushl   $0
2401:     calls   $1,_ilcint
2402:     popr    $0x3f
2403:     incl    _cnt+V_INTR
2404:     rei
2405: 
2406:     .globl  _Xexcdint0
2407:     .align  2
2408: _Xexcdint0:
2409:     pushr   $0x3f
2410:     incl    _fltintrcnt+(4*55)
2411:     pushl   $0
2412:     calls   $1,_excdint
2413:     popr    $0x3f
2414:     incl    _cnt+V_INTR
2415:     rei
2416: 
2417: 
2418:     .globl  _intrnames
2419: 
2420:     .globl  _eintrnames
2421:     .data
2422: _intrnames:
2423:     .asciz  "clock"
2424:     .asciz  "cnr"
2425:     .asciz  "cnx"
2426:     .asciz  "tur"
2427:     .asciz  "tux"
2428:     .asciz  "mba0"
2429:     .asciz  "mba1"
2430:     .asciz  "mba2"
2431:     .asciz  "mba3"
2432:     .asciz  "uba0"
2433:     .asciz  "uba1"
2434:     .asciz  "uba2"
2435:     .asciz  "uba3"
2436:     .asciz  "rk0"
2437:     .asciz  "tm0"
2438:     .asciz  "ut0"
2439:     .asciz  "tmscp0"
2440:     .asciz  "up0"
2441:     .asciz  "ud0"
2442:     .asciz  "idc0"
2443:     .asciz  "rl0"
2444:     .asciz  "dhr0"
2445:     .asciz  "dhx0"
2446:     .asciz  "dm0"
2447:     .asciz  "dhr1"
2448:     .asciz  "dhx1"
2449:     .asciz  "dzr0"
2450:     .asciz  "dzx0"
2451:     .asciz  "dzr1"
2452:     .asciz  "dzx1"
2453:     .asciz  "dzr2"
2454:     .asciz  "dzx2"
2455:     .asciz  "dzr3"
2456:     .asciz  "dzx3"
2457:     .asciz  "dzr4"
2458:     .asciz  "dzx4"
2459:     .asciz  "dzr5"
2460:     .asciz  "dzx5"
2461:     .asciz  "dzr6"
2462:     .asciz  "dzx6"
2463:     .asciz  "dzr7"
2464:     .asciz  "dzx7"
2465:     .asciz  "ts0"
2466:     .asciz  "dmfsr0"
2467:     .asciz  "dmfsx0"
2468:     .asciz  "dmfda0"
2469:     .asciz  "dmfdb0"
2470:     .asciz  "dmfr0"
2471:     .asciz  "dmfx0"
2472:     .asciz  "dmfl0"
2473:     .asciz  "dmzra0"
2474:     .asciz  "dmzxa0"
2475:     .asciz  "dmzrb0"
2476:     .asciz  "dmzxb0"
2477:     .asciz  "dmzrc0"
2478:     .asciz  "dmzxc0"
2479:     .asciz  "dhur0"
2480:     .asciz  "dhux0"
2481:     .asciz  "lp0"
2482:     .asciz  "enx0"
2483:     .asciz  "enr0"
2484:     .asciz  "encollide0"
2485:     .asciz  "ecr0"
2486:     .asciz  "eccollide0"
2487:     .asciz  "ecx0"
2488:     .asciz  "de0"
2489:     .asciz  "ilr0"
2490:     .asciz  "ilc0"
2491:     .asciz  "excd0"
2492: _eintrnames:
2493: 
2494:     .globl  _intrcnt
2495: 
2496:     .globl  _eintrcnt
2497:     .align 2
2498: _intrcnt:
2499:     .space  4 * 13
2500: _fltintrcnt:
2501:     .space  4 * 56
2502: _eintrcnt:
2503: 
2504:     .text

Defined functions

$ defined in line 1087; used 30 times
EMULATE defined in line 707; never used
ENTRY defined in line 1087; never used
JSBENTRY defined in line 1087; never used
PCB_ESP defined in line 972; never used
PCB_KSP defined in line 972; never used
PCB_P0BR defined in line 972; never used
PCB_P0LR defined in line 972; used 1 times
PCB_P1BR defined in line 972; never used
PCB_P1LR defined in line 972; never used
PCB_PC defined in line 972; never used
PCB_PSL defined in line 972; never used
PCB_R10 defined in line 972; never used
PCB_R11 defined in line 972; never used
PCB_SIGC defined in line 972; never used
PCB_SSP defined in line 972; never used
PCB_SZPT defined in line 972; never used
PCB_USP defined in line 972; never used
PCLOC defined in line 1087; never used
PRINTF defined in line 659; never used
P_RLINK defined in line 1087; never used
P_TSIZE defined in line 1685; never used
P_WCHAN defined in line 1087; never used
SCBVEC defined in line 807; never used
SYSMAP defined in line 815; never used
TRAP defined in line 733; never used
UPAGES defined in line 952; never used
V_FASTPGREC defined in line 1788; never used
V_FAULTS defined in line 1788; never used
V_PGREC defined in line 1788; never used
V_TRAP defined in line 1788; never used
addl2 defined in line 815; used 22 times
blbs defined in line 733; never used
clrw defined in line 428; never used
incl defined in line 428; used 136 times
jmp defined in line 1087; used 10 times
jsb defined in line 733; used 6 times
movb defined in line 428; used 8 times
movl defined in line 1685; used 121 times
movq defined in line 1087; used 4 times
pushl defined in line 428; used 77 times
tstb defined in line 1087; used 1 times
tstl defined in line 1087; used 19 times
tstw defined in line 1086; never used

Defined variables

text defined in line 224; used 8 times

Defined macros

APLOC defined in line 1377; used 1 times
CLSIZE defined in line 34; used 22 times
EMULATE defined in line 688; used 20 times
EMUTABLE defined in line 686; never used
ENTRY defined in line 1058; never used
IS defined in line 86; used 15 times
I_CLOCK defined in line 118; used 1 times
I_CNR defined in line 119; used 1 times
I_CNX defined in line 120; used 1 times
I_MBA0 defined in line 123; used 1 times
I_MBA1 defined in line 124; used 1 times
I_MBA2 defined in line 125; used 1 times
I_MBA3 defined in line 126; used 1 times
I_TUR defined in line 121; used 1 times
I_TUX defined in line 122; used 1 times
I_UBA defined in line 302; used 1 times
I_UBA0 defined in line 127; used 1 times
I_UBA1 defined in line 128; never used
I_UBA2 defined in line 129; never used
I_UBA3 defined in line 130; never used
JSBENTRY defined in line 1060; never used
KS defined in line 85; used 17 times
MSG defined in line 218; used 1 times
MSGBUFPTECNT defined in line 37; used 1 times
NMBCLUSTERS defined in line 38; used 1 times
NOEMULATE defined in line 687; used 41 times
PANIC defined in line 215; used 3 times
PCLOC defined in line 1376; used 1 times
PJ defined in line 649; used 128 times
POPR defined in line 220; used 25 times
PRINTF defined in line 217; used 3 times
PUSHR defined in line 219; used 29 times
P_ADDR defined in line 5; used 1 times
P_DSIZE defined in line 10; used 1 times
P_FLAG defined in line 15; used 1 times
P_LINK defined in line 2; never used
P_P0BR defined in line 12; used 3 times
P_PRI defined in line 6; used 2 times
P_RLINK defined in line 3; never used
P_SSIZE defined in line 11; never used
P_STAT defined in line 7; used 1 times
P_SZPT defined in line 13; used 1 times
P_TEXTP defined in line 14; used 1 times
P_TSIZE defined in line 9; used 1 times
P_WCHAN defined in line 8; never used
P_XLINK defined in line 4; used 1 times
R0 defined in line 1063; used 9 times
R1 defined in line 1064; used 4 times
R2 defined in line 1065; never used
R3 defined in line 1066; used 2 times
R4 defined in line 1067; never used
R5 defined in line 1068; used 2 times
R6 defined in line 1069; used 3 times
RP_FLAG defined in line 22; used 2 times
RU_MINFLT defined in line 41; used 1 times
SCBVEC defined in line 214; never used
SRUN defined in line 17; never used
SSLEEP defined in line 16; never used
STOP defined in line 87; used 1 times
  • in line 89
STRAY defined in line 82; used 50 times
STRAY15 defined in line 84; used 4 times
STRAY8 defined in line 83; used 1 times
  • in line 84
SYSMAP defined in line 827; never used
SYSPTSIZE defined in line 35; used 1 times
TRAP defined in line 713; used 1 times
UBA_BRRVR defined in line 18; used 1 times
UH_SIZE defined in line 21; used 8 times
UH_UBA defined in line 19; used 1 times
UH_VEC defined in line 20; used 1 times
UPAGES defined in line 33; used 11 times
USRPTSIZE defined in line 36; used 1 times
U_PROCP defined in line 39; used 1 times
U_RU defined in line 40; used 1 times
V_FASTPGREC defined in line 32; never used
V_FAULTS defined in line 30; never used
V_INTR defined in line 27; used 55 times
V_PDMA defined in line 29; used 1 times
V_PGREC defined in line 31; never used
V_SOFT defined in line 28; used 2 times
V_SWTCH defined in line 24; used 1 times
V_SYSCALL defined in line 26; used 1 times
V_TRAP defined in line 25; used 1 times
X_CADDR defined in line 23; used 1 times
_rpbmap defined in line 188; used 4 times
rUBA defined in line 299; used 2 times
rUBAHD defined in line 297; used 10 times
rUBANUM defined in line 296; used 9 times
rUVEC defined in line 298; used 4 times
vaddr defined in line 826; used 1 times
Last modified: 1986-06-07
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3219
Valid CSS Valid XHTML 1.0 Strict