Annotation of cci/d/fpevent/run_code.s, revision 1.1.1.1

1.1       root        1: # ************************************************************************
                      2: # *
                      3: # *            "RUN THE TEST CODE" ROUTINE
                      4: # *
                      5: # *  The general template of the test code will be:
                      6: # *
                      7: # *      <op-code> [<addr-mode>] [<op.#1>] [<addr-mode>] [<op.#2>]
                      8: # *
                      9: # *  any unused bytes will be padded with NOPs. After the NOPs there will
                     10: # *  be a jump back to this routine. The jump will only be taken if there
                     11: # *  is no event generated by the test instruction.
                     12: # *
                     13: # *  The event handler will verify the event type and return to this code 
                     14: # *  through the "event_return" pointer.
                     15: # *  After the event, this routine will decide if the event should have
                     16: # *  been masked or not. If it wasn't masked then this code will call the
                     17: # *  routine to check the event results (reg's, PSL, etc.). The checking
                     18: # *  routine is called from here because after the event, this was the  
                     19: # *  last routine with the right frame pointer.
                     20: # *
                     21: # *  30-May-85  added: ACC = 0 for pipelined test #2
                     22: # *  10-Jul-85  pulled instruction cache hit parts
                     23: # ************************************************************************
                     24:        .set    NOP_JMP,0x1010719f      /* jump to an absolute address */
                     25:        .text
                     26:        .align 1
                     27:        .globl _run_code
                     28: _run_code:
                     29:        .word   0
                     30:        moval   (r13),_rc_code_fp               /* save the frame pointer    */
                     31:        moval   (r14),_rc_code_sp               /* save the stack pointer    */
                     32:        movab   _loop_n_leave,return            /* exit for unexpected event */
                     33:        callf   $4,_fill_code_buff              /* stuff the code buffer     */
                     34:        moval   _evt_return,_event_return       /* set up event return addr  */
                     35: 
                     36: #########################################################################
                     37: # Invalidate the instruction cache (error loop starts here)
                     38: #########################################################################
                     39: _shift_loop:
                     40:        incl    _Codek                  /* Bump code cache key        */
                     41:        cmpl    _Codek,$255             /* Last key yet ?             */
                     42:        jlss    1f
                     43:        movl    $1,_Codek               /* Reset Code key to 1        */
                     44:        mtpr    $1,$PACC                /* Purge all code cache       */
                     45:        nop
                     46: 1:
                     47:        mtpr    _Codek,$CCK             /* Set new key                */
                     48:  
                     49: #########################################################################
                     50: # If the addressing mode is POP or deferred POP, push the data needed
                     51: #########################################################################
                     52:        cmpl    $0x8e,_addr_code        /* POP SP addressing?        */
                     53:        beql    1f
                     54:        cmpl    $0x9e,_addr_code        /* POP SP deferred addr.?    */
                     55:        bneq    2f
                     56: 1:
                     57:        cmpl    $1,_no_ops              /* push 1 or 2 operands?     */
                     58:        beql    1f
                     59:        pushl   _sgl_value_10           /* push the 2nd data operand */
                     60: 1:
                     61:        pushl   _sgl_value_9            /* push the data to be popped */
                     62:  
                     63: 2:
                     64: #########################################################################
                     65: # LOAD THE ACCUMULATOR AND THE REGISTERS  
                     66: # If this is pipelined test #2, load a zero into the accumulator
                     67: #########################################################################
                     68:        moval   (sp),_pre_event_sp      /* save the stack pointer      */
                     69:        cmpl    $2,_pipe_test
                     70:        bneq    1f
                     71:        clrl    r0                      /* load the accumulator with   */
                     72:        clrl    r1                      /*    zero for pipe test #2    */
                     73:        brb     2f
                     74: 1:     movl    _dbl_ld_acc,r0          /* if not pipe test #2, load   */
                     75:        movl    _dbl_ld_acc+4,r1        /*    the ACC with the data    */
                     76: 2:
                     77:        cmpl    _acc_ld_size,$DBL       /* load DBL or SGL ACC?        */
                     78:        beql    1f
                     79:        ldf     r0                      /* load the sgl accumulator    */
                     80:        brb     2f
                     81: 1:     ldd     r0                      /* load the dbl accumulator    */
                     82: 2:
                     83:        loadr   $0x3fff,_load_regs      /* load regs 0 - 13 (FP)       */
                     84:  
                     85:  
                     86: #########################################################################
                     87: # ENABLE OR DISABLE THE EVENT, SET THE EVENT TYPE & EXECUTE THE TEST CODE
                     88: #########################################################################
                     89:        bispsw  $ENABLE_EVENTS          /* enable ovfl & undfl events  */
                     90:        bicpsw  _disable_mask           /* disable events as needed    */
                     91:        movl    _test_event,_exp_event  /* set the event expected flag */
                     92:        movpsl  _init_psl               /* save PSL for error checking */
                     93:        jmp     *_code_addr             /* execute the test code       */
                     94:        halt
                     95: 
                     96: 
                     97: ##########################################################################
                     98: # The only way here (knock on wood) is if we executed the test instruction
                     99: # without getting any events. If an event was expected, it is an error to 
                    100: # come here.
                    101: # - Save the PSL and check if the event was disabled.
                    102: ##########################################################################
                    103:        .globl _rc_code_return
                    104: _rc_code_return:
                    105:        movpsl  _psl_val                /* save the final PSL      */
                    106:        clrl    _exp_event              /* no more events expected */
                    107:        bitl    $PSL_DBL,_psl_val       /* check for DBL Acc.       */
                    108:        bneq    1f
                    109:        stf     _dbl_st_acc             /* save the accumulator    */
                    110:        clrl    _dbl_st_acc+4
                    111:        brb     2f
                    112: 1:     std     _dbl_st_acc             /* save the accumulator    */
                    113: 2:
                    114:        tstl    _evt_disabled           /* Was the event disabled? */
                    115:        bneq    1f
                    116:        jmp     _rc_no_event            /*  No -event not disabled */
                    117: 1:
                    118: 
                    119: 
                    120: ##########################################################################
                    121: # The event was disabled so we're OK so far. Check the PSL flags
                    122: ##########################################################################
                    123:        callf   $4,_bad_final_psl       /* check the final PSL     */
                    124:        tstl    r0                      /* was the PSL OK?         */
                    125:        bneq    1f                      /*   -NO. handle the error */
                    126:        jmp     _loop_n_leave           /*   -YES. exit (or loop)  */
                    127: 1:
                    128:        tstl    _prt_error              /* print an error message? */
                    129:        beql    1f
                    130:        pushl   _bad_psl_msg            /* "bad final PSL" message */
                    131:        callf   $8,_prt_evt_er_msg      /* print the error message */
                    132:        pushl   $_rc_f_psl_msg          /* "final PSL = "          */
                    133:        callf   $8,_writes
                    134:        pushl   _psl_val
                    135:        callf   $8,_write32h
                    136:        pushl   $_rc_e_psl_msg          /* "expected PSL = "       */
                    137:        callf   $8,_writes
                    138:        pushl   _exp_psl
                    139:        callf   $8,_write32h
                    140:        pushl   $_rc_newline            /* print a line feed       */
                    141:        callf   $8,_writec
                    142: 1:
                    143:        tstl    _halt_flg               /* halt on error?          */
                    144:        beql    1f
                    145:        pushl   $BAD_PSL_HLT
                    146:        callf   $8,_event_halt          /* set up regs and halt    */
                    147: 1:
                    148:        tstl    _loop_on_err            /* loop on the error?      */
                    149:        beql    1f
                    150:        movl    $1,_force_loop          /* set the Force Loop flag */
                    151: 1:
                    152:        jmp     _loop_n_leave           /* exit or loop            */
                    153: 
                    154: 
                    155: ##########################################################################
                    156: # BUMMER!!   WE SHOULD HAVE GOTTEN AN EVENT  
                    157: ##########################################################################
                    158: _rc_no_event:
                    159:        storer  $0x3fff,_store_regs     /* store regs 0 - 13         */
                    160:        movl    _rc_code_fp,fp          /* re-load the frame pointer */
                    161:        movl    _rc_code_sp,sp          /* re-load the stack pointer */
                    162:        tstl    _force_loop             /* Is "force_loop" set?      */
                    163:        beql    1f
                    164:        jmp     _shift_loop             /* Yes - loop on the error   */
                    165: 1:
                    166:        incl    _errcnt;                /* bump the error count      */
                    167:        tstl    _prt_error              /* print an error message?   */
                    168:        beql    1f
                    169:        pushl   _no_evt_msg             /* "did not get event" msg   */
                    170:        callf   $8,_prt_evt_er_msg      /* print the error message   */
                    171: 1:
                    172:        tstl    _halt_flg               /* halt on error?            */
                    173:        beql    1f
                    174:        pushl   $NO_EVT_HLT
                    175:        callf   $8,_event_halt          /* halt with code of 1       */
                    176: 1:
                    177:        tstl    _loop_on_err            /* loop on the error?        */
                    178:        beql    1f
                    179:        movl    $1,_force_loop          /* set the force_loop flag   */
                    180: 1:
                    181:        jmp     _loop_n_leave           /* loop on the error or exit */
                    182:        halt                            /* we should never get here  */
                    183: 
                    184: 
                    185: ##########################################################################
                    186: # The only way here (knock on wood) is if we got the correct event while
                    187: # executing the instruction. 
                    188: ##########################################################################
                    189:        .globl _evt_return
                    190: _evt_return:
                    191:        clrl    _exp_event              /* no more events expected     */
                    192:        movl    _post_evt_acc,_dbl_st_acc       /* save the accumulator */
                    193:        movl    _post_evt_acc+4,_dbl_st_acc+4
                    194:        movl    _rc_code_fp,fp          /* re-load the frame pointer  */
                    195:        movl    _rc_code_sp,sp          /* re-load the stack pointer  */
                    196:        tstl    _force_loop             /* Is "force_loop" set?       */
                    197:        beql    1f
                    198:        jmp     _shift_loop             /* then loop on the error     */
                    199: 
                    200: 1:
                    201: ##########################################################################
                    202: # NOW CHECK TO SEE IF THE EVENT WAS DISABLED WHEN IT OCCURRED
                    203: ##########################################################################
                    204:        tstl    _evt_disabled           /* Was the interrupt disabled? */
                    205:        bneq    1f
                    206:        callf   $4,_chk_event           /*  No -verify the stack, etc. */
                    207:        jmp     _loop_n_leave           /* Exit ( or loop if error )   */
                    208: 
                    209: 1:
                    210: ##########################################################################
                    211: # BUMMER!! WE SHOULDN'T HAVE GOTTEN AN EVENT  
                    212: ##########################################################################
                    213:        movl    _rc_code_fp,fp          /* re-load the frame pointer  */
                    214:        movl    _rc_code_sp,sp          /* re-load the stack pointer  */
                    215:        tstl    _force_loop             /* Is "force_loop" set?       */
                    216:        beql    1f
                    217:        jmp     _shift_loop             /* then loop on the error     */
                    218: 1:
                    219:        incl    _errcnt;                /* bump the error count      */
                    220:        tstl    _prt_error              /* print an error message?   */
                    221:        beql    1f
                    222:        pushl   _disbl_evt_msg          /* "event while disabled" msg */
                    223:        callf   $8,_prt_evt_er_msg      /* print the error message */
                    224: 1:
                    225:        tstl    _halt_flg               /* halt on error?            */
                    226:        beql    1f
                    227:        pushl   $EVT_MSK_HLT
                    228:        callf   $8,_event_halt          /* halt with code of 2       */
                    229: 1:
                    230:        tstl    _loop_on_err            /* loop on the error?        */
                    231:        beql    1f
                    232:        movl    $1,_force_loop          /* set the force_loop flag   */
                    233: 
                    234: 1:
                    235: #########################################################################
                    236: #      THIS IS THE EXIT FROM THIS ROUTINE
                    237: # LOOP IF THE FORCE LOOP FLAG IS SET, OTHERWISE EXIT
                    238: #########################################################################
                    239: _loop_n_leave:
                    240:        movl    _rc_code_fp,fp          /* re-load the frame pointer */
                    241:        movl    _rc_code_sp,sp          /* re-load the stack pointer */
                    242:        tstl    _force_loop             /* Is "force_loop" set?      */
                    243:        beql    1f
                    244:        jmp     _shift_loop             /* then loop on the error    */
                    245: 1:
                    246:        ret                             /* return */
                    247: 
                    248: 
                    249: 
                    250: 
                    251: 
                    252: 
                    253: # *************************************************************************
                    254: # *
                    255: # *                    FILL IN THE CODE BUFFER ROUTINE
                    256: # *
                    257: # *  Set up the instruction code sequence. After the instruction code, 
                    258: # *  put a jump back to "execute_code" and fill the rest of the code buffer 
                    259: # *  with NOPs.
                    260: # *
                    261: # *************************************************************************
                    262:        .text
                    263:        .align  1
                    264:        .globl  _fill_code_buff
                    265: _fill_code_buff:
                    266:        .word   0
                    267:        movl    $START_OF_CODE,r0
                    268:        movl    r0,_code_addr           /* save the starting address */
                    269:        clrl    r1
                    270: 1:     movb    _inst_buf(r1),(r0)      /* move the code to the code buf */
                    271:        incl    r0
                    272:        aoblss  $16,r1,1b
                    273: ########################################################################
                    274: # After the instruction code, put a jump back to "_rc_code_return"
                    275: ########################################################################
                    276:        movl    $NOP_JMP,_sgl_dummy1    /* "<nop><nop><jmp><abs addr>" */
                    277:        clrl    r1
                    278: 1:     movb    _sgl_dummy1(r1),(r0)    /* move the code to the code buf */
                    279:        incl    r0
                    280:        aoblss  $4,r1,1b
                    281:   
                    282:        moval   _rc_code_return,_sgl_dummy1 /* jmp to 'ex_code_return' */
                    283:        clrl    r1
                    284: 1:     movb    _sgl_dummy1(r1),(r0)    /* move the code to the code buf */
                    285:        incl    r0
                    286:        aoblss  $4,r1,1b
                    287:  
                    288: ########################################################################
                    289: # Fill the rest of the buffer with NOPs and return
                    290: ########################################################################
                    291:        movl    $0x10,r1                /* 0x10 = NOP op-code         */
                    292: 1:     movb    r1,(r0)                 /* put NOPs in the code space */
                    293:        aobleq  $END_OF_CODE,r1,1b
                    294:        ret                             /* return */
                    295: 
                    296: 
                    297: 
                    298: ########################################################################
                    299: #      Variables
                    300: ########################################################################
                    301:        .align 2
                    302:        .globl  _rc_code_sp
                    303: _rc_code_sp:                           /* save stack pointer value here */
                    304:        .long   0
                    305:        .globl  _rc_code_fp
                    306: _rc_code_fp:                           /* save frame pointer value here */
                    307:        .long   0
                    308: 
                    309:        .globl  return                  /* emergency indirect return addr */
                    310: return:
                    311:        .long   _loop_n_leave           /* return to loop or leave */
                    312: 
                    313: ########################################################################
                    314: #      ERROR MESSAGES
                    315: ########################################################################
                    316: _rc_f_psl_msg:
                    317:        .ascii  "final PSL = \0"
                    318: _rc_e_psl_msg:
                    319:        .ascii  ",   expected PSL = \0"
                    320: _rc_newline:
                    321:        .ascii  " \n\0"

unix.superglobalmegacorp.com

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