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