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


/*	init.s								*/


/*	This file is a diagnostic version of locore.s.			*/
/*	It contains the following:					*/
/*	*system data area = scb, dump buffer, interrupt stack,		*/
/*	*system page table,user page tables,pcbs,iomap, & io buffers.	*/
/*									*/
/*	*system code = interrupt vectors, initialization of system data,*/
/*	*memory size calculation,initialization of SPT, zeroing of	*/
/*	*unused memory, & loading of SBR & SLR.				*/
/*	*								*/
/*	*at the end of this code, you are ready to go to virtual mode.	*/
/*	* --- GOOD LUCK!						*/
/*									*/
/*	The arithmetic fault test will only be run if there is a        */
/*	Floating Point Processor in the system or if the users sets the */
/*	'run arithmetic test' bit (bit 4 -0x10) in register #1.         */
/*									*/
/*  14-June-85 : run arithmetic fault test with FPP or option bit set   */
/*									*/
/*	Modified 11/20/85 to include two subtests (9 and A) that     	*/
/*	will generate an alignment fault when the error is in        	*/
/*	the intermediate address of a deferred addressing mode.      	*/
/*									*/
/*	Modified 04/22/86 to fix an intermittent failure that occured	*/
/*	due to clock or console receive interrupts.  The ISP, KSP and	*/
/*	Usp were seperated throughout the test to solve this problem.	*/
/*	Before this change the test would fail intermittently when run  */
/*	with the printout turned on.  Also added the release date that	*/
/*	can be read from memory.  The date will be after the jump to 	*/
/* 	of test at location 0x800					*/

/*	privileged registers addresses	*/
#include	"prvreg.h"
	
/*	program status long word definition	*/
#include	"psl.h"	

/* 	page table entry definition		*/
#include	"pte.h"
	
/*	process control block offsets	*/
#include	"pcboffset.h"	

/*	fundamental constants for globl use	*/
#include	"const.h"	

/*	system control block offsets*/
#include	"scboffset.h"
/*	SPT offsets				*/
#include	"sptoffset.h"

/*	trap numbers*/
#include	"trap.h"	


#define V_TRAP		0
#define V_SYSCALL	4

	.set	HIGH,0x1f	/*mask for disabling all interrupts	*/
	.set	MCKVEC,4	/*scb offset for machinecheck vector	*/
	.set	NISP,512	/*size of interrupt stack 		*/
	.set	DONE,255	/*user process done code		*/

	.text

#include "pstorage.s"		/* PROCESSOR STORAGE AREA 		*/

	.globl	_Entry
_Entry:
	jmp	start
	.long 0x00042286	/* date of realese	*/
	.space  (1024-10)




/*		globl dump buffer to be used for communication		*/
/*		between tests & interrupt handlers, & other misc.	*/
/*		purposes.						*/
				
				/*physical page 3			*/

	.set	NLWU,36		/*no. of longwords already used		*/
				/*this must be changed when you define	*/
				/*additional variables below before	*/
				/*_dbuf					*/
	.globl	_restart
_restart:
	.space	4		/*contains restart address for restarting*/
				/*after power is restored (loaded by	*/
				/*power fail interrupt handler & used by*/
				/*CPU 2					*/	
	.globl	_maxmem
_maxmem:
	.space	4		/*memory size in no of bytes		*/

	.globl	_maxpages
_maxpages:
	.space	4		/*memory size in no. of physical pages	*/

	.globl	_lastadd
_lastadd:
	.space	4		/*address of the last long word		*/

	.globl	_unused
_unused:
	.space	4		/*first unused page in system space	*/

	.globl	_ctlblk
_ctlblk:
	.long	0		/* pointer to SCB */

	.globl	_savvec0	/*save vectors area			*/
_savvec0:
	.space	4

	.globl	_savvec1	/*save vectors area			*/
_savvec1:
	.space	4

	.globl	_savvec2	/*save vectors area			*/
