Significant progress to getting pl1$pl1 to compile something, implemented many necess...
[multics_sim.git] / linkdcl.h
1 #ifndef _LINKDCL_H
2 #define _LINKDCL_H
3
4 #include "pointer.h"
5
6 // see pl1/linkdcl.incl.pl1
7
8 // dcl 1 link based aligned, /* link pair in linkage section */
9 struct link {
10   // 2 head_ptr bit (18) unal, /* rel pointer to beginning of linkage section */
11   // 2 ringno bit (3) unal,
12   // 2 mbz bit (6) unal,
13   // 2 run_depth fixed bin (2) unal, /* run unit depth, filled when link is snapped */
14   // 2 ft2 bit (6) unal, /* fault tag. 46(8) if not snapped, 43(8) if snapped */
15   uint64_t ft2 : 6;
16   int64_t run_depth : 3;
17   uint64_t mbz : 6;
18   uint64_t ringno : 3;
19   uint64_t head_ptr : 18;
20   uint64_t dummy0 : 28;
21
22   // 2 exp_ptr bit (18) unal, /* pointer (rel to defs) of expression word */
23   // 2 mbz2 bit (12) unal,
24   // 2 modifier bit (6) unal; /* modifier to be left in snapped link */
25   uint64_t modifier : 6;
26   uint64_t mbz2 : 12;
27   uint64_t exp_ptr : 18;
28   uint64_t dummy1 : 28;
29 };
30
31 #if 0 // avoid conflict with definition_dcls.h
32 // dcl 1 exp_word based aligned, /* expression word in link definition */
33 struct exp_word {
34   // 2 type_ptr bit (18) unal, /* pointer (rel to defs) of type pair structure */
35   // 2 exp bit (18) unal; /* constant expression to be added in when snapping link */
36   uint64_t exp : 18;
37   uint64_t type_ptr : 18;
38   uint64_t dummy0 : 28;
39 };
40
41 // dcl 1 type_pair based aligned, /* type pair in link definition */
42 struct type_pair {
43   // 2 type bit (18) unal, /* type of link. may be 1,2,3,4,5, or 6 */
44   // 2 trap_ptr bit (18) unal, /* pointer (rel to defs) to the trap word */
45   uint64_t trap_ptr : 18;
46   uint64_t type : 18;
47   uint64_t dummy0 : 28;
48
49   // 2 seg_ptr bit (18) unal, /* pointer to ACC reference name for segment referenced */
50   // 2 ext_ptr bit (18) unal; /* pointer (rel to defs) of ACC segdef name */
51   uint64_t ext_ptr : 18;
52   uint64_t seg_ptr : 18;
53   uint64_t dummy1 : 28;
54 };
55 #endif
56
57 // dcl 1 header based aligned, /* linkage block header */
58 struct linkage_header {
59   // 2 def_ptr ptr, /* pointer to definition section */
60   struct its_pointer def_ptr;
61
62   // 2 symbol_ptr ptr unal, /* pointer to symbol section in object segment */
63   struct packed_pointer symbol_ptr;
64
65   // 2 original_linkage_ptr
66   // ptr unal, /* pointer to linkage section in object segment */
67   struct packed_pointer original_linkage_ptr;
68
69   // 2 unused bit (72),
70   uint64_t unused[2];
71
72   // 2 stats,
73   //   3 begin_links bit (18) unal, /* offset (rel to this section) of first link */
74   //   3 block_length bit (18) unal, /* number of words in this linkage section */
75   uint64_t stats_block_length : 18;
76   uint64_t stats_begin_links : 18;
77   uint64_t dummy0 : 28;
78
79   //   3 segment_number
80   // bit (18) unal, /* text segment number associated with this section */
81   //   3 static_length bit (18) unal; /* number of words of static for this segment */
82   uint64_t stats_static_length : 18;
83   uint64_t stats_segment_number : 18;
84   uint64_t dummy1 : 28;
85 };
86
87 // dcl 1 linkage_header_flags
88 // aligned based, /* overlay of def_ptr for flags */
89 struct linkage_header_flags {
90   // 2 pad1 bit (28) unaligned, /* flags are in first word */
91   // 2 static_vlas bit (1) unaligned, /* static section "owns" some LA/VLA segments */
92   // 2 perprocess_static
93   // bit (1) unaligned, /* 1 copy of static section is used by all tasks/run units */
94   // 2 pad2 bit (6) unaligned;
95   uint64_t pad2 : 6;
96   uint64_t perprocess_static : 1;
97   uint64_t static_vlas : 1;
98   uint64_t pad1 : 28;
99   uint64_t dummy0 : 28;
100 };
101
102 // dcl 1 virgin_linkage_header
103 // aligned based, /* template for linkage header in object segment */
104 struct virgin_linkage_header {
105   // 2 pad bit (30) unaligned, /* is filled in by linker */
106   // 2 defs_in_link bit (6) unaligned, /* =o20 if defs in linkage (nonstandard) */
107   uint64_t defs_in_link : 6;
108   uint64_t pad : 30;
109   uint64_t dummy0 : 28;
110
111   // 2 def_offset bit (18) unaligned, /* offset of definition section */
112   // 2 first_ref_relp bit (18) unaligned, /* offset of trap-at-first-reference offset array */
113   uint64_t first_ref_relp : 18;
114   uint64_t def_offset : 18;
115   uint64_t dummy1 : 28;
116
117   // 2 filled_in_later bit (144),
118   uint64_t filled_in_later[4];
119
120   // 2 link_begin bit (18) unaligned, /* offset of first link */
121   // 2 linkage_section_lng
122   // bit (18) unaligned, /* length of linkage section */
123   uint64_t linkage_section_lng : 18;
124   uint64_t link_begin : 18;
125   uint64_t dummy2 : 28;
126
127   // 2 segno_pad bit (18) unaligned, /* will be segment number of copied linkage */
128   // 2 static_length bit (18) unaligned; /* length of static section */
129   uint64_t static_length : 18;
130   uint64_t segno_pad : 18;
131   uint64_t dummy3 : 28;
132 };
133
134 // dcl 1 trap_word based aligned, /* trap word in link definition */
135 struct trap_word {
136   // 2 call_ptr bit (18) unal, /* pointer (rel to link) of link to trap procedure */
137   // 2 arg_ptr bit (18) unal; /* pointer (rel to link) of link to arg info for trap proc */
138   uint64_t arg_ptr : 18;
139   uint64_t call_ptr : 18;
140   uint64_t dummy0 : 28;
141 };
142
143 // dcl 1 name based aligned, /* storage of ASCII names in definitions */
144 //   2 nchars bit (9) unaligned, /* number of characters in name */
145 //   2 char_string char (31) unaligned; /* 31-character name */
146
147 #endif