xref: /original-bsd/old/adb/adb.hp300/defs.h (revision 2bc5eadd)
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 #define	FP0	332
170 #define	FP1	344
171 #define	FP2	356
172 #define	FP3	368
173 #define	FP4	380
174 #define	FP5	392
175 #define	FP6	404
176 #define	FP7	416
177 #define	FPCR	428
178 #define	FPSR	432
179 #define	FPIAR	436
180 #endif
181 
182 #if !defined(pdp11) && !defined(vax) && !defined(hp300)
183 
184 "edit this file to accommodate your machine's addressing"
185 
186 #endif
187 
188 #define MAXOFF	255
189 #define MAXPOS	80
190 #define MAXLIN	128
191 #define EOR	'\n'
192 #define SP	' '
193 #define TB	'\t'
194 #define QUOTE	0200
195 #define STRIP	0177
196 #define EVEN	-2
197 
198 /* long to ints and back (puns) */
199 union {
200 	INT	I[2];
201 	L_INT	L;
202 } itolws;
203 
204 #ifdef pdp11
205 #define leng(a)		((long)((unsigned)(a)))
206 #define shorten(a)	((int)(a))
207 #define itol(a,b)	(itolws.I[0]=(a), itolws.I[1]=(b), itolws.L)
208 #define lobyte(a)	((a) & 0377)
209 #endif
210 
211 #ifdef vax
212 #define leng(a)		itol(0,a)
213 #define shorten(a)	((short)(a))
214 #define itol(a,b)	(itolws.I[0]=(b), itolws.I[1]=(a), itolws.L)
215 #define lobyte(a)	((a) & 0377)
216 #endif
217 
218 #ifdef mc68000
219 #define leng(a)		itol(0,a)
220 #define shorten(a)	((short)(a))
221 #define itol(a,b)	(itolws.I[0]=(a), itolws.I[1]=(b), itolws.L)
222 #define lobyte(a)	(((a) >> 8) & 0377)
223 #endif
224 
225 #if !defined(vax) && !defined(pdp11) && !defined(mc68000)
226 
227 "edit this file to suit your machine's byte order"
228 
229 #endif
230 
231 /* result type declarations */
232 L_INT		inkdot();
233 POS		get();
234 POS		chkget();
235 POS		lchkget();
236 STRING		exform();
237 L_INT		round();
238 BKPTR		scanbkpt();
239 VOID		fault();
240 
241 struct	pcb	pcb;
242 int	kernel;
243 int	kcore;
244 struct	pte *sbr;
245 int	slr;
246 int	masterpcbb;
247