_savvec2:
	.space	4

	.globl	_savvec3	/*save vectors area			*/
_savvec3:
	.space	4

	.globl	_savvec4	/*save vectors area			*/
_savvec4:
	.space	4

	.globl	_savvec5	/*save vectors area			*/
_savvec5:
	.space	4
	.globl	_savvec6	/*save vectors area			*/
_savvec6:
	.space	4
	.globl	_savvec7	/*save vectors area			*/
_savvec7:
	.space	4

	.globl	_savvec8	/*save vectors area			*/
_savvec8:
	.space	4

	.globl	_savvec9	/*save vectors area			*/
_savvec9:
	.space	4

	.globl	_savveca	/*save vectors area			*/
_savveca:
	.space	4

	.globl	badrtn
badrtn:
	.long	tfail 

testno: .long	0

	.globl	_dbuf		/*dump buffer left out of 1K		*/
	.globl	_r_no
_r_no:
	.long	0
	.globl	_pt_base
_pt_base:
	.long	0
	.globl	_saved_psl
_saved_psl:
	.long   0
	.globl	_saved_sp
_saved_sp:
	.long	0
	.globl	_saved_fp
_saved_fp:
	.long	0
	.globl	_p_ptr
_p_ptr:
	.long   0
	.globl	_ret_adr
_ret_adr:
	.long	0
	.globl	_exp_par0
_exp_par0:
	.long	0
	.globl	_exp_par1
_exp_par1:
	.long	0
	.globl	_exp_par2
_exp_par2:
	.long	0
	.globl	_exp_par3
_exp_par3:
	.long	0
	.globl	_act_par0
_act_par0:
	.long	0
	.globl	_act_par1
_act_par1:
	.long	0
	.globl	_act_par2
_act_par2:
	.long	0
	.globl	_act_par3
_act_par3:
	.long	0
	.globl	_test_no
_test_no:
	.long	0
	.globl	_clk_cnt
_clk_cnt:
	.long	0		/* Clock int. count */
_dbuf:
	.space	NBPG - (NLWU *4)
edbuf:


	.globl	_intstack	/* Interrupt stack			*/
_intstack:			/* Physical pages 4 & 5			*/
	.space	NISP
eintstack:

	.globl	_usrstack	/* User  stack			*/
_usrstack:			/* Physical pages 6 & 7			*/
	.space	NISP
eusrstack:

	.globl	_kerstack	/* Kernal stack			*/
_kerstack:			/* Physical pages 8 & 9			*/
	.space	NISP
ekerstack:

	.globl	_tmpstack	/* temp stack			*/
_tmpstack:			/* Physical pages 8 & 9			*/
	.space	NISP
etmpstack:


	.set	SYSPTSIZE,512	/* No. of entries in SPT		*/
 
/*
	System Page Table -- physical page 10 & 11
*/ 
	.align	2
	.globl	_Sysmap
_Sysmap:
	.space	SYSPTSIZE*4 	/* 512 max pages allowed for system	*/
eSysmap:
	.globl	_Syssize
	.set	_Syssize,(eSysmap-_Sysmap)/4	/* should be SYSPTSIZE	*/
	
	.globl	_iomap		/* Physical page 12	*/
_iomap:	.space	1024		/* IOMAP - unused 	*/
	.globl	_eiomap
_eiomap:

	.globl	_pcb0		/* Physical page 13	*/
_pcb0:	.space	128		/*process control block 0		*/
	.globl	_pcb1
_pcb1:	.space 128		/*process control block 1		*/
	.globl	_pcb2
_pcb2:	.space 128		/*process control block 2		*/
	.globl	_pcb3
_pcb3:	.space 128		/*process control block 3		*/
	.globl	_pcb4
_pcb4:	.space 128		/*process control block 4		*/
	.globl	_pcb5
_pcb5:	.space 128		/*process control block 5		*/
	.globl	_pcb6
_pcb6:	.space 128		/*process control block 6		*/
	.globl	_pcb7
