1 // Copyright (c) 2007 The Hewlett-Packard Development Company
2 // All rights reserved.
4 // Redistribution and use of this software in source and binary forms,
5 // with or without modification, are permitted provided that the
6 // following conditions are met:
8 // The software must be used only for Non-Commercial Use which means any
9 // use which is NOT directed to receiving any direct monetary
10 // compensation for, or commercial advantage from such use. Illustrative
11 // examples of non-commercial use are academic research, personal study,
12 // teaching, education and corporate research & development.
13 // Illustrative examples of commercial use are distributing products for
14 // commercial advantage and providing services using the software for
15 // commercial advantage.
17 // If you wish to use this software or functionality therein that may be
18 // covered by patents for commercial use, please contact:
19 // Director of Intellectual Property Licensing
20 // Office of Strategy and Technology
21 // Hewlett-Packard Company
22 // 1501 Page Mill Road
23 // Palo Alto, California 94304
25 // Redistributions of source code must retain the above copyright notice,
26 // this list of conditions and the following disclaimer. Redistributions
27 // in binary form must reproduce the above copyright notice, this list of
28 // conditions and the following disclaimer in the documentation and/or
29 // other materials provided with the distribution. Neither the name of
30 // the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
31 // contributors may be used to endorse or promote products derived from
32 // this software without specific prior written permission. No right of
33 // sublicense is granted herewith. Derivatives of the software and
34 // output created using the software may be prepared, but only for
35 // Non-Commercial Uses. Derivatives of the software may be shared with
36 // others provided: (i) the others agree to abide by the list of
37 // conditions herein which includes the Non-Commercial Use restrictions;
38 // and (ii) such Derivatives of the software include the above copyright
39 // notice to acknowledge the contribution from this software where
40 // applicable, this list of conditions and the disclaimer below.
42 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 // Authors: Gabe Black
56 ////////////////////////////////////////////////////////////////////
58 // Decode the two byte opcodes
60 0x2: decode OPCODE_PREFIXA {
61 0x0F: decode OPCODE_OP_TOP5 {
63 0x00: decode OPCODE_OP_BOTTOM3 {
68 //sandpile.org doesn't seem to know what this is... ?
69 0x04: loadall_or_reset_or_hang();
73 0x05: SyscallInst::syscall('xc->syscall(rax)');
76 //sandpile.org says (AMD) after sysret, so I might want to check
77 //if that means amd64 or AMD machines
78 0x07: loadall_or_sysret();
80 0x01: decode OPCODE_OP_BOTTOM3 {
90 0x02: decode LEGACY_DECODEVAL {
92 0x0: decode OPCODE_OP_BOTTOM3 {
103 0x4: decode OPCODE_OP_BOTTOM3 {
113 // operand size (0x66)
114 0x1: decode OPCODE_OP_BOTTOM3 {
125 0x8: decode OPCODE_OP_BOTTOM3 {
135 default: Inst::UD2();
137 0x03: decode OPCODE_OP_BOTTOM3 {
147 0x04: decode OPCODE_OP_BOTTOM3 {
157 0x05: decode OPCODE_OP_BOTTOM3 {
167 0x06: decode OPCODE_OP_BOTTOM3 {
177 0x07: decode OPCODE_OP_BOTTOM3 {
178 0x0: three_byte_opcode();
179 0x1: three_byte_opcode();
180 0x2: three_byte_opcode();
181 0x3: three_byte_opcode();
182 0x4: three_byte_opcode();
183 0x5: three_byte_opcode();
184 0x6: three_byte_opcode();
185 0x7: three_byte_opcode();
188 0x08: decode OPCODE_OP_BOTTOM3 {
198 0x09: decode OPCODE_OP_BOTTOM3 {
209 0x0A: decode OPCODE_OP_BOTTOM3 {
219 0x0B: decode OPCODE_OP_BOTTOM3 {
229 0x0C: decode OPCODE_OP_BOTTOM3 {
239 0x0D: decode OPCODE_OP_BOTTOM3 {
249 0x0E: decode OPCODE_OP_BOTTOM3 {
259 0x0F: decode OPCODE_OP_BOTTOM3 {
270 0x10: decode OPCODE_OP_BOTTOM3 {
280 0x11: decode OPCODE_OP_BOTTOM3 {
290 0x12: decode OPCODE_OP_BOTTOM3 {
300 0x13: decode OPCODE_OP_BOTTOM3 {
311 0x14: decode OPCODE_OP_BOTTOM3 {
316 0x4: shld_Ev_Gv_Ib();
317 0x5: shld_Ev_Gv_rCl();
318 0x6: xbts_and_cmpxchg();
319 0x7: ibts_and_cmpxchg();
321 0x15: decode OPCODE_OP_BOTTOM3 {
326 0x4: shrd_Ev_Gv_Ib();
327 0x5: shrd_Ev_Gv_rCl();
329 0x7: Inst::IMUL(Gv,Ev);
331 0x16: decode OPCODE_OP_BOTTOM3 {
332 0x0: cmpxchg_Eb_Gb();
333 0x1: cmpxchg_Ev_Gv();
338 //The size of the second operand in these instructions should
339 //really be "b" or "w", but it's set to v in order to have a
340 //consistent register size. This shouldn't affect behavior.
341 0x6: Inst::MOVZX_B(Gv,Ev);
342 0x7: Inst::MOVZX_W(Gv,Ev);
344 0x17: decode OPCODE_OP_BOTTOM3 {
345 0x0: jmpe_Jz(); // IA-64?
351 //The size of the second operand in these instructions should
352 //really be "b" or "w", but it's set to v in order to have a
353 //consistent register size. This shouldn't affect behavior.
354 0x6: Inst::MOVSX_B(Gv,Ev);
355 0x7: Inst::MOVSX_W(Gv,Ev);
357 0x18: decode OPCODE_OP_BOTTOM3 {
368 0x1A: decode OPCODE_OP_BOTTOM3 {
378 0x1B: decode OPCODE_OP_BOTTOM3 {
388 0x1C: decode OPCODE_OP_BOTTOM3 {
398 0x1D: decode OPCODE_OP_BOTTOM3 {
408 0x1E: decode OPCODE_OP_BOTTOM3 {
418 0x1F: decode OPCODE_OP_BOTTOM3 {
428 default: FailUnimpl::twoByteOps();
431 default: M5InternalError::error(
432 {{"Unexpected first opcode byte in two byte opcode!"}});