xref: /original-bsd/sys/tahoe/stand/machdep.c (revision b30b9691)
1 /*	machdep.c	1.5	90/12/16	*/
2 
3 #include "../tahoe/mem.h"
4 #include "../include/mtpr.h"
5 #include "../tahoe/SYS.h"
6 
7 	.set	_scb, 0x0
8 	.set	HIGH, 0x1f	# mask for total disable
9 	.set	BERVEC, 0x80	# offset into scb of the bus error vector
10 	.set	RESTVEC, 0x8	# offset into scb of the restart vector
11 
12 ENTRY(mtpr, 0)
13 	mtpr	8(fp),4(fp)
14 	ret
15 
16 ENTRY(mfpr, 0)
17 	mfpr	4(fp),r0
18 	ret
19 
20 ENTRY(bcopy, R2|R1|R0)
21 	movl	4(fp),r0
22 	movl	8(fp),r1
23 	movl	12(fp),r2
24 	movblk
25 	ret
26 
27 /*
28  * badaddr(addr, len)
29  *	see if access addr with a len type instruction causes a machine check
30  *	len is length of access (1=byte, 2=short, 4=long)
31  *	r0 = 0 means good(exists); r0 =1 means does not exist.
32  */
33 ENTRY(badaddr, R5|R4|R3|R2|R1)
34 	mfpr	$IPL,r1
35 	mtpr	$HIGH,$IPL
36 	mfpr	$SCBB,r5
37 	mtpr	$0,$SCBB
38 	movl	*$BERVEC,r2
39 	movl	4(fp),r3
40 	movl	8(fp),r4
41 	movab	9f,*$BERVEC
42 	bbc	$0,r4,1f; tstb	(r3)
43 1:	bbc	$1,r4,1f; tstw	(r3)
44 1:	bbc	$2,r4,1f; tstl	(r3)
45 1:	clrl	r0			# made it w/o machine checks
46 2:	movl	r2,*$BERVEC
47 	mtpr	r1,$IPL
48 	mtpr	r5,$SCBB
49 	ret
50 
51 /*
52  * wbadaddr(addr, len, value)
53  *	see if write of value to addr with a len type instruction causes
54  *	a machine check
55  *	len is length of access (1=byte, 2=short, 4=long)
56  *	r0 = 0 means good(exists); r0 =1 means does not exist.
57  */
58 ENTRY(wbadaddr, R5|R4|R3|R2|R1)
59 	mfpr	$IPL,r1
60 	mtpr	$HIGH,$IPL
61 	mfpr	$SCBB,r5
62 	mtpr	$0,$SCBB
63 	movl	*$BERVEC,r2
64 	movl	4(fp),r3
65 	movl	8(fp),r4
66 	movab	9f,*$BERVEC
67 	bbc	$0,r4,1f; movb	15(fp), (r3)
68 1:	bbc	$1,r4,1f; movw	14(fp), (r3)
69 1:	bbc	$2,r4,1f; movl	12(fp), (r3)
70 1:	clrl	r0			# made it w/o machine checks
71 2:	movl	r2,*$BERVEC
72 	mtpr	r1,$IPL
73 	mtpr	r5,$SCBB
74 	ret
75 
76 	.align	2
77 9:			# Here we catch buss error (if it comes)
78 	andl3	4(sp),$ERRCD,r0
79 	cmpl	r0,$APE
80 	jneq	1f
81 	halt			# Address parity error !!!
82 1:	cmpl	r0,$VBE
83 	jneq	1f
84 	halt			# Versabus error
85 1:
86 	movl	$1,r0		# Anything else = bad address
87 	movab	8(sp),sp	# discard buss error trash
88 	movab	2b,(sp)		# new program counter on stack.
89 	rei
90 
91 ENTRY(movow, 0)
92 	movow	10(fp),*4(fp)
93 	ret
94 
95 ENTRY(movob, 0)
96 	movob	11(fp),*4(fp)
97 	ret
98