_pcb7:	.space 128		/*process control block 7		*/

/*
	*user #0 page tables -- P0PT, P1PT, P2PT			
	*physical memory     --  page14, 15, & 16  respectively
*/
	.align	2
	.globl	_u0p0pt
_u0p0pt:
	.space	1024		/*255 max pages for user #0 text	*/
	.globl	_u0p1pt
_u0p1pt:	
	.space	1024		/*255 max pages for user #0 data	*/
	.globl	_u0p2pt
_u0p2pt:	
	.space	1020		/*255 max pages for user #0 stack	*/
eu0p2pt:
	.space	4

/*
	*user #1 page tables -- P0PT, P1PT, P2PT			
	*physical memory     --  page17 ,18, & 19  respectively
*/
	.align	2
	.globl	_u1p0pt
_u1p0pt:
	.space	1024		/*255 max pages for user #1 text	*/
	.globl	_u1p1pt
_u1p1pt:	
	.space	1024		/*255 max pages for user #1 data	*/
	.globl	_u1p2pt
_u1p2pt:	
	.space	1020		/*255 max pages for user #1 stack	*/
eu1p2pt:
	.space	4


/*
	*user #2 page tables -- P0PT, P1PT, P2PT			
	*physical memory     --  page 20, 21 , & 22  respectively
*/
	.align	2
	.globl	_u2p0pt
_u2p0pt:
	.space	1024		/*255 max pages for user #2 text	*/
	.globl	_u2p1pt
_u2p1pt:	
	.space	1024		/*255 max pages for user #2 data	*/
	.globl	_u2p2pt
_u2p2pt:	
	.space	1020		/*255 max pages for user #2 stack	*/
eu2p2pt:
	.space	4


/*
	*user #3 page tables -- P0PT, P1PT, P2PT			
	*physical memory     --  page 23, 24 , & 25  respectively
*/
	.align	2
	.globl	_u3p0pt
_u3p0pt:
	.space	1024		/*255 max pages for user #3 text	*/
	.globl	_u3p1pt
_u3p1pt:	
	.space	1024		/*255 max pages for user #3 data	*/
	.globl	_u3p2pt
_u3p2pt:	
	.space	1020		/*255 max pages for user #3 stack	*/
eu3p2pt:
	.space	4

/*
	*user #4 thru 6 page tables
	*physical memory -- pages 26 thru 34
*/
	.globl	_u4p0pt
_u4p0pt:
	.space	(9*NBPG) - 4
eu6p2pt:
	.space	4

/*
	*user #7 page tables -- P0PT, P1PT, P2PT			
	*physical memory     --  page 35, 36 , & 37  respectively
*/
	.align	2
	.globl	_u7p0pt
_u7p0pt:
	.space	1024		/*255 max pages for user #7 text	*/
	.globl	_u7p1pt
_u7p1pt:	
	.space	1024		/*255 max pages for user #7 data	*/
	.globl	_u7p2pt
_u7p2pt:	
	.space	1020		/*255 max pages for user #7 stack	*/
eu7p2pt:
	.space	4

	.globl	_iob0		/*io buffer 0 */
_iob0:	.space	1024
	.globl	_iob1		/*io buffer 1 */
_iob1:	.space	1024
	.globl	_iob2		/*io buffer 2 */
_iob2:	.space	1024
	.globl	_iob3		/*io buffer 3 */
_iob3:	.space	1024
	.globl	_iob4		/*io buffer 4 */
_iob4:	.space	1024
	.globl	_iob5		/*io buffer 5 */
_iob5:	.space	1024
	.globl	_iob6		/*io buffer 6 */
_iob6:	.space	1024
esysdata:

#include "scblock.s"		/* SYSTEM CONTROL BLOCK 		*/







#include	"evthandlers.s"	/*event handlers			*/

#define	ACBL(_n1,_n2,_n3,_n4) \
addl2	_n2,_n3;\
cmpl	_n3,_n1;\
bleq	_n4;



