one_byte_opcodes.isa revision 7713:ce987fa77797
12068SN/A// Copyright (c) 2007-2008 The Hewlett-Packard Development Company 22068SN/A// All rights reserved. 32188SN/A// 42068SN/A// The license below extends only to copyright in the software and shall 52068SN/A// not be construed as granting a license to any other intellectual 62068SN/A// property including but not limited to intellectual property relating 72068SN/A// to a hardware implementation of the functionality of the software 82068SN/A// licensed hereunder. You may use the software subject to the license 92068SN/A// terms below provided that you ensure that this notice is replicated 102068SN/A// unmodified and in its entirety in all distributions of the software, 112068SN/A// modified or unmodified, in source code or in binary form. 122068SN/A// 132068SN/A// Redistribution and use in source and binary forms, with or without 142068SN/A// modification, are permitted provided that the following conditions are 152068SN/A// met: redistributions of source code must retain the above copyright 162068SN/A// notice, this list of conditions and the following disclaimer; 172068SN/A// redistributions in binary form must reproduce the above copyright 182068SN/A// notice, this list of conditions and the following disclaimer in the 192068SN/A// documentation and/or other materials provided with the distribution; 202068SN/A// neither the name of the copyright holders nor the names of its 212068SN/A// contributors may be used to endorse or promote products derived from 222068SN/A// this software without specific prior written permission. 232068SN/A// 242068SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 252068SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 262068SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 272068SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 282665Ssaidi@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 292665Ssaidi@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 302068SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 312649Ssaidi@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 322649Ssaidi@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 332649Ssaidi@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 342649Ssaidi@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 352649Ssaidi@eecs.umich.edu// 362068SN/A// Authors: Gabe Black 372068SN/A 382068SN/A//////////////////////////////////////////////////////////////////// 392068SN/A// 402068SN/A// Decode the one byte opcodes 412068SN/A// 422068SN/A 432068SN/A0x1: decode OPCODE_OP_TOP5 { 448588Sgblack@eecs.umich.edu format Inst { 458588Sgblack@eecs.umich.edu 0x00: decode OPCODE_OP_BOTTOM3 { 468588Sgblack@eecs.umich.edu 0x6: decode MODE_SUBMODE { 478588Sgblack@eecs.umich.edu 0x0: UD2(); 488588Sgblack@eecs.umich.edu default: WarnUnimpl::push_ES(); 498588Sgblack@eecs.umich.edu } 502068SN/A 0x7: decode MODE_SUBMODE { 512068SN/A 0x0: UD2(); 522068SN/A default: WarnUnimpl::pop_ES(); 538588Sgblack@eecs.umich.edu } 548588Sgblack@eecs.umich.edu default: MultiInst::ADD(OPCODE_OP_BOTTOM3, 552068SN/A [Eb,Gb], [Ev,Gv], 562068SN/A [Gb,Eb], [Gv,Ev], 578588Sgblack@eecs.umich.edu [rAb,Ib], [rAv,Iz]); 582075SN/A } 592068SN/A 0x01: decode OPCODE_OP_BOTTOM3 { 602068SN/A 0x6: decode MODE_SUBMODE { 612068SN/A 0x0: UD2(); 628588Sgblack@eecs.umich.edu default: WarnUnimpl::push_CS(); 638588Sgblack@eecs.umich.edu } 648588Sgblack@eecs.umich.edu //Any time this is seen, it should generate a two byte opcode 658588Sgblack@eecs.umich.edu 0x7: M5InternalError::error( 668588Sgblack@eecs.umich.edu {{"Saw a one byte opcode whose value was 0x0F!"}}); 678588Sgblack@eecs.umich.edu default: MultiInst::OR(OPCODE_OP_BOTTOM3, 688588Sgblack@eecs.umich.edu [Eb,Gb], [Ev,Gv], 692068SN/A [Gb,Eb], [Gv,Ev], 702068SN/A [rAb,Ib], [rAv,Iz]); 712068SN/A } 728588Sgblack@eecs.umich.edu 0x02: decode OPCODE_OP_BOTTOM3 { 732068SN/A 0x6: decode MODE_SUBMODE { 742069SN/A 0x0: UD2(); 752068SN/A default: WarnUnimpl::push_SS(); 762068SN/A } 774027Sstever@eecs.umich.edu 0x7: decode MODE_SUBMODE { 784027Sstever@eecs.umich.edu 0x0: UD2(); 794027Sstever@eecs.umich.edu default: WarnUnimpl::pop_SS(); 806076Sgblack@eecs.umich.edu } 818588Sgblack@eecs.umich.edu default: MultiInst::ADC(OPCODE_OP_BOTTOM3, 822068SN/A [Eb,Gb], [Ev,Gv], 832069SN/A [Gb,Eb], [Gv,Ev], 842068SN/A [rAb,Ib], [rAv,Iz]); 852068SN/A } 862068SN/A 0x03: decode OPCODE_OP_BOTTOM3 { 872068SN/A 0x6: decode MODE_SUBMODE { 882068SN/A 0x0: UD2(); 892068SN/A default: WarnUnimpl::push_DS(); 902068SN/A } 912068SN/A 0x7: decode MODE_SUBMODE { 924027Sstever@eecs.umich.edu 0x0: UD2(); 934027Sstever@eecs.umich.edu default: WarnUnimpl::pop_DS(); 944027Sstever@eecs.umich.edu } 954027Sstever@eecs.umich.edu default: MultiInst::SBB(OPCODE_OP_BOTTOM3, 964027Sstever@eecs.umich.edu [Eb,Gb], [Ev,Gv], 974027Sstever@eecs.umich.edu [Gb,Eb], [Gv,Ev], 986076Sgblack@eecs.umich.edu [rAb,Ib], [rAv,Iz]); 992068SN/A } 1002068SN/A 0x04: decode OPCODE_OP_BOTTOM3 { 1012068SN/A 0x6: M5InternalError::error( 1022068SN/A {{"Tried to execute the ES segment override prefix!"}}); 1037799Sgblack@eecs.umich.edu 0x7: decode MODE_SUBMODE { 1042068SN/A 0x0: UD2(); 1058588Sgblack@eecs.umich.edu default: WarnUnimpl::daa(); 1062068SN/A } 1078588Sgblack@eecs.umich.edu default: MultiInst::AND(OPCODE_OP_BOTTOM3, 1082068SN/A [Eb,Gb], [Ev,Gv], 1092068SN/A [Gb,Eb], [Gv,Ev], 1108588Sgblack@eecs.umich.edu [rAb,Ib], [rAv,Iz]); 1112147SN/A } 1128588Sgblack@eecs.umich.edu 0x05: decode OPCODE_OP_BOTTOM3 { 1132068SN/A 0x6: M5InternalError::error( 1148588Sgblack@eecs.umich.edu {{"Tried to execute the CS segment override prefix!"}}); 1158588Sgblack@eecs.umich.edu 0x7: decode MODE_SUBMODE { 1162068SN/A 0x0: UD2(); 1172068SN/A default: WarnUnimpl::das(); 1182068SN/A } 1192068SN/A default: MultiInst::SUB(OPCODE_OP_BOTTOM3, 1202068SN/A [Eb,Gb], [Ev,Gv], 1212068SN/A [Gb,Eb], [Gv,Ev], 1222068SN/A [rAb,Ib], [rAv,Iz]); 1232147SN/A } 1242068SN/A 0x06: decode OPCODE_OP_BOTTOM3 { 1252068SN/A 0x6: M5InternalError::error( 1262068SN/A {{"Tried to execute the SS segment override prefix!"}}); 1272068SN/A 0x7: decode MODE_SUBMODE { 1282068SN/A 0x0: UD2(); 1298588Sgblack@eecs.umich.edu default: WarnUnimpl::aaa(); 1302068SN/A } 1318588Sgblack@eecs.umich.edu default: MultiInst::XOR(OPCODE_OP_BOTTOM3, 1322068SN/A [Eb,Gb], [Ev,Gv], 1332068SN/A [Gb,Eb], [Gv,Ev], 1342068SN/A [rAb,Ib], [rAv,Iz]); 1352068SN/A } 1368588Sgblack@eecs.umich.edu 0x07: decode OPCODE_OP_BOTTOM3 { 1372147SN/A 0x6: M5InternalError::error( 1388588Sgblack@eecs.umich.edu {{"Tried to execute the DS segment override prefix!"}}); 1392068SN/A 0x7: decode MODE_SUBMODE { 1408588Sgblack@eecs.umich.edu 0x0: UD2(); 1418588Sgblack@eecs.umich.edu default: WarnUnimpl::aas(); 1422068SN/A } 1432068SN/A default: MultiInst::CMP(OPCODE_OP_BOTTOM3, 1442068SN/A [Eb,Gb], [Ev,Gv], 1452068SN/A [Gb,Eb], [Gv,Ev], 1462068SN/A [rAb,Ib], [rAv,Iz]); 1472068SN/A } 1482068SN/A 0x08: decode MODE_SUBMODE { 1492068SN/A 0x0: M5InternalError::error ( 1502068SN/A {{"Tried to execute an REX prefix!"}}); 1512147SN/A default: INC(Bv); 1522068SN/A } 1532068SN/A 0x09: decode MODE_SUBMODE { 1542068SN/A 0x0: M5InternalError::error ( 1552068SN/A {{"Tried to execute an REX prefix!"}}); 1562068SN/A default: DEC(Bv); 1572068SN/A } 1588588Sgblack@eecs.umich.edu 0x0A: PUSH(Bv); 1598588Sgblack@eecs.umich.edu 0x0B: POP(Bv); 1608588Sgblack@eecs.umich.edu 0x0C: decode OPCODE_OP_BOTTOM3 { 1618588Sgblack@eecs.umich.edu 0x0: decode MODE_SUBMODE { 1622068SN/A 0x0: UD2(); 1632068SN/A default: PUSHA(); 1642068SN/A } 1652068SN/A 0x1: decode MODE_SUBMODE { 1662068SN/A 0x0: UD2(); 1672068SN/A default: POPA(); 1688588Sgblack@eecs.umich.edu } 1692068SN/A 0x2: decode MODE_SUBMODE { 1702068SN/A 0x0: UD2(); 1712068SN/A default: BOUND(Gv,Mv); 1722068SN/A } 1732068SN/A 0x3: decode MODE_SUBMODE { 1742068SN/A //The second operand should really be of size "d", but it's 1752068SN/A //set to "v" in order to have a consistent register size. 1767799Sgblack@eecs.umich.edu //This shouldn't affect behavior. 1772068SN/A 0x0: MOVSXD(Gv,Ev); 1782068SN/A default: WarnUnimpl::arpl_Ew_Gw(); 1792068SN/A } 1802068SN/A 0x4: M5InternalError::error( 1812068SN/A {{"Tried to execute the FS segment override prefix!"}}); 1822068SN/A 0x5: M5InternalError::error( 1832068SN/A {{"Tried to execute the GS segment override prefix!"}}); 1842068SN/A 0x6: M5InternalError::error( 1852068SN/A {{"Tried to execute the operand size override prefix!"}}); 1862068SN/A 0x7: M5InternalError::error( 1872068SN/A {{"Tried to execute the DS address size override prefix!"}}); 1882068SN/A } 1892068SN/A 0x0D: decode OPCODE_OP_BOTTOM3 { 1908588Sgblack@eecs.umich.edu 0x0: PUSH(Iz); 1918588Sgblack@eecs.umich.edu 0x1: IMUL(Gv,Ev,Iz); 1928588Sgblack@eecs.umich.edu 0x2: PUSH(Ib); 1938588Sgblack@eecs.umich.edu 0x3: IMUL(Gv,Ev,Ib); 1942068SN/A 0x4: StringInst::INS(Yb,rD); 1952068SN/A 0x5: StringInst::INS(Yz,rD); 1962068SN/A 0x6: StringInst::OUTS(rD,Xb); 1972068SN/A 0x7: StringInst::OUTS(rD,Xz); 1982068SN/A } 1992068SN/A 0x0E: decode OPCODE_OP_BOTTOM3 { 2002068SN/A 0x0: JO(Jb); 2012068SN/A 0x1: JNO(Jb); 2022068SN/A 0x2: JB(Jb); 2032068SN/A 0x3: JNB(Jb); 2042068SN/A 0x4: JZ(Jb); 2052068SN/A 0x5: JNZ(Jb); 2068560Sgblack@eecs.umich.edu 0x6: JBE(Jb); 2072068SN/A 0x7: JNBE(Jb); 2082068SN/A } 2092068SN/A 0x0F: decode OPCODE_OP_BOTTOM3 { 2102068SN/A 0x0: JS(Jb); 2112068SN/A 0x1: JNS(Jb); 2122068SN/A 0x2: JP(Jb); 2132068SN/A 0x3: JNP(Jb); 2142068SN/A 0x4: JL(Jb); 2152068SN/A 0x5: JNL(Jb); 2162068SN/A 0x6: JLE(Jb); 2178588Sgblack@eecs.umich.edu 0x7: JNLE(Jb); 2188588Sgblack@eecs.umich.edu } 2192068SN/A 0x10: decode OPCODE_OP_BOTTOM3 { 2202068SN/A //0x0: group1_Eb_Ib(); 2212068SN/A 0x0: decode MODRM_REG { 2222068SN/A 0x0: ADD(Eb,Ib); 2232068SN/A 0x1: OR(Eb,Ib); 2242068SN/A 0x2: ADC(Eb,Ib); 2252068SN/A 0x3: SBB(Eb,Ib); 2262068SN/A 0x4: AND(Eb,Ib); 2272068SN/A 0x5: SUB(Eb,Ib); 2282068SN/A 0x6: XOR(Eb,Ib); 2292068SN/A 0x7: CMP(Eb,Ib); 2302068SN/A } 2312068SN/A //0x1: group1_Ev_Iz(); 2322068SN/A 0x1: decode MODRM_REG { 2332068SN/A 0x0: ADD(Ev,Iz); 2342068SN/A 0x1: OR(Ev,Iz); 2352068SN/A 0x2: ADC(Ev,Iz); 2362068SN/A 0x3: SBB(Ev,Iz); 2372068SN/A 0x4: AND(Ev,Iz); 2388588Sgblack@eecs.umich.edu 0x5: SUB(Ev,Iz); 2398588Sgblack@eecs.umich.edu 0x6: XOR(Ev,Iz); 2408588Sgblack@eecs.umich.edu 0x7: CMP(Ev,Iz); 2418588Sgblack@eecs.umich.edu } 2422068SN/A 0x2: decode MODE_SUBMODE { 2432068SN/A 0x0: UD2(); 2442068SN/A //default: group1_Eb_Ib(); 2452068SN/A default: decode MODRM_REG { 2462068SN/A 0x0: ADD(Eb,Ib); 2472068SN/A 0x1: OR(Eb,Ib); 2482068SN/A 0x2: ADC(Eb,Ib); 2492068SN/A 0x3: SBB(Eb,Ib); 2502068SN/A 0x4: AND(Eb,Ib); 2512068SN/A 0x5: SUB(Eb,Ib); 2522068SN/A 0x6: XOR(Eb,Ib); 2532068SN/A 0x7: CMP(Eb,Ib); 2542068SN/A } 2552068SN/A } 2562068SN/A //0x3: group1_Ev_Ib(); 2578588Sgblack@eecs.umich.edu 0x3: decode MODRM_REG { 2582068SN/A 0x0: ADD(Ev,Ib); 2592068SN/A 0x1: OR(Ev,Ib); 2602068SN/A 0x2: ADC(Ev,Ib); 2618588Sgblack@eecs.umich.edu 0x3: SBB(Ev,Ib); 2622068SN/A 0x4: AND(Ev,Ib); 2632068SN/A 0x5: SUB(Ev,Ib); 2642068SN/A 0x6: XOR(Ev,Ib); 2658588Sgblack@eecs.umich.edu 0x7: CMP(Ev,Ib); 2662068SN/A } 2672068SN/A 0x4: TEST(Eb,Gb); 2682068SN/A 0x5: TEST(Ev,Gv); 2692068SN/A 0x6: XCHG(Eb,Gb); 2702068SN/A 0x7: XCHG(Ev,Gv); 2712068SN/A } 2722068SN/A 0x11: decode OPCODE_OP_BOTTOM3 { 2732068SN/A 0x0: MOV(Eb,Gb); 2742068SN/A 0x1: MOV(Ev,Gv); 2752068SN/A 0x2: MOV(Gb,Eb); 2762068SN/A 0x3: MOV(Gv,Ev); 2772068SN/A 0x4: decode MODRM_REG { 2782068SN/A 0x0, 0x1, 0x2, 2792068SN/A 0x3, 0x4, 0x5: MOV(Ev,Sv); 2802068SN/A } 2812068SN/A 0x5: LEA(Gv,M); 2822068SN/A 0x6: decode MODE_SUBMODE { 2832068SN/A 0x3, 0x4: MOV_REAL(Sv,Ev); 2842068SN/A default: decode MODRM_REG { 2852068SN/A 0x1: UD2(); // Moving to the CS selector is illegal. 2867799Sgblack@eecs.umich.edu 0x2: MOVSS(Sv,Ev); 2878588Sgblack@eecs.umich.edu 0x0, 0x3, 2882068SN/A 0x4, 0x5: MOV(Sv,Ev); 2892068SN/A default: UD2(); 2902068SN/A } 2912068SN/A } 2922068SN/A //0x7: group10_Ev(); 2932068SN/A 0x7: decode MODRM_REG { 2942068SN/A 0x0: POP(Ev); 2952068SN/A default: UD2(); 2968588Sgblack@eecs.umich.edu } 2978588Sgblack@eecs.umich.edu } 2982068SN/A 0x12: decode OPCODE_OP_BOTTOM3 { 2992068SN/A 0x0: NOP(); //XXX repe makes this a "pause" 3002068SN/A default: XCHG(Bv,rAv); 3012068SN/A } 3022068SN/A 0x13: decode OPCODE_OP_BOTTOM3 { 3032068SN/A 0x0: CDQE(rAv); 3042147SN/A 0x1: CQO(rAv,rDv); 3058588Sgblack@eecs.umich.edu 0x2: decode MODE_SUBMODE { 3062068SN/A 0x0: UD2(); 3072068SN/A default: WarnUnimpl::call_far_Ap(); 3082068SN/A } 3092068SN/A 0x3: WarnUnimpl::fwait(); //aka wait 3102068SN/A 0x4: PUSHF(); 3112068SN/A 0x5: POPF(); 3122068SN/A //The 64 bit versions of both of these should be illegal only 3132068SN/A //if CPUID says it isn't supported. For now, we'll just assume 3142068SN/A //that it's supported. 3152147SN/A 0x6: SAHF(); 3162068SN/A 0x7: LAHF(); 3172068SN/A } 3182068SN/A 0x14: decode OPCODE_OP_BOTTOM3 { 3192068SN/A 0x0: MOV(rAb, Ob); 3202068SN/A 0x1: MOV(rAv, Ov); 3218588Sgblack@eecs.umich.edu 0x2: MOV(Ob, rAb); 3228588Sgblack@eecs.umich.edu 0x3: MOV(Ov, rAv); 3236804Ssroy@cse.usf.edu 0x4: StringInst::MOVS(Yb,Xb); 3246804Ssroy@cse.usf.edu 0x5: StringInst::MOVS(Yv,Xv); 3256804Ssroy@cse.usf.edu 0x6: StringTestInst::CMPS(Yb,Xb); 3266804Ssroy@cse.usf.edu 0x7: StringTestInst::CMPS(Yv,Xv); 3276804Ssroy@cse.usf.edu } 3286804Ssroy@cse.usf.edu 0x15: decode OPCODE_OP_BOTTOM3 { 3296804Ssroy@cse.usf.edu 0x0: TEST(rAb,Ib); 3306804Ssroy@cse.usf.edu 0x1: TEST(rAv,Iz); 3316804Ssroy@cse.usf.edu 0x2: StringInst::STOS(Yb); 3326804Ssroy@cse.usf.edu 0x3: StringInst::STOS(Yv); 3336804Ssroy@cse.usf.edu 0x4: StringInst::LODS(Xb); 3346804Ssroy@cse.usf.edu 0x5: StringInst::LODS(Xv); 3356804Ssroy@cse.usf.edu 0x6: StringTestInst::SCAS(Yb); 3366804Ssroy@cse.usf.edu 0x7: StringTestInst::SCAS(Yv); 3376804Ssroy@cse.usf.edu } 3388588Sgblack@eecs.umich.edu 0x16: MOV(Bb,Ib); 3398588Sgblack@eecs.umich.edu 0x17: MOV(Bv,Iv); 3406804Ssroy@cse.usf.edu 0x18: decode OPCODE_OP_BOTTOM3 { 3416804Ssroy@cse.usf.edu //0x0: group2_Eb_Ib(); 3426804Ssroy@cse.usf.edu 0x0: decode MODRM_REG { 3436804Ssroy@cse.usf.edu 0x0: ROL(Eb,Ib); 3446804Ssroy@cse.usf.edu 0x1: ROR(Eb,Ib); 3456804Ssroy@cse.usf.edu 0x2: RCL(Eb,Ib); 3466804Ssroy@cse.usf.edu 0x3: RCR(Eb,Ib); 3476804Ssroy@cse.usf.edu 0x4: SAL(Eb,Ib); 3482068SN/A 0x5: SHR(Eb,Ib); 3492068SN/A 0x6: SAL(Eb,Ib); 3502068SN/A 0x7: SAR(Eb,Ib); 3512068SN/A } 3522068SN/A //0x1: group2_Ev_Ib(); 3532068SN/A 0x1: decode MODRM_REG { 3542068SN/A 0x0: ROL(Ev,Ib); 3552068SN/A 0x1: ROR(Ev,Ib); 3562068SN/A 0x2: RCL(Ev,Ib); 3572068SN/A 0x3: RCR(Ev,Ib); 3582068SN/A 0x4: SAL(Ev,Ib); 3592068SN/A 0x5: SHR(Ev,Ib); 3602068SN/A 0x6: SAL(Ev,Ib); 3612068SN/A 0x7: SAR(Ev,Ib); 3622068SN/A } 3632068SN/A 0x2: RET_NEAR(Iw); 3642068SN/A 0x3: RET_NEAR(); 3652068SN/A 0x4: decode MODE_SUBMODE { 3662068SN/A 0x0: UD2(); 3672068SN/A default: WarnUnimpl::les_Gz_Mp(); 3682068SN/A } 3696804Ssroy@cse.usf.edu 0x5: decode MODE_SUBMODE { 3706804Ssroy@cse.usf.edu 0x0: UD2(); 3716804Ssroy@cse.usf.edu default: WarnUnimpl::lds_Gz_Mp(); 3722068SN/A } 3732068SN/A //0x6: group12_Eb_Ib(); 3742068SN/A 0x6: decode MODRM_REG { 3752068SN/A 0x0: MOV(Eb,Ib); 3766804Ssroy@cse.usf.edu default: UD2(); 3776804Ssroy@cse.usf.edu } 3788588Sgblack@eecs.umich.edu //0x7: group12_Ev_Iz(); 3798588Sgblack@eecs.umich.edu 0x7: decode MODRM_REG { 3808588Sgblack@eecs.umich.edu 0x0: MOV(Ev,Iz); 3818588Sgblack@eecs.umich.edu default: UD2(); 3826804Ssroy@cse.usf.edu } 3836804Ssroy@cse.usf.edu } 3846804Ssroy@cse.usf.edu format WarnUnimpl { 3858588Sgblack@eecs.umich.edu 0x19: decode OPCODE_OP_BOTTOM3 { 3866804Ssroy@cse.usf.edu // The second parameter here should be of size b, but 3876804Ssroy@cse.usf.edu // immediate sizes are determined elsewhere and this would 3886804Ssroy@cse.usf.edu // confuse the instruction type specialization code. 3898588Sgblack@eecs.umich.edu 0x0: Inst::ENTER(Iw,Iw); 3908588Sgblack@eecs.umich.edu 0x1: Inst::LEAVE(); 3918588Sgblack@eecs.umich.edu 0x2: ret_far_Iw(); 3928588Sgblack@eecs.umich.edu 0x3: decode MODE_SUBMODE { 3936804Ssroy@cse.usf.edu 0x3, 0x4: ret_far_real(); 3946804Ssroy@cse.usf.edu default: Inst::RET_FAR(); 3956804Ssroy@cse.usf.edu } 3968588Sgblack@eecs.umich.edu 0x4: int3(); 3976804Ssroy@cse.usf.edu#if FULL_SYSTEM 3986804Ssroy@cse.usf.edu 0x5: int_Ib(); 3996804Ssroy@cse.usf.edu#else 4006804Ssroy@cse.usf.edu // Really only the LSB matters, but the predecoder will sign 4016804Ssroy@cse.usf.edu // extend it, and there's no easy way to specify only checking 4026804Ssroy@cse.usf.edu // the first byte. 4036804Ssroy@cse.usf.edu 0x5: decode IMMEDIATE { 4048588Sgblack@eecs.umich.edu -0x80: 4058588Sgblack@eecs.umich.edu SyscallInst::int80('xc->syscall(Rax)', 4066804Ssroy@cse.usf.edu IsSyscall, IsNonSpeculative); 4078588Sgblack@eecs.umich.edu default: int_Ib(); 4088588Sgblack@eecs.umich.edu } 4096804Ssroy@cse.usf.edu#endif 4106804Ssroy@cse.usf.edu 0x6: decode MODE_SUBMODE { 4116804Ssroy@cse.usf.edu 0x0: Inst::UD2(); 4126804Ssroy@cse.usf.edu default: into(); 4136804Ssroy@cse.usf.edu } 4146804Ssroy@cse.usf.edu 0x7: decode MODE_SUBMODE { 4156804Ssroy@cse.usf.edu 0x4: Inst::IRET_REAL(); 4166804Ssroy@cse.usf.edu 0x3: Inst::IRET_VIRT(); 4176804Ssroy@cse.usf.edu default: Inst::IRET_PROT(); 4186804Ssroy@cse.usf.edu } 4196804Ssroy@cse.usf.edu } 4208588Sgblack@eecs.umich.edu } 4218588Sgblack@eecs.umich.edu 0x1A: decode OPCODE_OP_BOTTOM3 { 4226804Ssroy@cse.usf.edu //0x0: group2_Eb_1(); 4238588Sgblack@eecs.umich.edu 0x0: decode MODRM_REG { 4248588Sgblack@eecs.umich.edu 0x0: ROL_1(Eb); 4256804Ssroy@cse.usf.edu 0x1: ROR_1(Eb); 4266804Ssroy@cse.usf.edu 0x2: RCL_1(Eb); 4276804Ssroy@cse.usf.edu 0x3: RCR_1(Eb); 4286804Ssroy@cse.usf.edu 0x4: SAL_1(Eb); 4296804Ssroy@cse.usf.edu 0x5: SHR_1(Eb); 4306804Ssroy@cse.usf.edu 0x6: SAL_1(Eb); 4316804Ssroy@cse.usf.edu 0x7: SAR_1(Eb); 4326804Ssroy@cse.usf.edu } 4336804Ssroy@cse.usf.edu //0x1: group2_Ev_1(); 4346804Ssroy@cse.usf.edu 0x1: decode MODRM_REG { 4356804Ssroy@cse.usf.edu 0x0: ROL_1(Ev); 4368588Sgblack@eecs.umich.edu 0x1: ROR_1(Ev); 4378588Sgblack@eecs.umich.edu 0x2: RCL_1(Ev); 4386804Ssroy@cse.usf.edu 0x3: RCR_1(Ev); 4398588Sgblack@eecs.umich.edu 0x4: SAL_1(Ev); 4408588Sgblack@eecs.umich.edu 0x5: SHR_1(Ev); 4416804Ssroy@cse.usf.edu 0x6: SAL_1(Ev); 4426804Ssroy@cse.usf.edu 0x7: SAR_1(Ev); 4436804Ssroy@cse.usf.edu } 4446804Ssroy@cse.usf.edu //0x2: group2_Eb_Cl(); 4456804Ssroy@cse.usf.edu 0x2: decode MODRM_REG { 4466804Ssroy@cse.usf.edu 0x0: ROL(Eb,rCb); 4476804Ssroy@cse.usf.edu 0x1: ROR(Eb,rCb); 4486804Ssroy@cse.usf.edu 0x2: RCL(Eb,rCb); 4496804Ssroy@cse.usf.edu 0x3: RCR(Eb,rCb); 4506804Ssroy@cse.usf.edu 0x4: SAL(Eb,rCb); 4516804Ssroy@cse.usf.edu 0x5: SHR(Eb,rCb); 4528588Sgblack@eecs.umich.edu 0x6: SAL(Eb,rCb); 4538588Sgblack@eecs.umich.edu 0x7: SAR(Eb,rCb); 4546804Ssroy@cse.usf.edu } 4558588Sgblack@eecs.umich.edu //The second operand should have size "b", but to have 4568588Sgblack@eecs.umich.edu //consistent register sizes it's "v". This shouldn't have 4576804Ssroy@cse.usf.edu //any affect on functionality. 4586804Ssroy@cse.usf.edu //0x3: group2_Ev_Cl(); 4596804Ssroy@cse.usf.edu 0x3: decode MODRM_REG { 4606804Ssroy@cse.usf.edu 0x0: ROL(Ev,rCv); 4616804Ssroy@cse.usf.edu 0x1: ROR(Ev,rCv); 4626804Ssroy@cse.usf.edu 0x2: RCL(Ev,rCv); 4636804Ssroy@cse.usf.edu 0x3: RCR(Ev,rCv); 4646804Ssroy@cse.usf.edu 0x4: SAL(Ev,rCv); 4656804Ssroy@cse.usf.edu 0x5: SHR(Ev,rCv); 4666804Ssroy@cse.usf.edu 0x6: SAL(Ev,rCv); 4676804Ssroy@cse.usf.edu 0x7: SAR(Ev,rCv); 4688588Sgblack@eecs.umich.edu } 4698588Sgblack@eecs.umich.edu 0x4: decode MODE_SUBMODE { 4706804Ssroy@cse.usf.edu 0x0: UD2(); 4718588Sgblack@eecs.umich.edu default: WarnUnimpl::aam_Ib(); 4728588Sgblack@eecs.umich.edu } 4736804Ssroy@cse.usf.edu 0x5: decode MODE_SUBMODE { 4746804Ssroy@cse.usf.edu 0x0: UD2(); 4756804Ssroy@cse.usf.edu default: WarnUnimpl::aad_Ib(); 4766804Ssroy@cse.usf.edu } 4776804Ssroy@cse.usf.edu 0x6: decode MODE_SUBMODE { 4786804Ssroy@cse.usf.edu 0x0: UD2(); 4796804Ssroy@cse.usf.edu default: SALC(rAb); 4806804Ssroy@cse.usf.edu } 4816804Ssroy@cse.usf.edu 0x7: XLAT(); 4826804Ssroy@cse.usf.edu } 4836804Ssroy@cse.usf.edu ##include "x87.isa" 4848588Sgblack@eecs.umich.edu 0x1C: decode OPCODE_OP_BOTTOM3 { 4858588Sgblack@eecs.umich.edu 0x0: LOOPNE(Jb); 4866804Ssroy@cse.usf.edu 0x1: LOOPE(Jb); 4878588Sgblack@eecs.umich.edu 0x2: LOOP(Jb); 4888588Sgblack@eecs.umich.edu 0x3: JRCX(Jb); 4896804Ssroy@cse.usf.edu 0x4: IN(rAb,Ib); 4906804Ssroy@cse.usf.edu 0x5: IN(rAv,Iv); 4916804Ssroy@cse.usf.edu 0x6: OUT(Ib,rAb); 4926804Ssroy@cse.usf.edu 0x7: OUT(Iv,rAv); 4936804Ssroy@cse.usf.edu } 4946804Ssroy@cse.usf.edu 0x1D: decode OPCODE_OP_BOTTOM3 { 4956804Ssroy@cse.usf.edu 0x0: CALL_NEAR(Jz); 4966804Ssroy@cse.usf.edu 0x1: JMP(Jz); 4976804Ssroy@cse.usf.edu 0x2: decode MODE_SUBMODE { 4986804Ssroy@cse.usf.edu 0x0: UD2(); 4996804Ssroy@cse.usf.edu 0x1: JMP_FAR(Iz); 5008588Sgblack@eecs.umich.edu 0x2: JMP_FAR(Iz); 5018588Sgblack@eecs.umich.edu 0x3: JMP_FAR_REAL(Iz); 5026804Ssroy@cse.usf.edu 0x4: JMP_FAR_REAL(Iz); 5038588Sgblack@eecs.umich.edu } 5048588Sgblack@eecs.umich.edu 0x3: JMP(Jb); 5056804Ssroy@cse.usf.edu 0x4: IN(rAb,rD); 5066804Ssroy@cse.usf.edu 0x5: IN(rAv,rD); 5076804Ssroy@cse.usf.edu 0x6: OUT(rD,rAb); 5086804Ssroy@cse.usf.edu 0x7: OUT(rD,rAv); 5096804Ssroy@cse.usf.edu } 5106804Ssroy@cse.usf.edu 0x1E: decode OPCODE_OP_BOTTOM3 { 5116804Ssroy@cse.usf.edu 0x0: M5InternalError::error( 5126804Ssroy@cse.usf.edu {{"Tried to execute the lock prefix!"}}); 5136804Ssroy@cse.usf.edu 0x1: WarnUnimpl::int1(); 5146804Ssroy@cse.usf.edu 0x2: M5InternalError::error( 5156804Ssroy@cse.usf.edu {{"Tried to execute the repne prefix!"}}); 5168588Sgblack@eecs.umich.edu 0x3: M5InternalError::error( 5178588Sgblack@eecs.umich.edu {{"Tried to execute the rep/repe prefix!"}}); 5186804Ssroy@cse.usf.edu 0x4: HLT(); 5198588Sgblack@eecs.umich.edu 0x5: CMC(); 5208588Sgblack@eecs.umich.edu //0x6: group3_Eb(); 5216804Ssroy@cse.usf.edu 0x6: decode MODRM_REG { 5226804Ssroy@cse.usf.edu 0x0: TEST(Eb,Iz); 5236804Ssroy@cse.usf.edu 0x1: TEST(Eb,Iz); 5246804Ssroy@cse.usf.edu 0x2: NOT(Eb); 5256804Ssroy@cse.usf.edu 0x3: NEG(Eb); 5262068SN/A 0x4: MUL_B(Eb); 5272068SN/A 0x5: IMUL_B(Eb); 5282068SN/A //This should be Eb, but it access the entire word value ax. 5298588Sgblack@eecs.umich.edu 0x6: DIV_B(Ew); 5302068SN/A 0x7: IDIV_B(Eb); 5312068SN/A } 5328588Sgblack@eecs.umich.edu //0x7: group3_Ev(); 5332068SN/A 0x7: decode MODRM_REG { 5342068SN/A 0x0: TEST(Ev,Iz); 5352068SN/A 0x1: TEST(Ev,Iz); 5362068SN/A 0x2: NOT(Ev); 5372068SN/A 0x3: NEG(Ev); 5382068SN/A 0x4: MUL(Ev); 5392068SN/A 0x5: IMUL(Ev); 5402068SN/A 0x6: DIV(Ev); 5412068SN/A 0x7: IDIV(Ev); 5422068SN/A } 5438588Sgblack@eecs.umich.edu } 5448588Sgblack@eecs.umich.edu 0x1F: decode OPCODE_OP_BOTTOM3 { 5458588Sgblack@eecs.umich.edu 0x0: CLC(); 5468588Sgblack@eecs.umich.edu 0x1: STC(); 5472068SN/A 0x2: CLI(); 5482068SN/A 0x3: STI(); 5492068SN/A 0x4: CLD(); 5502068SN/A 0x5: STD(); 5512068SN/A //0x6: group4(); 5522068SN/A 0x6: decode MODRM_REG { 5532068SN/A 0x0: INC(Eb); 5542068SN/A 0x1: DEC(Eb); 5552068SN/A default: UD2(); 5562068SN/A } 5572068SN/A //0x7: group5(); 5582068SN/A 0x7: decode MODRM_REG { 5592068SN/A 0x0: INC(Ev); 5602068SN/A 0x1: DEC(Ev); 5612068SN/A 0x2: CALL_NEAR(Ev); 5622068SN/A 0x3: WarnUnimpl::call_far_Mp(); 5632068SN/A 0x4: JMP(Ev); 5642068SN/A 0x5: decode MODE_SUBMODE { 5652068SN/A 0x0: JMP_FAR(Mz); 5662068SN/A 0x1: JMP_FAR(Mz); 5672068SN/A 0x2: JMP_FAR(Mz); 5682068SN/A 0x3: JMP_FAR_REAL(Mz); 5692068SN/A 0x4: JMP_FAR_REAL(Mz); 5702068SN/A } 5712068SN/A 0x6: PUSH(Ev); 5722068SN/A 0x7: UD2(); 5732068SN/A } 5742068SN/A } 5752068SN/A } 5762068SN/A default: FailUnimpl::oneByteOps(); 5772068SN/A} 5782068SN/A