File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / event / bpt_evt.s
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (6 years, 11 months ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b


 #
 #	Break point instruction event test
 #
 #	R0 = error code
 #	     1 - Break point instruction did not generate exception
 #		 R1 : address of break point instruction 
 #	     2 - Error in PC pushed on the stack
 #		 R1 : actual PC; R2 = expected PC 
 #	     3 - PSL is not pushed on the stack
 #	     4 - Too many parameters pushed on the stack

	.globl	_bpt_evt
_bpt_evt:
	.word	0x1fff
	mtpr	$31,$IPL
	movab	(sp),_savvec0		/* Save sp			*/
	mtpr	_savvec0,$ISP
	movl	_scb+BPTVEC,_savvec2	/* Save vector of Break point	*/
	movab	vecvec7,_scb+BPTVEC	/* Set new vector		*/
	movl	$-1,-(sp)		/* Set marker on SP to be checked */
					/*  after taken exception	*/
	movab	_pcb0,r1		/* Partially set PCB0		*/
	mtpr	r1,$PCBB
	movab	(sp),_pcb0		/*ksp in pcb0			*/
	movab	(sp),_pcb0+4		/*usp in pcb0			*/

	movpsl	r1			/*if not kernel mode, then force*/
	bitl	$0x01000000,r1		/*kernel mode			*/
	beql	1f
	movl	_scb+PINSTVEC,_savvec3
	movab	forckmd,_scb+PINSTVEC
	halt				/*halt in USER mode to force	*/
					/*K mode in psl			*/
	.align	2
forckmd:
	addl2	$8,sp			/*get rid of trash on the stack	*/
	movl	_savvec3,_scb+PINSTVEC	/*restore vector		*/

1:	movab	eee,r6		/* R6 = return address from event handler*/
	movab	epc1,r5		/* R5 = expected PC after taken break   */
epc1:	bpt			/* break point exception		*/
	movl	$1,r0
	movl	r5,r1
	jmp	*badrtn		/* Error- BPT did not generate exception*/

	.align	2		/* Break point exception handler	*/
vecvec7:
	movl	(sp)+,r1	/*pop pc				*/
	movl	r5,r2		/*r5 = expected pc			*/
	cmpl	r1,r2
	beql	1f
	movl	$2,r0		/*pc saved on stack not equal to exp	*/
	jmp	*badrtn

1:
	movl	(sp)+,r1	/*pop psl				*/
	cmpl	$-1,r1		/*if -1, then it is not psl		*/
	bneq	1f
	movl	$3,r0
	jmp	*badrtn		/* error - psl not saved on the stack	*/
1:
	cmpl	$-1,(sp)	/*sp now should be pointing at the marker*/
	beql	1f
	movl	$4,r0
	jmp	*badrtn		/*too many longwords pushed on the stack */
1:
	movl	r1,-(sp)
	movl	r6,-(sp)	/*r6 must have been loaded previously	*/
	rei
	halt			/*should never come here		*/

/*	Restore original state of SP, PSL & vectors	*/
eee:
	mtpr	$31,$IPL
	movl	_savvec0,sp
	movl	_savvec2,_scb+BPTVEC
	ret


unix.superglobalmegacorp.com

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