xref: /csrg-svn/sys/hp300/stand/machdep.c (revision 49161)
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  *
1241488Smckusick  * from: Utah $Hdr: machdep.c 1.6 88/05/24$
1341488Smckusick  *
14*49161Sbostic  *	@(#)machdep.c	7.3 (Berkeley) 05/05/91
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 
4841488Smckusick trap(fp)
4941488Smckusick  struct frame {
5041488Smckusick 	 int dregs[8];
5141488Smckusick 	 int aregs[8];
5241488Smckusick 	 int whoknows;
5341488Smckusick 	 short sr;
5441488Smckusick 	 int pc;
5541488Smckusick 	 short frame;
5641488Smckusick  } *fp;
5741488Smckusick {
5841488Smckusick 	static int intrap = 0;
5941488Smckusick 
6041488Smckusick 	if (intrap)
6141488Smckusick 		return;
6241488Smckusick 	intrap = 1;
63*49161Sbostic 	printf("Got unexpected trap, vector = %x, ps = %x, pc = %x\n",
6441488Smckusick 	       fp->frame&0xFFF, fp->sr, fp->pc);
65*49161Sbostic 	printf("dregs: %x %x %x %x %x %x %x %x\n",
6641488Smckusick 	       fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3],
6741488Smckusick 	       fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]);
68*49161Sbostic 	printf("aregs: %x %x %x %x %x %x %x %x\n",
6941488Smckusick 	       fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3],
7041488Smckusick 	       fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]);
7141488Smckusick 	intrap = 0;
7241488Smckusick }
7341488Smckusick 
7441488Smckusick nodev()
7541488Smckusick {
7641488Smckusick 	return(0);
7741488Smckusick }
7841488Smckusick 
7941488Smckusick #ifdef ROMPRF
8041488Smckusick #define ROWS	46
8141488Smckusick #define COLS	128
8241488Smckusick 
8341488Smckusick romputchar(c)
8441488Smckusick  register int c;
8541488Smckusick {
8641488Smckusick 	static char buf[COLS];
8741488Smckusick 	static int col = 0, row = 0;
8841488Smckusick 	register int i;
8941488Smckusick 
9041488Smckusick 	switch (c) {
9141488Smckusick 	case '\0':
9241488Smckusick 		break;
9341488Smckusick 	case '\r':
9441488Smckusick 	case '\n':
9541488Smckusick 		for (i = col; i < COLS-1; i++)
9641488Smckusick 			buf[i] = ' ';
9741488Smckusick 		buf[i] = '\0';
9841488Smckusick 		romout(row, buf);
9941488Smckusick 		col = 0;
10041488Smckusick 		if (++row == ROWS)
10141488Smckusick 			row = 0;
10241488Smckusick 		break;
10341488Smckusick 
10441488Smckusick 	case '\t':
10541488Smckusick 		do {
10641488Smckusick 			romputchar(' ');
10741488Smckusick 		} while (col & 7);
10841488Smckusick 		break;
10941488Smckusick 
11041488Smckusick 	default:
11141488Smckusick 		buf[col] = c;
11241488Smckusick 		if (++col == COLS-1)
11341488Smckusick 			romputchar('\n');
11441488Smckusick 		break;
11541488Smckusick 	}
11641488Smckusick }
11741488Smckusick #endif
118