Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/asm/x86/X86Disassembler.java @ 1552:c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
Summary: Change all the Sun copyrights to Oracle copyright
Reviewed-by: ohair
author | trims |
---|---|
date | Thu, 27 May 2010 19:08:38 -0700 |
parents | a61af66fc99e |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.asm.x86; | |
26 | |
27 import sun.jvm.hotspot.asm.*; | |
28 import java.io.*; | |
29 | |
30 public class X86Disassembler extends Disassembler | |
31 implements X86Opcodes { | |
32 private int byteIndex; | |
33 protected final X86InstructionFactory factory; | |
34 | |
35 public X86Disassembler(long startPc, byte[] code, X86InstructionFactory factory) { | |
36 super(startPc, code); | |
37 this.factory = factory; | |
38 } | |
39 | |
40 public X86Disassembler(long startPc, byte[] code) { | |
41 this(startPc, code, new X86InstructionFactoryImpl()); | |
42 } | |
43 | |
44 //Please refer to IA-32 Intel Architecture Software Developer's Manual Volume 2 | |
45 //APPENDIX A - Table A-2. One-byte Opcode Map | |
46 private static final InstructionDecoder oneByteTable[] = { | |
47 /* 00 */ | |
48 new ArithmeticDecoder("addb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_ADD), | |
49 new ArithmeticDecoder("addS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_ADD), | |
50 new ArithmeticDecoder("addb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_ADD), | |
51 new ArithmeticDecoder("addS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_ADD), | |
52 new ArithmeticDecoder("addb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_ADD), | |
53 new ArithmeticDecoder("addS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_ADD), | |
54 new InstructionDecoder("pushl", ADDR_REG, ES), | |
55 new InstructionDecoder("popl", ADDR_REG, ES), | |
56 /* 08 */ | |
57 new LogicalDecoder("orb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_OR), | |
58 new LogicalDecoder("orS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_OR), | |
59 new LogicalDecoder("orb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_OR), | |
60 new LogicalDecoder("orS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_OR), | |
61 new LogicalDecoder("orb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_OR), | |
62 new LogicalDecoder("orS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_OR), | |
63 new InstructionDecoder("pushl", ADDR_REG, CS), | |
64 null, /* 0x0f extended opcode escape */ | |
65 /* 10 */ | |
66 new ArithmeticDecoder("adcb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_ADDC), | |
67 new ArithmeticDecoder("adcS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_ADDC), | |
68 new ArithmeticDecoder("adcb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_ADDC), | |
69 new ArithmeticDecoder("adcS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_ADDC), | |
70 new ArithmeticDecoder("adcb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_ADDC), | |
71 new ArithmeticDecoder("adcS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_ADDC), | |
72 new InstructionDecoder("pushl", ADDR_REG, SS), | |
73 new InstructionDecoder("popl", ADDR_REG, SS), | |
74 /* 18 */ | |
75 new ArithmeticDecoder("sbbb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_SUBC), | |
76 new ArithmeticDecoder("sbbS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_SUBC), | |
77 new ArithmeticDecoder("sbbb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_SUBC), | |
78 new ArithmeticDecoder("sbbS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_SUBC), | |
79 new ArithmeticDecoder("sbbb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_SUBC), | |
80 new ArithmeticDecoder("sbbS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_SUBC), | |
81 new InstructionDecoder("pushl", ADDR_REG, DS), | |
82 new InstructionDecoder("popl", ADDR_REG, DS), | |
83 /* 20 */ | |
84 new LogicalDecoder("andb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_AND), | |
85 new LogicalDecoder("andS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_AND), | |
86 new LogicalDecoder("andb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_AND), | |
87 new LogicalDecoder("andS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_AND), | |
88 new LogicalDecoder("andb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_AND), | |
89 new LogicalDecoder("andS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_AND), | |
90 null, /* SEG es prefix */ | |
91 new InstructionDecoder("daa"), | |
92 /* 28 */ | |
93 new ArithmeticDecoder("subb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_SUB), | |
94 new ArithmeticDecoder("subS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_SUB), | |
95 new ArithmeticDecoder("subb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_SUB), | |
96 new ArithmeticDecoder("subS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_SUB), | |
97 new ArithmeticDecoder("subb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_SUB), | |
98 new ArithmeticDecoder("subS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_SUB), | |
99 null, /* SEG CS prefix */ | |
100 new InstructionDecoder("das"), | |
101 /* 30 */ | |
102 new LogicalDecoder("xorb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_XOR), | |
103 new LogicalDecoder("xorS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_XOR), | |
104 new LogicalDecoder("xorb", ADDR_G, b_mode, ADDR_E, b_mode, RTLOP_XOR), | |
105 new LogicalDecoder("xorS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_XOR), | |
106 new LogicalDecoder("xorb", ADDR_REG, AL, ADDR_I, b_mode, RTLOP_XOR), | |
107 new LogicalDecoder("xorS", ADDR_REG, EAX, ADDR_I, v_mode, RTLOP_XOR), | |
108 null, /* SEG SS prefix */ | |
109 new InstructionDecoder("aaa"), | |
110 /* 38 */ | |
111 new InstructionDecoder("cmpb", ADDR_E, b_mode, ADDR_G, b_mode), | |
112 new InstructionDecoder("cmpS", ADDR_E, v_mode, ADDR_G, v_mode), | |
113 new InstructionDecoder("cmpb", ADDR_G, b_mode, ADDR_E, b_mode), | |
114 new InstructionDecoder("cmpS", ADDR_G, v_mode, ADDR_E, v_mode), | |
115 new InstructionDecoder("cmpb", ADDR_REG, AL, ADDR_I, b_mode), | |
116 new InstructionDecoder("cmpS", ADDR_REG, EAX, ADDR_I, v_mode), | |
117 null, /* SEG DS prefix */ | |
118 new InstructionDecoder("aas"), | |
119 /* 40 */ | |
120 new ArithmeticDecoder("incS", ADDR_REG, EAX, RTLOP_ADD), | |
121 new ArithmeticDecoder("incS", ADDR_REG, ECX, RTLOP_ADD), | |
122 new ArithmeticDecoder("incS", ADDR_REG, EDX, RTLOP_ADD), | |
123 new ArithmeticDecoder("incS", ADDR_REG, EBX, RTLOP_ADD), | |
124 new ArithmeticDecoder("incS", ADDR_REG, ESP, RTLOP_ADD), | |
125 new ArithmeticDecoder("incS", ADDR_REG, EBP, RTLOP_ADD), | |
126 new ArithmeticDecoder("incS", ADDR_REG, ESI, RTLOP_ADD), | |
127 new ArithmeticDecoder("incS", ADDR_REG, EDI, RTLOP_ADD), | |
128 /* 48 */ | |
129 new ArithmeticDecoder("decS", ADDR_REG, EAX, RTLOP_SUB), | |
130 new ArithmeticDecoder("decS", ADDR_REG, ECX, RTLOP_SUB), | |
131 new ArithmeticDecoder("decS", ADDR_REG, EDX, RTLOP_SUB), | |
132 new ArithmeticDecoder("decS", ADDR_REG, EBX, RTLOP_SUB), | |
133 new ArithmeticDecoder("decS", ADDR_REG, ESP, RTLOP_SUB), | |
134 new ArithmeticDecoder("decS", ADDR_REG, EBP, RTLOP_SUB), | |
135 new ArithmeticDecoder("decS", ADDR_REG, ESI, RTLOP_SUB), | |
136 new ArithmeticDecoder("decS", ADDR_REG, EDI, RTLOP_SUB), | |
137 /* 50 */ | |
138 new InstructionDecoder("pushS", ADDR_REG, EAX), | |
139 new InstructionDecoder("pushS", ADDR_REG, ECX), | |
140 new InstructionDecoder("pushS", ADDR_REG, EDX), | |
141 new InstructionDecoder("pushS", ADDR_REG, EBX), | |
142 new InstructionDecoder("pushS", ADDR_REG, ESP), | |
143 new InstructionDecoder("pushS", ADDR_REG, EBP), | |
144 new InstructionDecoder("pushS", ADDR_REG, ESI), | |
145 new InstructionDecoder("pushS", ADDR_REG, EDI), | |
146 /* 58 */ | |
147 new InstructionDecoder("popS", ADDR_REG, EAX), | |
148 new InstructionDecoder("popS", ADDR_REG, ECX), | |
149 new InstructionDecoder("popS", ADDR_REG, EDX), | |
150 new InstructionDecoder("popS", ADDR_REG, EBX), | |
151 new InstructionDecoder("popS", ADDR_REG, ESP), | |
152 new InstructionDecoder("popS", ADDR_REG, EBP), | |
153 new InstructionDecoder("popS", ADDR_REG, ESI), | |
154 new InstructionDecoder("popS", ADDR_REG, EDI), | |
155 /* 60 */ | |
156 new InstructionDecoder("pusha"), | |
157 new InstructionDecoder("popa"), | |
158 new InstructionDecoder("boundS", ADDR_G, v_mode, ADDR_E, v_mode), | |
159 new InstructionDecoder("arpl", ADDR_E, w_mode, ADDR_G, w_mode), | |
160 null, /* seg fs */ | |
161 null, /* seg gs */ | |
162 null, /* op size prefix */ | |
163 null, /* adr size prefix */ | |
164 /* 68 */ | |
165 new InstructionDecoder("pushS", ADDR_I, v_mode), /* 386 book wrong */ | |
166 new ArithmeticDecoder("imulS", ADDR_G, v_mode, ADDR_E, v_mode, ADDR_I, v_mode, RTLOP_SMUL), | |
167 new InstructionDecoder("pushl", ADDR_I, b_mode), /* push of byte really pushes 4 bytes */ | |
168 new ArithmeticDecoder("imulS", ADDR_G, v_mode, ADDR_E, v_mode, ADDR_I, b_mode, RTLOP_SMUL), | |
169 new InstructionDecoder("insb", ADDR_ESDI, b_mode, INDIR_REG, DX), | |
170 new InstructionDecoder("insS", ADDR_ESDI, v_mode, INDIR_REG, DX), | |
171 new InstructionDecoder("outsb", INDIR_REG, DX, ADDR_DSSI, b_mode), | |
172 new InstructionDecoder("outsS", INDIR_REG, DX, ADDR_DSSI, v_mode), | |
173 /* 70 */ | |
174 new ConditionalJmpDecoder("jo", ADDR_J, b_mode), | |
175 new ConditionalJmpDecoder("jno", ADDR_J, b_mode), | |
176 new ConditionalJmpDecoder("jb", ADDR_J, b_mode), | |
177 new ConditionalJmpDecoder("jae", ADDR_J, b_mode), | |
178 new ConditionalJmpDecoder("je", ADDR_J, b_mode), | |
179 new ConditionalJmpDecoder("jne", ADDR_J, b_mode), | |
180 new ConditionalJmpDecoder("jbe", ADDR_J, b_mode), | |
181 new ConditionalJmpDecoder("ja", ADDR_J, b_mode), | |
182 /* 78 */ | |
183 new ConditionalJmpDecoder("js", ADDR_J, b_mode), | |
184 new ConditionalJmpDecoder("jns", ADDR_J, b_mode), | |
185 new ConditionalJmpDecoder("jp", ADDR_J, b_mode), | |
186 new ConditionalJmpDecoder("jnp", ADDR_J, b_mode), | |
187 new ConditionalJmpDecoder("jl", ADDR_J, b_mode), | |
188 new ConditionalJmpDecoder("jnl", ADDR_J, b_mode), | |
189 new ConditionalJmpDecoder("jle", ADDR_J, b_mode), | |
190 new ConditionalJmpDecoder("jg", ADDR_J, b_mode), | |
191 /* 80 */ | |
192 new GRPDecoder(null, 0), | |
193 new GRPDecoder(null, 1), | |
194 null, | |
195 new GRPDecoder(null, 2), | |
196 new InstructionDecoder("testb", ADDR_E, b_mode, ADDR_G, b_mode), | |
197 new InstructionDecoder("testS", ADDR_E, v_mode, ADDR_G, v_mode), | |
198 new MoveDecoder("xchgb", ADDR_E, b_mode, ADDR_G, b_mode), | |
199 new MoveDecoder("xchgS", ADDR_E, v_mode, ADDR_G, v_mode), | |
200 /* 88 */ | |
201 new MoveDecoder("movb", ADDR_E, b_mode, ADDR_G, b_mode), | |
202 new MoveDecoder("movS", ADDR_E, v_mode, ADDR_G, v_mode), | |
203 new MoveDecoder("movb", ADDR_G, b_mode, ADDR_E, b_mode), | |
204 new MoveDecoder("movS", ADDR_G, v_mode, ADDR_E, v_mode), | |
205 new MoveDecoder("movw", ADDR_E, w_mode, ADDR_SEG, w_mode), | |
206 new InstructionDecoder("leaS", ADDR_G, v_mode, ADDR_E, 0), | |
207 new MoveDecoder("movw", ADDR_SEG, w_mode, ADDR_E, w_mode), | |
208 new InstructionDecoder("popS", ADDR_E, v_mode), | |
209 /* 90 */ | |
210 new InstructionDecoder("nop"), | |
211 new MoveDecoder("xchgS", ADDR_REG, ECX, ADDR_REG, EAX), | |
212 new MoveDecoder("xchgS", ADDR_REG, EDX, ADDR_REG, EAX), | |
213 new MoveDecoder("xchgS", ADDR_REG, EBX, ADDR_REG, EAX), | |
214 new MoveDecoder("xchgS", ADDR_REG, ESP, ADDR_REG, EAX), | |
215 new MoveDecoder("xchgS", ADDR_REG, EBP, ADDR_REG, EAX), | |
216 new MoveDecoder("xchgS", ADDR_REG, ESI, ADDR_REG, EAX), | |
217 new MoveDecoder("xchgS", ADDR_REG, EDI, ADDR_REG, EAX), | |
218 /* 98 */ | |
219 new InstructionDecoder("cwtl"), | |
220 new InstructionDecoder("cltd"), | |
221 new CallDecoder("lcall", ADDR_DIR, p_mode), | |
222 null, /* fwait */ | |
223 new InstructionDecoder("pushf"), | |
224 new InstructionDecoder("popf"), | |
225 new InstructionDecoder("sahf"), | |
226 new InstructionDecoder("lahf"), | |
227 /* a0 */ | |
228 new MoveDecoder("movb", ADDR_REG, AL, ADDR_OFF, b_mode), | |
229 new MoveDecoder("movS", ADDR_REG, EAX, ADDR_OFF, v_mode), | |
230 new MoveDecoder("movb", ADDR_OFF, b_mode, ADDR_REG, AL), | |
231 new MoveDecoder("movS", ADDR_OFF, v_mode, ADDR_REG, EAX), | |
232 new MoveDecoder("movsb", ADDR_ESDI, b_mode, ADDR_DSSI, b_mode), | |
233 new MoveDecoder("movsS", ADDR_ESDI, v_mode, ADDR_DSSI, v_mode), | |
234 new InstructionDecoder("cmpsb", ADDR_ESDI, b_mode, ADDR_DSSI, b_mode), | |
235 new InstructionDecoder("cmpsS", ADDR_ESDI, v_mode, ADDR_DSSI, v_mode), | |
236 /* a8 */ | |
237 new InstructionDecoder("testb", ADDR_REG, AL, ADDR_I, b_mode), | |
238 new InstructionDecoder("testS", ADDR_REG, EAX, ADDR_I, v_mode), | |
239 new InstructionDecoder("stosb", ADDR_ESDI, b_mode, ADDR_REG, AL), | |
240 new InstructionDecoder("stosS", ADDR_ESDI, v_mode, ADDR_REG, EAX), | |
241 new InstructionDecoder("lodsb", ADDR_REG, AL, ADDR_DSSI, b_mode), | |
242 new InstructionDecoder("lodsS", ADDR_REG, EAX, ADDR_DSSI, v_mode), | |
243 new InstructionDecoder("scasb", ADDR_REG, AL, ADDR_ESDI, b_mode), | |
244 new InstructionDecoder("scasS", ADDR_REG, EAX, ADDR_ESDI, v_mode), | |
245 /* b0 */ | |
246 new MoveDecoder("movb", ADDR_REG, AL, ADDR_I, b_mode), | |
247 new MoveDecoder("movb", ADDR_REG, CL, ADDR_I, b_mode), | |
248 new MoveDecoder("movb", ADDR_REG, DL, ADDR_I, b_mode), | |
249 new MoveDecoder("movb", ADDR_REG, BL, ADDR_I, b_mode), | |
250 new MoveDecoder("movb", ADDR_REG, AH, ADDR_I, b_mode), | |
251 new MoveDecoder("movb", ADDR_REG, CH, ADDR_I, b_mode), | |
252 new MoveDecoder("movb", ADDR_REG, DH, ADDR_I, b_mode), | |
253 new MoveDecoder("movb", ADDR_REG, BH, ADDR_I, b_mode), | |
254 /* b8 */ | |
255 new MoveDecoder("movS", ADDR_REG, EAX, ADDR_I, v_mode), | |
256 new MoveDecoder("movS", ADDR_REG, ECX, ADDR_I, v_mode), | |
257 new MoveDecoder("movS", ADDR_REG, EDX, ADDR_I, v_mode), | |
258 new MoveDecoder("movS", ADDR_REG, EBX, ADDR_I, v_mode), | |
259 new MoveDecoder("movS", ADDR_REG, ESP, ADDR_I, v_mode), | |
260 new MoveDecoder("movS", ADDR_REG, EBP, ADDR_I, v_mode), | |
261 new MoveDecoder("movS", ADDR_REG, ESI, ADDR_I, v_mode), | |
262 new MoveDecoder("movS", ADDR_REG, EDI, ADDR_I, v_mode), | |
263 /* c0 */ | |
264 new GRPDecoder(null, 3), | |
265 new GRPDecoder(null, 4), | |
266 new BranchDecoder("ret", ADDR_I, w_mode), | |
267 new BranchDecoder("ret"), | |
268 new InstructionDecoder("lesS", ADDR_G, v_mode, ADDR_E, 0), | |
269 new InstructionDecoder("ldsS", ADDR_G, v_mode, ADDR_E, 0), | |
270 new MoveDecoder("movb", ADDR_E, b_mode, ADDR_I, b_mode), | |
271 new MoveDecoder("movS", ADDR_E, v_mode, ADDR_I, v_mode), | |
272 /* c8 */ | |
273 new InstructionDecoder("enter", ADDR_I, w_mode, ADDR_I, b_mode), | |
274 new InstructionDecoder("leave"), | |
275 new InstructionDecoder("lret", ADDR_I, w_mode), | |
276 new InstructionDecoder("lret"), | |
277 new InstructionDecoder("int3"), | |
278 new InstructionDecoder("int", ADDR_I, b_mode), | |
279 new InstructionDecoder("into"), | |
280 new InstructionDecoder("iret"), | |
281 /* d0 */ | |
282 new GRPDecoder(null, 5), | |
283 new GRPDecoder(null, 6), | |
284 new GRPDecoder(null, 7), | |
285 new GRPDecoder(null, 8), | |
286 new InstructionDecoder("aam", ADDR_I, b_mode), | |
287 new InstructionDecoder("aad", ADDR_I, b_mode), | |
288 null, | |
289 new InstructionDecoder("xlat"), | |
290 /* d8 */ | |
291 new FloatDecoder(), | |
292 new FloatDecoder(), | |
293 new FloatDecoder(), | |
294 new FloatDecoder(), | |
295 new FloatDecoder(), | |
296 new FloatDecoder(), | |
297 new FloatDecoder(), | |
298 new FloatDecoder(), | |
299 /* e0 */ | |
300 new BranchDecoder("loopne", ADDR_J, b_mode), | |
301 new BranchDecoder("loope", ADDR_J, b_mode), | |
302 new BranchDecoder("loop", ADDR_J, b_mode), | |
303 new ConditionalJmpDecoder("jCcxz", ADDR_J, b_mode), | |
304 new InstructionDecoder("inb", ADDR_REG, AL, ADDR_I, b_mode), | |
305 new InstructionDecoder("inS", ADDR_REG, EAX, ADDR_I, b_mode), | |
306 new InstructionDecoder("outb", ADDR_I, b_mode, ADDR_REG, AL), | |
307 new InstructionDecoder("outS", ADDR_I, b_mode, ADDR_REG, EAX), | |
308 /* e8 */ | |
309 new CallDecoder("call", ADDR_J, v_mode), | |
310 new JmpDecoder("jmp", ADDR_J, v_mode), | |
311 new JmpDecoder("ljmp", ADDR_DIR, p_mode), | |
312 new JmpDecoder("jmp", ADDR_J, b_mode), | |
313 new InstructionDecoder("inb", ADDR_REG, AL, INDIR_REG, DX), | |
314 new InstructionDecoder("inS", ADDR_REG, EAX, INDIR_REG, DX), | |
315 new InstructionDecoder("outb", INDIR_REG, DX, ADDR_REG,AL), | |
316 new InstructionDecoder("outS", INDIR_REG, DX, ADDR_REG, EAX), | |
317 /* f0 */ | |
318 new InstructionDecoder("lock"), /* lock prefix */ | |
319 null, | |
320 new InstructionDecoder("repne"), /* repne */ | |
321 new InstructionDecoder("rep"), /* repz */ | |
322 new InstructionDecoder("hlt"), | |
323 new InstructionDecoder("cmc"), | |
324 new GRPDecoder(null, 9), | |
325 new GRPDecoder(null, 10), | |
326 /* f8 */ | |
327 new InstructionDecoder("clc"), | |
328 new InstructionDecoder("stc"), | |
329 new InstructionDecoder("cli"), | |
330 new InstructionDecoder("sti"), | |
331 new InstructionDecoder("cld"), | |
332 new InstructionDecoder("std"), | |
333 new GRPDecoder(null, 11), | |
334 new GRPDecoder(null, 12) | |
335 }; | |
336 | |
337 //APPENDIX A - Table A-3. Two-byte Opcode Map | |
338 private static final InstructionDecoder twoByteTable[] = { | |
339 /* 00 */ | |
340 new GRPDecoder(null, 13), | |
341 new GRPDecoder(null, 14), | |
342 new InstructionDecoder("larS", ADDR_G, v_mode, ADDR_E, w_mode), | |
343 new InstructionDecoder("lslS", ADDR_G, v_mode, ADDR_E, w_mode), | |
344 null, | |
345 null, | |
346 new InstructionDecoder("clts"), | |
347 null, | |
348 /* 08 */ | |
349 new InstructionDecoder("invd"), | |
350 new InstructionDecoder("wbinvd"), | |
351 null, | |
352 null, | |
353 null, | |
354 null, | |
355 null, | |
356 null, | |
357 /* 10 */ //SSE | |
358 new SSEMoveDecoder("movups", ADDR_V, ps_mode, ADDR_W, ps_mode), | |
359 new SSEMoveDecoder("movups", ADDR_W, ps_mode, ADDR_V, ps_mode), | |
360 new SSEMoveDecoder("movlps", ADDR_W, q_mode, ADDR_V, q_mode), | |
361 new SSEMoveDecoder("movlps", ADDR_V, q_mode, ADDR_W, q_mode), | |
362 new SSEInstructionDecoder("unpcklps", ADDR_V, ps_mode, ADDR_W, q_mode), | |
363 new SSEInstructionDecoder("unpckhps", ADDR_V, ps_mode, ADDR_W, q_mode), | |
364 new SSEMoveDecoder("movhps", ADDR_V, q_mode, ADDR_W, q_mode), | |
365 new SSEMoveDecoder("movhps", ADDR_W, q_mode, ADDR_V, q_mode), | |
366 /* 18 */ | |
367 new GRPDecoder(null, 21), | |
368 null, | |
369 null, | |
370 null, | |
371 null, | |
372 null, | |
373 null, | |
374 null, | |
375 /* 20 */ | |
376 /* these are all backward in appendix A of the intel book */ | |
377 new MoveDecoder("movl", ADDR_R, d_mode, ADDR_C, d_mode), | |
378 new MoveDecoder("movl", ADDR_R, d_mode, ADDR_D, d_mode), | |
379 new MoveDecoder("movl", ADDR_C, d_mode, ADDR_R, d_mode), | |
380 new MoveDecoder("movl", ADDR_D, d_mode, ADDR_R, d_mode), | |
381 new MoveDecoder("movl", ADDR_R, d_mode, ADDR_T, d_mode), | |
382 null, | |
383 new MoveDecoder("movl", ADDR_T, d_mode, ADDR_R, d_mode), | |
384 null, | |
385 /* 28 */ | |
386 new SSEMoveDecoder("movaps", ADDR_V, ps_mode, ADDR_W, ps_mode), | |
387 new SSEMoveDecoder("movaps", ADDR_W, ps_mode, ADDR_V, ps_mode), | |
388 new SSEInstructionDecoder("cvtpi2ps", ADDR_V, ps_mode, ADDR_Q, q_mode), | |
389 new SSEMoveDecoder("movntps", ADDR_W, ps_mode, ADDR_V, ps_mode), | |
390 new SSEInstructionDecoder("cvttps2pi", ADDR_Q, q_mode, ADDR_W, ps_mode), | |
391 new SSEInstructionDecoder("cvtps2pi", ADDR_Q, q_mode, ADDR_W, ps_mode), | |
392 new SSEInstructionDecoder("ucomiss", ADDR_V, ss_mode, ADDR_W, ss_mode), | |
393 new SSEInstructionDecoder("comiss", ADDR_V, ps_mode, ADDR_W, ps_mode), | |
394 /* 30 */ | |
395 new SSEInstructionDecoder("wrmsr"), | |
396 new SSEInstructionDecoder("rtdsc"), | |
397 new SSEInstructionDecoder("rdmsr"), | |
398 new SSEInstructionDecoder("rdpmc"), | |
399 new SSEInstructionDecoder("sysenter"), | |
400 new SSEInstructionDecoder("sysexit"), | |
401 null, | |
402 null, | |
403 /* 38 */ | |
404 null, | |
405 null, | |
406 null, | |
407 null, | |
408 new SSEMoveDecoder("movnti", ADDR_G, v_mode, ADDR_E, v_mode), | |
409 null, | |
410 null, | |
411 null, | |
412 /* 40 */ | |
413 new MoveDecoder("cmovo", ADDR_G, v_mode, ADDR_E, v_mode), | |
414 new MoveDecoder("cmovno", ADDR_G, v_mode, ADDR_E, v_mode), | |
415 new MoveDecoder("cmovb", ADDR_G, v_mode, ADDR_E, v_mode), | |
416 new MoveDecoder("cmovae", ADDR_G, v_mode, ADDR_E, v_mode), | |
417 new MoveDecoder("cmove", ADDR_G, v_mode, ADDR_E, v_mode), | |
418 new MoveDecoder("cmovne", ADDR_G, v_mode, ADDR_E, v_mode), | |
419 new MoveDecoder("cmovbe", ADDR_G, v_mode, ADDR_E, v_mode), | |
420 new MoveDecoder("cmova", ADDR_G, v_mode, ADDR_E, v_mode), | |
421 /* 48 */ | |
422 new MoveDecoder("cmovs", ADDR_G, v_mode, ADDR_E, v_mode), | |
423 new MoveDecoder("cmovns", ADDR_G, v_mode, ADDR_E, v_mode), | |
424 new MoveDecoder("cmovp", ADDR_G, v_mode, ADDR_E, v_mode), | |
425 new MoveDecoder("cmovnp", ADDR_G, v_mode, ADDR_E, v_mode), | |
426 new MoveDecoder("cmovl", ADDR_G, v_mode, ADDR_E, v_mode), | |
427 new MoveDecoder("cmovge", ADDR_G, v_mode, ADDR_E, v_mode), | |
428 new MoveDecoder("cmovle", ADDR_G, v_mode, ADDR_E, v_mode), | |
429 new MoveDecoder("cmovg", ADDR_G, v_mode, ADDR_E, v_mode), | |
430 /* 50 */ | |
431 new SSEMoveDecoder("movmskps", ADDR_E, d_mode, ADDR_V, ps_mode), | |
432 new SSEInstructionDecoder("sqrtps", ADDR_V, ps_mode, ADDR_W, ps_mode), | |
433 new SSEInstructionDecoder("rsqrtps", ADDR_V, ps_mode, ADDR_W, ps_mode), | |
434 new SSEInstructionDecoder("rcpps", ADDR_V, ps_mode, ADDR_W, ps_mode), | |
435 new SSELogicalDecoder("andps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_AND), | |
436 new SSELogicalDecoder("andnps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_AND), | |
437 new SSELogicalDecoder("orps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_OR), | |
438 new SSELogicalDecoder("xorps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_XOR), | |
439 /* 58 */ | |
440 new SSEArithmeticDecoder("addps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_ADD), | |
441 new SSEArithmeticDecoder("mulps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_SMUL), | |
442 new SSEInstructionDecoder("cvtps2pd", ADDR_V, pd_mode, ADDR_W, ps_mode), | |
443 new SSEInstructionDecoder("cvtdq2ps", ADDR_V, ps_mode, ADDR_W, dq_mode), | |
444 new SSEArithmeticDecoder("subps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_SUB), | |
445 new SSEInstructionDecoder("minps", ADDR_V, ps_mode, ADDR_W, ps_mode), | |
446 new SSEArithmeticDecoder("divps", ADDR_V, ps_mode, ADDR_W, ps_mode, RTLOP_SDIV), | |
447 new SSEInstructionDecoder("maxps", ADDR_V, ps_mode, ADDR_W, ps_mode), | |
448 /* 60 */ | |
449 new SSEInstructionDecoder("punpcklbw", ADDR_P, q_mode, ADDR_Q, d_mode), | |
450 new SSEInstructionDecoder("punpcklwd", ADDR_P, q_mode, ADDR_Q, d_mode), | |
451 new SSEInstructionDecoder("punpckldq", ADDR_P, q_mode, ADDR_Q, d_mode), | |
452 new SSEInstructionDecoder("packsswb", ADDR_P, q_mode, ADDR_Q, q_mode), | |
453 new SSEInstructionDecoder("pcmpgtb", ADDR_P, q_mode, ADDR_Q, q_mode), | |
454 new SSEInstructionDecoder("pcmpgtw", ADDR_P, q_mode, ADDR_Q, q_mode), | |
455 new SSEInstructionDecoder("pcmpgtd", ADDR_P, q_mode, ADDR_Q, q_mode), | |
456 new SSEInstructionDecoder("packuswb", ADDR_P, q_mode, ADDR_Q, q_mode), | |
457 /* 68 */ | |
458 new SSEInstructionDecoder("punpckhbw", ADDR_P, q_mode, ADDR_Q, d_mode), | |
459 new SSEInstructionDecoder("punpckhwd", ADDR_P, q_mode, ADDR_Q, d_mode), | |
460 new SSEInstructionDecoder("punpckhdq", ADDR_P, q_mode, ADDR_Q, d_mode), | |
461 new SSEInstructionDecoder("packssdw", ADDR_P, q_mode, ADDR_Q, d_mode), | |
462 null, | |
463 null, | |
464 new SSEMoveDecoder("movd", ADDR_P, d_mode, ADDR_E, d_mode), | |
465 new SSEMoveDecoder("movq", ADDR_P, q_mode, ADDR_E, q_mode), | |
466 /* 70 */ | |
467 new SSEInstructionDecoder("pshufw", ADDR_P, q_mode, ADDR_Q, q_mode, ADDR_I, b_mode), | |
468 new GRPDecoder(null, 17), | |
469 new GRPDecoder(null, 18), | |
470 new GRPDecoder(null, 19), | |
471 new SSEInstructionDecoder("pcmpeqb", ADDR_P, q_mode, ADDR_Q, q_mode), | |
472 new SSEInstructionDecoder("pcmpeqw", ADDR_P, q_mode, ADDR_Q, q_mode), | |
473 new SSEInstructionDecoder("pcmpeqd", ADDR_P, q_mode, ADDR_Q, q_mode), | |
474 new SSEInstructionDecoder("emms"), | |
475 /* 78 */ | |
476 null, | |
477 null, | |
478 null, | |
479 null, | |
480 null, | |
481 null, | |
482 new SSEMoveDecoder("movd", ADDR_E, d_mode, ADDR_P, d_mode), | |
483 new SSEMoveDecoder("movq", ADDR_Q, q_mode, ADDR_P, q_mode), | |
484 /* 80 */ | |
485 new ConditionalJmpDecoder("jo", ADDR_J, v_mode), | |
486 new ConditionalJmpDecoder("jno", ADDR_J, v_mode), | |
487 new ConditionalJmpDecoder("jb", ADDR_J, v_mode), | |
488 new ConditionalJmpDecoder("jae", ADDR_J, v_mode), | |
489 new ConditionalJmpDecoder("je", ADDR_J, v_mode), | |
490 new ConditionalJmpDecoder("jne", ADDR_J, v_mode), | |
491 new ConditionalJmpDecoder("jbe", ADDR_J, v_mode), | |
492 new ConditionalJmpDecoder("ja", ADDR_J, v_mode), | |
493 /* 88 */ | |
494 new ConditionalJmpDecoder("js", ADDR_J, v_mode), | |
495 new ConditionalJmpDecoder("jns", ADDR_J, v_mode), | |
496 new ConditionalJmpDecoder("jp", ADDR_J, v_mode), | |
497 new ConditionalJmpDecoder("jnp", ADDR_J, v_mode), | |
498 new ConditionalJmpDecoder("jl", ADDR_J, v_mode), | |
499 new ConditionalJmpDecoder("jge", ADDR_J, v_mode), | |
500 new ConditionalJmpDecoder("jle", ADDR_J, v_mode), | |
501 new ConditionalJmpDecoder("jg", ADDR_J, v_mode), | |
502 /* 90 */ | |
503 new InstructionDecoder("seto", ADDR_E, b_mode), | |
504 new InstructionDecoder("setno", ADDR_E, b_mode), | |
505 new InstructionDecoder("setb", ADDR_E, b_mode), | |
506 new InstructionDecoder("setae", ADDR_E, b_mode), | |
507 new InstructionDecoder("sete", ADDR_E, b_mode), | |
508 new InstructionDecoder("setne", ADDR_E, b_mode), | |
509 new InstructionDecoder("setbe", ADDR_E, b_mode), | |
510 new InstructionDecoder("seta", ADDR_E, b_mode), | |
511 /* 98 */ | |
512 new InstructionDecoder("sets", ADDR_E, b_mode), | |
513 new InstructionDecoder("setns", ADDR_E, b_mode), | |
514 new InstructionDecoder("setp", ADDR_E, b_mode), | |
515 new InstructionDecoder("setnp", ADDR_E, b_mode), | |
516 new InstructionDecoder("setl", ADDR_E, b_mode), | |
517 new InstructionDecoder("setge", ADDR_E, b_mode), | |
518 new InstructionDecoder("setle", ADDR_E, b_mode), | |
519 new InstructionDecoder("setg", ADDR_E, b_mode), | |
520 /* a0 */ | |
521 new InstructionDecoder("pushl", ADDR_REG, FS), | |
522 new InstructionDecoder("popl", ADDR_REG, FS), | |
523 null, | |
524 new InstructionDecoder("btS", ADDR_E, v_mode, ADDR_G, v_mode), | |
525 new InstructionDecoder("shldS", ADDR_E, v_mode, ADDR_G, v_mode, ADDR_I, b_mode), | |
526 new InstructionDecoder("shldS", ADDR_E, v_mode, ADDR_G, v_mode, ADDR_REG, CL), | |
527 null, | |
528 null, | |
529 /* a8 */ | |
530 new InstructionDecoder("pushl", ADDR_REG, GS), | |
531 new InstructionDecoder("popl", ADDR_REG, GS), | |
532 new SSEInstructionDecoder("rsm"), | |
533 new InstructionDecoder("btsS", ADDR_E, v_mode, ADDR_G, v_mode), | |
534 new InstructionDecoder("shrdS", ADDR_E, v_mode, ADDR_G, v_mode, ADDR_I, b_mode), | |
535 new InstructionDecoder("shrdS", ADDR_E, v_mode, ADDR_G, v_mode, ADDR_REG, CL), | |
536 new GRPDecoder(null, 20), | |
537 new ArithmeticDecoder("imulS", ADDR_G, v_mode, ADDR_E, v_mode, RTLOP_SMUL), | |
538 /* b0 */ | |
539 new InstructionDecoder("cmpxchgb", ADDR_E, b_mode, ADDR_G, b_mode), | |
540 new InstructionDecoder("cmpxchgS", ADDR_E, v_mode, ADDR_G, v_mode), | |
541 new InstructionDecoder("lssS", ADDR_G, v_mode, ADDR_M, p_mode), | |
542 new InstructionDecoder("btrS", ADDR_E, v_mode, ADDR_G, v_mode), | |
543 new InstructionDecoder("lfsS", ADDR_G, v_mode, ADDR_M, p_mode), | |
544 new InstructionDecoder("lgsS", ADDR_G, v_mode, ADDR_M, p_mode), | |
545 new MoveDecoder("movzbS", ADDR_G, v_mode, ADDR_E, b_mode), | |
546 new MoveDecoder("movzwS", ADDR_G, v_mode, ADDR_E, w_mode), | |
547 /* b8 */ | |
548 null, | |
549 null, | |
550 new GRPDecoder(null, 15), | |
551 new InstructionDecoder("btcS", ADDR_E, v_mode, ADDR_G, v_mode), | |
552 new InstructionDecoder("bsfS", ADDR_G, v_mode, ADDR_E, v_mode), | |
553 new InstructionDecoder("bsrS", ADDR_G, v_mode, ADDR_E, v_mode), | |
554 new MoveDecoder("movsbS", ADDR_G, v_mode, ADDR_E, b_mode), | |
555 new MoveDecoder("movswS", ADDR_G, v_mode, ADDR_E, w_mode), | |
556 /* c0 */ | |
557 new ArithmeticDecoder("xaddb", ADDR_E, b_mode, ADDR_G, b_mode, RTLOP_ADD), | |
558 new ArithmeticDecoder("xaddS", ADDR_E, v_mode, ADDR_G, v_mode, RTLOP_ADD), | |
559 new SSEInstructionDecoder("cmpps", ADDR_V, ps_mode, ADDR_W, ps_mode, ADDR_I, b_mode), | |
560 new SSEMoveDecoder("movnti", ADDR_E, d_mode, ADDR_G, d_mode), | |
561 new SSEInstructionDecoder("pinsrw", ADDR_P, q_mode, ADDR_E, d_mode, ADDR_I, b_mode), | |
562 new SSEInstructionDecoder("pextrw", ADDR_G, d_mode, ADDR_P, q_mode, ADDR_I, b_mode), | |
563 new SSEInstructionDecoder("shufps", ADDR_V, ps_mode, ADDR_W, ps_mode, ADDR_I, b_mode), | |
564 new GRPDecoder(null, 16), | |
565 /* c8 */ | |
566 new InstructionDecoder("bswap", ADDR_REG, EAX), | |
567 new InstructionDecoder("bswap", ADDR_REG, ECX), | |
568 new InstructionDecoder("bswap", ADDR_REG, EDX), | |
569 new InstructionDecoder("bswap", ADDR_REG, EBX), | |
570 new InstructionDecoder("bswap", ADDR_REG, ESP), | |
571 new InstructionDecoder("bswap", ADDR_REG, EBP), | |
572 new InstructionDecoder("bswap", ADDR_REG, ESI), | |
573 new InstructionDecoder("bswap", ADDR_REG, EDI), | |
574 /* d0 */ | |
575 null, | |
576 new SSEShiftDecoder("psrlw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SRL), | |
577 new SSEShiftDecoder("psrld", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SRL), | |
578 new SSEShiftDecoder("psrlq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SRL), | |
579 new SSEArithmeticDecoder("paddq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
580 new SSEArithmeticDecoder("pmullw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SMUL), | |
581 null, | |
582 new SSEMoveDecoder("pmovmskb", ADDR_G, d_mode, ADDR_P, q_mode), | |
583 /* d8 */ | |
584 new SSEArithmeticDecoder("psubusb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), | |
585 new SSEArithmeticDecoder("psubusw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), | |
586 new SSEInstructionDecoder("pminub", ADDR_P, q_mode, ADDR_Q, q_mode), | |
587 new SSELogicalDecoder("pand", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_AND), | |
588 new SSEArithmeticDecoder("paddusb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
589 new SSEArithmeticDecoder("paddusw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
590 new SSEInstructionDecoder("pmaxub", ADDR_P, q_mode, ADDR_Q, q_mode), | |
591 new SSELogicalDecoder("pandn", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_AND), | |
592 /* e0 */ | |
593 new SSEInstructionDecoder("pavgb", ADDR_P, q_mode, ADDR_Q, q_mode), | |
594 new SSEInstructionDecoder("psraw", ADDR_P, q_mode, ADDR_Q, q_mode), | |
595 new SSEInstructionDecoder("psrad", ADDR_P, q_mode, ADDR_Q, q_mode), | |
596 new SSEInstructionDecoder("pavgw", ADDR_P, q_mode, ADDR_Q, q_mode), | |
597 new SSEArithmeticDecoder("pmulhuw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_UMUL), | |
598 new SSEArithmeticDecoder("pmulhw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SMUL), | |
599 null, | |
600 new SSEMoveDecoder("movntq", ADDR_W, q_mode, ADDR_V, q_mode), | |
601 /* e8 */ | |
602 new SSEArithmeticDecoder("psubsb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), | |
603 new SSEArithmeticDecoder("psubsw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), | |
604 new SSEInstructionDecoder("pminsw", ADDR_P, q_mode, ADDR_Q, q_mode), | |
605 new SSELogicalDecoder("por", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_OR), | |
606 new SSEArithmeticDecoder("paddsb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
607 new SSEArithmeticDecoder("paddsw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
608 new SSEInstructionDecoder("pmaxsw", ADDR_P, q_mode, ADDR_Q, q_mode), | |
609 new SSELogicalDecoder("pxor", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_XOR), | |
610 /* f0 */ | |
611 null, | |
612 new SSEShiftDecoder("psllw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SLL), | |
613 new SSEShiftDecoder("pslld", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SLL), | |
614 new SSEShiftDecoder("psllq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SLL), | |
615 new SSEArithmeticDecoder("pmuludq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_UMUL), | |
616 new SSEArithmeticDecoder("pmaddwd", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
617 new SSEArithmeticDecoder("psadbw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
618 new SSEMoveDecoder("maskmoveq", ADDR_P, pi_mode, ADDR_Q, pi_mode), | |
619 /* f8 */ | |
620 new SSEArithmeticDecoder("psubb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), | |
621 new SSEArithmeticDecoder("psubw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), | |
622 new SSEArithmeticDecoder("psubd", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), | |
623 new SSEArithmeticDecoder("psubq", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_SUB), | |
624 new SSEArithmeticDecoder("paddb", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
625 new SSEArithmeticDecoder("paddw", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
626 new SSEArithmeticDecoder("paddd", ADDR_P, q_mode, ADDR_Q, q_mode, RTLOP_ADD), | |
627 null | |
628 }; | |
629 | |
630 private static final InstructionDecoder twoBytePrefixF2Table[] = { | |
631 /* 00 */ | |
632 null, | |
633 null, | |
634 null, | |
635 null, | |
636 null, | |
637 null, | |
638 null, | |
639 null, | |
640 /* 08 */ | |
641 null, | |
642 null, | |
643 null, | |
644 null, | |
645 null, | |
646 null, | |
647 null, | |
648 null, | |
649 /* 10 */ | |
650 new SSEMoveDecoder("movsd", ADDR_V, sd_mode, ADDR_W, sd_mode), | |
651 new SSEMoveDecoder("movsd", ADDR_V, sd_mode, ADDR_W, sd_mode), | |
652 null, | |
653 null, | |
654 null, | |
655 null, | |
656 null, | |
657 null, | |
658 /* 18 */ | |
659 null, | |
660 null, | |
661 null, | |
662 null, | |
663 null, | |
664 null, | |
665 null, | |
666 null, | |
667 /* 20 */ | |
668 null, | |
669 null, | |
670 null, | |
671 null, | |
672 null, | |
673 null, | |
674 null, | |
675 null, | |
676 /* 28 */ | |
677 null, | |
678 null, | |
679 new SSEInstructionDecoder("cvtsi2sd", ADDR_V, sd_mode, ADDR_E, d_mode), | |
680 null, | |
681 new SSEInstructionDecoder("cvttsd2si", ADDR_G, d_mode, ADDR_W, sd_mode), | |
682 new SSEInstructionDecoder("cvtsd2si", ADDR_G, d_mode, ADDR_W, sd_mode), | |
683 null, | |
684 null, | |
685 /* 30 */ | |
686 null, | |
687 null, | |
688 null, | |
689 null, | |
690 null, | |
691 null, | |
692 null, | |
693 null, | |
694 /* 38 */ | |
695 null, | |
696 null, | |
697 null, | |
698 null, | |
699 null, | |
700 null, | |
701 null, | |
702 null, | |
703 /* 40 */ | |
704 null, | |
705 null, | |
706 null, | |
707 null, | |
708 null, | |
709 null, | |
710 null, | |
711 null, | |
712 /* 48 */ | |
713 null, | |
714 null, | |
715 null, | |
716 null, | |
717 null, | |
718 null, | |
719 null, | |
720 null, | |
721 /* 50 */ | |
722 null, | |
723 new SSEInstructionDecoder("sqrtsd", ADDR_V, sd_mode, ADDR_W, sd_mode), | |
724 null, | |
725 null, | |
726 null, | |
727 null, | |
728 null, | |
729 null, | |
730 /* 58 */ | |
731 new SSEArithmeticDecoder("addsd", ADDR_V, sd_mode, ADDR_W, sd_mode, RTLOP_ADD), | |
732 new SSEArithmeticDecoder("mulsd", ADDR_V, sd_mode, ADDR_W, sd_mode, RTLOP_SMUL), | |
733 new SSEInstructionDecoder("cvtsd2ss", ADDR_V, sd_mode, ADDR_W, sd_mode), | |
734 null, | |
735 new SSEArithmeticDecoder("subsd", ADDR_V, sd_mode, ADDR_W, sd_mode, RTLOP_SUB), | |
736 new SSEInstructionDecoder("minsd", ADDR_V, sd_mode, ADDR_W, sd_mode), | |
737 new SSEArithmeticDecoder("divsd", ADDR_V, sd_mode, ADDR_W, sd_mode, RTLOP_SDIV), | |
738 new SSEInstructionDecoder("maxsd", ADDR_V, sd_mode, ADDR_W, sd_mode), | |
739 /* 60 */ | |
740 null, | |
741 null, | |
742 null, | |
743 null, | |
744 null, | |
745 null, | |
746 null, | |
747 null, | |
748 /* 68 */ | |
749 null, | |
750 null, | |
751 null, | |
752 null, | |
753 null, | |
754 null, | |
755 null, | |
756 null, | |
757 /* 70 */ | |
758 new SSEInstructionDecoder("pshuflw", ADDR_V, dq_mode, ADDR_W, dq_mode, ADDR_I, b_mode), | |
759 null, | |
760 null, | |
761 null, | |
762 null, | |
763 null, | |
764 null, | |
765 null, | |
766 /* 78 */ | |
767 null, | |
768 null, | |
769 null, | |
770 null, | |
771 null, | |
772 null, | |
773 null, | |
774 null, | |
775 /* 80 */ | |
776 null, | |
777 null, | |
778 null, | |
779 null, | |
780 null, | |
781 null, | |
782 null, | |
783 null, | |
784 /* 88 */ | |
785 null, | |
786 null, | |
787 null, | |
788 null, | |
789 null, | |
790 null, | |
791 null, | |
792 null, | |
793 /* 90 */ | |
794 null, | |
795 null, | |
796 null, | |
797 null, | |
798 null, | |
799 null, | |
800 null, | |
801 null, | |
802 /* 98 */ | |
803 null, | |
804 null, | |
805 null, | |
806 null, | |
807 null, | |
808 null, | |
809 null, | |
810 null, | |
811 /* a0 */ | |
812 null, | |
813 null, | |
814 null, | |
815 null, | |
816 null, | |
817 null, | |
818 null, | |
819 null, | |
820 /* a8 */ | |
821 null, | |
822 null, | |
823 null, | |
824 null, | |
825 null, | |
826 null, | |
827 null, | |
828 null, | |
829 /* b0 */ | |
830 null, | |
831 null, | |
832 null, | |
833 null, | |
834 null, | |
835 null, | |
836 null, | |
837 null, | |
838 /* b8 */ | |
839 null, | |
840 null, | |
841 null, | |
842 null, | |
843 null, | |
844 null, | |
845 null, | |
846 null, | |
847 /* c0 */ | |
848 null, | |
849 null, | |
850 new SSEInstructionDecoder("cmpsd", ADDR_V, sd_mode, ADDR_W, sd_mode, ADDR_I, b_mode), | |
851 null, | |
852 null, | |
853 null, | |
854 null, | |
855 null, | |
856 /* c8 */ | |
857 null, | |
858 null, | |
859 null, | |
860 null, | |
861 null, | |
862 null, | |
863 null, | |
864 null, | |
865 /* d0 */ | |
866 null, | |
867 null, | |
868 null, | |
869 null, | |
870 null, | |
871 null, | |
872 new SSEMoveDecoder("movdq2q", ADDR_P, q_mode, ADDR_W, q_mode), | |
873 null, | |
874 /* d8 */ | |
875 null, | |
876 null, | |
877 null, | |
878 null, | |
879 null, | |
880 null, | |
881 null, | |
882 null, | |
883 /* e0 */ | |
884 null, | |
885 null, | |
886 null, | |
887 null, | |
888 null, | |
889 null, | |
890 new SSEInstructionDecoder("cvtpd2dq", ADDR_V, dq_mode, ADDR_W, pd_mode), | |
891 null, | |
892 /* e8 */ | |
893 null, | |
894 null, | |
895 null, | |
896 null, | |
897 null, | |
898 null, | |
899 null, | |
900 null, | |
901 /* f0 */ | |
902 null, | |
903 null, | |
904 null, | |
905 null, | |
906 null, | |
907 null, | |
908 null, | |
909 null, | |
910 /* f8 */ | |
911 null, | |
912 null, | |
913 null, | |
914 null, | |
915 null, | |
916 null, | |
917 null, | |
918 null | |
919 }; | |
920 | |
921 private static final InstructionDecoder twoBytePrefixF3Table[] = { | |
922 /* 00 */ | |
923 null, | |
924 null, | |
925 null, | |
926 null, | |
927 null, | |
928 null, | |
929 null, | |
930 null, | |
931 /* 08 */ | |
932 null, | |
933 null, | |
934 null, | |
935 null, | |
936 null, | |
937 null, | |
938 null, | |
939 null, | |
940 /* 10 */ | |
941 new SSEMoveDecoder("movss", ADDR_V, ss_mode, ADDR_W, ss_mode), | |
942 new SSEMoveDecoder("movss", ADDR_W, ss_mode, ADDR_V, ss_mode), | |
943 null, | |
944 null, | |
945 null, | |
946 null, | |
947 null, | |
948 null, | |
949 /* 18 */ | |
950 null, | |
951 null, | |
952 null, | |
953 null, | |
954 null, | |
955 null, | |
956 null, | |
957 null, | |
958 /* 20 */ | |
959 null, | |
960 null, | |
961 null, | |
962 null, | |
963 null, | |
964 null, | |
965 null, | |
966 null, | |
967 /* 28 */ | |
968 null, | |
969 null, | |
970 new SSEInstructionDecoder("cvtsi2ss", ADDR_V, ss_mode, ADDR_E, d_mode), | |
971 null, | |
972 new SSEInstructionDecoder("cvttss2si", ADDR_G, d_mode, ADDR_W, ss_mode), | |
973 new SSEInstructionDecoder("cvtss2si", ADDR_G, d_mode, ADDR_W, ss_mode), | |
974 null, | |
975 null, | |
976 /* 30 */ | |
977 null, | |
978 null, | |
979 null, | |
980 null, | |
981 null, | |
982 null, | |
983 null, | |
984 null, | |
985 /* 38 */ | |
986 null, | |
987 null, | |
988 null, | |
989 null, | |
990 null, | |
991 null, | |
992 null, | |
993 null, | |
994 /* 40 */ | |
995 null, | |
996 null, | |
997 null, | |
998 null, | |
999 null, | |
1000 null, | |
1001 null, | |
1002 null, | |
1003 /* 48 */ | |
1004 null, | |
1005 null, | |
1006 null, | |
1007 null, | |
1008 null, | |
1009 null, | |
1010 null, | |
1011 null, | |
1012 /* 50 */ | |
1013 null, | |
1014 new SSEInstructionDecoder("sqrtss", ADDR_V, ss_mode, ADDR_W, ss_mode), | |
1015 new SSEInstructionDecoder("rsqrtss", ADDR_V, ss_mode, ADDR_W, ss_mode), | |
1016 new SSEInstructionDecoder("rcpss", ADDR_V, ss_mode, ADDR_W, ss_mode), | |
1017 null, | |
1018 null, | |
1019 null, | |
1020 null, | |
1021 /* 58 */ | |
1022 new SSEArithmeticDecoder("addss", ADDR_V, ss_mode, ADDR_W, ss_mode, RTLOP_ADD), | |
1023 new SSEArithmeticDecoder("mulss", ADDR_V, ss_mode, ADDR_W, ss_mode, RTLOP_SMUL), | |
1024 new SSEInstructionDecoder("cvtss2sd", ADDR_V, ss_mode, ADDR_W, ss_mode), | |
1025 new SSEInstructionDecoder("cvttps2dq", ADDR_V, dq_mode, ADDR_W, ps_mode), | |
1026 new SSEArithmeticDecoder("subss", ADDR_V, ss_mode, ADDR_W, ss_mode, RTLOP_SUB), | |
1027 new SSEInstructionDecoder("minss", ADDR_V, ss_mode, ADDR_W, ss_mode), | |
1028 new SSEArithmeticDecoder("divss", ADDR_V, ss_mode, ADDR_W, ss_mode, RTLOP_SDIV), | |
1029 new SSEInstructionDecoder("maxss", ADDR_V, ss_mode, ADDR_W, ss_mode), | |
1030 /* 60 */ | |
1031 null, | |
1032 null, | |
1033 null, | |
1034 null, | |
1035 null, | |
1036 null, | |
1037 null, | |
1038 null, | |
1039 /* 68 */ | |
1040 null, | |
1041 null, | |
1042 null, | |
1043 null, | |
1044 null, | |
1045 null, | |
1046 null, | |
1047 new SSEMoveDecoder("movdqu", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1048 /* 70 */ | |
1049 new SSEInstructionDecoder("pshufhw", ADDR_V, dq_mode, ADDR_W, dq_mode, ADDR_I, b_mode), | |
1050 null, | |
1051 null, | |
1052 null, | |
1053 null, | |
1054 null, | |
1055 null, | |
1056 null, | |
1057 /* 78 */ | |
1058 null, | |
1059 null, | |
1060 null, | |
1061 null, | |
1062 null, | |
1063 null, | |
1064 new SSEMoveDecoder("movq", ADDR_V, q_mode, ADDR_W, q_mode), | |
1065 new SSEMoveDecoder("movdqu", ADDR_W, dq_mode, ADDR_V, dq_mode), | |
1066 /* 80 */ | |
1067 null, | |
1068 null, | |
1069 null, | |
1070 null, | |
1071 null, | |
1072 null, | |
1073 null, | |
1074 null, | |
1075 /* 88 */ | |
1076 null, | |
1077 null, | |
1078 null, | |
1079 null, | |
1080 null, | |
1081 null, | |
1082 null, | |
1083 null, | |
1084 /* 90 */ | |
1085 null, | |
1086 null, | |
1087 null, | |
1088 null, | |
1089 null, | |
1090 null, | |
1091 null, | |
1092 null, | |
1093 /* 98 */ | |
1094 null, | |
1095 null, | |
1096 null, | |
1097 null, | |
1098 null, | |
1099 null, | |
1100 null, | |
1101 null, | |
1102 /* a0 */ | |
1103 null, | |
1104 null, | |
1105 null, | |
1106 null, | |
1107 null, | |
1108 null, | |
1109 null, | |
1110 null, | |
1111 /* a8 */ | |
1112 null, | |
1113 null, | |
1114 null, | |
1115 null, | |
1116 null, | |
1117 null, | |
1118 null, | |
1119 null, | |
1120 /* b0 */ | |
1121 null, | |
1122 null, | |
1123 null, | |
1124 null, | |
1125 null, | |
1126 null, | |
1127 null, | |
1128 null, | |
1129 /* b8 */ | |
1130 null, | |
1131 null, | |
1132 null, | |
1133 null, | |
1134 null, | |
1135 null, | |
1136 null, | |
1137 null, | |
1138 /* c0 */ | |
1139 null, | |
1140 null, | |
1141 new SSEInstructionDecoder("cmpss", ADDR_V, ss_mode, ADDR_W, ss_mode, ADDR_I, b_mode), | |
1142 null, | |
1143 null, | |
1144 null, | |
1145 null, | |
1146 null, | |
1147 /* c8 */ | |
1148 null, | |
1149 null, | |
1150 null, | |
1151 null, | |
1152 null, | |
1153 null, | |
1154 null, | |
1155 null, | |
1156 /* d0 */ | |
1157 null, | |
1158 null, | |
1159 null, | |
1160 null, | |
1161 null, | |
1162 null, | |
1163 new SSEMoveDecoder("movq2dq", ADDR_V, dq_mode, ADDR_Q, q_mode), | |
1164 null, | |
1165 /* d8 */ | |
1166 null, | |
1167 null, | |
1168 null, | |
1169 null, | |
1170 null, | |
1171 null, | |
1172 null, | |
1173 null, | |
1174 /* e0 */ | |
1175 null, | |
1176 null, | |
1177 null, | |
1178 null, | |
1179 null, | |
1180 null, | |
1181 new SSEInstructionDecoder("cvtdq2pd", ADDR_V, pd_mode, ADDR_W, dq_mode), | |
1182 null, | |
1183 /* e8 */ | |
1184 null, | |
1185 null, | |
1186 null, | |
1187 null, | |
1188 null, | |
1189 null, | |
1190 null, | |
1191 null, | |
1192 /* f0 */ | |
1193 null, | |
1194 null, | |
1195 null, | |
1196 null, | |
1197 null, | |
1198 null, | |
1199 null, | |
1200 null, | |
1201 /* f8 */ | |
1202 null, | |
1203 null, | |
1204 null, | |
1205 null, | |
1206 null, | |
1207 null, | |
1208 null, | |
1209 null | |
1210 }; | |
1211 | |
1212 private static final InstructionDecoder twoBytePrefix66Table[] = { | |
1213 /* 00 */ | |
1214 null, | |
1215 null, | |
1216 null, | |
1217 null, | |
1218 null, | |
1219 null, | |
1220 null, | |
1221 null, | |
1222 /* 08 */ | |
1223 null, | |
1224 null, | |
1225 null, | |
1226 null, | |
1227 null, | |
1228 null, | |
1229 null, | |
1230 null, | |
1231 /* 10 */ | |
1232 new SSEMoveDecoder("movupd", ADDR_V, pd_mode, ADDR_W, pd_mode), | |
1233 new SSEMoveDecoder("movupd", ADDR_W, pd_mode, ADDR_V, pd_mode), | |
1234 new SSEMoveDecoder("movlpd", ADDR_V, q_mode, ADDR_W, s_mode), | |
1235 new SSEMoveDecoder("movlpd", ADDR_V, q_mode, ADDR_W, q_mode), | |
1236 new SSEInstructionDecoder("unpcklpd", ADDR_V, pd_mode, ADDR_W, q_mode), | |
1237 new SSEInstructionDecoder("unpckhpd", ADDR_V, pd_mode, ADDR_W, q_mode), | |
1238 new SSEMoveDecoder("movhpd", ADDR_V, q_mode, ADDR_W, q_mode), | |
1239 new SSEMoveDecoder("movhpd", ADDR_W, q_mode, ADDR_V, q_mode), | |
1240 /* 18 */ | |
1241 null, | |
1242 null, | |
1243 null, | |
1244 null, | |
1245 null, | |
1246 null, | |
1247 null, | |
1248 null, | |
1249 /* 20 */ | |
1250 null, | |
1251 null, | |
1252 null, | |
1253 null, | |
1254 null, | |
1255 null, | |
1256 null, | |
1257 null, | |
1258 /* 28 */ | |
1259 new SSEMoveDecoder("movapd", ADDR_V, pd_mode, ADDR_W, pd_mode), | |
1260 new SSEMoveDecoder("movapd", ADDR_W, pd_mode, ADDR_V, pd_mode), | |
1261 new SSEInstructionDecoder("cvtpi2pd", ADDR_V, pd_mode, ADDR_Q, dq_mode), | |
1262 new SSEMoveDecoder("movntpd", ADDR_W, pd_mode, ADDR_V, pd_mode), | |
1263 new SSEInstructionDecoder("cvttpd2pi", ADDR_Q, dq_mode, ADDR_W, pd_mode), | |
1264 new SSEInstructionDecoder("cvtpd2pi", ADDR_Q, dq_mode, ADDR_W, pd_mode), | |
1265 new SSEInstructionDecoder("ucomisd", ADDR_V, sd_mode, ADDR_W, sd_mode), | |
1266 new SSEInstructionDecoder("comisd", ADDR_V, sd_mode, ADDR_W, sd_mode), | |
1267 /* 30 */ | |
1268 null, | |
1269 null, | |
1270 null, | |
1271 null, | |
1272 null, | |
1273 null, | |
1274 null, | |
1275 null, | |
1276 /* 38 */ | |
1277 null, | |
1278 null, | |
1279 null, | |
1280 null, | |
1281 null, | |
1282 null, | |
1283 null, | |
1284 null, | |
1285 /* 40 */ | |
1286 null, | |
1287 null, | |
1288 null, | |
1289 null, | |
1290 null, | |
1291 null, | |
1292 null, | |
1293 null, | |
1294 /* 48 */ | |
1295 null, | |
1296 null, | |
1297 null, | |
1298 null, | |
1299 null, | |
1300 null, | |
1301 null, | |
1302 null, | |
1303 /* 50 */ | |
1304 new SSEMoveDecoder("movmskpd", ADDR_E, d_mode, ADDR_V, pd_mode), | |
1305 new SSEInstructionDecoder("sqrtpd", ADDR_V, pd_mode, ADDR_W, pd_mode), | |
1306 null, | |
1307 null, | |
1308 new SSELogicalDecoder("andpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_AND), | |
1309 new SSELogicalDecoder("andnpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_AND), | |
1310 new SSELogicalDecoder("orpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_OR), | |
1311 new SSELogicalDecoder("xorpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_XOR), | |
1312 /* 58 */ | |
1313 new SSEArithmeticDecoder("addpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_ADD), | |
1314 new SSEArithmeticDecoder("mulpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_SMUL), | |
1315 new SSEInstructionDecoder("cvtpd2ps", ADDR_V, ps_mode, ADDR_W, pd_mode), | |
1316 new SSEInstructionDecoder("cvtps2dq", ADDR_V, dq_mode, ADDR_W, ps_mode), | |
1317 new SSEArithmeticDecoder("subpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_SUB), | |
1318 new SSEInstructionDecoder("minpd", ADDR_V, pd_mode, ADDR_W, pd_mode), | |
1319 new SSEArithmeticDecoder("divpd", ADDR_V, pd_mode, ADDR_W, pd_mode, RTLOP_SDIV), | |
1320 new SSEInstructionDecoder("maxpd", ADDR_V, pd_mode, ADDR_W, pd_mode), | |
1321 /* 60 */ | |
1322 new SSEInstructionDecoder("punpcklbw", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1323 new SSEInstructionDecoder("punpcklwd", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1324 new SSEInstructionDecoder("punpckldq", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1325 new SSEInstructionDecoder("packsswb", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1326 new SSEInstructionDecoder("pcmpgtb", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1327 new SSEInstructionDecoder("pcmpgtw", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1328 new SSEInstructionDecoder("pcmpgtd", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1329 new SSEInstructionDecoder("packuswb", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1330 /* 68 */ | |
1331 new SSEInstructionDecoder("punpckhbw", ADDR_P, dq_mode, ADDR_Q, dq_mode), | |
1332 new SSEInstructionDecoder("punpckhwd", ADDR_P, dq_mode, ADDR_Q, dq_mode), | |
1333 new SSEInstructionDecoder("punpckhdq", ADDR_P, dq_mode, ADDR_Q, dq_mode), | |
1334 new SSEInstructionDecoder("packssdw", ADDR_P, dq_mode, ADDR_Q, dq_mode), | |
1335 new SSEInstructionDecoder("punpcklqdq", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1336 new SSEInstructionDecoder("punpckhqdq", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1337 new SSEMoveDecoder("movd", ADDR_V, dq_mode, ADDR_E, d_mode), | |
1338 new SSEMoveDecoder("movdqa", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1339 /* 70 */ | |
1340 new SSEInstructionDecoder("pshufd", ADDR_V, dq_mode, ADDR_W, dq_mode, ADDR_I, b_mode), | |
1341 new GRPDecoder(null, 22), | |
1342 new GRPDecoder(null, 23), | |
1343 new GRPDecoder(null, 24), | |
1344 new SSEInstructionDecoder("pcmpeqb", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1345 new SSEInstructionDecoder("pcmpeqw", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1346 new SSEInstructionDecoder("pcmpeqd", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1347 null, | |
1348 /* 78 */ | |
1349 null, | |
1350 null, | |
1351 null, | |
1352 null, | |
1353 null, | |
1354 null, | |
1355 new SSEMoveDecoder("movd", ADDR_E, d_mode, ADDR_V, dq_mode), | |
1356 new SSEMoveDecoder("movdqa", ADDR_W, dq_mode, ADDR_V, dq_mode), | |
1357 /* 80 */ | |
1358 null, | |
1359 null, | |
1360 null, | |
1361 null, | |
1362 null, | |
1363 null, | |
1364 null, | |
1365 null, | |
1366 /* 88 */ | |
1367 null, | |
1368 null, | |
1369 null, | |
1370 null, | |
1371 null, | |
1372 null, | |
1373 null, | |
1374 null, | |
1375 /* 90 */ | |
1376 null, | |
1377 null, | |
1378 null, | |
1379 null, | |
1380 null, | |
1381 null, | |
1382 null, | |
1383 null, | |
1384 /* 98 */ | |
1385 null, | |
1386 null, | |
1387 null, | |
1388 null, | |
1389 null, | |
1390 null, | |
1391 null, | |
1392 null, | |
1393 /* a0 */ | |
1394 null, | |
1395 null, | |
1396 null, | |
1397 null, | |
1398 null, | |
1399 null, | |
1400 null, | |
1401 null, | |
1402 /* a8 */ | |
1403 null, | |
1404 null, | |
1405 null, | |
1406 null, | |
1407 null, | |
1408 null, | |
1409 null, | |
1410 null, | |
1411 /* b0 */ | |
1412 null, | |
1413 null, | |
1414 null, | |
1415 null, | |
1416 null, | |
1417 null, | |
1418 null, | |
1419 null, | |
1420 /* b8 */ | |
1421 null, | |
1422 null, | |
1423 null, | |
1424 null, | |
1425 null, | |
1426 null, | |
1427 null, | |
1428 null, | |
1429 /* c0 */ | |
1430 null, | |
1431 null, | |
1432 new SSEInstructionDecoder("cmppd", ADDR_V, pd_mode, ADDR_W, pd_mode, ADDR_I, b_mode), | |
1433 null, | |
1434 new SSEInstructionDecoder("pinsrw", ADDR_V, dq_mode, ADDR_E, d_mode, ADDR_I, b_mode), | |
1435 new SSEInstructionDecoder("pextrw", ADDR_G, d_mode, ADDR_V, dq_mode, ADDR_I, b_mode), | |
1436 new SSEInstructionDecoder("shufpd", ADDR_V, pd_mode, ADDR_W, pd_mode, ADDR_I, b_mode), | |
1437 null, | |
1438 /* c8 */ | |
1439 null, | |
1440 null, | |
1441 null, | |
1442 null, | |
1443 null, | |
1444 null, | |
1445 null, | |
1446 null, | |
1447 /* d0 */ | |
1448 null, | |
1449 new SSEShiftDecoder("psrlw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SRL), | |
1450 new SSEShiftDecoder("psrld", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SRL), | |
1451 new SSEShiftDecoder("psrlq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SRL), | |
1452 new SSEArithmeticDecoder("paddq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1453 new SSEArithmeticDecoder("pmullw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SMUL), | |
1454 new SSEMoveDecoder("movq", ADDR_W, q_mode, ADDR_V, q_mode), | |
1455 new SSEMoveDecoder("pmovmskb", ADDR_G, d_mode, ADDR_V, dq_mode), | |
1456 /* d8 */ | |
1457 new SSEArithmeticDecoder("psubusb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), | |
1458 new SSEArithmeticDecoder("psubusw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), | |
1459 new SSEInstructionDecoder("pminub", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1460 new SSELogicalDecoder("pand", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_AND), | |
1461 new SSEArithmeticDecoder("paddusb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1462 new SSEArithmeticDecoder("paddusw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1463 new SSEInstructionDecoder("pmaxub", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1464 new SSELogicalDecoder("pandn", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_AND), | |
1465 /* e0 */ | |
1466 new SSEInstructionDecoder("pavgb", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1467 new SSEInstructionDecoder("psraw", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1468 new SSEInstructionDecoder("psrad", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1469 new SSEInstructionDecoder("pavgw", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1470 new SSEArithmeticDecoder("pmulhuw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_UMUL), | |
1471 new SSEArithmeticDecoder("pmulhw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SMUL), | |
1472 new SSEInstructionDecoder("cvttpd2dq", ADDR_V, dq_mode, ADDR_W, pd_mode), | |
1473 new SSEMoveDecoder("movntdq", ADDR_W, dq_mode, ADDR_V, dq_mode), | |
1474 /* e8 */ | |
1475 new SSEArithmeticDecoder("psubusb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), | |
1476 new SSEArithmeticDecoder("psubusw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), | |
1477 new SSEInstructionDecoder("pminsw", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1478 new SSELogicalDecoder("por", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_OR), | |
1479 new SSEArithmeticDecoder("paddsb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1480 new SSEArithmeticDecoder("paddsw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1481 new SSEInstructionDecoder("pmaxsw", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1482 new SSELogicalDecoder("pxor", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_XOR), | |
1483 /* f0 */ | |
1484 null, | |
1485 new SSEShiftDecoder("psllw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SLL), | |
1486 new SSEShiftDecoder("pslld", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SLL), | |
1487 new SSEShiftDecoder("psllq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SLL), | |
1488 new SSEArithmeticDecoder("pmuludq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_UMUL), | |
1489 new SSEArithmeticDecoder("pmaddwd", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1490 new SSEArithmeticDecoder("psadbw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1491 new SSEMoveDecoder("maskmovdqu", ADDR_V, dq_mode, ADDR_W, dq_mode), | |
1492 /* f8 */ | |
1493 new SSEArithmeticDecoder("psubb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), | |
1494 new SSEArithmeticDecoder("psubw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), | |
1495 new SSEArithmeticDecoder("psubd", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), | |
1496 new SSEArithmeticDecoder("psubq", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_SUB), | |
1497 new SSEArithmeticDecoder("paddb", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1498 new SSEArithmeticDecoder("paddw", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1499 new SSEArithmeticDecoder("paddd", ADDR_V, dq_mode, ADDR_W, dq_mode, RTLOP_ADD), | |
1500 null | |
1501 }; | |
1502 | |
1503 public void decode(InstructionVisitor visitor) { | |
1504 int enter_instruction = 0; | |
1505 Instruction instr = null; | |
1506 visitor.prologue(); | |
1507 InstructionDecoder instrDecoder = null; | |
1508 try { | |
1509 byteIndex = 0; | |
1510 int len = 0; | |
1511 int instrStartIndex = 0; | |
1512 | |
1513 while(len < code.length) { | |
1514 int prefixes = 0; | |
1515 instrStartIndex = byteIndex; | |
1516 | |
1517 //check if there is any prefix | |
1518 prefixes = getPrefixes(); | |
1519 int segmentOverride = 1; //get segment override prefix | |
1520 | |
1521 if (code[byteIndex] == 0xc8) | |
1522 enter_instruction = 1; | |
1523 else | |
1524 enter_instruction = 0; | |
1525 | |
1526 //Read opcode | |
1527 int opcode = InstructionDecoder.readByte(code, byteIndex); | |
1528 byteIndex++; | |
1529 | |
1530 if (opcode == 0x0f) { | |
1531 opcode = InstructionDecoder.readByte(code, byteIndex); | |
1532 byteIndex++; | |
1533 | |
1534 //SSE: SSE instructions have reserved use of 0xF2, 0xF3, 0x66 prefixes | |
1535 if ((prefixes & PREFIX_REPNZ) != 0) { | |
1536 instrDecoder = twoBytePrefixF2Table[opcode]; | |
1537 } else if ((prefixes & PREFIX_REPZ) != 0) { | |
1538 instrDecoder = twoBytePrefixF3Table[opcode]; | |
1539 } else if ((prefixes & PREFIX_DATA) != 0) { | |
1540 instrDecoder = twoBytePrefix66Table[opcode]; | |
1541 } else { | |
1542 instrDecoder = twoByteTable[opcode]; | |
1543 } | |
1544 | |
1545 } else { | |
1546 instrDecoder = oneByteTable[opcode]; | |
1547 } | |
1548 if (instrDecoder != null) { | |
1549 instr = instrDecoder.decode(code, byteIndex, instrStartIndex, segmentOverride, prefixes, factory); | |
1550 visitor.visit(startPc + len, instr); | |
1551 len = instrDecoder.getCurrentIndex(); | |
1552 } | |
1553 else { | |
1554 len += 1; | |
1555 } | |
1556 byteIndex = len; | |
1557 } | |
1558 } catch (Exception exp) { | |
1559 visitor.epilogue(); | |
1560 } | |
1561 } | |
1562 | |
1563 private int getPrefixes() { | |
1564 int prefixByte = 0; | |
1565 int prefixes = 0; | |
1566 boolean isPrefix = true; | |
1567 while (isPrefix) { | |
1568 prefixByte = InstructionDecoder.readByte(code, byteIndex); | |
1569 | |
1570 switch (prefixByte) { | |
1571 case 0xf3: | |
1572 prefixes |= PREFIX_REPZ; | |
1573 break; | |
1574 case 0xf2: | |
1575 prefixes |= PREFIX_REPNZ; | |
1576 break; | |
1577 case 0xf0: | |
1578 prefixes |= PREFIX_LOCK; | |
1579 break; | |
1580 case 0x2e: | |
1581 prefixes |= PREFIX_CS; | |
1582 break; | |
1583 case 0x36: | |
1584 prefixes |= PREFIX_SS; | |
1585 break; | |
1586 case 0x3e: | |
1587 prefixes |= PREFIX_DS; | |
1588 break; | |
1589 case 0x26: | |
1590 prefixes |= PREFIX_ES; | |
1591 break; | |
1592 case 0x64: | |
1593 prefixes |= PREFIX_FS; | |
1594 break; | |
1595 case 0x65: | |
1596 prefixes |= PREFIX_GS; | |
1597 break; | |
1598 case 0x66: | |
1599 prefixes |= PREFIX_DATA; | |
1600 break; | |
1601 case 0x67: | |
1602 prefixes |= PREFIX_ADR; | |
1603 break; | |
1604 case 0x9b: | |
1605 prefixes |= PREFIX_FWAIT; | |
1606 break; | |
1607 default: | |
1608 isPrefix = false; | |
1609 break; | |
1610 } | |
1611 if(isPrefix) | |
1612 byteIndex++; | |
1613 } | |
1614 return prefixes; | |
1615 } | |
1616 | |
1617 } |