/*
	*INITIALIZATION CODE
	*
	* MME off; mode = k; IPL = 31; IS = 1
	*
*/

	.globl	start
start:
	mtpr	$0,$MME		/* Disable MME */

	movl	r0,_tno		/* R0 : Test no to run; 0 run all tests */
	movl	r1,_option
	movl	r2,_Cycle	/* R2 : Cycle count */

	clrl	_cycle
	clrl	_lptest
	movl	$1,_Emsg		/* Turn on messages sense switch */
	andl3	_option,$0x8,_ss1	/* Heading message sense switch */

	tstl	_tno		/* Set lptest if tno = XX and loop forever */
	beql	1f
	cmpl	_Cycle,$-1
	bneq	extest
	incl	_lptest
extest:
	movab	1f,r0
	andl2	$0xfffffff,r0
	jmp	(r0)			/* Switch map S->U */
1:
	mtpr	$0,$MME
	movab	_scb,r0
	andl2	$0x3ffffc00,r0
	mtpr	r0,$SCBB	/* Set SCBB  */
	mtpr	$0x1f,$IPL	/* Set IPL to HIGH */

	movpsl	r1
	andl2	$0xffffff00,r1		/* Mask out flags		*/
	cmpl	r1,$0x041f0000		/*IS on,modes =k & IPL = 31?	*/
	beql	1f
2:	movl	$1,r0
	movl	$0x041f0000,r2
	halt			/* PSL not initialized as expected	*/
/*
#	Mask out bit 30,31 of SCB vectors
#	Will turm them back on when ready to go virtual in 
#	system space
*/
1:
	clrl	_clk_cnt
	movl	$7,r0		/* R0 : Vector no. of clock int. */
	movab	_Hardclk,_scb[r0]	/* New vector for clock */
	movl	$NBPG/4,r1		/* One page for SCB */
	movab	_scb,r0
	andl2	$0x3ffffc00,r0
1:	andl2	$0x3fffffff,(r0)
	addl2	$4,r0
	decl	r1			/* Last one yet ? */
	bneq	1b


	movl	$_intstack+NISP,r0
	andl2	$0x3fffffff,r0		/* Mask out bit 30,31 */
	mtpr	r0,$ISP			/* init. ISP		*/
	movl	r0,sp			/* in case we get exception	*/
	movab	(sp),fp			/* Initialize FP	  	*/

	movl	$_usrstack+NISP,r0
	andl2	$0x3fffffff,r0		/* Mask out bit 30,31 */
	mtpr	r0,$KSP			/* init. KSP		*/


/*
 	Clear system data area all the way upto system code
 	this includes dump buffer,interrupt stack,spt,iomap,pcbs,user 
 	page tables, & io buffer area.
*/
3:	
	movab	esysdata,r7
	movab	_restart,r6
1:	clrl	(r6)
	ACBL(r7,$4,r6,1b)
/*
 	Initialize System Page Table
*/
5:
	clrl	r2
	movab	esysdata,r1	/* R1 = Last address in system data area */
	andl2	$0x3fffffff,r1	/* Mask out bit 30,31	*/
	shar	$PGSHIFT,r1,r1	/* Get page no. of last system data addr  */
				/* Map systm data area 1 to 1,kernel writable */
1:
	movl	r2,r11		/* Donot want to use orl3 */
	orl2	$PG_V|PG_KW,r11
	orl2	r11,_Sysmap[r2]
	aoblss	r1,r2,1b
/*
  	Map system text area 1 to 1, Kernel read/write.
	For this to work, the label _etext must exist at the end 
	of system code; Add in 4 more pages for data area used in C
*/
	movab	_edata + 4*(NBPG-1),r1	/* Map text+data 1 to 1; Kernel R/W */
/*	movab	_etext + 4*(NBPG-1), r1		*/
	andl2	$0x3fffffff,r1
	shar	$PGSHIFT,r1,r1
