1 #ifndef _DEFINITION_DCLS_H
2 #define _DEFINITION_DCLS_H
6 // see pl1/definition_dcls.incl.pl1
8 /* everything for the definition section */
12 // CLASS_TEXT init (0), /* text section definition */
14 // CLASS_LINKAGE init (1), /* linkage section definition */
16 // CLASS_SYMBOL init (2), /* symbol section definition */
18 // CLASS_SEGNAME init (3), /* segment name definition */
20 // CLASS_STATIC init (4), /* static section definition */
22 // CLASS_SYSTEM init (5), /* valid only in self links, not def class */
24 // CLASS_HEAP init (6) /* valid only in self links, not def class */
26 // ) fixed bin (3) unsigned internal static options (constant);
29 // declare CLASS_NAMES (0:6) character (12) internal static options (constant)
30 // init ("text", "linkage", "symbol", "segname", "static", "system", "heap");
31 extern char *class_names[7];
33 // declare SYMBOLIC_SECTION_NAMES (0:6) character (8)
34 // init ("*text", "*link", "*symbol", *, "*static", "*system", "*heap") internal static
35 // options (constant);
36 extern char *symbolic_section_names[7];
38 // declare 1 definition_flags unaligned based,
39 // 2 new bit (1), /* should be "1"b */
40 // 2 ignore bit (1), /* cannot snap link to this */
41 // 2 entry bit (1), /* can tra here */
42 // 2 retain bit (1), /* binder respects this */
43 // 2 argcount bit (1), /* OBSOLETE */
44 // 2 descriptors bit (1), /* OBSOLETE */
45 // 2 indirect bit (1), /* target is a pointer to actual target */
46 // 2 unused bit (8); /* Must be zero */
48 /* Header of the definition section */
50 // declare def_header_ptr pointer;
51 // declare 1 definition_header aligned based (def_header_ptr),
52 struct definition_header {
53 // 2 def_list_relp fixed bin (18) unsigned unaligned,
54 // /* first definition, reloc def18 */
55 // 2 msf_map_relp fixed bin (18) unsigned unaligned,
56 // /* msf_map if any, or 0 if none. reloc def18 unless none */
57 uint64_t msf_map_relp : 18;
58 uint64_t def_list_relp : 18;
61 // 2 hash_table_relp fixed bin (18) unsigned unaligned,
62 // /* def hash table, if any, or 0 if none. reloc def18 unless none */
63 // 2 flags unaligned like definition_flags;
64 // /* both new and ignore must be "1"b here */
66 uint64_t flags_unused : 8;
67 uint64_t flags_indirect : 1;
68 uint64_t flags_descriptors : 1;
69 uint64_t flags_argcount : 1;
70 uint64_t flags_retain : 1;
71 uint64_t flags_entry : 1;
72 uint64_t flags_ignore : 1;
73 uint64_t flags_new : 1;
74 uint64_t hash_table_relp : 18;
78 /* A non class=3 definition. See segname_definition below for class=3 */
80 // declare def_ptr pointer;
81 // declare 1 definition aligned based (def_ptr),
83 // 2 forward_relp unal fixed bin (18) unsigned,
84 // /* offset of next def */
85 // 2 backward_relp unal fixed bin (18) unsigned,
86 // /* offset of previous def */
87 uint64_t backward_relp : 18;
88 uint64_t forward_relp : 18;
91 // 2 thing_relp unal fixed bin (18) unsigned,
92 // /* offset in section specified by class of thing this defines */
93 // 2 flags unaligned like definition_flags,
94 // 2 class unal fixed bin (3) unsigned,
95 // /* Type of definition */
97 uint64_t flags_unused : 8;
98 uint64_t flags_indirect : 1;
99 uint64_t flags_descriptors : 1;
100 uint64_t flags_argcount : 1;
101 uint64_t flags_retain : 1;
102 uint64_t flags_entry : 1;
103 uint64_t flags_ignore : 1;
104 uint64_t flags_new : 1;
105 uint64_t thing_relp : 18;
106 uint64_t dummy1 : 28;
108 // 2 name_relp unal fixed bin (18) unsigned,
109 // /* offset of ACC for symbol */
110 // 2 segname_relp unal fixed bin (18) unsigned;
111 // /* offset of segname def to which this belongs */
112 uint64_t segname_relp : 18;
113 uint64_t name_relp : 18;
114 uint64_t dummy2 : 28;
117 /* Class=3, segname definition */
119 // declare segname_ptr pointer;
120 // declare 1 segname_definition aligned based (segname_ptr),
121 struct segname_definition {
122 // 2 forward_relp unal fixed bin (18) unsigned,
123 // /* offset of next def */
124 // 2 backward_relp unal fixed bin (18) unsigned,
125 // /* offset of previous def */
126 uint64_t backward_relp : 18;
127 uint64_t forward_relp : 18;
128 uint64_t dummy0 : 28;
130 // 2 next_segname_relp unal fixed bin (18) unsigned,
131 // /* offset of next segname def */
132 // 2 flags unaligned like definition_flags,
133 // 2 class unal fixed bin (3) unsigned,
134 // /* 3 for segname */
136 uint64_t flags_unused : 8;
137 uint64_t flags_indirect : 1;
138 uint64_t flags_descriptors : 1;
139 uint64_t flags_argcount : 1;
140 uint64_t flags_retain : 1;
141 uint64_t flags_entry : 1;
142 uint64_t flags_ignore : 1;
143 uint64_t flags_new : 1;
144 uint64_t next_segname_relp : 18;
145 uint64_t dummy1 : 28;
147 // 2 name_relp unal fixed bin (18) unsigned,
148 // /* offset of ACC for symbol */
149 // 2 first_relp unal fixed bin (18) unsigned;
150 // /* see following : */
151 uint64_t first_relp : 18;
152 uint64_t name_relp : 18;
153 uint64_t dummy2 : 28;
156 /* Definition blocks are chained off of segname definitions.
157 segname_definition.first_relp is one of three things:
158 (1) the def section offset of the first ordinary (class^=3) definition
159 belonging to this segname block. In the case where there are more than
160 one segname's on a block, all their first_relp will point
163 (2) if there are no ordinary definitions associated with this segname,
164 then it is the def section offset of the next segname.
166 (3) if there are no ordinary definitions in the block, and it
167 is the last block, then it points to a word containing 0.
169 Thus the end of a list of synonym segnames can be detected by forward_relp
170 pointing to a class=3 definition whose first_relp is not the same as
171 the current definitions first_relp.
174 /* All the definitions are linked through the forward and
175 backward thread variables. The end of the chain can is indicated
176 by forward pointing to a zero word. */
178 // declare exp_ptr pointer;
179 // declare 1 exp_word based (exp_ptr) aligned, /* expression word in link definition */
181 // 2 type_relp fixed bin (18) unsigned unal,
182 // /* pointer (rel to defs) of type pair structure */
183 // 2 expression fixed bin (17) unal; /* constant expression to be added in when snapping link */
184 int64_t expression : 18;
185 uint64_t type_relp : 18;
186 uint64_t dummy1 : 28;
191 // LINK_SELF_BASE init (1), /* *section|0+expression,modifier */
192 // /* which section determined by segname_relp */
194 // LINK_OBSOLETE_2 init (2), /* not used */
196 // LINK_REFNAME_BASE init (3), /* refname|0+expression,modifier */
197 LINK_REFNAME_BASE = 3,
198 // LINK_REFNAME_OFFSETNAME init (4), /* refname|offsetname+expression,modifier */
199 LINK_REFNAME_OFFSETNAME = 4,
200 // LINK_SELF_OFFSETNAME init (5), /* *section|offsetname+expression,modifier */
201 LINK_SELF_OFFSETNAME = 5,
202 // LINK_CREATE_IF_NOT_FOUND init (6), /* OBSOLETE: like LINK_REFNAME_OFFSETNAME except that it will create instead of taking linkage_error */
203 LINK_CREATE_IF_NOT_FOUND = 6,
204 // SECTION_TEXT init (0), /* *text */
206 // SECTION_LINK init (1), /* *link */
208 // SECTION_SYMBOL init (2), /* *symbol */
210 // SECTION_UNUSED init (3), /* reserved */
212 // SECTION_STATIC init (4), /* *static */
214 // SECTION_SYSTEM init (5), /* *system */
216 // SECTION_HEAP init (6) /* *heap */
218 // ) fixed bin (18) unsigned unaligned internal static options (constant);
221 /* use CLASS_NAMES for section names */
223 // declare LINK_TYPE_NAMES (1:6)
224 // init ("absolute in section", "unused", "absolute off of refname",
225 // "symbolic off of refname", "symbolic in section", "symbolic off of refname; create")
226 // character (32) varying internal static options (constant);
227 extern char *link_type_names[6];
229 // declare type_ptr pointer;
230 // declare 1 type_pair based (type_ptr) aligned,/* type pair in link definition */
232 // 2 type fixed bin (18) unsigned unal,
234 // 2 trap_relp fixed bin (18) unsigned unal,
235 // /* pointer (rel to defs) to the trap word */
236 // /* unless LINK_SELF_OFFSETNAME off of *system or create link */
237 uint64_t trap_relp : 18;
239 uint64_t dummy0 : 28;
241 // 2 segname_relp fixed bin (18) unsigned unal,
242 // /* pointer (rel to defs) to ACC reference name for segment referenced,
243 // /*or section code for SELF links */
244 // 2 offsetname_relp fixed bin (18) unsigned unal;
245 // /* for OFFSETNAME links, ACC string of name of location. */
246 // /* for others, must be ZERO */
247 uint64_t offsetname_relp : 18;
248 uint64_t segname_relp : 18;
249 uint64_t dummy1 : 28;
254 // declare link_trap_ptr pointer;
255 // declare 1 link_trap_pair aligned based (link_trap_ptr),
256 struct link_trap_pair {
257 // 2 call_relp fixed bin (18) unsigned unaligned,
258 // /* LINK18, link to thing to call */
259 // 2 info_relp fixed bin (18) unsigned unaligned;
260 // /* LINK18, link to argument list */
261 uint64_t info_relp : 18;
262 uint64_t call_relp : 18;
263 uint64_t dummy0 : 28;
266 /* initialization info for *system or *heap link */
268 /* NOTE --------------------------------------------------
269 the following structures defining initialization information are also
270 defined in fortran_storage.incl.pl1 system_link_init_info.incl.pl1
271 and should be kept equivalent
272 -------------------------------------------------------
277 // INIT_NO_INIT init (0),
279 // INIT_COPY_INFO init (3),
281 // INIT_DEFINE_AREA init (4),
282 INIT_DEFINE_AREA = 4,
283 // INIT_LIST_TEMPLATE init (5),
284 INIT_LIST_TEMPLATE = 5,
285 // INIT_DEFERRED init (6)
287 // ) fixed bin internal static options (constant);
290 /* for type = 0 or 4 */
292 // declare link_init_ptr pointer;
293 // declare 1 link_init aligned based (link_init_ptr),
295 // 2 n_words fixed bin (35), /* number to invent */
296 // 2 type fixed bin; /* see types above */
297 int64_t n_words : 36;
298 uint64_t dummy0 : 28;
299 uint64_t dummy1 : 18;
301 uint64_t dummy2 : 28;
304 /* for type=3, there is data to copy */
306 // declare 1 link_init_copy_info aligned based (link_init_ptr),
307 struct link_init_copy_info {
308 // 2 header aligned like link_init,
309 int64_t header_n_words : 36;
310 uint64_t dummy0 : 28;
311 uint64_t dummy1 : 18;
312 uint64_t header_type : 18;
313 uint64_t dummy2 : 28;
315 // 2 initial_data (link_init_n_words refer (link_init_copy_info.header.n_words)) bit (36) aligned;
316 uint64_t initial_data[];
319 // declare link_init_n_words fixed bin;
321 /* for type = 5, there is a list template to copy */
323 /* A list template consists of a series of entries with the following
324 description, concatenated together. n_bits and datum are bit items,
325 to permit a wide range of inputs.
327 1. A 'repeat' of '0' signifies skipping of 'n_bits' bits.
328 2. A 'n_bits' of '0' signifies the last item of the list.
330 COMMON, VLA's, and LA's are presumed to start at the base pointer
331 of their particular storage section. */
333 // declare 1 list_template_entry aligned based,
334 struct list_template_entry {
335 // 2 n_bits fixed bin (35) aligned, /* size of datum */
336 // 2 mbz bit (3) unaligned, /* future expansion */
337 // 2 init_type fixed bin (3) unsigned unaligned, /* 0 normal init, 1 ptr init, 2 packed ptr init */
338 // 2 repeat fixed bin (30) unsigned unaligned,
339 // /* number of times to repeat datum */
340 // 2 datum bit (link_init_n_bits_in_datum refer (list_template_entry.n_bits));
342 uint64_t dummy0 : 28;
344 uint64_t init_type : 3;
345 uint64_t repeat0 : 24;
346 uint64_t repeat1 : 6;
348 uint64_t dummy1 : 28;
351 // declare 1 link_init_list_template
352 // aligned based (link_init_ptr),
353 struct link_init_list_template {
354 // 2 header aligned like link_init,
355 // 2 pad bit (18) unaligned,
356 int64_t header_n_words : 36;
357 uint64_t dummy0 : 28;
358 uint64_t header_pad_bit : 18;
360 uint64_t header_dummy1 : 28;
362 // 2 n_words_in_list fixed bin (18) unsigned unaligned,
363 uint64_t dummy2 : 18;
364 uint64_t n_words_in_list : 18;
365 uint64_t dummy3 : 28;
367 // 2 template (link_init_n_words_in_list refer (link_init_list_template.n_words_in_list));
368 struct list_template_entry template[];
371 // declare link_init_n_words_in_list
374 /* the pointer_init_template represents the initialization information
375 for ITS and packed pointers. Both pointer types require the entire
379 // dcl 1 pointer_init_template based,
380 struct pointer_init {
381 // 2 ptr_type fixed bin (18) unsigned unaligned, /* 0 text section, 1 linkage section, 2 static section */
382 // 2 section_offset fixed bin (18) unsigned unaligned, /* offset to item in specified section */
383 uint64_t section_offset : 18;
384 uint64_t ptr_type : 18;
385 uint64_t dummy0 : 28;
387 // 2 word_offset fixed bin (18) unsigned unaligned, /* offset from section item to target in words */
388 // 2 mbz bit (12) unaligned,
389 // 2 bit_offset fixed bin (6) unsigned unaligned; /* offset from section item|word offset to target in bits */
390 uint64_t bit_offset : 6;
392 uint64_t word_offset : 18;
393 uint64_t dummy1 : 28;
396 // declare link_init_n_bits_in_datum
399 /* for type = 6, the init_info resides in another MSF component */
400 /* target_relp is a linkage section offset to a partial link to */
401 /* the base of the linkage section of the component containing */
402 /* the actual init_info. link_relp is the offset of the actual */
403 /* link within that linkage section. */
405 // declare 1 link_init_deferred aligned based (link_init_ptr),
406 struct link_init_deferred_aligned {
407 // 2 header aligned like link_init,
408 // 2 target_relp fixed bin (18) unsigned unaligned,
409 int64_t n_words : 36;
410 uint64_t dummy0 : 28;
411 uint64_t target_relp : 18;
413 uint64_t dummy1 : 28;
415 // 2 link_relp fixed bin (18) unsigned unaligned;
416 uint64_t dummy2 : 18;
417 uint64_t link_relp : 18;
418 uint64_t dummy3 : 28;
421 /* Definition section hash table */
423 // declare def_ht_ptr pointer;
424 // declare 1 definition_ht aligned based (def_ht_ptr),
425 struct definition_ht {
426 // 2 n_entries fixed bin,
427 uint64_t dummy0 : 18;
428 int64_t n_entries : 18;
429 uint64_t dummy1 : 28;
431 // 2 table (def_ht_n_entries refer (definition_ht.n_entries)) aligned,
433 // 3 def_relp fixed bin (18) unsigned unaligned,
434 // 3 unused bit (18) unaligned;
435 uint64_t unused : 18;
436 uint64_t def_relp : 18;
437 uint64_t dummy0 : 28;
441 // declare def_ht_n_entries fixed bin;
443 // /* Component name ht */
444 // declare comp_ht_ptr pointer;
445 // declare 1 component_ht aligned based (comp_ht_ptr),
446 struct component_ht {
447 // 2 n_entries fixed bin,
448 uint64_t dummy0 : 18;
449 int64_t n_entries : 18;
450 uint64_t dummy1 : 28;
452 // 2 table (comp_ht_n_entries refer (component_ht.n_entries)) aligned,
454 // 3 def_relp fixed bin (18) unsigned unaligned,
455 // /* hashed segname */
456 // 3 block_hdr_relp fixed bin (18) unsigned unaligned;
457 // /* first segname def of block containing def_relp */
458 uint64_t block_hdr_relp : 18;
459 uint64_t def_relp : 18;
460 uint64_t dummy0 : 28;
464 // declare comp_ht_n_entries fixed bin;
466 /* Duplicate name table */
468 // declare dup_table_ptr pointer;
469 // declare 1 duplicate_table aligned based (dup_table_ptr),
470 struct duplicate_table {
471 // 2 mbz bit (18) unaligned, /* to tell it from a definition */
472 // 2 n_names fixed bin (18) unsigned unaligned,
474 uint64_t n_names : 18;
476 uint64_t dummy0 : 28;
478 // 2 table (dup_table_n_names refer (duplicate_table.n_names)) aligned,
480 // 3 def_relp fixed bin (18) unsigned unaligned,
481 // 3 block_hdr_relp fixed bin (18) unsigned unaligned;
482 uint64_t block_hdr_relp : 18;
483 uint64_t def_relp : 18;
484 uint64_t dummy0 : 28;
488 // declare dup_table_n_names fixed bin;
490 /* The msf_map is found in the definition section of an */
491 /* object MSF component. It is used by the linker to */
492 /* determine whether a segment is a component of an object */
493 /* MSF or a standard single-segment object. */
495 // dcl msf_map_ptr ptr;
496 // dcl 01 msf_map aligned based (msf_map_ptr),
498 // 02 version char (8),
501 // 02 component_count fixed bin (15) unsigned,
502 uint64_t component_count : 15;
503 uint64_t dummy0 : 49;
505 // 02 my_component fixed bin (15) unsigned;
506 uint64_t my_component : 15;
507 uint64_t dummy1 : 49;
510 // dcl msf_map_version_1 char (8) static options (constant)
511 // init ("msfmp1.0");
513 // declare acc_string_ptr pointer;
514 // declare 1 acc_string aligned based (acc_string_ptr),
515 // 2 count fixed bin (9) unsigned unaligned,
516 // 2 string character (max (3, acc_string_length) refer (acc_string.count)) unaligned,
517 // 2 mbz bit (0) aligned; /* this causes the statement */
518 // /* unspec (acc_string) = ""b to zero out */
519 // /* the last word, if the string is not of length 0mod4 */
521 // declare acc_string_length fixed bin (21);