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


 #
 #	*probe read & write events test (virtual)
 #
 #	R12 = Which space is probing
 #	      0 - Probe in P0 space
 #	      1 - Probe in P2 space
 #	R0  = PC of Probe instruction that failed
 #	R5  = PSL after Probe
 #

	.set   LAST_VPGNO,0xfffff
	.set   TEST_P2PTE,LAST_VPGNO
	.set   P2ADDR,0x80000000
	.set   P0ADDR,0
	.set   KERNEL,0
	.set   USER,1
	.set   READ,1
	.set   WRITE,2

	.globl	_probe_evt
_probe_evt:
	.word	0x1fff

 #	Set up P0PT, P2PT 
 #
 #	u0p0pt :
 #	virtual page 0  = Valid, UW, physical page of _iob0
 #	virtual page 1  = NO_ACCESS, physical page of _iob1 
 #
 #	u0p2pt :
 #	virtual page 0xffffe = Valid, UW, physical pages _iob4
 #	virtual page 0xfffff = NO_ACCESS, physical pages _iob5
 #
 #
	movab	_u0p2pt,r10		/* Virtual address of P2PT */
	andl3	$0x3fffffff,$_iob4,r9	/* Physical address of _iob4 */
	shrl	$PGSHIFT,r9,r9		/* Physical page no of _iob4 */
	orl3	$PG_V|PG_UW,r9,(r10)	/* Valid, UW */
	andl3	$0x3fffffff,$_iob5,r9	/* Physical page no. of _iob5 */
	shrl	$PGSHIFT,r9,r9		/* Physical page no of _iob5 */
	orl3	$PG_NOACC,r9,4(r10)	/* No access */
	subl3   $((LAST_VPGNO-1) << 2),r10,r11
					/* Address to initialize P2BR */

	clrl	r2			/* Set up P0PT */
	andl3	$0x3fffffff,$_iob0,r3	/* Physical address of _iob0 */
	shrl	$PGSHIFT,r3,r3		/* Physical page no of _iob0 */
	orl3	$PG_V|PG_UW,r3,_u0p0pt[r2]
	incl	r2
	andl3	$0x3fffffff,$_iob1,r3	/* Physical address of _iob1 */
	shrl	$PGSHIFT,r3,r3		/* Physical page no of _iob1 */
	orl3	$PG_NOACC,r3,_u0p0pt[r2]

	andl3	$_pcb0,$0x3fffffff,r1
	mtpr	r1,$PCBB
	mtpr	$((LAST_VPGNO<<PGSHIFT)|0x400|P2ADDR),$KSP
	mtpr	$0,$TBIA
	
	mtpr	$_u0p0pt,$P0BR
	mtpr	$4,$P0LR		/* Four PTEs in P0BR  */
	mtpr	r11,$P2BR
	mtpr	$0xffffd,$P2LR		/* Two PTEs in P2BR  */
	calls	$4,probe_tst		/* Do test ... */
	ret				/* Done ... */


 #
 #	Routine to do PROBE test
 #
probe_tst:
	.word	0x1ff

	movl	$1,r12			/* r12 = 1 ; PROBE in P2 space	*/
					/* r12 = 0 ; PROBE in P0 space	*/
	movl	$(LAST_VPGNO << PGSHIFT)|P2ADDR,r2
				/* R2 : base address of NO_ACCESS page */
	movl	$((LAST_VPGNO-1) << PGSHIFT)|P2ADDR,r4
				/* R4 : base address of accessible page */
tstart:
# 	PROBE read in User mode
#
	movl	$USER,r1		/* R1 : Mode used in PROBE	*/
	movl	$NBPG-4,r3		/* R3 : PROBE less than 1 page */
	movl	$NBPG+0xf0,r6		/* R6 : PROBE more than 1 page */
	movl	$READ,r7		/* R7 : type of access		*/

	movab	_prb1,r0		/* R0 : PC of probe instruction	*/
	movl	r2,Cache
	bicpsw	$Z
