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 {
83 0x2: This_should_be_an_illegal_instruction();
85 0x4: This_should_be_an_illegal_instruction();
90 0x02: decode OPCODE_OP_BOTTOM3 {
100 0x03: decode OPCODE_OP_BOTTOM3 {
110 0x04: decode OPCODE_OP_BOTTOM3 {
120 0x05: decode OPCODE_OP_BOTTOM3 {
130 0x06: decode OPCODE_OP_BOTTOM3 {
137 0x6: This_should_be_an_illegal_instruction();
140 0x07: decode OPCODE_OP_BOTTOM3 {
141 0x0: three_byte_opcode();
142 0x1: three_byte_opcode();
143 0x2: three_byte_opcode();
144 0x3: three_byte_opcode();
145 0x4: three_byte_opcode();
146 0x5: three_byte_opcode();
147 0x6: three_byte_opcode();
148 0x7: three_byte_opcode();
150 0x08: decode OPCODE_OP_BOTTOM3 {
158 0x7: cmovnbe_Gv_Ev();
160 0x09: decode OPCODE_OP_BOTTOM3 {
168 0x7: cmovnle_Gv_Ev();
170 0x0A: decode OPCODE_OP_BOTTOM3 {
180 0x0B: decode OPCODE_OP_BOTTOM3 {
190 0x0C: decode OPCODE_OP_BOTTOM3 {
200 0x0D: decode OPCODE_OP_BOTTOM3 {
210 0x0E: decode OPCODE_OP_BOTTOM3 {
220 0x0F: decode OPCODE_OP_BOTTOM3 {
230 0x10: decode OPCODE_OP_BOTTOM3 {
240 0x11: decode OPCODE_OP_BOTTOM3 {
250 0x12: decode OPCODE_OP_BOTTOM3 {
260 0x13: decode OPCODE_OP_BOTTOM3 {
270 0x14: decode OPCODE_OP_BOTTOM3 {
275 0x4: shld_Ev_Gv_Ib();
276 0x5: shld_Ev_Gv_rCl();
277 0x6: xbts_and_cmpxchg();
278 0x7: ibts_and_cmpxchg();
280 0x15: decode OPCODE_OP_BOTTOM3 {
285 0x4: shrd_Ev_Gv_Ib();
286 0x5: shrd_Ev_Gv_rCl();
290 0x16: decode OPCODE_OP_BOTTOM3 {
291 0x0: cmpxchg_Eb_Gb();
292 0x1: cmpxchg_Ev_Gv();
297 0x6: Inst::MOVZX_B(Gv,Eb);
298 0x7: Inst::MOVZX_W(Gv,Ew);
300 0x17: decode OPCODE_OP_BOTTOM3 {
301 0x0: jmpe_Jz(); // IA-64?
310 0x18: decode OPCODE_OP_BOTTOM3 {
320 0x19: decode OPCODE_OP_BOTTOM3 {
330 0x1A: decode OPCODE_OP_BOTTOM3 {
340 0x1B: decode OPCODE_OP_BOTTOM3 {
350 0x1C: decode OPCODE_OP_BOTTOM3 {
360 0x1D: decode OPCODE_OP_BOTTOM3 {
370 0x1E: decode OPCODE_OP_BOTTOM3 {
380 0x1F: decode OPCODE_OP_BOTTOM3 {
390 default: FailUnimpl::twoByteOps();
393 default: M5InternalError::error(
394 {{"Unexpected first opcode byte in two byte opcode!"}});