xref: /csrg-svn/sys/tahoe/stand/machdep.c (revision 45796)
1*45796Sbostic /*	machdep.c	1.5	90/12/16	*/
225869Ssam 
3*45796Sbostic #include "../tahoe/mem.h"
4*45796Sbostic #include "../include/mtpr.h"
5*45796Sbostic #include "../tahoe/SYS.h"
625869Ssam 
730309Skarels 	.set	_scb, 0x0
825869Ssam 	.set	HIGH, 0x1f	# mask for total disable
925869Ssam 	.set	BERVEC, 0x80	# offset into scb of the bus error vector
1025869Ssam 	.set	RESTVEC, 0x8	# offset into scb of the restart vector
1125869Ssam 
1225869Ssam ENTRY(mtpr, 0)
1325869Ssam 	mtpr	8(fp),4(fp)
1425869Ssam 	ret
1525869Ssam 
1625869Ssam ENTRY(mfpr, 0)
1725869Ssam 	mfpr	4(fp),r0
1825869Ssam 	ret
1925869Ssam 
2025869Ssam ENTRY(bcopy, R2|R1|R0)
2125869Ssam 	movl	4(fp),r0
2225869Ssam 	movl	8(fp),r1
2325869Ssam 	movl	12(fp),r2
2425869Ssam 	movblk
2525869Ssam 	ret
2625869Ssam 
2725869Ssam /*
2825869Ssam  * badaddr(addr, len)
2925869Ssam  *	see if access addr with a len type instruction causes a machine check
3025869Ssam  *	len is length of access (1=byte, 2=short, 4=long)
3125869Ssam  *	r0 = 0 means good(exists); r0 =1 means does not exist.
3225869Ssam  */
3325869Ssam ENTRY(badaddr, R5|R4|R3|R2|R1)
3425869Ssam 	mfpr	$IPL,r1
3525869Ssam 	mtpr	$HIGH,$IPL
3625869Ssam 	mfpr	$SCBB,r5
3725869Ssam 	mtpr	$0,$SCBB
3825869Ssam 	movl	*$BERVEC,r2
3925869Ssam 	movl	4(fp),r3
4025869Ssam 	movl	8(fp),r4
4125869Ssam 	movab	9f,*$BERVEC
4225869Ssam 	bbc	$0,r4,1f; tstb	(r3)
4325869Ssam 1:	bbc	$1,r4,1f; tstw	(r3)
4425869Ssam 1:	bbc	$2,r4,1f; tstl	(r3)
4525869Ssam 1:	clrl	r0			# made it w/o machine checks
4625869Ssam 2:	movl	r2,*$BERVEC
4725869Ssam 	mtpr	r1,$IPL
4825869Ssam 	mtpr	r5,$SCBB
4925869Ssam 	ret
5025869Ssam 
5132556Sbostic /*
5232556Sbostic  * wbadaddr(addr, len, value)
5332556Sbostic  *	see if write of value to addr with a len type instruction causes
5432556Sbostic  *	a machine check
5532556Sbostic  *	len is length of access (1=byte, 2=short, 4=long)
5632556Sbostic  *	r0 = 0 means good(exists); r0 =1 means does not exist.
5732556Sbostic  */
5832556Sbostic ENTRY(wbadaddr, R5|R4|R3|R2|R1)
5932556Sbostic 	mfpr	$IPL,r1
6032556Sbostic 	mtpr	$HIGH,$IPL
6132556Sbostic 	mfpr	$SCBB,r5
6232556Sbostic 	mtpr	$0,$SCBB
6332556Sbostic 	movl	*$BERVEC,r2
6432556Sbostic 	movl	4(fp),r3
6532556Sbostic 	movl	8(fp),r4
6632556Sbostic 	movab	9f,*$BERVEC
6732556Sbostic 	bbc	$0,r4,1f; movb	15(fp), (r3)
6832556Sbostic 1:	bbc	$1,r4,1f; movw	14(fp), (r3)
6932556Sbostic 1:	bbc	$2,r4,1f; movl	12(fp), (r3)
7032556Sbostic 1:	clrl	r0			# made it w/o machine checks
7132556Sbostic 2:	movl	r2,*$BERVEC
7232556Sbostic 	mtpr	r1,$IPL
7332556Sbostic 	mtpr	r5,$SCBB
7432556Sbostic 	ret
7532556Sbostic 
7625869Ssam 	.align	2
7725869Ssam 9:			# Here we catch buss error (if it comes)
7825869Ssam 	andl3	4(sp),$ERRCD,r0
7925869Ssam 	cmpl	r0,$APE
8025869Ssam 	jneq	1f
8125869Ssam 	halt			# Address parity error !!!
8225869Ssam 1:	cmpl	r0,$VBE
8325869Ssam 	jneq	1f
8425869Ssam 	halt			# Versabus error
8525869Ssam 1:
8625869Ssam 	movl	$1,r0		# Anything else = bad address
8725869Ssam 	movab	8(sp),sp	# discard buss error trash
8825869Ssam 	movab	2b,(sp)		# new program counter on stack.
8925869Ssam 	rei
9025869Ssam 
9125869Ssam ENTRY(movow, 0)
9225869Ssam 	movow	10(fp),*4(fp)
9325869Ssam 	ret
9425869Ssam 
9525869Ssam ENTRY(movob, 0)
9630309Skarels 	movob	11(fp),*4(fp)
9725869Ssam 	ret
98