Annotation of cci/d/fpevent/fpp_event.c, revision 1.1

1.1     ! root        1: #include "fpp_defs.h"
        !             2: 
        !             3: /*************************************************************************
        !             4: *
        !             5: *           FLOATING POINT PROCESSOR EXCEPTION HANDLER
        !             6: *
        !             7: *  This routine will be called after any trap or exception. It will 
        !             8: *  compare the actual event type to any expected event type ( in 
        !             9: *  _EXP_EVENT ). If no event was expected _EXP_EVENT will be = 0.
        !            10: *
        !            11: *  If a previous error has set the FORCE_LOOP flag, then the test will exit
        !            12: *  through the loop address pointer without any event type checking.
        !            13: *  current subtest through _EVENT_RETURN. 
        !            14: *
        !            15: *  If the event was NOT it expected:
        !            16: *     if _PRT_ERROR is set, an error message will be printed.
        !            17: *     if _HALT_FLG  is set, the program will halt.
        !            18: *     if _UNEXP_EVENT_RET is non-zero, it will contain the return address, 
        !            19: *     or the program will return to the monitor via RETURN.
        !            20: *
        !            21: *  The error message will be of the form:
        !            22: *     ** cycle: xx. test: xx. unexpected event type: xx
        !            23: *     ** Par0 :  xxxxxxxx
        !            24: *     ** Par1 :  xxxxxxxx
        !            25: *     ** PC   :  xxxxxxxx
        !            26: *     ** PSL  :  xxxxxxxx
        !            27: *
        !            28: *
        !            29: *  30-Apr-85  combined 'fpp_event.s' and 'trap.c' into 'fpp_event.c'.
        !            30: *
        !            31: *************************************************************************/
        !            32: 
        !            33: XTrap( code )
        !            34: long code;                             /* event type code */
        !            35: {
        !            36: register long r12, r11, r10, r9, r8;
        !            37: long tpc, tpsl;
        !            38:        if( force_loop )                /* check for continual looping  */
        !            39:              asm("jmp *_event_return");; 
        !            40:        asm("movl 8(fp),r12");          /* get par 0 */
        !            41:        asm("movl 12(fp),r11");         /* get par 1 */
        !            42:        asm("movl 16(fp),r10");         /* get par 2 */
        !            43:        asm("movl 20(fp),r9");          /* get par 3 */
        !            44:        asm("movl 24(fp),r8");          /* get par 4 */
        !            45:        if( code == ARITH_CODE ) {
        !            46:              event_code = r12;         /* set the arith fault type seen */
        !            47:              event_psl = r10;          /* take the PSL off the stack */
        !            48:        } else
        !            49:              event_psl = r11;;         /* take the PSL off the stack */
        !            50:        if( code == exp_event )  {      /* was the event expected?      */
        !            51:              if( (exp_event != ARITH_CODE) || (exp_code == r12) )
        !            52:                    asm("jmp *_event_return");; /* exit -the evt was expected */
        !            53:        }
        !            54: /*
        !            55:  *  If we get here then the event was not expected
        !            56: */
        !            57:        errcnt++;                       /* bump the error count      */
        !            58:        if( prt_error ) {
        !            59:              if( !error ) {
        !            60:                    error = TRUE;       /* set current-error flag   */
        !            61:                    writec('\n');
        !            62:              }
        !            63:              writes("\n** cycle: ");
        !            64:              writed( cycle );
        !            65:              writes(". test: ");
        !            66:              writeh( test_no );
        !            67:              writes(". unexpected event -type: ");
        !            68:              writeh( code );
        !            69:              writec('\n');
        !            70:              if( code==0x37 ) {        /* FPP Emulation trap */
        !            71:                     writes("** Par 0 :  "); write32h(r12); writec('\n');
        !            72:                     writes("** Par 1 :  "); write32h(r11); writec('\n');
        !            73:                     writes("** Par 2 :  "); write32h(r10); writec('\n');
        !            74:                     tpc = r9;
        !            75:                     tpsl = r8; 
        !            76:              } else
        !            77:              if( (code==0x20) ||       /* bus error */
        !            78:                  (code==0x2f) ||       /* access control violation */
        !            79:                  (code==0x30) ) {      /* page fault */
        !            80:                     writes("** Par 0 :  "); write32h(r12); writec('\n');
        !            81:                     writes("** Par 1 :  "); write32h(r11); writec('\n');
        !            82:                     tpc = r10;
        !            83:                     tpsl = r9; 
        !            84:              } else 
        !            85:              if( (code==0x34) ||       /* arithmetic acception */
        !            86:                  (code==0x2b) ) {      /* Kcall */
        !            87:                     writes("** Par.  :  "); 
        !            88:                     writeh(r12); writec('\n');
        !            89:                     tpc = r11;
        !            90:                     tpsl = r10;
        !            91:              } else {
        !            92:                     tpc = r12;
        !            93:                     tpsl = r11; 
        !            94:              }
        !            95:              writes("** PC    :  "); write32h(tpc); writec('\n');
        !            96:              writes("** PSL   :  "); write32h(tpsl); writec('\n');
        !            97:        }
        !            98:        if( halt_flg )  {               /* halt on the error? */
        !            99:              asm("movl _test_no,r0");          /* r0 = test number   */
        !           100:              asm("clrl r1");                   /* r1 = 0 (subtest #) */
        !           101:              asm("movl _event_type,r2");       /* r2 = event code    */
        !           102:              asm("movl _cycle,r3");            /* r3 = cycle count   */
        !           103:              asm("movl r12,r4");               /* r4 = parameter 1   */
        !           104:              asm("movl r11,r5");               /* r5 = parameter 2   */
        !           105:              asm("movl r10,r6");               /* r6 = parameter 3   */
        !           106:              asm("movl r9,r7");                /* r7 = parameter 4   */
        !           107:              asm("movl _index,r8");            /* r8 = data index    */
        !           108:              asm("halt");                      /* halt               */
        !           109:        }
        !           110:        if( unexp_event_ret )
        !           111:              asm("jmp *_unexp_event_ret");     /* return to the test */
        !           112:        else
        !           113:              asm("jmp *return");
        !           114: }

unix.superglobalmegacorp.com

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