one_byte_opcodes.isa revision 5294:7222bdaed33b
15703SN/A// Copyright (c) 2007 The Hewlett-Packard Development Company 25703SN/A// All rights reserved. 311103Snilay@cs.wisc.edu// 411103Snilay@cs.wisc.edu// Redistribution and use of this software in source and binary forms, 511103Snilay@cs.wisc.edu// with or without modification, are permitted provided that the 65703SN/A// following conditions are met: 711103Snilay@cs.wisc.edu// 811103Snilay@cs.wisc.edu// The software must be used only for Non-Commercial Use which means any 911103Snilay@cs.wisc.edu// use which is NOT directed to receiving any direct monetary 1011103Snilay@cs.wisc.edu// compensation for, or commercial advantage from such use. Illustrative 1111103Snilay@cs.wisc.edu// examples of non-commercial use are academic research, personal study, 1211103Snilay@cs.wisc.edu// teaching, education and corporate research & development. 1311103Snilay@cs.wisc.edu// Illustrative examples of commercial use are distributing products for 1410036SAli.Saidi@ARM.com// commercial advantage and providing services using the software for 1510036SAli.Saidi@ARM.com// commercial advantage. 1611103Snilay@cs.wisc.edu// 1711103Snilay@cs.wisc.edu// If you wish to use this software or functionality therein that may be 1811103Snilay@cs.wisc.edu// covered by patents for commercial use, please contact: 1911103Snilay@cs.wisc.edu// Director of Intellectual Property Licensing 2010576Sandreas.hansson@arm.com// Office of Strategy and Technology 2111103Snilay@cs.wisc.edu// Hewlett-Packard Company 2211103Snilay@cs.wisc.edu// 1501 Page Mill Road 2311103Snilay@cs.wisc.edu// Palo Alto, California 94304 2411103Snilay@cs.wisc.edu// 2511103Snilay@cs.wisc.edu// Redistributions of source code must retain the above copyright notice, 2611103Snilay@cs.wisc.edu// this list of conditions and the following disclaimer. Redistributions 2711103Snilay@cs.wisc.edu// in binary form must reproduce the above copyright notice, this list of 2811103Snilay@cs.wisc.edu// conditions and the following disclaimer in the documentation and/or 2911103Snilay@cs.wisc.edu// other materials provided with the distribution. Neither the name of 3011103Snilay@cs.wisc.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 3110576Sandreas.hansson@arm.com// contributors may be used to endorse or promote products derived from 3211103Snilay@cs.wisc.edu// this software without specific prior written permission. No right of 3311103Snilay@cs.wisc.edu// sublicense is granted herewith. Derivatives of the software and 3411103Snilay@cs.wisc.edu// output created using the software may be prepared, but only for 3511103Snilay@cs.wisc.edu// Non-Commercial Uses. Derivatives of the software may be shared with 3611103Snilay@cs.wisc.edu// others provided: (i) the others agree to abide by the list of 3711103Snilay@cs.wisc.edu// conditions herein which includes the Non-Commercial Use restrictions; 3811103Snilay@cs.wisc.edu// and (ii) such Derivatives of the software include the above copyright 3910892Sandreas.hansson@arm.com// notice to acknowledge the contribution from this software where 4011103Snilay@cs.wisc.edu// applicable, this list of conditions and the disclaimer below. 4111103Snilay@cs.wisc.edu// 4211103Snilay@cs.wisc.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 4311103Snilay@cs.wisc.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 4411103Snilay@cs.wisc.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 4511103Snilay@cs.wisc.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 4611103Snilay@cs.wisc.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 4711103Snilay@cs.wisc.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 4811103Snilay@cs.wisc.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 4911103Snilay@cs.wisc.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 5011103Snilay@cs.wisc.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 5110892Sandreas.hansson@arm.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 5211103Snilay@cs.wisc.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5311103Snilay@cs.wisc.edu// 5411103Snilay@cs.wisc.edu// Authors: Gabe Black 5511103Snilay@cs.wisc.edu 5611103Snilay@cs.wisc.edu//////////////////////////////////////////////////////////////////// 5711103Snilay@cs.wisc.edu// 5811103Snilay@cs.wisc.edu// Decode the one byte opcodes 5911103Snilay@cs.wisc.edu// 6011103Snilay@cs.wisc.edu 6111103Snilay@cs.wisc.edu0x1: decode OPCODE_OP_TOP5 { 6211103Snilay@cs.wisc.edu format Inst { 6310892Sandreas.hansson@arm.com 0x00: decode OPCODE_OP_BOTTOM3 { 6411103Snilay@cs.wisc.edu 0x6: decode MODE_SUBMODE { 6511103Snilay@cs.wisc.edu 0x0: UD2(); 6611103Snilay@cs.wisc.edu default: WarnUnimpl::push_ES(); 6711103Snilay@cs.wisc.edu } 6811103Snilay@cs.wisc.edu 0x7: decode MODE_SUBMODE { 6911103Snilay@cs.wisc.edu 0x0: UD2(); 7011103Snilay@cs.wisc.edu default: WarnUnimpl::pop_ES(); 7111103Snilay@cs.wisc.edu } 7211103Snilay@cs.wisc.edu default: MultiInst::ADD(OPCODE_OP_BOTTOM3, 7311103Snilay@cs.wisc.edu [Eb,Gb], [Ev,Gv], 7411103Snilay@cs.wisc.edu [Gb,Eb], [Gv,Ev], 7511103Snilay@cs.wisc.edu [rAb,Ib], [rAv,Iz]); 7611103Snilay@cs.wisc.edu } 7711103Snilay@cs.wisc.edu 0x01: decode OPCODE_OP_BOTTOM3 { 7811103Snilay@cs.wisc.edu 0x6: decode MODE_SUBMODE { 7911103Snilay@cs.wisc.edu 0x0: UD2(); 8011103Snilay@cs.wisc.edu default: WarnUnimpl::push_CS(); 8111103Snilay@cs.wisc.edu } 8211103Snilay@cs.wisc.edu //Any time this is seen, it should generate a two byte opcode 8311103Snilay@cs.wisc.edu 0x7: M5InternalError::error( 8411103Snilay@cs.wisc.edu {{"Saw a one byte opcode whose value was 0x0F!"}}); 8511103Snilay@cs.wisc.edu default: MultiInst::OR(OPCODE_OP_BOTTOM3, 8611103Snilay@cs.wisc.edu [Eb,Gb], [Ev,Gv], 8711103Snilay@cs.wisc.edu [Gb,Eb], [Gv,Ev], 8811103Snilay@cs.wisc.edu [rAb,Ib], [rAv,Iz]); 8911103Snilay@cs.wisc.edu } 9011103Snilay@cs.wisc.edu 0x02: decode OPCODE_OP_BOTTOM3 { 9111103Snilay@cs.wisc.edu 0x6: decode MODE_SUBMODE { 9211103Snilay@cs.wisc.edu 0x0: UD2(); 9311103Snilay@cs.wisc.edu default: WarnUnimpl::push_SS(); 9411103Snilay@cs.wisc.edu } 9511103Snilay@cs.wisc.edu 0x7: decode MODE_SUBMODE { 9611103Snilay@cs.wisc.edu 0x0: UD2(); 979978Sandreas.hansson@arm.com default: WarnUnimpl::pop_SS(); 9811103Snilay@cs.wisc.edu } 9911103Snilay@cs.wisc.edu default: MultiInst::ADC(OPCODE_OP_BOTTOM3, 1009978Sandreas.hansson@arm.com [Eb,Gb], [Ev,Gv], 1019978Sandreas.hansson@arm.com [Gb,Eb], [Gv,Ev], 1029978Sandreas.hansson@arm.com [rAb,Ib], [rAv,Iz]); 1039978Sandreas.hansson@arm.com } 1049978Sandreas.hansson@arm.com 0x03: decode OPCODE_OP_BOTTOM3 { 1059978Sandreas.hansson@arm.com 0x6: decode MODE_SUBMODE { 10611103Snilay@cs.wisc.edu 0x0: UD2(); 1079978Sandreas.hansson@arm.com default: WarnUnimpl::push_DS(); 1089978Sandreas.hansson@arm.com } 1099978Sandreas.hansson@arm.com 0x7: decode MODE_SUBMODE { 1109978Sandreas.hansson@arm.com 0x0: UD2(); 1119978Sandreas.hansson@arm.com default: WarnUnimpl::pop_DS(); 1129978Sandreas.hansson@arm.com } 11311103Snilay@cs.wisc.edu default: MultiInst::SBB(OPCODE_OP_BOTTOM3, 11411103Snilay@cs.wisc.edu [Eb,Gb], [Ev,Gv], 11511103Snilay@cs.wisc.edu [Gb,Eb], [Gv,Ev], 11611103Snilay@cs.wisc.edu [rAb,Ib], [rAv,Iz]); 11711103Snilay@cs.wisc.edu } 11811103Snilay@cs.wisc.edu 0x04: decode OPCODE_OP_BOTTOM3 { 11911103Snilay@cs.wisc.edu 0x6: M5InternalError::error( 12011103Snilay@cs.wisc.edu {{"Tried to execute the ES segment override prefix!"}}); 12110352Sandreas.hansson@arm.com 0x7: decode MODE_SUBMODE { 12210352Sandreas.hansson@arm.com 0x0: UD2(); 12310352Sandreas.hansson@arm.com default: WarnUnimpl::daa(); 12410352Sandreas.hansson@arm.com } 12510352Sandreas.hansson@arm.com default: MultiInst::AND(OPCODE_OP_BOTTOM3, 12610352Sandreas.hansson@arm.com [Eb,Gb], [Ev,Gv], 12710352Sandreas.hansson@arm.com [Gb,Eb], [Gv,Ev], 12810352Sandreas.hansson@arm.com [rAb,Ib], [rAv,Iz]); 12910352Sandreas.hansson@arm.com } 13010352Sandreas.hansson@arm.com 0x05: decode OPCODE_OP_BOTTOM3 { 13110352Sandreas.hansson@arm.com 0x6: M5InternalError::error( 13210352Sandreas.hansson@arm.com {{"Tried to execute the CS segment override prefix!"}}); 13310352Sandreas.hansson@arm.com 0x7: decode MODE_SUBMODE { 13410352Sandreas.hansson@arm.com 0x0: UD2(); 13510352Sandreas.hansson@arm.com default: WarnUnimpl::das(); 13610242Ssteve.reinhardt@amd.com } 13710148Sandreas.hansson@arm.com default: MultiInst::SUB(OPCODE_OP_BOTTOM3, 1389312Sandreas.hansson@arm.com [Eb,Gb], [Ev,Gv], 1399312Sandreas.hansson@arm.com [Gb,Eb], [Gv,Ev], 1409312Sandreas.hansson@arm.com [rAb,Ib], [rAv,Iz]); 1419312Sandreas.hansson@arm.com } 1429312Sandreas.hansson@arm.com 0x06: decode OPCODE_OP_BOTTOM3 { 1439312Sandreas.hansson@arm.com 0x6: M5InternalError::error( 1449312Sandreas.hansson@arm.com {{"Tried to execute the SS segment override prefix!"}}); 1459312Sandreas.hansson@arm.com 0x7: decode MODE_SUBMODE { 14610148Sandreas.hansson@arm.com 0x0: UD2(); 14710148Sandreas.hansson@arm.com default: WarnUnimpl::aaa(); 14810148Sandreas.hansson@arm.com } 14910148Sandreas.hansson@arm.com default: MultiInst::XOR(OPCODE_OP_BOTTOM3, 15010148Sandreas.hansson@arm.com [Eb,Gb], [Ev,Gv], 15110148Sandreas.hansson@arm.com [Gb,Eb], [Gv,Ev], 15210148Sandreas.hansson@arm.com [rAb,Ib], [rAv,Iz]); 15310148Sandreas.hansson@arm.com } 15410148Sandreas.hansson@arm.com 0x07: decode OPCODE_OP_BOTTOM3 { 15510148Sandreas.hansson@arm.com 0x6: M5InternalError::error( 15610148Sandreas.hansson@arm.com {{"Tried to execute the DS segment override prefix!"}}); 15710148Sandreas.hansson@arm.com 0x7: decode MODE_SUBMODE { 15810148Sandreas.hansson@arm.com 0x0: UD2(); 15910148Sandreas.hansson@arm.com default: WarnUnimpl::aas(); 16010148Sandreas.hansson@arm.com } 16111103Snilay@cs.wisc.edu default: MultiInst::CMP(OPCODE_OP_BOTTOM3, 16211103Snilay@cs.wisc.edu [Eb,Gb], [Ev,Gv], 16311103Snilay@cs.wisc.edu [Gb,Eb], [Gv,Ev], 16411103Snilay@cs.wisc.edu [rAb,Ib], [rAv,Iz]); 16511103Snilay@cs.wisc.edu } 16611103Snilay@cs.wisc.edu 0x08: decode MODE_SUBMODE { 16711103Snilay@cs.wisc.edu 0x0: M5InternalError::error ( 16811103Snilay@cs.wisc.edu {{"Tried to execute an REX prefix!"}}); 16911103Snilay@cs.wisc.edu default: INC(Bv); 17011103Snilay@cs.wisc.edu } 17111103Snilay@cs.wisc.edu 0x09: decode MODE_SUBMODE { 17211103Snilay@cs.wisc.edu 0x0: M5InternalError::error ( 17311103Snilay@cs.wisc.edu {{"Tried to execute an REX prefix!"}}); 17411103Snilay@cs.wisc.edu default: DEC(Bv); 17511103Snilay@cs.wisc.edu } 17611103Snilay@cs.wisc.edu 0x0A: PUSH(Bv); 17711103Snilay@cs.wisc.edu 0x0B: POP(Bv); 17811103Snilay@cs.wisc.edu 0x0C: decode OPCODE_OP_BOTTOM3 { 17911103Snilay@cs.wisc.edu 0x0: decode MODE_SUBMODE { 18011103Snilay@cs.wisc.edu 0x0: UD2(); 18111103Snilay@cs.wisc.edu default: PUSHA(); 18211103Snilay@cs.wisc.edu } 18311103Snilay@cs.wisc.edu 0x1: decode MODE_SUBMODE { 18411103Snilay@cs.wisc.edu 0x0: UD2(); 18511103Snilay@cs.wisc.edu default: POPA(); 18611103Snilay@cs.wisc.edu } 18711103Snilay@cs.wisc.edu 0x2: decode MODE_SUBMODE { 18811103Snilay@cs.wisc.edu 0x0: UD2(); 18911103Snilay@cs.wisc.edu default: BOUND(Gv,Mv); 19011103Snilay@cs.wisc.edu } 19111103Snilay@cs.wisc.edu 0x3: decode MODE_SUBMODE { 19211103Snilay@cs.wisc.edu //The second operand should really be of size "d", but it's 19311103Snilay@cs.wisc.edu //set to "v" in order to have a consistent register size. 19411103Snilay@cs.wisc.edu //This shouldn't affect behavior. 19511103Snilay@cs.wisc.edu 0x0: MOVSXD(Gv,Ev); 19611103Snilay@cs.wisc.edu default: WarnUnimpl::arpl_Ew_Gw(); 19711103Snilay@cs.wisc.edu } 19811103Snilay@cs.wisc.edu 0x4: M5InternalError::error( 19911103Snilay@cs.wisc.edu {{"Tried to execute the FS segment override prefix!"}}); 20011103Snilay@cs.wisc.edu 0x5: M5InternalError::error( 20111103Snilay@cs.wisc.edu {{"Tried to execute the GS segment override prefix!"}}); 20211103Snilay@cs.wisc.edu 0x6: M5InternalError::error( 20311103Snilay@cs.wisc.edu {{"Tried to execute the operand size override prefix!"}}); 20411103Snilay@cs.wisc.edu 0x7: M5InternalError::error( 20511103Snilay@cs.wisc.edu {{"Tried to execute the DS address size override prefix!"}}); 20611103Snilay@cs.wisc.edu } 20711103Snilay@cs.wisc.edu 0x0D: decode OPCODE_OP_BOTTOM3 { 20811103Snilay@cs.wisc.edu 0x0: PUSH(Iz); 20911103Snilay@cs.wisc.edu 0x1: IMUL(Gv,Ev,Iz); 21011103Snilay@cs.wisc.edu 0x2: PUSH(Ib); 21111103Snilay@cs.wisc.edu 0x3: IMUL(Gv,Ev,Ib); 21211103Snilay@cs.wisc.edu 0x4: StringInst::INS(Yb,rD); 21311103Snilay@cs.wisc.edu 0x5: StringInst::INS(Yz,rD); 21411103Snilay@cs.wisc.edu 0x6: StringInst::OUTS(rD,Xb); 21511103Snilay@cs.wisc.edu 0x7: StringInst::OUTS(rD,Xz); 21611103Snilay@cs.wisc.edu } 21711103Snilay@cs.wisc.edu 0x0E: decode OPCODE_OP_BOTTOM3 { 21811103Snilay@cs.wisc.edu 0x0: JO(Jb); 21911103Snilay@cs.wisc.edu 0x1: JNO(Jb); 22011103Snilay@cs.wisc.edu 0x2: JB(Jb); 22111103Snilay@cs.wisc.edu 0x3: JNB(Jb); 22211103Snilay@cs.wisc.edu 0x4: JZ(Jb); 22311103Snilay@cs.wisc.edu 0x5: JNZ(Jb); 22411103Snilay@cs.wisc.edu 0x6: JBE(Jb); 22511103Snilay@cs.wisc.edu 0x7: JNBE(Jb); 22611103Snilay@cs.wisc.edu } 22711103Snilay@cs.wisc.edu 0x0F: decode OPCODE_OP_BOTTOM3 { 22810726Sandreas.hansson@arm.com 0x0: JS(Jb); 22910352Sandreas.hansson@arm.com 0x1: JNS(Jb); 23010352Sandreas.hansson@arm.com 0x2: JP(Jb); 23111103Snilay@cs.wisc.edu 0x3: JNP(Jb); 23211103Snilay@cs.wisc.edu 0x4: JL(Jb); 23311103Snilay@cs.wisc.edu 0x5: JNL(Jb); 23411103Snilay@cs.wisc.edu 0x6: JLE(Jb); 23511103Snilay@cs.wisc.edu 0x7: JNLE(Jb); 23611103Snilay@cs.wisc.edu } 23711103Snilay@cs.wisc.edu 0x10: decode OPCODE_OP_BOTTOM3 { 23811103Snilay@cs.wisc.edu //0x0: group1_Eb_Ib(); 23911103Snilay@cs.wisc.edu 0x0: decode MODRM_REG { 24011103Snilay@cs.wisc.edu 0x0: ADD(Eb,Ib); 24111103Snilay@cs.wisc.edu 0x1: OR(Eb,Ib); 24211103Snilay@cs.wisc.edu 0x2: ADC(Eb,Ib); 24311103Snilay@cs.wisc.edu 0x3: SBB(Eb,Ib); 24411103Snilay@cs.wisc.edu 0x4: AND(Eb,Ib); 24511103Snilay@cs.wisc.edu 0x5: SUB(Eb,Ib); 24611103Snilay@cs.wisc.edu 0x6: XOR(Eb,Ib); 24711103Snilay@cs.wisc.edu 0x7: CMP(Eb,Ib); 24811103Snilay@cs.wisc.edu } 24911103Snilay@cs.wisc.edu //0x1: group1_Ev_Iz(); 25011103Snilay@cs.wisc.edu 0x1: decode MODRM_REG { 25111103Snilay@cs.wisc.edu 0x0: ADD(Ev,Iz); 25211103Snilay@cs.wisc.edu 0x1: OR(Ev,Iz); 25311103Snilay@cs.wisc.edu 0x2: ADC(Ev,Iz); 25411103Snilay@cs.wisc.edu 0x3: SBB(Ev,Iz); 25511103Snilay@cs.wisc.edu 0x4: AND(Ev,Iz); 25611103Snilay@cs.wisc.edu 0x5: SUB(Ev,Iz); 25711103Snilay@cs.wisc.edu 0x6: XOR(Ev,Iz); 25811103Snilay@cs.wisc.edu 0x7: CMP(Ev,Iz); 25911103Snilay@cs.wisc.edu } 26011103Snilay@cs.wisc.edu 0x2: decode MODE_SUBMODE { 26111103Snilay@cs.wisc.edu 0x0: UD2(); 26211103Snilay@cs.wisc.edu //default: group1_Eb_Ib(); 26311103Snilay@cs.wisc.edu default: decode MODRM_REG { 26411103Snilay@cs.wisc.edu 0x0: ADD(Eb,Ib); 26511103Snilay@cs.wisc.edu 0x1: OR(Eb,Ib); 2669978Sandreas.hansson@arm.com 0x2: ADC(Eb,Ib); 26711103Snilay@cs.wisc.edu 0x3: SBB(Eb,Ib); 26811103Snilay@cs.wisc.edu 0x4: AND(Eb,Ib); 26911103Snilay@cs.wisc.edu 0x5: SUB(Eb,Ib); 27011103Snilay@cs.wisc.edu 0x6: XOR(Eb,Ib); 27111103Snilay@cs.wisc.edu 0x7: CMP(Eb,Ib); 2729978Sandreas.hansson@arm.com } 27310892Sandreas.hansson@arm.com } 27410352Sandreas.hansson@arm.com //0x3: group1_Ev_Ib(); 27510892Sandreas.hansson@arm.com 0x3: decode MODRM_REG { 27611103Snilay@cs.wisc.edu 0x0: ADD(Ev,Ib); 27711103Snilay@cs.wisc.edu 0x1: OR(Ev,Ib); 27811103Snilay@cs.wisc.edu 0x2: ADC(Ev,Ib); 27911103Snilay@cs.wisc.edu 0x3: SBB(Ev,Ib); 28011103Snilay@cs.wisc.edu 0x4: AND(Ev,Ib); 28111103Snilay@cs.wisc.edu 0x5: SUB(Ev,Ib); 28211103Snilay@cs.wisc.edu 0x6: XOR(Ev,Ib); 28311103Snilay@cs.wisc.edu 0x7: CMP(Ev,Ib); 28411103Snilay@cs.wisc.edu } 28511103Snilay@cs.wisc.edu 0x4: TEST(Eb,Gb); 28611103Snilay@cs.wisc.edu 0x5: TEST(Ev,Gv); 28711103Snilay@cs.wisc.edu 0x6: XCHG(Eb,Gb); 28811103Snilay@cs.wisc.edu 0x7: XCHG(Ev,Gv); 28911103Snilay@cs.wisc.edu } 29011103Snilay@cs.wisc.edu 0x11: decode OPCODE_OP_BOTTOM3 { 29111103Snilay@cs.wisc.edu 0x0: MOV(Eb,Gb); 29211103Snilay@cs.wisc.edu 0x1: MOV(Ev,Gv); 29311103Snilay@cs.wisc.edu 0x2: MOV(Gb,Eb); 29411103Snilay@cs.wisc.edu 0x3: MOV(Gv,Ev); 29510628Sandreas.hansson@arm.com 0x4: decode MODRM_REG { 29611103Snilay@cs.wisc.edu 0x0, 0x1, 0x2, 29710628Sandreas.hansson@arm.com 0x3, 0x4, 0x5: MOV(Ev,Sv); 29811103Snilay@cs.wisc.edu } 29911103Snilay@cs.wisc.edu 0x5: LEA(Gv,M); 30011103Snilay@cs.wisc.edu 0x6: decode MODE_SUBMODE { 30111103Snilay@cs.wisc.edu 0x3, 0x4: MOV_REAL(Sv,Ev); 30211103Snilay@cs.wisc.edu default: decode MODRM_REG { 30311103Snilay@cs.wisc.edu 0x1: UD2(); // Moving to the CS selector is illegal. 30411103Snilay@cs.wisc.edu 0x2: MOVSS(Sv,Ev); 30511103Snilay@cs.wisc.edu 0x0, 0x3, 30611103Snilay@cs.wisc.edu 0x4, 0x5: MOV(Sv,Ev); 30711103Snilay@cs.wisc.edu default: UD2(); 30811103Snilay@cs.wisc.edu } 30910628Sandreas.hansson@arm.com } 31011103Snilay@cs.wisc.edu //0x7: group10_Ev(); 31110628Sandreas.hansson@arm.com 0x7: decode MODRM_REG { 31211103Snilay@cs.wisc.edu 0x0: POP(Ev); 31311103Snilay@cs.wisc.edu default: UD2(); 31411103Snilay@cs.wisc.edu } 31511103Snilay@cs.wisc.edu } 31611103Snilay@cs.wisc.edu 0x12: decode OPCODE_OP_BOTTOM3 { 3179481Snilay@cs.wisc.edu 0x0: NOP(); //XXX repe makes this a "pause" 31811103Snilay@cs.wisc.edu default: XCHG(Bv,rAv); 31911103Snilay@cs.wisc.edu } 32011103Snilay@cs.wisc.edu 0x13: decode OPCODE_OP_BOTTOM3 { 32110576Sandreas.hansson@arm.com 0x0: CDQE(rAv); 3228464SN/A 0x1: CQO(rAv,rDv); 3238464SN/A 0x2: decode MODE_SUBMODE { 3248464SN/A 0x0: UD2(); 3258464SN/A default: WarnUnimpl::call_far_Ap(); 32611103Snilay@cs.wisc.edu } 32711103Snilay@cs.wisc.edu 0x3: WarnUnimpl::fwait(); //aka wait 32810892Sandreas.hansson@arm.com 0x4: PUSHF(); 32911103Snilay@cs.wisc.edu 0x5: POPF(); 33011103Snilay@cs.wisc.edu //The 64 bit versions of both of these should be illegal only 33111103Snilay@cs.wisc.edu //if CPUID says it isn't supported. For now, we'll just assume 33211103Snilay@cs.wisc.edu //that it's supported. 33311103Snilay@cs.wisc.edu 0x6: decode MODE_SUBMODE { 33411103Snilay@cs.wisc.edu 0x0: SAHF_64(); 33511103Snilay@cs.wisc.edu default: SAHF(); 33611103Snilay@cs.wisc.edu } 33711103Snilay@cs.wisc.edu 0x7: decode MODE_SUBMODE { 33811103Snilay@cs.wisc.edu 0x0: LAHF_64(); 33911103Snilay@cs.wisc.edu default: LAHF(); 34011103Snilay@cs.wisc.edu } 34111103Snilay@cs.wisc.edu } 3428464SN/A 0x14: decode OPCODE_OP_BOTTOM3 { 3438464SN/A 0x0: MOV(rAb, Ob); 3448464SN/A 0x1: MOV(rAv, Ov); 3458464SN/A 0x2: MOV(Ob, rAb); 3468464SN/A 0x3: MOV(Ov, rAv); 3478464SN/A 0x4: StringInst::MOVS(Yb,Xb); 3488464SN/A 0x5: StringInst::MOVS(Yv,Xv); 3498464SN/A 0x6: StringTestInst::CMPS(Yb,Xb); 3508464SN/A 0x7: StringTestInst::CMPS(Yv,Xv); 3518464SN/A } 3528464SN/A 0x15: decode OPCODE_OP_BOTTOM3 { 3538464SN/A 0x0: TEST(rAb,Ib); 35411103Snilay@cs.wisc.edu 0x1: TEST(rAv,Iz); 3558464SN/A 0x2: StringInst::STOS(Yb); 3568464SN/A 0x3: StringInst::STOS(Yv); 35711103Snilay@cs.wisc.edu 0x4: StringInst::LODS(Xb); 35811103Snilay@cs.wisc.edu 0x5: StringInst::LODS(Xv); 35911103Snilay@cs.wisc.edu 0x6: StringTestInst::SCAS(Yb); 36011103Snilay@cs.wisc.edu 0x7: StringTestInst::SCAS(Yv); 36111103Snilay@cs.wisc.edu } 36211103Snilay@cs.wisc.edu 0x16: MOV(Bb,Ib); 36311103Snilay@cs.wisc.edu 0x17: MOV(Bv,Iv); 36411103Snilay@cs.wisc.edu 0x18: decode OPCODE_OP_BOTTOM3 { 36511103Snilay@cs.wisc.edu //0x0: group2_Eb_Ib(); 36611103Snilay@cs.wisc.edu 0x0: decode MODRM_REG { 36711103Snilay@cs.wisc.edu 0x0: ROL(Eb,Ib); 36811103Snilay@cs.wisc.edu 0x1: ROR(Eb,Ib); 36911103Snilay@cs.wisc.edu 0x2: RCL(Eb,Ib); 37011103Snilay@cs.wisc.edu 0x3: RCR(Eb,Ib); 37111103Snilay@cs.wisc.edu 0x4: SAL(Eb,Ib); 37211103Snilay@cs.wisc.edu 0x5: SHR(Eb,Ib); 3738464SN/A 0x6: SAL(Eb,Ib); 37411103Snilay@cs.wisc.edu 0x7: SAR(Eb,Ib); 37511103Snilay@cs.wisc.edu } 37611103Snilay@cs.wisc.edu //0x1: group2_Ev_Ib(); 37711103Snilay@cs.wisc.edu 0x1: decode MODRM_REG { 37811103Snilay@cs.wisc.edu 0x0: ROL(Ev,Ib); 37911103Snilay@cs.wisc.edu 0x1: ROR(Ev,Ib); 38011103Snilay@cs.wisc.edu 0x2: RCL(Ev,Ib); 38111103Snilay@cs.wisc.edu 0x3: RCR(Ev,Ib); 38211103Snilay@cs.wisc.edu 0x4: SAL(Ev,Ib); 3838464SN/A 0x5: SHR(Ev,Ib); 3848464SN/A 0x6: SAL(Ev,Ib); 3858464SN/A 0x7: SAR(Ev,Ib); 38611103Snilay@cs.wisc.edu } 38711103Snilay@cs.wisc.edu 0x2: RET_NEAR(Iw); 38811103Snilay@cs.wisc.edu 0x3: RET_NEAR(); 38911103Snilay@cs.wisc.edu 0x4: decode MODE_SUBMODE { 39011103Snilay@cs.wisc.edu 0x0: UD2(); 39111103Snilay@cs.wisc.edu default: WarnUnimpl::les_Gz_Mp(); 39211103Snilay@cs.wisc.edu } 39311103Snilay@cs.wisc.edu 0x5: decode MODE_SUBMODE { 39411103Snilay@cs.wisc.edu 0x0: UD2(); 39511103Snilay@cs.wisc.edu default: WarnUnimpl::lds_Gz_Mp(); 39611103Snilay@cs.wisc.edu } 39711103Snilay@cs.wisc.edu //0x6: group12_Eb_Ib(); 39811103Snilay@cs.wisc.edu 0x6: decode MODRM_REG { 39911103Snilay@cs.wisc.edu 0x0: MOV(Eb,Ib); 40011103Snilay@cs.wisc.edu default: UD2(); 40111103Snilay@cs.wisc.edu } 40211103Snilay@cs.wisc.edu //0x7: group12_Ev_Iz(); 40311103Snilay@cs.wisc.edu 0x7: decode MODRM_REG { 40411103Snilay@cs.wisc.edu 0x0: MOV(Ev,Iz); 40511103Snilay@cs.wisc.edu default: UD2(); 40611103Snilay@cs.wisc.edu } 40711103Snilay@cs.wisc.edu } 40811103Snilay@cs.wisc.edu format WarnUnimpl { 40911103Snilay@cs.wisc.edu 0x19: decode OPCODE_OP_BOTTOM3 { 41011103Snilay@cs.wisc.edu // The second parameter here should be of size b, but 41111103Snilay@cs.wisc.edu // immediate sizes are determined elsewhere and this would 41211103Snilay@cs.wisc.edu // confuse the instruction type specialization code. 41311103Snilay@cs.wisc.edu 0x0: Inst::ENTER(Iw,Iw); 41411103Snilay@cs.wisc.edu 0x1: Inst::LEAVE(); 41511103Snilay@cs.wisc.edu 0x2: ret_far_Iw(); 41611103Snilay@cs.wisc.edu 0x3: ret_far(); 41711103Snilay@cs.wisc.edu 0x4: int3(); 41811103Snilay@cs.wisc.edu 0x5: int_Ib(); 41911103Snilay@cs.wisc.edu 0x6: decode MODE_SUBMODE { 42011103Snilay@cs.wisc.edu 0x0: Inst::UD2(); 42111103Snilay@cs.wisc.edu default: into(); 42211103Snilay@cs.wisc.edu } 42311103Snilay@cs.wisc.edu 0x7: iret(); 42411103Snilay@cs.wisc.edu } 42511103Snilay@cs.wisc.edu } 42611103Snilay@cs.wisc.edu 0x1A: decode OPCODE_OP_BOTTOM3 { 42711103Snilay@cs.wisc.edu //0x0: group2_Eb_1(); 42811103Snilay@cs.wisc.edu 0x0: decode MODRM_REG { 42911103Snilay@cs.wisc.edu 0x0: ROL_1(Eb); 43011103Snilay@cs.wisc.edu 0x1: ROR_1(Eb); 43111103Snilay@cs.wisc.edu 0x2: RCL_1(Eb); 4328464SN/A 0x3: RCR_1(Eb); 43311103Snilay@cs.wisc.edu 0x4: SAL_1(Eb); 43411103Snilay@cs.wisc.edu 0x5: SHR_1(Eb); 43511103Snilay@cs.wisc.edu 0x6: SAL_1(Eb); 43611103Snilay@cs.wisc.edu 0x7: SAR_1(Eb); 43711103Snilay@cs.wisc.edu } 43811103Snilay@cs.wisc.edu //0x1: group2_Ev_1(); 43911103Snilay@cs.wisc.edu 0x1: decode MODRM_REG { 44011103Snilay@cs.wisc.edu 0x0: ROL_1(Ev); 44111103Snilay@cs.wisc.edu 0x1: ROR_1(Ev); 4428464SN/A 0x2: RCL_1(Ev); 4438464SN/A 0x3: RCR_1(Ev); 4448464SN/A 0x4: SAL_1(Ev); 44511103Snilay@cs.wisc.edu 0x5: SHR_1(Ev); 4468464SN/A 0x6: SAL_1(Ev); 44711103Snilay@cs.wisc.edu 0x7: SAR_1(Ev); 44811103Snilay@cs.wisc.edu } 44911103Snilay@cs.wisc.edu //0x2: group2_Eb_Cl(); 45011103Snilay@cs.wisc.edu 0x2: decode MODRM_REG { 45111103Snilay@cs.wisc.edu 0x0: ROL(Eb,rCb); 45211103Snilay@cs.wisc.edu 0x1: ROR(Eb,rCb); 45311103Snilay@cs.wisc.edu 0x2: RCL(Eb,rCb); 45411103Snilay@cs.wisc.edu 0x3: RCR(Eb,rCb); 45511103Snilay@cs.wisc.edu 0x4: SAL(Eb,rCb); 45611103Snilay@cs.wisc.edu 0x5: SHR(Eb,rCb); 45711103Snilay@cs.wisc.edu 0x6: SAL(Eb,rCb); 45811103Snilay@cs.wisc.edu 0x7: SAR(Eb,rCb); 45911103Snilay@cs.wisc.edu } 46011103Snilay@cs.wisc.edu //The second operand should have size "b", but to have 46111103Snilay@cs.wisc.edu //consistent register sizes it's "v". This shouldn't have 46211103Snilay@cs.wisc.edu //any affect on functionality. 46311103Snilay@cs.wisc.edu //0x3: group2_Ev_Cl(); 46411103Snilay@cs.wisc.edu 0x3: decode MODRM_REG { 46511103Snilay@cs.wisc.edu 0x0: ROL(Ev,rCv); 46611103Snilay@cs.wisc.edu 0x1: ROR(Ev,rCv); 46711103Snilay@cs.wisc.edu 0x2: RCL(Ev,rCv); 46811103Snilay@cs.wisc.edu 0x3: RCR(Ev,rCv); 46911103Snilay@cs.wisc.edu 0x4: SAL(Ev,rCv); 47011103Snilay@cs.wisc.edu 0x5: SHR(Ev,rCv); 47111103Snilay@cs.wisc.edu 0x6: SAL(Ev,rCv); 47211103Snilay@cs.wisc.edu 0x7: SAR(Ev,rCv); 47311103Snilay@cs.wisc.edu } 47411103Snilay@cs.wisc.edu 0x4: decode MODE_SUBMODE { 47511103Snilay@cs.wisc.edu 0x0: UD2(); 47611103Snilay@cs.wisc.edu default: WarnUnimpl::aam_Ib(); 47711103Snilay@cs.wisc.edu } 4788464SN/A 0x5: decode MODE_SUBMODE { 4798464SN/A 0x0: UD2(); 48010892Sandreas.hansson@arm.com default: WarnUnimpl::aad_Ib(); 48111103Snilay@cs.wisc.edu } 48211103Snilay@cs.wisc.edu 0x6: decode MODE_SUBMODE { 48311103Snilay@cs.wisc.edu 0x0: UD2(); 48411103Snilay@cs.wisc.edu default: SALC(rAb); 48511103Snilay@cs.wisc.edu } 48611103Snilay@cs.wisc.edu 0x7: XLAT(); 48711103Snilay@cs.wisc.edu } 48811103Snilay@cs.wisc.edu ##include "x87.isa" 48911103Snilay@cs.wisc.edu 0x1C: decode OPCODE_OP_BOTTOM3 { 49011103Snilay@cs.wisc.edu 0x0: LOOPNE(Jb); 49111103Snilay@cs.wisc.edu 0x1: LOOPE(Jb); 49211103Snilay@cs.wisc.edu 0x2: LOOP(Jb); 49311103Snilay@cs.wisc.edu 0x3: JRCX(Jb); 49411103Snilay@cs.wisc.edu 0x4: IN(rAb,Ib); 49511103Snilay@cs.wisc.edu 0x5: IN(rAv,Iv); 49611103Snilay@cs.wisc.edu 0x6: OUT(Ib,rAb); 49711103Snilay@cs.wisc.edu 0x7: OUT(Iv,rAv); 49811103Snilay@cs.wisc.edu } 49911103Snilay@cs.wisc.edu 0x1D: decode OPCODE_OP_BOTTOM3 { 50011103Snilay@cs.wisc.edu 0x0: CALL_NEAR(Jz); 50111103Snilay@cs.wisc.edu 0x1: JMP(Jz); 50211103Snilay@cs.wisc.edu 0x2: decode MODE_SUBMODE { 50311103Snilay@cs.wisc.edu 0x0: UD2(); 50411103Snilay@cs.wisc.edu default: WarnUnimpl::jmp_far_Ap(); 50511103Snilay@cs.wisc.edu } 50611103Snilay@cs.wisc.edu 0x3: JMP(Jb); 50711103Snilay@cs.wisc.edu 0x4: IN(rAb,rD); 50811103Snilay@cs.wisc.edu 0x5: IN(rAv,rD); 50911103Snilay@cs.wisc.edu 0x6: OUT(rD,rAb); 51011103Snilay@cs.wisc.edu 0x7: OUT(rD,rAv); 51111103Snilay@cs.wisc.edu } 51211103Snilay@cs.wisc.edu 0x1E: decode OPCODE_OP_BOTTOM3 { 5138464SN/A 0x0: M5InternalError::error( 51411103Snilay@cs.wisc.edu {{"Tried to execute the lock prefix!"}}); 51511103Snilay@cs.wisc.edu 0x1: WarnUnimpl::int1(); 51611103Snilay@cs.wisc.edu 0x2: M5InternalError::error( 51711103Snilay@cs.wisc.edu {{"Tried to execute the repne prefix!"}}); 51811103Snilay@cs.wisc.edu 0x3: M5InternalError::error( 51911103Snilay@cs.wisc.edu {{"Tried to execute the rep/repe prefix!"}}); 52011103Snilay@cs.wisc.edu 0x4: HLT(); 52111103Snilay@cs.wisc.edu 0x5: CMC(); 52211103Snilay@cs.wisc.edu //0x6: group3_Eb(); 52311103Snilay@cs.wisc.edu 0x6: decode MODRM_REG { 52411103Snilay@cs.wisc.edu 0x0: TEST(Eb,Iz); 52511103Snilay@cs.wisc.edu 0x1: TEST(Eb,Iz); 52611103Snilay@cs.wisc.edu 0x2: NOT(Eb); 5278464SN/A 0x3: NEG(Eb); 52811103Snilay@cs.wisc.edu 0x4: MUL_B(Eb); 52911103Snilay@cs.wisc.edu 0x5: IMUL_B(Eb); 53011103Snilay@cs.wisc.edu //This should be Eb, but it access the entire word value ax. 53111103Snilay@cs.wisc.edu 0x6: DIV_B(Ew); 5328464SN/A 0x7: IDIV(Eb); 5338464SN/A } 53411103Snilay@cs.wisc.edu //0x7: group3_Ev(); 53511103Snilay@cs.wisc.edu 0x7: decode MODRM_REG { 5368464SN/A 0x0: TEST(Ev,Iz); 53711103Snilay@cs.wisc.edu 0x1: TEST(Ev,Iz); 53811103Snilay@cs.wisc.edu 0x2: NOT(Ev); 53911103Snilay@cs.wisc.edu 0x3: NEG(Ev); 54011103Snilay@cs.wisc.edu 0x4: MUL(Ev); 54111103Snilay@cs.wisc.edu 0x5: IMUL(Ev); 54211103Snilay@cs.wisc.edu 0x6: DIV(Ev); 54311103Snilay@cs.wisc.edu 0x7: IDIV(Ev); 54411103Snilay@cs.wisc.edu } 54511103Snilay@cs.wisc.edu } 54611103Snilay@cs.wisc.edu 0x1F: decode OPCODE_OP_BOTTOM3 { 54711103Snilay@cs.wisc.edu 0x0: CLC(); 54811103Snilay@cs.wisc.edu 0x1: STC(); 54911103Snilay@cs.wisc.edu 0x2: WarnUnimpl::cli(); 55011103Snilay@cs.wisc.edu 0x3: WarnUnimpl::sti(); 55111103Snilay@cs.wisc.edu 0x4: CLD(); 55211103Snilay@cs.wisc.edu 0x5: STD(); 55311103Snilay@cs.wisc.edu //0x6: group4(); 5548464SN/A 0x6: decode MODRM_REG { 55511103Snilay@cs.wisc.edu 0x0: INC(Eb); 55611103Snilay@cs.wisc.edu 0x1: DEC(Eb); 55711103Snilay@cs.wisc.edu default: UD2(); 55811103Snilay@cs.wisc.edu } 55911103Snilay@cs.wisc.edu //0x7: group5(); 56011103Snilay@cs.wisc.edu 0x7: decode MODRM_REG { 56111103Snilay@cs.wisc.edu 0x0: INC(Ev); 56211103Snilay@cs.wisc.edu 0x1: DEC(Ev); 56311103Snilay@cs.wisc.edu 0x2: CALL_NEAR(Ev); 5648464SN/A 0x3: WarnUnimpl::call_far_Mp(); 56511103Snilay@cs.wisc.edu 0x4: JMP(Ev); 56611103Snilay@cs.wisc.edu 0x5: WarnUnimpl::jmp_far_Mp(); 5678464SN/A 0x6: PUSH(Ev); 56811103Snilay@cs.wisc.edu 0x7: UD2(); 56911103Snilay@cs.wisc.edu } 57011103Snilay@cs.wisc.edu } 57111103Snilay@cs.wisc.edu } 57211103Snilay@cs.wisc.edu default: FailUnimpl::oneByteOps(); 57311103Snilay@cs.wisc.edu} 5748241SN/A