|
|
1.1 ! root 1: ! 2: #include "stdio.h" ! 3: #include "../fpp_defs.h" ! 4: ! 5: ! 6: /*************************************************************************** ! 7: * ! 8: * LDF -FLOATING POINT SINGLE PRECISION LOAD RESERVED OPERAND TEST ! 9: * ! 10: ***************************************************************************/ ! 11: ! 12: func_ptr_array ldf_r_tests; /* table of pointers to subtests */ ! 13: int max_ldf_r_sbtst_no; /* # reserved operand tests */ ! 14: ! 15: ! 16: /* ! 17: * SUBTEST MESSAGE TABLE: messages describing the subtests ! 18: */ ! 19: char *ldf_r_sbtst_msg1[] = ! 20: { ! 21: " LDF -test 1 -Resop, Register data ", /* subtest # 1 */ ! 22: " LDF -test 2 -Resop, Cache data " /* subtest # 2 */ ! 23: }; ! 24: ! 25: ! 26: /* ! 27: * ERROR MESSAGE TABLE ! 28: */ ! 29: char *ldf_r_err_msg[] = ! 30: { ! 31: "-expected fault didn't occur\n" /* error code = 1 */ ! 32: }; ! 33: ! 34: ! 35: /*************************************************************************** ! 36: * ! 37: * LOAD SINGLE PRECISION RESERVED OPERAND MONITOR ! 38: * ! 39: ***************************************************************************/ ! 40: ldf_event() ! 41: { ! 42: asm(".globl _ldf_e"); ! 43: asm("_ldf_e:"); /* entry address */ ! 44: if( (cycle == 1) && (prt_hdrs) ) /* print header on 1st cycle */ ! 45: { ! 46: writes(" LDF"); ! 47: } ! 48: stuff_ldf_r_array(); /* fill in subtest ptr array */ ! 49: ldf_r_sched(); /* load reserved operands */ ! 50: asm("jmp *return");; /* return to test monitor */ ! 51: } ! 52: ! 53: ! 54: ! 55: ! 56: ! 57: ! 58: /***************************************************************************** ! 59: * ! 60: * LDF - RESERVED OPERAND TEST SEQUENCER ! 61: * ! 62: * This function will select the subtest and call the subtest schedualer ! 63: * ! 64: *****************************************************************************/ ! 65: ldf_r_sched() ! 66: { ! 67: int sbtst_index; ! 68: for( subtest = 1; subtest < max_ldf_r_sbtst_no; subtest++ ) ! 69: { ! 70: sbtst_index = subtest - 1; ! 71: subtest_message = ldf_r_sbtst_msg1[ sbtst_index ]; ! 72: test_ldf_r( ldf_r_tests[ sbtst_index ] ); /* execute the test */ ! 73: } ! 74: } ! 75: ! 76: ! 77: ! 78: ! 79: ! 80: ! 81: ! 82: /***************************************************************************** ! 83: * ! 84: * LDF RESERVED OPERAND TEST ! 85: * ! 86: * This function will call the specific subtest sequences. The subtest will ! 87: * load a Reserved Operand. A Reserved Operand Fault ( code 2d ) should ! 88: * occur. The fault handler will return control to this function. ! 89: * ! 90: *****************************************************************************/ ! 91: test_ldf_r( current_subtest ) ! 92: int (*current_subtest)(); /* pointer to test sequence */ ! 93: { ! 94: asm("moval (r14),_pre_event_sp"); /* save the stack pointer */ ! 95: asm("moval (r13),_pre_event_fp"); /* save the frame pointer */ ! 96: asm("moval _ldf_r_ret,_event_return"); /* set event return address */ ! 97: /* ! 98: * test all of the data pattenrs ! 99: */ ! 100: for( index = 0; index < max_ldf_resop_index; index++ ); ! 101: { ! 102: sgl_ld_acc = ldf_resop_data[index]; /* get Reserved Op data */ ! 103: asm("_ldf_r_loop:"); ! 104: exp_event = RESOP_CODE; /* RESOP fault expected */ ! 105: (*current_subtest)(); /* run the test */ ! 106: /* ! 107: * We shouldn't get to this point - if we do then there was no trap. ! 108: */ ! 109: err_code = 1; /* error type 1 (no event) */ ! 110: exp_event = FALSE; /* no events are expected */ ! 111: asm("movl _pre_event_sp,r14"); /* restore stack pointer */ ! 112: asm("movl _pre_event_fp,r13"); /* restore frame pointer */ ! 113: if( force_loop ) ! 114: { ! 115: loop_val_1b = sgl_ld_acc; /* save last OP_1 pattern */ ! 116: sgl_ld_acc = loop_val_1a; /* get next OP_1 pattern */ ! 117: loop_val_1a = loop_val_1b; /* get ready for next loop */ ! 118: asm("jmp _ldf_r_loop"); /* loop forever */ ! 119: }; ! 120: errcnt++; /* bump the error count */ ! 121: if( prt_error ) { ! 122: error_message = ldf_r_err_msg[ err_code -1 ]; ! 123: ldf_r_print_error( error_message ); ! 124: }; ! 125: if ( halt_flg ) /* halt on error */ ! 126: ldf_err_hlt(); ! 127: if ( loop_on_err ) ! 128: { ! 129: get_ldf_r_loop_data(); /* set up the loop data */ ! 130: force_loop = 1; /* set the force loop flag */ ! 131: asm("jmp _ldf_r_loop"); /* and loop */ ! 132: }; ! 133: /* ! 134: * Reserved Operand events will return here: ! 135: */ ! 136: asm(".globl _ldf_r_ret"); ! 137: asm("_ldf_r_ret:"); ! 138: if( force_loop ) ! 139: { ! 140: get_ldf_r_loop_data(); /* set up the loop data */ ! 141: asm("jmp _ldf_r_loop"); /* loop on previous error */ ! 142: }; ! 143: }; ! 144: asm("movl _pre_event_sp,r14"); /* restore stack pointer */ ! 145: asm("movl _pre_event_fp,r13"); /* restore frame pointer */ ! 146: } /* end of subtest schedualer */ ! 147: ! 148: ! 149: ! 150: ! 151: ! 152: /*************************************************************************** ! 153: * ! 154: * SUBTEST 1 - Register data ! 155: * ! 156: ***************************************************************************/ ! 157: ldf_r_reg() ! 158: { ! 159: asm("movl _sgl_ld_acc,r4"); /* move the data to a reg */ ! 160: asm("ldf r4"); /* trigger the fault */ ! 161: asm("nop"); /* waste a little time */ ! 162: asm("nop"); /* waste a little time */ ! 163: sgl_dummy1 = 0; /* dummy instr for "C" */ ! 164: } ! 165: ! 166: ! 167: ! 168: ! 169: ! 170: /*************************************************************************** ! 171: * ! 172: * SUBTEST 2 - Cache data ! 173: * ! 174: ***************************************************************************/ ! 175: ldf_r_cache() ! 176: { ! 177: asm("ldf _sgl_ld_acc"); /* trigger the fault */ ! 178: asm("nop"); /* waste a little time */ ! 179: asm("nop"); /* waste a little time */ ! 180: sgl_dummy1 = 0; /* dummy instr for "C" */ ! 181: } ! 182: ! 183: ! 184: ! 185: ! 186: /****************************************************************************** ! 187: * ! 188: * FILL IN THE SUBTEST POINTER ARRAY WITH THE SUBTEST ADDRESSES ! 189: * ! 190: ******************************************************************************/ ! 191: stuff_ldf_r_array() ! 192: { ! 193: ldf_r_tests[0] = ldf_r_reg; /* subtest 1 (register data) */ ! 194: ldf_r_tests[1] = ldf_r_cache; /* subtest 2 (cache data) */ ! 195: max_ldf_r_sbtst_no = 2; /* set # of reserved op tsts */ ! 196: } ! 197: ! 198: ! 199: ! 200: ! 201: /****************************************************************************** ! 202: * ! 203: * HALT ON ERROR ! 204: * ! 205: ******************************************************************************/ ! 206: ldf_err_hlt() ! 207: { ! 208: asm("movl _test_no,r0"); /* r0 = test number */ ! 209: asm("movl _subtest,r1"); /* r1 = subtest number */ ! 210: asm("movl _err_code,r2"); /* r2 = error code */ ! 211: asm("movl _cycle,r3"); /* r3 = cycle count */ ! 212: asm("movl _sgl_ld_acc,r4"); /* r4 = operand */ ! 213: asm(".globl _ldf_resop_hlt"); ! 214: asm("_ldf_resop_hlt:"); /* PC after the halt */ ! 215: asm("halt"); /* HALT ... */ ! 216: sgl_dummy1 = 0; /* dummy statement for 'C' */ ! 217: } ! 218: ! 219: ! 220: ! 221: ! 222: ! 223: /****************************************************************************** ! 224: * ! 225: * PRINT AN ERROR MESSAGE ! 226: * ! 227: ******************************************************************************/ ! 228: ldf_r_print_error() ! 229: { ! 230: writes("\ncycle: "); ! 231: writed( cycle ); ! 232: writes( subtest_message ); ! 233: writes( error_message ); ! 234: writes("operand = "); ! 235: write32h( sgl_ld_acc ); ! 236: writes(" \n"); ! 237: } ! 238: ! 239: ! 240: ! 241: ! 242: ! 243: /****************************************************************************** ! 244: * ! 245: * GET DATA PATTERNS FOR LOOPING ON THE ERROR ! 246: * ! 247: ******************************************************************************/ ! 248: get_ldf_r_loop_data() ! 249: { ! 250: if( (index > 0) && (!no_data_swap_on_lp) ) ! 251: { ! 252: old_indx = index -1; /* get the last data pattern */ ! 253: loop_val_1a = ldf_resop_data[old_indx]; ! 254: } ! 255: else ! 256: loop_val_1a = sgl_ld_acc; /* use the same data pattern */ ! 257: } ! 258: ! 259: ! 260: ! 261:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.