|
|
1.1 ! root 1: ! 2: #include "macro4_defs.h" ! 3: ! 4: /********************************************************************* ! 5: * ! 6: * MONITOR FOR THE FPP INSTRUCTION TESTS ! 7: * ! 8: * 20-Jul-85 : written ! 9: *********************************************************************/ ! 10: monitor() ! 11: { ! 12: int no_subtests; /* number of tests in the table */ ! 13: force_loop = FALSE; /* clear the 'force loop' flag */ ! 14: cycle = 0; /* clear the cycle count */ ! 15: errcnt = 0; /* clear the error count */ ! 16: error = FALSE; /* clear the current error flag */ ! 17: if( no_fpp_wcs ) { ! 18: test_tbl = no_fpp_test_tbl; /* use the NO-FPP tests */ ! 19: no_subtests = no_fpp_test_cnt; ! 20: } else { ! 21: test_tbl = fpp_test_tbl; /* use the FPP tests */ ! 22: no_subtests = fpp_test_cnt; ! 23: } ! 24: /* ! 25: * Print the Header information and enable the Data Cache if desired ! 26: */ ! 27: if( prt_hdrs ) { ! 28: writes("\nMacro4 Test"); ! 29: if( no_fpp_wcs ) ! 30: writes(" - FPP is NOT installed"); ! 31: else ! 32: writes(" - FPP is installed"); ! 33: } ! 34: if( en_data_cache ) { ! 35: if( prt_hdrs ) ! 36: writes(" - Data Cache Enabled: \n"); ! 37: asm("mtpr $1,$25"); /* purge all data cache pages */ ! 38: asm("mtpr $1,$27"); /* enable the data cache */ ! 39: } else { ! 40: if( prt_hdrs ) ! 41: writes(" - Data Cache Disabled: \n"); ! 42: asm("mtpr $2,$27"); /* disable the data cache */ ! 43: } ! 44: /* ! 45: * Check the run list to see if a specific test is called for ! 46: */ ! 47: for( cycle = 1; ( (cycle <= count) || nonstop ); cycle++ ) { ! 48: if( (prt_hdrs) && (cycle != 1) ) /* show we're still running */ ! 49: writec('.'); ! 50: if( (run_list > 0) && /* run 1 test only */ ! 51: (run_list <= no_subtests) ) { ! 52: test_no = run_list; ! 53: test_index = run_list - 1; ! 54: sched_test( test_index ); /* run the test */ ! 55: } else { /* run all tests */ ! 56: for(test_index=0; test_index<no_subtests; test_index++) { ! 57: test_no = test_index + 1; ! 58: sched_test( test_index ); /* run the test */ ! 59: } ! 60: } /* end of test-all-instructions */ ! 61: } /* end of test cycles - done with the test */ ! 62: cycle--; /* correct cycle count */ ! 63: if( prt_hdrs ) { ! 64: /* if( !error ) */ ! 65: writec('\n'); /* new line if no current errors */ ! 66: writes("Cycles Complete = "); ! 67: writed( cycle ); ! 68: if( errcnt ) { ! 69: writes(", Error Count = " ); ! 70: writed( errcnt ); ! 71: writes(", Test Complete\n"); ! 72: } else ! 73: writes(", TEST PASSED -NO ERRORS!!! \n"); ! 74: }; ! 75: /* ! 76: * Set up the registers to halt ! 77: */ ! 78: asm("movl _errcnt,r0"); /* set error count for halt */ ! 79: asm("bneq 1f"); ! 80: asm("movl $0xCAFEBABE,r0");; /* set the no-error flag */ ! 81: asm("1:"); ! 82: asm("movl _OPTIONS,r1"); /* restore options to r1 */ ! 83: asm("movl _cycle,r2"); /* move cycle count to r2 */ ! 84: asm("halt");; ! 85: } ! 86: ! 87: ! 88: ! 89: /*********************************************************************** ! 90: * ! 91: * Start the current subtest ! 92: * ! 93: * The test may come back here after an unexpected event so the monitor's ! 94: * stack and frame pointers are saved. Funny things happen if we try to ! 95: * exit from this routine with the wrong frame pointer. Unexpected events ! 96: * will either return indirectly through "return" or they will just halt. ! 97: * ! 98: ***********************************************************************/ ! 99: sched_test( test_index ) ! 100: int test_index; ! 101: { ! 102: asm("moval (r13),_monitor_fp"); /* save the frame ptr */ ! 103: asm("moval (r14),_monitor_sp"); /* save the stack ptr */ ! 104: test_ptr = test_tbl[ test_index ]; /* get ptr to test */ ! 105: asm("jmp *_test_ptr"); /* execute the test */ ! 106: asm(".globl _sched_return"); ! 107: asm("_sched_return:"); /* return here after the test */ ! 108: asm("nop"); ! 109: asm("movl _monitor_fp,r13"); /* restore the frame pointer */ ! 110: asm("movl _monitor_sp,r14");; /* restore the stack pointer */ ! 111: if( FALSE ) { ! 112: asm(".align 2"); ! 113: asm(".globl return"); /* event return is through here */ ! 114: asm("return:"); ! 115: asm(".long _sched_return");; ! 116: } ! 117: } ! 118:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.