|
|
1.1 ! root 1: ! 2: # ! 3: # *kernel call event test (virtual) ! 4: # *Try KCALL 3 times with different operand specifiers ! 5: # ! 6: # R3 = which KCALL is testing (1,2,3) ! 7: # R0 = error code ! 8: # 1 - Error in KSP after Kcall ! 9: # R1 = actual KSP, R2 = expected KSP ! 10: # 2 - Error in Kcall parameter pushed on the stack ! 11: # R1 = actual, R2 = expected ! 12: # 3 - Error in PC pushed on the stack ! 13: # R1 = actual, R2 = expected ! 14: # 4 - Error in PSL pushed on the stack ! 15: # R1 = actual, R2 = expected ! 16: # ! 17: .globl _kcall_evt ! 18: _kcall_evt: ! 19: .word 0x1fff ! 20: ! 21: mtpr $1,$TBIA /* Purge Translation buffer */ ! 22: clrl loopcnt /* Try Kcall 3 times */ ! 23: # ! 24: # Set up user P2PT : ! 25: # ! 26: movl $241,r1 ! 27: movl _unused,r2 ! 28: movl $255,r3 ! 29: 1: ! 30: orl3 $(PG_V|PG_UW),r2,_u0p2pt[r1] ! 31: incl r2 ! 32: aobleq r3,r1,1b ! 33: ! 34: movl $255,r2 ! 35: andl2 $0x7fffffff,_u0p2pt[r2] ! 36: ! 37: movl $250,r2 ! 38: andl2 $0x7fffffff,_u0p2pt[r2] ! 39: decl r2 ! 40: andl2 $0x7fffffff,_u0p2pt[r2] ! 41: movl $244,r2 ! 42: andl2 $0x7fffffff,_u0p2pt[r2] ! 43: # ! 44: # Set up User P0PT : Virtual page 0 to N are mapped ! 45: # to physical pages that contain User code. PTEs are ! 46: # set to valid, User/Kernel read. ! 47: # ! 48: clrl r2 ! 49: andl3 $_utest,$0x3fffffff,r1 /* R1 = First addr of User code */ ! 50: andl3 $0x000003ff,r1,r7 ! 51: shrl $PGSHIFT,r1,r1 /* R1 = First page no of User code */ ! 52: movl $_eutest+NBPG-1,r3 /* R3 = Last VA of user code */ ! 53: andl2 $0x3fffffff,r3 ! 54: shrl $PGSHIFT,r3,r3 /* R3 = Last page no of User code */ ! 55: 1: ! 56: orl3 $(PG_V|PG_UW),r1,_u0p0pt[r2] /* Valid, User/Kernel write */ ! 57: incl r2 /* Next page */ ! 58: aobleq r3,r1,1b ! 59: ! 60: movab _pcb0,r1 /* Initialize PCB #0 */ ! 61: movl $0xbfffe3fc,PCB_KSP(r1) ! 62: movl $0xbfffe3fc,exp_ksp ! 63: movl $0xbffffbfc,PCB_USP(r1) ! 64: movl r7,PCB_PC(r1) ! 65: movl $0x01000000,PCB_PSL(r1) /* PCB_PSL : User mode, IPL 0 */ ! 66: movl $0x01000000,exp_upsl /* Set expected PSL */ ! 67: movl $_u0p0pt,PCB_P0BR(r1) ! 68: movl $_u0p1pt,PCB_P1BR(r1) ! 69: movl $0xbfc03400,PCB_P2BR(r1) ! 70: movl $3,PCB_P0LR(r1) ! 71: movl $8,PCB_P1LR(r1) ! 72: movl $0x000ffff0,PCB_P2LR(r1) ! 73: ! 74: movl _scb+SYSVEC,_savvec0 /* Save original Kcall handler */ ! 75: movab _u0ret,_scb+SYSVEC /* Set new Kcall handler */ ! 76: andl2 $0x3fffffff,r1 ! 77: mtpr r1,$PCBB /* Set PCBB */ ! 78: mtpr $1,$TBIA /* Purge translation buffer */ ! 79: mtpr $1,$PADC /* Purge data cache */ ! 80: movl r13,_savvec1 /* Saved original FP */ ! 81: ! 82: ldpctx /* Load user context */ ! 83: rei /* Switch to user */ ! 84: # ! 85: # Kcall Handler : service on Kernel stack ! 86: # ! 87: .align 2 ! 88: _u0ret: ! 89: mtpr $HIGH,$IPL ! 90: mtpr $1,$PADC /* Purge data cache */ ! 91: ! 92: movab (sp),r1 /* R1 = current KSP */ ! 93: subl3 $0xc,exp_ksp,r2 /* R2 = Expected KSP after Kcall exception */ ! 94: cmpl r1,r2 ! 95: beql 1f ! 96: movl $1,r0 ! 97: addl3 $1,loopcnt,r3 ! 98: jmp *badrtn /* Error : too many parameters pushed on KSP */ ! 99: 1: ! 100: movl (sp)+,r1 /* R1 = Parameter of Kcall */ ! 101: movl $DONE,r2 ! 102: cmpl r1,r2 /* Check Kcall parameter pushed on KSP */ ! 103: beql 1f ! 104: movl $2,r0 /* R0 = Which part is failed */ ! 105: addl3 $1,loopcnt,r3 ! 106: jmp *badrtn /* Error : did not receive correct parameter */ ! 107: 1: ! 108: movl exp_upc,r2 /* R2 = expected PC */ ! 109: movl (sp),r1 /* R1 = actual PC pushed */ ! 110: cmpl r1,r2 /* Check PC pushed on the KSP */ ! 111: beql 1f ! 112: movl $3,r0 ! 113: addl3 $1,loopcnt,r3 ! 114: jmp *badrtn ! 115: 1: ! 116: movl exp_upsl,r2 /* R2 = expected PSL */ ! 117: andl3 $0xfffffff0,4(sp),r1 /* R1 = actual PSL pushed */ ! 118: cmpl r1,r2 /* Check PSL pushed on the KSP */ ! 119: beql 1f ! 120: movl $4,r0 ! 121: addl3 $1,loopcnt,r3 ! 122: jmp *badrtn ! 123: 1: ! 124: incl loopcnt /* Increment counter */ ! 125: cmpl $3,loopcnt ! 126: jeql endkct /* If equal then end of test */ ! 127: rei /* else REI back to user code */ ! 128: endkct: ! 129: movl _savvec0,_scb+SYSVEC /* Restore original Kcall handler */ ! 130: svpctx /* Switch back to ISP */ ! 131: movl _savvec1,r13 /* Restore original FP */ ! 132: ret ! 133: # ! 134: # ****************************************** ! 135: # _utest = test to be mapped in user 0 space ! 136: # ****************************************** ! 137: # ! 138: .globl _utest ! 139: _utest: ! 140: movab _kc1,exp_upc /* expected PC after Kcall */ ! 141: _kpc1: ! 142: kcall $DONE /* Literal */ ! 143: _kc1: ! 144: movab _kc2,exp_upc /* expected PC after Kcall */ ! 145: movw $DONE,r5 ! 146: _kpc2: ! 147: kcall r5 /* Register */ ! 148: _kc2: ! 149: movab _eutest,exp_upc /* expected PC after Kcall */ ! 150: movw $DONE,kcpar ! 151: _kpc3: ! 152: kcall kcpar /* memory */ ! 153: _eutest: ! 154: halt ! 155: # ! 156: # Data area ! 157: # ! 158: .align 2 ! 159: loopcnt: ! 160: .long 0 /* Try Kcall 3 times */ ! 161: exp_upc: ! 162: .long 0 /* Expected PC after Kcall */ ! 163: exp_upsl: ! 164: .long 0 /* Expected PSL after Kcall */ ! 165: exp_ksp: ! 166: .long 0 ! 167: kcpar: ! 168: .long 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.