Annotation of cci/d/event/align_evt.s, revision 1.1.1.2

1.1       root        1: 
                      2: 
                      3:  #
                      4:  #     *alignment exception event test
                      5:  #     *word,longword, & quadword alignment are checked
                      6:  #
                      7:  #     R5 = PC that failed
                      8:  #     R0 = error code
                      9:  #          1 : Expected alignment fault didnot happen
                     10:  #          2 : Error in PC pushed on the stack
                     11:  #              R1 = actual,  R2 = expected
                     12:  #          3 : Error in PSL pushed on the stack
                     13:  #              R1 = actual,  R2 = expected
                     14:  #          4 : Too many parameters pushed on the stack
1.1.1.2 ! root       15:  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        !            16:  #     Modified 11/20/85 to include two subtests (9 and A) that     #
        !            17:  #     will generate an alignment fault when the error is in        #
        !            18:  #     the intermediate address of a deferred addressing mode.      #
        !            19:  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.1       root       20: 
                     21: 
                     22:        .globl  _align_evt
                     23: _align_evt:
                     24:        .word   0x1ff
                     25:        mtpr    $31,$IPL                /* Set IPL to HIGH              */
                     26:        movab   (sp),_savvec0           /* Save current SP              */
                     27:        mtpr    _savvec0,$ISP           /* Set ISP                      */
                     28:        movl    _scb+ALIGNVEC,_savvec2  /* Save alignment fault vector  */
                     29:        movab   vecvec,_scb+ALIGNVEC    /* Set new vector               */
                     30:        movl    $-1,-(sp)               /* Push marker on stack         */
                     31:        movab   _pcb0,r1                /* Partially set PCB0           */
                     32:        mtpr    r1,$PCBB                /* Set PCBB to PCB0             */
1.1.1.2 ! root       33:        mfpr    $KSP,_savvec9           /* Save kernal stack pointer    */
        !            34:        mfpr    $USP,_savveca           /* Save user stack pointer      */