1:
	movl	r2,r11
	orl2	$PG_V|PG_KW,r11		/* Kernel Read/Write */
	orl2	r11,_Sysmap[r2]
	aoblss	r1,r2,1b
/*
 	Map from here (1st unused page) to page 512 :
 	   * invalid,no access, & virtual = physical
*/
	movl	r2,_unused	/* Save first unused physical page no	*/
	movl	$LSP+1,r1
1:	movl	r2,_Sysmap[r2]
	aoblss	r1,r2,1b

/*
 	Initialize SBR, SLR
 *Following are some useful addresses for user 0 (in case you want
 *to start user 0:
 *
 *	p0br = $_u0p0pt (limit = 256 max)
 *	p1br = $_u0p1pt ( same limit)
 *	p2br = $0xbfc02c00 (funny)
 *	p2lr = $0x000ffff0 (funny)
 *
 *for other users, add NBPG*3 to above except for p2 area
 *
 *	u0_user_sp = 0xbffffbfc
 *	u0_k_sp    = 0xbfffe3fc
 *	u0_s_sp    = 0xbfffcbfc
 *	u0_e_sp    = 0xbfffcbfc
 *
*/

sysrdy:
	mtpr	$(_Sysmap-0xc0000000),$SBR      /* Set SYSTEM BASE REG */
	mtpr	$_Syssize,$SLR

	.globl	_ready
_ready:
	mtpr	$64,$DCR	/* Enable fault */				
	movab	tfail,badrtn

	tstl	_ss1
	jeql	1f
	pushab	M0
	callf	$8,_writes	/* Print heading */

	cmpl	$0,_tno
	beql	t0
	cmpl	$1,_tno
	bneq	nxt1
t0:
	tstl	_ss1
	jeql	1f
	pushab	M1
	callf	$8,_writes
1:
	clrl	_Errmsg
	callf	$4,_prvreg 	/* Subtest1 : MTPR/MFPR from privilege regs */
	tstl	_lptest
	bneq	t0
nxt1:
	movab	(sp),r0
	andl2	$0x3fffffff,r0		/* Mask out bit 30,31 */
	mtpr	r0,$ISP			/* init. ISP */

	movl	$_usrstack+NISP,r0
	andl2	$0x3fffffff,r0		/* Mask out bit 30,31 */
	mtpr	r0,$USP			/* init. USP		*/

	movl	$_kerstack+NISP,r0
	andl2	$0x3fffffff,r0		/* Mask out bit 30,31 */
	mtpr	r0,$KSP			/* init. KSP		*/

	cmpl	$0,_tno
	beql	t1
	cmpl	$2,_tno
	bneq	nxt2
t1:
	tstl	_ss1
	jeql	1f
	pushab	M2
	callf	$8,_writes
1:
	clrl	_Errmsg
	callf	$4,_prvinstr	/* Subtest2 : Test ldpctx, svpctx, rei */
	tstl	_lptest
	bneq	t1
nxt2:
	cmpl	$0,_tno
	beql	t2
	cmpl	$3,_tno
	bneq	nxt3
t2:
	tstl	_ss1
	jeql	1f
	pushab	M3
	callf	$8,_writes
1:
	clrl	_Errmsg
	callf	$4,_be_evt	/* Subtest3 : Bus error interrupt	*/
	tstl	_lptest		/* again on this test */
	bneq	t2
nxt3:
	cmpl	$0,_tno
	beql	t3
	cmpl	$4,_tno
	bneq	nxt4
t3:
	tstl	_ss1
	jeql	1f
	pushab	M4
	callf	$8,_writes
1:
	clrl	_Errmsg
	callf	$4,_roprnd_evt  /* Subtest4  : Reserved operand fault 	*/
	tstl	_lptest
	bneq	t3
nxt4:
	cmpl	$0,_tno
	beql	t4
	cmpl	$5,_tno
	bneq	nxt5
t4:
	tstl	_ss1
	jeql	1f
	pushab	M5
	callf	$8,_writes
