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

 #
 #	reserved instructions event test
 #	includes unimplemented instructions
 #
 #	R7 = PC that failed
 #	R0 = error code
 #	     1 - expected reserved inst. fault didnot happen
 #		 R1 = opcode that should cause fault
 #	     2 - Error in PC pushed on the stack
 #		 R1 = actual,  R2 = expected
 #	     3 - PSL is not pushed on the stack
 #	     4 - Too many parameters pushed on the stack

	.globl	_rsv_evt
_rsv_evt:
	.word	0x1fff
	mtpr	$31,$IPL		/* Set IPL to HIGH		*/
	movab	(sp),_savvec0		/* Save current SP		*/
	mtpr	_savvec0,$ISP		/* Set ISP to current SP	*/
	movl	_scb+PINSTVEC,_savvec2	/* Save priv. inst fault vector	*/
	movab	vecvec5,_scb+PINSTVEC	/* Set new vector		*/
	movl	$-1,-(sp)		/* Push marker on stack		*/
	movab	_pcb0,r1
	mtpr	r1,$PCBB		/* Set PCBB to PCB_U0		*/
	mfpr	$KSP,_savvec9		/* Save kernal stack pointer	*/
	mfpr	$USP,_savveca		/* Save user stack pointer	*/
	movab	rtable,r5		/* R5 = addr reserved operand table */
	movb	(r5),resinstr		/* Store reserved opcode	*/
	mtpr	$0xff,$PACC		/* Purge all code cache		*/
	movpsl	r6			/* r6 = saved psl		*/
	movab	resinstr,r7		/* R7 = PC that failed */

resinstr:
	.byte	0xff	/* This where reserved opcode is stored & executed */
	movl	$1,r0
	movb	resinstr,r1		/*r1 = reserved opcode		*/
	andl2	$0xff,r1
	jmp	*badrtn			/* Error - no reserved opcode fault */
#
#	***************************************
#	Event handler for privilege inst. fault
#	***************************************
#	
	.align	2
vecvec5:
	movl	(sp)+,r1	/* R1 = actual PC pop from stack	*/
	movab	resinstr,r2	/* R2 = expected PC			*/
	cmpl	r1,r2
	beql	1f
	movl	$2,r0		/* Error : wrong PC on stack		*/
	jmp	*badrtn		/* R1 = actual & R2 = expected		*/
#
1:
	movl	(sp)+,r1	/* R1 = actual PSL pop from stack	*/
	movl	r6,r2		/* r2 = expected psl			*/
	cmpl	r2,r1
	beql	1f
	movl	$3,r0		/* Error : PSL is not pushed on stack	*/
	jmp	*badrtn
#
1:
	cmpl	$-1,(sp)	/* SP should point at the marker 	*/
	beql	1f
	movl	$4,r0		/* Too many parameters pushed on SP 	*/
	jmp	*badrtn
#
1:
	incb	r5		/* Get next reserved opcode		*/
	movb	(r5),resinstr	/* Store it there to be executed	*/
	cmpb	$0,resinstr	/* Is this the last opcode ?		*/
	beql	1f
	mtpr	$0xff,$23	/* Purge all code cache			*/
	movpsl	r6
	brw	resinstr	/* Branch back and do again		*/
1:
	
	movl	_savvec0,sp
	mtpr	_savvec0,$ISP		/* Restore interrupt stack pointer */
	mtpr	_savvec9,$KSP		/* Restore kernal stack pointer	*/
	mtpr	_savveca,$USP		/* Restore user stack pointer	*/
	movl	_savvec2,_scb+PINSTVEC	/* Restore original vector	*/
	ret				/* Return			*/
#
#
#	WARNING : If reserved opcodes change, so do the following table
	.align 	2
rtable:
#	.byte	0x01		/* Now is EHALT : 5/13/83	*/
	.byte	0x02
	.byte	0x03
	.byte	0x04
#	.byte	0x05		/* Now is SINF : 20/Feb/85 	*/
#	.byte	0x06		/* Now is LDF  : 20/Feb/85 	*/
#	.byte	0x07		/* Now is LDD  : 20/Feb/85 	*/
	.byte	0x12
	.byte	0x14
#	.byte	0x15		/* Now is COSF : 20/Feb/85	*/
#	.byte	0x16		/* Now is LNF  : 20/Feb/85	*/
#	.byte	0x17		/* Now is LND  : 20/Feb/85	*/
	.byte	0x22
	.byte	0x24
