|
|
1.1 ! root 1: /* ! 2: * The following primitives use the fancy VAX instructions ! 3: * much like VMS does. _whichqs tells which of the 32 queues _qs ! 4: * have processes in them. Setrq puts processes into queues, Remrq ! 5: * removes them from queues. The running process is on no queue, ! 6: * other processes are on a queue related to p->p_pri, divided by 4 ! 7: * actually to shrink the 0-127 range of priorities into the 32 available ! 8: * queues. ! 9: */ ! 10: .comm _noproc,4 ! 11: .comm _runrun,4 ! 12: .text ! 13: ! 14: /* ! 15: * Setrq(p), using fancy VAX instructions. ! 16: * ! 17: * Call should be made at spl6(), and p->p_stat should be SRUN ! 18: */ ! 19: .globl _Setrq # <<<massaged to jsb by "asm.sed">>> ! 20: _Setrq: ! 21: tstl P_RLINK(r0) ## firewall: p->p_rlink must be 0 ! 22: beql set1 ## ! 23: pushab set3 ## ! 24: calls $1,_panic ## ! 25: set1: ! 26: bitl $SPROCIO,P_FLAG(r0) # if he's getting PROCIO'd, ! 27: bneq set2 # we leave him alone ! 28: movzbl P_PRI(r0),r1 # put on queue which is p->p_pri / 4 ! 29: ashl $-2,r1,r1 ! 30: movaq _qs[r1],r2 ! 31: insque (r0),*4(r2) # at end of queue ! 32: bbss r1,_whichqs,set2 # mark queue non-empty ! 33: set2: ! 34: rsb ! 35: ! 36: set3: .asciz "setrq" ! 37: ! 38: /* ! 39: * Remrq(p), using fancy VAX instructions ! 40: * ! 41: * Call should be made at spl6(). ! 42: */ ! 43: .globl _Remrq # <<<massaged to jsb by "asm.sed">>> ! 44: _Remrq: ! 45: bitl $SPROCIO,P_FLAG(r0) # if he's getting PROCIO'd, ! 46: bneq rem2a # we leave him alone ! 47: movzbl P_PRI(r0),r1 ! 48: ashl $-2,r1,r1 ! 49: bbsc r1,_whichqs,rem1 ! 50: pushab rem3 # it wasn't recorded to be on its q ! 51: calls $1,_panic ! 52: rem1: ! 53: remque (r0),r2 ! 54: beql rem2 ! 55: bbss r1,_whichqs,rem2 ! 56: rem2: ! 57: clrl P_RLINK(r0) ## for firewall checking ! 58: rem2a: ! 59: rsb ! 60: ! 61: rem3: .asciz "remrq" ! 62: ! 63: /* ! 64: * Masterpaddr is the p->p_addr of the running process on the master ! 65: * processor. When a multiprocessor system, the slave processors will have ! 66: * an array of slavepaddr's. ! 67: */ ! 68: .globl _masterpaddr ! 69: .data ! 70: _masterpaddr: ! 71: .long 0 ! 72: ! 73: .text ! 74: sw0: .asciz "swtch" ! 75: /* ! 76: * Swtch(), using fancy VAX instructions ! 77: */ ! 78: .globl _Swtch ! 79: _Swtch: # <<<massaged to jsb by "asm.sed">>> ! 80: movl $1,_noproc ! 81: clrl _runrun ! 82: sw1: ffs $0,$32,_whichqs,r0 # look for non-empty queue ! 83: bneq sw1a ! 84: mtpr $0,$IPL # must allow interrupts here ! 85: brw sw1 # this is an idle loop! ! 86: sw1a: mtpr $0x18,$IPL # lock out all so _whichqs==_qs ! 87: bbcc r0,_whichqs,sw1 # proc moved via lbolt interrupt ! 88: movaq _qs[r0],r1 ! 89: remque *(r1),r2 # r2 = p = highest pri process ! 90: bvc sw2 # make sure something was there ! 91: sw1b: pushab sw0 ! 92: calls $1,_panic ! 93: sw2: beql sw3 ! 94: insv $1,r0,$1,_whichqs # still more procs in this queue ! 95: sw3: ! 96: clrl _noproc ! 97: movzbl P_STAT(r2),r3 ## firewalls ! 98: cmpl $SRUN,r3 ## ! 99: bneq sw1b ## ! 100: clrl P_RLINK(r2) ## ! 101: movl *P_ADDR(r2),r0 ! 102: movl r0,_masterpaddr ! 103: ashl $PGSHIFT,r0,r0 # r0 = pcbb(p) ! 104: # mfpr $PCBB,r1 # resume of current proc is easy ! 105: # cmpl r0,r1 ! 106: # beql res0 ! 107: # incl _cnt+V_SWTCH ! 108: /* fall into... */ ! 109: ! 110: /* ! 111: * Resume(pf) ! 112: */ ! 113: .globl _Resume # <<<massaged to jsb by "asm.sed">>> ! 114: _Resume: ! 115: mtpr $0x18,$IPL # no interrupts, please ! 116: pushl _nofault ! 117: pushl _CMAP2 # yech ! 118: svpctx ! 119: mtpr r0,$PCBB ! 120: ldpctx ! 121: movl (sp)+,_CMAP2 # yech ! 122: mtpr $_CADDR2,$TBIS ! 123: movl (sp)+,_nofault ! 124: res0: ! 125: tstl _u+PCB_SSWAP ! 126: bneq res1 ! 127: rei ! 128: ! 129: res1: ! 130: movl _u+PCB_SSWAP,r0 # longjmp to saved context ! 131: clrl _u+PCB_SSWAP ! 132: movq (r0)+,r6 ! 133: movq (r0)+,r8 ! 134: movq (r0)+,r10 ! 135: movq (r0)+,r12 ! 136: movl (r0)+,r1 ! 137: cmpl r1,sp # must be a pop ! 138: bgequ 1f ! 139: pushab 2f ! 140: calls $1,_panic ! 141: /* NOTREACHED */ ! 142: 1: ! 143: movl r1,sp ! 144: movl (r0),(sp) # address to return to ! 145: movl $PSL_PRVMOD,4(sp) # ``cheating'' (jfr) ! 146: rei ! 147: ! 148: 2: .asciz "ldctx"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.