File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / fpevent / monitor.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:30:17 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v121, HEAD
Power 6/32 Unix version 1.21


#include "evt_defs.h"

/*********************************************************************
*
*	MONITOR FOR THE FPP EVENTS TESTS
*
*  22-Mar-85 : written
*  10-Jul-85 : don't run pipe test if running all tests on a specified op-code
*  16-Jul-85 : added NO-FPP test capability
*********************************************************************/
monitor()
{
struct test_t *test_tbl;		/* pointer to the test table to use */
int no_subtests;			/* number of tests in the table */
	force_loop = FALSE;		/* clear the 'force loop' flag */
	valid_test = FALSE;		/* clear the 'a test was run' 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("\nFPP Events 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: ");
	    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: ");
	    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_list <= no_subtests) ) {
	        test_no = run_list;
	        test_index = run_list - 1;
	        if( (prt_hdrs) && (cycle == 1) ) {
/*  	     if( !error )			/*		*/
			  writec('\n');
	             writes( test_tbl[ test_index ].name );
		};
	        (test_tbl[ test_index ].test)();
	    } 
	     else    /* run all tests */
	    {
	        for(test_index=0; test_index<no_subtests; test_index++) {
		    test_no = test_index + 1;
	            if( (no_fpp_wcs) ||    /* don't run pipe test w/ FPP WCS */
	                (!evt_inst) || 	   /*   and a specified instruction  */
			(test_index != pipe_test_index) ) {
	                   if( (prt_hdrs) && (cycle == 1) ) {
/*  			        if( !error )		/*		*/
			             writec('\n');
	                        writes( test_tbl[ test_index ].name );
		           };
	                   (test_tbl[ test_index ].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 */
	    if( valid_test ) {		/* were any tests actually run? */
	         writes("Cycles Complete = ");
	         writed( cycle );
	         if( errcnt ) {
		     writes(",  Error Count = " );
		     writed( errcnt );
		     writes(",  Test Complete\n");
	         } else 
		     writes(",  TEST PASSED -NO ERRORS!!! \n");
	    } else {
	         writes("FPEVENT: no tests were run with instruction ");
		 writeh( evt_inst );
		 writec('\n');
	    }
	};
/*
 * Set up the registers to halt
*/
	asm("movl _errcnt,r0");		/* set error count for halt */
	asm("bneq 1f");
	asm("tstl _valid_test");	/* were any tests run?      */
	asm("beql 1f");			/* r0 = 0 if no tests run   */
	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("movl _evt_inst,r3");	/* move inst op-code to r3  */
	asm("halt");;
}
 


unix.superglobalmegacorp.com

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