1:	clrl	_Errmsg
	callf	$4,_prv_evt	/* Subtest5  : Privilege inst. fault 	*/
	tstl	_lptest
	bneq	t4
nxt5:
	cmpl	$0,_tno
	beql	t5
	cmpl	$6,_tno
	bneq	nxt6
t5:
	tstl	_ss1
	jeql	1f
	pushab	M6
	callf	$8,_writes
1:	clrl	_Errmsg
	callf	$4,_align_evt	/* Subtest6  : Data alignment fault	*/
	tstl	_lptest
	bneq	t5
nxt6:
	cmpl	$0,_tno
	beql	t6
	cmpl	$7,_tno
	bneq	nxt7
t6:
	tstl	_ss1
	jeql	1f
	pushab	M7
	callf	$8,_writes
1:	clrl	_Errmsg
	callf	$4,_raddr_evt	/* Subtest7  : Reserved addr. mode fault */
	tstl	_lptest
	bneq	t6
nxt7:
	cmpl	$0,_tno
	beql	t7
	cmpl	$8,_tno
	bneq	nxt8
t7:
	tstl	_ss1
	jeql	1f
	pushab	M8
	callf	$8,_writes
1:	clrl	_Errmsg
	callf	$4,_rsv_evt	 /* Subtest8  : Reserved instuction fault */
	tstl	_lptest
	bneq	t7
nxt8:
# 6/14/85 brw	nxt9	/* SKIP THIS TEST because of backplane problem  */
	mtpr	$0x400,$DCR	/* Is there a floating point out there? */
	tstl	r1		/*   -R1 will be non zero if there is.  */
	bneq	1f		/* test the arithmetic fault w/ FPP's   */
	bitl	$0x10,_option	/* test the arithmetic fault anyway?    */
	beql	nxt9		/* -don't run it (backplane problem )*/
1:
	cmpl	$0,_tno
	beql	t8
	cmpl	$9,_tno
	bneq	nxt9
t8:
	tstl	_ss1
	jeql	1f
	pushab	M9
	callf	$8,_writes
1:	clrl	_Errmsg
	callf	$4,_arith_evt	 /* Subtest9  : Arithmetic fault	*/
	tstl	_lptest
	bneq	t8
nxt9:
	cmpl	$0,_tno
	beql	t9
	cmpl	$10,_tno
	bneq	nxt10
t9:
	tstl	_ss1
	jeql	1f
	pushab	M10
	callf	$8,_writes
1:	clrl	_Errmsg
	callf	$4,_bpt_evt	/* subtest10  : Break point instruction test */
	tstl	_lptest
	bneq	t9
nxt10:
	cmpl	$0,_tno
	beql	t10
	cmpl	$11,_tno
	bneq	nxt11
t10:
	tstl	_ss1
	jeql	1f
	pushab	M11
	callf	$8,_writes
1:	clrl	_Errmsg
	callf	$0,_ttrap_evt	/* Subtest11 : Trace trap test */
	tstl	_lptest
	bneq	t10
nxt11:
	cmpl	$0,_tno
	beql	t11
	cmpl	$12,_tno
	jneq	nxt12
t11:
	tstl	_ss1
	jeql	1f
	pushab	M12
	callf	$8,_writes
1:	clrl	_Errmsg
	callf	$4,_sftint_evt	/* Subtest12 : Software interrupt test */
	tstl	_lptest
	bneq	t11

/* 		GO TO VIRTUAL MODE
	Double map the kernel into user addresses : 
	This will enable system to go to virtual mode the 1st time !!
*/
nxt12:
	mtpr	$(_Sysmap-0xc0000000),$SBR      /* Set SYSTEM BASE REG */
	mtpr	$_Syssize,$SLR
	mtpr	$_Sysmap,$P0BR
	mtpr	$_Syssize,$P0LR
	mtpr	$1,$PADC
	mtpr	$1,$TBIA
	mtpr	$1,$MME
	jmp	*$vmode
