1 /* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department. 9 * 10 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: machdep.c 1.6 88/05/24$ 13 * 14 * @(#)machdep.c 7.2 (Berkeley) 12/16/90 15 */ 16 17 #include "sys/param.h" 18 19 /* 20 * Copy bytes within kernel 21 */ 22 bcopy(from, to, count) 23 register caddr_t from, to; 24 register unsigned count; 25 { 26 while (count--) 27 *to++ = *from++; 28 } 29 30 bzero(to, count) 31 register caddr_t to; 32 register unsigned count; 33 { 34 while (count--) 35 *to++ = 0; 36 } 37 38 bcmp(s1, s2, len) 39 register char *s1, *s2; 40 register int len; 41 { 42 while (len--) 43 if (*s1++ != *s2++) 44 return (1); 45 return (0); 46 } 47 48 trap(fp) 49 struct frame { 50 int dregs[8]; 51 int aregs[8]; 52 int whoknows; 53 short sr; 54 int pc; 55 short frame; 56 } *fp; 57 { 58 static int intrap = 0; 59 60 if (intrap) 61 return; 62 intrap = 1; 63 romprintf("Got unexpected trap, vector = %x, ps = %x, pc = %x\n", 64 fp->frame&0xFFF, fp->sr, fp->pc); 65 romprintf("dregs: %x %x %x %x %x %x %x %x\n", 66 fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3], 67 fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]); 68 romprintf("aregs: %x %x %x %x %x %x %x %x\n", 69 fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3], 70 fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]); 71 intrap = 0; 72 } 73 74 nodev() 75 { 76 return(0); 77 } 78 79 #ifdef ROMPRF 80 #define ROWS 46 81 #define COLS 128 82 83 romputchar(c) 84 register int c; 85 { 86 static char buf[COLS]; 87 static int col = 0, row = 0; 88 register int i; 89 90 switch (c) { 91 case '\0': 92 break; 93 case '\r': 94 case '\n': 95 for (i = col; i < COLS-1; i++) 96 buf[i] = ' '; 97 buf[i] = '\0'; 98 romout(row, buf); 99 col = 0; 100 if (++row == ROWS) 101 row = 0; 102 break; 103 104 case '\t': 105 do { 106 romputchar(' '); 107 } while (col & 7); 108 break; 109 110 default: 111 buf[col] = c; 112 if (++col == COLS-1) 113 romputchar('\n'); 114 break; 115 } 116 } 117 #endif 118