new copyright; att/bsd/shared
[unix-history] / usr / src / usr.bin / pascal / src / objfmt.h
CommitLineData
0fc6e47b
KB
1/*-
2 * Copyright (c) 1980 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
252367af 6 *
0fc6e47b 7 * @(#)objfmt.h 5.4 (Berkeley) %G%
252367af 8 */
26692d6a
PK
9
10/*
11 * The size of the display.
12 */
13#define DSPLYSZ 20
14
15/*
16 * The structure of the runtime display
17 */
18#ifdef OBJ
19struct dispsave {
20 char *locvars; /* pointer to local variables */
21 struct blockmark *stp; /* pointer to local stack frame */
22};
23 /*
24 * The following union allows fast access to
25 * precomputed display entries
26 */
27union display {
28 struct dispsave frame[DSPLYSZ];
29 char *raw[2*DSPLYSZ];
30} display;
31#endif OBJ
32#ifdef PC
33#ifdef vax
34 /*
35 * the display is made up of saved AP's and FP's.
36 * FP's are used to find locals,
37 * and AP's are used to find parameters.
38 * FP and AP are untyped pointers,
39 * but are used throughout as (char *).
40 * the display is used by adding AP_OFFSET or FP_OFFSET to the
41 * address of the approriate display entry.
42 */
43 struct dispsave {
44 char *savedAP;
45 char *savedFP;
46 } display[ DSPLYSZ ];
47
48# define AP_OFFSET ( 0 )
49# define FP_OFFSET ( sizeof (char *) )
50#endif vax
51#ifdef mc68000
52 /*
53 * the display is just the saved a6.
54 * arguments are at positive offsets,
55 * locals are at negative offsets.
56 * there are no offsets within the saved display structure.
57 */
58 struct dispsave {
59 char *saveda6;
60 } display[ DSPLYSZ ];
61
62# define AP_OFFSET (0)
63# define FP_OFFSET (0)
64#endif mc68000
1922e5bd
KM
65#ifdef tahoe
66 /*
67 * the display is just the saved FP.
68 * arguments are at positive offsets,
69 * locals are at negative offsets.
70 * there are no offsets within the saved display structure.
71 */
72 struct dispsave {
73 char *savedFP;
74 } display[ DSPLYSZ ];
75
76# define AP_OFFSET 0
77# define FP_OFFSET 0
78#endif tahoe
26692d6a
PK
79#endif PC
80
81 /*
82 * the structure below describes the block mark used by the architecture.
83 * this is the space used by the machine between the arguments and the
84 * whatever is used to point to the arguments.
85 */
86#ifdef OBJ
87struct blockmark {
88 char *tos; /* pointer to top of stack frame */
89 struct iorec *file; /* pointer to active file name */
90 struct hdr {
91 long framesze; /* number of bytes of local vars */
92 long nargs; /* number of bytes of arguments */
93 long tests; /* TRUE => perform runtime tests */
94 short offset; /* offset of procedure in source file */
95 char name[1]; /* name of active procedure */
96 } *entry;
97 struct dispsave odisp; /* previous display value for this level */
98 struct dispsave *dp; /* pointer to active display entry */
99 char *pc; /* previous location counter */
100 long lino; /* previous line number */
101};
102#endif OBJ
103#ifdef PC
104#ifdef vax
105 /*
106 * since we have the ap pointing to the number of args:
107 */
108 struct blockmark {
109 long nargs;
110 };
111#endif vax
112#ifdef mc68000
113 /*
114 * there's the saved pc (from the jsr)
115 * and the saved a6 (from the link a6).
116 */
117 struct blockmark {
118 char *savedpc;
119 char *saveda6;
120 };
121#endif mc68000
1922e5bd
KM
122#ifdef tahoe
123 /*
124 * since we have the fp pointing to its predecessor
125 */
126 struct blockmark {
127 long savedfp;
128 };
129#endif tahoe
26692d6a
PK
130#endif PC
131
132 /*
133 * formal routine structure:
134 */
135struct formalrtn {
136 long (*fentryaddr)(); /* formal entry point */
137 long fbn; /* block number of function */
138 struct dispsave fdisp[ DSPLYSZ ]; /* saved at first passing */
60ba0e41
RT
139};
140#ifndef PC
141#ifndef OBJ
142struct formalrtn frtn;
143#endif
144#endif
26692d6a
PK
145
146#define FENTRYOFFSET 0
147#define FBNOFFSET ( FENTRYOFFSET + sizeof frtn.fentryaddr )
148#define FDISPOFFSET ( FBNOFFSET + sizeof frtn.fbn )
fb008ab4
PK
149
150#ifdef OBJ
151 /*
152 * the creation time, the size and the magic number of the obj file
153 */
154 struct pxhdr {
2d40c995
KM
155 long maketime;
156 long objsize;
b2877e66 157 long symtabsize;
fb008ab4
PK
158 short magicnum;
159 };
160
86c1236e
KM
161/*
162 * START defines the beginning of the text space.
163 * This should be the defined external label "start",
164 * however there is no way to access externals from C
165 * whose names do not begin with an "_".
166 */
26692d6a 167#ifdef vax
bd48d6a0 168# define HEADER_BYTES 2048 /* the size of px_header */
86c1236e 169# define START 0x0 /* beginning of text */
26692d6a 170#endif vax
1922e5bd 171#ifdef tahoe
3d73d125 172# define HEADER_BYTES 2560 /* the size of px_header */
1922e5bd
KM
173# define START 0x0 /* beginning of text */
174#endif tahoe
26692d6a
PK
175#ifdef mc68000
176# define HEADER_BYTES 3072 /* the size of px_header */
86c1236e 177# define START 0x8000 /* beginning of text */
26692d6a 178#endif mc68000
774bc4b2 179# define INDX 1 /* amt to shift display index */
fb008ab4
PK
180#endif OBJ
181
fb008ab4
PK
182 /*
183 * these are because of varying sizes of pointers
184 */
26692d6a
PK
185#ifdef ADDR16
186# define PTR_AS O_AS2
187# define PTR_RV O_RV2
188# define PTR_IND O_IND2
189# define PTR_CON O_CON2
190# define PTR_DUP O_SDUP2
191# define CON_INT O_CON2
192# define INT_TYP (nl + T2INT)
193# define PTR_DCL char *
194# define TOOMUCH 50000
195# define SHORTADDR 65536
196# define MAXSET 65536 /* maximum set size */
197#endif ADDR16
198#ifdef ADDR32
fb008ab4
PK
199# define PTR_AS O_AS4
200# define PTR_RV O_RV4
201# define PTR_IND O_IND4
2d40c995
KM
202# define PTR_CON O_CON4
203# define PTR_DUP O_SDUP4
44dfd6de
KM
204# define CON_INT O_CON24
205# define INT_TYP (nl + T4INT)
fb008ab4
PK
206# define PTR_DCL unsigned long /* for pointer variables */
207# define SHORTADDR 32768 /* maximum short address */
208# define TOOMUCH 65536 /* maximum variable size */
209# define MAXSET 65536 /* maximum set size */
26692d6a
PK
210#endif ADDR32
211 /*
212 * Offsets due to the structure of the runtime stack.
213 * DPOFF1 is the amount of fixed storage in each block allocated
214 * as local variables for the runtime system.
215 * since locals are allocated negative offsets,
216 * -DPOFF1 is the last used implicit local offset.
217 * DPOFF2 is the size of the block mark.
218 * since arguments are allocated positive offsets,
219 * DPOFF2 is the end of the implicit arguments.
220 * for obj, the first argument has the highest offset
221 * from the stackpointer. and the block mark is an
222 * implicit last parameter.
223 * for pc, the first argument has the lowest offset
224 * from the argumentpointer. and the block mark is an
225 * implicit first parameter.
226 */
fb008ab4 227# ifdef OBJ
26692d6a
PK
228# ifdef ADDR32
229# define MAGICNUM 0403 /* obj magic number */
230# define DPOFF1 0
231# define DPOFF2 (sizeof (struct blockmark))
232# define INPUT_OFF -8 /* offset of `input' */
233# define OUTPUT_OFF -4 /* offset of `output' */
234# endif ADDR32
235# ifdef ADDR16
236# define MAGICNUM 0404
237# define DPOFF1 0
238# define DPOFF2 (sizeof (struct blockmark))
239# define INPUT_OFF -2
240# define OUTPUT_OFF -4
241# endif ADDR16
fb008ab4
PK
242# endif OBJ
243# ifdef PC
26692d6a
PK
244# define DPOFF1 ( sizeof (struct rtlocals) )
245# define DPOFF2 ( sizeof (struct blockmark) )
fb008ab4
PK
246# define INPUT_OFF 0
247# define OUTPUT_OFF 0
248# endif PC