vmode:
	mtpr	$0,$P0LR

	movl	$_intstack+NISP,r0
	mtpr	r0,$ISP			/* init. ISP,sp to virtual address */
	movl	r0,sp

/*
 	Set bit 30,31 of SCB vectors on.
 	Now we are running virtual in system space
*/
	movl	$NBPG/4,r1		/* One page for SCB */
	movab	_scb,r0
	andl2	$0xfffffc00,r0
1:	orl2	$0xc0000000,(r0)
	addl2	$4,r0
	decl	r1			/* Last one yet ? */
	bneq	1b

	movab	tfail,badrtn

	cmpl	$0,_tno
	beql	t12
	cmpl	$13,_tno
	bneq	nxt13
t12:
	tstl	_ss1
	jeql	1f
	pushab	M13
	callf	$8,_writes
1:	clrl	_Errmsg
	calls	$4,_kcall_evt		/* KCALL test */
	tstl	_lptest
	bneq	t12
nxt13:
	cmpl	$0,_tno
	beql	t13
	cmpl	$14,_tno
	bneq	nxt14
t13:
	tstl	_ss1
	jeql	1f
	pushab	M14
	callf	$8,_writes
1:	clrl	_Errmsg
	calls	$4,_trans_evt		/* Translation fault */
	tstl	_lptest
	bneq	t13
nxt14:
	cmpl	$0,_tno
	beql	t14
	cmpl	$15,_tno
	bneq	nxt15
t14:
	tstl	_ss1
	jeql	1f
	pushab	M15
	callf	$8,_writes
1:	clrl	_Errmsg
	calls	$4,_probe_evt		/* PROBER/PROBEW test */
	tstl	_lptest
	bneq	t14
nxt15:
	cmpl	$0,_tno
	beql	t15
	cmpl	$16,_tno
	bneq	nxt16
t15:
	tstl	_ss1
	jeql	1f
	pushab	M16
	callf	$8,_writes
1:	clrl	_Errmsg
	calls	$4,_ksnv_evt		/* Kernel stack not valid test */
	tstl	_lptest
	bneq	t15
nxt16:
	cmpl	$0,_tno
	beql	t16
	cmpl	$17,_tno
	bneq	nxt17
t16:
	tstl	_ss1
	jeql	1f
	pushab	M17
	callf	$8,_writes
1:	clrl	_Errmsg
	calls	$4,_mulevt		/* Multiple events test */
	tstl	_lptest
	bneq	t16
nxt17:
	incl	_cycle
	cmpl	$0,_tno
	jneq	last
	cmpl	$-1,_Cycle		/* If Cycle == -1; loop forever */
	beql	1f			/* and skip the last test */
	subl3	_cycle,_Cycle,r0
	cmpl	$0,r0			/* Only (ALL tests and last cycle) */
	jlss	last			/* turn on this test */
t17:
	pushl	$M18			/* Display msg */
	callf	$8,_writes
	pushl	$M19
	callf	$8,_writes
	pushl	$M20
	callf	$8,_writes
	clrl	_Errmsg
	calls	$4,_isnv_evt     	/* Interrupt stack not valid test */
					/* NO RETURN FROM THIS TEST */
last:
	cmpl	$-1,_Cycle		/* If Cycle == -1; loop forever */
	beql	1f

	cmpl	_cycle,_Cycle
	bgeq	passed

1:	mfpr	$SBR,r0
	mfpr	$SLR,r1
	orl2	$0xc0000000,r0
	mtpr	r0,$P0BR
	mtpr	r1,$P0LR		/* Map user to system space */
	jmp	extest

passed:
	tstl	_ss1
	jeql	1f
	pushab	M21		/* Cycle count */
	callf	$4+4,_writes
	pushl	_Cycle
	callf	$4+4,_writeh
	pushab	M22
	callf	$4+4,_writes
1:
	movl	$0xcafebabe,r0
	halt
	.space	20

	.globl  tfail