1.1       root       35: 
                     36:        movpsl  r1                      /* If not kernel mode, then force */
                     37:        bitl    $0x01000000,r1          /* Kernel mode                  */
                     38:        beql    1f
                     39:        movl    _scb+PINSTVEC,_savvec3
                     40:        movab   forckmd,_scb+PINSTVEC
                     41:        halt                            /* Halt in user mode to force fault */
                     42:        .align  2
                     43: forckmd:
                     44:        movab   (sp)+,tmp0      /*get rid of trash on the stack */
                     45:        movab   (sp)+,tmp0
                     46:        movl    _savvec3,_scb+PINSTVEC  /*restore vector                */
                     47: #
                     48: #      We now in KERNEL MODE; IPL = 0x1f
                     49: #      Try to store a word in an ODD address
                     50: 1:
                     51:        movab   epc1,r5                 /* R5 = expected PC on stack    */
                     52:        movab   spc2,r6                 /* R6 = return from exception addr */
                     53:        movpsl  r7                      /* R7 = Expected PSL to to checked */
                     54: epc1:  movw    $256,dtable+1           /* Should cause fault           */
                     55:        movl    $1,r0           /* Error : NO fault happen              */
                     56:        jmp     *badrtn
                     57: #
                     58: #      We now in KERNEL MODE; IPL = 0x1f
                     59: #      Try to store a word in an ODD address
                     60: spc2:
                     61:        movab   epc2,r5                 /* R5 = expected PC on stack    */
                     62:        movab   spc3,r6                 /* R6 = return from exception addr */
                     63:        movpsl  r7                      /* R7 = Expected PSL to to checked */
                     64: epc2:  movw    $256,dtable+3           /* Should cause fault           */
                     65:        movl    $1,r0           /* Error : NO fault happen              */
                     66:        jmp     *badrtn
                     67: #
                     68: #      We now in KERNEL MODE; IPL = 0x1f
                     69: #      Try to store a longword in an ODD address
                     70: spc3:
                     71:        movab   epc3,r5                 /* R5 = expected PC on stack    */
                     72:        movab   spc4,r6                 /* R6 = return from exception addr */
                     73:        movpsl  r7                      /* R7 = Expected PSL to to checked */
                     74: epc3:  movl    $666666,dtable+1        /* Should cause fault           */
                     75:        movl    $1,r0
                     76:        jmp     *badrtn
                     77: #
                     78: #      We now in KERNEL MODE; IPL = 0x1f
                     79: #      Try to store a longword in an ODD address
                     80: spc4:
                     81:        movab   epc4,r5                 /* R5 = expected PC on stack    */
                     82:        movab   spc5,r6                 /* R6 = return from exception addr */
                     83:        movpsl  r7                      /* R7 = Expected PSL to to checked */
                     84: epc4:  movl    $666666,dtable+2        /* Should cause fault           */
                     85:        movl    $1,r0           /* Error : NO fault happen              */
                     86:        jmp     *badrtn
                     87: #
                     88: #      We now in KERNEL MODE; IPL = 0x1f
                     89: #      Try to store a longword in an ODD address
                     90: spc5:
                     91:        movab   epc5,r5                 /* R5 = expected PC on stack    */
                     92:        movab   spc6,r6                 /* R6 = return from exception addr */
                     93:        movpsl  r1                      /* R7 = Expected PSL to to checked */
                     94: epc5:  movl    $666666,dtable+3        /* Should cause fault           */
                     95:        movl    $1,r0           /* Error : NO fault happen              */
                     96:        jmp     *badrtn
                     97: #
                     98: #      We now in KERNEL MODE; IPL = 0x1f
                     99: #      Try to shift a quadword into an ODD address
                    100: spc6:
                    101:        movab   epc6,r5                 /* R5 = expected PC on stack    */
                    102:        movab   spc7,r6                 /* R6 = return from exception addr */
                    103:        movpsl  r7                      /* R7 = Expected PSL to to checked */
                    104: epc6:  shrq    $6,dtable+1,r0          /* Should cause fault           */
                    105:        movl    $1,r0           /* Error : NO fault happen              */
                    106:        jmp     *badrtn
                    107: #
                    108: #      We now in KERNEL MODE; IPL = 0x1f
                    109: #      Try to shift a quadword into an ODD address
                    110: spc7:
                    111:        movab   epc7,r5                 /* R5 = expected PC on stack    */
                    112:        movab   spc8,r6                 /* R6 = return from exception addr */
                    113:        movpsl  r7                      /* R7 = Expected PSL to to checked */
                    114: epc7:  shrq    $6,dtable+2,r0          /* Should cause fault           */
                    115:        movl    $1,r0           /* Error : NO fault happen              */
                    116:        jmp     *badrtn
                    117: #
                    118: #      We now in KERNEL MODE; IPL = 0x1f
                    119: #      Try to shift a quadword into an ODD address
                    120: spc8:
                    121:        movab   epc8,r5                 /* R5 = expected PC on stack    */
1.1.1.2 ! root      122:        movab   spc9,r6                 /* R6 = return from exception addr */
1.1       root      123:        movpsl  r7                      /* R7 = Expected PSL to to checked */
                    124: epc8:  shrq    $6,dtable+3,r0          /* Should cause fault   */
                    125:        movl    $1,r0           /* Error : NO fault happen              */
                    126:        jmp     *badrtn
