xref: /csrg-svn/sys/hp300/stand/machdep.c (revision 56510)
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*56510Sbostic  *	@(#)machdep.c	7.6 (Berkeley) 10/11/92
1541488Smckusick  */
1641488Smckusick 
17*56510Sbostic #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 
5241488Smckusick trap(fp)
5354073Shibler 	struct frame {
5454073Shibler 		int dregs[8];
5554073Shibler 		int aregs[8];
5654073Shibler 		int whoknows;
5754073Shibler 		short sr;
5854073Shibler 		int pc;
5954073Shibler 		short frame;
6054073Shibler 	} *fp;
6141488Smckusick {
6241488Smckusick 	static int intrap = 0;
6341488Smckusick 
6441488Smckusick 	if (intrap)
6554073Shibler 		return(0);
6641488Smckusick 	intrap = 1;
6754073Shibler #ifdef ROMPRF
6854073Shibler 	userom = 1;
6954073Shibler #endif
7054073Shibler 	printf("Got unexpected trap: format=%x vector=%x ps=%x pc=%x\n",
7154073Shibler 		  (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]);
7854073Shibler #ifdef ROMPRF
7954073Shibler 	userom = 0;
8054073Shibler #endif
8141488Smckusick 	intrap = 0;
8254073Shibler 	return(0);
8341488Smckusick }
8441488Smckusick 
8541488Smckusick #ifdef ROMPRF
8641488Smckusick #define ROWS	46
8741488Smckusick #define COLS	128
8841488Smckusick 
8941488Smckusick romputchar(c)
9054073Shibler 	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':
10054073Shibler 		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