xref: /csrg-svn/sys/tahoe/stand/machdep.c (revision 49431)
1*49431Sbostic /*-
2*49431Sbostic  * Copyright (c) 1991 The Regents of the University of California.
3*49431Sbostic  * All rights reserved.
4*49431Sbostic  *
5*49431Sbostic  * This code is derived from software contributed to Berkeley by
6*49431Sbostic  * Computer Consoles Inc.
7*49431Sbostic  *
8*49431Sbostic  * %sccs.include.proprietary.c%
9*49431Sbostic  *
10*49431Sbostic  *	@(#)machdep.c	1.6 (Berkeley) 05/08/91
11*49431Sbostic  */
1225869Ssam 
1345796Sbostic #include "../tahoe/mem.h"
1445796Sbostic #include "../include/mtpr.h"
1545796Sbostic #include "../tahoe/SYS.h"
1625869Ssam 
1730309Skarels 	.set	_scb, 0x0
1825869Ssam 	.set	HIGH, 0x1f	# mask for total disable
1925869Ssam 	.set	BERVEC, 0x80	# offset into scb of the bus error vector
2025869Ssam 	.set	RESTVEC, 0x8	# offset into scb of the restart vector
2125869Ssam 
2225869Ssam ENTRY(mtpr, 0)
2325869Ssam 	mtpr	8(fp),4(fp)
2425869Ssam 	ret
2525869Ssam 
2625869Ssam ENTRY(mfpr, 0)
2725869Ssam 	mfpr	4(fp),r0
2825869Ssam 	ret
2925869Ssam 
3025869Ssam ENTRY(bcopy, R2|R1|R0)
3125869Ssam 	movl	4(fp),r0
3225869Ssam 	movl	8(fp),r1
3325869Ssam 	movl	12(fp),r2
3425869Ssam 	movblk
3525869Ssam 	ret
3625869Ssam 
3725869Ssam /*
3825869Ssam  * badaddr(addr, len)
3925869Ssam  *	see if access addr with a len type instruction causes a machine check
4025869Ssam  *	len is length of access (1=byte, 2=short, 4=long)
4125869Ssam  *	r0 = 0 means good(exists); r0 =1 means does not exist.
4225869Ssam  */
4325869Ssam ENTRY(badaddr, R5|R4|R3|R2|R1)
4425869Ssam 	mfpr	$IPL,r1
4525869Ssam 	mtpr	$HIGH,$IPL
4625869Ssam 	mfpr	$SCBB,r5
4725869Ssam 	mtpr	$0,$SCBB
4825869Ssam 	movl	*$BERVEC,r2
4925869Ssam 	movl	4(fp),r3
5025869Ssam 	movl	8(fp),r4
5125869Ssam 	movab	9f,*$BERVEC
5225869Ssam 	bbc	$0,r4,1f; tstb	(r3)
5325869Ssam 1:	bbc	$1,r4,1f; tstw	(r3)
5425869Ssam 1:	bbc	$2,r4,1f; tstl	(r3)
5525869Ssam 1:	clrl	r0			# made it w/o machine checks
5625869Ssam 2:	movl	r2,*$BERVEC
5725869Ssam 	mtpr	r1,$IPL
5825869Ssam 	mtpr	r5,$SCBB
5925869Ssam 	ret
6025869Ssam 
6132556Sbostic /*
6232556Sbostic  * wbadaddr(addr, len, value)
6332556Sbostic  *	see if write of value to addr with a len type instruction causes
6432556Sbostic  *	a machine check
6532556Sbostic  *	len is length of access (1=byte, 2=short, 4=long)
6632556Sbostic  *	r0 = 0 means good(exists); r0 =1 means does not exist.
6732556Sbostic  */
6832556Sbostic ENTRY(wbadaddr, R5|R4|R3|R2|R1)
6932556Sbostic 	mfpr	$IPL,r1
7032556Sbostic 	mtpr	$HIGH,$IPL
7132556Sbostic 	mfpr	$SCBB,r5
7232556Sbostic 	mtpr	$0,$SCBB
7332556Sbostic 	movl	*$BERVEC,r2
7432556Sbostic 	movl	4(fp),r3
7532556Sbostic 	movl	8(fp),r4
7632556Sbostic 	movab	9f,*$BERVEC
7732556Sbostic 	bbc	$0,r4,1f; movb	15(fp), (r3)
7832556Sbostic 1:	bbc	$1,r4,1f; movw	14(fp), (r3)
7932556Sbostic 1:	bbc	$2,r4,1f; movl	12(fp), (r3)
8032556Sbostic 1:	clrl	r0			# made it w/o machine checks
8132556Sbostic 2:	movl	r2,*$BERVEC
8232556Sbostic 	mtpr	r1,$IPL
8332556Sbostic 	mtpr	r5,$SCBB
8432556Sbostic 	ret
8532556Sbostic 
8625869Ssam 	.align	2
8725869Ssam 9:			# Here we catch buss error (if it comes)
8825869Ssam 	andl3	4(sp),$ERRCD,r0
8925869Ssam 	cmpl	r0,$APE
9025869Ssam 	jneq	1f
9125869Ssam 	halt			# Address parity error !!!
9225869Ssam 1:	cmpl	r0,$VBE
9325869Ssam 	jneq	1f
9425869Ssam 	halt			# Versabus error
9525869Ssam 1:
9625869Ssam 	movl	$1,r0		# Anything else = bad address
9725869Ssam 	movab	8(sp),sp	# discard buss error trash
9825869Ssam 	movab	2b,(sp)		# new program counter on stack.
9925869Ssam 	rei
10025869Ssam 
10125869Ssam ENTRY(movow, 0)
10225869Ssam 	movow	10(fp),*4(fp)
10325869Ssam 	ret
10425869Ssam 
10525869Ssam ENTRY(movob, 0)
10630309Skarels 	movob	11(fp),*4(fp)
10725869Ssam 	ret
108