dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / libdisasm / common / dis_s390x.c
blobbce41c09eccf4ea5e9f7e06c90cb21369ab80a75
1 /*
2 * Copyright 2015-2017 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include <stdio.h>
18 #include <libdisasm.h>
19 #include <sys/sysmacros.h>
20 #include <sys/debug.h>
21 #include <sys/byteorder.h>
23 #include "libdisasm_impl.h"
25 #define ILC2LEN(ilc) (2 * ((ilc) >= 2 ? (ilc) : (ilc) + 1))
27 extern size_t strlen(const char *);
28 extern size_t strlcat(char *, const char *, size_t);
31 * Throughout this file, the instruction format names based on:
32 * SA22-7832-09 z/Architecture Principles of Operation
34 * System/370, ESA/390, and earlier z/Architecture POP use slightly
35 * different names for the formats (the variant names are numeric). For the
36 * sake of simplicity, we use the most detailed definitions - z/Architecture.
38 * For ESA/390 we map the formats:
39 * E -> E
40 * I -> I
41 * RR -> RR
42 * RRE -> RRE
43 * RRF -> RRD & RRFa-e
44 * RX -> RXa-b
45 * RXE -> RXE
46 * RXF -> RXF
47 * RS -> RSa-b
48 * RSE -> RSYa-b
49 * RSL -> RSLa
50 * RSI -> RSI
51 * RI -> RIa-c
52 * RIL -> RILa-c
53 * SI -> SI
54 * S -> S
55 * SS -> SSa-b & SSd-e
56 * SSE -> SSE
58 * For System/370 we map the formats:
59 * RR -> RR
60 * RX -> RXa-b
61 * RS -> RSa-b
62 * SI -> SI
63 * S -> S
64 * SS -> SSa-c
66 * Disassembly begins in tbl_xx. The first byte of the instruction is used
67 * as the index. This yields either an instruction or a sub-table.
69 * If an instruction is encountered, its format field is used to format the
70 * instruction.
72 * There are two types of sub-tables: extended opcode tables (indicated with
73 * IF_TBL) or a multiple mnemonics tables (indicated with IF_MULTI).
75 * Extended opcode tables indicade which additional bits of the instruction
76 * should be inspected. These bits are used as an index into the sub table.
78 * Multiple mnemonic tables are used to print different mnemonics depending
79 * on the architecture. Over the years, certain instructions got a new
80 * preferred mnemonic. For example, 0xa70 is test-under-mask-high (tmh) on
81 * System/390. On z/Architecture systems, the instruction behaves
82 * identically (and the assembler hapilly accepts tmh), but the preferred
83 * mnemonic is tmlh (test-under-mask-low-high) because z/Architecture
84 * extended the general purpose registers from 32 bits to 64 bits. The
85 * current architecture flag (e.g., F_390) is used to index into the
86 * sub-table.
88 * Regardless of which sub-table is encountered, the selected entry in the
89 * sub-table is interpreted using the same rules as the contents of tbl_xx.
91 * Finally, we use the extended opcode sub-table mechanism to pretty print
92 * the branching instructions. All branches are conditional based on a
93 * 4-bit mask indicating which value of the condition code will result in a
94 * taken branch. In order to produce a more human friendly output, we use
95 * the 4-bit mask as an extended opcode to break up the branching
96 * instruction into 16 different ones. For example, instead of printing:
98 * bc 7,0x123(%r1,%r2)
100 * we print:
102 * bne 0x123(%r1,%r2)
104 * Note that we are using designated initializers via the INSTR/TABLE/MULTI
105 * macros and therefore the below tables can be sparse. We rely on unset
106 * entries having zero format fields (aka. IF_INVAL) per C99.
109 /* BEGIN CSTYLED */
110 enum ifmt {
111 /* invalid */
112 IF_INVAL = 0,
114 /* indirection */
115 IF_TBL,
116 IF_MULTI,
118 /* 2-byte */
119 IF_ZERO, /* 370, 390, z */
120 IF_E, /* 390, z */
121 IF_I, /* 390, z */
122 IF_RR, /* 370, 390, z */
124 /* 4-byte */
125 IF_DIAG, /* 370, 390, z */
126 IF_IE, /* z */
127 IF_RIa, /* 390, z */
128 IF_RIb, /* 390, z */
129 IF_RIc, /* 390, z */
130 IF_RRD, /* 390, z */ /* on 390 these are RRF */
131 IF_RRE, /* 390, z */
132 IF_RRFa, /* 390, z */
133 IF_RRFb, /* 390, z */
134 IF_RRFc, /* 390, z */
135 IF_RRFd, /* 390, z */
136 IF_RRFe, /* 390, z */
137 IF_RSa, /* 370, 390, z */
138 IF_RSb, /* 370, 390, z */
139 IF_RSI, /* 390, z */
140 IF_RXa, /* 370, 390, z */
141 IF_RXb, /* 370, 390, z */
142 IF_S, /* 370, 390, z */
143 IF_SI, /* 370, 390, z */
145 /* 6-byte */
146 IF_MII, /* z */
147 IF_RIEa, /* z */
148 IF_RIEb, /* z */
149 IF_RIEc, /* z */
150 IF_RIEd, /* z */
151 IF_RIEe, /* z */
152 IF_RIEf, /* z */
153 IF_RILa, /* 390, z */
154 IF_RILb, /* 390, z */
155 IF_RILc, /* 390, z */
156 IF_RIS, /* z */
157 IF_RRS, /* z */
158 IF_RSLa, /* 390, z */
159 IF_RSLb, /* z */
160 IF_RSYa, /* z */
161 IF_RSYb, /* z */
162 IF_RXE, /* 390, z */
163 IF_RXF, /* 390, z */
164 IF_RXYa, /* z */
165 IF_RXYb, /* z */
166 IF_SIL, /* z */
167 IF_SIY, /* z */
168 IF_SMI, /* z */
169 IF_SSa, /* 370, 390, z */
170 IF_SSb, /* 370, 390, z */
171 IF_SSc, /* 370, 390, z */
172 IF_SSd, /* 390, z */
173 IF_SSe, /* 390, z */
174 IF_SSf, /* 390, z */
175 IF_SSE, /* 390, z */
176 IF_SSF, /* z */
179 #define IF_NFMTS (IF_SSF + 1)
181 #define F_370 0x0001 /* 370 */
182 #define F_390 0x0002 /* 390 */
183 #define F_Z 0x0004 /* z */
184 #define F_SIGNED_IMM 0x0010 /* 370, 390, z */
185 #define F_CTL_REG 0x0020 /* 370, 390, z */
186 #define F_HIDE_MASK 0x0040 /* 370, 390, z */
187 #define F_R1_IS_MASK 0x0080 /* 370, 390, z */
188 /* END CSTYLED */
190 struct inst_table {
191 union {
192 struct {
193 const char *it_name;
194 unsigned it_flags;
195 } it_inst;
196 struct {
197 const struct inst_table *it_ptr;
198 uint8_t it_off:4;
199 uint8_t it_shift:4;
200 uint8_t it_mask;
201 } it_table;
202 struct {
203 const struct inst_table *it_ptr;
204 } it_multi;
205 } it_u;
206 enum ifmt it_fmt;
209 #define BITFLD(a, b) DECL_BITFIELD2(b:4, a:4)
211 union inst {
212 uint8_t raw[6];
213 struct {
214 uint8_t op;
215 uint8_t par1;
216 uint16_t par2;
217 } diag;
218 struct {
219 uint8_t op;
220 uint8_t i;
221 } i;
222 struct {
223 uint16_t op;
224 uint8_t pad;
225 BITFLD(i1, i2);
226 } ie;
227 struct {
228 uint8_t op;
229 BITFLD(m1, ri2h);
230 uint8_t ri2l;
231 uint8_t ri3h;
232 uint16_t ri3l;
233 } mii;
234 struct {
235 uint8_t op;
236 BITFLD(r1, r2);
237 } rr;
238 struct {
239 uint16_t op;
240 BITFLD(r1, pad);
241 BITFLD(r3, r2);
242 } rrd;
243 struct {
244 uint16_t op;
245 uint8_t pad;
246 BITFLD(r1, r2);
247 } rre;
248 struct {
249 uint16_t op;
250 BITFLD(r1, m4);
251 BITFLD(r3, r2);
252 } rrf_ab;
253 struct {
254 uint16_t op;
255 BITFLD(m3, m4);
256 BITFLD(r1, r2);
257 } rrf_cde;
258 struct {
259 uint8_t op1;
260 BITFLD(r1, r2);
261 BITFLD(b4, d4h);
262 uint8_t d4l;
263 BITFLD(m3, pad);
264 uint8_t op2;
265 } rrs;
266 struct {
267 uint8_t op;
268 BITFLD(r1, x2);
269 BITFLD(b2, d2h);
270 uint8_t d2l;
271 } rx_a;
272 struct {
273 uint8_t op;
274 BITFLD(m1, x2);
275 BITFLD(b2, d2h);
276 uint8_t d2l;
277 } rx_b;
278 struct {
279 uint8_t op1;
280 BITFLD(r1, x2);
281 BITFLD(b2, d2h);
282 uint8_t d2l;
283 uint8_t pad;
284 uint8_t op2;
285 } rxe;
286 struct {
287 uint8_t op1;
288 BITFLD(r3, x2);
289 BITFLD(b2, d2h);
290 uint8_t d2l;
291 BITFLD(r1, pad);
292 uint8_t op2;
293 } rxf;
294 struct {
295 uint8_t op1;
296 BITFLD(r1, x2);
297 BITFLD(b2, dl2h);
298 uint8_t dl2l;
299 uint8_t dh2;
300 uint8_t op2;
301 } rxy_a;
302 struct {
303 uint8_t op1;
304 BITFLD(m1, x2);
305 BITFLD(b2, dl2h);
306 uint8_t dl2l;
307 uint8_t dh2;
308 uint8_t op2;
309 } rxy_b;
310 struct {
311 uint8_t op;
312 BITFLD(r1, r3);
313 BITFLD(b2, d2h);
314 uint8_t d2l;
315 } rs_a;
316 struct {
317 uint8_t op;
318 BITFLD(r1, m3);
319 BITFLD(b2, d2h);
320 uint8_t d2l;
321 } rs_b;
322 struct {
323 uint8_t op1;
324 BITFLD(l1, pad1);
325 BITFLD(b1, d1h);
326 uint8_t d1l;
327 uint8_t pad2;
328 uint8_t op2;
329 } rsl_a;
330 struct {
331 uint8_t op1;
332 uint8_t l2;
333 BITFLD(b2, d2h);
334 uint8_t d2l;
335 BITFLD(r1, m3);
336 uint8_t op2;
337 } rsl_b;
338 struct {
339 uint8_t op;
340 BITFLD(r1, r3);
341 uint16_t ri2;
342 } rsi;
343 struct {
344 uint8_t op1;
345 BITFLD(r1, r3);
346 BITFLD(b2, dl2h);
347 uint8_t dl2l;
348 uint8_t dh2;
349 uint8_t op2;
350 } rsy_a;
351 struct {
352 uint8_t op1;
353 BITFLD(r1, m3);
354 BITFLD(b2, dl2h);
355 uint8_t dl2l;
356 uint8_t dh2;
357 uint8_t op2;
358 } rsy_b;
359 struct {
360 uint8_t op1;
361 BITFLD(r1, op2);
362 uint16_t i2;
363 } ri_a;
364 struct {
365 uint8_t op1;
366 BITFLD(r1, op2);
367 uint16_t ri2;
368 } ri_b;
369 struct {
370 uint8_t op1;
371 BITFLD(m1, op2);
372 uint16_t ri2;
373 } ri_c;
374 struct {
375 uint8_t op1;
376 BITFLD(r1, _pad0);
377 uint16_t i2;
378 BITFLD(m3, _pad1);
379 uint8_t op2;
380 } rie_a;
381 struct {
382 uint8_t op1;
383 BITFLD(r1, r2);
384 uint16_t ri4;
385 BITFLD(m3, _pad);
386 uint8_t op2;
387 } rie_b;
388 struct {
389 uint8_t op1;
390 BITFLD(r1, m3);
391 uint16_t ri4;
392 uint8_t i2;
393 uint8_t op2;
394 } rie_c;
395 struct {
396 uint8_t op1;
397 BITFLD(r1, r3);
398 uint16_t i2;
399 uint8_t _pad;
400 uint8_t op2;
401 } rie_d;
402 struct {
403 uint8_t op1;
404 BITFLD(r1, r3);
405 uint16_t ri2;
406 uint8_t _pad;
407 uint8_t op2;
408 } rie_e;
409 struct {
410 uint8_t op1;
411 BITFLD(r1, r2);
412 uint8_t i3;
413 uint8_t i4;
414 uint8_t i5;
415 uint8_t op2;
416 } rie_f;
417 struct {
418 uint8_t op1;
419 BITFLD(r1, op2);
420 uint16_t i2h;
421 uint16_t i2l;
422 } ril_a;
423 struct {
424 uint8_t op1;
425 BITFLD(r1, op2);
426 uint16_t ri2h;
427 uint16_t ri2l;
428 } ril_b;
429 struct {
430 uint8_t op1;
431 BITFLD(m1, op2);
432 uint16_t ri2h;
433 uint16_t ri2l;
434 } ril_c;
435 struct {
436 uint8_t op1;
437 BITFLD(r1, m3);
438 BITFLD(b4, d4h);
439 uint8_t d4l;
440 uint8_t i2;
441 uint8_t op2;
442 } ris;
443 struct {
444 uint8_t op;
445 uint8_t i2;
446 BITFLD(b1, d1h);
447 uint8_t d1l;
448 } si;
449 struct {
450 uint16_t op;
451 BITFLD(b1, d1h);
452 uint8_t d1l;
453 uint16_t i2;
454 } sil;
455 struct {
456 uint8_t op1;
457 uint8_t i2;
458 BITFLD(b1, dl1h);
459 uint8_t dl1l;
460 uint8_t dh1;
461 uint8_t op2;
462 } siy;
463 struct {
464 uint8_t op;
465 BITFLD(m1, pad);
466 BITFLD(b3, d3h);
467 uint8_t d3l;
468 uint16_t ri2;
469 } smi;
470 struct {
471 uint8_t op1;
472 uint8_t op2;
473 BITFLD(b2, d2h);
474 uint8_t d2l;
475 } s;
476 struct {
477 uint8_t op;
478 uint8_t l;
479 BITFLD(b1, d1h);
480 uint8_t d1l;
481 BITFLD(b2, d2h);
482 uint8_t d2l;
483 } ss_a;
484 struct {
485 uint8_t op;
486 BITFLD(l1, l2);
487 BITFLD(b1, d1h);
488 uint8_t d1l;
489 BITFLD(b2, d2h);
490 uint8_t d2l;
491 } ss_b;
492 struct {
493 uint8_t op;
494 BITFLD(l1, i3);
495 BITFLD(b1, d1h);
496 uint8_t d1l;
497 BITFLD(b2, d2h);
498 uint8_t d2l;
499 } ss_c;
500 struct {
501 uint8_t op;
502 BITFLD(r1, r3);
503 BITFLD(b1, d1h);
504 uint8_t d1l;
505 BITFLD(b2, d2h);
506 uint8_t d2l;
507 } ss_d;
508 struct {
509 uint8_t op;
510 BITFLD(r1, r3);
511 BITFLD(b2, d2h);
512 uint8_t d2l;
513 BITFLD(b4, d4h);
514 uint8_t d4l;
515 } ss_e;
516 struct {
517 uint8_t op;
518 uint8_t l2;
519 BITFLD(b1, d1h);
520 uint8_t d1l;
521 BITFLD(b2, d2h);
522 uint8_t d2l;
523 } ss_f;
524 struct {
525 uint16_t op;
526 BITFLD(b1, d1h);
527 uint8_t d1l;
528 BITFLD(b2, d2h);
529 uint8_t d2l;
530 } sse;
531 struct {
532 uint8_t op1;
533 BITFLD(r3, op2);
534 BITFLD(b1, d1h);
535 uint8_t d1l;
536 BITFLD(b2, d2h);
537 uint8_t d2l;
538 } ssf;
541 #define INSTR(op, m, fm, fl) [op] = { \
542 .it_u.it_inst = { \
543 .it_name = (m), \
544 .it_flags = (fl), \
545 }, \
546 .it_fmt = (fm), \
548 #define TABLE(op, tbl, o, s, m) [op] = { \
549 .it_u.it_table = { \
550 .it_ptr = (tbl), \
551 .it_off = (o), \
552 .it_shift = (s), \
553 .it_mask = (m), \
554 }, \
555 .it_fmt = IF_TBL, \
557 #define MULTI(op, tbl) [op] = { \
558 .it_u.it_multi.it_ptr = (tbl), \
559 .it_fmt = IF_MULTI, \
563 * Instruction tables based on:
564 * GA22-7000-4 System/370 Principles of Operation
565 * SA22-7201-08 ESA/390 Principles of Operation
566 * SA22-7832-09 z/Architecture Principles of Operation
569 /* BEGIN CSTYLED */
570 static const struct inst_table tbl_01xx[256] = {
571 INSTR(0x01, "pr", IF_E, F_390 | F_Z),
572 INSTR(0x02, "upt", IF_E, F_390 | F_Z),
573 INSTR(0x04, "ptff", IF_E, F_Z),
574 INSTR(0x07, "sckpf", IF_E, F_390 | F_Z),
575 INSTR(0x0a, "pfpo", IF_E, F_Z),
576 INSTR(0x0b, "tam", IF_E, F_390 | F_Z),
577 INSTR(0x0c, "sam24", IF_E, F_390 | F_Z),
578 INSTR(0x0d, "sam31", IF_E, F_390 | F_Z),
579 INSTR(0x0e, "sam64", IF_E, F_Z),
580 INSTR(0xff, "trap2", IF_E, F_390 | F_Z),
583 static const struct inst_table tbl_07[] = {
584 INSTR(0x0, "nopr", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
585 INSTR(0x1, "bor", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
586 INSTR(0x2, "bhr", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
587 INSTR(0x3, "bcr", IF_RR, F_370 | F_390 | F_Z | F_R1_IS_MASK),
588 INSTR(0x4, "blr", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
589 INSTR(0x5, "bcr", IF_RR, F_370 | F_390 | F_Z | F_R1_IS_MASK),
590 INSTR(0x6, "bcr", IF_RR, F_370 | F_390 | F_Z | F_R1_IS_MASK),
591 INSTR(0x7, "bnzr", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
592 INSTR(0x8, "ber", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
593 INSTR(0x9, "bcr", IF_RR, F_370 | F_390 | F_Z | F_R1_IS_MASK),
594 INSTR(0xa, "bcr", IF_RR, F_370 | F_390 | F_Z | F_R1_IS_MASK),
595 INSTR(0xb, "bner", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
596 INSTR(0xc, "bcr", IF_RR, F_370 | F_390 | F_Z | F_R1_IS_MASK),
597 INSTR(0xd, "bnhr", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
598 INSTR(0xe, "bnor", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
599 INSTR(0xf, "br", IF_RR, F_370 | F_390 | F_Z | F_HIDE_MASK),
602 static const struct inst_table tbl_47[] = {
603 INSTR(0x0, "nop", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
604 INSTR(0x1, "bo", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
605 INSTR(0x2, "bh", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
606 INSTR(0x3, "bc", IF_RXb, F_370 | F_390 | F_Z),
607 INSTR(0x4, "bl", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
608 INSTR(0x5, "bc", IF_RXb, F_370 | F_390 | F_Z),
609 INSTR(0x6, "bc", IF_RXb, F_370 | F_390 | F_Z),
610 INSTR(0x7, "bne", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
611 INSTR(0x8, "be", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
612 INSTR(0x9, "bc", IF_RXb, F_370 | F_390 | F_Z),
613 INSTR(0xa, "bc", IF_RXb, F_370 | F_390 | F_Z),
614 INSTR(0xb, "bnl", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
615 INSTR(0xc, "bc", IF_RXb, F_370 | F_390 | F_Z),
616 INSTR(0xd, "bnh", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
617 INSTR(0xe, "bno", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
618 INSTR(0xf, "b", IF_RXb, F_370 | F_390 | F_Z | F_HIDE_MASK),
621 /* the preferred mnemonic changed over time */
622 static const struct inst_table tbl_25[] = {
623 INSTR(F_370, "lrdr", IF_RR, F_370),
624 INSTR(F_390, "ldxr", IF_RR, F_390),
625 INSTR(F_Z, "ldxr", IF_RR, F_Z),
628 /* the preferred mnemonic changed over time */
629 static const struct inst_table tbl_35[] = {
630 INSTR(F_370, "lrer", IF_RR, F_370),
631 INSTR(F_390, "ledr", IF_RR, F_390),
632 INSTR(F_Z, "ledr", IF_RR, F_Z),
635 /* the preferred mnemonic changed over time */
636 static const struct inst_table tbl_3c[] = {
637 INSTR(F_370, "mer", IF_RR, F_370),
638 INSTR(F_390, "mder", IF_RR, F_390),
639 INSTR(F_Z, "mder", IF_RR, F_Z),
642 /* the preferred mnemonic changed over time */
643 static const struct inst_table tbl_7c[] = {
644 INSTR(F_370, "me", IF_RXa, F_370),
645 INSTR(F_390, "mde", IF_RXa, F_390),
646 INSTR(F_Z, "mde", IF_RXa, F_Z),
649 /* the meaning of this instruction changed over time */
650 static const struct inst_table tbl_84[] = {
651 INSTR(F_370, "wrd", IF_SI, F_370),
652 INSTR(F_390, "brxh", IF_RSI, F_390),
653 INSTR(F_Z, "brxh", IF_RSI, F_Z),
656 /* the meaning of this instruction changed over time */
657 static const struct inst_table tbl_85[] = {
658 INSTR(F_370, "rdd", IF_SI, F_370),
659 INSTR(F_390, "brxle", IF_RSI, F_390),
660 INSTR(F_Z, "brxle", IF_RSI, F_Z),
663 static const struct inst_table tbl_a5x[16] = {
664 INSTR(0x0, "iihh", IF_RIa, F_Z),
665 INSTR(0x1, "iihl", IF_RIa, F_Z),
666 INSTR(0x2, "iilh", IF_RIa, F_Z),
667 INSTR(0x3, "iill", IF_RIa, F_Z),
668 INSTR(0x4, "nihh", IF_RIa, F_Z),
669 INSTR(0x5, "nihl", IF_RIa, F_Z),
670 INSTR(0x6, "nilh", IF_RIa, F_Z),
671 INSTR(0x7, "nill", IF_RIa, F_Z),
672 INSTR(0x8, "oihh", IF_RIa, F_Z),
673 INSTR(0x9, "oihl", IF_RIa, F_Z),
674 INSTR(0xa, "oilh", IF_RIa, F_Z),
675 INSTR(0xb, "oill", IF_RIa, F_Z),
676 INSTR(0xc, "llihh", IF_RIa, F_Z),
677 INSTR(0xd, "llihl", IF_RIa, F_Z),
678 INSTR(0xe, "llilh", IF_RIa, F_Z),
679 INSTR(0xf, "llill", IF_RIa, F_Z),
682 /* the preferred mnemonic changed over time */
683 static const struct inst_table tbl_a70[] = {
684 INSTR(F_390, "tmh", IF_RIa, F_390),
685 INSTR(F_Z, "tmlh", IF_RIa, F_Z),
688 /* the preferred mnemonic changed over time */
689 static const struct inst_table tbl_a71[] = {
690 INSTR(F_390, "tml", IF_RIa, F_390),
691 INSTR(F_Z, "tmll", IF_RIa, F_Z),
694 static const struct inst_table tbl_a74[16] = {
695 INSTR(0x0, "jnop", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
696 INSTR(0x1, "jo", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
697 INSTR(0x2, "jh", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
698 INSTR(0x3, "brc", IF_RIc, F_390 | F_Z),
699 INSTR(0x4, "jl", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
700 INSTR(0x5, "brc", IF_RIc, F_390 | F_Z),
701 INSTR(0x6, "brc", IF_RIc, F_390 | F_Z),
702 INSTR(0x7, "jne", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
703 INSTR(0x8, "je", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
704 INSTR(0x9, "brc", IF_RIc, F_390 | F_Z),
705 INSTR(0xa, "brc", IF_RIc, F_390 | F_Z),
706 INSTR(0xb, "jnl", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
707 INSTR(0xc, "brc", IF_RIc, F_390 | F_Z),
708 INSTR(0xd, "jnh", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
709 INSTR(0xe, "jno", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
710 INSTR(0xf, "j", IF_RIc, F_390 | F_Z | F_HIDE_MASK),
713 static const struct inst_table tbl_a7x[16] = {
714 MULTI(0x0, tbl_a70),
715 MULTI(0x1, tbl_a71),
716 INSTR(0x2, "tmhh", IF_RIa, F_Z),
717 INSTR(0x3, "tmhl", IF_RIa, F_Z),
718 TABLE(0x4, tbl_a74, 1, 4, 0x0f),
719 INSTR(0x5, "bras", IF_RIb, F_390 | F_Z),
720 INSTR(0x6, "brct", IF_RIb, F_390 | F_Z),
721 INSTR(0x7, "brctg", IF_RIb, F_Z),
722 INSTR(0x8, "lhi", IF_RIa, F_390 | F_Z),
723 INSTR(0x9, "lghi", IF_RIa, F_Z),
724 INSTR(0xa, "ahi", IF_RIa, F_390 | F_Z | F_SIGNED_IMM),
725 INSTR(0xb, "aghi", IF_RIa, F_Z | F_SIGNED_IMM),
726 INSTR(0xc, "mhi", IF_RIa, F_390 | F_Z),
727 INSTR(0xd, "mghi", IF_RIa, F_Z),
728 INSTR(0xe, "chi", IF_RIa, F_390 | F_Z | F_SIGNED_IMM),
729 INSTR(0xf, "cghi", IF_RIa, F_Z | F_SIGNED_IMM),
732 static const struct inst_table tbl_b2a6[] = {
733 INSTR(F_390, "cuutf", IF_RRFc, F_390),
734 INSTR(F_Z, "c21", IF_RRFc, F_Z),
737 static const struct inst_table tbl_b2a7[] = {
738 INSTR(F_390, "cutfu", IF_RRFc, F_390),
739 INSTR(F_Z, "cu12", IF_RRFc, F_Z),
742 static const struct inst_table tbl_b2xx[256] = {
743 INSTR(0x02, "stidp", IF_S, F_370 | F_390 | F_Z),
744 INSTR(0x04, "sck", IF_S, F_370 | F_390 | F_Z),
745 INSTR(0x05, "stck", IF_S, F_370 | F_390 | F_Z),
746 INSTR(0x06, "sckc", IF_S, F_370 | F_390 | F_Z),
747 INSTR(0x07, "stckc", IF_S, F_370 | F_390 | F_Z),
748 INSTR(0x08, "spt", IF_S, F_370 | F_390 | F_Z),
749 INSTR(0x09, "stpt", IF_S, F_370 | F_390 | F_Z),
750 INSTR(0x0a, "spka", IF_S, F_370 | F_390 | F_Z),
751 INSTR(0x0b, "ipk", IF_S, F_370 | F_390 | F_Z),
752 INSTR(0x0d, "ptlb", IF_S, F_370 | F_390 | F_Z),
753 INSTR(0x10, "spx", IF_S, F_370 | F_390 | F_Z),
754 INSTR(0x11, "stpx", IF_S, F_370 | F_390 | F_Z),
755 INSTR(0x12, "stap", IF_S, F_370 | F_390 | F_Z),
756 INSTR(0x13, "rrb", IF_S, F_370),
757 INSTR(0x14, "sie", IF_S, F_390 | F_Z),
758 INSTR(0x18, "pc", IF_S, F_390 | F_Z),
759 INSTR(0x19, "sac", IF_S, F_390 | F_Z),
760 INSTR(0x1a, "cfc", IF_S, F_390 | F_Z),
761 INSTR(0x21, "ipte", IF_RRE, F_390 | F_Z),
762 INSTR(0x22, "ipm", IF_RRE, F_390 | F_Z),
763 INSTR(0x23, "ivsk", IF_RRE, F_390 | F_Z),
764 INSTR(0x24, "iac", IF_RRE, F_390 | F_Z),
765 INSTR(0x25, "ssar", IF_RRE, F_390 | F_Z),
766 INSTR(0x26, "epar", IF_RRE, F_390 | F_Z),
767 INSTR(0x27, "esar", IF_RRE, F_390 | F_Z),
768 INSTR(0x28, "pt", IF_RRE, F_390 | F_Z),
769 INSTR(0x29, "iske", IF_RRE, F_390 | F_Z),
770 INSTR(0x2a, "rrbe", IF_RRE, F_390 | F_Z),
771 INSTR(0x2b, "sske", IF_RRFc, F_390 | F_Z),
772 INSTR(0x2c, "tb", IF_RRE, F_390 | F_Z),
773 INSTR(0x2d, "dxr", IF_RRE, F_390 | F_Z),
774 INSTR(0x2e, "pgin", IF_RRE, F_390 | F_Z),
775 INSTR(0x2f, "pgout", IF_RRE, F_390 | F_Z),
776 INSTR(0x30, "csch", IF_S, F_Z),
777 INSTR(0x31, "hsch", IF_S, F_Z),
778 INSTR(0x32, "msch", IF_S, F_Z),
779 INSTR(0x33, "ssch", IF_S, F_Z),
780 INSTR(0x34, "stsch", IF_S, F_Z),
781 INSTR(0x35, "tsch", IF_S, F_Z),
782 INSTR(0x36, "tpi", IF_S, F_Z),
783 INSTR(0x37, "sal", IF_S, F_Z),
784 INSTR(0x38, "rsch", IF_S, F_Z),
785 INSTR(0x39, "stcrw", IF_S, F_Z),
786 INSTR(0x3a, "stcps", IF_S, F_Z),
787 INSTR(0x3b, "rchp", IF_S, F_Z),
788 INSTR(0x3d, "schm", IF_S, F_Z),
789 INSTR(0x40, "bakr", IF_RRE, F_390 | F_Z),
790 INSTR(0x41, "cksm", IF_RRE, F_390 | F_Z),
791 INSTR(0x44, "sqdr", IF_RRE, F_390 | F_Z),
792 INSTR(0x45, "sqer", IF_RRE, F_390 | F_Z),
793 INSTR(0x46, "stura", IF_RRE, F_390 | F_Z),
794 INSTR(0x47, "msta", IF_RRE, F_390 | F_Z),
795 INSTR(0x48, "palb", IF_RRE, F_390 | F_Z),
796 INSTR(0x49, "ereg", IF_RRE, F_390 | F_Z),
797 INSTR(0x4a, "esta", IF_RRE, F_390 | F_Z),
798 INSTR(0x4b, "lura", IF_RRE, F_390 | F_Z),
799 INSTR(0x4c, "tar", IF_RRE, F_390 | F_Z),
800 INSTR(0x4d, "cpya", IF_RRE, F_390 | F_Z),
801 INSTR(0x4e, "sar", IF_RRE, F_390 | F_Z),
802 INSTR(0x4f, "ear", IF_RRE, F_390 | F_Z),
803 INSTR(0x50, "csp", IF_RRE, F_390 | F_Z),
804 INSTR(0x52, "msr", IF_RRE, F_390 | F_Z),
805 INSTR(0x54, "mvpg", IF_RRE, F_390 | F_Z),
806 INSTR(0x55, "mvst", IF_RRE, F_390 | F_Z),
807 INSTR(0x57, "cuse", IF_RRE, F_390 | F_Z),
808 INSTR(0x58, "bsg", IF_RRE, F_390 | F_Z),
809 INSTR(0x5a, "bsa", IF_RRE, F_390 | F_Z),
810 INSTR(0x5d, "clst", IF_RRE, F_390 | F_Z),
811 INSTR(0x5e, "srst", IF_RRE, F_390 | F_Z),
812 INSTR(0x63, "cmpsc", IF_RRE, F_Z),
813 INSTR(0x76, "xsch", IF_S, F_Z),
814 INSTR(0x77, "rp", IF_S, F_390 | F_Z),
815 INSTR(0x78, "stcke", IF_S, F_390 | F_Z),
816 INSTR(0x79, "sacf", IF_S, F_390 | F_Z),
817 INSTR(0x7c, "stckf", IF_S, F_Z),
818 INSTR(0x7d, "stsi", IF_S, F_390 | F_Z),
819 INSTR(0x99, "srnm", IF_S, F_390 | F_Z),
820 INSTR(0x9c, "stfpc", IF_S, F_390 | F_Z),
821 INSTR(0x9d, "lfpc", IF_S, F_390 | F_Z),
822 INSTR(0xa5, "tre", IF_RRE, F_390 | F_Z),
823 MULTI(0xa6, tbl_b2a6),
824 MULTI(0xa7, tbl_b2a7),
825 INSTR(0xb0, "stfle", IF_S, F_Z),
826 INSTR(0xb1, "stfl", IF_S, F_390 | F_Z),
827 INSTR(0xb2, "lpswe", IF_S, F_Z),
828 INSTR(0xb8, "srnmb", IF_S, F_Z),
829 INSTR(0xb9, "srnmt", IF_S, F_Z),
830 INSTR(0xbd, "lfas", IF_S, F_Z),
831 INSTR(0xe8, "ppa", IF_RRFc, F_Z),
832 INSTR(0xec, "etnd", IF_RRE, F_Z),
833 INSTR(0xf8, "tend", IF_S, F_Z),
834 INSTR(0xfa, "niai", IF_IE, F_Z),
835 INSTR(0xfc, "tabort", IF_S, F_Z),
836 INSTR(0xff, "trap4", IF_S, F_390 | F_Z),
839 static const struct inst_table tbl_b344[] = {
840 INSTR(F_390, "ledbr", IF_RRE, F_390),
841 INSTR(F_Z, "ledbra", IF_RRFe, F_Z),
844 static const struct inst_table tbl_b345[] = {
845 INSTR(F_390, "ldxbr", IF_RRE, F_390),
846 INSTR(F_Z, "ldxbra", IF_RRFe, F_Z),
849 static const struct inst_table tbl_b346[] = {
850 INSTR(F_390, "lexbr", IF_RRE, F_390),
851 INSTR(F_Z, "lexbra", IF_RRFe, F_Z),
854 static const struct inst_table tbl_b347[] = {
855 INSTR(F_390, "fixbr", IF_RRFe, F_390),
856 INSTR(F_Z, "fixbra", IF_RRFe, F_Z),
859 static const struct inst_table tbl_b357[] = {
860 INSTR(F_390, "fiebr", IF_RRFe, F_390),
861 INSTR(F_Z, "fiebre", IF_RRFe, F_Z),
864 static const struct inst_table tbl_b35f[] = {
865 INSTR(F_390, "fidbr", IF_RRFe, F_390),
866 INSTR(F_Z, "fidbra", IF_RRFe, F_Z),
869 static const struct inst_table tbl_b394[] = {
870 INSTR(F_390, "cefbr", IF_RRE, F_390),
871 INSTR(F_Z, "cefbra", IF_RRFe, F_Z),
874 static const struct inst_table tbl_b395[] = {
875 INSTR(F_390, "cdfbr", IF_RRE, F_390),
876 INSTR(F_Z, "cdfbra", IF_RRFe, F_Z),
879 static const struct inst_table tbl_b396[] = {
880 INSTR(F_390, "cxfbr", IF_RRE, F_390),
881 INSTR(F_Z, "cxfbra", IF_RRFe, F_Z),
884 static const struct inst_table tbl_b398[] = {
885 INSTR(F_390, "cfebr", IF_RRFe, F_390),
886 INSTR(F_Z, "cfebra", IF_RRFe, F_Z),
889 static const struct inst_table tbl_b399[] = {
890 INSTR(F_390, "cfdbr", IF_RRFe, F_390),
891 INSTR(F_Z, "cfdbra", IF_RRFe, F_Z),
894 static const struct inst_table tbl_b39a[] = {
895 INSTR(F_390, "cfxbr", IF_RRFe, F_390),
896 INSTR(F_Z, "cfxbra", IF_RRFe, F_Z),
899 static const struct inst_table tbl_b3xx[256] = {
900 INSTR(0x00, "lpebr", IF_RRE, F_390 | F_Z),
901 INSTR(0x01, "lnebr", IF_RRE, F_390 | F_Z),
902 INSTR(0x02, "ltebr", IF_RRE, F_390 | F_Z),
903 INSTR(0x03, "lcebr", IF_RRE, F_390 | F_Z),
904 INSTR(0x04, "ldebr", IF_RRE, F_390 | F_Z),
905 INSTR(0x05, "lxdbr", IF_RRE, F_390 | F_Z),
906 INSTR(0x06, "lxebr", IF_RRE, F_390 | F_Z),
907 INSTR(0x07, "mxdbr", IF_RRE, F_390 | F_Z),
908 INSTR(0x08, "kebr", IF_RRE, F_390 | F_Z),
909 INSTR(0x09, "cebr", IF_RRE, F_390 | F_Z),
910 INSTR(0x0a, "aebr", IF_RRE, F_390 | F_Z),
911 INSTR(0x0b, "sebr", IF_RRE, F_390 | F_Z),
912 INSTR(0x0c, "mdebr", IF_RRE, F_390 | F_Z),
913 INSTR(0x0d, "debr", IF_RRE, F_390 | F_Z),
914 INSTR(0x0e, "maebr", IF_RRD, F_390 | F_Z),
915 INSTR(0x0f, "msebr", IF_RRD, F_390 | F_Z),
916 INSTR(0x10, "lpdbr", IF_RRE, F_390 | F_Z),
917 INSTR(0x11, "lndbr", IF_RRE, F_390 | F_Z),
918 INSTR(0x12, "ltdbr", IF_RRE, F_390 | F_Z),
919 INSTR(0x13, "lcdbr", IF_RRE, F_390 | F_Z),
920 INSTR(0x14, "sqebr", IF_RRE, F_390 | F_Z),
921 INSTR(0x15, "sqdbr", IF_RRE, F_390 | F_Z),
922 INSTR(0x16, "sqxbr", IF_RRE, F_390 | F_Z),
923 INSTR(0x17, "meebr", IF_RRE, F_390 | F_Z),
924 INSTR(0x18, "kdbr", IF_RRE, F_390 | F_Z),
925 INSTR(0x19, "cdbr", IF_RRE, F_390 | F_Z),
926 INSTR(0x1a, "adbr", IF_RRE, F_390 | F_Z),
927 INSTR(0x1b, "sdbr", IF_RRE, F_390 | F_Z),
928 INSTR(0x1c, "mdbr", IF_RRE, F_390 | F_Z),
929 INSTR(0x1d, "ddbr", IF_RRE, F_390 | F_Z),
930 INSTR(0x1e, "madbr", IF_RRD, F_390 | F_Z),
931 INSTR(0x1f, "msdbr", IF_RRD, F_390 | F_Z),
932 INSTR(0x24, "lder", IF_RRE, F_390 | F_Z),
933 INSTR(0x25, "lxdr", IF_RRE, F_390 | F_Z),
934 INSTR(0x26, "lxer", IF_RRE, F_390 | F_Z),
935 INSTR(0x2e, "maer", IF_RRD, F_390 | F_Z),
936 INSTR(0x2f, "mser", IF_RRD, F_390 | F_Z),
937 INSTR(0x36, "sqxr", IF_RRE, F_390 | F_Z),
938 INSTR(0x37, "meer", IF_RRE, F_390 | F_Z),
939 INSTR(0x38, "maylr", IF_RRD, F_Z),
940 INSTR(0x39, "mylr", IF_RRD, F_Z),
941 INSTR(0x3a, "mayr", IF_RRD, F_Z),
942 INSTR(0x3b, "myr", IF_RRD, F_Z),
943 INSTR(0x3c, "mayhr", IF_RRD, F_Z),
944 INSTR(0x3d, "myhr", IF_RRD, F_Z),
945 INSTR(0x3e, "madr", IF_RRD, F_390 | F_Z),
946 INSTR(0x3f, "msdr", IF_RRD, F_390 | F_Z),
947 INSTR(0x40, "lpxbr", IF_RRE, F_390 | F_Z),
948 INSTR(0x41, "lnxbr", IF_RRE, F_390 | F_Z),
949 INSTR(0x42, "ltxbr", IF_RRE, F_390 | F_Z),
950 INSTR(0x43, "lcxbr", IF_RRE, F_390 | F_Z),
951 MULTI(0x44, tbl_b344),
952 MULTI(0x45, tbl_b345),
953 MULTI(0x46, tbl_b346),
954 MULTI(0x47, tbl_b347),
955 INSTR(0x48, "kxbr", IF_RRE, F_390 | F_Z),
956 INSTR(0x49, "cxbr", IF_RRE, F_390 | F_Z),
957 INSTR(0x4a, "axbr", IF_RRE, F_390 | F_Z),
958 INSTR(0x4b, "sxbr", IF_RRE, F_390 | F_Z),
959 INSTR(0x4c, "mxbr", IF_RRE, F_390 | F_Z),
960 INSTR(0x4d, "dxbr", IF_RRE, F_390 | F_Z),
961 INSTR(0x50, "tbedr", IF_RRFe, F_390 | F_Z),
962 INSTR(0x51, "tbdr", IF_RRFe, F_390 | F_Z),
963 INSTR(0x53, "diebr", IF_RRFb, F_390 | F_Z),
964 MULTI(0x57, tbl_b357),
965 INSTR(0x58, "thder", IF_RRE, F_390 | F_Z),
966 INSTR(0x59, "thdr", IF_RRE, F_390 | F_Z),
967 INSTR(0x5b, "didbr", IF_RRFe, F_390 | F_Z),
968 MULTI(0x5f, tbl_b35f),
969 INSTR(0x60, "lpxr", IF_RRE, F_390 | F_Z),
970 INSTR(0x61, "lnxr", IF_RRE, F_390 | F_Z),
971 INSTR(0x62, "ltxr", IF_RRE, F_390 | F_Z),
972 INSTR(0x63, "lcxr", IF_RRE, F_390 | F_Z),
973 INSTR(0x65, "lxr", IF_RRE, F_390 | F_Z),
974 INSTR(0x66, "lexr", IF_RRE, F_390 | F_Z),
975 INSTR(0x67, "fixr", IF_RRE, F_390 | F_Z),
976 INSTR(0x69, "cxr", IF_RRE, F_390 | F_Z),
977 INSTR(0x70, "lpdfr", IF_RRE, F_Z),
978 INSTR(0x71, "lndfr", IF_RRE, F_Z),
979 INSTR(0x72, "cpsdr", IF_RRFe, F_Z),
980 INSTR(0x73, "lcdfr", IF_RRE, F_Z),
981 INSTR(0x74, "lzer", IF_RRE, F_390 | F_Z),
982 INSTR(0x75, "lzdr", IF_RRE, F_390 | F_Z),
983 INSTR(0x76, "lzxr", IF_RRE, F_390 | F_Z),
984 INSTR(0x77, "fier", IF_RRE, F_390 | F_Z),
985 INSTR(0x7f, "fidr", IF_RRE, F_390 | F_Z),
986 INSTR(0x84, "sfpc", IF_RRE, F_390 | F_Z),
987 INSTR(0x85, "sfasr", IF_RRE, F_Z),
988 INSTR(0x8c, "efpc", IF_RRE, F_390 | F_Z),
989 INSTR(0x90, "celfbr", IF_RRFe, F_Z),
990 INSTR(0x91, "cdlfbr", IF_RRFe, F_Z),
991 INSTR(0x92, "cxlfbr", IF_RRFe, F_Z),
992 MULTI(0x94, tbl_b394),
993 MULTI(0x95, tbl_b395),
994 MULTI(0x96, tbl_b396),
995 MULTI(0x98, tbl_b398),
996 MULTI(0x99, tbl_b399),
997 MULTI(0x9a, tbl_b39a),
998 INSTR(0x9c, "clfebr", IF_RRFe, F_Z),
999 INSTR(0x9d, "clfdbr", IF_RRFe, F_Z),
1000 INSTR(0x9e, "clfxbr", IF_RRFe, F_Z),
1001 INSTR(0xa0, "celgbr", IF_RRFe, F_Z),
1002 INSTR(0xa1, "cdlgbr", IF_RRFe, F_Z),
1003 INSTR(0xa2, "cxlgbr", IF_RRFe, F_Z),
1004 INSTR(0xa4, "cegbra", IF_RRFe, F_Z),
1005 INSTR(0xa5, "cdgbra", IF_RRFe, F_Z),
1006 INSTR(0xa6, "cxgbra", IF_RRFe, F_Z),
1007 INSTR(0xa8, "cgebra", IF_RRFe, F_Z),
1008 INSTR(0xa9, "cgdbra", IF_RRFe, F_Z),
1009 INSTR(0xaa, "cgxbra", IF_RRFe, F_Z),
1010 INSTR(0xac, "clgebr", IF_RRFe, F_Z),
1011 INSTR(0xad, "clgdbr", IF_RRFe, F_Z),
1012 INSTR(0xae, "clgxbr", IF_RRFe, F_Z),
1013 INSTR(0xb4, "cefr", IF_RRE, F_390 | F_Z),
1014 INSTR(0xb5, "cdfr", IF_RRE, F_390 | F_Z),
1015 INSTR(0xb6, "cxfr", IF_RRE, F_390 | F_Z),
1016 INSTR(0xb8, "cfer", IF_RRFe, F_390 | F_Z),
1017 INSTR(0xb9, "cfdr", IF_RRFe, F_390 | F_Z),
1018 INSTR(0xba, "cfxr", IF_RRFe, F_390 | F_Z),
1019 INSTR(0xc1, "ldgr", IF_RRE, F_Z),
1020 INSTR(0xc4, "cegr", IF_RRE, F_Z),
1021 INSTR(0xc5, "cdgr", IF_RRE, F_Z),
1022 INSTR(0xc6, "cxgr", IF_RRE, F_Z),
1023 INSTR(0xc8, "cger", IF_RRFe, F_Z),
1024 INSTR(0xc9, "cgdr", IF_RRFe, F_Z),
1025 INSTR(0xca, "cgxr", IF_RRFe, F_Z),
1026 INSTR(0xcd, "lgdr", IF_RRE, F_Z),
1027 INSTR(0xd0, "mdtra", IF_RRFa, F_Z),
1028 INSTR(0xd1, "ddtra", IF_RRFa, F_Z),
1029 INSTR(0xd2, "adtra", IF_RRFa, F_Z),
1030 INSTR(0xd3, "sdtra", IF_RRFa, F_Z),
1031 INSTR(0xd4, "ldetr", IF_RRFd, F_Z),
1032 INSTR(0xd5, "ledtr", IF_RRFe, F_Z),
1033 INSTR(0xd6, "ltdtr", IF_RRE, F_Z),
1034 INSTR(0xd7, "fidtr", IF_RRFe, F_Z),
1035 INSTR(0xd8, "mxtra", IF_RRFa, F_Z),
1036 INSTR(0xd9, "dxtra", IF_RRFa, F_Z),
1037 INSTR(0xda, "axtra", IF_RRFa, F_Z),
1038 INSTR(0xdb, "sxtra", IF_RRFa, F_Z),
1039 INSTR(0xdc, "lxdtr", IF_RRFd, F_Z),
1040 INSTR(0xdd, "ldxtr", IF_RRFe, F_Z),
1041 INSTR(0xde, "ltxtr", IF_RRE, F_Z),
1042 INSTR(0xdf, "fixtr", IF_RRFe, F_Z),
1043 INSTR(0xe0, "kdtr", IF_RRE, F_Z),
1044 INSTR(0xe1, "cgdtra", IF_RRFe, F_Z),
1045 INSTR(0xe2, "cudtr", IF_RRE, F_Z),
1046 INSTR(0xe3, "csdtr", IF_RRFd, F_Z),
1047 INSTR(0xe4, "cdtr", IF_RRE, F_Z),
1048 INSTR(0xe5, "eedtr", IF_RRE, F_Z),
1049 INSTR(0xe7, "esdtr", IF_RRE, F_Z),
1050 INSTR(0xe8, "kxtr", IF_RRE, F_Z),
1051 INSTR(0xe9, "cgxtra", IF_RRFe, F_Z),
1052 INSTR(0xea, "cuxtr", IF_RRE, F_Z),
1053 INSTR(0xeb, "csxtr", IF_RRFd, F_Z),
1054 INSTR(0xec, "cxtr", IF_RRE, F_Z),
1055 INSTR(0xed, "eextr", IF_RRE, F_Z),
1056 INSTR(0xef, "esxtr", IF_RRE, F_Z),
1057 INSTR(0xf1, "cdgtra", IF_RRE, F_Z),
1058 INSTR(0xf2, "cdutr", IF_RRE, F_Z),
1059 INSTR(0xf3, "cdstr", IF_RRE, F_Z),
1060 INSTR(0xf4, "cedtr", IF_RRE, F_Z),
1061 INSTR(0xf5, "qadtr", IF_RRFb, F_Z),
1062 INSTR(0xf6, "iedtr", IF_RRFb, F_Z),
1063 INSTR(0xf7, "rrdtr", IF_RRFb, F_Z),
1064 INSTR(0xf9, "cxgtra", IF_RRE, F_Z),
1065 INSTR(0xfa, "cxutr", IF_RRE, F_Z),
1066 INSTR(0xfb, "cxstr", IF_RRE, F_Z),
1067 INSTR(0xfc, "cextr", IF_RRE, F_Z),
1068 INSTR(0xfd, "qaxtr", IF_RRFb, F_Z),
1069 INSTR(0xfe, "iextr", IF_RRFb, F_Z),
1070 INSTR(0xff, "rrxtr", IF_RRFb, F_Z),
1073 static const struct inst_table tbl_b9xx[256] = {
1074 INSTR(0x00, "lpgr", IF_RRE, F_Z),
1075 INSTR(0x01, "lngr", IF_RRE, F_Z),
1076 INSTR(0x02, "ltgr", IF_RRE, F_Z),
1077 INSTR(0x03, "lcgr", IF_RRE, F_Z),
1078 INSTR(0x04, "lgr", IF_RRE, F_Z),
1079 INSTR(0x05, "lurag", IF_RRE, F_Z),
1080 INSTR(0x06, "lgbr", IF_RRE, F_Z),
1081 INSTR(0x07, "lghr", IF_RRE, F_Z),
1082 INSTR(0x08, "agr", IF_RRE, F_Z),
1083 INSTR(0x09, "sgr", IF_RRE, F_Z),
1084 INSTR(0x0a, "algr", IF_RRE, F_Z),
1085 INSTR(0x0b, "slgr", IF_RRE, F_Z),
1086 INSTR(0x0c, "msgr", IF_RRE, F_Z),
1087 INSTR(0x0d, "dsgr", IF_RRE, F_Z),
1088 INSTR(0x0e, "eregg", IF_RRE, F_Z),
1089 INSTR(0x0f, "lrvgr", IF_RRE, F_Z),
1090 INSTR(0x10, "lpgfr", IF_RRE, F_Z),
1091 INSTR(0x11, "lngfr", IF_RRE, F_Z),
1092 INSTR(0x12, "ltgfr", IF_RRE, F_Z),
1093 INSTR(0x13, "lcgfr", IF_RRE, F_Z),
1094 INSTR(0x14, "lgfr", IF_RRE, F_Z),
1095 INSTR(0x16, "llgfr", IF_RRE, F_Z),
1096 INSTR(0x17, "llgtr", IF_RRE, F_Z),
1097 INSTR(0x18, "agfr", IF_RRE, F_Z),
1098 INSTR(0x19, "sgfr", IF_RRE, F_Z),
1099 INSTR(0x1a, "algfr", IF_RRE, F_Z),
1100 INSTR(0x1b, "slgfr", IF_RRE, F_Z),
1101 INSTR(0x1c, "msgfr", IF_RRE, F_Z),
1102 INSTR(0x1d, "dsgfr", IF_RRE, F_Z),
1103 INSTR(0x1e, "kmac", IF_RRE, F_390 | F_Z),
1104 INSTR(0x1f, "lrvr", IF_RRE, F_390 | F_Z),
1105 INSTR(0x20, "cgr", IF_RRE, F_Z),
1106 INSTR(0x21, "clgr", IF_RRE, F_Z),
1107 INSTR(0x25, "sturg", IF_RRE, F_Z),
1108 INSTR(0x26, "lbr", IF_RRE, F_Z),
1109 INSTR(0x27, "lhr", IF_RRE, F_Z),
1110 INSTR(0x28, "pckmo", IF_RRE, F_Z),
1111 INSTR(0x2a, "kmf", IF_RRE, F_Z),
1112 INSTR(0x2b, "kmo", IF_RRE, F_Z),
1113 INSTR(0x2c, "pcc", IF_RRE, F_Z),
1114 INSTR(0x2d, "kmctr", IF_RRFd, F_Z),
1115 INSTR(0x2e, "km", IF_RRE, F_390 | F_Z),
1116 INSTR(0x2f, "kmc", IF_RRE, F_390 | F_Z),
1117 INSTR(0x30, "cgfr", IF_RRE, F_Z),
1118 INSTR(0x31, "clgfr", IF_RRE, F_Z),
1119 INSTR(0x3e, "kimd", IF_RRE, F_390 | F_Z),
1120 INSTR(0x3f, "klmd", IF_RRE, F_390 | F_Z),
1121 INSTR(0x41, "cfdtr", IF_RRFe, F_Z),
1122 INSTR(0x42, "clgdtr", IF_RRFe, F_Z),
1123 INSTR(0x43, "clfdtr", IF_RRFe, F_Z),
1124 INSTR(0x46, "bctgr", IF_RRE, F_Z),
1125 INSTR(0x49, "cfxtr", IF_RRFe, F_Z),
1126 INSTR(0x4a, "clgxtr", IF_RRFe, F_Z),
1127 INSTR(0x4b, "clfxtr", IF_RRFe, F_Z),
1128 INSTR(0x51, "cdftr", IF_RRE, F_Z),
1129 INSTR(0x52, "cdlgtr", IF_RRFe, F_Z),
1130 INSTR(0x53, "cdlftr", IF_RRFe, F_Z),
1131 INSTR(0x59, "cxftr", IF_RRE, F_Z),
1132 INSTR(0x5a, "cxlgtr", IF_RRFe, F_Z),
1133 INSTR(0x5b, "cxlftr", IF_RRFe, F_Z),
1134 INSTR(0x60, "cgrt", IF_RRFc, F_Z),
1135 INSTR(0x61, "clgrt", IF_RRFc, F_Z),
1136 INSTR(0x72, "crt", IF_RRFc, F_Z),
1137 INSTR(0x73, "clrt", IF_RRFc, F_Z),
1138 INSTR(0x80, "ngr", IF_RRE, F_Z),
1139 INSTR(0x81, "ogr", IF_RRE, F_Z),
1140 INSTR(0x82, "xgr", IF_RRE, F_Z),
1141 INSTR(0x83, "flogr", IF_RRE, F_Z),
1142 INSTR(0x84, "llgcr", IF_RRE, F_Z),
1143 INSTR(0x85, "llghr", IF_RRE, F_Z),
1144 INSTR(0x86, "mlgr", IF_RRE, F_Z),
1145 INSTR(0x87, "dlgr", IF_RRE, F_Z),
1146 INSTR(0x88, "alcgr", IF_RRE, F_Z),
1147 INSTR(0x89, "slbgr", IF_RRE, F_Z),
1148 INSTR(0x8a, "cspg", IF_RRE, F_Z),
1149 INSTR(0x8d, "epsw", IF_RRE, F_390 | F_Z),
1150 INSTR(0x8e, "idte", IF_RRFb, F_Z),
1151 INSTR(0x8f, "crdte", IF_RRFb, F_Z),
1152 INSTR(0x90, "trtt", IF_RRFc, F_390 | F_Z),
1153 INSTR(0x91, "trto", IF_RRFc, F_390 | F_Z),
1154 INSTR(0x92, "trot", IF_RRFc, F_390 | F_Z),
1155 INSTR(0x93, "troo", IF_RRFc, F_390 | F_Z),
1156 INSTR(0x94, "llcr", IF_RRE, F_Z),
1157 INSTR(0x95, "llhr", IF_RRE, F_Z),
1158 INSTR(0x96, "mlr", IF_RRE, F_390 | F_Z),
1159 INSTR(0x97, "dlr", IF_RRE, F_390 | F_Z),
1160 INSTR(0x98, "alcr", IF_RRE, F_390 | F_Z),
1161 INSTR(0x99, "slbr", IF_RRE, F_390 | F_Z),
1162 INSTR(0x9a, "epair", IF_RRE, F_Z),
1163 INSTR(0x9b, "esair", IF_RRE, F_Z),
1164 INSTR(0x9d, "esea", IF_RRE, F_Z),
1165 INSTR(0x9e, "pti", IF_RRE, F_Z),
1166 INSTR(0x9f, "ssair", IF_RRE, F_Z),
1167 INSTR(0xa2, "ptf", IF_RRE, F_Z),
1168 INSTR(0xaa, "lptea", IF_RRFb, F_Z),
1169 INSTR(0xae, "rrbm", IF_RRE, F_Z),
1170 INSTR(0xaf, "pfmf", IF_RRE, F_Z),
1171 INSTR(0xb0, "cu14", IF_RRFc, F_Z),
1172 INSTR(0xb1, "cu24", IF_RRFc, F_Z),
1173 INSTR(0xb2, "cu41", IF_RRE, F_Z),
1174 INSTR(0xb3, "cu42", IF_RRE, F_Z),
1175 INSTR(0xbd, "trtre", IF_RRFc, F_Z),
1176 INSTR(0xbe, "srstu", IF_RRE, F_Z),
1177 INSTR(0xbf, "trte", IF_RRFc, F_Z),
1178 INSTR(0xc8, "ahhhr", IF_RRFa, F_Z),
1179 INSTR(0xc9, "shhhr", IF_RRFa, F_Z),
1180 INSTR(0xca, "alhhhr", IF_RRFa, F_Z),
1181 INSTR(0xcb, "slhhhr", IF_RRFa, F_Z),
1182 INSTR(0xcd, "chhr", IF_RRE, F_Z),
1183 INSTR(0xcf, "clhhr", IF_RRE, F_Z),
1184 INSTR(0xd8, "ahhlr", IF_RRFa, F_Z),
1185 INSTR(0xd9, "shhlr", IF_RRFa, F_Z),
1186 INSTR(0xda, "alhhlr", IF_RRFa, F_Z),
1187 INSTR(0xdb, "slhhlr", IF_RRFa, F_Z),
1188 INSTR(0xdd, "chlr", IF_RRE, F_Z),
1189 INSTR(0xdf, "clhlr", IF_RRE, F_Z),
1190 INSTR(0xe1, "popcnt", IF_RRE, F_Z),
1191 INSTR(0xe2, "locgr", IF_RRFc, F_Z),
1192 INSTR(0xe4, "ngrk", IF_RRFa, F_Z),
1193 INSTR(0xe6, "ogrk", IF_RRFa, F_Z),
1194 INSTR(0xe7, "xgrk", IF_RRFa, F_Z),
1195 INSTR(0xe8, "agrk", IF_RRFa, F_Z),
1196 INSTR(0xe9, "sgrk", IF_RRFa, F_Z),
1197 INSTR(0xea, "algrk", IF_RRFa, F_Z),
1198 INSTR(0xeb, "slgrk", IF_RRFa, F_Z),
1199 INSTR(0xf2, "locgr", IF_RRFc, F_Z),
1200 INSTR(0xf4, "nrk", IF_RRFa, F_Z),
1201 INSTR(0xf6, "ork", IF_RRFa, F_Z),
1202 INSTR(0xf7, "xrk", IF_RRFa, F_Z),
1203 INSTR(0xf8, "ark", IF_RRFa, F_Z),
1204 INSTR(0xf9, "srk", IF_RRFa, F_Z),
1205 INSTR(0xfa, "alrk", IF_RRFa, F_Z),
1206 INSTR(0xfb, "slrk", IF_RRFa, F_Z),
1209 static const struct inst_table tbl_c0x[16] = {
1210 INSTR(0x0, "larl", IF_RILb, F_390 | F_Z),
1211 INSTR(0x1, "lgfi", IF_RILa, F_Z),
1212 INSTR(0x4, "brcl", IF_RILc, F_390 | F_Z),
1213 INSTR(0x5, "brasl", IF_RILb, F_390 | F_Z),
1214 INSTR(0x6, "xihf", IF_RILa, F_Z),
1215 INSTR(0x7, "xilf", IF_RILa, F_Z),
1216 INSTR(0x8, "iihf", IF_RILa, F_Z),
1217 INSTR(0x9, "iilf", IF_RILa, F_Z),
1218 INSTR(0xa, "nihf", IF_RILa, F_Z),
1219 INSTR(0xb, "nilf", IF_RILa, F_Z),
1220 INSTR(0xc, "oihf", IF_RILa, F_Z),
1221 INSTR(0xd, "oilf", IF_RILa, F_Z),
1222 INSTR(0xe, "llihf", IF_RILa, F_Z),
1223 INSTR(0xf, "llilf", IF_RILa, F_Z),
1226 static const struct inst_table tbl_c2x[16] = {
1227 INSTR(0x0, "msgfi", IF_RILa, F_Z),
1228 INSTR(0x1, "msfi", IF_RILa, F_Z),
1229 INSTR(0x4, "slgfi", IF_RILa, F_Z),
1230 INSTR(0x5, "slfi", IF_RILa, F_Z),
1231 INSTR(0x8, "agfi", IF_RILa, F_Z),
1232 INSTR(0x9, "afi", IF_RILa, F_Z),
1233 INSTR(0xa, "algfi", IF_RILa, F_Z),
1234 INSTR(0xb, "alfi", IF_RILa, F_Z),
1235 INSTR(0xc, "cgfi", IF_RILa, F_Z),
1236 INSTR(0xd, "cfi", IF_RILa, F_Z),
1237 INSTR(0xe, "clgfi", IF_RILa, F_Z),
1238 INSTR(0xf, "clfi", IF_RILa, F_Z),
1241 static const struct inst_table tbl_c4x[16] = {
1242 INSTR(0x2, "llhrl", IF_RILb, F_Z),
1243 INSTR(0x4, "lghrl", IF_RILb, F_Z),
1244 INSTR(0x5, "lhrl", IF_RILb, F_Z),
1245 INSTR(0x6, "llghrl", IF_RILb, F_Z),
1246 INSTR(0x7, "sthrl", IF_RILb, F_Z),
1247 INSTR(0x8, "lgrl", IF_RILb, F_Z),
1248 INSTR(0xb, "stgrl", IF_RILb, F_Z),
1249 INSTR(0xc, "lgfrl", IF_RILb, F_Z),
1250 INSTR(0xd, "lrl", IF_RILb, F_Z),
1251 INSTR(0xe, "llgfrl", IF_RILb, F_Z),
1252 INSTR(0xf, "strl", IF_RILb, F_Z),
1255 static const struct inst_table tbl_c6x[16] = {
1256 INSTR(0x0, "exrl", IF_RILb, F_Z),
1257 INSTR(0x2, "pfdrl", IF_RILc, F_Z),
1258 INSTR(0x4, "cghrl", IF_RILb, F_Z),
1259 INSTR(0x5, "chrl", IF_RILb, F_Z),
1260 INSTR(0x6, "clghrl", IF_RILb, F_Z),
1261 INSTR(0x7, "clhrl", IF_RILb, F_Z),
1262 INSTR(0x8, "cgrl", IF_RILb, F_Z),
1263 INSTR(0xa, "clgrl", IF_RILb, F_Z),
1264 INSTR(0xc, "cgfrl", IF_RILb, F_Z),
1265 INSTR(0xd, "crl", IF_RILb, F_Z),
1266 INSTR(0xe, "clgfrl", IF_RILb, F_Z),
1267 INSTR(0xf, "clrl", IF_RILb, F_Z),
1270 static const struct inst_table tbl_c8x[16] = {
1271 INSTR(0x0, "mvcos", IF_SSF, F_Z),
1272 INSTR(0x1, "ectg", IF_SSF, F_Z),
1273 INSTR(0x2, "csst", IF_SSF, F_Z),
1274 INSTR(0x4, "lpd", IF_SSF, F_Z),
1275 INSTR(0x5, "lpdg", IF_SSF, F_Z),
1278 static const struct inst_table tbl_ccx[16] = {
1279 INSTR(0x6, "brcth", IF_RILb, F_Z),
1280 INSTR(0x8, "aih", IF_RILa, F_Z),
1281 INSTR(0xa, "alsih", IF_RILa, F_Z),
1282 INSTR(0xb, "alsihn", IF_RILa, F_Z),
1283 INSTR(0xd, "cih", IF_RILa, F_Z),
1284 INSTR(0xf, "clih", IF_RILa, F_Z),
1287 static const struct inst_table tbl_e3xx[256] = {
1288 INSTR(0x02, "ltg", IF_RXYa, F_Z),
1289 INSTR(0x03, "lrag", IF_RXYa, F_Z),
1290 INSTR(0x04, "lg", IF_RXYa, F_Z),
1291 INSTR(0x06, "cvby", IF_RXYa, F_Z),
1292 INSTR(0x08, "ag", IF_RXYa, F_Z),
1293 INSTR(0x09, "sg", IF_RXYa, F_Z),
1294 INSTR(0x0a, "alg", IF_RXYa, F_Z),
1295 INSTR(0x0b, "slg", IF_RXYa, F_Z),
1296 INSTR(0x0c, "msg", IF_RXYa, F_Z),
1297 INSTR(0x0d, "dsg", IF_RXYa, F_Z),
1298 INSTR(0x0e, "cvbg", IF_RXYa, F_Z),
1299 INSTR(0x0f, "lrvg", IF_RXYa, F_Z),
1300 INSTR(0x12, "lt", IF_RXYa, F_Z),
1301 INSTR(0x13, "lray", IF_RXYa, F_Z),
1302 INSTR(0x14, "lgf", IF_RXYa, F_Z),
1303 INSTR(0x15, "lgh", IF_RXYa, F_Z),
1304 INSTR(0x16, "llgf", IF_RXYa, F_Z),
1305 INSTR(0x17, "llgt", IF_RXYa, F_Z),
1306 INSTR(0x18, "agf", IF_RXYa, F_Z),
1307 INSTR(0x19, "sgf", IF_RXYa, F_Z),
1308 INSTR(0x1a, "algf", IF_RXYa, F_Z),
1309 INSTR(0x1b, "slgf", IF_RXYa, F_Z),
1310 INSTR(0x1c, "msgf", IF_RXYa, F_Z),
1311 INSTR(0x1d, "dsgf", IF_RXYa, F_Z),
1312 INSTR(0x1e, "lrv", IF_RXYa, F_390 | F_Z),
1313 INSTR(0x1f, "lrvh", IF_RXYa, F_390 | F_Z),
1314 INSTR(0x20, "cg", IF_RXYa, F_Z),
1315 INSTR(0x21, "clg", IF_RXYa, F_Z),
1316 INSTR(0x24, "stg", IF_RXYa, F_Z),
1317 INSTR(0x25, "ntstg", IF_RXYa, F_Z),
1318 INSTR(0x26, "cvdy", IF_RXYa, F_Z),
1319 INSTR(0x2e, "cvdg", IF_RXYa, F_Z),
1320 INSTR(0x2f, "strvg", IF_RXYa, F_Z),
1321 INSTR(0x30, "cgf", IF_RXYa, F_Z),
1322 INSTR(0x31, "clgf", IF_RXYa, F_Z),
1323 INSTR(0x32, "ltgf", IF_RXYa, F_Z),
1324 INSTR(0x34, "cgh", IF_RXYa, F_Z),
1325 INSTR(0x36, "pfd", IF_RXYb, F_Z),
1326 INSTR(0x3e, "strv", IF_RXYa, F_390 | F_Z),
1327 INSTR(0x3f, "strvh", IF_RXYa, F_390 | F_Z),
1328 INSTR(0x46, "bctg", IF_RXYa, F_Z),
1329 INSTR(0x50, "sty", IF_RXYa, F_Z),
1330 INSTR(0x51, "msy", IF_RXYa, F_Z),
1331 INSTR(0x54, "ny", IF_RXYa, F_Z),
1332 INSTR(0x55, "cly", IF_RXYa, F_Z),
1333 INSTR(0x56, "oy", IF_RXYa, F_Z),
1334 INSTR(0x57, "xy", IF_RXYa, F_Z),
1335 INSTR(0x58, "ly", IF_RXYa, F_Z),
1336 INSTR(0x59, "cy", IF_RXYa, F_Z),
1337 INSTR(0x5a, "ay", IF_RXYa, F_Z),
1338 INSTR(0x5b, "sy", IF_RXYa, F_Z),
1339 INSTR(0x5c, "mfy", IF_RXYa, F_Z),
1340 INSTR(0x5e, "aly", IF_RXYa, F_Z),
1341 INSTR(0x5f, "sly", IF_RXYa, F_Z),
1342 INSTR(0x70, "sthy", IF_RXYa, F_Z),
1343 INSTR(0x71, "lay", IF_RXYa, F_Z),
1344 INSTR(0x72, "stcy", IF_RXYa, F_Z),
1345 INSTR(0x73, "icy", IF_RXYa, F_Z),
1346 INSTR(0x75, "laey", IF_RXYa, F_Z),
1347 INSTR(0x76, "lb", IF_RXYa, F_Z),
1348 INSTR(0x77, "lgb", IF_RXYa, F_Z),
1349 INSTR(0x78, "lhy", IF_RXYa, F_Z),
1350 INSTR(0x79, "chy", IF_RXYa, F_Z),
1351 INSTR(0x7a, "ahy", IF_RXYa, F_Z),
1352 INSTR(0x7b, "shy", IF_RXYa, F_Z),
1353 INSTR(0x7c, "mhy", IF_RXYa, F_Z),
1354 INSTR(0x80, "ng", IF_RXYa, F_Z),
1355 INSTR(0x81, "og", IF_RXYa, F_Z),
1356 INSTR(0x82, "xg", IF_RXYa, F_Z),
1357 INSTR(0x85, "lgat", IF_RXYa, F_Z),
1358 INSTR(0x86, "mlg", IF_RXYa, F_Z),
1359 INSTR(0x87, "dlg", IF_RXYa, F_Z),
1360 INSTR(0x88, "alcg", IF_RXYa, F_Z),
1361 INSTR(0x89, "slbg", IF_RXYa, F_Z),
1362 INSTR(0x8e, "stpq", IF_RXYa, F_Z),
1363 INSTR(0x8f, "lpq", IF_RXYa, F_Z),
1364 INSTR(0x90, "llgc", IF_RXYa, F_Z),
1365 INSTR(0x91, "llgh", IF_RXYa, F_Z),
1366 INSTR(0x94, "llc", IF_RXYa, F_Z),
1367 INSTR(0x95, "llh", IF_RXYa, F_Z),
1368 INSTR(0x96, "ml", IF_RXYa, F_390 | F_Z),
1369 INSTR(0x97, "dl", IF_RXYa, F_390 | F_Z),
1370 INSTR(0x98, "alc", IF_RXYa, F_390 | F_Z),
1371 INSTR(0x99, "slb", IF_RXYa, F_390 | F_Z),
1372 INSTR(0x9c, "llgtat", IF_RXYa, F_Z),
1373 INSTR(0x9d, "llgfat", IF_RXYa, F_Z),
1374 INSTR(0x9f, "lat", IF_RXYa, F_Z),
1375 INSTR(0xc0, "lbh", IF_RXYa, F_Z),
1376 INSTR(0xc2, "llch", IF_RXYa, F_Z),
1377 INSTR(0xc3, "stch", IF_RXYa, F_Z),
1378 INSTR(0xc4, "lhh", IF_RXYa, F_Z),
1379 INSTR(0xc6, "llhh", IF_RXYa, F_Z),
1380 INSTR(0xc7, "sthh", IF_RXYa, F_Z),
1381 INSTR(0xc8, "lfhat", IF_RXYa, F_Z),
1382 INSTR(0xca, "lfh", IF_RXYa, F_Z),
1383 INSTR(0xcb, "stfh", IF_RXYa, F_Z),
1384 INSTR(0xcd, "chf", IF_RXYa, F_Z),
1385 INSTR(0xcf, "clhf", IF_RXYa, F_Z),
1388 static const struct inst_table tbl_e5xx[256] = {
1389 INSTR(0x00, "lasp", IF_SSE, F_390 | F_Z),
1390 INSTR(0x01, "tprot", IF_SSE, F_390 | F_Z),
1391 INSTR(0x02, "strag", IF_SSE, F_Z),
1392 INSTR(0x0e, "mvcsk", IF_SSE, F_390 | F_Z),
1393 INSTR(0x0f, "mvcdk", IF_SSE, F_390 | F_Z),
1394 INSTR(0x44, "mvhhi", IF_SIL, F_Z),
1395 INSTR(0x48, "mvghi", IF_SIL, F_Z),
1396 INSTR(0x4c, "mvhi", IF_SIL, F_Z),
1397 INSTR(0x54, "chhsi", IF_SIL, F_Z),
1398 INSTR(0x55, "clhhsi", IF_SIL, F_Z),
1399 INSTR(0x58, "cghsi", IF_SIL, F_Z),
1400 INSTR(0x59, "clghsi", IF_SIL, F_Z),
1401 INSTR(0x5c, "chsi", IF_SIL, F_Z),
1402 INSTR(0x5d, "clfhsi", IF_SIL, F_Z),
1403 INSTR(0x60, "tbegin", IF_SIL, F_Z),
1404 INSTR(0x61, "tbeginc", IF_SIL, F_Z),
1407 static const struct inst_table tbl_ebxx[256] = {
1408 INSTR(0x04, "lmg", IF_RSYa, F_Z),
1409 INSTR(0x0a, "srag", IF_RSYa, F_Z),
1410 INSTR(0x0b, "slag", IF_RSYa, F_Z),
1411 INSTR(0x0c, "srlg", IF_RSYa, F_Z),
1412 INSTR(0x0d, "sllg", IF_RSYa, F_Z),
1413 INSTR(0x0f, "tracg", IF_RSYa, F_Z),
1414 INSTR(0x14, "csy", IF_RSYa, F_Z),
1415 INSTR(0x1c, "rllg", IF_RSYa, F_Z),
1416 INSTR(0x1d, "rll", IF_RSYa, F_390 | F_Z),
1417 INSTR(0x20, "clmh", IF_RSYb, F_Z),
1418 INSTR(0x21, "clmy", IF_RSYb, F_Z),
1419 INSTR(0x23, "clt", IF_RSYb, F_Z),
1420 INSTR(0x24, "stmg", IF_RSYa, F_Z),
1421 INSTR(0x25, "stctg", IF_RSYa, F_Z | F_CTL_REG),
1422 INSTR(0x26, "stmh", IF_RSYa, F_Z),
1423 INSTR(0x2b, "clgt", IF_RSYb, F_Z),
1424 INSTR(0x2c, "stcmh", IF_RSYb, F_Z),
1425 INSTR(0x2d, "stcmy", IF_RSYb, F_Z),
1426 INSTR(0x2f, "lctlg", IF_RSYa, F_Z | F_CTL_REG),
1427 INSTR(0x30, "csg", IF_RSYa, F_Z),
1428 INSTR(0x31, "cdsy", IF_RSYa, F_Z),
1429 INSTR(0x3e, "cdsg", IF_RSYa, F_Z),
1430 INSTR(0x44, "bxhg", IF_RSYa, F_Z),
1431 INSTR(0x45, "bxleg", IF_RSYa, F_Z),
1432 INSTR(0x4c, "ecag", IF_RSYa, F_Z),
1433 INSTR(0x51, "tmy", IF_SIY, F_Z),
1434 INSTR(0x52, "mviy", IF_SIY, F_Z),
1435 INSTR(0x54, "niy", IF_SIY, F_Z),
1436 INSTR(0x55, "cliy", IF_SIY, F_Z),
1437 INSTR(0x56, "oiy", IF_SIY, F_Z),
1438 INSTR(0x57, "xiy", IF_SIY, F_Z),
1439 INSTR(0x6a, "asi", IF_SIY, F_Z),
1440 INSTR(0x6e, "alsi", IF_SIY, F_Z),
1441 INSTR(0x80, "icmh", IF_RSYb, F_Z),
1442 INSTR(0x81, "icmy", IF_RSYb, F_Z),
1443 INSTR(0x8e, "mvclu", IF_RSYa, F_390 | F_Z),
1444 INSTR(0x8f, "clclu", IF_RSYa, F_390 | F_Z),
1445 INSTR(0x90, "stmy", IF_RSYa, F_Z),
1446 INSTR(0x96, "lmh", IF_RSYa, F_Z),
1447 INSTR(0x98, "lmy", IF_RSYa, F_Z),
1448 INSTR(0x9a, "lamy", IF_RSYa, F_Z),
1449 INSTR(0x9b, "stamy", IF_RSYa, F_Z),
1450 INSTR(0xc0, "tp", IF_RSLa, F_390 | F_Z),
1451 INSTR(0xdc, "srak", IF_RSYa, F_Z),
1452 INSTR(0xdd, "slak", IF_RSYa, F_Z),
1453 INSTR(0xde, "srlk", IF_RSYa, F_Z),
1454 INSTR(0xdf, "sllk", IF_RSYa, F_Z),
1455 INSTR(0xe2, "locg", IF_RSYb, F_Z),
1456 INSTR(0xe3, "stocg", IF_RSYb, F_Z),
1457 INSTR(0xe4, "lang", IF_RSYa, F_Z),
1458 INSTR(0xe6, "laog", IF_RSYa, F_Z),
1459 INSTR(0xe7, "laxg", IF_RSYa, F_Z),
1460 INSTR(0xe8, "laag", IF_RSYa, F_Z),
1461 INSTR(0xea, "laalg", IF_RSYa, F_Z),
1462 INSTR(0xf2, "loc", IF_RSYb, F_Z),
1463 INSTR(0xf3, "stoc", IF_RSYb, F_Z),
1464 INSTR(0xf4, "lan", IF_RSYa, F_Z),
1465 INSTR(0xf6, "lao", IF_RSYa, F_Z),
1466 INSTR(0xf7, "lax", IF_RSYa, F_Z),
1467 INSTR(0xf8, "laa", IF_RSYa, F_Z),
1468 INSTR(0xfa, "laal", IF_RSYa, F_Z),
1471 static const struct inst_table tbl_ecxx[256] = {
1472 INSTR(0x44, "brxhg", IF_RIEe, F_Z),
1473 INSTR(0x45, "brxlg", IF_RIEe, F_Z),
1474 INSTR(0x51, "risblg", IF_RIEf, F_Z),
1475 INSTR(0x54, "rnsbg", IF_RIEf, F_Z),
1476 INSTR(0x55, "risbg", IF_RIEf, F_Z),
1477 INSTR(0x56, "rosbg", IF_RIEf, F_Z),
1478 INSTR(0x57, "rxsbg", IF_RIEf, F_Z),
1479 INSTR(0x59, "risbgn", IF_RIEf, F_Z),
1480 INSTR(0x5d, "risbhg", IF_RIEf, F_Z),
1481 INSTR(0x64, "cgrj", IF_RIEb, F_Z),
1482 INSTR(0x65, "clgrj", IF_RIEb, F_Z),
1483 INSTR(0x70, "cgit", IF_RIEa, F_Z),
1484 INSTR(0x71, "clgit", IF_RIEa, F_Z),
1485 INSTR(0x72, "cit", IF_RIEa, F_Z),
1486 INSTR(0x73, "clfit", IF_RIEa, F_Z),
1487 INSTR(0x76, "crj", IF_RIEb, F_Z),
1488 INSTR(0x77, "clrj", IF_RIEb, F_Z),
1489 INSTR(0x7c, "cgij", IF_RIEc, F_Z),
1490 INSTR(0x7d, "clgij", IF_RIEc, F_Z),
1491 INSTR(0x7e, "cij", IF_RIEc, F_Z),
1492 INSTR(0x7f, "clij", IF_RIEc, F_Z),
1493 INSTR(0xd8, "ahik", IF_RIEd, F_Z),
1494 INSTR(0xd9, "aghik", IF_RIEd, F_Z),
1495 INSTR(0xda, "alhsik", IF_RIEd, F_Z),
1496 INSTR(0xdb, "alghsik", IF_RIEd, F_Z),
1497 INSTR(0xe4, "cgrb", IF_RRS, F_Z),
1498 INSTR(0xe5, "clgrb", IF_RRS, F_Z),
1499 INSTR(0xf6, "crb", IF_RRS, F_Z),
1500 INSTR(0xf7, "clrb", IF_RRS, F_Z),
1501 INSTR(0xfc, "cgib", IF_RIS, F_Z),
1502 INSTR(0xfd, "clgib", IF_RIS, F_Z),
1503 INSTR(0xfe, "cib", IF_RIS, F_Z),
1504 INSTR(0xff, "clib", IF_RIS, F_Z),
1507 static const struct inst_table tbl_edxx[256] = {
1508 INSTR(0x04, "ldeb", IF_RXE, F_390 | F_Z),
1509 INSTR(0x05, "lxdb", IF_RXE, F_390 | F_Z),
1510 INSTR(0x06, "lxeb", IF_RXE, F_390 | F_Z),
1511 INSTR(0x07, "mxdb", IF_RXE, F_390 | F_Z),
1512 INSTR(0x08, "keb", IF_RXE, F_390 | F_Z),
1513 INSTR(0x09, "ceb", IF_RXE, F_390 | F_Z),
1514 INSTR(0x0a, "aeb", IF_RXE, F_390 | F_Z),
1515 INSTR(0x0b, "seb", IF_RXE, F_390 | F_Z),
1516 INSTR(0x0c, "mdeb", IF_RXE, F_390 | F_Z),
1517 INSTR(0x0d, "deb", IF_RXE, F_390 | F_Z),
1518 INSTR(0x0e, "maeb", IF_RXF, F_390 | F_Z),
1519 INSTR(0x0f, "mseb", IF_RXF, F_390 | F_Z),
1520 INSTR(0x10, "tceb", IF_RXE, F_390 | F_Z),
1521 INSTR(0x11, "tcdb", IF_RXE, F_390 | F_Z),
1522 INSTR(0x12, "tcxb", IF_RXE, F_390 | F_Z),
1523 INSTR(0x14, "sqeb", IF_RXE, F_390 | F_Z),
1524 INSTR(0x15, "sqdb", IF_RXE, F_390 | F_Z),
1525 INSTR(0x17, "meeb", IF_RXE, F_390 | F_Z),
1526 INSTR(0x18, "kdb", IF_RXE, F_390 | F_Z),
1527 INSTR(0x19, "cdb", IF_RXE, F_390 | F_Z),
1528 INSTR(0x1a, "adb", IF_RXE, F_390 | F_Z),
1529 INSTR(0x1b, "sdb", IF_RXE, F_390 | F_Z),
1530 INSTR(0x1c, "mdb", IF_RXE, F_390 | F_Z),
1531 INSTR(0x1d, "ddb", IF_RXE, F_390 | F_Z),
1532 INSTR(0x1e, "madb", IF_RXF, F_390 | F_Z),
1533 INSTR(0x1f, "msdb", IF_RXF, F_390 | F_Z),
1534 INSTR(0x24, "lde", IF_RXE, F_390 | F_Z),
1535 INSTR(0x25, "lxd", IF_RXE, F_390 | F_Z),
1536 INSTR(0x26, "lxe", IF_RXE, F_390 | F_Z),
1537 INSTR(0x2e, "mae", IF_RXF, F_390 | F_Z),
1538 INSTR(0x2f, "mse", IF_RXF, F_390 | F_Z),
1539 INSTR(0x34, "sqe", IF_RXE, F_390 | F_Z),
1540 INSTR(0x35, "sqd", IF_RXE, F_390 | F_Z),
1541 INSTR(0x37, "mee", IF_RXE, F_390 | F_Z),
1542 INSTR(0x38, "mayl", IF_RXF, F_Z),
1543 INSTR(0x39, "myl", IF_RXF, F_Z),
1544 INSTR(0x3a, "may", IF_RXF, F_Z),
1545 INSTR(0x3b, "my", IF_RXF, F_Z),
1546 INSTR(0x3c, "mayh", IF_RXF, F_Z),
1547 INSTR(0x3d, "myh", IF_RXF, F_Z),
1548 INSTR(0x3e, "mad", IF_RXF, F_390 | F_Z),
1549 INSTR(0x3f, "msd", IF_RXF, F_390 | F_Z),
1550 INSTR(0x40, "sldt", IF_RXF, F_Z),
1551 INSTR(0x41, "srdt", IF_RXF, F_Z),
1552 INSTR(0x48, "slxt", IF_RXF, F_Z),
1553 INSTR(0x49, "srxt", IF_RXF, F_Z),
1554 INSTR(0x50, "tdcet", IF_RXE, F_Z),
1555 INSTR(0x51, "tdget", IF_RXE, F_Z),
1556 INSTR(0x54, "tdcdt", IF_RXE, F_Z),
1557 INSTR(0x55, "tdgdt", IF_RXE, F_Z),
1558 INSTR(0x58, "tdcxt", IF_RXE, F_Z),
1559 INSTR(0x59, "tdgxt", IF_RXE, F_Z),
1560 INSTR(0x64, "ley", IF_RXYa, F_Z),
1561 INSTR(0x65, "ldy", IF_RXYa, F_Z),
1562 INSTR(0x66, "stey", IF_RXYa, F_Z),
1563 INSTR(0x67, "stdy", IF_RXYa, F_Z),
1564 INSTR(0xa8, "czdt", IF_RSLb, F_Z),
1565 INSTR(0xa9, "czxt", IF_RSLb, F_Z),
1566 INSTR(0xaa, "cdzt", IF_RSLb, F_Z),
1567 INSTR(0xab, "cxzt", IF_RSLb, F_Z),
1570 static const struct inst_table tbl_xx[256] = {
1571 INSTR(0x00, ".byte", IF_ZERO, F_370 | F_390 | F_Z),
1572 TABLE(0x01, tbl_01xx, 1, 0, 0xff),
1573 INSTR(0x04, "spm", IF_RR, F_370 | F_Z),
1574 INSTR(0x05, "balr", IF_RR, F_370 | F_Z),
1575 INSTR(0x06, "bctr", IF_RR, F_370 | F_Z),
1576 TABLE(0x07, tbl_07, 1, 4, 0x0f),
1577 INSTR(0x08, "ssk", IF_RR, F_370),
1578 INSTR(0x09, "isk", IF_RR, F_370),
1579 INSTR(0x0a, "svc", IF_I, F_370 | F_390 | F_Z),
1580 INSTR(0x0b, "bsm", IF_RR, F_390 | F_Z),
1581 INSTR(0x0c, "bassm", IF_RR, F_390 | F_Z),
1582 INSTR(0x0d, "basr", IF_RR, F_390 | F_Z),
1583 INSTR(0x0e, "mvcl", IF_RR, F_370 | F_390 | F_Z),
1584 INSTR(0x0f, "clcl", IF_RR, F_370 | F_390 | F_Z),
1585 INSTR(0x10, "lpr", IF_RR, F_370 | F_390 | F_Z),
1586 INSTR(0x11, "lnr", IF_RR, F_370 | F_390 | F_Z),
1587 INSTR(0x12, "ltr", IF_RR, F_370 | F_390 | F_Z),
1588 INSTR(0x13, "lcr", IF_RR, F_370 | F_390 | F_Z),
1589 INSTR(0x14, "nr", IF_RR, F_370 | F_390 | F_Z),
1590 INSTR(0x15, "clr", IF_RR, F_370 | F_390 | F_Z),
1591 INSTR(0x16, "or", IF_RR, F_370 | F_390 | F_Z),
1592 INSTR(0x17, "xr", IF_RR, F_370 | F_390 | F_Z),
1593 INSTR(0x18, "lr", IF_RR, F_370 | F_390 | F_Z),
1594 INSTR(0x19, "cr", IF_RR, F_370 | F_390 | F_Z),
1595 INSTR(0x1a, "ar", IF_RR, F_370 | F_390 | F_Z),
1596 INSTR(0x1b, "sr", IF_RR, F_370 | F_390 | F_Z),
1597 INSTR(0x1c, "mr", IF_RR, F_370 | F_390 | F_Z),
1598 INSTR(0x1d, "dr", IF_RR, F_370 | F_390 | F_Z),
1599 INSTR(0x1e, "alr", IF_RR, F_370 | F_390 | F_Z),
1600 INSTR(0x1f, "slr", IF_RR, F_370 | F_390 | F_Z),
1601 INSTR(0x20, "lpdr", IF_RR, F_370 | F_390 | F_Z),
1602 INSTR(0x21, "lndr", IF_RR, F_370 | F_390 | F_Z),
1603 INSTR(0x22, "ltdr", IF_RR, F_370 | F_390 | F_Z),
1604 INSTR(0x23, "lcdr", IF_RR, F_370 | F_390 | F_Z),
1605 INSTR(0x24, "hdr", IF_RR, F_370 | F_390 | F_Z),
1606 MULTI(0x25, tbl_25),
1607 INSTR(0x26, "mxr", IF_RR, F_370 | F_390 | F_Z),
1608 INSTR(0x27, "mxdr", IF_RR, F_370 | F_390 | F_Z),
1609 INSTR(0x28, "ldr", IF_RR, F_370 | F_390 | F_Z),
1610 INSTR(0x29, "cdr", IF_RR, F_370 | F_390 | F_Z),
1611 INSTR(0x2a, "adr", IF_RR, F_370 | F_390 | F_Z),
1612 INSTR(0x2b, "sdr", IF_RR, F_370 | F_390 | F_Z),
1613 INSTR(0x2c, "mdr", IF_RR, F_370 | F_390 | F_Z),
1614 INSTR(0x2d, "ddr", IF_RR, F_370 | F_390 | F_Z),
1615 INSTR(0x2e, "awr", IF_RR, F_370 | F_390 | F_Z),
1616 INSTR(0x2f, "swr", IF_RR, F_370 | F_390 | F_Z),
1617 INSTR(0x30, "lper", IF_RR, F_370 | F_390 | F_Z),
1618 INSTR(0x31, "lner", IF_RR, F_370 | F_390 | F_Z),
1619 INSTR(0x32, "lter", IF_RR, F_370 | F_390 | F_Z),
1620 INSTR(0x33, "lcer", IF_RR, F_370 | F_390 | F_Z),
1621 INSTR(0x34, "her", IF_RR, F_370 | F_390 | F_Z),
1622 MULTI(0x35, tbl_35),
1623 INSTR(0x36, "axr", IF_RR, F_370 | F_390 | F_Z),
1624 INSTR(0x37, "sxr", IF_RR, F_370 | F_390 | F_Z),
1625 INSTR(0x38, "ler", IF_RR, F_370 | F_390 | F_Z),
1626 INSTR(0x39, "cer", IF_RR, F_370 | F_390 | F_Z),
1627 INSTR(0x3a, "aer", IF_RR, F_370 | F_390 | F_Z),
1628 INSTR(0x3b, "ser", IF_RR, F_370 | F_390 | F_Z),
1629 MULTI(0x3c, tbl_3c),
1630 INSTR(0x3d, "der", IF_RR, F_370 | F_390 | F_Z),
1631 INSTR(0x3e, "aur", IF_RR, F_370 | F_390 | F_Z),
1632 INSTR(0x3f, "sur", IF_RR, F_370 | F_390 | F_Z),
1633 INSTR(0x40, "sth", IF_RXa, F_370 | F_390 | F_Z),
1634 INSTR(0x41, "la", IF_RXa, F_370 | F_390 | F_Z),
1635 INSTR(0x42, "stc", IF_RXa, F_370 | F_390 | F_Z),
1636 INSTR(0x43, "ic", IF_RXa, F_370 | F_390 | F_Z),
1637 INSTR(0x44, "ex", IF_RXa, F_370 | F_390 | F_Z),
1638 INSTR(0x45, "bal", IF_RXa, F_370 | F_390 | F_Z),
1639 INSTR(0x46, "bct", IF_RXa, F_370 | F_390 | F_Z),
1640 TABLE(0x47, tbl_47, 1, 4, 0x0f),
1641 INSTR(0x48, "lh", IF_RXa, F_370 | F_390 | F_Z),
1642 INSTR(0x49, "ch", IF_RXa, F_370 | F_390 | F_Z),
1643 INSTR(0x4a, "ah", IF_RXa, F_370 | F_390 | F_Z),
1644 INSTR(0x4b, "sh", IF_RXa, F_370 | F_390 | F_Z),
1645 INSTR(0x4c, "mh", IF_RXa, F_370 | F_390 | F_Z),
1646 INSTR(0x4d, "bas", IF_RXa, F_390 | F_Z),
1647 INSTR(0x4e, "cvd", IF_RXa, F_370 | F_390 | F_Z),
1648 INSTR(0x4f, "cvb", IF_RXa, F_370 | F_390 | F_Z),
1649 INSTR(0x50, "st", IF_RXa, F_370 | F_390 | F_Z),
1650 INSTR(0x51, "lae", IF_RXa, F_390 | F_Z),
1651 INSTR(0x54, "n", IF_RXa, F_370 | F_390 | F_Z),
1652 INSTR(0x55, "cl", IF_RXa, F_370 | F_390 | F_Z),
1653 INSTR(0x56, "o", IF_RXa, F_370 | F_390 | F_Z),
1654 INSTR(0x57, "x", IF_RXa, F_370 | F_390 | F_Z),
1655 INSTR(0x58, "l", IF_RXa, F_370 | F_390 | F_Z),
1656 INSTR(0x59, "c", IF_RXa, F_370 | F_390 | F_Z),
1657 INSTR(0x5a, "a", IF_RXa, F_370 | F_390 | F_Z),
1658 INSTR(0x5b, "s", IF_RXa, F_370 | F_390 | F_Z),
1659 INSTR(0x5c, "m", IF_RXa, F_370 | F_390 | F_Z),
1660 INSTR(0x5d, "d", IF_RXa, F_370 | F_390 | F_Z),
1661 INSTR(0x5e, "al", IF_RXa, F_370 | F_390 | F_Z),
1662 INSTR(0x5f, "sl", IF_RXa, F_370 | F_390 | F_Z),
1663 INSTR(0x60, "std", IF_RXa, F_370 | F_390 | F_Z),
1664 INSTR(0x67, "mxd", IF_RXa, F_370 | F_390 | F_Z),
1665 INSTR(0x68, "ld", IF_RXa, F_370 | F_390 | F_Z),
1666 INSTR(0x69, "cd", IF_RXa, F_370 | F_390 | F_Z),
1667 INSTR(0x6a, "ad", IF_RXa, F_370 | F_390 | F_Z),
1668 INSTR(0x6b, "sd", IF_RXa, F_370 | F_390 | F_Z),
1669 INSTR(0x6c, "md", IF_RXa, F_370 | F_390 | F_Z),
1670 INSTR(0x6d, "dd", IF_RXa, F_370 | F_390 | F_Z),
1671 INSTR(0x6e, "aw", IF_RXa, F_370 | F_390 | F_Z),
1672 INSTR(0x6f, "sw", IF_RXa, F_370 | F_390 | F_Z),
1673 INSTR(0x70, "ste", IF_RXa, F_370 | F_390 | F_Z),
1674 INSTR(0x71, "ms", IF_RXa, F_390 | F_Z),
1675 INSTR(0x78, "le", IF_RXa, F_370 | F_390 | F_Z),
1676 INSTR(0x79, "ce", IF_RXa, F_370 | F_390 | F_Z),
1677 INSTR(0x7a, "ae", IF_RXa, F_370 | F_390 | F_Z),
1678 INSTR(0x7b, "se", IF_RXa, F_370 | F_390 | F_Z),
1679 MULTI(0x7c, tbl_7c),
1680 INSTR(0x7d, "de", IF_RXa, F_370 | F_390 | F_Z),
1681 INSTR(0x7e, "au", IF_RXa, F_370 | F_390 | F_Z),
1682 INSTR(0x7f, "su", IF_RXa, F_370 | F_390 | F_Z),
1683 INSTR(0x80, "ssm", IF_S, F_370 | F_390 | F_Z),
1684 INSTR(0x82, "lpsw", IF_S, F_370 | F_390 | F_Z),
1685 INSTR(0x83, "diag", IF_DIAG, F_370 | F_390 | F_Z),
1686 MULTI(0x84, tbl_84),
1687 MULTI(0x85, tbl_85),
1688 INSTR(0x86, "bxh", IF_RSa, F_370 | F_390 | F_Z),
1689 INSTR(0x87, "bxle", IF_RSa, F_370 | F_390 | F_Z),
1690 INSTR(0x88, "srl", IF_RSa, F_370 | F_390 | F_Z),
1691 INSTR(0x89, "sll", IF_RSa, F_370 | F_390 | F_Z),
1692 INSTR(0x8a, "sra", IF_RSa, F_370 | F_390 | F_Z),
1693 INSTR(0x8b, "sla", IF_RSa, F_370 | F_390 | F_Z),
1694 INSTR(0x8c, "srdl", IF_RSa, F_370 | F_390 | F_Z),
1695 INSTR(0x8d, "sldl", IF_RSa, F_370 | F_390 | F_Z),
1696 INSTR(0x8e, "srda", IF_RSa, F_370 | F_390 | F_Z),
1697 INSTR(0x8f, "slda", IF_RSa, F_370 | F_390 | F_Z),
1698 INSTR(0x90, "stm", IF_RSa, F_370 | F_390 | F_Z),
1699 INSTR(0x91, "tm", IF_SI, F_370 | F_390 | F_Z),
1700 INSTR(0x92, "mvi", IF_SI, F_370 | F_390 | F_Z),
1701 INSTR(0x93, "ts", IF_S, F_370 | F_390 | F_Z),
1702 INSTR(0x94, "ni", IF_SI, F_370 | F_390 | F_Z),
1703 INSTR(0x95, "cli", IF_SI, F_370 | F_390 | F_Z),
1704 INSTR(0x96, "oi", IF_SI, F_370 | F_390 | F_Z),
1705 INSTR(0x97, "xi", IF_SI, F_370 | F_390 | F_Z),
1706 INSTR(0x98, "lm", IF_RSa, F_370 | F_390 | F_Z),
1707 INSTR(0x99, "trace", IF_RSa, F_390 | F_Z),
1708 INSTR(0x9a, "lam", IF_RSa, F_390 | F_Z),
1709 INSTR(0x9b, "stam", IF_RSa, F_390 | F_Z),
1710 TABLE(0xa5, tbl_a5x, 1, 0, 0x0f),
1711 TABLE(0xa7, tbl_a7x, 1, 0, 0x0f),
1712 INSTR(0xa8, "mvcle", IF_RSa, F_390 | F_Z),
1713 INSTR(0xa9, "clcle", IF_RSa, F_390 | F_Z),
1714 INSTR(0xac, "stnsm", IF_SI, F_370 | F_390 | F_Z),
1715 INSTR(0xad, "stosm", IF_SI, F_370 | F_390 | F_Z),
1716 INSTR(0xae, "sigp", IF_RSa, F_370 | F_390 | F_Z),
1717 INSTR(0xaf, "mc", IF_SI, F_370 | F_390 | F_Z),
1718 INSTR(0xb1, "lra", IF_RXa, F_370 | F_390 | F_Z),
1719 TABLE(0xb2, tbl_b2xx, 1, 0, 0xff),
1720 TABLE(0xb3, tbl_b3xx, 1, 0, 0xff),
1721 INSTR(0xb6, "stctl", IF_RSa, F_370 | F_390 | F_Z | F_CTL_REG),
1722 INSTR(0xb7, "lctl", IF_RSa, F_370 | F_390 | F_Z | F_CTL_REG),
1723 TABLE(0xb9, tbl_b9xx, 1, 0, 0xff),
1724 INSTR(0xba, "cs", IF_RSa, F_370 | F_390 | F_Z),
1725 INSTR(0xbb, "cds", IF_RSa, F_370 | F_390 | F_Z),
1726 INSTR(0xbd, "clm", IF_RSb, F_370 | F_390 | F_Z),
1727 INSTR(0xbe, "stcm", IF_RSb, F_370 | F_390 | F_Z),
1728 INSTR(0xbf, "icm", IF_RSb, F_370 | F_390 | F_Z),
1729 TABLE(0xc0, tbl_c0x, 1, 0, 0x0f),
1730 TABLE(0xc2, tbl_c2x, 1, 0, 0x0f),
1731 TABLE(0xc4, tbl_c4x, 1, 0, 0x0f),
1732 INSTR(0xc5, "bprp", IF_MII, F_Z),
1733 TABLE(0xc6, tbl_c6x, 1, 0, 0x0f),
1734 INSTR(0xc7, "bpp", IF_SMI, F_Z),
1735 TABLE(0xc8, tbl_c8x, 1, 0, 0x0f),
1736 TABLE(0xcc, tbl_ccx, 1, 0, 0x0f),
1737 INSTR(0xd0, "trtr", IF_SSa, F_Z),
1738 INSTR(0xd1, "mvn", IF_SSa, F_370 | F_390 | F_Z),
1739 INSTR(0xd2, "mvc", IF_SSa, F_370 | F_390 | F_Z),
1740 INSTR(0xd3, "mvz", IF_SSa, F_370 | F_390 | F_Z),
1741 INSTR(0xd4, "nc", IF_SSa, F_370 | F_390 | F_Z),
1742 INSTR(0xd5, "clc", IF_SSa, F_370 | F_390 | F_Z),
1743 INSTR(0xd6, "oc", IF_SSa, F_370 | F_390 | F_Z),
1744 INSTR(0xd7, "xc", IF_SSa, F_370 | F_390 | F_Z),
1745 INSTR(0xd9, "mvck", IF_SSd, F_390 | F_Z),
1746 INSTR(0xda, "mvcp", IF_SSd, F_390 | F_Z),
1747 INSTR(0xdb, "mvcs", IF_SSd, F_390 | F_Z),
1748 INSTR(0xdc, "tr", IF_SSa, F_370 | F_390 | F_Z),
1749 INSTR(0xdd, "trt", IF_SSa, F_370 | F_390 | F_Z),
1750 INSTR(0xde, "ed", IF_SSa, F_370 | F_390 | F_Z),
1751 INSTR(0xdf, "edmk", IF_SSa, F_370 | F_390 | F_Z),
1752 INSTR(0xe1, "pku", IF_SSf, F_390 | F_Z),
1753 INSTR(0xe2, "unpku", IF_SSa, F_390 | F_Z),
1754 TABLE(0xe3, tbl_e3xx, 5, 0, 0xff),
1755 TABLE(0xe5, tbl_e5xx, 1, 0, 0xff),
1756 INSTR(0xe8, "mvcin", IF_SSa, F_390 | F_Z),
1757 INSTR(0xe9, "pka", IF_SSf, F_390 | F_Z),
1758 INSTR(0xea, "unpka", IF_SSa, F_390 | F_Z),
1759 TABLE(0xeb, tbl_ebxx, 5, 0, 0xff),
1760 TABLE(0xec, tbl_ecxx, 5, 0, 0xff),
1761 TABLE(0xed, tbl_edxx, 5, 0, 0xff),
1762 INSTR(0xee, "plo", IF_SSe, F_390 | F_Z),
1763 INSTR(0xef, "lmd", IF_SSe, F_Z),
1764 INSTR(0xf0, "srp", IF_SSc, F_370 | F_390 | F_Z),
1765 INSTR(0xf1, "mvo", IF_SSb, F_370 | F_390 | F_Z),
1766 INSTR(0xf2, "pack", IF_SSb, F_370 | F_390 | F_Z),
1767 INSTR(0xf3, "unpk", IF_SSb, F_370 | F_390 | F_Z),
1768 INSTR(0xf8, "zap", IF_SSb, F_370 | F_390 | F_Z),
1769 INSTR(0xf9, "cp", IF_SSb, F_370 | F_390 | F_Z),
1770 INSTR(0xfa, "ap", IF_SSb, F_370 | F_390 | F_Z),
1771 INSTR(0xfb, "sp", IF_SSb, F_370 | F_390 | F_Z),
1772 INSTR(0xfc, "mp", IF_SSb, F_370 | F_390 | F_Z),
1773 INSTR(0xfd, "dp", IF_SSb, F_370 | F_390 | F_Z),
1775 /* END CSTYLED */
1777 /* how masks are printed */
1778 static const char *M[16] = {
1779 "0", "1", "2", "3", "4", "5", "6", "7",
1780 "8", "9", "10", "11", "12", "13", "14", "15",
1783 /* how general purpose regs are printed */
1784 static const char *R[16] = {
1785 "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7",
1786 "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
1789 /* how control regs are printed */
1790 static const char *C[16] = {
1791 "%c0", "%c1", "%c2", "%c3", "%c4", "%c5", "%c6", "%c7",
1792 "%c8", "%c9", "%c10", "%c11", "%c12", "%c13", "%c14", "%c15",
1795 /* B and X registers are still registers - print them the same way */
1796 #define B R
1797 #define X R
1799 static inline uint32_t
1800 val_8_4_8(uint32_t hi, uint32_t mid, uint32_t lo)
1802 ASSERT0(hi & ~0xff);
1803 ASSERT0(mid & ~0xf);
1804 ASSERT0(lo & ~0xff);
1805 return ((hi << 12) | (mid << 8) | lo);
1808 static inline uint32_t
1809 val_16_16(uint32_t hi, uint32_t lo)
1811 ASSERT0(hi & ~0xffff);
1812 ASSERT0(lo & ~0xffff);
1813 return ((BE_16(hi) << 16) | BE_16(lo));
1816 static inline int32_t
1817 sval_16_16(uint32_t hi, uint32_t lo)
1819 return (val_16_16(hi, lo));
1822 static inline uint32_t
1823 val_8_16(uint32_t hi, uint32_t lo)
1825 ASSERT0(hi & ~0xff);
1826 ASSERT0(lo & ~0xffff);
1827 return ((hi << 16) | BE_16(lo));
1830 static inline int32_t
1831 sval_8_16(uint32_t hi, uint32_t lo)
1833 int32_t tmp = val_8_16(hi, lo);
1835 /* sign extend */
1836 if (tmp & 0x00800000)
1837 return (0xff000000 | tmp);
1838 return (tmp);
1841 static inline uint32_t
1842 val_4_8(uint32_t hi, uint32_t lo)
1844 ASSERT0(hi & ~0xf);
1845 ASSERT0(lo & ~0xff);
1846 return ((hi << 8) | lo);
1849 static inline int32_t
1850 sval_4_8(uint32_t hi, uint32_t lo)
1852 uint32_t tmp = val_4_8(hi, lo);
1854 /* sign extend */
1855 if (tmp & 0x800)
1856 return (0xfffff000 | tmp);
1857 return (tmp);
1860 static void
1861 lookup_sym(dis_handle_t *dhp, uint64_t addr, char *buf, size_t buflen)
1863 size_t curlen;
1865 if (dhp->dh_lookup(dhp->dh_data, addr, NULL, 0, NULL, NULL) != 0)
1866 return;
1868 strlcat(buf, "\t<", buflen);
1869 curlen = strlen(buf);
1870 dhp->dh_lookup(dhp->dh_data, addr, buf + curlen, buflen - curlen, NULL,
1871 NULL);
1872 strlcat(buf, ">", buflen);
1875 /* ARGSUSED */
1876 static void
1877 fmt_zero(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1879 (void) snprintf(buf, buflen, "0x00, 0x00");
1882 /* ARGSUSED */
1883 static void
1884 fmt_diag(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1886 (void) snprintf(buf, buflen, "%#x",
1887 val_8_16(inst->diag.par1, inst->diag.par2));
1890 /* ARGSUSED */
1891 static void
1892 fmt_e(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1894 /* nothing to do */
1897 /* ARGSUSED */
1898 static void
1899 fmt_i(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1901 (void) snprintf(buf, buflen, "%#x", inst->i.i);
1904 /* ARGSUSED */
1905 static void
1906 fmt_ie(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1908 (void) snprintf(buf, buflen, "%u,%u", inst->ie.i1, inst->ie.i2);
1911 /* ARGSUSED */
1912 static void
1913 fmt_mii(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1915 uint64_t ri2 = addr + 2 * sval_4_8(inst->mii.ri2h, inst->mii.ri2l);
1916 uint64_t ri3 = addr + 2 * sval_8_16(inst->mii.ri3h, inst->mii.ri3l);
1918 (void) snprintf(buf, buflen, "%s,%#x,%#x", M[inst->mii.m1], ri2, ri3);
1920 lookup_sym(dhp, ri2, buf, buflen);
1921 lookup_sym(dhp, ri3, buf, buflen);
1924 /* ARGSUSED */
1925 static void
1926 fmt_ril_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1928 (void) snprintf(buf, buflen, "%s,%u", R[inst->ril_a.r1],
1929 val_16_16(inst->ril_a.i2h, inst->ril_a.i2l));
1932 /* ARGSUSED */
1933 static void
1934 fmt_ril_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf,
1935 size_t buflen, int flags)
1937 uint64_t ri2 = addr + 2 *
1938 sval_16_16(inst->ril_b.ri2h, inst->ril_b.ri2l);
1940 (void) snprintf(buf, buflen, "%s,%#x", R[inst->ril_b.r1], ri2);
1942 lookup_sym(dhp, ri2, buf, buflen);
1945 /* ARGSUSED */
1946 static void
1947 fmt_ril_c(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1949 uint64_t ri2 = addr + 2 *
1950 sval_16_16(inst->ril_c.ri2h, inst->ril_c.ri2l);
1952 (void) snprintf(buf, buflen, "%s,%#x", M[inst->ril_c.m1], ri2);
1954 lookup_sym(dhp, ri2, buf, buflen);
1957 /* ARGSUSED */
1958 static void
1959 fmt_ris(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1961 uint32_t d4 = val_4_8(inst->ris.d4h, inst->ris.d4l);
1963 (void) snprintf(buf, buflen, "%s,%u,%s,%u(%s)",
1964 R[inst->ris.r1], inst->ris.i2, M[inst->ris.m3], d4,
1965 B[inst->ris.b4]);
1968 /* ARGSUSED */
1969 static void
1970 fmt_ri_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1972 uint16_t i2 = BE_16(inst->ri_a.i2);
1974 if (flags & F_SIGNED_IMM)
1975 (void) snprintf(buf, buflen, "%s,%d", R[inst->ri_a.r1],
1976 (int16_t)i2);
1977 else
1978 (void) snprintf(buf, buflen, "%s,%u", R[inst->ri_a.r1],
1979 i2);
1982 /* ARGSUSED */
1983 static void
1984 fmt_ri_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1986 uint64_t ri2 = addr + 2 * (int16_t)BE_16(inst->ri_b.ri2);
1988 (void) snprintf(buf, buflen, "%s,%#x", R[inst->ri_b.r1], ri2);
1990 lookup_sym(dhp, ri2, buf, buflen);
1993 static void
1994 fmt_ri_c(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
1996 uint64_t ri2 = addr + 2 * (int16_t)BE_16(inst->ri_c.ri2);
1998 if (flags & F_HIDE_MASK)
1999 (void) snprintf(buf, buflen, "%#x", ri2);
2000 else
2001 (void) snprintf(buf, buflen, "%s,%#x", M[inst->ri_c.m1], ri2);
2003 lookup_sym(dhp, ri2, buf, buflen);
2006 /* ARGSUSED */
2007 static void
2008 fmt_rie_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2010 (void) snprintf(buf, buflen, "%s,%u,%s", R[inst->rie_a.r1],
2011 BE_16(inst->rie_a.i2), M[inst->rie_a.m3]);
2014 /* ARGSUSED */
2015 static void
2016 fmt_rie_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2018 uint64_t ri4 = addr + 2 * (int16_t)BE_16(inst->rie_b.ri4);
2020 (void) snprintf(buf, buflen, "%s,%s,%s,%#x", R[inst->rie_b.r1],
2021 R[inst->rie_b.r2], M[inst->rie_b.m3], ri4);
2023 lookup_sym(dhp, ri4, buf, buflen);
2026 /* ARGSUSED */
2027 static void
2028 fmt_rie_c(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2030 uint64_t ri4 = addr + 2 * (int16_t)BE_16(inst->rie_c.ri4);
2032 (void) snprintf(buf, buflen, "%s,%u,%s,%#x", R[inst->rie_c.r1],
2033 inst->rie_c.i2, M[inst->rie_c.m3], ri4);
2035 lookup_sym(dhp, ri4, buf, buflen);
2038 /* ARGSUSED */
2039 static void
2040 fmt_rie_d(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2042 (void) snprintf(buf, buflen, "%s,%s,%u", R[inst->rie_d.r1],
2043 R[inst->rie_d.r3], BE_16(inst->rie_d.i2));
2046 /* ARGSUSED */
2047 static void
2048 fmt_rie_e(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2050 uint64_t ri2 = addr + 2 * (int16_t)BE_16(inst->rie_e.ri2);
2052 (void) snprintf(buf, buflen, "%s,%s,%#x", R[inst->rie_e.r1],
2053 R[inst->rie_e.r3], ri2);
2055 lookup_sym(dhp, ri2, buf, buflen);
2058 /* ARGSUSED */
2059 static void
2060 fmt_rie_f(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2062 (void) snprintf(buf, buflen, "%s,%s,%u,%u,%u", R[inst->rie_f.r1],
2063 R[inst->rie_f.r2], inst->rie_f.i3, inst->rie_f.i4,
2064 inst->rie_f.i5);
2067 /* ARGSUSED */
2068 static void
2069 fmt_rre(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2071 (void) snprintf(buf, buflen, "%s,%s", R[inst->rre.r1], R[inst->rre.r2]);
2074 /* ARGSUSED */
2075 static void
2076 fmt_rrf_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2078 (void) snprintf(buf, buflen, "%s,%s,%s",
2079 R[inst->rrf_ab.r1], R[inst->rrf_ab.r2], R[inst->rrf_ab.r3]);
2082 /* ARGSUSED */
2083 static void
2084 fmt_rrf_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2086 (void) snprintf(buf, buflen, "%s,%s,%s",
2087 R[inst->rrf_ab.r1], R[inst->rrf_ab.r3], R[inst->rrf_ab.r2]);
2090 /* ARGSUSED */
2091 static void
2092 fmt_rrf_c(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2094 (void) snprintf(buf, buflen, "%s,%s,%s",
2095 R[inst->rrf_cde.r1], R[inst->rrf_cde.r2], M[inst->rrf_cde.m3]);
2098 /* ARGSUSED */
2099 static void
2100 fmt_rrf_d(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2102 (void) snprintf(buf, buflen, "%s,%s,%s",
2103 R[inst->rrf_cde.r1], R[inst->rrf_cde.r2], M[inst->rrf_cde.m4]);
2106 /* ARGSUSED */
2107 static void
2108 fmt_rrf_e(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2110 (void) snprintf(buf, buflen, "%s,%s,%s,%s",
2111 R[inst->rrf_cde.r1], M[inst->rrf_cde.m3],
2112 R[inst->rrf_cde.r2], M[inst->rrf_cde.m4]);
2115 /* ARGSUSED */
2116 static void
2117 fmt_rrs(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2119 (void) snprintf(buf, buflen, "%s,%s,%s,%u(%s)", R[inst->rrs.r1],
2120 R[inst->rrs.r2], M[inst->rrs.m3],
2121 val_4_8(inst->rrs.d4h, inst->rrs.d4l), B[inst->rrs.b4]);
2124 /* ARGSUSED */
2125 static void
2126 fmt_rr(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2128 /* a branch uses r1 as a mask */
2129 if (flags & F_HIDE_MASK)
2130 (void) snprintf(buf, buflen, "%s", R[inst->rr.r2]);
2131 else if (flags & F_R1_IS_MASK)
2132 (void) snprintf(buf, buflen, "%s,%s", M[inst->rr.r1],
2133 R[inst->rr.r2]);
2134 else
2135 (void) snprintf(buf, buflen, "%s,%s", R[inst->rr.r1],
2136 R[inst->rr.r2]);
2139 /* ARGSUSED */
2140 static void
2141 fmt_rrd(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2143 (void) snprintf(buf, buflen, "%s,%s,%s", R[inst->rrd.r1],
2144 R[inst->rrd.r3], R[inst->rrd.r2]);
2147 /* ARGSUSED */
2148 static void
2149 fmt_rx_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2151 uint32_t d2 = val_4_8(inst->rx_a.d2h, inst->rx_b.d2l);
2153 (void) snprintf(buf, buflen, "%s,%u(%s,%s)", R[inst->rx_a.r1],
2154 d2, X[inst->rx_a.x2], B[inst->rx_a.b2]);
2157 /* ARGSUSED */
2158 static void
2159 fmt_rx_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2161 uint32_t d2 = val_4_8(inst->rx_b.d2h, inst->rx_b.d2l);
2163 if (flags & F_HIDE_MASK)
2164 (void) snprintf(buf, buflen, "%u(%s,%s)",
2165 d2, X[inst->rx_b.x2], B[inst->rx_b.b2]);
2166 else
2167 (void) snprintf(buf, buflen, "%s,%u(%s,%s)", M[inst->rx_b.m1],
2168 d2, X[inst->rx_b.x2], B[inst->rx_b.b2]);
2171 /* ARGSUSED */
2172 static void
2173 fmt_rxe(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2175 uint32_t d2 = val_4_8(inst->rxe.d2h, inst->rxe.d2l);
2177 (void) snprintf(buf, buflen, "%s,%u(%s,%s)",
2178 R[inst->rxe.r1], d2, X[inst->rxe.x2], B[inst->rxe.b2]);
2181 /* ARGSUSED */
2182 static void
2183 fmt_rxf(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2185 uint32_t d2 = val_4_8(inst->rxf.d2h, inst->rxf.d2l);
2187 (void) snprintf(buf, buflen, "%s,%s,%u(%s,%s)",
2188 R[inst->rxf.r1], R[inst->rxf.r3], d2, X[inst->rxf.x2],
2189 B[inst->rxf.b2]);
2192 /* ARGSUSED */
2193 static void
2194 fmt_rxy_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2196 uint32_t d2;
2198 d2 = val_8_4_8(inst->rxy_a.dh2, inst->rxy_a.dl2h, inst->rxy_a.dl2l);
2200 (void) snprintf(buf, buflen, "%s,%u(%s,%s)",
2201 R[inst->rxy_a.r1], d2, X[inst->rxy_a.x2], B[inst->rxy_a.b2]);
2204 /* ARGSUSED */
2205 static void
2206 fmt_rxy_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2208 uint32_t d2;
2210 d2 = val_8_4_8(inst->rxy_b.dh2, inst->rxy_b.dl2h, inst->rxy_b.dl2l);
2212 (void) snprintf(buf, buflen, "%s,%u(%s,%s)",
2213 M[inst->rxy_b.m1], d2, X[inst->rxy_b.x2], B[inst->rxy_b.b2]);
2216 /* ARGSUSED */
2217 static void
2218 fmt_rs_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2220 const char *r1, *r3;
2222 if (flags & F_CTL_REG) {
2223 r1 = C[inst->rs_a.r1];
2224 r3 = C[inst->rs_a.r3];
2225 } else {
2226 r1 = R[inst->rs_a.r1];
2227 r3 = R[inst->rs_a.r3];
2230 (void) snprintf(buf, buflen, "%s,%s,%u(%s)", r1, r3,
2231 val_4_8(inst->rs_a.d2h, inst->rs_a.d2l), B[inst->rs_a.b2]);
2234 /* ARGSUSED */
2235 static void
2236 fmt_rs_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2238 (void) snprintf(buf, buflen, "%s,%s,%u(%s)", R[inst->rs_b.r1],
2239 M[inst->rs_b.m3], val_4_8(inst->rs_b.d2h, inst->rs_b.d2l),
2240 B[inst->rs_b.b2]);
2243 /* ARGSUSED */
2244 static void
2245 fmt_rsl_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2247 (void) snprintf(buf, buflen, "%u(%u,%s)",
2248 val_4_8(inst->rsl_a.d1h, inst->rsl_a.d1l), inst->rsl_a.l1,
2249 B[inst->rsl_a.b1]);
2252 /* ARGSUSED */
2253 static void
2254 fmt_rsl_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2256 (void) snprintf(buf, buflen, "%s,%u(%u,%s),%s",
2257 R[inst->rsl_b.r1],
2258 val_4_8(inst->rsl_b.d2h, inst->rsl_b.d2l), inst->rsl_b.l2,
2259 B[inst->rsl_b.b2], M[inst->rsl_b.m3]);
2262 /* ARGSUSED */
2263 static void
2264 fmt_rsy_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2266 const char *r1, *r3;
2267 uint32_t d2;
2269 d2 = val_8_4_8(inst->rsy_a.dh2, inst->rsy_a.dl2h, inst->rsy_a.dl2l);
2271 if (flags & F_CTL_REG) {
2272 r1 = C[inst->rsy_a.r1];
2273 r3 = C[inst->rsy_a.r3];
2274 } else {
2275 r1 = R[inst->rsy_a.r1];
2276 r3 = R[inst->rsy_a.r3];
2279 (void) snprintf(buf, buflen, "%s,%s,%u(%s)", r1, r3, d2,
2280 B[inst->rsy_a.b2]);
2283 /* ARGSUSED */
2284 static void
2285 fmt_rsy_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2287 uint32_t d2;
2289 d2 = val_8_4_8(inst->rsy_b.dh2, inst->rsy_b.dl2h, inst->rsy_b.dl2l);
2291 (void) snprintf(buf, buflen, "%s,%s,%u(%s)",
2292 R[inst->rsy_b.r1], M[inst->rsy_b.m3],
2293 d2, B[inst->rsy_b.b2]);
2296 /* ARGSUSED */
2297 static void
2298 fmt_rsi(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2300 uint64_t ri2 = addr + 2 * (int16_t)BE_16(inst->rsi.ri2);
2302 (void) snprintf(buf, buflen, "%s,%s,%#x", R[inst->rsi.r1],
2303 R[inst->rsi.r3], ri2);
2305 lookup_sym(dhp, ri2, buf, buflen);
2308 /* ARGSUSED */
2309 static void
2310 fmt_si(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2312 uint32_t d1 = val_4_8(inst->si.d1h, inst->si.d1l);
2314 (void) snprintf(buf, buflen, "%u(%s),%u", d1, B[inst->si.b1],
2315 inst->si.i2);
2318 /* ARGSUSED */
2319 static void
2320 fmt_sil(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2322 (void) snprintf(buf, buflen, "%u(%s),%u",
2323 val_4_8(inst->sil.d1h, inst->sil.d1l), B[inst->sil.b1],
2324 BE_16(inst->sil.i2));
2327 /* ARGSUSED */
2328 static void
2329 fmt_siy(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2331 (void) snprintf(buf, buflen, "%u(%s),%u",
2332 val_8_4_8(inst->siy.dh1, inst->siy.dl1h, inst->siy.dl1l),
2333 B[inst->siy.b1], inst->siy.i2);
2336 /* ARGSUSED */
2337 static void
2338 fmt_smi(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2340 uint64_t ri2 = addr + 2 * (int16_t)BE_16(inst->smi.ri2);
2342 (void) snprintf(buf, buflen, "%s,%#x,%u(%s)", M[inst->smi.m1], ri2,
2343 val_4_8(inst->smi.d3h, inst->smi.d3l), B[inst->smi.b3]);
2345 lookup_sym(dhp, ri2, buf, buflen);
2348 /* ARGSUSED */
2349 static void
2350 fmt_s(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2352 uint32_t d = val_4_8(inst->s.d2h, inst->s.d2l);
2354 (void) snprintf(buf, buflen, "%u(%s)", d, B[inst->s.b2]);
2357 /* ARGSUSED */
2358 static void
2359 fmt_ss_a(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2361 uint32_t d1, d2;
2363 d1 = val_4_8(inst->ss_a.d1h, inst->ss_a.d1l);
2364 d2 = val_4_8(inst->ss_a.d2h, inst->ss_a.d2l);
2366 (void) snprintf(buf, buflen, "%u(%u,%s),%u(%s)",
2367 d1, inst->ss_a.l + 1, B[inst->ss_a.b1],
2368 d2, B[inst->ss_a.b2]);
2371 /* ARGSUSED */
2372 static void
2373 fmt_ss_b(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2375 uint32_t d1, d2;
2377 d1 = val_4_8(inst->ss_b.d1h, inst->ss_b.d1l);
2378 d2 = val_4_8(inst->ss_b.d2h, inst->ss_b.d2l);
2380 (void) snprintf(buf, buflen, "%u(%u,%s),%u(%u,%s)",
2381 d1, inst->ss_b.l1 + 1, B[inst->ss_b.b1],
2382 d2, inst->ss_b.l2 + 1, B[inst->ss_b.b2]);
2385 /* ARGSUSED */
2386 static void
2387 fmt_ss_c(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2389 uint32_t d1, d2;
2391 d1 = val_4_8(inst->ss_c.d1h, inst->ss_c.d1l);
2392 d2 = val_4_8(inst->ss_c.d2h, inst->ss_c.d2l);
2394 (void) snprintf(buf, buflen, "%u(%u,%s),%u(%s),%u",
2395 d1, inst->ss_c.l1, B[inst->ss_c.b1],
2396 d2, B[inst->ss_c.b2], inst->ss_c.i3);
2399 /* ARGSUSED */
2400 static void
2401 fmt_ss_d(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2403 uint32_t d1, d2;
2405 d1 = val_4_8(inst->ss_d.d1h, inst->ss_d.d1l);
2406 d2 = val_4_8(inst->ss_d.d2h, inst->ss_d.d2l);
2408 (void) snprintf(buf, buflen, "%u(%s,%s),%u(%s),%s",
2409 d1, R[inst->ss_d.r1], B[inst->ss_d.b1],
2410 d2, B[inst->ss_d.b2], R[inst->ss_d.r3]);
2413 /* ARGSUSED */
2414 static void
2415 fmt_ss_e(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2417 uint32_t d2, d4;
2419 d2 = val_4_8(inst->ss_e.d2h, inst->ss_e.d2l);
2420 d4 = val_4_8(inst->ss_e.d4h, inst->ss_e.d4l);
2422 (void) snprintf(buf, buflen, "%s,%u(%s),%s,%u(%s)",
2423 R[inst->ss_e.r1], d2, B[inst->ss_e.b2],
2424 R[inst->ss_e.r3], d4, B[inst->ss_e.b4]);
2427 /* ARGSUSED */
2428 static void
2429 fmt_ss_f(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2431 uint32_t d1, d2;
2433 d1 = val_4_8(inst->ss_f.d1h, inst->ss_f.d1l);
2434 d2 = val_4_8(inst->ss_f.d2h, inst->ss_f.d2l);
2436 (void) snprintf(buf, buflen, "%u(%s),%u(%u,%s)",
2437 d1, B[inst->ss_f.b1], d2, inst->ss_f.l2,
2438 B[inst->ss_f.b2]);
2441 /* ARGSUSED */
2442 static void
2443 fmt_sse(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2445 uint32_t d1 = val_4_8(inst->sse.d1h, inst->sse.d1l);
2446 uint32_t d2 = val_4_8(inst->sse.d2h, inst->sse.d2l);
2448 (void) snprintf(buf, buflen, "%u(%s),%u(%s)",
2449 d1, B[inst->sse.b1], d2, B[inst->sse.b2]);
2452 /* ARGSUSED */
2453 static void
2454 fmt_ssf(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf, size_t buflen, int flags)
2456 uint32_t d1 = val_4_8(inst->ssf.d1h, inst->ssf.d1l);
2457 uint32_t d2 = val_4_8(inst->ssf.d2h, inst->ssf.d2l);
2459 (void) snprintf(buf, buflen, "%u(%s),%u(%s),%s",
2460 d1, B[inst->ssf.b1],
2461 d2, B[inst->ssf.b2], R[inst->ssf.r3]);
2464 static void (*fmt_fxns[IF_NFMTS])(dis_handle_t *, uint64_t, union inst *,
2465 char *, size_t, int) = {
2466 [IF_ZERO] = fmt_zero,
2467 [IF_DIAG] = fmt_diag,
2468 [IF_E] = fmt_e,
2469 [IF_I] = fmt_i,
2470 [IF_IE] = fmt_ie,
2471 [IF_MII] = fmt_mii,
2472 [IF_RIa] = fmt_ri_a,
2473 [IF_RIb] = fmt_ri_b,
2474 [IF_RIc] = fmt_ri_c,
2475 [IF_RIEa] = fmt_rie_a,
2476 [IF_RIEb] = fmt_rie_b,
2477 [IF_RIEc] = fmt_rie_c,
2478 [IF_RIEd] = fmt_rie_d,
2479 [IF_RIEe] = fmt_rie_e,
2480 [IF_RIEf] = fmt_rie_f,
2481 [IF_RILa] = fmt_ril_a,
2482 [IF_RILb] = fmt_ril_b,
2483 [IF_RILc] = fmt_ril_c,
2484 [IF_RIS] = fmt_ris,
2485 [IF_RR] = fmt_rr,
2486 [IF_RRD] = fmt_rrd,
2487 [IF_RRE] = fmt_rre,
2488 [IF_RRFa] = fmt_rrf_a,
2489 [IF_RRFb] = fmt_rrf_b,
2490 [IF_RRFc] = fmt_rrf_c,
2491 [IF_RRFd] = fmt_rrf_d,
2492 [IF_RRFe] = fmt_rrf_e,
2493 [IF_RRS] = fmt_rrs,
2494 [IF_RSa] = fmt_rs_a,
2495 [IF_RSb] = fmt_rs_b,
2496 [IF_RSI] = fmt_rsi,
2497 [IF_RSLa] = fmt_rsl_a,
2498 [IF_RSLb] = fmt_rsl_b,
2499 [IF_RSYa] = fmt_rsy_a,
2500 [IF_RSYb] = fmt_rsy_b,
2501 [IF_RXa] = fmt_rx_a,
2502 [IF_RXb] = fmt_rx_b,
2503 [IF_RXE] = fmt_rxe,
2504 [IF_RXF] = fmt_rxf,
2505 [IF_RXYa] = fmt_rxy_a,
2506 [IF_RXYb] = fmt_rxy_b,
2507 [IF_S] = fmt_s,
2508 [IF_SI] = fmt_si,
2509 [IF_SIL] = fmt_sil,
2510 [IF_SIY] = fmt_siy,
2511 [IF_SMI] = fmt_smi,
2512 [IF_SSa] = fmt_ss_a,
2513 [IF_SSb] = fmt_ss_b,
2514 [IF_SSc] = fmt_ss_c,
2515 [IF_SSd] = fmt_ss_d,
2516 [IF_SSe] = fmt_ss_e,
2517 [IF_SSf] = fmt_ss_f,
2518 [IF_SSE] = fmt_sse,
2519 [IF_SSF] = fmt_ssf,
2523 * Even if we don't know how to disassemble the instruction, we know how long
2524 * it is, so we always succeed. That is why we can get away with returning
2525 * void.
2527 static void
2528 dis_s390(dis_handle_t *dhp, uint64_t addr, union inst *inst, char *buf,
2529 size_t buflen, int mach)
2531 const struct inst_table *tbl = &tbl_xx[inst->raw[0]];
2532 int tmp;
2534 /* nothing to do */
2535 if (buflen == 0)
2536 return;
2538 while (tbl->it_fmt == IF_TBL || tbl->it_fmt == IF_MULTI) {
2539 if (tbl->it_fmt == IF_TBL) {
2540 int idx;
2542 idx = inst->raw[tbl->it_u.it_table.it_off];
2543 idx >>= tbl->it_u.it_table.it_shift;
2544 idx &= tbl->it_u.it_table.it_mask;
2546 tbl = &tbl->it_u.it_table.it_ptr[idx];
2547 } else if (tbl->it_fmt == IF_MULTI) {
2548 tbl = &tbl->it_u.it_multi.it_ptr[mach];
2552 if (tbl->it_fmt == IF_INVAL)
2553 goto inval;
2555 if ((tbl->it_u.it_inst.it_flags & mach) == 0)
2556 goto inval;
2558 tmp = snprintf(buf, buflen, "%-7s ", tbl->it_u.it_inst.it_name);
2559 if (tmp < 0)
2560 return;
2562 fmt_fxns[tbl->it_fmt](dhp, addr, inst, buf + tmp, buflen - tmp,
2563 tbl->it_u.it_inst.it_flags);
2565 return;
2567 inval:
2568 (void) snprintf(buf, buflen, "??");
2571 static int
2572 dis_s390_supports_flags(int flags)
2574 if ((flags & DIS_ARCH_MASK) == DIS_S3X0 &&
2575 DIS_SIZE_CHECK(flags, DIS_SIZE_24 | DIS_SIZE_32 | DIS_SIZE_64))
2576 return (1);
2578 return (0);
2581 static int
2582 dis_s390_disassemble(dis_handle_t *dhp, uint64_t addr, char *buf,
2583 size_t buflen)
2585 union inst inst;
2586 int mach;
2587 int len;
2589 if (dhp->dh_read(dhp->dh_data, addr, &inst.raw[0], 2) != 2)
2590 return (-1);
2592 len = ILC2LEN(inst.raw[0] >> 6) - 2;
2594 if (len > 0 &&
2595 dhp->dh_read(dhp->dh_data, addr + 2, &inst.raw[2], len) != len)
2596 return (-1);
2598 switch (dhp->dh_flags & DIS_SIZE_MASK) {
2599 case DIS_SIZE_16:
2600 return (-1);
2601 case DIS_SIZE_24:
2602 mach = F_370;
2603 break;
2604 case DIS_SIZE_32:
2605 mach = F_390;
2606 break;
2607 case DIS_SIZE_64:
2608 mach = F_Z;
2609 break;
2612 dis_s390(dhp, addr, &inst, buf, buflen, mach);
2614 return (0);
2617 static int
2618 dis_s390_instrlen(dis_handle_t *dhp, uint64_t pc)
2620 uint8_t byte;
2622 if (dhp->dh_read(dhp->dh_data, pc, &byte, 1) != 1)
2623 return (-1);
2625 return (ILC2LEN(byte >> 6));
2628 /* ARGSUSED */
2629 static int
2630 dis_s390_min_instrlen(dis_handle_t *dhp)
2632 return (2);
2635 /* ARGSUSED */
2636 static int
2637 dis_s390_max_instrlen(dis_handle_t *dhp)
2639 return (6);
2642 dis_arch_t dis_arch_s390 = {
2643 .da_supports_flags = dis_s390_supports_flags,
2644 .da_disassemble = dis_s390_disassemble,
2645 .da_min_instrlen = dis_s390_min_instrlen,
2646 .da_max_instrlen = dis_s390_max_instrlen,
2647 .da_instrlen = dis_s390_instrlen,