_prb1:
	prober	r1,*Cache,r3	/* Z flag should be 1 : not accessible  */
	beql	1f
error0:	movpsl	r5			/* R5 : PSL after PROBE		*/
	jmp	*badrtn			/* Error in Z flag 		*/
	
1:	mtpr	$0,$TBIA
	movab	_prb2,r0
	movl	r4,Cache
	bispsw	$Z
_prb2:
	prober	$1,*Cache,r3		/* Z flag should be 0 : accessible  */
	bneq	1f
	brw 	error0

1:	mtpr	$0,$TBIA
	movab	_prb3,r0
	movl	r6,Cache
	bicpsw	$Z
_prb3:
	prober	r1,(r4),Cache	/* Z flag should be 1 : not accessible  */
	beql	1f
	brw 	error0

/*	PROBE read in Kernel mode		*/

1:	mtpr	$0,$TBIA
	movb	$KERNEL,Cache
	movab	_prb4,r0
	bispsw	$Z
_prb4:
	prober	Cache,(r4),r3		/* Z flag should be 0 : accessible  */
	bneq	1f
	brw 	error0

1:	mtpr	$0,$TBIA
	movab	_prb5,r0
	bicpsw	$Z
_prb5:
	prober	r1,(r2),r3	/* Z flag should be 1 : not accessible  */
	beql	1f
	brw 	error0

1:	mtpr	$0,$TBIA
	movab	_prb6,r0
	bicpsw	$Z
_prb6:
	prober	$0,(r4),r6	/* Z flag should be 1 : not accessible  */
	beql	1f
	brw 	error0


/*	PROBE write in User mode	*/

1:	mtpr	$0,$TBIA
	movl	$USER,r1		/* R1 : Mode used in PROBE	*/
	movl	$WRITE,r7		/* R7 : type of access		*/

	movab	_prb7,r0
	movl	r2,Cache
	bicpsw	$Z
_prb7:
	probew	r1,*Cache,r3	/* Z flag should be 1 : not accessible  */
	beql	1f
error1:
	movpsl	r5			/* R5 : PSL after PROBE		*/
	jmp	*badrtn			/* Error in Z flag 		*/
1:
	mtpr	$0,$TBIA
	movab	_prb8,r0
	movl	r4,Cache
	bispsw	$Z
_prb8:
	probew	$1,*Cache,r3		/* Z flag should be 0 : accessible  */
	mtpr	$0,$TBIA
	bneq	1f
	brw 	error1

1:	mtpr	$0,$TBIA
	movab	_prb9,r0
	movl	r6,Cache
	bicpsw	$Z
_prb9:
	probew	r1,(r4),Cache	/* Z flag should be 1 : not accessible  */
	beql	1f
	brw 	error1

/*	PROBE write in Kernel mode		*/

1:	mtpr	$0,$TBIA
	movb	$KERNEL,Cache
	movab	_prb10,r0
	bispsw	$Z
_prb10:
	probew	Cache,(r4),r3		/* Z flag should be 0 : accessible  */
	bneq	1f
	brw 	error0

1:	mtpr	$0,$TBIA
	movab	_prb11,r0
	bicpsw	$Z
_prb11:
	probew	$0,(r2),r3	/* Z flag should be 1 : not accessible  */
	beql	1f
	brw 	error0

1:	mtpr	$0,$TBIA
	movab	_prb12,r0
	bicpsw	$Z
_prb12:
	probew	r1,(r4),r6	/* Z flag should be 1 : not accessible  */
	beql	1f
	brw 	error0

1:	mtpr	$0,$TBIA
	decl	r12		/* Decrement loop count */
	blss	endt
	
	movl	$(1 << PGSHIFT)|P0ADDR,r2
				/* R2 : base address of NO_ACCESS page */
	movl	$(0 << PGSHIFT)|P0ADDR,r4
				/* R4 : base address of accessible page */ 
	jmp	tstart			/* Test again but in P0 space */
endt:
	clrl	r0
	ret

	.align	2
Cache:
	.long	0

unix.superglobalmegacorp.com

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