blob: afdb9729cf9b86ac18b00f2cf0cc088270b79c90 [file] [log] [blame]
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001/*
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02002 * Disassemble s390 instructions.
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
6 */
7
8#include <linux/sched.h>
9#include <linux/kernel.h>
10#include <linux/string.h>
11#include <linux/errno.h>
12#include <linux/ptrace.h>
13#include <linux/timer.h>
14#include <linux/mm.h>
15#include <linux/smp.h>
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +020016#include <linux/init.h>
17#include <linux/interrupt.h>
18#include <linux/delay.h>
19#include <linux/module.h>
20#include <linux/kallsyms.h>
21#include <linux/reboot.h>
22#include <linux/kprobes.h>
Adrian Bunk79df3c12007-05-08 00:35:10 -070023#include <linux/kdebug.h>
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +020024
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +020025#include <asm/uaccess.h>
26#include <asm/io.h>
Arun Sharma600634972011-07-26 16:09:06 -070027#include <linux/atomic.h>
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +020028#include <asm/mathemu.h>
29#include <asm/cpcmd.h>
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +020030#include <asm/lowcore.h>
31#include <asm/debug.h>
Heiko Carstensd7b250e2011-05-26 09:48:24 +020032#include <asm/irq.h>
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +020033
34#ifndef CONFIG_64BIT
35#define ONELONG "%08lx: "
36#else /* CONFIG_64BIT */
37#define ONELONG "%016lx: "
38#endif /* CONFIG_64BIT */
39
40#define OPERAND_GPR 0x1 /* Operand printed as %rx */
41#define OPERAND_FPR 0x2 /* Operand printed as %fx */
42#define OPERAND_AR 0x4 /* Operand printed as %ax */
43#define OPERAND_CR 0x8 /* Operand printed as %cx */
44#define OPERAND_DISP 0x10 /* Operand printed as displacement */
45#define OPERAND_BASE 0x20 /* Operand printed as base register */
46#define OPERAND_INDEX 0x40 /* Operand printed as index register */
47#define OPERAND_PCREL 0x80 /* Operand printed as pc-relative symbol */
48#define OPERAND_SIGNED 0x100 /* Operand printed as signed value */
49#define OPERAND_LENGTH 0x200 /* Operand printed as length (+1) */
50
51enum {
52 UNUSED, /* Indicates the end of the operand list */
53 R_8, /* GPR starting at position 8 */
54 R_12, /* GPR starting at position 12 */
55 R_16, /* GPR starting at position 16 */
56 R_20, /* GPR starting at position 20 */
57 R_24, /* GPR starting at position 24 */
58 R_28, /* GPR starting at position 28 */
59 R_32, /* GPR starting at position 32 */
60 F_8, /* FPR starting at position 8 */
61 F_12, /* FPR starting at position 12 */
62 F_16, /* FPR starting at position 16 */
63 F_20, /* FPR starting at position 16 */
64 F_24, /* FPR starting at position 24 */
65 F_28, /* FPR starting at position 28 */
66 F_32, /* FPR starting at position 32 */
67 A_8, /* Access reg. starting at position 8 */
68 A_12, /* Access reg. starting at position 12 */
69 A_24, /* Access reg. starting at position 24 */
70 A_28, /* Access reg. starting at position 28 */
71 C_8, /* Control reg. starting at position 8 */
72 C_12, /* Control reg. starting at position 12 */
73 B_16, /* Base register starting at position 16 */
74 B_32, /* Base register starting at position 32 */
75 X_12, /* Index register starting at position 12 */
76 D_20, /* Displacement starting at position 20 */
77 D_36, /* Displacement starting at position 36 */
78 D20_20, /* 20 bit displacement starting at 20 */
79 L4_8, /* 4 bit length starting at position 8 */
80 L4_12, /* 4 bit length starting at position 12 */
81 L8_8, /* 8 bit length starting at position 8 */
82 U4_8, /* 4 bit unsigned value starting at 8 */
83 U4_12, /* 4 bit unsigned value starting at 12 */
84 U4_16, /* 4 bit unsigned value starting at 16 */
85 U4_20, /* 4 bit unsigned value starting at 20 */
Heiko Carstensc68dba22012-11-19 22:49:34 +010086 U4_24, /* 4 bit unsigned value starting at 24 */
87 U4_28, /* 4 bit unsigned value starting at 28 */
Martin Schwidefsky618708f2010-02-26 22:37:49 +010088 U4_32, /* 4 bit unsigned value starting at 32 */
Heiko Carstensc68dba22012-11-19 22:49:34 +010089 U4_36, /* 4 bit unsigned value starting at 36 */
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +020090 U8_8, /* 8 bit unsigned value starting at 8 */
91 U8_16, /* 8 bit unsigned value starting at 16 */
Martin Schwidefsky618708f2010-02-26 22:37:49 +010092 U8_24, /* 8 bit unsigned value starting at 24 */
93 U8_32, /* 8 bit unsigned value starting at 32 */
94 I8_8, /* 8 bit signed value starting at 8 */
95 I8_32, /* 8 bit signed value starting at 32 */
Heiko Carstensc68dba22012-11-19 22:49:34 +010096 J12_12, /* PC relative offset at 12 */
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +020097 I16_16, /* 16 bit signed value starting at 16 */
Martin Schwidefsky618708f2010-02-26 22:37:49 +010098 I16_32, /* 32 bit signed value starting at 16 */
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +020099 U16_16, /* 16 bit unsigned value starting at 16 */
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100100 U16_32, /* 32 bit unsigned value starting at 16 */
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200101 J16_16, /* PC relative jump offset at 16 */
Heiko Carstensc68dba22012-11-19 22:49:34 +0100102 J16_32, /* PC relative offset at 16 */
103 I24_24, /* 24 bit signed value starting at 24 */
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200104 J32_16, /* PC relative long offset at 16 */
105 I32_16, /* 32 bit signed value starting at 16 */
106 U32_16, /* 32 bit unsigned value starting at 16 */
107 M_16, /* 4 bit optional mask starting at 16 */
Heiko Carstensc68dba22012-11-19 22:49:34 +0100108 M_20, /* 4 bit optional mask starting at 20 */
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200109 RO_28, /* optional GPR starting at position 28 */
110};
111
112/*
113 * Enumeration of the different instruction formats.
114 * For details consult the principles of operation.
115 */
116enum {
117 INSTR_INVALID,
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100118 INSTR_E,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100119 INSTR_IE_UU,
120 INSTR_MII_UPI,
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100121 INSTR_RIE_R0IU, INSTR_RIE_R0UU, INSTR_RIE_RRP, INSTR_RIE_RRPU,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200122 INSTR_RIE_RRUUU, INSTR_RIE_RUPI, INSTR_RIE_RUPU, INSTR_RIE_RRI0,
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100123 INSTR_RIL_RI, INSTR_RIL_RP, INSTR_RIL_RU, INSTR_RIL_UP,
124 INSTR_RIS_R0RDU, INSTR_RIS_R0UU, INSTR_RIS_RURDI, INSTR_RIS_RURDU,
125 INSTR_RI_RI, INSTR_RI_RP, INSTR_RI_RU, INSTR_RI_UP,
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200126 INSTR_RRE_00, INSTR_RRE_0R, INSTR_RRE_AA, INSTR_RRE_AR, INSTR_RRE_F0,
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100127 INSTR_RRE_FF, INSTR_RRE_FR, INSTR_RRE_R0, INSTR_RRE_RA, INSTR_RRE_RF,
128 INSTR_RRE_RR, INSTR_RRE_RR_OPT,
129 INSTR_RRF_0UFF, INSTR_RRF_F0FF, INSTR_RRF_F0FF2, INSTR_RRF_F0FR,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100130 INSTR_RRF_FFRU, INSTR_RRF_FUFF, INSTR_RRF_FUFF2, INSTR_RRF_M0RR,
131 INSTR_RRF_R0RR, INSTR_RRF_R0RR2, INSTR_RRF_RMRR, INSTR_RRF_RURR,
132 INSTR_RRF_U0FF, INSTR_RRF_U0RF, INSTR_RRF_U0RR, INSTR_RRF_UUFF,
133 INSTR_RRF_UUFR, INSTR_RRF_UURF,
134 INSTR_RRR_F0FF, INSTR_RRS_RRRDU,
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200135 INSTR_RR_FF, INSTR_RR_R0, INSTR_RR_RR, INSTR_RR_U0, INSTR_RR_UR,
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100136 INSTR_RSE_CCRD, INSTR_RSE_RRRD, INSTR_RSE_RURD,
137 INSTR_RSI_RRP,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100138 INSTR_RSL_LRDFU, INSTR_RSL_R0RD,
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100139 INSTR_RSY_AARD, INSTR_RSY_CCRD, INSTR_RSY_RRRD, INSTR_RSY_RURD,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200140 INSTR_RSY_RDRM,
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100141 INSTR_RS_AARD, INSTR_RS_CCRD, INSTR_RS_R0RD, INSTR_RS_RRRD,
142 INSTR_RS_RURD,
143 INSTR_RXE_FRRD, INSTR_RXE_RRRD,
144 INSTR_RXF_FRRDF,
145 INSTR_RXY_FRRD, INSTR_RXY_RRRD, INSTR_RXY_URRD,
146 INSTR_RX_FRRD, INSTR_RX_RRRD, INSTR_RX_URRD,
147 INSTR_SIL_RDI, INSTR_SIL_RDU,
148 INSTR_SIY_IRD, INSTR_SIY_URD,
149 INSTR_SI_URD,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100150 INSTR_SMI_U0RDP,
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100151 INSTR_SSE_RDRD,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200152 INSTR_SSF_RRDRD, INSTR_SSF_RRDRD2,
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100153 INSTR_SS_L0RDRD, INSTR_SS_LIRDRD, INSTR_SS_LLRDRD, INSTR_SS_RRRDRD,
154 INSTR_SS_RRRDRD2, INSTR_SS_RRRDRD3,
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200155 INSTR_S_00, INSTR_S_RD,
156};
157
158struct operand {
159 int bits; /* The number of bits in the operand. */
160 int shift; /* The number of bits to shift. */
161 int flags; /* One bit syntax flags. */
162};
163
164struct insn {
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200165 const char name[5];
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200166 unsigned char opfrag;
167 unsigned char format;
168};
169
170static const struct operand operands[] =
171{
172 [UNUSED] = { 0, 0, 0 },
173 [R_8] = { 4, 8, OPERAND_GPR },
174 [R_12] = { 4, 12, OPERAND_GPR },
175 [R_16] = { 4, 16, OPERAND_GPR },
176 [R_20] = { 4, 20, OPERAND_GPR },
177 [R_24] = { 4, 24, OPERAND_GPR },
178 [R_28] = { 4, 28, OPERAND_GPR },
179 [R_32] = { 4, 32, OPERAND_GPR },
180 [F_8] = { 4, 8, OPERAND_FPR },
181 [F_12] = { 4, 12, OPERAND_FPR },
182 [F_16] = { 4, 16, OPERAND_FPR },
183 [F_20] = { 4, 16, OPERAND_FPR },
184 [F_24] = { 4, 24, OPERAND_FPR },
185 [F_28] = { 4, 28, OPERAND_FPR },
186 [F_32] = { 4, 32, OPERAND_FPR },
187 [A_8] = { 4, 8, OPERAND_AR },
188 [A_12] = { 4, 12, OPERAND_AR },
189 [A_24] = { 4, 24, OPERAND_AR },
190 [A_28] = { 4, 28, OPERAND_AR },
191 [C_8] = { 4, 8, OPERAND_CR },
192 [C_12] = { 4, 12, OPERAND_CR },
193 [B_16] = { 4, 16, OPERAND_BASE | OPERAND_GPR },
194 [B_32] = { 4, 32, OPERAND_BASE | OPERAND_GPR },
195 [X_12] = { 4, 12, OPERAND_INDEX | OPERAND_GPR },
196 [D_20] = { 12, 20, OPERAND_DISP },
197 [D_36] = { 12, 36, OPERAND_DISP },
198 [D20_20] = { 20, 20, OPERAND_DISP | OPERAND_SIGNED },
199 [L4_8] = { 4, 8, OPERAND_LENGTH },
200 [L4_12] = { 4, 12, OPERAND_LENGTH },
201 [L8_8] = { 8, 8, OPERAND_LENGTH },
202 [U4_8] = { 4, 8, 0 },
203 [U4_12] = { 4, 12, 0 },
204 [U4_16] = { 4, 16, 0 },
205 [U4_20] = { 4, 20, 0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100206 [U4_24] = { 4, 24, 0 },
207 [U4_28] = { 4, 28, 0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100208 [U4_32] = { 4, 32, 0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100209 [U4_36] = { 4, 36, 0 },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200210 [U8_8] = { 8, 8, 0 },
211 [U8_16] = { 8, 16, 0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100212 [U8_24] = { 8, 24, 0 },
213 [U8_32] = { 8, 32, 0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100214 [J12_12] = { 12, 12, OPERAND_PCREL },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200215 [I16_16] = { 16, 16, OPERAND_SIGNED },
216 [U16_16] = { 16, 16, 0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100217 [U16_32] = { 16, 32, 0 },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200218 [J16_16] = { 16, 16, OPERAND_PCREL },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100219 [J16_32] = { 16, 32, OPERAND_PCREL },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100220 [I16_32] = { 16, 32, OPERAND_SIGNED },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100221 [I24_24] = { 24, 24, OPERAND_SIGNED },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200222 [J32_16] = { 32, 16, OPERAND_PCREL },
223 [I32_16] = { 32, 16, OPERAND_SIGNED },
224 [U32_16] = { 32, 16, 0 },
225 [M_16] = { 4, 16, 0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100226 [M_20] = { 4, 20, 0 },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200227 [RO_28] = { 4, 28, OPERAND_GPR }
228};
229
230static const unsigned char formats[][7] = {
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100231 [INSTR_E] = { 0xff, 0,0,0,0,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100232 [INSTR_IE_UU] = { 0xff, U4_24,U4_28,0,0,0,0 },
233 [INSTR_MII_UPI] = { 0xff, U4_8,J12_12,I24_24 },
234 [INSTR_RIE_R0IU] = { 0xff, R_8,I16_16,U4_32,0,0,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100235 [INSTR_RIE_R0UU] = { 0xff, R_8,U16_16,U4_32,0,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100236 [INSTR_RIE_RRI0] = { 0xff, R_8,R_12,I16_16,0,0,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100237 [INSTR_RIE_RRPU] = { 0xff, R_8,R_12,U4_32,J16_16,0,0 },
238 [INSTR_RIE_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
239 [INSTR_RIE_RRUUU] = { 0xff, R_8,R_12,U8_16,U8_24,U8_32,0 },
240 [INSTR_RIE_RUPI] = { 0xff, R_8,I8_32,U4_12,J16_16,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100241 [INSTR_RIE_RUPU] = { 0xff, R_8,U8_32,U4_12,J16_16,0,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100242 [INSTR_RIL_RI] = { 0x0f, R_8,I32_16,0,0,0,0 },
243 [INSTR_RIL_RP] = { 0x0f, R_8,J32_16,0,0,0,0 },
244 [INSTR_RIL_RU] = { 0x0f, R_8,U32_16,0,0,0,0 },
245 [INSTR_RIL_UP] = { 0x0f, U4_8,J32_16,0,0,0,0 },
246 [INSTR_RIS_R0RDU] = { 0xff, R_8,U8_32,D_20,B_16,0,0 },
247 [INSTR_RIS_RURDI] = { 0xff, R_8,I8_32,U4_12,D_20,B_16,0 },
248 [INSTR_RIS_RURDU] = { 0xff, R_8,U8_32,U4_12,D_20,B_16,0 },
249 [INSTR_RI_RI] = { 0x0f, R_8,I16_16,0,0,0,0 },
250 [INSTR_RI_RP] = { 0x0f, R_8,J16_16,0,0,0,0 },
251 [INSTR_RI_RU] = { 0x0f, R_8,U16_16,0,0,0,0 },
252 [INSTR_RI_UP] = { 0x0f, U4_8,J16_16,0,0,0,0 },
253 [INSTR_RRE_00] = { 0xff, 0,0,0,0,0,0 },
254 [INSTR_RRE_0R] = { 0xff, R_28,0,0,0,0,0 },
255 [INSTR_RRE_AA] = { 0xff, A_24,A_28,0,0,0,0 },
256 [INSTR_RRE_AR] = { 0xff, A_24,R_28,0,0,0,0 },
257 [INSTR_RRE_F0] = { 0xff, F_24,0,0,0,0,0 },
258 [INSTR_RRE_FF] = { 0xff, F_24,F_28,0,0,0,0 },
259 [INSTR_RRE_FR] = { 0xff, F_24,R_28,0,0,0,0 },
260 [INSTR_RRE_R0] = { 0xff, R_24,0,0,0,0,0 },
261 [INSTR_RRE_RA] = { 0xff, R_24,A_28,0,0,0,0 },
262 [INSTR_RRE_RF] = { 0xff, R_24,F_28,0,0,0,0 },
263 [INSTR_RRE_RR] = { 0xff, R_24,R_28,0,0,0,0 },
264 [INSTR_RRE_RR_OPT]= { 0xff, R_24,RO_28,0,0,0,0 },
265 [INSTR_RRF_0UFF] = { 0xff, F_24,F_28,U4_20,0,0,0 },
266 [INSTR_RRF_F0FF2] = { 0xff, F_24,F_16,F_28,0,0,0 },
267 [INSTR_RRF_F0FF] = { 0xff, F_16,F_24,F_28,0,0,0 },
268 [INSTR_RRF_F0FR] = { 0xff, F_24,F_16,R_28,0,0,0 },
269 [INSTR_RRF_FFRU] = { 0xff, F_24,F_16,R_28,U4_20,0,0 },
270 [INSTR_RRF_FUFF] = { 0xff, F_24,F_16,F_28,U4_20,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100271 [INSTR_RRF_FUFF2] = { 0xff, F_24,F_28,F_16,U4_20,0,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100272 [INSTR_RRF_M0RR] = { 0xff, R_24,R_28,M_16,0,0,0 },
273 [INSTR_RRF_R0RR] = { 0xff, R_24,R_16,R_28,0,0,0 },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200274 [INSTR_RRF_R0RR2] = { 0xff, R_24,R_28,R_16,0,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100275 [INSTR_RRF_RMRR] = { 0xff, R_24,R_16,R_28,M_20,0,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100276 [INSTR_RRF_RURR] = { 0xff, R_24,R_28,R_16,U4_20,0,0 },
277 [INSTR_RRF_U0FF] = { 0xff, F_24,U4_16,F_28,0,0,0 },
278 [INSTR_RRF_U0RF] = { 0xff, R_24,U4_16,F_28,0,0,0 },
279 [INSTR_RRF_U0RR] = { 0xff, R_24,R_28,U4_16,0,0,0 },
280 [INSTR_RRF_UUFF] = { 0xff, F_24,U4_16,F_28,U4_20,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100281 [INSTR_RRF_UUFR] = { 0xff, F_24,U4_16,R_28,U4_20,0,0 },
282 [INSTR_RRF_UURF] = { 0xff, R_24,U4_16,F_28,U4_20,0,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100283 [INSTR_RRR_F0FF] = { 0xff, F_24,F_28,F_16,0,0,0 },
284 [INSTR_RRS_RRRDU] = { 0xff, R_8,R_12,U4_32,D_20,B_16,0 },
285 [INSTR_RR_FF] = { 0xff, F_8,F_12,0,0,0,0 },
286 [INSTR_RR_R0] = { 0xff, R_8, 0,0,0,0,0 },
287 [INSTR_RR_RR] = { 0xff, R_8,R_12,0,0,0,0 },
288 [INSTR_RR_U0] = { 0xff, U8_8, 0,0,0,0,0 },
289 [INSTR_RR_UR] = { 0xff, U4_8,R_12,0,0,0,0 },
290 [INSTR_RSE_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 },
291 [INSTR_RSE_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 },
292 [INSTR_RSE_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
293 [INSTR_RSI_RRP] = { 0xff, R_8,R_12,J16_16,0,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100294 [INSTR_RSL_LRDFU] = { 0xff, F_32,D_20,L4_8,B_16,U4_36,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100295 [INSTR_RSL_R0RD] = { 0xff, D_20,L4_8,B_16,0,0,0 },
296 [INSTR_RSY_AARD] = { 0xff, A_8,A_12,D20_20,B_16,0,0 },
297 [INSTR_RSY_CCRD] = { 0xff, C_8,C_12,D20_20,B_16,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100298 [INSTR_RSY_RDRM] = { 0xff, R_8,D20_20,B_16,U4_12,0,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100299 [INSTR_RSY_RRRD] = { 0xff, R_8,R_12,D20_20,B_16,0,0 },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200300 [INSTR_RSY_RURD] = { 0xff, R_8,U4_12,D20_20,B_16,0,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100301 [INSTR_RS_AARD] = { 0xff, A_8,A_12,D_20,B_16,0,0 },
302 [INSTR_RS_CCRD] = { 0xff, C_8,C_12,D_20,B_16,0,0 },
303 [INSTR_RS_R0RD] = { 0xff, R_8,D_20,B_16,0,0,0 },
304 [INSTR_RS_RRRD] = { 0xff, R_8,R_12,D_20,B_16,0,0 },
305 [INSTR_RS_RURD] = { 0xff, R_8,U4_12,D_20,B_16,0,0 },
306 [INSTR_RXE_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 },
307 [INSTR_RXE_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200308 [INSTR_RXF_FRRDF] = { 0xff, F_32,F_8,D_20,X_12,B_16,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100309 [INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },
310 [INSTR_RXY_RRRD] = { 0xff, R_8,D20_20,X_12,B_16,0,0 },
311 [INSTR_RXY_URRD] = { 0xff, U4_8,D20_20,X_12,B_16,0,0 },
312 [INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 },
313 [INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 },
314 [INSTR_RX_URRD] = { 0xff, U4_8,D_20,X_12,B_16,0,0 },
315 [INSTR_SIL_RDI] = { 0xff, D_20,B_16,I16_32,0,0,0 },
316 [INSTR_SIL_RDU] = { 0xff, D_20,B_16,U16_32,0,0,0 },
317 [INSTR_SIY_IRD] = { 0xff, D20_20,B_16,I8_8,0,0,0 },
318 [INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 },
319 [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100320 [INSTR_SMI_U0RDP] = { 0xff, U4_8,J16_32,D_20,B_16,0,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100321 [INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100322 [INSTR_SSF_RRDRD] = { 0x0f, D_20,B_16,D_36,B_32,R_8,0 },
323 [INSTR_SSF_RRDRD2]= { 0x0f, R_8,D_20,B_16,D_36,B_32,0 },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100324 [INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 },
325 [INSTR_SS_LIRDRD] = { 0xff, D_20,L4_8,B_16,D_36,B_32,U4_12 },
326 [INSTR_SS_LLRDRD] = { 0xff, D_20,L4_8,B_16,D_36,L4_12,B_32 },
327 [INSTR_SS_RRRDRD2]= { 0xff, R_8,D_20,B_16,R_12,D_36,B_32 },
328 [INSTR_SS_RRRDRD3]= { 0xff, R_8,R_12,D_20,B_16,D_36,B_32 },
329 [INSTR_SS_RRRDRD] = { 0xff, D_20,R_8,B_16,D_36,B_32,R_12 },
330 [INSTR_S_00] = { 0xff, 0,0,0,0,0,0 },
331 [INSTR_S_RD] = { 0xff, D_20,B_16,0,0,0,0 },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200332};
333
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200334enum {
335 LONG_INSN_ALGHSIK,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100336 LONG_INSN_ALHHHR,
337 LONG_INSN_ALHHLR,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200338 LONG_INSN_ALHSIK,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100339 LONG_INSN_ALSIHN,
340 LONG_INSN_CDFBRA,
341 LONG_INSN_CDGBRA,
342 LONG_INSN_CDGTRA,
343 LONG_INSN_CDLFBR,
344 LONG_INSN_CDLFTR,
345 LONG_INSN_CDLGBR,
346 LONG_INSN_CDLGTR,
347 LONG_INSN_CEFBRA,
348 LONG_INSN_CEGBRA,
349 LONG_INSN_CELFBR,
350 LONG_INSN_CELGBR,
351 LONG_INSN_CFDBRA,
352 LONG_INSN_CFEBRA,
353 LONG_INSN_CFXBRA,
354 LONG_INSN_CGDBRA,
355 LONG_INSN_CGDTRA,
356 LONG_INSN_CGEBRA,
357 LONG_INSN_CGXBRA,
358 LONG_INSN_CGXTRA,
359 LONG_INSN_CLFDBR,
360 LONG_INSN_CLFDTR,
361 LONG_INSN_CLFEBR,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200362 LONG_INSN_CLFHSI,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100363 LONG_INSN_CLFXBR,
364 LONG_INSN_CLFXTR,
365 LONG_INSN_CLGDBR,
366 LONG_INSN_CLGDTR,
367 LONG_INSN_CLGEBR,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200368 LONG_INSN_CLGFRL,
369 LONG_INSN_CLGHRL,
370 LONG_INSN_CLGHSI,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100371 LONG_INSN_CLGXBR,
372 LONG_INSN_CLGXTR,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200373 LONG_INSN_CLHHSI,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100374 LONG_INSN_CXFBRA,
375 LONG_INSN_CXGBRA,
376 LONG_INSN_CXGTRA,
377 LONG_INSN_CXLFBR,
378 LONG_INSN_CXLFTR,
379 LONG_INSN_CXLGBR,
380 LONG_INSN_CXLGTR,
381 LONG_INSN_FIDBRA,
382 LONG_INSN_FIEBRA,
383 LONG_INSN_FIXBRA,
384 LONG_INSN_LDXBRA,
385 LONG_INSN_LEDBRA,
386 LONG_INSN_LEXBRA,
387 LONG_INSN_LLGFAT,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200388 LONG_INSN_LLGFRL,
389 LONG_INSN_LLGHRL,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100390 LONG_INSN_LLGTAT,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200391 LONG_INSN_POPCNT,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100392 LONG_INSN_RIEMIT,
393 LONG_INSN_RINEXT,
394 LONG_INSN_RISBGN,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200395 LONG_INSN_RISBHG,
396 LONG_INSN_RISBLG,
Heiko Carstensc68dba22012-11-19 22:49:34 +0100397 LONG_INSN_SLHHHR,
398 LONG_INSN_SLHHLR,
Martin Schwidefskyd35339a2012-07-31 11:03:04 +0200399 LONG_INSN_TABORT,
400 LONG_INSN_TBEGIN,
401 LONG_INSN_TBEGINC,
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200402};
403
404static char *long_insn_name[] = {
405 [LONG_INSN_ALGHSIK] = "alghsik",
Heiko Carstensc68dba22012-11-19 22:49:34 +0100406 [LONG_INSN_ALHHHR] = "alhhhr",
407 [LONG_INSN_ALHHLR] = "alhhlr",
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200408 [LONG_INSN_ALHSIK] = "alhsik",
Heiko Carstensc68dba22012-11-19 22:49:34 +0100409 [LONG_INSN_ALSIHN] = "alsihn",
410 [LONG_INSN_CDFBRA] = "cdfbra",
411 [LONG_INSN_CDGBRA] = "cdgbra",
412 [LONG_INSN_CDGTRA] = "cdgtra",
413 [LONG_INSN_CDLFBR] = "cdlfbr",
414 [LONG_INSN_CDLFTR] = "cdlftr",
415 [LONG_INSN_CDLGBR] = "cdlgbr",
416 [LONG_INSN_CDLGTR] = "cdlgtr",
417 [LONG_INSN_CEFBRA] = "cefbra",
418 [LONG_INSN_CEGBRA] = "cegbra",
419 [LONG_INSN_CELFBR] = "celfbr",
420 [LONG_INSN_CELGBR] = "celgbr",
421 [LONG_INSN_CFDBRA] = "cfdbra",
422 [LONG_INSN_CFEBRA] = "cfebra",
423 [LONG_INSN_CFXBRA] = "cfxbra",
424 [LONG_INSN_CGDBRA] = "cgdbra",
425 [LONG_INSN_CGDTRA] = "cgdtra",
426 [LONG_INSN_CGEBRA] = "cgebra",
427 [LONG_INSN_CGXBRA] = "cgxbra",
428 [LONG_INSN_CGXTRA] = "cgxtra",
429 [LONG_INSN_CLFDBR] = "clfdbr",
430 [LONG_INSN_CLFDTR] = "clfdtr",
431 [LONG_INSN_CLFEBR] = "clfebr",
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200432 [LONG_INSN_CLFHSI] = "clfhsi",
Heiko Carstensc68dba22012-11-19 22:49:34 +0100433 [LONG_INSN_CLFXBR] = "clfxbr",
434 [LONG_INSN_CLFXTR] = "clfxtr",
435 [LONG_INSN_CLGDBR] = "clgdbr",
436 [LONG_INSN_CLGDTR] = "clgdtr",
437 [LONG_INSN_CLGEBR] = "clgebr",
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200438 [LONG_INSN_CLGFRL] = "clgfrl",
439 [LONG_INSN_CLGHRL] = "clghrl",
440 [LONG_INSN_CLGHSI] = "clghsi",
Heiko Carstensc68dba22012-11-19 22:49:34 +0100441 [LONG_INSN_CLGXBR] = "clgxbr",
442 [LONG_INSN_CLGXTR] = "clgxtr",
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200443 [LONG_INSN_CLHHSI] = "clhhsi",
Heiko Carstensc68dba22012-11-19 22:49:34 +0100444 [LONG_INSN_CXFBRA] = "cxfbra",
445 [LONG_INSN_CXGBRA] = "cxgbra",
446 [LONG_INSN_CXGTRA] = "cxgtra",
447 [LONG_INSN_CXLFBR] = "cxlfbr",
448 [LONG_INSN_CXLFTR] = "cxlftr",
449 [LONG_INSN_CXLGBR] = "cxlgbr",
450 [LONG_INSN_CXLGTR] = "cxlgtr",
451 [LONG_INSN_FIDBRA] = "fidbra",
452 [LONG_INSN_FIEBRA] = "fiebra",
453 [LONG_INSN_FIXBRA] = "fixbra",
454 [LONG_INSN_LDXBRA] = "ldxbra",
455 [LONG_INSN_LEDBRA] = "ledbra",
456 [LONG_INSN_LEXBRA] = "lexbra",
457 [LONG_INSN_LLGFAT] = "llgfat",
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200458 [LONG_INSN_LLGFRL] = "llgfrl",
459 [LONG_INSN_LLGHRL] = "llghrl",
Heiko Carstensc68dba22012-11-19 22:49:34 +0100460 [LONG_INSN_LLGTAT] = "llgtat",
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200461 [LONG_INSN_POPCNT] = "popcnt",
Heiko Carstensc68dba22012-11-19 22:49:34 +0100462 [LONG_INSN_RIEMIT] = "riemit",
463 [LONG_INSN_RINEXT] = "rinext",
464 [LONG_INSN_RISBGN] = "risbgn",
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200465 [LONG_INSN_RISBHG] = "risbhg",
Heiko Carstensf7ed68a2012-09-24 15:29:44 +0200466 [LONG_INSN_RISBLG] = "risblg",
Heiko Carstensc68dba22012-11-19 22:49:34 +0100467 [LONG_INSN_SLHHHR] = "slhhhr",
468 [LONG_INSN_SLHHLR] = "slhhlr",
Martin Schwidefskyd35339a2012-07-31 11:03:04 +0200469 [LONG_INSN_TABORT] = "tabort",
470 [LONG_INSN_TBEGIN] = "tbegin",
471 [LONG_INSN_TBEGINC] = "tbeginc",
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +0200472};
473
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200474static struct insn opcode[] = {
475#ifdef CONFIG_64BIT
Heiko Carstensc68dba22012-11-19 22:49:34 +0100476 { "bprp", 0xc5, INSTR_MII_UPI },
477 { "bpp", 0xc7, INSTR_SMI_U0RDP },
478 { "trtr", 0xd0, INSTR_SS_L0RDRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200479 { "lmd", 0xef, INSTR_SS_RRRDRD3 },
480#endif
481 { "spm", 0x04, INSTR_RR_R0 },
482 { "balr", 0x05, INSTR_RR_RR },
483 { "bctr", 0x06, INSTR_RR_RR },
484 { "bcr", 0x07, INSTR_RR_UR },
485 { "svc", 0x0a, INSTR_RR_U0 },
486 { "bsm", 0x0b, INSTR_RR_RR },
487 { "bassm", 0x0c, INSTR_RR_RR },
488 { "basr", 0x0d, INSTR_RR_RR },
489 { "mvcl", 0x0e, INSTR_RR_RR },
490 { "clcl", 0x0f, INSTR_RR_RR },
491 { "lpr", 0x10, INSTR_RR_RR },
492 { "lnr", 0x11, INSTR_RR_RR },
493 { "ltr", 0x12, INSTR_RR_RR },
494 { "lcr", 0x13, INSTR_RR_RR },
495 { "nr", 0x14, INSTR_RR_RR },
496 { "clr", 0x15, INSTR_RR_RR },
497 { "or", 0x16, INSTR_RR_RR },
498 { "xr", 0x17, INSTR_RR_RR },
499 { "lr", 0x18, INSTR_RR_RR },
500 { "cr", 0x19, INSTR_RR_RR },
501 { "ar", 0x1a, INSTR_RR_RR },
502 { "sr", 0x1b, INSTR_RR_RR },
503 { "mr", 0x1c, INSTR_RR_RR },
504 { "dr", 0x1d, INSTR_RR_RR },
505 { "alr", 0x1e, INSTR_RR_RR },
506 { "slr", 0x1f, INSTR_RR_RR },
507 { "lpdr", 0x20, INSTR_RR_FF },
508 { "lndr", 0x21, INSTR_RR_FF },
509 { "ltdr", 0x22, INSTR_RR_FF },
510 { "lcdr", 0x23, INSTR_RR_FF },
511 { "hdr", 0x24, INSTR_RR_FF },
512 { "ldxr", 0x25, INSTR_RR_FF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200513 { "mxr", 0x26, INSTR_RR_FF },
514 { "mxdr", 0x27, INSTR_RR_FF },
515 { "ldr", 0x28, INSTR_RR_FF },
516 { "cdr", 0x29, INSTR_RR_FF },
517 { "adr", 0x2a, INSTR_RR_FF },
518 { "sdr", 0x2b, INSTR_RR_FF },
519 { "mdr", 0x2c, INSTR_RR_FF },
520 { "ddr", 0x2d, INSTR_RR_FF },
521 { "awr", 0x2e, INSTR_RR_FF },
522 { "swr", 0x2f, INSTR_RR_FF },
523 { "lper", 0x30, INSTR_RR_FF },
524 { "lner", 0x31, INSTR_RR_FF },
525 { "lter", 0x32, INSTR_RR_FF },
526 { "lcer", 0x33, INSTR_RR_FF },
527 { "her", 0x34, INSTR_RR_FF },
528 { "ledr", 0x35, INSTR_RR_FF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200529 { "axr", 0x36, INSTR_RR_FF },
530 { "sxr", 0x37, INSTR_RR_FF },
531 { "ler", 0x38, INSTR_RR_FF },
532 { "cer", 0x39, INSTR_RR_FF },
533 { "aer", 0x3a, INSTR_RR_FF },
534 { "ser", 0x3b, INSTR_RR_FF },
535 { "mder", 0x3c, INSTR_RR_FF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200536 { "der", 0x3d, INSTR_RR_FF },
537 { "aur", 0x3e, INSTR_RR_FF },
538 { "sur", 0x3f, INSTR_RR_FF },
539 { "sth", 0x40, INSTR_RX_RRRD },
540 { "la", 0x41, INSTR_RX_RRRD },
541 { "stc", 0x42, INSTR_RX_RRRD },
542 { "ic", 0x43, INSTR_RX_RRRD },
543 { "ex", 0x44, INSTR_RX_RRRD },
544 { "bal", 0x45, INSTR_RX_RRRD },
545 { "bct", 0x46, INSTR_RX_RRRD },
546 { "bc", 0x47, INSTR_RX_URRD },
547 { "lh", 0x48, INSTR_RX_RRRD },
548 { "ch", 0x49, INSTR_RX_RRRD },
549 { "ah", 0x4a, INSTR_RX_RRRD },
550 { "sh", 0x4b, INSTR_RX_RRRD },
551 { "mh", 0x4c, INSTR_RX_RRRD },
552 { "bas", 0x4d, INSTR_RX_RRRD },
553 { "cvd", 0x4e, INSTR_RX_RRRD },
554 { "cvb", 0x4f, INSTR_RX_RRRD },
555 { "st", 0x50, INSTR_RX_RRRD },
556 { "lae", 0x51, INSTR_RX_RRRD },
557 { "n", 0x54, INSTR_RX_RRRD },
558 { "cl", 0x55, INSTR_RX_RRRD },
559 { "o", 0x56, INSTR_RX_RRRD },
560 { "x", 0x57, INSTR_RX_RRRD },
561 { "l", 0x58, INSTR_RX_RRRD },
562 { "c", 0x59, INSTR_RX_RRRD },
563 { "a", 0x5a, INSTR_RX_RRRD },
564 { "s", 0x5b, INSTR_RX_RRRD },
565 { "m", 0x5c, INSTR_RX_RRRD },
566 { "d", 0x5d, INSTR_RX_RRRD },
567 { "al", 0x5e, INSTR_RX_RRRD },
568 { "sl", 0x5f, INSTR_RX_RRRD },
569 { "std", 0x60, INSTR_RX_FRRD },
570 { "mxd", 0x67, INSTR_RX_FRRD },
571 { "ld", 0x68, INSTR_RX_FRRD },
572 { "cd", 0x69, INSTR_RX_FRRD },
573 { "ad", 0x6a, INSTR_RX_FRRD },
574 { "sd", 0x6b, INSTR_RX_FRRD },
575 { "md", 0x6c, INSTR_RX_FRRD },
576 { "dd", 0x6d, INSTR_RX_FRRD },
577 { "aw", 0x6e, INSTR_RX_FRRD },
578 { "sw", 0x6f, INSTR_RX_FRRD },
579 { "ste", 0x70, INSTR_RX_FRRD },
580 { "ms", 0x71, INSTR_RX_RRRD },
581 { "le", 0x78, INSTR_RX_FRRD },
582 { "ce", 0x79, INSTR_RX_FRRD },
583 { "ae", 0x7a, INSTR_RX_FRRD },
584 { "se", 0x7b, INSTR_RX_FRRD },
585 { "mde", 0x7c, INSTR_RX_FRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200586 { "de", 0x7d, INSTR_RX_FRRD },
587 { "au", 0x7e, INSTR_RX_FRRD },
588 { "su", 0x7f, INSTR_RX_FRRD },
589 { "ssm", 0x80, INSTR_S_RD },
590 { "lpsw", 0x82, INSTR_S_RD },
591 { "diag", 0x83, INSTR_RS_RRRD },
592 { "brxh", 0x84, INSTR_RSI_RRP },
593 { "brxle", 0x85, INSTR_RSI_RRP },
594 { "bxh", 0x86, INSTR_RS_RRRD },
595 { "bxle", 0x87, INSTR_RS_RRRD },
596 { "srl", 0x88, INSTR_RS_R0RD },
597 { "sll", 0x89, INSTR_RS_R0RD },
598 { "sra", 0x8a, INSTR_RS_R0RD },
599 { "sla", 0x8b, INSTR_RS_R0RD },
600 { "srdl", 0x8c, INSTR_RS_R0RD },
601 { "sldl", 0x8d, INSTR_RS_R0RD },
602 { "srda", 0x8e, INSTR_RS_R0RD },
603 { "slda", 0x8f, INSTR_RS_R0RD },
604 { "stm", 0x90, INSTR_RS_RRRD },
605 { "tm", 0x91, INSTR_SI_URD },
606 { "mvi", 0x92, INSTR_SI_URD },
607 { "ts", 0x93, INSTR_S_RD },
608 { "ni", 0x94, INSTR_SI_URD },
609 { "cli", 0x95, INSTR_SI_URD },
610 { "oi", 0x96, INSTR_SI_URD },
611 { "xi", 0x97, INSTR_SI_URD },
612 { "lm", 0x98, INSTR_RS_RRRD },
613 { "trace", 0x99, INSTR_RS_RRRD },
614 { "lam", 0x9a, INSTR_RS_AARD },
615 { "stam", 0x9b, INSTR_RS_AARD },
616 { "mvcle", 0xa8, INSTR_RS_RRRD },
617 { "clcle", 0xa9, INSTR_RS_RRRD },
618 { "stnsm", 0xac, INSTR_SI_URD },
619 { "stosm", 0xad, INSTR_SI_URD },
620 { "sigp", 0xae, INSTR_RS_RRRD },
621 { "mc", 0xaf, INSTR_SI_URD },
622 { "lra", 0xb1, INSTR_RX_RRRD },
623 { "stctl", 0xb6, INSTR_RS_CCRD },
624 { "lctl", 0xb7, INSTR_RS_CCRD },
625 { "cs", 0xba, INSTR_RS_RRRD },
626 { "cds", 0xbb, INSTR_RS_RRRD },
627 { "clm", 0xbd, INSTR_RS_RURD },
628 { "stcm", 0xbe, INSTR_RS_RURD },
629 { "icm", 0xbf, INSTR_RS_RURD },
630 { "mvn", 0xd1, INSTR_SS_L0RDRD },
631 { "mvc", 0xd2, INSTR_SS_L0RDRD },
632 { "mvz", 0xd3, INSTR_SS_L0RDRD },
633 { "nc", 0xd4, INSTR_SS_L0RDRD },
634 { "clc", 0xd5, INSTR_SS_L0RDRD },
635 { "oc", 0xd6, INSTR_SS_L0RDRD },
636 { "xc", 0xd7, INSTR_SS_L0RDRD },
637 { "mvck", 0xd9, INSTR_SS_RRRDRD },
638 { "mvcp", 0xda, INSTR_SS_RRRDRD },
639 { "mvcs", 0xdb, INSTR_SS_RRRDRD },
640 { "tr", 0xdc, INSTR_SS_L0RDRD },
641 { "trt", 0xdd, INSTR_SS_L0RDRD },
642 { "ed", 0xde, INSTR_SS_L0RDRD },
643 { "edmk", 0xdf, INSTR_SS_L0RDRD },
644 { "pku", 0xe1, INSTR_SS_L0RDRD },
645 { "unpku", 0xe2, INSTR_SS_L0RDRD },
646 { "mvcin", 0xe8, INSTR_SS_L0RDRD },
647 { "pka", 0xe9, INSTR_SS_L0RDRD },
648 { "unpka", 0xea, INSTR_SS_L0RDRD },
649 { "plo", 0xee, INSTR_SS_RRRDRD2 },
650 { "srp", 0xf0, INSTR_SS_LIRDRD },
651 { "mvo", 0xf1, INSTR_SS_LLRDRD },
652 { "pack", 0xf2, INSTR_SS_LLRDRD },
653 { "unpk", 0xf3, INSTR_SS_LLRDRD },
654 { "zap", 0xf8, INSTR_SS_LLRDRD },
655 { "cp", 0xf9, INSTR_SS_LLRDRD },
656 { "ap", 0xfa, INSTR_SS_LLRDRD },
657 { "sp", 0xfb, INSTR_SS_LLRDRD },
658 { "mp", 0xfc, INSTR_SS_LLRDRD },
659 { "dp", 0xfd, INSTR_SS_LLRDRD },
660 { "", 0, INSTR_INVALID }
661};
662
663static struct insn opcode_01[] = {
664#ifdef CONFIG_64BIT
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100665 { "ptff", 0x04, INSTR_E },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100666 { "pfpo", 0x0a, INSTR_E },
667 { "sam64", 0x0e, INSTR_E },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200668#endif
669 { "pr", 0x01, INSTR_E },
670 { "upt", 0x02, INSTR_E },
671 { "sckpf", 0x07, INSTR_E },
672 { "tam", 0x0b, INSTR_E },
673 { "sam24", 0x0c, INSTR_E },
674 { "sam31", 0x0d, INSTR_E },
675 { "trap2", 0xff, INSTR_E },
676 { "", 0, INSTR_INVALID }
677};
678
679static struct insn opcode_a5[] = {
680#ifdef CONFIG_64BIT
681 { "iihh", 0x00, INSTR_RI_RU },
682 { "iihl", 0x01, INSTR_RI_RU },
683 { "iilh", 0x02, INSTR_RI_RU },
684 { "iill", 0x03, INSTR_RI_RU },
685 { "nihh", 0x04, INSTR_RI_RU },
686 { "nihl", 0x05, INSTR_RI_RU },
687 { "nilh", 0x06, INSTR_RI_RU },
688 { "nill", 0x07, INSTR_RI_RU },
689 { "oihh", 0x08, INSTR_RI_RU },
690 { "oihl", 0x09, INSTR_RI_RU },
691 { "oilh", 0x0a, INSTR_RI_RU },
692 { "oill", 0x0b, INSTR_RI_RU },
693 { "llihh", 0x0c, INSTR_RI_RU },
694 { "llihl", 0x0d, INSTR_RI_RU },
695 { "llilh", 0x0e, INSTR_RI_RU },
696 { "llill", 0x0f, INSTR_RI_RU },
697#endif
698 { "", 0, INSTR_INVALID }
699};
700
701static struct insn opcode_a7[] = {
702#ifdef CONFIG_64BIT
703 { "tmhh", 0x02, INSTR_RI_RU },
704 { "tmhl", 0x03, INSTR_RI_RU },
705 { "brctg", 0x07, INSTR_RI_RP },
706 { "lghi", 0x09, INSTR_RI_RI },
707 { "aghi", 0x0b, INSTR_RI_RI },
708 { "mghi", 0x0d, INSTR_RI_RI },
709 { "cghi", 0x0f, INSTR_RI_RI },
710#endif
711 { "tmlh", 0x00, INSTR_RI_RU },
712 { "tmll", 0x01, INSTR_RI_RU },
713 { "brc", 0x04, INSTR_RI_UP },
714 { "bras", 0x05, INSTR_RI_RP },
715 { "brct", 0x06, INSTR_RI_RP },
716 { "lhi", 0x08, INSTR_RI_RI },
717 { "ahi", 0x0a, INSTR_RI_RI },
718 { "mhi", 0x0c, INSTR_RI_RI },
719 { "chi", 0x0e, INSTR_RI_RI },
720 { "", 0, INSTR_INVALID }
721};
722
Jan Glaubere4b8b3f2012-07-31 10:52:05 +0200723static struct insn opcode_aa[] = {
724#ifdef CONFIG_64BIT
725 { { 0, LONG_INSN_RINEXT }, 0x00, INSTR_RI_RI },
726 { "rion", 0x01, INSTR_RI_RI },
727 { "tric", 0x02, INSTR_RI_RI },
728 { "rioff", 0x03, INSTR_RI_RI },
729 { { 0, LONG_INSN_RIEMIT }, 0x04, INSTR_RI_RI },
730#endif
731 { "", 0, INSTR_INVALID }
732};
733
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200734static struct insn opcode_b2[] = {
735#ifdef CONFIG_64BIT
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200736 { "stckf", 0x7c, INSTR_S_RD },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100737 { "lpp", 0x80, INSTR_S_RD },
738 { "lcctl", 0x84, INSTR_S_RD },
739 { "lpctl", 0x85, INSTR_S_RD },
740 { "qsi", 0x86, INSTR_S_RD },
741 { "lsctl", 0x87, INSTR_S_RD },
742 { "qctri", 0x8e, INSTR_S_RD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200743 { "stfle", 0xb0, INSTR_S_RD },
744 { "lpswe", 0xb2, INSTR_S_RD },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100745 { "srnmb", 0xb8, INSTR_S_RD },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100746 { "srnmt", 0xb9, INSTR_S_RD },
747 { "lfas", 0xbd, INSTR_S_RD },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100748 { "scctr", 0xe0, INSTR_RRE_RR },
749 { "spctr", 0xe1, INSTR_RRE_RR },
750 { "ecctr", 0xe4, INSTR_RRE_RR },
751 { "epctr", 0xe5, INSTR_RRE_RR },
752 { "ppa", 0xe8, INSTR_RRF_U0RR },
753 { "etnd", 0xec, INSTR_RRE_R0 },
754 { "ecpga", 0xed, INSTR_RRE_RR },
755 { "tend", 0xf8, INSTR_S_00 },
756 { "niai", 0xfa, INSTR_IE_UU },
Martin Schwidefskyd35339a2012-07-31 11:03:04 +0200757 { { 0, LONG_INSN_TABORT }, 0xfc, INSTR_S_RD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200758#endif
759 { "stidp", 0x02, INSTR_S_RD },
760 { "sck", 0x04, INSTR_S_RD },
761 { "stck", 0x05, INSTR_S_RD },
762 { "sckc", 0x06, INSTR_S_RD },
763 { "stckc", 0x07, INSTR_S_RD },
764 { "spt", 0x08, INSTR_S_RD },
765 { "stpt", 0x09, INSTR_S_RD },
766 { "spka", 0x0a, INSTR_S_RD },
767 { "ipk", 0x0b, INSTR_S_00 },
768 { "ptlb", 0x0d, INSTR_S_00 },
769 { "spx", 0x10, INSTR_S_RD },
770 { "stpx", 0x11, INSTR_S_RD },
771 { "stap", 0x12, INSTR_S_RD },
772 { "sie", 0x14, INSTR_S_RD },
773 { "pc", 0x18, INSTR_S_RD },
774 { "sac", 0x19, INSTR_S_RD },
775 { "cfc", 0x1a, INSTR_S_RD },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100776 { "servc", 0x20, INSTR_RRE_RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200777 { "ipte", 0x21, INSTR_RRE_RR },
778 { "ipm", 0x22, INSTR_RRE_R0 },
779 { "ivsk", 0x23, INSTR_RRE_RR },
780 { "iac", 0x24, INSTR_RRE_R0 },
781 { "ssar", 0x25, INSTR_RRE_R0 },
782 { "epar", 0x26, INSTR_RRE_R0 },
783 { "esar", 0x27, INSTR_RRE_R0 },
784 { "pt", 0x28, INSTR_RRE_RR },
785 { "iske", 0x29, INSTR_RRE_RR },
786 { "rrbe", 0x2a, INSTR_RRE_RR },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100787 { "sske", 0x2b, INSTR_RRF_M0RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200788 { "tb", 0x2c, INSTR_RRE_0R },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100789 { "dxr", 0x2d, INSTR_RRE_FF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200790 { "pgin", 0x2e, INSTR_RRE_RR },
791 { "pgout", 0x2f, INSTR_RRE_RR },
792 { "csch", 0x30, INSTR_S_00 },
793 { "hsch", 0x31, INSTR_S_00 },
794 { "msch", 0x32, INSTR_S_RD },
795 { "ssch", 0x33, INSTR_S_RD },
796 { "stsch", 0x34, INSTR_S_RD },
797 { "tsch", 0x35, INSTR_S_RD },
798 { "tpi", 0x36, INSTR_S_RD },
799 { "sal", 0x37, INSTR_S_00 },
800 { "rsch", 0x38, INSTR_S_00 },
801 { "stcrw", 0x39, INSTR_S_RD },
802 { "stcps", 0x3a, INSTR_S_RD },
803 { "rchp", 0x3b, INSTR_S_00 },
804 { "schm", 0x3c, INSTR_S_00 },
805 { "bakr", 0x40, INSTR_RRE_RR },
806 { "cksm", 0x41, INSTR_RRE_RR },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100807 { "sqdr", 0x44, INSTR_RRE_FF },
808 { "sqer", 0x45, INSTR_RRE_FF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200809 { "stura", 0x46, INSTR_RRE_RR },
810 { "msta", 0x47, INSTR_RRE_R0 },
811 { "palb", 0x48, INSTR_RRE_00 },
812 { "ereg", 0x49, INSTR_RRE_RR },
813 { "esta", 0x4a, INSTR_RRE_RR },
814 { "lura", 0x4b, INSTR_RRE_RR },
815 { "tar", 0x4c, INSTR_RRE_AR },
Christian Borntraegercee9e532007-08-22 13:51:42 +0200816 { "cpya", 0x4d, INSTR_RRE_AA },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200817 { "sar", 0x4e, INSTR_RRE_AR },
818 { "ear", 0x4f, INSTR_RRE_RA },
819 { "csp", 0x50, INSTR_RRE_RR },
820 { "msr", 0x52, INSTR_RRE_RR },
821 { "mvpg", 0x54, INSTR_RRE_RR },
822 { "mvst", 0x55, INSTR_RRE_RR },
823 { "cuse", 0x57, INSTR_RRE_RR },
824 { "bsg", 0x58, INSTR_RRE_RR },
825 { "bsa", 0x5a, INSTR_RRE_RR },
826 { "clst", 0x5d, INSTR_RRE_RR },
827 { "srst", 0x5e, INSTR_RRE_RR },
828 { "cmpsc", 0x63, INSTR_RRE_RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200829 { "siga", 0x74, INSTR_S_RD },
830 { "xsch", 0x76, INSTR_S_00 },
831 { "rp", 0x77, INSTR_S_RD },
832 { "stcke", 0x78, INSTR_S_RD },
833 { "sacf", 0x79, INSTR_S_RD },
834 { "stsi", 0x7d, INSTR_S_RD },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100835 { "spp", 0x80, INSTR_S_RD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200836 { "srnm", 0x99, INSTR_S_RD },
837 { "stfpc", 0x9c, INSTR_S_RD },
838 { "lfpc", 0x9d, INSTR_S_RD },
839 { "tre", 0xa5, INSTR_RRE_RR },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100840 { "cuutf", 0xa6, INSTR_RRF_M0RR },
841 { "cutfu", 0xa7, INSTR_RRF_M0RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200842 { "stfl", 0xb1, INSTR_S_RD },
843 { "trap4", 0xff, INSTR_S_RD },
844 { "", 0, INSTR_INVALID }
845};
846
847static struct insn opcode_b3[] = {
848#ifdef CONFIG_64BIT
849 { "maylr", 0x38, INSTR_RRF_F0FF },
850 { "mylr", 0x39, INSTR_RRF_F0FF },
851 { "mayr", 0x3a, INSTR_RRF_F0FF },
852 { "myr", 0x3b, INSTR_RRF_F0FF },
853 { "mayhr", 0x3c, INSTR_RRF_F0FF },
854 { "myhr", 0x3d, INSTR_RRF_F0FF },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100855 { "lpdfr", 0x70, INSTR_RRE_FF },
856 { "lndfr", 0x71, INSTR_RRE_FF },
857 { "cpsdr", 0x72, INSTR_RRF_F0FF2 },
858 { "lcdfr", 0x73, INSTR_RRE_FF },
Martin Schwidefsky618708f2010-02-26 22:37:49 +0100859 { "sfasr", 0x85, INSTR_RRE_R0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100860 { { 0, LONG_INSN_CELFBR }, 0x90, INSTR_RRF_UUFR },
861 { { 0, LONG_INSN_CDLFBR }, 0x91, INSTR_RRF_UUFR },
862 { { 0, LONG_INSN_CXLFBR }, 0x92, INSTR_RRF_UURF },
863 { { 0, LONG_INSN_CEFBRA }, 0x94, INSTR_RRF_UUFR },
864 { { 0, LONG_INSN_CDFBRA }, 0x95, INSTR_RRF_UUFR },
865 { { 0, LONG_INSN_CXFBRA }, 0x96, INSTR_RRF_UURF },
866 { { 0, LONG_INSN_CFEBRA }, 0x98, INSTR_RRF_UURF },
867 { { 0, LONG_INSN_CFDBRA }, 0x99, INSTR_RRF_UURF },
868 { { 0, LONG_INSN_CFXBRA }, 0x9a, INSTR_RRF_UUFR },
869 { { 0, LONG_INSN_CLFEBR }, 0x9c, INSTR_RRF_UURF },
870 { { 0, LONG_INSN_CLFDBR }, 0x9d, INSTR_RRF_UURF },
871 { { 0, LONG_INSN_CLFXBR }, 0x9e, INSTR_RRF_UUFR },
872 { { 0, LONG_INSN_CELGBR }, 0xa0, INSTR_RRF_UUFR },
873 { { 0, LONG_INSN_CDLGBR }, 0xa1, INSTR_RRF_UUFR },
874 { { 0, LONG_INSN_CXLGBR }, 0xa2, INSTR_RRF_UURF },
875 { { 0, LONG_INSN_CEGBRA }, 0xa4, INSTR_RRF_UUFR },
876 { { 0, LONG_INSN_CDGBRA }, 0xa5, INSTR_RRF_UUFR },
877 { { 0, LONG_INSN_CXGBRA }, 0xa6, INSTR_RRF_UURF },
878 { { 0, LONG_INSN_CGEBRA }, 0xa8, INSTR_RRF_UURF },
879 { { 0, LONG_INSN_CGDBRA }, 0xa9, INSTR_RRF_UURF },
880 { { 0, LONG_INSN_CGXBRA }, 0xaa, INSTR_RRF_UUFR },
881 { { 0, LONG_INSN_CLGEBR }, 0xac, INSTR_RRF_UURF },
882 { { 0, LONG_INSN_CLGDBR }, 0xad, INSTR_RRF_UURF },
883 { { 0, LONG_INSN_CLGXBR }, 0xae, INSTR_RRF_UUFR },
884 { "ldgr", 0xc1, INSTR_RRE_FR },
885 { "cegr", 0xc4, INSTR_RRE_FR },
886 { "cdgr", 0xc5, INSTR_RRE_FR },
887 { "cxgr", 0xc6, INSTR_RRE_FR },
888 { "cger", 0xc8, INSTR_RRF_U0RF },
889 { "cgdr", 0xc9, INSTR_RRF_U0RF },
890 { "cgxr", 0xca, INSTR_RRF_U0RF },
891 { "lgdr", 0xcd, INSTR_RRE_RF },
892 { "mdtra", 0xd0, INSTR_RRF_FUFF2 },
893 { "ddtra", 0xd1, INSTR_RRF_FUFF2 },
894 { "adtra", 0xd2, INSTR_RRF_FUFF2 },
895 { "sdtra", 0xd3, INSTR_RRF_FUFF2 },
896 { "ldetr", 0xd4, INSTR_RRF_0UFF },
897 { "ledtr", 0xd5, INSTR_RRF_UUFF },
898 { "ltdtr", 0xd6, INSTR_RRE_FF },
899 { "fidtr", 0xd7, INSTR_RRF_UUFF },
900 { "mxtra", 0xd8, INSTR_RRF_FUFF2 },
901 { "dxtra", 0xd9, INSTR_RRF_FUFF2 },
902 { "axtra", 0xda, INSTR_RRF_FUFF2 },
903 { "sxtra", 0xdb, INSTR_RRF_FUFF2 },
904 { "lxdtr", 0xdc, INSTR_RRF_0UFF },
905 { "ldxtr", 0xdd, INSTR_RRF_UUFF },
906 { "ltxtr", 0xde, INSTR_RRE_FF },
907 { "fixtr", 0xdf, INSTR_RRF_UUFF },
908 { "kdtr", 0xe0, INSTR_RRE_FF },
909 { { 0, LONG_INSN_CGDTRA }, 0xe1, INSTR_RRF_UURF },
910 { "cudtr", 0xe2, INSTR_RRE_RF },
911 { "csdtr", 0xe3, INSTR_RRE_RF },
912 { "cdtr", 0xe4, INSTR_RRE_FF },
913 { "eedtr", 0xe5, INSTR_RRE_RF },
914 { "esdtr", 0xe7, INSTR_RRE_RF },
915 { "kxtr", 0xe8, INSTR_RRE_FF },
916 { { 0, LONG_INSN_CGXTRA }, 0xe9, INSTR_RRF_UUFR },
917 { "cuxtr", 0xea, INSTR_RRE_RF },
918 { "csxtr", 0xeb, INSTR_RRE_RF },
919 { "cxtr", 0xec, INSTR_RRE_FF },
920 { "eextr", 0xed, INSTR_RRE_RF },
921 { "esxtr", 0xef, INSTR_RRE_RF },
922 { { 0, LONG_INSN_CDGTRA }, 0xf1, INSTR_RRF_UUFR },
923 { "cdutr", 0xf2, INSTR_RRE_FR },
924 { "cdstr", 0xf3, INSTR_RRE_FR },
925 { "cedtr", 0xf4, INSTR_RRE_FF },
926 { "qadtr", 0xf5, INSTR_RRF_FUFF },
927 { "iedtr", 0xf6, INSTR_RRF_F0FR },
928 { "rrdtr", 0xf7, INSTR_RRF_FFRU },
929 { { 0, LONG_INSN_CXGTRA }, 0xf9, INSTR_RRF_UURF },
930 { "cxutr", 0xfa, INSTR_RRE_FR },
931 { "cxstr", 0xfb, INSTR_RRE_FR },
932 { "cextr", 0xfc, INSTR_RRE_FF },
933 { "qaxtr", 0xfd, INSTR_RRF_FUFF },
934 { "iextr", 0xfe, INSTR_RRF_F0FR },
935 { "rrxtr", 0xff, INSTR_RRF_FFRU },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200936#endif
937 { "lpebr", 0x00, INSTR_RRE_FF },
938 { "lnebr", 0x01, INSTR_RRE_FF },
939 { "ltebr", 0x02, INSTR_RRE_FF },
940 { "lcebr", 0x03, INSTR_RRE_FF },
941 { "ldebr", 0x04, INSTR_RRE_FF },
942 { "lxdbr", 0x05, INSTR_RRE_FF },
943 { "lxebr", 0x06, INSTR_RRE_FF },
944 { "mxdbr", 0x07, INSTR_RRE_FF },
945 { "kebr", 0x08, INSTR_RRE_FF },
946 { "cebr", 0x09, INSTR_RRE_FF },
947 { "aebr", 0x0a, INSTR_RRE_FF },
948 { "sebr", 0x0b, INSTR_RRE_FF },
949 { "mdebr", 0x0c, INSTR_RRE_FF },
950 { "debr", 0x0d, INSTR_RRE_FF },
951 { "maebr", 0x0e, INSTR_RRF_F0FF },
952 { "msebr", 0x0f, INSTR_RRF_F0FF },
953 { "lpdbr", 0x10, INSTR_RRE_FF },
954 { "lndbr", 0x11, INSTR_RRE_FF },
955 { "ltdbr", 0x12, INSTR_RRE_FF },
956 { "lcdbr", 0x13, INSTR_RRE_FF },
957 { "sqebr", 0x14, INSTR_RRE_FF },
958 { "sqdbr", 0x15, INSTR_RRE_FF },
959 { "sqxbr", 0x16, INSTR_RRE_FF },
960 { "meebr", 0x17, INSTR_RRE_FF },
961 { "kdbr", 0x18, INSTR_RRE_FF },
962 { "cdbr", 0x19, INSTR_RRE_FF },
963 { "adbr", 0x1a, INSTR_RRE_FF },
964 { "sdbr", 0x1b, INSTR_RRE_FF },
965 { "mdbr", 0x1c, INSTR_RRE_FF },
966 { "ddbr", 0x1d, INSTR_RRE_FF },
967 { "madbr", 0x1e, INSTR_RRF_F0FF },
968 { "msdbr", 0x1f, INSTR_RRF_F0FF },
969 { "lder", 0x24, INSTR_RRE_FF },
970 { "lxdr", 0x25, INSTR_RRE_FF },
971 { "lxer", 0x26, INSTR_RRE_FF },
972 { "maer", 0x2e, INSTR_RRF_F0FF },
973 { "mser", 0x2f, INSTR_RRF_F0FF },
974 { "sqxr", 0x36, INSTR_RRE_FF },
975 { "meer", 0x37, INSTR_RRE_FF },
976 { "madr", 0x3e, INSTR_RRF_F0FF },
977 { "msdr", 0x3f, INSTR_RRF_F0FF },
978 { "lpxbr", 0x40, INSTR_RRE_FF },
979 { "lnxbr", 0x41, INSTR_RRE_FF },
980 { "ltxbr", 0x42, INSTR_RRE_FF },
981 { "lcxbr", 0x43, INSTR_RRE_FF },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100982 { { 0, LONG_INSN_LEDBRA }, 0x44, INSTR_RRF_UUFF },
983 { { 0, LONG_INSN_LDXBRA }, 0x45, INSTR_RRF_UUFF },
984 { { 0, LONG_INSN_LEXBRA }, 0x46, INSTR_RRF_UUFF },
985 { { 0, LONG_INSN_FIXBRA }, 0x47, INSTR_RRF_UUFF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200986 { "kxbr", 0x48, INSTR_RRE_FF },
987 { "cxbr", 0x49, INSTR_RRE_FF },
988 { "axbr", 0x4a, INSTR_RRE_FF },
989 { "sxbr", 0x4b, INSTR_RRE_FF },
990 { "mxbr", 0x4c, INSTR_RRE_FF },
991 { "dxbr", 0x4d, INSTR_RRE_FF },
992 { "tbedr", 0x50, INSTR_RRF_U0FF },
993 { "tbdr", 0x51, INSTR_RRF_U0FF },
994 { "diebr", 0x53, INSTR_RRF_FUFF },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100995 { { 0, LONG_INSN_FIEBRA }, 0x57, INSTR_RRF_UUFF },
996 { "thder", 0x58, INSTR_RRE_FF },
997 { "thdr", 0x59, INSTR_RRE_FF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +0200998 { "didbr", 0x5b, INSTR_RRF_FUFF },
Heiko Carstensc68dba22012-11-19 22:49:34 +0100999 { { 0, LONG_INSN_FIDBRA }, 0x5f, INSTR_RRF_UUFF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001000 { "lpxr", 0x60, INSTR_RRE_FF },
1001 { "lnxr", 0x61, INSTR_RRE_FF },
1002 { "ltxr", 0x62, INSTR_RRE_FF },
1003 { "lcxr", 0x63, INSTR_RRE_FF },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001004 { "lxr", 0x65, INSTR_RRE_FF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001005 { "lexr", 0x66, INSTR_RRE_FF },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001006 { "fixr", 0x67, INSTR_RRE_FF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001007 { "cxr", 0x69, INSTR_RRE_FF },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001008 { "lzer", 0x74, INSTR_RRE_F0 },
1009 { "lzdr", 0x75, INSTR_RRE_F0 },
1010 { "lzxr", 0x76, INSTR_RRE_F0 },
1011 { "fier", 0x77, INSTR_RRE_FF },
1012 { "fidr", 0x7f, INSTR_RRE_FF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001013 { "sfpc", 0x84, INSTR_RRE_RR_OPT },
1014 { "efpc", 0x8c, INSTR_RRE_RR_OPT },
1015 { "cefbr", 0x94, INSTR_RRE_RF },
1016 { "cdfbr", 0x95, INSTR_RRE_RF },
1017 { "cxfbr", 0x96, INSTR_RRE_RF },
1018 { "cfebr", 0x98, INSTR_RRF_U0RF },
1019 { "cfdbr", 0x99, INSTR_RRF_U0RF },
1020 { "cfxbr", 0x9a, INSTR_RRF_U0RF },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001021 { "cefr", 0xb4, INSTR_RRE_FR },
1022 { "cdfr", 0xb5, INSTR_RRE_FR },
1023 { "cxfr", 0xb6, INSTR_RRE_FR },
1024 { "cfer", 0xb8, INSTR_RRF_U0RF },
1025 { "cfdr", 0xb9, INSTR_RRF_U0RF },
1026 { "cfxr", 0xba, INSTR_RRF_U0RF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001027 { "", 0, INSTR_INVALID }
1028};
1029
1030static struct insn opcode_b9[] = {
1031#ifdef CONFIG_64BIT
1032 { "lpgr", 0x00, INSTR_RRE_RR },
1033 { "lngr", 0x01, INSTR_RRE_RR },
1034 { "ltgr", 0x02, INSTR_RRE_RR },
1035 { "lcgr", 0x03, INSTR_RRE_RR },
1036 { "lgr", 0x04, INSTR_RRE_RR },
1037 { "lurag", 0x05, INSTR_RRE_RR },
1038 { "lgbr", 0x06, INSTR_RRE_RR },
1039 { "lghr", 0x07, INSTR_RRE_RR },
1040 { "agr", 0x08, INSTR_RRE_RR },
1041 { "sgr", 0x09, INSTR_RRE_RR },
1042 { "algr", 0x0a, INSTR_RRE_RR },
1043 { "slgr", 0x0b, INSTR_RRE_RR },
1044 { "msgr", 0x0c, INSTR_RRE_RR },
1045 { "dsgr", 0x0d, INSTR_RRE_RR },
1046 { "eregg", 0x0e, INSTR_RRE_RR },
1047 { "lrvgr", 0x0f, INSTR_RRE_RR },
1048 { "lpgfr", 0x10, INSTR_RRE_RR },
1049 { "lngfr", 0x11, INSTR_RRE_RR },
1050 { "ltgfr", 0x12, INSTR_RRE_RR },
1051 { "lcgfr", 0x13, INSTR_RRE_RR },
1052 { "lgfr", 0x14, INSTR_RRE_RR },
1053 { "llgfr", 0x16, INSTR_RRE_RR },
1054 { "llgtr", 0x17, INSTR_RRE_RR },
1055 { "agfr", 0x18, INSTR_RRE_RR },
1056 { "sgfr", 0x19, INSTR_RRE_RR },
1057 { "algfr", 0x1a, INSTR_RRE_RR },
1058 { "slgfr", 0x1b, INSTR_RRE_RR },
1059 { "msgfr", 0x1c, INSTR_RRE_RR },
1060 { "dsgfr", 0x1d, INSTR_RRE_RR },
1061 { "cgr", 0x20, INSTR_RRE_RR },
1062 { "clgr", 0x21, INSTR_RRE_RR },
1063 { "sturg", 0x25, INSTR_RRE_RR },
1064 { "lbr", 0x26, INSTR_RRE_RR },
1065 { "lhr", 0x27, INSTR_RRE_RR },
1066 { "cgfr", 0x30, INSTR_RRE_RR },
1067 { "clgfr", 0x31, INSTR_RRE_RR },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001068 { "cfdtr", 0x41, INSTR_RRF_UURF },
1069 { { 0, LONG_INSN_CLGDTR }, 0x42, INSTR_RRF_UURF },
1070 { { 0, LONG_INSN_CLFDTR }, 0x43, INSTR_RRF_UURF },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001071 { "bctgr", 0x46, INSTR_RRE_RR },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001072 { "cfxtr", 0x49, INSTR_RRF_UURF },
1073 { { 0, LONG_INSN_CLGXTR }, 0x4a, INSTR_RRF_UUFR },
1074 { { 0, LONG_INSN_CLFXTR }, 0x4b, INSTR_RRF_UUFR },
1075 { "cdftr", 0x51, INSTR_RRF_UUFR },
1076 { { 0, LONG_INSN_CDLGTR }, 0x52, INSTR_RRF_UUFR },
1077 { { 0, LONG_INSN_CDLFTR }, 0x53, INSTR_RRF_UUFR },
1078 { "cxftr", 0x59, INSTR_RRF_UURF },
1079 { { 0, LONG_INSN_CXLGTR }, 0x5a, INSTR_RRF_UURF },
1080 { { 0, LONG_INSN_CXLFTR }, 0x5b, INSTR_RRF_UUFR },
1081 { "cgrt", 0x60, INSTR_RRF_U0RR },
1082 { "clgrt", 0x61, INSTR_RRF_U0RR },
1083 { "crt", 0x72, INSTR_RRF_U0RR },
1084 { "clrt", 0x73, INSTR_RRF_U0RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001085 { "ngr", 0x80, INSTR_RRE_RR },
1086 { "ogr", 0x81, INSTR_RRE_RR },
1087 { "xgr", 0x82, INSTR_RRE_RR },
1088 { "flogr", 0x83, INSTR_RRE_RR },
1089 { "llgcr", 0x84, INSTR_RRE_RR },
1090 { "llghr", 0x85, INSTR_RRE_RR },
1091 { "mlgr", 0x86, INSTR_RRE_RR },
1092 { "dlgr", 0x87, INSTR_RRE_RR },
1093 { "alcgr", 0x88, INSTR_RRE_RR },
1094 { "slbgr", 0x89, INSTR_RRE_RR },
1095 { "cspg", 0x8a, INSTR_RRE_RR },
1096 { "idte", 0x8e, INSTR_RRF_R0RR },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001097 { "crdte", 0x8f, INSTR_RRF_RMRR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001098 { "llcr", 0x94, INSTR_RRE_RR },
1099 { "llhr", 0x95, INSTR_RRE_RR },
1100 { "esea", 0x9d, INSTR_RRE_R0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001101 { "ptf", 0xa2, INSTR_RRE_R0 },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001102 { "lptea", 0xaa, INSTR_RRF_RURR },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001103 { "rrbm", 0xae, INSTR_RRE_RR },
1104 { "pfmf", 0xaf, INSTR_RRE_RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001105 { "cu14", 0xb0, INSTR_RRF_M0RR },
1106 { "cu24", 0xb1, INSTR_RRF_M0RR },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001107 { "cu41", 0xb2, INSTR_RRE_RR },
1108 { "cu42", 0xb3, INSTR_RRE_RR },
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001109 { "trtre", 0xbd, INSTR_RRF_M0RR },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001110 { "srstu", 0xbe, INSTR_RRE_RR },
1111 { "trte", 0xbf, INSTR_RRF_M0RR },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001112 { "ahhhr", 0xc8, INSTR_RRF_R0RR2 },
1113 { "shhhr", 0xc9, INSTR_RRF_R0RR2 },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001114 { { 0, LONG_INSN_ALHHHR }, 0xca, INSTR_RRF_R0RR2 },
1115 { { 0, LONG_INSN_SLHHHR }, 0xcb, INSTR_RRF_R0RR2 },
1116 { "chhr", 0xcd, INSTR_RRE_RR },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001117 { "clhhr", 0xcf, INSTR_RRE_RR },
1118 { "ahhlr", 0xd8, INSTR_RRF_R0RR2 },
1119 { "shhlr", 0xd9, INSTR_RRF_R0RR2 },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001120 { { 0, LONG_INSN_ALHHLR }, 0xda, INSTR_RRF_R0RR2 },
1121 { { 0, LONG_INSN_SLHHLR }, 0xdb, INSTR_RRF_R0RR2 },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001122 { "chlr", 0xdd, INSTR_RRE_RR },
1123 { "clhlr", 0xdf, INSTR_RRE_RR },
1124 { { 0, LONG_INSN_POPCNT }, 0xe1, INSTR_RRE_RR },
1125 { "locgr", 0xe2, INSTR_RRF_M0RR },
1126 { "ngrk", 0xe4, INSTR_RRF_R0RR2 },
1127 { "ogrk", 0xe6, INSTR_RRF_R0RR2 },
1128 { "xgrk", 0xe7, INSTR_RRF_R0RR2 },
1129 { "agrk", 0xe8, INSTR_RRF_R0RR2 },
1130 { "sgrk", 0xe9, INSTR_RRF_R0RR2 },
1131 { "algrk", 0xea, INSTR_RRF_R0RR2 },
1132 { "slgrk", 0xeb, INSTR_RRF_R0RR2 },
1133 { "locr", 0xf2, INSTR_RRF_M0RR },
1134 { "nrk", 0xf4, INSTR_RRF_R0RR2 },
1135 { "ork", 0xf6, INSTR_RRF_R0RR2 },
1136 { "xrk", 0xf7, INSTR_RRF_R0RR2 },
1137 { "ark", 0xf8, INSTR_RRF_R0RR2 },
1138 { "srk", 0xf9, INSTR_RRF_R0RR2 },
1139 { "alrk", 0xfa, INSTR_RRF_R0RR2 },
1140 { "slrk", 0xfb, INSTR_RRF_R0RR2 },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001141#endif
1142 { "kmac", 0x1e, INSTR_RRE_RR },
1143 { "lrvr", 0x1f, INSTR_RRE_RR },
1144 { "km", 0x2e, INSTR_RRE_RR },
1145 { "kmc", 0x2f, INSTR_RRE_RR },
1146 { "kimd", 0x3e, INSTR_RRE_RR },
1147 { "klmd", 0x3f, INSTR_RRE_RR },
1148 { "epsw", 0x8d, INSTR_RRE_RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001149 { "trtt", 0x90, INSTR_RRF_M0RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001150 { "trto", 0x91, INSTR_RRF_M0RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001151 { "trot", 0x92, INSTR_RRF_M0RR },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001152 { "troo", 0x93, INSTR_RRF_M0RR },
1153 { "mlr", 0x96, INSTR_RRE_RR },
1154 { "dlr", 0x97, INSTR_RRE_RR },
1155 { "alcr", 0x98, INSTR_RRE_RR },
1156 { "slbr", 0x99, INSTR_RRE_RR },
1157 { "", 0, INSTR_INVALID }
1158};
1159
1160static struct insn opcode_c0[] = {
1161#ifdef CONFIG_64BIT
1162 { "lgfi", 0x01, INSTR_RIL_RI },
1163 { "xihf", 0x06, INSTR_RIL_RU },
1164 { "xilf", 0x07, INSTR_RIL_RU },
1165 { "iihf", 0x08, INSTR_RIL_RU },
1166 { "iilf", 0x09, INSTR_RIL_RU },
1167 { "nihf", 0x0a, INSTR_RIL_RU },
1168 { "nilf", 0x0b, INSTR_RIL_RU },
1169 { "oihf", 0x0c, INSTR_RIL_RU },
1170 { "oilf", 0x0d, INSTR_RIL_RU },
1171 { "llihf", 0x0e, INSTR_RIL_RU },
1172 { "llilf", 0x0f, INSTR_RIL_RU },
1173#endif
1174 { "larl", 0x00, INSTR_RIL_RP },
1175 { "brcl", 0x04, INSTR_RIL_UP },
1176 { "brasl", 0x05, INSTR_RIL_RP },
1177 { "", 0, INSTR_INVALID }
1178};
1179
1180static struct insn opcode_c2[] = {
1181#ifdef CONFIG_64BIT
Heiko Carstensc68dba22012-11-19 22:49:34 +01001182 { "msgfi", 0x00, INSTR_RIL_RI },
1183 { "msfi", 0x01, INSTR_RIL_RI },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001184 { "slgfi", 0x04, INSTR_RIL_RU },
1185 { "slfi", 0x05, INSTR_RIL_RU },
1186 { "agfi", 0x08, INSTR_RIL_RI },
1187 { "afi", 0x09, INSTR_RIL_RI },
1188 { "algfi", 0x0a, INSTR_RIL_RU },
1189 { "alfi", 0x0b, INSTR_RIL_RU },
1190 { "cgfi", 0x0c, INSTR_RIL_RI },
1191 { "cfi", 0x0d, INSTR_RIL_RI },
1192 { "clgfi", 0x0e, INSTR_RIL_RU },
1193 { "clfi", 0x0f, INSTR_RIL_RU },
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001194#endif
1195 { "", 0, INSTR_INVALID }
1196};
1197
1198static struct insn opcode_c4[] = {
1199#ifdef CONFIG_64BIT
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001200 { "llhrl", 0x02, INSTR_RIL_RP },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001201 { "lghrl", 0x04, INSTR_RIL_RP },
1202 { "lhrl", 0x05, INSTR_RIL_RP },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001203 { { 0, LONG_INSN_LLGHRL }, 0x06, INSTR_RIL_RP },
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001204 { "sthrl", 0x07, INSTR_RIL_RP },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001205 { "lgrl", 0x08, INSTR_RIL_RP },
1206 { "stgrl", 0x0b, INSTR_RIL_RP },
1207 { "lgfrl", 0x0c, INSTR_RIL_RP },
1208 { "lrl", 0x0d, INSTR_RIL_RP },
1209 { { 0, LONG_INSN_LLGFRL }, 0x0e, INSTR_RIL_RP },
1210 { "strl", 0x0f, INSTR_RIL_RP },
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001211#endif
1212 { "", 0, INSTR_INVALID }
1213};
1214
1215static struct insn opcode_c6[] = {
1216#ifdef CONFIG_64BIT
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001217 { "exrl", 0x00, INSTR_RIL_RP },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001218 { "pfdrl", 0x02, INSTR_RIL_UP },
1219 { "cghrl", 0x04, INSTR_RIL_RP },
1220 { "chrl", 0x05, INSTR_RIL_RP },
1221 { { 0, LONG_INSN_CLGHRL }, 0x06, INSTR_RIL_RP },
1222 { "clhrl", 0x07, INSTR_RIL_RP },
1223 { "cgrl", 0x08, INSTR_RIL_RP },
1224 { "clgrl", 0x0a, INSTR_RIL_RP },
1225 { "cgfrl", 0x0c, INSTR_RIL_RP },
1226 { "crl", 0x0d, INSTR_RIL_RP },
1227 { { 0, LONG_INSN_CLGFRL }, 0x0e, INSTR_RIL_RP },
1228 { "clrl", 0x0f, INSTR_RIL_RP },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001229#endif
1230 { "", 0, INSTR_INVALID }
1231};
1232
1233static struct insn opcode_c8[] = {
1234#ifdef CONFIG_64BIT
1235 { "mvcos", 0x00, INSTR_SSF_RRDRD },
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001236 { "ectg", 0x01, INSTR_SSF_RRDRD },
1237 { "csst", 0x02, INSTR_SSF_RRDRD },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001238 { "lpd", 0x04, INSTR_SSF_RRDRD2 },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001239 { "lpdg", 0x05, INSTR_SSF_RRDRD2 },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001240#endif
1241 { "", 0, INSTR_INVALID }
1242};
1243
1244static struct insn opcode_cc[] = {
1245#ifdef CONFIG_64BIT
1246 { "brcth", 0x06, INSTR_RIL_RP },
1247 { "aih", 0x08, INSTR_RIL_RI },
1248 { "alsih", 0x0a, INSTR_RIL_RI },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001249 { { 0, LONG_INSN_ALSIHN }, 0x0b, INSTR_RIL_RI },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001250 { "cih", 0x0d, INSTR_RIL_RI },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001251 { "clih", 0x0f, INSTR_RIL_RI },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001252#endif
1253 { "", 0, INSTR_INVALID }
1254};
1255
1256static struct insn opcode_e3[] = {
1257#ifdef CONFIG_64BIT
1258 { "ltg", 0x02, INSTR_RXY_RRRD },
1259 { "lrag", 0x03, INSTR_RXY_RRRD },
1260 { "lg", 0x04, INSTR_RXY_RRRD },
1261 { "cvby", 0x06, INSTR_RXY_RRRD },
1262 { "ag", 0x08, INSTR_RXY_RRRD },
1263 { "sg", 0x09, INSTR_RXY_RRRD },
1264 { "alg", 0x0a, INSTR_RXY_RRRD },
1265 { "slg", 0x0b, INSTR_RXY_RRRD },
1266 { "msg", 0x0c, INSTR_RXY_RRRD },
1267 { "dsg", 0x0d, INSTR_RXY_RRRD },
1268 { "cvbg", 0x0e, INSTR_RXY_RRRD },
1269 { "lrvg", 0x0f, INSTR_RXY_RRRD },
1270 { "lt", 0x12, INSTR_RXY_RRRD },
1271 { "lray", 0x13, INSTR_RXY_RRRD },
1272 { "lgf", 0x14, INSTR_RXY_RRRD },
1273 { "lgh", 0x15, INSTR_RXY_RRRD },
1274 { "llgf", 0x16, INSTR_RXY_RRRD },
1275 { "llgt", 0x17, INSTR_RXY_RRRD },
1276 { "agf", 0x18, INSTR_RXY_RRRD },
1277 { "sgf", 0x19, INSTR_RXY_RRRD },
1278 { "algf", 0x1a, INSTR_RXY_RRRD },
1279 { "slgf", 0x1b, INSTR_RXY_RRRD },
1280 { "msgf", 0x1c, INSTR_RXY_RRRD },
1281 { "dsgf", 0x1d, INSTR_RXY_RRRD },
1282 { "cg", 0x20, INSTR_RXY_RRRD },
1283 { "clg", 0x21, INSTR_RXY_RRRD },
1284 { "stg", 0x24, INSTR_RXY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001285 { "ntstg", 0x25, INSTR_RXY_RRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001286 { "cvdy", 0x26, INSTR_RXY_RRRD },
1287 { "cvdg", 0x2e, INSTR_RXY_RRRD },
1288 { "strvg", 0x2f, INSTR_RXY_RRRD },
1289 { "cgf", 0x30, INSTR_RXY_RRRD },
1290 { "clgf", 0x31, INSTR_RXY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001291 { "ltgf", 0x32, INSTR_RXY_RRRD },
1292 { "cgh", 0x34, INSTR_RXY_RRRD },
1293 { "pfd", 0x36, INSTR_RXY_URRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001294 { "strvh", 0x3f, INSTR_RXY_RRRD },
1295 { "bctg", 0x46, INSTR_RXY_RRRD },
1296 { "sty", 0x50, INSTR_RXY_RRRD },
1297 { "msy", 0x51, INSTR_RXY_RRRD },
1298 { "ny", 0x54, INSTR_RXY_RRRD },
1299 { "cly", 0x55, INSTR_RXY_RRRD },
1300 { "oy", 0x56, INSTR_RXY_RRRD },
1301 { "xy", 0x57, INSTR_RXY_RRRD },
1302 { "ly", 0x58, INSTR_RXY_RRRD },
1303 { "cy", 0x59, INSTR_RXY_RRRD },
1304 { "ay", 0x5a, INSTR_RXY_RRRD },
1305 { "sy", 0x5b, INSTR_RXY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001306 { "mfy", 0x5c, INSTR_RXY_RRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001307 { "aly", 0x5e, INSTR_RXY_RRRD },
1308 { "sly", 0x5f, INSTR_RXY_RRRD },
1309 { "sthy", 0x70, INSTR_RXY_RRRD },
1310 { "lay", 0x71, INSTR_RXY_RRRD },
1311 { "stcy", 0x72, INSTR_RXY_RRRD },
1312 { "icy", 0x73, INSTR_RXY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001313 { "laey", 0x75, INSTR_RXY_RRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001314 { "lb", 0x76, INSTR_RXY_RRRD },
1315 { "lgb", 0x77, INSTR_RXY_RRRD },
1316 { "lhy", 0x78, INSTR_RXY_RRRD },
1317 { "chy", 0x79, INSTR_RXY_RRRD },
1318 { "ahy", 0x7a, INSTR_RXY_RRRD },
1319 { "shy", 0x7b, INSTR_RXY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001320 { "mhy", 0x7c, INSTR_RXY_RRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001321 { "ng", 0x80, INSTR_RXY_RRRD },
1322 { "og", 0x81, INSTR_RXY_RRRD },
1323 { "xg", 0x82, INSTR_RXY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001324 { "lgat", 0x85, INSTR_RXY_RRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001325 { "mlg", 0x86, INSTR_RXY_RRRD },
1326 { "dlg", 0x87, INSTR_RXY_RRRD },
1327 { "alcg", 0x88, INSTR_RXY_RRRD },
1328 { "slbg", 0x89, INSTR_RXY_RRRD },
1329 { "stpq", 0x8e, INSTR_RXY_RRRD },
1330 { "lpq", 0x8f, INSTR_RXY_RRRD },
1331 { "llgc", 0x90, INSTR_RXY_RRRD },
1332 { "llgh", 0x91, INSTR_RXY_RRRD },
1333 { "llc", 0x94, INSTR_RXY_RRRD },
1334 { "llh", 0x95, INSTR_RXY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001335 { { 0, LONG_INSN_LLGTAT }, 0x9c, INSTR_RXY_RRRD },
1336 { { 0, LONG_INSN_LLGFAT }, 0x9d, INSTR_RXY_RRRD },
1337 { "lat", 0x9f, INSTR_RXY_RRRD },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001338 { "lbh", 0xc0, INSTR_RXY_RRRD },
1339 { "llch", 0xc2, INSTR_RXY_RRRD },
1340 { "stch", 0xc3, INSTR_RXY_RRRD },
1341 { "lhh", 0xc4, INSTR_RXY_RRRD },
1342 { "llhh", 0xc6, INSTR_RXY_RRRD },
1343 { "sthh", 0xc7, INSTR_RXY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001344 { "lfhat", 0xc8, INSTR_RXY_RRRD },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001345 { "lfh", 0xca, INSTR_RXY_RRRD },
1346 { "stfh", 0xcb, INSTR_RXY_RRRD },
1347 { "chf", 0xcd, INSTR_RXY_RRRD },
1348 { "clhf", 0xcf, INSTR_RXY_RRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001349#endif
1350 { "lrv", 0x1e, INSTR_RXY_RRRD },
1351 { "lrvh", 0x1f, INSTR_RXY_RRRD },
1352 { "strv", 0x3e, INSTR_RXY_RRRD },
1353 { "ml", 0x96, INSTR_RXY_RRRD },
1354 { "dl", 0x97, INSTR_RXY_RRRD },
1355 { "alc", 0x98, INSTR_RXY_RRRD },
1356 { "slb", 0x99, INSTR_RXY_RRRD },
1357 { "", 0, INSTR_INVALID }
1358};
1359
1360static struct insn opcode_e5[] = {
1361#ifdef CONFIG_64BIT
1362 { "strag", 0x02, INSTR_SSE_RDRD },
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001363 { "mvhhi", 0x44, INSTR_SIL_RDI },
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001364 { "mvghi", 0x48, INSTR_SIL_RDI },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001365 { "mvhi", 0x4c, INSTR_SIL_RDI },
1366 { "chhsi", 0x54, INSTR_SIL_RDI },
1367 { { 0, LONG_INSN_CLHHSI }, 0x55, INSTR_SIL_RDU },
1368 { "cghsi", 0x58, INSTR_SIL_RDI },
1369 { { 0, LONG_INSN_CLGHSI }, 0x59, INSTR_SIL_RDU },
1370 { "chsi", 0x5c, INSTR_SIL_RDI },
1371 { { 0, LONG_INSN_CLFHSI }, 0x5d, INSTR_SIL_RDU },
Martin Schwidefskyd35339a2012-07-31 11:03:04 +02001372 { { 0, LONG_INSN_TBEGIN }, 0x60, INSTR_SIL_RDU },
1373 { { 0, LONG_INSN_TBEGINC }, 0x61, INSTR_SIL_RDU },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001374#endif
1375 { "lasp", 0x00, INSTR_SSE_RDRD },
1376 { "tprot", 0x01, INSTR_SSE_RDRD },
1377 { "mvcsk", 0x0e, INSTR_SSE_RDRD },
1378 { "mvcdk", 0x0f, INSTR_SSE_RDRD },
1379 { "", 0, INSTR_INVALID }
1380};
1381
1382static struct insn opcode_eb[] = {
1383#ifdef CONFIG_64BIT
1384 { "lmg", 0x04, INSTR_RSY_RRRD },
1385 { "srag", 0x0a, INSTR_RSY_RRRD },
1386 { "slag", 0x0b, INSTR_RSY_RRRD },
1387 { "srlg", 0x0c, INSTR_RSY_RRRD },
1388 { "sllg", 0x0d, INSTR_RSY_RRRD },
1389 { "tracg", 0x0f, INSTR_RSY_RRRD },
1390 { "csy", 0x14, INSTR_RSY_RRRD },
1391 { "rllg", 0x1c, INSTR_RSY_RRRD },
1392 { "clmh", 0x20, INSTR_RSY_RURD },
1393 { "clmy", 0x21, INSTR_RSY_RURD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001394 { "clt", 0x23, INSTR_RSY_RURD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001395 { "stmg", 0x24, INSTR_RSY_RRRD },
1396 { "stctg", 0x25, INSTR_RSY_CCRD },
1397 { "stmh", 0x26, INSTR_RSY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001398 { "clgt", 0x2b, INSTR_RSY_RURD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001399 { "stcmh", 0x2c, INSTR_RSY_RURD },
1400 { "stcmy", 0x2d, INSTR_RSY_RURD },
1401 { "lctlg", 0x2f, INSTR_RSY_CCRD },
1402 { "csg", 0x30, INSTR_RSY_RRRD },
1403 { "cdsy", 0x31, INSTR_RSY_RRRD },
1404 { "cdsg", 0x3e, INSTR_RSY_RRRD },
1405 { "bxhg", 0x44, INSTR_RSY_RRRD },
1406 { "bxleg", 0x45, INSTR_RSY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001407 { "ecag", 0x4c, INSTR_RSY_RRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001408 { "tmy", 0x51, INSTR_SIY_URD },
1409 { "mviy", 0x52, INSTR_SIY_URD },
1410 { "niy", 0x54, INSTR_SIY_URD },
1411 { "cliy", 0x55, INSTR_SIY_URD },
1412 { "oiy", 0x56, INSTR_SIY_URD },
1413 { "xiy", 0x57, INSTR_SIY_URD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001414 { "asi", 0x6a, INSTR_SIY_IRD },
1415 { "alsi", 0x6e, INSTR_SIY_IRD },
1416 { "agsi", 0x7a, INSTR_SIY_IRD },
1417 { "algsi", 0x7e, INSTR_SIY_IRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001418 { "icmh", 0x80, INSTR_RSY_RURD },
1419 { "icmy", 0x81, INSTR_RSY_RURD },
1420 { "clclu", 0x8f, INSTR_RSY_RRRD },
1421 { "stmy", 0x90, INSTR_RSY_RRRD },
1422 { "lmh", 0x96, INSTR_RSY_RRRD },
1423 { "lmy", 0x98, INSTR_RSY_RRRD },
1424 { "lamy", 0x9a, INSTR_RSY_AARD },
1425 { "stamy", 0x9b, INSTR_RSY_AARD },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001426 { "srak", 0xdc, INSTR_RSY_RRRD },
1427 { "slak", 0xdd, INSTR_RSY_RRRD },
1428 { "srlk", 0xde, INSTR_RSY_RRRD },
1429 { "sllk", 0xdf, INSTR_RSY_RRRD },
1430 { "locg", 0xe2, INSTR_RSY_RDRM },
1431 { "stocg", 0xe3, INSTR_RSY_RDRM },
1432 { "lang", 0xe4, INSTR_RSY_RRRD },
1433 { "laog", 0xe6, INSTR_RSY_RRRD },
1434 { "laxg", 0xe7, INSTR_RSY_RRRD },
1435 { "laag", 0xe8, INSTR_RSY_RRRD },
1436 { "laalg", 0xea, INSTR_RSY_RRRD },
1437 { "loc", 0xf2, INSTR_RSY_RDRM },
1438 { "stoc", 0xf3, INSTR_RSY_RDRM },
1439 { "lan", 0xf4, INSTR_RSY_RRRD },
1440 { "lao", 0xf6, INSTR_RSY_RRRD },
1441 { "lax", 0xf7, INSTR_RSY_RRRD },
1442 { "laa", 0xf8, INSTR_RSY_RRRD },
1443 { "laal", 0xfa, INSTR_RSY_RRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001444 { "lric", 0x60, INSTR_RSY_RDRM },
1445 { "stric", 0x61, INSTR_RSY_RDRM },
1446 { "mric", 0x62, INSTR_RSY_RDRM },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001447#endif
1448 { "rll", 0x1d, INSTR_RSY_RRRD },
1449 { "mvclu", 0x8e, INSTR_RSY_RRRD },
1450 { "tp", 0xc0, INSTR_RSL_R0RD },
1451 { "", 0, INSTR_INVALID }
1452};
1453
1454static struct insn opcode_ec[] = {
1455#ifdef CONFIG_64BIT
1456 { "brxhg", 0x44, INSTR_RIE_RRP },
1457 { "brxlg", 0x45, INSTR_RIE_RRP },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001458 { { 0, LONG_INSN_RISBLG }, 0x51, INSTR_RIE_RRUUU },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001459 { "rnsbg", 0x54, INSTR_RIE_RRUUU },
1460 { "risbg", 0x55, INSTR_RIE_RRUUU },
1461 { "rosbg", 0x56, INSTR_RIE_RRUUU },
1462 { "rxsbg", 0x57, INSTR_RIE_RRUUU },
1463 { { 0, LONG_INSN_RISBGN }, 0x59, INSTR_RIE_RRUUU },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001464 { { 0, LONG_INSN_RISBHG }, 0x5D, INSTR_RIE_RRUUU },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001465 { "cgrj", 0x64, INSTR_RIE_RRPU },
1466 { "clgrj", 0x65, INSTR_RIE_RRPU },
1467 { "cgit", 0x70, INSTR_RIE_R0IU },
1468 { "clgit", 0x71, INSTR_RIE_R0UU },
1469 { "cit", 0x72, INSTR_RIE_R0IU },
1470 { "clfit", 0x73, INSTR_RIE_R0UU },
1471 { "crj", 0x76, INSTR_RIE_RRPU },
1472 { "clrj", 0x77, INSTR_RIE_RRPU },
1473 { "cgij", 0x7c, INSTR_RIE_RUPI },
1474 { "clgij", 0x7d, INSTR_RIE_RUPU },
1475 { "cij", 0x7e, INSTR_RIE_RUPI },
1476 { "clij", 0x7f, INSTR_RIE_RUPU },
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001477 { "ahik", 0xd8, INSTR_RIE_RRI0 },
1478 { "aghik", 0xd9, INSTR_RIE_RRI0 },
1479 { { 0, LONG_INSN_ALHSIK }, 0xda, INSTR_RIE_RRI0 },
1480 { { 0, LONG_INSN_ALGHSIK }, 0xdb, INSTR_RIE_RRI0 },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001481 { "cgrb", 0xe4, INSTR_RRS_RRRDU },
1482 { "clgrb", 0xe5, INSTR_RRS_RRRDU },
1483 { "crb", 0xf6, INSTR_RRS_RRRDU },
1484 { "clrb", 0xf7, INSTR_RRS_RRRDU },
1485 { "cgib", 0xfc, INSTR_RIS_RURDI },
1486 { "clgib", 0xfd, INSTR_RIS_RURDU },
1487 { "cib", 0xfe, INSTR_RIS_RURDI },
1488 { "clib", 0xff, INSTR_RIS_RURDU },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001489#endif
1490 { "", 0, INSTR_INVALID }
1491};
1492
1493static struct insn opcode_ed[] = {
1494#ifdef CONFIG_64BIT
1495 { "mayl", 0x38, INSTR_RXF_FRRDF },
1496 { "myl", 0x39, INSTR_RXF_FRRDF },
1497 { "may", 0x3a, INSTR_RXF_FRRDF },
1498 { "my", 0x3b, INSTR_RXF_FRRDF },
1499 { "mayh", 0x3c, INSTR_RXF_FRRDF },
1500 { "myh", 0x3d, INSTR_RXF_FRRDF },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001501 { "sldt", 0x40, INSTR_RXF_FRRDF },
1502 { "srdt", 0x41, INSTR_RXF_FRRDF },
1503 { "slxt", 0x48, INSTR_RXF_FRRDF },
1504 { "srxt", 0x49, INSTR_RXF_FRRDF },
1505 { "tdcet", 0x50, INSTR_RXE_FRRD },
1506 { "tdget", 0x51, INSTR_RXE_FRRD },
1507 { "tdcdt", 0x54, INSTR_RXE_FRRD },
1508 { "tdgdt", 0x55, INSTR_RXE_FRRD },
1509 { "tdcxt", 0x58, INSTR_RXE_FRRD },
1510 { "tdgxt", 0x59, INSTR_RXE_FRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001511 { "ley", 0x64, INSTR_RXY_FRRD },
1512 { "ldy", 0x65, INSTR_RXY_FRRD },
1513 { "stey", 0x66, INSTR_RXY_FRRD },
1514 { "stdy", 0x67, INSTR_RXY_FRRD },
Heiko Carstensc68dba22012-11-19 22:49:34 +01001515 { "czdt", 0xa8, INSTR_RSL_LRDFU },
1516 { "czxt", 0xa9, INSTR_RSL_LRDFU },
1517 { "cdzt", 0xaa, INSTR_RSL_LRDFU },
1518 { "cxzt", 0xab, INSTR_RSL_LRDFU },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001519#endif
1520 { "ldeb", 0x04, INSTR_RXE_FRRD },
1521 { "lxdb", 0x05, INSTR_RXE_FRRD },
1522 { "lxeb", 0x06, INSTR_RXE_FRRD },
1523 { "mxdb", 0x07, INSTR_RXE_FRRD },
1524 { "keb", 0x08, INSTR_RXE_FRRD },
1525 { "ceb", 0x09, INSTR_RXE_FRRD },
1526 { "aeb", 0x0a, INSTR_RXE_FRRD },
1527 { "seb", 0x0b, INSTR_RXE_FRRD },
1528 { "mdeb", 0x0c, INSTR_RXE_FRRD },
1529 { "deb", 0x0d, INSTR_RXE_FRRD },
1530 { "maeb", 0x0e, INSTR_RXF_FRRDF },
1531 { "mseb", 0x0f, INSTR_RXF_FRRDF },
1532 { "tceb", 0x10, INSTR_RXE_FRRD },
1533 { "tcdb", 0x11, INSTR_RXE_FRRD },
1534 { "tcxb", 0x12, INSTR_RXE_FRRD },
1535 { "sqeb", 0x14, INSTR_RXE_FRRD },
1536 { "sqdb", 0x15, INSTR_RXE_FRRD },
1537 { "meeb", 0x17, INSTR_RXE_FRRD },
1538 { "kdb", 0x18, INSTR_RXE_FRRD },
1539 { "cdb", 0x19, INSTR_RXE_FRRD },
1540 { "adb", 0x1a, INSTR_RXE_FRRD },
1541 { "sdb", 0x1b, INSTR_RXE_FRRD },
1542 { "mdb", 0x1c, INSTR_RXE_FRRD },
1543 { "ddb", 0x1d, INSTR_RXE_FRRD },
1544 { "madb", 0x1e, INSTR_RXF_FRRDF },
1545 { "msdb", 0x1f, INSTR_RXF_FRRDF },
1546 { "lde", 0x24, INSTR_RXE_FRRD },
1547 { "lxd", 0x25, INSTR_RXE_FRRD },
1548 { "lxe", 0x26, INSTR_RXE_FRRD },
1549 { "mae", 0x2e, INSTR_RXF_FRRDF },
1550 { "mse", 0x2f, INSTR_RXF_FRRDF },
1551 { "sqe", 0x34, INSTR_RXE_FRRD },
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001552 { "sqd", 0x35, INSTR_RXE_FRRD },
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001553 { "mee", 0x37, INSTR_RXE_FRRD },
1554 { "mad", 0x3e, INSTR_RXF_FRRDF },
1555 { "msd", 0x3f, INSTR_RXF_FRRDF },
1556 { "", 0, INSTR_INVALID }
1557};
1558
1559/* Extracts an operand value from an instruction. */
1560static unsigned int extract_operand(unsigned char *code,
1561 const struct operand *operand)
1562{
1563 unsigned int val;
1564 int bits;
1565
1566 /* Extract fragments of the operand byte for byte. */
1567 code += operand->shift / 8;
1568 bits = (operand->shift & 7) + operand->bits;
1569 val = 0;
1570 do {
1571 val <<= 8;
1572 val |= (unsigned int) *code++;
1573 bits -= 8;
1574 } while (bits > 0);
1575 val >>= -bits;
1576 val &= ((1U << (operand->bits - 1)) << 1) - 1;
1577
1578 /* Check for special long displacement case. */
1579 if (operand->bits == 20 && operand->shift == 20)
1580 val = (val & 0xff) << 12 | (val & 0xfff00) >> 8;
1581
1582 /* Sign extend value if the operand is signed or pc relative. */
1583 if ((operand->flags & (OPERAND_SIGNED | OPERAND_PCREL)) &&
1584 (val & (1U << (operand->bits - 1))))
1585 val |= (-1U << (operand->bits - 1)) << 1;
1586
1587 /* Double value if the operand is pc relative. */
1588 if (operand->flags & OPERAND_PCREL)
1589 val <<= 1;
1590
1591 /* Length x in an instructions has real length x + 1. */
1592 if (operand->flags & OPERAND_LENGTH)
1593 val++;
1594 return val;
1595}
1596
1597static inline int insn_length(unsigned char code)
1598{
1599 return ((((int) code + 64) >> 7) + 1) << 1;
1600}
1601
1602static struct insn *find_insn(unsigned char *code)
1603{
1604 unsigned char opfrag = code[1];
1605 unsigned char opmask;
1606 struct insn *table;
1607
1608 switch (code[0]) {
1609 case 0x01:
1610 table = opcode_01;
1611 break;
1612 case 0xa5:
1613 table = opcode_a5;
1614 break;
1615 case 0xa7:
1616 table = opcode_a7;
1617 break;
Jan Glaubere4b8b3f2012-07-31 10:52:05 +02001618 case 0xaa:
1619 table = opcode_aa;
1620 break;
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001621 case 0xb2:
1622 table = opcode_b2;
1623 break;
1624 case 0xb3:
1625 table = opcode_b3;
1626 break;
1627 case 0xb9:
1628 table = opcode_b9;
1629 break;
1630 case 0xc0:
1631 table = opcode_c0;
1632 break;
1633 case 0xc2:
1634 table = opcode_c2;
1635 break;
Martin Schwidefsky618708f2010-02-26 22:37:49 +01001636 case 0xc4:
1637 table = opcode_c4;
1638 break;
1639 case 0xc6:
1640 table = opcode_c6;
1641 break;
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001642 case 0xc8:
1643 table = opcode_c8;
1644 break;
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001645 case 0xcc:
1646 table = opcode_cc;
1647 break;
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001648 case 0xe3:
1649 table = opcode_e3;
1650 opfrag = code[5];
1651 break;
1652 case 0xe5:
1653 table = opcode_e5;
1654 break;
1655 case 0xeb:
1656 table = opcode_eb;
1657 opfrag = code[5];
1658 break;
1659 case 0xec:
1660 table = opcode_ec;
1661 opfrag = code[5];
1662 break;
1663 case 0xed:
1664 table = opcode_ed;
1665 opfrag = code[5];
1666 break;
1667 default:
1668 table = opcode;
1669 opfrag = code[0];
1670 break;
1671 }
1672 while (table->format != INSTR_INVALID) {
1673 opmask = formats[table->format][0];
1674 if (table->opfrag == (opfrag & opmask))
1675 return table;
1676 table++;
1677 }
1678 return NULL;
1679}
1680
Cornelia Huck9b7fb992012-07-23 17:20:28 +02001681/**
1682 * insn_to_mnemonic - decode an s390 instruction
1683 * @instruction: instruction to decode
1684 * @buf: buffer to fill with mnemonic
1685 *
1686 * Decode the instruction at @instruction and store the corresponding
1687 * mnemonic into @buf.
1688 * @buf is left unchanged if the instruction could not be decoded.
1689 * Returns:
1690 * %0 on success, %-ENOENT if the instruction was not found.
1691 */
1692int insn_to_mnemonic(unsigned char *instruction, char buf[8])
1693{
1694 struct insn *insn;
1695
1696 insn = find_insn(instruction);
1697 if (!insn)
1698 return -ENOENT;
1699 if (insn->name[0] == '\0')
1700 snprintf(buf, sizeof(buf), "%s",
1701 long_insn_name[(int) insn->name[1]]);
1702 else
1703 snprintf(buf, sizeof(buf), "%.5s", insn->name);
1704 return 0;
1705}
1706EXPORT_SYMBOL_GPL(insn_to_mnemonic);
1707
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001708static int print_insn(char *buffer, unsigned char *code, unsigned long addr)
1709{
1710 struct insn *insn;
1711 const unsigned char *ops;
1712 const struct operand *operand;
1713 unsigned int value;
1714 char separator;
1715 char *ptr;
Martin Schwidefsky74ccbdc2007-10-12 16:11:33 +02001716 int i;
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001717
1718 ptr = buffer;
1719 insn = find_insn(code);
1720 if (insn) {
Martin Schwidefsky8b8c12b2010-10-25 16:10:15 +02001721 if (insn->name[0] == '\0')
1722 ptr += sprintf(ptr, "%s\t",
1723 long_insn_name[(int) insn->name[1]]);
1724 else
1725 ptr += sprintf(ptr, "%.5s\t", insn->name);
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001726 /* Extract the operands. */
1727 separator = 0;
Martin Schwidefsky74ccbdc2007-10-12 16:11:33 +02001728 for (ops = formats[insn->format] + 1, i = 0;
1729 *ops != 0 && i < 6; ops++, i++) {
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001730 operand = operands + *ops;
1731 value = extract_operand(code, operand);
1732 if ((operand->flags & OPERAND_INDEX) && value == 0)
1733 continue;
1734 if ((operand->flags & OPERAND_BASE) &&
1735 value == 0 && separator == '(') {
1736 separator = ',';
1737 continue;
1738 }
1739 if (separator)
1740 ptr += sprintf(ptr, "%c", separator);
1741 if (operand->flags & OPERAND_GPR)
1742 ptr += sprintf(ptr, "%%r%i", value);
1743 else if (operand->flags & OPERAND_FPR)
1744 ptr += sprintf(ptr, "%%f%i", value);
1745 else if (operand->flags & OPERAND_AR)
1746 ptr += sprintf(ptr, "%%a%i", value);
1747 else if (operand->flags & OPERAND_CR)
1748 ptr += sprintf(ptr, "%%c%i", value);
1749 else if (operand->flags & OPERAND_PCREL)
Christian Borntraeger92d154b2007-07-17 13:36:03 +02001750 ptr += sprintf(ptr, "%lx", (signed int) value
1751 + addr);
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001752 else if (operand->flags & OPERAND_SIGNED)
1753 ptr += sprintf(ptr, "%i", value);
1754 else
1755 ptr += sprintf(ptr, "%u", value);
1756 if (operand->flags & OPERAND_DISP)
1757 separator = '(';
1758 else if (operand->flags & OPERAND_BASE) {
1759 ptr += sprintf(ptr, ")");
1760 separator = ',';
1761 } else
1762 separator = ',';
1763 }
1764 } else
1765 ptr += sprintf(ptr, "unknown");
1766 return (int) (ptr - buffer);
1767}
1768
1769void show_code(struct pt_regs *regs)
1770{
Heiko Carstens7d256172012-07-27 10:31:12 +02001771 char *mode = user_mode(regs) ? "User" : "Krnl";
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001772 unsigned char code[64];
1773 char buffer[64], *ptr;
1774 mm_segment_t old_fs;
1775 unsigned long addr;
1776 int start, end, opsize, hops, i;
1777
1778 /* Get a snapshot of the 64 bytes surrounding the fault address. */
1779 old_fs = get_fs();
Heiko Carstens7d256172012-07-27 10:31:12 +02001780 set_fs(user_mode(regs) ? USER_DS : KERNEL_DS);
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001781 for (start = 32; start && regs->psw.addr >= 34 - start; start -= 2) {
1782 addr = regs->psw.addr - 34 + start;
1783 if (__copy_from_user(code + start - 2,
1784 (char __user *) addr, 2))
1785 break;
1786 }
1787 for (end = 32; end < 64; end += 2) {
1788 addr = regs->psw.addr + end - 32;
1789 if (__copy_from_user(code + end,
1790 (char __user *) addr, 2))
1791 break;
1792 }
1793 set_fs(old_fs);
1794 /* Code snapshot useable ? */
1795 if ((regs->psw.addr & 1) || start >= end) {
1796 printk("%s Code: Bad PSW.\n", mode);
1797 return;
1798 }
1799 /* Find a starting point for the disassembly. */
1800 while (start < 32) {
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001801 for (i = 0, hops = 0; start + i < 32 && hops < 3; hops++) {
1802 if (!find_insn(code + start + i))
1803 break;
1804 i += insn_length(code[start + i]);
1805 }
1806 if (start + i == 32)
1807 /* Looks good, sequence ends at PSW. */
1808 break;
1809 start += 2;
1810 }
1811 /* Decode the instructions. */
1812 ptr = buffer;
1813 ptr += sprintf(ptr, "%s Code:", mode);
1814 hops = 0;
1815 while (start < end && hops < 8) {
Heiko Carstens2fa1d4f2011-12-27 11:27:32 +01001816 opsize = insn_length(code[start]);
1817 if (start + opsize == 32)
1818 *ptr++ = '#';
1819 else if (start == 32)
1820 *ptr++ = '>';
1821 else
1822 *ptr++ = ' ';
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001823 addr = regs->psw.addr + start - 32;
1824 ptr += sprintf(ptr, ONELONG, addr);
Martin Schwidefskybb11e3b2007-04-27 16:01:41 +02001825 if (start + opsize >= end)
1826 break;
1827 for (i = 0; i < opsize; i++)
1828 ptr += sprintf(ptr, "%02x", code[start + i]);
1829 *ptr++ = '\t';
1830 if (i < 6)
1831 *ptr++ = '\t';
1832 ptr += print_insn(ptr, code + start, addr);
1833 start += opsize;
1834 printk(buffer);
1835 ptr = buffer;
1836 ptr += sprintf(ptr, "\n ");
1837 hops++;
1838 }
1839 printk("\n");
1840}
Martin Schwidefskyc10302e2012-07-31 16:23:59 +02001841
1842void print_fn_code(unsigned char *code, unsigned long len)
1843{
1844 char buffer[64], *ptr;
1845 int opsize, i;
1846
1847 while (len) {
1848 ptr = buffer;
1849 opsize = insn_length(*code);
1850 ptr += sprintf(ptr, "%p: ", code);
1851 for (i = 0; i < opsize; i++)
1852 ptr += sprintf(ptr, "%02x", code[i]);
1853 *ptr++ = '\t';
1854 if (i < 4)
1855 *ptr++ = '\t';
1856 ptr += print_insn(ptr, code, (unsigned long) code);
1857 *ptr++ = '\n';
1858 *ptr++ = 0;
1859 printk(buffer);
1860 code += opsize;
1861 len -= opsize;
1862 }
1863}