|
|
Power 6/32 Unix version 1.21
# # *alignment exception event test # *word,longword, & quadword alignment are checked # # R5 = PC that failed # R0 = error code # 1 : Expected alignment fault didnot happen # 2 : Error in PC pushed on the stack # R1 = actual, R2 = expected # 3 : Error in PSL pushed on the stack # R1 = actual, R2 = expected # 4 : Too many parameters pushed on the stack #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Modified 11/20/85 to include two subtests (9 and A) that # # will generate an alignment fault when the error is in # # the intermediate address of a deferred addressing mode. # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .globl _align_evt _align_evt: .word 0x1ff mtpr $31,$IPL /* Set IPL to HIGH */ movab (sp),_savvec0 /* Save current SP */ mtpr _savvec0,$ISP /* Set ISP */ movl _scb+ALIGNVEC,_savvec2 /* Save alignment fault vector */ movab vecvec,_scb+ALIGNVEC /* Set new vector */ movl $-1,-(sp) /* Push marker on stack */ movab _pcb0,r1 /* Partially set PCB0 */ mtpr r1,$PCBB /* Set PCBB to PCB0 */ mfpr $KSP,_savvec9 /* Save kernal stack pointer */ mfpr $USP,_savveca /* Save user stack pointer */ 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 fault */ .align 2 forckmd: movab (sp)+,tmp0 /*get rid of trash on the stack */ movab (sp)+,tmp0 movl _savvec3,_scb+PINSTVEC /*restore vector */ # # We now in KERNEL MODE; IPL = 0x1f # Try to store a word in an ODD address 1: movab epc1,r5 /* R5 = expected PC on stack */ movab spc2,r6 /* R6 = return from exception addr */ movpsl r7 /* R7 = Expected PSL to to checked */ epc1: movw $256,dtable+1 /* Should cause fault */ movl $1,r0 /* Error : NO fault happen */ jmp *badrtn # # We now in KERNEL MODE; IPL = 0x1f # Try to store a word in an ODD address spc2: movab epc2,r5 /* R5 = expected PC on stack */ movab spc3,r6 /* R6 = return from exception addr */ movpsl r7 /* R7 = Expected PSL to to checked */ epc2: movw $256,dtable+3 /* Should cause fault */ movl $1,r0 /* Error : NO fault happen */ jmp *badrtn # # We now in KERNEL MODE; IPL = 0x1f # Try to store a longword in an ODD address spc3: movab epc3,r5 /* R5 = expected PC on stack */ movab spc4,r6 /* R6 = return from exception addr */ movpsl r7 /* R7 = Expected PSL to to checked */ epc3: movl $666666,dtable+1 /* Should cause fault */ movl $1,r0 jmp *badrtn # # We now in KERNEL MODE; IPL = 0x1f # Try to store a longword in an ODD address spc4: movab epc4,r5 /* R5 = expected PC on stack */ movab spc5,r6 /* R6 = return from exception addr */ movpsl r7 /* R7 = Expected PSL to to checked */ epc4: movl $666666,dtable+2 /* Should cause fault */ movl $1,r0 /* Error : NO fault happen */ jmp *badrtn # # We now in KERNEL MODE; IPL = 0x1f # Try to store a longword in an ODD address spc5: movab epc5,r5 /* R5 = expected PC on stack */ movab spc6,r6 /* R6 = return from exception addr */ movpsl r1 /* R7 = Expected PSL to to checked */ epc5: movl $666666,dtable+3 /* Should cause fault */ movl $1,r0 /* Error : NO fault happen */ jmp *badrtn # # We now in KERNEL MODE; IPL = 0x1f # Try to shift a quadword into an ODD address spc6: movab epc6,r5 /* R5 = expected PC on stack */ movab spc7,r6 /* R6 = return from exception addr */ movpsl r7 /* R7 = Expected PSL to to checked */ epc6: shrq $6,dtable+1,r0 /* Should cause fault */ movl $1,r0 /* Error : NO fault happen */ jmp *badrtn # # We now in KERNEL MODE; IPL = 0x1f # Try to shift a quadword into an ODD address spc7: movab epc7,r5 /* R5 = expected PC on stack */ movab spc8,r6 /* R6 = return from exception addr */ movpsl r7 /* R7 = Expected PSL to to checked */ epc7: shrq $6,dtable+2,r0 /* Should cause fault */ movl $1,r0 /* Error : NO fault happen */ jmp *badrtn # # We now in KERNEL MODE; IPL = 0x1f # Try to shift a quadword into an ODD address spc8: movab epc8,r5 /* R5 = expected PC on stack */ movab spc9,r6 /* R6 = return from exception addr */ movpsl r7 /* R7 = Expected PSL to to checked */ epc8: shrq $6,dtable+3,r0 /* Should cause fault */ movl $1,r0 /* Error : NO fault happen */ jmp *badrtn # # Now in KERNAL MODE; IPL = 0x1f # try Register + longword Displacment deferred # This should get a fault because the intermidiate address ( (r8) + 4 ) # is not longword aligned. spc9: movab epc9,r5 /* R5 = expected PC on stack */ movab spca,r6 /* R6 = return from exception addr */ movpsl r7 /* R7 = Expected PSL to be checked */ movab dtable,tmp1 movab tmp0+1,r8 epc9: movl $0x6,*l^4(r8) /* should cause an alignment fault */ movl $1,r0 /* ERROR : Did not generate fault */ jmp *badrtn # # Now in KERNAL MODE; IPL = 0x1f # try Register + longword Displacment deferred # This should get a fault because the intermidiate address ( (r8) + 4 ) # is not longword aligned. # spca: movab epca,r5 /* R5 = expected PC on stack */ movab eee,r6 /* R6 = return from exception addr */ movpsl r7 /* R7 = Expected PSL to be checked */ movab dtable,tmp1 movab tmp0+2,r8 epca: movl $0x6,*l^4(r8) /* Should cause an alignment fault */ movl $1,r0 /* ERROR : Did not generate fault */ jmp *badrtn # # # Event handler for Data alignment fault # .align 2 vecvec: movl (sp)+,r1 /* R1 = actual PC pop from stack */ movl r5,r2 /* R5 = expected PC */ cmpl r1,r2 beql 1f movl $2,r0 /* Error : Wrong PC on stack */ jmp *badrtn /* R1 = actual; R2 = expected */ 1: movl (sp)+,r1 /* R1 = actual PSL pop from stack */ movl r7,r2 /* R2 = expected PSL */ cmpl r2,r1 beql 1f movl $3,r0 /* Error : wrong PSL on stack */ jmp *badrtn /* R1 = actual; R2 = expected */ 1: cmpl $-1,(sp) /* Check if SP now point to marker */ beql 1f movl $4,r0 /* Error : too many things push on SP */ jmp *badrtn 1: movl r1,-(sp) /* Set PSL & PC on the stack for return */ movl r6,-(sp) /* r6 contain return address */ rei jmp *badrtn /* Should never come here */ # # All done; get ready to return to monitor # eee: mtpr $31,$IPL movl _savvec0,sp /* Restore original vector */ mtpr _savvec0,$ISP /* restore interrupt stack pointer */ mtpr _savvec9,$KSP /* restore kernal stack pointer */ mtpr _savveca,$USP /* restore user stack pointer */ movl _savvec2,_scb+ALIGNVEC ret # # .align 2 tmp0: .long 0 tmp1: .long 0 dtable: .byte 0x12 .byte 0x34 .byte 0x56 .byte 0x78 .byte 0x9a .byte 0xbc .byte 0xde .byte 0xf0 .byte 0x12 .byte 0x34 .byte 0x56 .byte 0x78 .byte 0x9a .byte 0xbc .byte 0xde .byte 0xf0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.