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 * 1254073Shibler * from: Utah $Hdr: machdep.c 1.10 92/06/18 1341488Smckusick * 14*59344Shibler * @(#)machdep.c 7.7 (Berkeley) 04/27/93 1541488Smckusick */ 1641488Smckusick 1756510Sbostic #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 4854073Shibler #ifdef ROMPRF 4954073Shibler int userom; 5054073Shibler #endif 5154073Shibler 52*59344Shibler struct trapframe { 53*59344Shibler int dregs[8]; 54*59344Shibler int aregs[8]; 55*59344Shibler int whoknows; 56*59344Shibler short sr; 57*59344Shibler int pc; 58*59344Shibler short frame; 59*59344Shibler }; 60*59344Shibler 6141488Smckusick trap(fp) 62*59344Shibler struct trapframe *fp; 6341488Smckusick { 6441488Smckusick static int intrap = 0; 6541488Smckusick 6641488Smckusick if (intrap) 6754073Shibler return(0); 6841488Smckusick intrap = 1; 6954073Shibler #ifdef ROMPRF 7054073Shibler userom = 1; 7154073Shibler #endif 7254073Shibler printf("Got unexpected trap: format=%x vector=%x ps=%x pc=%x\n", 7354073Shibler (fp->frame>>12)&0xF, fp->frame&0xFFF, fp->sr, fp->pc); 7449161Sbostic printf("dregs: %x %x %x %x %x %x %x %x\n", 7541488Smckusick fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3], 7641488Smckusick fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]); 7749161Sbostic printf("aregs: %x %x %x %x %x %x %x %x\n", 7841488Smckusick fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3], 7941488Smckusick fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]); 8054073Shibler #ifdef ROMPRF 8154073Shibler userom = 0; 8254073Shibler #endif 8341488Smckusick intrap = 0; 8454073Shibler return(0); 8541488Smckusick } 8641488Smckusick 8741488Smckusick #ifdef ROMPRF 8841488Smckusick #define ROWS 46 8941488Smckusick #define COLS 128 9041488Smckusick 9141488Smckusick romputchar(c) 9254073Shibler register int c; 9341488Smckusick { 9441488Smckusick static char buf[COLS]; 9541488Smckusick static int col = 0, row = 0; 9641488Smckusick register int i; 9741488Smckusick 9841488Smckusick switch (c) { 9941488Smckusick case '\0': 10041488Smckusick break; 10141488Smckusick case '\r': 10254073Shibler break; /* ignore */ 10341488Smckusick case '\n': 10441488Smckusick for (i = col; i < COLS-1; i++) 10541488Smckusick buf[i] = ' '; 10641488Smckusick buf[i] = '\0'; 10741488Smckusick romout(row, buf); 10841488Smckusick col = 0; 10941488Smckusick if (++row == ROWS) 11041488Smckusick row = 0; 11141488Smckusick break; 11241488Smckusick 11341488Smckusick case '\t': 11441488Smckusick do { 11541488Smckusick romputchar(' '); 11641488Smckusick } while (col & 7); 11741488Smckusick break; 11841488Smckusick 11941488Smckusick default: 12041488Smckusick buf[col] = c; 12141488Smckusick if (++col == COLS-1) 12241488Smckusick romputchar('\n'); 12341488Smckusick break; 12441488Smckusick } 12541488Smckusick } 12641488Smckusick #endif 127