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