1.1.1.2 ! root      127: #      
        !           128: #      Now in KERNAL MODE; IPL = 0x1f
        !           129: #      try Register + longword Displacment deferred
        !           130: #      This should get a fault because the intermidiate address ( (r8) + 4 )
        !           131: #      is not longword aligned.
        !           132: 
        !           133: spc9:  movab   epc9,r5                 /* R5 = expected PC on stack    */
        !           134:        movab   spca,r6                 /* R6 = return from exception addr */
        !           135:        movpsl  r7                      /* R7 = Expected PSL to be checked */
        !           136:        movab   dtable,tmp1
        !           137:        movab   tmp0+1,r8
        !           138: epc9:  movl    $0x6,*l^4(r8)           /* should cause an alignment fault */
        !           139:        movl    $1,r0                   /* ERROR : Did not generate fault  */
        !           140:        jmp     *badrtn
        !           141: #      
        !           142: #      Now in KERNAL MODE; IPL = 0x1f
        !           143: #      try Register + longword Displacment deferred
        !           144: #      This should get a fault because the intermidiate address ( (r8) + 4 )
        !           145: #      is not longword aligned.
        !           146: #
        !           147: spca:  movab   epca,r5                 /* R5 = expected PC on stack    */
        !           148:        movab   eee,r6                  /* R6 = return from exception addr */
        !           149:        movpsl  r7                      /* R7 = Expected PSL to be checked */
        !           150:        movab   dtable,tmp1
        !           151:        movab   tmp0+2,r8
        !           152: epca:  movl    $0x6,*l^4(r8)           /* Should cause an alignment fault */
        !           153:        movl    $1,r0                   /* ERROR : Did not generate fault  */
        !           154:        jmp     *badrtn
1.1       root      155: #
                    156: #
                    157: #      Event handler for Data alignment fault
                    158: #
                    159:        .align  2
                    160: vecvec:
                    161:        movl    (sp)+,r1        /* R1 = actual PC pop from stack        */
                    162:        movl    r5,r2           /* R5 = expected PC                     */
                    163:        cmpl    r1,r2
                    164:        beql    1f
                    165:        movl    $2,r0           /* Error : Wrong PC on stack            */
                    166:        jmp     *badrtn         /* R1 = actual; R2 = expected           */
                    167: 
                    168: 1:     movl    (sp)+,r1        /* R1 = actual PSL pop from stack       */
                    169:        movl    r7,r2           /* R2 = expected PSL                    */
                    170:        cmpl    r2,r1
                    171:        beql    1f
                    172:        movl    $3,r0           /* Error : wrong PSL on stack           */
                    173:        jmp     *badrtn         /* R1 = actual; R2 = expected           */
                    174: 
                    175: 1:     cmpl    $-1,(sp)        /* Check if SP now point to marker      */
                    176:        beql    1f
                    177:        movl    $4,r0           /* Error : too many things push on SP  */
                    178:        jmp     *badrtn
                    179: 
                    180: 1:     movl    r1,-(sp)        /* Set PSL & PC on the stack for return */
                    181:        movl    r6,-(sp)        /* r6 contain return address            */
                    182:        rei
                    183:        jmp     *badrtn         /* Should never come here               */
                    184: #
                    185: #      All done; get ready to return to monitor
                    186: #
                    187: eee:
                    188:        mtpr    $31,$IPL
                    189:        movl    _savvec0,sp     /* Restore original vector              */
1.1.1.2 ! root      190:        mtpr    _savvec0,$ISP           /* restore interrupt stack pointer */
        !           191:        mtpr    _savvec9,$KSP           /* restore kernal stack pointer */
        !           192:        mtpr    _savveca,$USP           /* restore user stack pointer   */
1.1       root      193:        movl    _savvec2,_scb+ALIGNVEC
                    194:        ret
                    195: #
                    196: #
                    197:        .align  2
                    198: tmp0:  .long   0
1.1.1.2 ! root      199: tmp1:  .long   0
1.1       root      200: dtable:        .byte   0x12
                    201:        .byte   0x34
                    202:        .byte   0x56
                    203:        .byte   0x78
                    204:        .byte   0x9a
                    205:        .byte   0xbc
                    206:        .byte   0xde
                    207:        .byte   0xf0
                    208:        .byte   0x12
                    209:        .byte   0x34
                    210:        .byte   0x56
                    211:        .byte   0x78
                    212:        .byte   0x9a
                    213:        .byte   0xbc
                    214:        .byte   0xde
                    215:        .byte   0xf0
                    216: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.