|
|
1.1 root 1: /* @(#)macdefs.h 2.5 */
2: /* the following defines give the SIZE and ALIGNMENT requirements
3: * of the various types in BITS. This information differs
4: * from machine to machine. If you have the source for the
5: * PCC compiler, this can be found in the `macdefs.h' file
6: */
7:
8: /* ANY use of the union STUFFU is inherently MACHINE DEPENDENT
9: * it is used for stuffing bytes into longs, etc.
10: * most machines can be made to work if you move the fields and recompile
11: */
12:
13: #ifdef TAHOE
14: #define SZCHAR 8
15: #define SZSHORT 16
16: #define SZINT 32
17: #define SZLONG 32
18: #define SZPOINT 32
19: #define SZFLOAT 32
20: #define SZDOUBLE 64
21:
22: #define ALCHAR 8
23: #define ALSHORT 16
24: #define ALINT 32
25: #define ALLONG 32
26: #define ALPOINT 32
27: #define ALFLOAT 32
28: #define ALDOUBLE 32
29: #define ALSTRUCT 32
30:
31: #define LTORBYTES /* bytes are numbered from left to right */
32: #define RTOLBITS /* bits are numbered from right to left */
33: #define cbPage 512 /* # of bytes on a disk page */
34:
35: typedef union {
36: long lng;
37: float fl;
38: struct {
39: short shortHi;
40: short shortLo;
41: } shorts;
42: struct {
43: char chHiHi;
44: char chHiLo;
45: char chLoHi;
46: char chLoLo;
47: } chars;
48: } STUFFU;
49: #endif
50:
51: #ifdef ONYX
52: #define SZCHAR 8
53: #define SZSHORT 16
54: #define SZINT 16
55: #define SZLONG 32
56: #define SZPOINT 16
57: #define SZFLOAT 32
58: #define SZDOUBLE 64
59:
60: #define ALCHAR 8
61: #define ALSHORT 16
62: #define ALINT 16
63: #define ALLONG 16
64: #define ALPOINT 16
65: #define ALFLOAT 16
66: #define ALDOUBLE 16
67: #define ALSTRUCT 8
68:
69: #define EVENBYTES /* accesses must be made on even byte boundaries */
70: #define RTOLBYTES /* bytes are numbered from right to left */
71: #define RTOLBITS /* bits are numbered from right to left */
72: #define cbPage 512 /* # of bytes on a disk page */
73:
74: typedef union {
75: long lng;
76: float fl;
77: struct {
78: short shortHi;
79: short shortLo;
80: } shorts;
81: struct {
82: char chHiHi;
83: char chHiLo;
84: char chLoHi;
85: char chLoLo;
86: } chars;
87: } STUFFU;
88: #endif
89:
90: #ifdef REGULUS
91: #define SZCHAR 8
92: #define SZSHORT 16
93: #define SZINT 16
94: #define SZLONG 32
95: #define SZPOINT 32
96: #define SZFLOAT 32
97: #define SZDOUBLE 32
98:
99: #define ALCHAR 16
100: #define ALSHORT 16
101: #define ALINT 16
102: #define ALLONG 16
103: #define ALPOINT 16
104: #define ALFLOAT 16
105: #define ALDOUBLE 16
106: #define ALSTRUCT 16
107:
108: #define EVENBYTES /* accesses must be made on even byte boundaries */
109: #define LTORBYTES /* bytes are numbered from left to right */
110: #define LTORBITS /* bits are numbered from left to right */
111: #define cbPage 512 /* # of bytes on a disk page */
112:
113: typedef union {
114: long lng;
115: float fl;
116: struct {
117: short shortHi;
118: short shortLo;
119: } shorts;
120: struct {
121: char chHiHi;
122: char chHiLo;
123: char chLoHi;
124: char chLoLo;
125: } chars;
126: } STUFFU;
127: #endif
128:
129: #ifdef VAX
130: #define SZCHAR 8
131: #define SZSHORT 16
132: #define SZINT 32
133: #define SZLONG 32
134: #define SZPOINT 32
135: #define SZFLOAT 32
136: #define SZDOUBLE 64
137:
138: #define ALCHAR 8
139: #define ALSHORT 8
140: #define ALINT 8
141: #define ALLONG 8
142: #define ALPOINT 8
143: #define ALFLOAT 8
144: #define ALDOUBLE 8
145: #define ALSTRUCT 8
146:
147: #define RTOLBYTES /* bytes are numbered from right to left */
148: #define RTOLBITS /* bits are numbered from right to left */
149: #define cbPage 512 /* # of bytes on a disk page */
150:
151: typedef union {
152: long lng;
153: float fl;
154: struct {
155: short shortLo;
156: short shortHi;
157: } shorts;
158: struct {
159: char chLoLo;
160: char chLoHi;
161: char chHiLo;
162: char chHiHi;
163: } chars;
164: } STUFFU;
165: #endif
166:
167: #ifdef SUN
168: #define SZCHAR 8
169: #define SZSHORT 16
170: #define SZINT 32
171: #define SZLONG 32
172: #define SZPOINT 32
173: #define SZFLOAT 32
174: #define SZDOUBLE 64
175:
176: #define ALCHAR 8
177: #define ALSHORT 8
178: #define ALINT 8
179: #define ALLONG 8
180: #define ALPOINT 8
181: #define ALFLOAT 8
182: #define ALDOUBLE 8
183: #define ALSTRUCT 8
184:
185: #define EVENBYTES /* accesses must be made on even byte boundaries */
186: #define LTORBYTES /* bytes are numbered from left to right */
187: #define LTORBITS /* bits are numbered from left to right */
188: #define cbPage 512 /* # of bytes on a disk page */
189:
190: typedef union {
191: long lng;
192: float fl;
193: struct {
194: short shortHi;
195: short shortLo;
196: } shorts;
197: struct {
198: char chHiHi;
199: char chHiLo;
200: char chLoHi;
201: char chLoLo;
202: } chars;
203: } STUFFU;
204: /* SUN */
205: #endif
206:
207:
208: #define CBCHAR 1 /* I hope that this is right!!! */
209: #define CBSHORT SZSHORT/SZCHAR
210: #define CBINT SZINT/SZCHAR
211: #define CBLONG SZLONG/SZCHAR
212: #define CBPOINT SZPOINT/SZCHAR
213: #define CBFLOAT SZFLOAT/SZCHAR
214: #define CBDOUBLE SZDOUBLE/SZCHAR
215:
216:
217: #define U1 ((unsigned)~0)
218: #define shortMax (U1>>(SZINT-SZSHORT+1)) /* largest signed short integer */
219: #define shortMin (-shortMax-1) /* smallest signed short integer */
220: #define intMax (U1>>1) /* largest signed integer */
221: #define intMin (-intMax-1) /* smallest signed long integer */
222: #define longMax (U1>>1) /* largest signed long */
223: #define longMin (-longMax-1) /* smallest signed long */
224:
225: #define Mask(width) (~(U1<<width)) /* generate a bunch of 1111111's */
226: #ifdef RTOLBITS
227: #define Extract(x, pos, width) ((x>>pos) & Mask(width))
228: #define SetBits(x, width, pos, val) {x &= ~(Mask(width)<<pos); x |= val<<pos;}
229: #else
230: #define Extract(x, pos, width) ((x>>(SZINT-pos-width)) & Mask(width))
231: #define SetBits(x, width, pos, val)\
232: {x &= ~(Mask(width)<<(SZINT-pos-width)); x |= val<<(SZINT-pos-width);}
233: #endif
234:
235: /* adrReg0 is usually the reference point in "core". It's the displacement
236: * for the end of the (user+kernel) stack.
237: * adrReason is the displacement in a core file header where we can find
238: * the reason for the child's death (relative to adrReg0). I know of no way to
239: * determine this number other than by Divine insight, or by
240: * looking at the sources for the crash program(?).
241: */
242: #ifdef TAHOE
243:
244: #ifndef BSD42
245: #define adrReg0 (4*1024) /* see InitAll in init.c for discussion */
246: #else
247: #define adrReg0 (6*1024) /* The _u structure is 6k in Unix 4.2 ! */
248: #endif
249:
250: #define adrReason -3*4 /* On Tahoe, HW pushes psl, pc, then the code */
251: #endif
252:
253: #ifdef ONYX
254: #define adrReg0 ((int *)03742) /* see InitAll in init.c for discussion */
255: #define adrReason 03654 /* -27 */
256: #endif
257:
258: #ifdef PLEXUS
259: #undef adrReg0
260: #undef adrReason
261: #define adrReg0 ((int *)03750) /* see InitAll in init.c for discussion */
262: #define adrReason 03650
263: #define SP R15
264: #endif
265:
266: #ifdef M68000
267: #define adrReg0 ((int *)010000) /* see InitAll in init.c for discussion */
268: #define adrReason 07764 /* -3 */
269: #endif
270:
271: #ifdef VAX
272: #define adrReg0 ((int *)010000) /* see InitAll in init.c for discussion */
273: #define adrReason 07764 /* -3 */
274: #endif
275:
276: #ifndef M68000
277: /* these are internal names for registers, REAL offsets are in vrgOffset */
278: #define u0 0
279: #define u1 1
280: #define u2 2
281: #define u3 3
282: #define u4 4
283: #define u5 5
284: #define u6 6
285: #define u7 7
286: #define u8 8
287: #define u9 9
288: #define u10 10
289: #define u11 11
290: #define u12 12
291: #ifndef TAHOE
292: #define u13 13
293: #endif
294:
295: #ifdef ONYX
296: #define u14 14
297: #define u15 15
298: #define usp 16
299: #define upc 17
300: #define ufp 18
301: #define ufcw 19
302: #define uregMax 20
303: #endif
304:
305: #ifdef VAX
306: #define uap 14
307: #define ufp 15
308: #define usp 16
309: #define ups 17
310: #define upc 18
311: #define uregMax 19
312: #endif
313:
314: #ifdef TAHOE
315: #define ufp 13
316: #define usp 14
317: #define upc 15
318: #define ups 16
319: #define uregMax 17
320: #endif
321:
322: #endif
323:
324: #ifdef SUN
325: #define adrReg0 ((int *)013666) /* see InitAll in init.c for discussion */
326: #define adrReason 013652 /* -3 */
327: #endif
328:
329: #ifdef M68000
330: /* these are internal names for registers, REAL offsets are in vrgOffset */
331: #define ud0 0
332: #define ud1 1
333: #define ud2 2
334: #define ud3 3
335: #define ud4 4
336: #define ud5 5
337: #define ud6 6
338: #define ud7 7
339: #define ua0 8
340: #define ua1 9
341: #define ua2 10
342: #define ua3 11
343: #define ua4 12
344: #define ua5 13
345: #define ua6 14
346: #define ua7 15
347: #define upc 16
348: #define ups 17
349: #define ufp 18
350: #define usp 19
351: #define uregMax 20
352: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.