#	.byte	0x25		/* Now is ATANF : 20/Feb/85	*/
#	.byte	0x26		/* Now is STF   : 20/Feb/85	*/
#	.byte	0x27		/* Now is STD   : 20/Feb/85	*/
	.byte	0x32
	.byte	0x34
#	.byte	0x35		/* Now is LOGF  : 20/Feb/85	*/
#	.byte	0x36		/* Now is CMPF  : 20/Feb/85	*/
#	.byte	0x37		/* Now is CMPD  : 20/Feb/85	*/
	.byte	0x42
	.byte	0x43
	.byte	0x44
#	.byte	0x45		/* Now is SQRTF : 20/Feb/85	*/
#	.byte	0x46		/* Now is CMPF2 : 20/Feb/85	*/
#	.byte	0x47		/* Now is CMPD2 : 20/Feb/85	*/
	.byte	0x4f
	.byte	0x52
	.byte	0x53
	.byte	0x54
#	.byte	0x55		/* Now is EXPF  : 20/Feb/85	*/
#	.byte	0x56		/* Now is TSTF  : 20/Feb/85	*/
#	.byte	0x57		/* Now is TSTD  : 20/Feb/85	*/
	.byte	0x62
	.byte	0x63
	.byte	0x64
	.byte	0x65
	.byte	0x66
#	.byte	0x67		/* Now is PUSHD : 20/Feb/85	*/
	.byte	0x72
	.byte	0x73
	.byte	0x74
	.byte	0x75
#	.byte	0x76		/* Now is CVLF  : 20/Feb/85	*/
#	.byte	0x77		/* Now is CVLD  : 20/Feb/85	*/
	.byte	0x83
	.byte	0x84
	.byte	0x85
#	.byte	0x86		/* Now is CVFL  : 20/Feb/85	*/
#	.byte	0x87		/* Now is CVDL  : 20/Feb/85	*/
	.byte	0x8f
	.byte	0x93
	.byte	0x94
	.byte	0x95
	.byte	0x96
#	.byte	0x97		/* Now is LDFD  : 20/Feb/85	*/
	.byte	0x9f
	.byte	0xa2
	.byte	0xa3
	.byte	0xa4
	.byte	0xa5
#	.byte	0xa6		/* Now is CVDF  : 20/Feb/85	*/
	.byte	0xa7
	.byte	0xaf
	.byte	0xb2
	.byte	0xb3
	.byte	0xb4
	.byte	0xb5
#	.byte	0xb6		/* Now is NEGF  : 20/Feb/85	*/
#	.byte	0xb7		/* Now is NEGD  : 20/Feb/85	*/
	.byte	0xc4
	.byte	0xc5
#	.byte	0xc6		/* Now is ADDF  : 20/Feb/85	*/
#	.byte	0xc7		/* Now is ADDD  : 20/Feb/85	*/
#	.byte	0xcb		/* Now is MOVOW : 6/14/83	*/
	.byte	0xd3
	.byte	0xd4
	.byte	0xd5
#	.byte	0xd6		/* Now is SUBF  : 20/Feb/85	*/
#	.byte	0xd7		/* Now is SUBD  : 20/Feb/85	*/
	.byte	0xde
	.byte	0xdf
	.byte	0xe2
	.byte	0xe3
	.byte	0xe4
	.byte	0xe5
#	.byte	0xe6		/* Now is MULF  : 20/Feb/85	*/
#	.byte	0xe7		/* Now is MULD  : 20/Feb/85	*/
	.byte	0xef
	.byte	0xf2
	.byte	0xf3
	.byte	0xf4
	.byte	0xf5
#	.byte	0xf6		/* Now is DIVF  : 20/Feb/85	*/
#	.byte	0xf7		/* Now is DIVD  : 20/Feb/85	*/
	.byte	0xfa
	.byte	0xff
	.byte	0x61		/* 8/23 */
	.byte	0x0f		/* 8/23 */
#	.byte	0x6e		/* 12/7 divl2u */
#	.byte	0x7e		/* 12/7 divl3u */
#	.byte	0x68		/* 12/7 Modl2 */
#	.byte	0x6a		/* 12/7 Modl2u */
#	.byte	0x78		/* 12/7 Modl3 */
#	.byte	0x7a		/* 12/7 Modl3u */
	.byte	0x00

unix.superglobalmegacorp.com

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