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