|
|
Power 6/32 Unix version 1.2b
# # *software interrupt event test # # R0 = error code # 1 - REI fell thru # R8 = PC of REI instruction # 2 - REI did not take pending software int. #2 in SISR # R1 = current PSL after REI; R2 = SISR # R8 = PC of REI instruction # 3 - MTPR to SIRR did not cause initerrupt # R1 = current PSL ; R2 = SISR # R8 = PC of MTPR instruction # 4 - Unexpected software interrupt # R1 = current PSL ; R2 = PC pushed on the stack # R3 = PSL pushed on the stack # R4 = SISR # 5 - Error in PC pushed on the stack after software interrupt # R1 = Actual PC ; R2 = Expected PC # R8 = PC of REI that caused software interrupt. # 6 - PSL is not saved on the stack after software interrupt # R8 = PC of REI that caused software interrupt. # 7 - Too many paramters pushed on the stack # R8 = PC of REI that caused software interrupt. # 8 - Cuurent PSL_IPL is not set to expected value after int. # R1 = PSL after taking interrupt. # R2 = Expected PSL_IPL # .globl _sftint_evt _sftint_evt: .word 0x1ff mtpr $31,$IPL movab (sp),_savvec0 /* Save current SP */ mtpr _savvec0,$ISP movl _scb+SIVEC1-4,_savvec2 /*save vector for soft int #2 */ movab _scb+SIVEC1-8,_savvec3 /*save vector for soft int#3 */ movab vecvec4,_scb+SIVEC1-4 /*new vector */ movab vecvec4,_scb+SIVEC1-8 /*new vector */ movl $-1,-(sp) /*marker on SP to be checked */ /* after taken interrupt. */ movab _pcb0,r1 /* Partialy set PCB0 */ mtpr r1,$PCBB movab (sp),_pcb0 /*ksp in pcb0 */ movab (sp),_pcb0+4 /*usp in pcb0 */ movpsl r1 /*if not kernel mode, then force*/ bitl $0x01000000,r1 /*kernel mode */ beql 1f movl _scb+PINSTVEC,_savvec3 movab forckmd,_scb+PINSTVEC halt /*halt in USER mode to force */ /*K mode in psl */ .align 2 forckmd: addl2 $8,sp /*get rid of trash on the stack */ movl _savvec3,_scb+PINSTVEC /*restore vector */ 1: movl $-1,r7 mtpr $2,$SIRR /* Software request interrupt at IPL 2 */ /* current IPL is 31 so SISR is set at 2 */ mtpr $3,$IPL /* lower current IPL to 3 */ movl $2,r7 /* R7 = flag to be check in int. handler */ movpsl r1 andl2 $0xffe10000,r1 /* REI to process has IPL #1 */ movl r1,-(sp) /* Set up PC,PSL for REI */ movab error,r5 /* R5 = Expected PC on SP after interrupt */ movl r5,-(sp) movab pc1,r6 /* R6 = return address from exception */ movab spc1,r8 spc1: rei /* This should take soft int#2 */ movl $1,r0 jmp *badrtn /* Error : REI fell thru */ error: movl $2,r0 /* Error : REI did not take soft int#2 */ movpsl r1 /* pending in SISR; R1 = current PSL */ mfpr $SISR,r2 /* R2 = SISR */ jmp *badrtn pc1: movab eee,r6 /* R6 = address to return from exception */ movab exp1,r5 /* R5 = expected address after taken int */ movl $3,r7 /* R7 = flag to be check in int. handler */ movab spc2,r8 spc2: mtpr $3,$SIRR /* At this point ipl = 2, and so we */ /* should get int at level #3 */ exp1: movl $3,r0 /* Error : MTPR to SIRR did not cause */ movpsl r1 /* soft interrupt #3 */ mfpr $SISR,r2 /* R2 = SISR, R1 = current PSL */ jmp *badrtn .align 2 /* SOFTWARE interrupt #2 handler */ vecvec4: cmpl $-1,r7 /* If R7 == -1 then unexpected interrupt */ bneq 1f movpsl r1 /* Error : Took int when PSL_IPL was greater */ movl (sp)+,r2 /* or equal to the one set by MTPR in SIRR */ movl (sp)+,r3 /* R0 = error code, R1 = current PSL */ mfpr $SISR,r4 /* R2 = PC on SP , R3 = PSL on SP, R4 = SISR */ movl $4,r0 jmp *badrtn 1: movl (sp)+,r1 /* R1 = PC from SP */ movl r5,r2 /* R2 = expected PC */ cmpl r1,r2 beql 1f movl $5,r0 /* Error : Actual PC not same as expected */ jmp *badrtn 1: movl (sp)+,r1 /* R1 = PSL from SP */ cmpl $-1,r1 /* If -1, then it is not PSL */ bneq 1f movl $6,r0 jmp *badrtn /* Error - PSL not saved on the stack */ /* after Soft interrupt; */ 1: cmpl $-1,(sp) /* SP should be pointing at the marker at */ beql 1f /* this point, otherwise error */ movl $7,r0 jmp *badrtn /* Too many longwords pushed on the */ /* SP after software interrupt */ 1: movpsl r1 /* R1 = current PSL after taken interrupt */ andl2 $0x001f0000,r1 /* Mask out all other bits except IPL */ cmpl $3,r7 /* Soft #3 interrupt? */ bneq 1f cmpl $0x00030000,r1 /* Did IPL set to 3 after taken int. ? */ beql 2f brb 5f 1: cmpl $0x00020000,r1 /* Did IPL set to 2 after taken int. ? */ beql 2f 5: movl $8,r0 /* Error : PSL_IPL not set to expected */ movpsl r1 /* value after taking interrupt */ movl r7,r2 jmp *badrtn 2: movpsl -(sp) /* Set PSL & PC on the stack for return */ movl r6,-(sp) /* R6 must have been loaded previously */ mtpr $31,$IPL rei halt /* Should never come here */ /* Restore original state of SP, PSL & vectors */ eee: movl _savvec2,_scb+SIVEC1-4 movl _savvec3,_scb+SIVEC1-8 mtpr $31,$IPL movl _savvec0,sp ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.