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

#include "fpp_defs.h"



/****************************************************************************
*	Floating Point Test RESERVED_ADDRESS FAULT Handler
*
* The only way to this code is via an RESERVED ADDRESS fault and the 
* EVENT handler. The fault may or may not be expected.
*
*  13-Feb-85   JJM: removed the messages from here & made code prettier
****************************************************************************/
reserved_address()
{
	asm(".globl _res_addr_handler");	/* entry point              */
	asm("_res_addr_handler:");
	asm("movl _pre_event_fp,r13");		/* set the frame pointer    */
	if( address_fault_expected ) 
	{
	   asm("movl _post_event_sp,r14");	/* point SP to stack data   */
	   asm("movl (sp)+,_pop_val_1");	/* pop the PC of the instr. */
	   asm("movl (sp)+,_pop_val_2");	/* pop the pushed PSL       */
	   asm("movl _pre_event_sp,r14");	/* restore stack_pointer    */
/*
 * check the data on the stack
*/
	   if( (pop_val_1 != exp_pc) ||		/* expected PC ?            */
	       (pop_val_2 != exp_psl) ) 	/* expected PSL ?           */
	   {
	         errcnt++;			/* bump the error count     */
	         if( prt_error ) 
		 {
	             writes("\ncyle: ");
		     writed( cycle );
	             writes(" FPP - ");
		     writeh( test_no );
		     writes(" - invalid stack after Reserved Addr fault");
		     writes("\n addressing mode = ");
		     writes( addressing_modes[addr_mode] );
		     writes("\n stack PC = ");
		     write32h( pop_val_1 );
		     writes(", PSL = ");
		     write32h( pop_val_2 );
		     writes(",   exp PC = ");
		     write32h( exp_pc );
		     writes(",  PSL = ");
		     write32h( exp_psl );
	         }
	         if ( halt_flg ) 		/* if halt on error         */
		 {
		    asm("movl _test_no,r0");	/* r0  = test number        */
		    asm("movl $0,r1");		/* r1  = 0 (subtest number) */
		    asm("movl $1,r2");		/* r2  = error code         */
		    asm("movl _cycle,r3");	/* r3  = cycle count        */
		    asm("movl _pop_val_1,r4");	/* r4  = actual PC on stack */
		    asm("movl _pop_val_2,r5");	/* r5  = actual PSL on stck */
		    asm("movl _exp_pc,r6");	/* r6  = expected PC        */
		    asm("movl _exp_psl,r7");	/* r7  = expected PSL       */
	            asm("_resaddr_hlt_1:");	/* PC after the halt        */
		    asm("halt");		/* HALT ...                 */
	         }
		 if( loop_on_err ) 
		 {
		     force_loop = TRUE;		/* set the forced loop flag */
		     asm("jmp *_loop_addr");	/* and go loop              */
		 }
	    }  /* end of stack data error */
	} 
	else   			/* the address fault was not expected */
	{
	    errcnt++;				/* increment the error count */
	    if( prt_error ) 
	    {
	        writes("\ncyle: ");
		writed( cycle );
	        writes(" FPP-");
		writeh( test_no );
		writes(" - invalid Reserved Addr fault");
		writes("\n addressing mode = ");
		writes( addressing_modes[addr_mode] );
	    }
	    if ( halt_flg ) 			/* if halt on error         */
	    {
	        asm("movl _test_no,r0");	/* r0  = test number        */
	        asm("clrl r1");			/* r1  = 0 (subtest number) */
	        asm("movl $2,r2");		/* r2  = error code         */
	        asm("movl _cycle,r3");		/* r3  = cycle count        */
	        asm("movl _addr_mode,r4");	/* r4  = addressing mode    */
	        asm(".globl _resaddr_hlt_2");
	        asm("_resaddr_hlt_2:");		/* PC after the halt        */
	        asm("halt");			/* HALT ...                 */
	    } 
	    if( loop_on_err ) 
	    {
		force_loop = TRUE;		/* We're going to loop  */
	        asm("jmp *_loop_addr");		/* loop forever         */
	    };
	};  /* end of ELSE (unexpected fault) */
	asm("jmp *_next_addr");	/* go to the next mode  */
}








/****************************************************************************
*		No RESERVED_ADDRESS FAULT Occurred routine
*
* The only way to this code is if an expected RESERVED ADDRESS Fault did 
* NOT occurr.
****************************************************************************/
no_res_address()
{
	asm(".globl _no_res_addr_fault");
	asm("_no_res_addr_fault:");		/* start of "no fault" stuff */
	errcnt++;				/* increment the error count */
	if( prt_error ) 
	{
	    writes("\ncyle: ");
	    writed( cycle );
	    writes(" FPP-");
	    writeh( test_no );
	    writes("  Expected Reserved Address fault did not occur");
	    writes("\n Addressing Mode = ");
	    writes( addressing_modes[addr_mode] );
	}
	if ( halt_flg ) 			/* if halt on error         */
	{
	    asm("movl _test_no,r0");		/* r0  = test number        */
	    asm("clrl r1");			/* r1  = 0 (subtest number) */
	    asm("movl $3,r2");			/* r2  = error code         */
	    asm("movl _cycle,r3");		/* r3  = cycle count        */
	    asm("movl _addr_mode,r4");    	/* r4  = addressing mode    */
	    asm("_res_addr_hlt3:");		/* PC after the halt        */
	    asm("halt");			/* HALT ...                 */
	}
	if( loop_on_err ) 
	{
	    force_loop = TRUE;			/* We're going to loop  */
	    asm("jmp *_loop_addr");		/* loop forever         */
	} else
	    asm("jmp *_next_addr");;		/* go to the next mode  */
}





unix.superglobalmegacorp.com

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