tfail:					/* enter here when test fail */
	storer	$0x1fff,Gregs		/* save registers */
	tstl	_Emsg			/* If set then donot print message */
	beql	nomsg
	movl	_Errmsg,r0
	beql	1f
	pushl	r0			/* Print errror message if any */
	callf	$8,_writes
1:
	pushab	Gregs
	callf	$8,_error		/* Dump general registers */
nomsg:
	loadr	$0x1fff,Gregs		/* load registers */
	halt


	.align	2
	.globl	_Hardclk
_Hardclk:
	incl	_clk_cnt
	rei


	.data	1
M0:
	.ascii	"\n\t** The Event Test **\12\0"
M1:
 	.ascii	"** Subtest1  : MTPR/MFPR from privilege registers \12\0"
M2:
	.ascii	"** Subtest2  : Test LDPCTX, SVPCTX, REI \12\0"
M3:
	.ascii	"** Subtest3  : Bus error interrupt	\12\0"
M4:
	.ascii	"** Subtest4  : Reserved operand fault\12\0"
M5:
	.ascii	"** Subtest5  : Privilege inst. fault \12\0"
M6:
	.ascii	"** Subtest6  : Data alignment fault	\12\0"
M7:
	.ascii	"** Subtest7  : Reserved addr. mode fault \12\0"
M8:
	.ascii	"** Subtest8  : Reserved instruction fault \12\0"
M9:
	.ascii	"** Subtest9  : Arithmetic fault\12\0"
M10:
	.ascii	"** Subtest10 : Break point instruction test \12\0"
M11:
	.ascii	"** Subtest11 : Trace trap test \12\0"
M12:
	.ascii	"** Subtest12 : Software interrupt test \12\0"
M13:
	.ascii	"** Subtest13 : KCALL\12\0"
M14:
	.ascii	"** Subtest14 : Translation fault\12\0"
M15:
	.ascii	"** Subtest15 : PROBER/PROBEW\12\0"
M16:
	.ascii	"** Subtest16 : Kernel stack not valid test\12\0"
M17:
	.ascii	"** Subtest17 : Mutiple events test\12\0"
M18:
	.ascii	"** Subtest18 : Interrupt stack not valid test.\12\0"
M19:
	.ascii	"If TAHOE get a machine check after you see this message\12\0"
M20:
	.ascii	" then The EVENT test passed !\12\0"
	
M21:	.ascii	"\n** Cycle count : \0"
M22:	.ascii	"\n\0"

	.globl	err1
err1:
	.ascii	"\nRegisters : \0"
	.globl	err2
err2:
	.ascii	"  \0"
	.globl	err3
err3:
	.ascii	"\n            \0"
	.globl	err4
err4:
	.ascii	"\n\0"

	.globl	e_type
e_type:
	.ascii	"\n** Unexpected exception type : \0"

	.globl	par_0
par_0:
	.ascii	"** Par 0 : \0"

	.globl	par_1
par_1:
	.ascii	"** Par 1 : \0"

	.globl	par_pc
par_pc:
	.ascii	"** PC    : \0"

	.globl	par_psl
par_psl:
	.ascii	"** PSL   : \0"

	.align 	2
Gregs:	.space	60	/* Space to save general registers */
	.align	2
	.globl	_Errmsg
_Errmsg:
	.long	0	/* Pointer to error message */
	.globl	_ss1
_ss1:	.long	0	/* If 1 then donot print heading messages */
	.globl	_tno
_tno:	.long	0	/* If -1 run ALL tests, else run test "tno" */
	.globl	_Cycle
_Cycle:	.long	0	/* Cycle count */
	.globl	_cycle
_cycle:	.long	0	/* Cycle count */
	.globl	_option
_option:
	.long	0
	.globl	_lptest
_lptest:
	.long	0	/* Loop on test specified by tno */
	.globl	_CPer
_CPer:
	.long	0
	.globl	_Emsg
_Emsg:
	.long	1


unix.superglobalmegacorp.com

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