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