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


#include "dmp_defs.h"

/*********************************************************************
*
*	MONITOR FOR THE DEMAND PAGING TESTS
*
*  11-Feb-85  : written
*
*********************************************************************/

monitor()
{
int sbtst_indx;
	asm("moval (fp),_monitor_fp");	/* save the frame pointer */
	asm("moval (sp),_monitor_sp");	/* save the stack pointer */
	force_loop = FALSE;		/* clear the force loop flag */
	cycle = 0;			/* clear the cycle count */
	errcnt = 0;			/* clear the error count */
/*
 * Print the Header information and enable the Data Cache if desired
*/
	if( prt_hdrs ) {
	    writes("\nFPP Demand Paging Test");
	    if( no_fpp_wcs )
		 writes(" - FPP is NOT installed");
	    else
		 writes(" - FPP is installed");
	    if( user_mode )
	        writes(".  User Mode");
	    else
	        writes(".  Kernal Mode");
	}
	if( en_data_cache ) {
	    asm("mtpr $1,$25");			/* purge all data cache pages */
	    asm("mtpr $1,$27");			/* enable the data cache */
	    if( prt_hdrs )
		writes(", Data Cache Enabled:\n");
	} else {
	    asm("mtpr $2,$27");			/* disable the data cache */
	    if( prt_hdrs )
		writes(", Data Cache Disabled:\n");
	}
	if( count )
	    nonstop = FALSE;			/* user specfied # of cycles */
	else
	    nonstop = TRUE;			/* continuous testing */
/*
 * Check to see if they've asked for PUSHD in the Kernal mode ( a no no )
*/
	valid_test = TRUE;
	if( (run_list) && (!user_mode) ) {
	     sbtst_indx = run_list -1;
	     if( inst_tbl[sbtst_indx].inst_code == PUSHD_OP_CODE ) {
			writes(
		      "PUSHD is not a valid instruction in the Kernal Mode\n");
			valid_test = FALSE;
	     }
	}
	if( valid_test ) {
	   for( cycle = 1; ( (cycle <= count) || nonstop ); cycle++ ) {
	      if( (prt_hdrs) && (cycle != 1) )
		 writec('.');		/* show we're still running */
	      if( (run_list > 0) && (run_list <= NO_INSTRUCTIONS) ) {
	         test_no  = run_list;
	         sbtst_indx = run_list - 1;
	         if( (prt_hdrs) && (cycle == 1) )
	            writes( inst_tbl[ sbtst_indx ].name );
	         sched_test( sbtst_indx );
	      } 
	       else 	/* test ALL applicable instructions */
	      {
	         for(sbtst_indx=0;sbtst_indx<NO_INSTRUCTIONS;sbtst_indx++) {
		    test_no = sbtst_indx + 1;
		    if( (user_mode) ||
	                (inst_tbl[sbtst_indx].inst_code != PUSHD_OP_CODE) ) {
	               if( (prt_hdrs) && (cycle == 1) ) {
		          if( (inst_tbl[sbtst_indx].inst_code==LDD_OP_CODE) ||
			      (inst_tbl[sbtst_indx].inst_code==CVDF_OP_CODE) )
			         writec('\n');		/* start a new line */
	                  writes( inst_tbl[ sbtst_indx ].name );
		       }
	               sched_test( sbtst_indx );
		       asm("tst_all_return:");;
	            }  /* end of IF (not PUSHD in Kernal mode) */
	         }  /* end of FOR (each instruction) */
	      }  /* end of ELSE test all instructions */
	      asm("tst_one_return:");;
	   } /* end of test cycles  */
	   cycle--;			/* correct cycle count */
	}  /* end of IF (valid test)  */
	if( prt_hdrs ) {
/*	    if( !error )  */
		 writec('\n');		/* new line if no current errors */
	    writes("Cycles Complete = ");
	    writed( cycle );
	    if( valid_test ) {
	        if( errcnt ) {
		    writes(",  Error Count = " );
		    writed( errcnt );
		    writes(",  Test Complete\n");
	        } else {
		    writes(",  TEST PASSED -NO ERRORS!!! \n");
	        }
	    }  /* end of IF (valid test) */
	};  /* end of IF (print headers) */
	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("halt");;			/* ALL DONE - HALT */
/*
 * This is the return from an unexpected fpp event
*/
		asm(".globl _mon_ret");
		asm("_mon_ret:");
		asm("movl _monitor_fp,fp");	/* restore the frame ptr  */
		asm("movl _monitor_sp,sp");	/* restore the stack ptr  */
		asm("tstl _run_list");		/* test all instructions? */
		asm("beql 1f");
		asm("jmp tst_one_return");	/* go to next test cycle  */
		asm("1:");
		asm("jmp tst_all_return");	/* test next instruction  */
		asm(".align 2");
		asm(".globl return");
		asm("return:");
		asm(".long _mon_ret");		/* pointer to return addr */
}
 


unix.superglobalmegacorp.com

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