-
Notifications
You must be signed in to change notification settings - Fork 0
/
dis.m
323 lines (306 loc) · 3.75 KB
/
dis.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
Dis: module
{
PATH: con "/dis/lib/dis.dis";
XMAGIC: con 819248;
SMAGIC: con 923426;
MUSTCOMPILE: con 1<<0;
DONTCOMPILE: con 1<<1;
SHAREMP: con 1<<2;
DYNMOD: con 1<<3;
HASLDT0: con 1<<4;
HASEXCEPT: con 1<<5;
HASLDT: con 1<<6;
AMP: con 16r00; # Src/Dst op addressing
AFP: con 16r01;
AIMM: con 16r02;
AXXX: con 16r03;
AIND: con 16r04;
AMASK: con 16r07;
ARM: con 16rC0; # Middle op addressing
AXNON: con 16r00;
AXIMM: con 16r40;
AXINF: con 16r80;
AXINM: con 16rC0;
DEFZ: con 0;
DEFB: con 1; # Byte
DEFW: con 2; # Word
DEFS: con 3; # Utf-string
DEFF: con 4; # Real value
DEFA: con 5; # Array
DIND: con 6; # Set index
DAPOP: con 7; # Restore address register
DEFL: con 8; # BIG
DMAX: con 1<<4;
Inst: adt
{
op: int;
addr: int;
mid: int;
src: int;
dst: int;
};
Type: adt
{
size: int;
np: int;
map: array of byte;
};
Data: adt
{
op: int; # encoded op
n: int; # number of elements
off: int; # byte offset in data space
pick {
Zero => # DEFZ
Bytes => # DEFB
bytes: array of byte;
Words => # DEFW
words: array of int;
String => # DEFS
str: string;
Reals => # DEFF
reals: array of real;
Array => # DEFA
typex: int;
length: int;
Aindex => # DIND
index: int;
Arestore => # DAPOP
Bigs => # DEFL
bigs: array of big;
}
};
Link: adt
{
pc: int;
desc: int;
sig: int;
name: string;
};
Import: adt
{
sig: int;
name: string;
};
Except: adt
{
s: string;
pc: int;
};
Handler: adt
{
pc1: int;
pc2: int;
eoff: int;
ne: int;
t: ref Type;
etab: array of ref Except;
};
Mod: adt
{
name: string;
srcpath: string;
magic: int;
rt: int;
ssize: int;
isize: int;
dsize: int;
tsize: int;
lsize: int;
entry: int;
entryt: int;
inst: array of ref Inst;
types: array of ref Type;
data: list of ref Data;
links: array of ref Link;
imports: array of array of ref Import;
handlers: array of ref Handler;
sign: array of byte;
};
INOP,
IALT,
INBALT,
IGOTO,
ICALL,
IFRAME,
ISPAWN,
IRUNT,
ILOAD,
IMCALL,
IMSPAWN,
IMFRAME,
IRET,
IJMP,
ICASE,
IEXIT,
INEW,
INEWA,
INEWCB,
INEWCW,
INEWCF,
INEWCP,
INEWCM,
INEWCMP,
ISEND,
IRECV,
ICONSB,
ICONSW,
ICONSP,
ICONSF,
ICONSM,
ICONSMP,
IHEADB,
IHEADW,
IHEADP,
IHEADF,
IHEADM,
IHEADMP,
ITAIL,
ILEA,
IINDX,
IMOVP,
IMOVM,
IMOVMP,
IMOVB,
IMOVW,
IMOVF,
ICVTBW,
ICVTWB,
ICVTFW,
ICVTWF,
ICVTCA,
ICVTAC,
ICVTWC,
ICVTCW,
ICVTFC,
ICVTCF,
IADDB,
IADDW,
IADDF,
ISUBB,
ISUBW,
ISUBF,
IMULB,
IMULW,
IMULF,
IDIVB,
IDIVW,
IDIVF,
IMODW,
IMODB,
IANDB,
IANDW,
IORB,
IORW,
IXORB,
IXORW,
ISHLB,
ISHLW,
ISHRB,
ISHRW,
IINSC,
IINDC,
IADDC,
ILENC,
ILENA,
ILENL,
IBEQB,
IBNEB,
IBLTB,
IBLEB,
IBGTB,
IBGEB,
IBEQW,
IBNEW,
IBLTW,
IBLEW,
IBGTW,
IBGEW,
IBEQF,
IBNEF,
IBLTF,
IBLEF,
IBGTF,
IBGEF,
IBEQC,
IBNEC,
IBLTC,
IBLEC,
IBGTC,
IBGEC,
ISLICEA,
ISLICELA,
ISLICEC,
IINDW,
IINDF,
IINDB,
INEGF,
IMOVL,
IADDL,
ISUBL,
IDIVL,
IMODL,
IMULL,
IANDL,
IORL,
IXORL,
ISHLL,
ISHRL,
IBNEL,
IBLTL,
IBLEL,
IBGTL,
IBGEL,
IBEQL,
ICVTLF,
ICVTFL,
ICVTLW,
ICVTWL,
ICVTLC,
ICVTCL,
IHEADL,
ICONSL,
INEWCL,
ICASEC,
IINDL,
IMOVPC,
ITCMP,
IMNEWZ,
ICVTRF,
ICVTFR,
ICVTWS,
ICVTSW,
ILSRW,
ILSRL,
IECLR,
INEWZ,
INEWAZ,
IRAISE,
ICASEL,
IMULX,
IDIVX,
ICVTXX,
IMULX0,
IDIVX0,
ICVTXX0,
IMULX1,
IDIVX1,
ICVTXX1,
ICVTFX,
ICVTXF,
IEXPW,
IEXPL,
IEXPF,
ISELF,
# add new instructions here
MAXDIS: con iota;
init: fn();
loadobj: fn(file: string): (ref Mod, string);
op2s: fn(op: int): string;
inst2s: fn(ins: ref Inst): string;
src: fn(file: string): string;
};
#
# derived by Vita Nuova Limited 1998 from /appl/wm/rt.b and /include/isa.h, both
# Copyright © 1996-1999 Lucent Technologies Inc. All rights reserved.
#