locked_opcodes.isa revision 10593
16100Sgblack@eecs.umich.edu// Copyright (c) 2009 The Regents of The University of Michigan 26098Sgblack@eecs.umich.edu// All rights reserved. 36098Sgblack@eecs.umich.edu// 46100Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 56100Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are 66100Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright 76100Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 86100Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 96100Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 106100Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution; 116100Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its 126098Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 136100Sgblack@eecs.umich.edu// this software without specific prior written permission. 146098Sgblack@eecs.umich.edu// 156098Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 166098Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 176098Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 186098Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 196098Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 206098Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 216098Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 226098Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 236098Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 246098Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 256098Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 266098Sgblack@eecs.umich.edu// 276098Sgblack@eecs.umich.edu// Authors: Gabe Black 286098Sgblack@eecs.umich.edu 296098Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////// 306098Sgblack@eecs.umich.edu// 316098Sgblack@eecs.umich.edu// Decode opcodes with the lock prefix. Opcodes which shouldn't have that 326098Sgblack@eecs.umich.edu// prefix should effectively decode to UD2. 336098Sgblack@eecs.umich.edu// 346098Sgblack@eecs.umich.edu 356098Sgblack@eecs.umich.edu// All the memory references in these instructions happen through modrm bytes. 366098Sgblack@eecs.umich.edu// We therefore only need to make sure the modrm byte encodes a memory 376098Sgblack@eecs.umich.edu// reference to make sure these are the memory forms of these instructions. 386098Sgblack@eecs.umich.edu0x1: decode MODRM_MOD { 396098Sgblack@eecs.umich.edu format Inst { 406098Sgblack@eecs.umich.edu 0x3: UD2(); 4110593Sgabeblack@google.com default: decode OPCODE_TYPE { 4210593Sgabeblack@google.com 'X86ISA::OneByteOpcode': decode OPCODE_OP_TOP5 { 436098Sgblack@eecs.umich.edu 0x00: decode OPCODE_OP_BOTTOM3 { 446098Sgblack@eecs.umich.edu default: MultiInst::ADD_LOCKED(OPCODE_OP_BOTTOM3, 456098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 466098Sgblack@eecs.umich.edu } 476098Sgblack@eecs.umich.edu 0x01: decode OPCODE_OP_BOTTOM3 { 486098Sgblack@eecs.umich.edu default: MultiInst::OR_LOCKED(OPCODE_OP_BOTTOM3, 496098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 506098Sgblack@eecs.umich.edu } 516098Sgblack@eecs.umich.edu 0x02: decode OPCODE_OP_BOTTOM3 { 526098Sgblack@eecs.umich.edu default: MultiInst::ADC_LOCKED(OPCODE_OP_BOTTOM3, 536098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 546098Sgblack@eecs.umich.edu } 556098Sgblack@eecs.umich.edu 0x03: decode OPCODE_OP_BOTTOM3 { 566098Sgblack@eecs.umich.edu default: MultiInst::SBB_LOCKED(OPCODE_OP_BOTTOM3, 576098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 586098Sgblack@eecs.umich.edu } 596098Sgblack@eecs.umich.edu 0x04: decode OPCODE_OP_BOTTOM3 { 606098Sgblack@eecs.umich.edu default: MultiInst::AND_LOCKED(OPCODE_OP_BOTTOM3, 616098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 626098Sgblack@eecs.umich.edu } 636098Sgblack@eecs.umich.edu 0x05: decode OPCODE_OP_BOTTOM3 { 646098Sgblack@eecs.umich.edu default: MultiInst::SUB_LOCKED(OPCODE_OP_BOTTOM3, 656098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 666098Sgblack@eecs.umich.edu } 676098Sgblack@eecs.umich.edu 0x06: decode OPCODE_OP_BOTTOM3 { 686098Sgblack@eecs.umich.edu default: MultiInst::XOR_LOCKED(OPCODE_OP_BOTTOM3, 696098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 706098Sgblack@eecs.umich.edu } 716098Sgblack@eecs.umich.edu 0x10: decode OPCODE_OP_BOTTOM3 { 726098Sgblack@eecs.umich.edu 0x0: decode MODRM_REG { 736098Sgblack@eecs.umich.edu 0x0: ADD_LOCKED(Mb,Ib); 746098Sgblack@eecs.umich.edu 0x1: OR_LOCKED(Mb,Ib); 756098Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mb,Ib); 766098Sgblack@eecs.umich.edu 0x3: SBB_LOCKED(Mb,Ib); 776098Sgblack@eecs.umich.edu 0x4: AND_LOCKED(Mb,Ib); 786098Sgblack@eecs.umich.edu 0x5: SUB_LOCKED(Mb,Ib); 796098Sgblack@eecs.umich.edu 0x6: XOR_LOCKED(Mb,Ib); 806098Sgblack@eecs.umich.edu } 816098Sgblack@eecs.umich.edu 0x1: decode MODRM_REG { 826098Sgblack@eecs.umich.edu 0x0: ADD_LOCKED(Mv,Iz); 836098Sgblack@eecs.umich.edu 0x1: OR_LOCKED(Mv,Iz); 846098Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mv,Iz); 856098Sgblack@eecs.umich.edu 0x3: SBB_LOCKED(Mv,Iz); 866098Sgblack@eecs.umich.edu 0x4: AND_LOCKED(Mv,Iz); 876098Sgblack@eecs.umich.edu 0x5: SUB_LOCKED(Mv,Iz); 886098Sgblack@eecs.umich.edu 0x6: XOR_LOCKED(Mv,Iz); 896098Sgblack@eecs.umich.edu } 906098Sgblack@eecs.umich.edu 0x2: decode MODE_SUBMODE { 916098Sgblack@eecs.umich.edu 0x0: UD2(); 926098Sgblack@eecs.umich.edu default: decode MODRM_REG { 936098Sgblack@eecs.umich.edu 0x0: ADD_LOCKED(Mb,Ib); 946098Sgblack@eecs.umich.edu 0x1: OR_LOCKED(Mb,Ib); 956098Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mb,Ib); 966098Sgblack@eecs.umich.edu 0x3: SBB_LOCKED(Mb,Ib); 976098Sgblack@eecs.umich.edu 0x4: AND_LOCKED(Mb,Ib); 986098Sgblack@eecs.umich.edu 0x5: SUB_LOCKED(Mb,Ib); 996098Sgblack@eecs.umich.edu 0x6: XOR_LOCKED(Mb,Ib); 1006098Sgblack@eecs.umich.edu } 1016098Sgblack@eecs.umich.edu } 1026098Sgblack@eecs.umich.edu //0x3: group1_Ev_Ib(); 1036098Sgblack@eecs.umich.edu 0x3: decode MODRM_REG { 1046098Sgblack@eecs.umich.edu 0x0: ADD_LOCKED(Mv,Ib); 1056098Sgblack@eecs.umich.edu 0x1: OR_LOCKED(Mv,Ib); 1066098Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mv,Ib); 1076098Sgblack@eecs.umich.edu 0x3: SBB_LOCKED(Mv,Ib); 1086098Sgblack@eecs.umich.edu 0x4: AND_LOCKED(Mv,Ib); 1096098Sgblack@eecs.umich.edu 0x5: SUB_LOCKED(Mv,Ib); 1106098Sgblack@eecs.umich.edu 0x6: XOR_LOCKED(Mv,Ib); 1116098Sgblack@eecs.umich.edu } 1126098Sgblack@eecs.umich.edu 0x6: XCHG_LOCKED(Mb,Gb); 1136098Sgblack@eecs.umich.edu 0x7: XCHG_LOCKED(Mv,Gv); 1146098Sgblack@eecs.umich.edu } 1156098Sgblack@eecs.umich.edu 0x1E: decode OPCODE_OP_BOTTOM3 { 1166098Sgblack@eecs.umich.edu //0x6: group3_Eb(); 1176098Sgblack@eecs.umich.edu 0x6: decode MODRM_REG { 1186098Sgblack@eecs.umich.edu 0x2: NOT_LOCKED(Mb); 1196098Sgblack@eecs.umich.edu 0x3: NEG_LOCKED(Mb); 1206098Sgblack@eecs.umich.edu } 1216098Sgblack@eecs.umich.edu //0x7: group3_Ev(); 1226098Sgblack@eecs.umich.edu 0x7: decode MODRM_REG { 1236098Sgblack@eecs.umich.edu 0x2: NOT_LOCKED(Mv); 1246098Sgblack@eecs.umich.edu 0x3: NEG_LOCKED(Mv); 1256098Sgblack@eecs.umich.edu } 1266098Sgblack@eecs.umich.edu } 1276098Sgblack@eecs.umich.edu 0x1F: decode OPCODE_OP_BOTTOM3 { 1286098Sgblack@eecs.umich.edu 0x6: decode MODRM_REG { 1296098Sgblack@eecs.umich.edu 0x0: INC_LOCKED(Mb); 1306098Sgblack@eecs.umich.edu 0x1: DEC_LOCKED(Mb); 1316098Sgblack@eecs.umich.edu default: UD2(); 1326098Sgblack@eecs.umich.edu } 1336098Sgblack@eecs.umich.edu //0x7: group5(); 1346098Sgblack@eecs.umich.edu 0x7: decode MODRM_REG { 1356098Sgblack@eecs.umich.edu 0x0: INC_LOCKED(Mv); 1366098Sgblack@eecs.umich.edu 0x1: DEC_LOCKED(Mv); 1376098Sgblack@eecs.umich.edu } 1386098Sgblack@eecs.umich.edu } 1396098Sgblack@eecs.umich.edu } 14010593Sgabeblack@google.com 'X86ISA::TwoByteOpcode': decode OPCODE_OP_TOP5 { 14110593Sgabeblack@google.com 0x04: decode OPCODE_OP_BOTTOM3 { 14210593Sgabeblack@google.com 0x0: WarnUnimpl::mov_Rd_CR8D(); 14310593Sgabeblack@google.com 0x2: WarnUnimpl::mov_CR8D_Rd(); 14410593Sgabeblack@google.com } 14510593Sgabeblack@google.com 0x15: decode OPCODE_OP_BOTTOM3 { 14610593Sgabeblack@google.com 0x3: BTS_LOCKED(Mv,Gv); 14710593Sgabeblack@google.com } 14810593Sgabeblack@google.com 0x16: decode OPCODE_OP_BOTTOM3 { 14910593Sgabeblack@google.com 0x0: CMPXCHG_LOCKED(Mb,Gb); 15010593Sgabeblack@google.com 0x1: CMPXCHG_LOCKED(Mv,Gv); 15110593Sgabeblack@google.com 0x3: BTR_LOCKED(Mv,Gv); 15210593Sgabeblack@google.com } 15310593Sgabeblack@google.com 0x17: decode OPCODE_OP_BOTTOM3 { 15410593Sgabeblack@google.com 0x2: decode MODRM_REG { 15510593Sgabeblack@google.com 0x5: BTS_LOCKED(Mv,Ib); 15610593Sgabeblack@google.com 0x6: BTR_LOCKED(Mv,Ib); 15710593Sgabeblack@google.com 0x7: BTC_LOCKED(Mv,Ib); 1586611Sgblack@eecs.umich.edu } 15910593Sgabeblack@google.com 0x3: BTC_LOCKED(Mv,Gv); 16010593Sgabeblack@google.com } 16110593Sgabeblack@google.com 0x18: decode OPCODE_OP_BOTTOM3 { 16210593Sgabeblack@google.com 0x0: XADD_LOCKED(Mb,Gb); 16310593Sgabeblack@google.com 0x1: XADD_LOCKED(Mv,Gv); 16410593Sgabeblack@google.com //0x7: group9(); 16510593Sgabeblack@google.com 0x7: decode MODRM_REG { 16610593Sgabeblack@google.com //Also CMPXCHG16B 16710593Sgabeblack@google.com 0x1: CMPXCHG8B_LOCKED(Mdp); 1686098Sgblack@eecs.umich.edu } 1696098Sgblack@eecs.umich.edu } 1706098Sgblack@eecs.umich.edu } 1716098Sgblack@eecs.umich.edu } 1726098Sgblack@eecs.umich.edu } 1736098Sgblack@eecs.umich.edu} 174