xref: /original-bsd/old/adb/adb.hp300/defs.h (revision c3e32dec)
1 /*	defs.h	4.6	86/03/26	*/
2 
3 /*
4  * adb - vax string table version; common definitions
5  */
6 #include <sys/param.h>
7 
8 #include <machine/psl.h>
9 #ifdef NEWVM
10 typedef	unsigned long Ooff_t;
11 #define	off_t Ooff_t
12 #define lseek Lseek
13 #include <hp300/pte.h>
14 #else
15 #include <machine/pte.h>
16 #endif
17 
18 #include <sys/user.h>
19 
20 #include <ctype.h>
21 #include <a.out.h>
22 #include <sys/ptrace.h>
23 
24 #ifdef NEWVM
25 #undef TRUE
26 #undef FALSE
27 #endif
28 #include "mac.h"
29 #include "mode.h"
30 #include "head.h"
31 
32 /* access modes */
33 #define RD	0
34 #define WT	1
35 
36 #define NSP	0
37 #define	ISP	1
38 #define	DSP	2
39 #define STAR	4
40 #define PSP	8
41 #define STARCOM 0200
42 
43 #ifdef pdp11
44 I guess I should look this up in the 2.10 source...
45 #endif
46 
47 #ifdef vax
48 /*
49  * Symbol types, used internally in calls to findsym routine.
50  * One the VAX this all degenerates since I & D symbols are indistinct.
51  * Basically we get NSYM==0 for `=' command, ISYM==DSYM otherwise.
52  */
53 #define NSYM	0
54 #define DSYM	1		/* Data space symbol */
55 #define ISYM	DSYM		/* Instruction space symbol == DSYM on VAX */
56 
57 #define BKPTSET	1
58 #define BKPTEXEC 2
59 
60 #define USERPS	PSL
61 #define USERPC	PC
62 #define BPT	03
63 #define TBIT	020
64 #define FD	0200
65 #define getradj(i)	0
66 #define lget	get
67 
68 /* puns from <sys/ptrace.h> */
69 #define	CONTIN	PT_CONTINUE
70 #define SINGLE	PT_STEP
71 
72 /* the quantities involving ctob() are located in the kernel stack. */
73 /* the others are in the pcb. */
74 #define KSP	0
75 #define ESP	4
76 #define SSP	8
77 #define USP	(ctob(UPAGES)-5*sizeof(int))
78 
79 /* should read this in from reg.h */
80 #define R0	(ctob(UPAGES)-18*sizeof(int))
81 #define R1	(ctob(UPAGES)-17*sizeof(int))
82 #define R2	(ctob(UPAGES)-16*sizeof(int))
83 #define R3	(ctob(UPAGES)-15*sizeof(int))
84 #define R4	(ctob(UPAGES)-14*sizeof(int))
85 #define R5	(ctob(UPAGES)-13*sizeof(int))
86 #define R6	(ctob(UPAGES)-12*sizeof(int))
87 #define R7	(ctob(UPAGES)-11*sizeof(int))
88 #define R8	(ctob(UPAGES)-10*sizeof(int))
89 #define R9	(ctob(UPAGES)-9*sizeof(int))
90 #define R10	(ctob(UPAGES)-8*sizeof(int))
91 #define R11	(ctob(UPAGES)-7*sizeof(int))
92 #define AP	(ctob(UPAGES)-21*sizeof(int))
93 #define FP	(ctob(UPAGES)-20*sizeof(int))
94 #define PC	(ctob(UPAGES)-2*sizeof(int))
95 #define PSL	(ctob(UPAGES)-1*sizeof(int))
96 
97 #define P0BR	80
98 #define P0LR	84
99 #define P1BR	88
100 #define P1LR	92
101 #endif
102 
103 #ifdef hp300
104 #define NSYM	0		/* ??? */
105 #define DSYM	1		/* Data space symbol */
106 #define ISYM	DSYM		/* Instruction space symbol */
107 
108 #define BKPTSET	1
109 #define BKPTEXEC 2
110 
111 extern L_INT	getradj();
112 
113 #define BPT	0x4e42
114 
115 /* puns from <sys/ptrace.h> */
116 #define	CONTIN	PT_CONTINUE
117 #define SINGLE	PT_STEP
118 
119 /*
120  * Appropriated from dbx (returning a favor)
121  * `10' comes from:
122  *	(4)	stack starts 4 bytes in from end of uarea
123  *	(2)	trap type 0 frame format word is 2 bytes back from that
124  *	(4)	trap type 0 pc is 4 bytes back from that
125  */
126 #define	regloc(reg)	(ctob(UPAGES) + (sizeof(int) * ((reg) - 17)) - 10)
127 
128 /* select map */
129 #define	mapptr(s)	(((s)&DSP)?&datmap:(((s)&PSP)?&physmap:&txtmap))
130 
131 #define KSP	12	/* who knows? */
132 
133 /* should read this in from reg.h */
134 #define	D0	regloc(0)
135 #define	D1	regloc(1)
136 #define	D2	regloc(2)
137 #define	D3	regloc(3)
138 #define	D4	regloc(4)
139 #define	D5	regloc(5)
140 #define	D6	regloc(6)
141 #define	D7	regloc(7)
142 #define	A0	regloc(8)
143 #define	A1	regloc(9)
144 #define	A2	regloc(10)
145 #define	A3	regloc(11)
146 #define	A4	regloc(12)
147 #define	A5	regloc(13)
148 #define	A6	regloc(14)
149 #define	A7	regloc(15)
150 /*
151  * In 4.4 these have changed, stackadj (pad) field is 4 bytes not 2
152  * so PSW/PC are 2 bytes further away from D0.
153  */
154 #if defined(BSD4_4) || defined(HPBSD)
155 #define	PSW	(regloc(16)+2)
156 #define	PC	(regloc(17)+2)
157 #else
158 #define	PSW	regloc(16)
159 #define	PC	regloc(17)
160 #endif
161 #define FP	A6
162 #define USP	A7
163 
164 #define P0BR	60
165 #define P0LR	64
166 #define P1BR	68
167 #define P1LR	72
168 
169 #ifdef BSD4_4
170 #define FPBASE	280
171 #else
172 #define FPBASE	332
173 #endif
174 #define	FP0	(FPBASE+0*12)
175 #define	FP1	(FPBASE+1*12)
176 #define	FP2	(FPBASE+2*12)
177 #define	FP3	(FPBASE+3*12)
178 #define	FP4	(FPBASE+4*12)
179 #define	FP5	(FPBASE+5*12)
180 #define	FP6	(FPBASE+6*12)
181 #define	FP7	(FPBASE+7*12)
182 #define	FPCR	(FPBASE+8*12+0)
183 #define	FPSR	(FPBASE+8*12+4)
184 #define	FPIAR	(FPBASE+8*12+8)
185 #endif
186 
187 #if !defined(pdp11) && !defined(vax) && !defined(hp300)
188 
189 "edit this file to accommodate your machine's addressing"
190 
191 #endif
192 
193 #define MAXOFF	255
194 #define MAXPOS	80
195 #define MAXLIN	128
196 #define EOR	'\n'
197 #define SP	' '
198 #define TB	'\t'
199 #define QUOTE	0200
200 #define STRIP	0177
201 #define EVEN	-2
202 
203 /* long to ints and back (puns) */
204 union {
205 	INT	I[2];
206 	L_INT	L;
207 } itolws;
208 
209 #ifdef pdp11
210 #define leng(a)		((long)((unsigned)(a)))
211 #define shorten(a)	((int)(a))
212 #define itol(a,b)	(itolws.I[0]=(a), itolws.I[1]=(b), itolws.L)
213 #define lobyte(a)	((a) & 0377)
214 #endif
215 
216 #ifdef vax
217 #define leng(a)		itol(0,a)
218 #define shorten(a)	((short)(a))
219 #define itol(a,b)	(itolws.I[0]=(b), itolws.I[1]=(a), itolws.L)
220 #define lobyte(a)	((a) & 0377)
221 #endif
222 
223 #ifdef mc68000
224 #define leng(a)		itol(0,a)
225 #define shorten(a)	((short)(a))
226 #define itol(a,b)	(itolws.I[0]=(a), itolws.I[1]=(b), itolws.L)
227 #define lobyte(a)	(((a) >> 8) & 0377)
228 #endif
229 
230 #if !defined(vax) && !defined(pdp11) && !defined(mc68000)
231 
232 "edit this file to suit your machine's byte order"
233 
234 #endif
235 
236 /* result type declarations */
237 L_INT		inkdot();
238 POS		get();
239 POS		chkget();
240 POS		lchkget();
241 STRING		exform();
242 L_INT		round();
243 BKPTR		scanbkpt();
244 VOID		fault();
245 
246 struct	pcb	pcb;
247 int	kernel;
248 int	kcore;
249 struct	pte *sbr;
250 int	slr;
251 int	masterpcbb;
252