141488Smckusick /* 241488Smckusick * Copyright (c) 1988 University of Utah. 341488Smckusick * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 441488Smckusick * All rights reserved. 541488Smckusick * 641488Smckusick * This code is derived from software contributed to Berkeley by 741488Smckusick * the Systems Programming Group of the University of Utah Computer 841488Smckusick * Science Department. 941488Smckusick * 1041488Smckusick * %sccs.include.redist.c% 1141488Smckusick * 12*54073Shibler * from: Utah $Hdr: machdep.c 1.10 92/06/18 1341488Smckusick * 14*54073Shibler * @(#)machdep.c 7.5 (Berkeley) 06/18/92 1541488Smckusick */ 1641488Smckusick 1745790Sbostic #include "sys/param.h" 1841488Smckusick 1941488Smckusick /* 2041488Smckusick * Copy bytes within kernel 2141488Smckusick */ 2241488Smckusick bcopy(from, to, count) 2341488Smckusick register caddr_t from, to; 2441488Smckusick register unsigned count; 2541488Smckusick { 2641488Smckusick while (count--) 2741488Smckusick *to++ = *from++; 2841488Smckusick } 2941488Smckusick 3041488Smckusick bzero(to, count) 3141488Smckusick register caddr_t to; 3241488Smckusick register unsigned count; 3341488Smckusick { 3441488Smckusick while (count--) 3541488Smckusick *to++ = 0; 3641488Smckusick } 3741488Smckusick 3841488Smckusick bcmp(s1, s2, len) 3941488Smckusick register char *s1, *s2; 4041488Smckusick register int len; 4141488Smckusick { 4241488Smckusick while (len--) 4341488Smckusick if (*s1++ != *s2++) 4441488Smckusick return (1); 4541488Smckusick return (0); 4641488Smckusick } 4741488Smckusick 48*54073Shibler #ifdef ROMPRF 49*54073Shibler int userom; 50*54073Shibler #endif 51*54073Shibler 5241488Smckusick trap(fp) 53*54073Shibler struct frame { 54*54073Shibler int dregs[8]; 55*54073Shibler int aregs[8]; 56*54073Shibler int whoknows; 57*54073Shibler short sr; 58*54073Shibler int pc; 59*54073Shibler short frame; 60*54073Shibler } *fp; 6141488Smckusick { 6241488Smckusick static int intrap = 0; 6341488Smckusick 6441488Smckusick if (intrap) 65*54073Shibler return(0); 6641488Smckusick intrap = 1; 67*54073Shibler #ifdef ROMPRF 68*54073Shibler userom = 1; 69*54073Shibler #endif 70*54073Shibler printf("Got unexpected trap: format=%x vector=%x ps=%x pc=%x\n", 71*54073Shibler (fp->frame>>12)&0xF, fp->frame&0xFFF, fp->sr, fp->pc); 7249161Sbostic printf("dregs: %x %x %x %x %x %x %x %x\n", 7341488Smckusick fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3], 7441488Smckusick fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]); 7549161Sbostic printf("aregs: %x %x %x %x %x %x %x %x\n", 7641488Smckusick fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3], 7741488Smckusick fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]); 78*54073Shibler #ifdef ROMPRF 79*54073Shibler userom = 0; 80*54073Shibler #endif 8141488Smckusick intrap = 0; 82*54073Shibler return(0); 8341488Smckusick } 8441488Smckusick 8541488Smckusick #ifdef ROMPRF 8641488Smckusick #define ROWS 46 8741488Smckusick #define COLS 128 8841488Smckusick 8941488Smckusick romputchar(c) 90*54073Shibler register int c; 9141488Smckusick { 9241488Smckusick static char buf[COLS]; 9341488Smckusick static int col = 0, row = 0; 9441488Smckusick register int i; 9541488Smckusick 9641488Smckusick switch (c) { 9741488Smckusick case '\0': 9841488Smckusick break; 9941488Smckusick case '\r': 100*54073Shibler break; /* ignore */ 10141488Smckusick case '\n': 10241488Smckusick for (i = col; i < COLS-1; i++) 10341488Smckusick buf[i] = ' '; 10441488Smckusick buf[i] = '\0'; 10541488Smckusick romout(row, buf); 10641488Smckusick col = 0; 10741488Smckusick if (++row == ROWS) 10841488Smckusick row = 0; 10941488Smckusick break; 11041488Smckusick 11141488Smckusick case '\t': 11241488Smckusick do { 11341488Smckusick romputchar(' '); 11441488Smckusick } while (col & 7); 11541488Smckusick break; 11641488Smckusick 11741488Smckusick default: 11841488Smckusick buf[col] = c; 11941488Smckusick if (++col == COLS-1) 12041488Smckusick romputchar('\n'); 12141488Smckusick break; 12241488Smckusick } 12341488Smckusick } 12441488Smckusick #endif 125