|
|
Power 6/32 Unix version 1.2b
# # TRACE TRAP EVENT TEST # # R0 = error code # 1 - instruction is executed before trap exception occured # R1 : PC of instruction excecuted # 2 - Error in PC after taking trap # R1 : Actual, R2 : Expected # 3 - PSL is not saved after taking trap # R2 : PC of instruction trapped # 4 - Too many parameter pushed on the stack # R2 : PC of instruction trapped .globl _ttrap_evt _ttrap_evt: .word 0x1fff mtpr $0x1f,$IPL /* Set IPL to HIGH */ movab (sp),_savvec0 /* Save sp */ mtpr _savvec0,$ISP /* Set ISP to sp */ movl _scb+TRACEVEC,_savvec7 /* Save TRACE trap vector */ movab vecvec6,_scb+TRACEVEC /* Set new TRACE trap vector */ movl $-1,-(sp) /* Set marker on sp */ andl3 $_pcb0,$0x3fffffff,r1 /* Initialize PCB slightly */ mtpr r1,$PCBB /* Set PCBB */ movab (sp),_pcb0 /* Set PCB_KSP to current sp */ movab (sp),_pcb0+4 /* Set PCB_USP to current sp */ clrl _savvec1 clrl _savvec2 /* savvec2 : exp value of savvec1 */ /* after trapped. */ movab epc1,_exp_pc /* expected PC after trap */ movab epc1,r8 bispsw $0x10 /* Turn on TRACE enable bit */ epc1: movl $1,_savvec1 epc2: bicpsw $0x10 /* Turn off TRACE enable bit */ movab epc3,_exp_pc incl _savvec1 movab epc3,r8 bispsw $0x10 /* Turn on trace enable bit */ epc3: bicpsw $0x10 /* Turn off TRACE enable bit */ eee: mtpr $31,$IPL /* Restore original SP, PSL, */ movl _savvec0,sp /* TRACE trap vector. */ movl _savvec7,_scb+TRACEVEC ret /* Done with this sucker !! */ .align 2 /* TRACE trap handler */ vecvec6: bicpsw $0x10 /* Clear TRACE bit */ cmpl _savvec1,_savvec2 /* Check if instruction is */ beql 1f /* executed before trapped .. */ movl $1,r0 movl r8,r1 /* PC of inst. executed before trapped */ jmp *badrtn /* Error - inst is executed */ /* before trap occured. */ 1: incl _savvec2 movl (sp)+,r1 /* Pop actual PC from stack */ movl r1,r10 /* Save PC to return */ movl _exp_pc,r2 /* Get expected PC */ cmpl r1,r2 /* Compare to actual PC */ beql 1f movl $2,r0 /* PC error : error code = 2 */ jmp *badrtn /* r1 = actual; r2 = expected */ 1: movab epc2,_exp_pc /* Expected PC of next trap */ movl (sp)+,r1 /* Pop next longword from stack */ movl r1,r11 /* Save PSL for REI */ cmpl $-1,r1 /* Check if this's PSL or marker */ bneq 1f 2: movl $3,r0 /* Error : PSL not saved */ jmp *badrtn /* Error code = 3; r1 = monster */ /* from stack !! */ 1: cmpl $-1,(sp) /* Error if SP not pointing at marker */ beql 1f 2: movl $4,r0 /* Error : too many monsters */ jmp *badrtn /* pushed on the stack !! */ 1: movl r11,-(sp) /* Push PSL & PC for next REI */ movl r10,-(sp) rei halt .align 2 _exp_pc: .long 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.