|
|
Power 6/32 Unix version 1.21
#include "macro4_defs.h"
/*********************************************************************
*
* MONITOR FOR THE FPP INSTRUCTION TESTS
*
* 20-Jul-85 : written
*********************************************************************/
monitor()
{
int no_subtests; /* number of tests in the table */
force_loop = FALSE; /* clear the 'force loop' flag */
cycle = 0; /* clear the cycle count */
errcnt = 0; /* clear the error count */
error = FALSE; /* clear the current error flag */
if( no_fpp_wcs ) {
test_tbl = no_fpp_test_tbl; /* use the NO-FPP tests */
no_subtests = no_fpp_test_cnt;
} else {
test_tbl = fpp_test_tbl; /* use the FPP tests */
no_subtests = fpp_test_cnt;
}
/*
* Print the Header information and enable the Data Cache if desired
*/
if( prt_hdrs ) {
writes("\nMacro4 Test");
if( no_fpp_wcs )
writes(" - FPP is NOT installed");
else
writes(" - FPP is installed");
}
if( en_data_cache ) {
if( prt_hdrs )
writes(" - Data Cache Enabled: \n");
asm("mtpr $1,$25"); /* purge all data cache pages */
asm("mtpr $1,$27"); /* enable the data cache */
} else {
if( prt_hdrs )
writes(" - Data Cache Disabled: \n");
asm("mtpr $2,$27"); /* disable the data cache */
}
/*
* Check the run list to see if a specific test is called for
*/
for( cycle = 1; ( (cycle <= count) || nonstop ); cycle++ ) {
if( (prt_hdrs) && (cycle != 1) ) /* show we're still running */
writec('.');
if( (run_list > 0) && /* run 1 test only */
(run_list <= no_subtests) ) {
test_no = run_list;
test_index = run_list - 1;
sched_test( test_index ); /* run the test */
} else { /* run all tests */
for(test_index=0; test_index<no_subtests; test_index++) {
test_no = test_index + 1;
sched_test( test_index ); /* run the test */
}
} /* end of test-all-instructions */
} /* end of test cycles - done with the test */
cycle--; /* correct cycle count */
if( prt_hdrs ) {
/* if( !error ) */
writec('\n'); /* new line if no current errors */
writes("Cycles Complete = ");
writed( cycle );
if( errcnt ) {
writes(", Error Count = " );
writed( errcnt );
writes(", Test Complete\n");
} else
writes(", TEST PASSED -NO ERRORS!!! \n");
};
/*
* Set up the registers to halt
*/
asm("movl _errcnt,r0"); /* set error count for halt */
asm("bneq 1f");
asm("movl $0xCAFEBABE,r0");; /* set the no-error flag */
asm("1:");
asm("movl _OPTIONS,r1"); /* restore options to r1 */
asm("movl _cycle,r2"); /* move cycle count to r2 */
asm("halt");;
}
/***********************************************************************
*
* Start the current subtest
*
* The test may come back here after an unexpected event so the monitor's
* stack and frame pointers are saved. Funny things happen if we try to
* exit from this routine with the wrong frame pointer. Unexpected events
* will either return indirectly through "return" or they will just halt.
*
***********************************************************************/
sched_test( test_index )
int test_index;
{
asm("moval (r13),_monitor_fp"); /* save the frame ptr */
asm("moval (r14),_monitor_sp"); /* save the stack ptr */
test_ptr = test_tbl[ test_index ]; /* get ptr to test */
asm("jmp *_test_ptr"); /* execute the test */
asm(".globl _sched_return");
asm("_sched_return:"); /* return here after the test */
asm("nop");
asm("movl _monitor_fp,r13"); /* restore the frame pointer */
asm("movl _monitor_sp,r14");; /* restore the stack pointer */
if( FALSE ) {
asm(".align 2");
asm(".globl return"); /* event return is through here */
asm("return:");
asm(".long _sched_return");;
}
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.