xref: /csrg-svn/sys/tahoe/stand/machdep.c (revision 32556)
1*32556Sbostic /*	machdep.c	1.3	87/10/27	*/
225869Ssam 
325869Ssam #include "../tahoe/mem.h"
425869Ssam #include "../tahoe/mtpr.h"
525869Ssam #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 
51*32556Sbostic /*
52*32556Sbostic  * wbadaddr(addr, len, value)
53*32556Sbostic  *	see if write of value to addr with a len type instruction causes
54*32556Sbostic  *	a machine check
55*32556Sbostic  *	len is length of access (1=byte, 2=short, 4=long)
56*32556Sbostic  *	r0 = 0 means good(exists); r0 =1 means does not exist.
57*32556Sbostic  */
58*32556Sbostic ENTRY(wbadaddr, R5|R4|R3|R2|R1)
59*32556Sbostic 	mfpr	$IPL,r1
60*32556Sbostic 	mtpr	$HIGH,$IPL
61*32556Sbostic 	mfpr	$SCBB,r5
62*32556Sbostic 	mtpr	$0,$SCBB
63*32556Sbostic 	movl	*$BERVEC,r2
64*32556Sbostic 	movl	4(fp),r3
65*32556Sbostic 	movl	8(fp),r4
66*32556Sbostic 	movab	9f,*$BERVEC
67*32556Sbostic 	bbc	$0,r4,1f; movb	15(fp), (r3)
68*32556Sbostic 1:	bbc	$1,r4,1f; movw	14(fp), (r3)
69*32556Sbostic 1:	bbc	$2,r4,1f; movl	12(fp), (r3)
70*32556Sbostic 1:	clrl	r0			# made it w/o machine checks
71*32556Sbostic 2:	movl	r2,*$BERVEC
72*32556Sbostic 	mtpr	r1,$IPL
73*32556Sbostic 	mtpr	r5,$SCBB
74*32556Sbostic 	ret
75*32556Sbostic 
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