locked_opcodes.isa revision 6100
13931Ssaidi@eecs.umich.edu// Copyright (c) 2009 The Regents of The University of Michigan 22632Sstever@eecs.umich.edu// All rights reserved. 32632Sstever@eecs.umich.edu// 42632Sstever@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 52632Sstever@eecs.umich.edu// modification, are permitted provided that the following conditions are 62632Sstever@eecs.umich.edu// met: redistributions of source code must retain the above copyright 72632Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 82632Sstever@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 92632Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 102632Sstever@eecs.umich.edu// documentation and/or other materials provided with the distribution; 112632Sstever@eecs.umich.edu// neither the name of the copyright holders nor the names of its 122632Sstever@eecs.umich.edu// contributors may be used to endorse or promote products derived from 132632Sstever@eecs.umich.edu// this software without specific prior written permission. 142632Sstever@eecs.umich.edu// 152632Sstever@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 162632Sstever@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 172632Sstever@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 182632Sstever@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 192632Sstever@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 202632Sstever@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 212632Sstever@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 222632Sstever@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 232632Sstever@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 242632Sstever@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 252632Sstever@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262632Sstever@eecs.umich.edu// 272632Sstever@eecs.umich.edu// Authors: Gabe Black 282632Sstever@eecs.umich.edu 292632Sstever@eecs.umich.edu//////////////////////////////////////////////////////////////////// 302022SN/A// 312022SN/A// Decode opcodes with the lock prefix. Opcodes which shouldn't have that 322022SN/A// prefix should effectively decode to UD2. 332022SN/A// 342022SN/A 352022SN/A// All the memory references in these instructions happen through modrm bytes. 363275Sgblack@eecs.umich.edu// We therefore only need to make sure the modrm byte encodes a memory 373275Sgblack@eecs.umich.edu// reference to make sure these are the memory forms of these instructions. 383275Sgblack@eecs.umich.edu0x1: decode MODRM_MOD { 393275Sgblack@eecs.umich.edu format Inst { 403275Sgblack@eecs.umich.edu 0x3: UD2(); 413918Ssaidi@eecs.umich.edu default: decode OPCODE_NUM { 423275Sgblack@eecs.umich.edu 0x1: decode OPCODE_OP_TOP5 { 433275Sgblack@eecs.umich.edu 0x00: decode OPCODE_OP_BOTTOM3 { 443275Sgblack@eecs.umich.edu default: MultiInst::ADD_LOCKED(OPCODE_OP_BOTTOM3, 452022SN/A [Mb,Gb], [Mv,Gv]); 462022SN/A } 472022SN/A 0x01: decode OPCODE_OP_BOTTOM3 { 482022SN/A default: MultiInst::OR_LOCKED(OPCODE_OP_BOTTOM3, 492022SN/A [Mb,Gb], [Mv,Gv]); 502022SN/A } 512022SN/A 0x02: decode OPCODE_OP_BOTTOM3 { 522224SN/A default: MultiInst::ADC_LOCKED(OPCODE_OP_BOTTOM3, 532224SN/A [Mb,Gb], [Mv,Gv]); 543384Sgblack@eecs.umich.edu } 552224SN/A 0x03: decode OPCODE_OP_BOTTOM3 { 562224SN/A default: MultiInst::SBB_LOCKED(OPCODE_OP_BOTTOM3, 572022SN/A [Mb,Gb], [Mv,Gv]); 582022SN/A } 595091Sgblack@eecs.umich.edu 0x04: decode OPCODE_OP_BOTTOM3 { 605091Sgblack@eecs.umich.edu default: MultiInst::AND_LOCKED(OPCODE_OP_BOTTOM3, 615091Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 625091Sgblack@eecs.umich.edu } 635091Sgblack@eecs.umich.edu 0x05: decode OPCODE_OP_BOTTOM3 { 645091Sgblack@eecs.umich.edu default: MultiInst::SUB_LOCKED(OPCODE_OP_BOTTOM3, 655091Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 665091Sgblack@eecs.umich.edu } 675091Sgblack@eecs.umich.edu 0x06: decode OPCODE_OP_BOTTOM3 { 685091Sgblack@eecs.umich.edu default: MultiInst::XOR_LOCKED(OPCODE_OP_BOTTOM3, 695091Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 705091Sgblack@eecs.umich.edu } 715091Sgblack@eecs.umich.edu 0x10: decode OPCODE_OP_BOTTOM3 { 725091Sgblack@eecs.umich.edu 0x0: decode MODRM_REG { 732022SN/A 0x0: ADD_LOCKED(Mb,Ib); 742022SN/A 0x1: OR_LOCKED(Mb,Ib); 753384Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mb,Ib); 762224SN/A 0x3: SBB_LOCKED(Mb,Ib); 772022SN/A 0x4: AND_LOCKED(Mb,Ib); 782022SN/A 0x5: SUB_LOCKED(Mb,Ib); 792022SN/A 0x6: XOR_LOCKED(Mb,Ib); 802022SN/A } 812022SN/A 0x1: decode MODRM_REG { 825091Sgblack@eecs.umich.edu 0x0: ADD_LOCKED(Mv,Iz); 835091Sgblack@eecs.umich.edu 0x1: OR_LOCKED(Mv,Iz); 845091Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mv,Iz); 855091Sgblack@eecs.umich.edu 0x3: SBB_LOCKED(Mv,Iz); 865091Sgblack@eecs.umich.edu 0x4: AND_LOCKED(Mv,Iz); 875091Sgblack@eecs.umich.edu 0x5: SUB_LOCKED(Mv,Iz); 885091Sgblack@eecs.umich.edu 0x6: XOR_LOCKED(Mv,Iz); 895091Sgblack@eecs.umich.edu } 905091Sgblack@eecs.umich.edu 0x2: decode MODE_SUBMODE { 915091Sgblack@eecs.umich.edu 0x0: UD2(); 922022SN/A default: decode MODRM_REG { 932022SN/A 0x0: ADD_LOCKED(Mb,Ib); 942224SN/A 0x1: OR_LOCKED(Mb,Ib); 952224SN/A 0x2: ADC_LOCKED(Mb,Ib); 962022SN/A 0x3: SBB_LOCKED(Mb,Ib); 972224SN/A 0x4: AND_LOCKED(Mb,Ib); 982022SN/A 0x5: SUB_LOCKED(Mb,Ib); 993931Ssaidi@eecs.umich.edu 0x6: XOR_LOCKED(Mb,Ib); 1002224SN/A } 1012224SN/A } 1022224SN/A //0x3: group1_Ev_Ib(); 1032022SN/A 0x3: decode MODRM_REG { 1042224SN/A 0x0: ADD_LOCKED(Mv,Ib); 1052224SN/A 0x1: OR_LOCKED(Mv,Ib); 1062224SN/A 0x2: ADC_LOCKED(Mv,Ib); 1072224SN/A 0x3: SBB_LOCKED(Mv,Ib); 1082224SN/A 0x4: AND_LOCKED(Mv,Ib); 1092022SN/A 0x5: SUB_LOCKED(Mv,Ib); 1102022SN/A 0x6: XOR_LOCKED(Mv,Ib); 1112022SN/A } 1122022SN/A 0x6: XCHG_LOCKED(Mb,Gb); 1132022SN/A 0x7: XCHG_LOCKED(Mv,Gv); 1142022SN/A } 1152022SN/A 0x1E: decode OPCODE_OP_BOTTOM3 { 1162022SN/A //0x6: group3_Eb(); 1173272Sgblack@eecs.umich.edu 0x6: decode MODRM_REG { 1183272Sgblack@eecs.umich.edu 0x2: NOT_LOCKED(Mb); 1193272Sgblack@eecs.umich.edu 0x3: NEG_LOCKED(Mb); 1203272Sgblack@eecs.umich.edu } 1213272Sgblack@eecs.umich.edu //0x7: group3_Ev(); 1222022SN/A 0x7: decode MODRM_REG { 1232022SN/A 0x2: NOT_LOCKED(Mv); 1244362Sgblack@eecs.umich.edu 0x3: NEG_LOCKED(Mv); 1253792Sgblack@eecs.umich.edu } 1262022SN/A } 1272022SN/A 0x1F: decode OPCODE_OP_BOTTOM3 { 1282022SN/A 0x6: decode MODRM_REG { 1292022SN/A 0x0: INC_LOCKED(Mb); 1302022SN/A 0x1: DEC_LOCKED(Mb); 1314008Ssaidi@eecs.umich.edu default: UD2(); 1324008Ssaidi@eecs.umich.edu } 1334008Ssaidi@eecs.umich.edu //0x7: group5(); 1344011Ssaidi@eecs.umich.edu 0x7: decode MODRM_REG { 1354008Ssaidi@eecs.umich.edu 0x0: INC_LOCKED(Mv); 1364394Ssaidi@eecs.umich.edu 0x1: DEC_LOCKED(Mv); 1374008Ssaidi@eecs.umich.edu } 1384394Ssaidi@eecs.umich.edu } 1394394Ssaidi@eecs.umich.edu } 1404394Ssaidi@eecs.umich.edu 0x2: decode OPCODE_PREFIXA { 1414394Ssaidi@eecs.umich.edu 0x0F: decode OPCODE_OP_TOP5 { 1424008Ssaidi@eecs.umich.edu 0x15: decode OPCODE_OP_BOTTOM3 { 1434394Ssaidi@eecs.umich.edu 0x3: BTS_LOCKED(Mv,Gv); 1444394Ssaidi@eecs.umich.edu } 1454008Ssaidi@eecs.umich.edu 0x16: decode OPCODE_OP_BOTTOM3 { 1464011Ssaidi@eecs.umich.edu 0x0: CMPXCHG_LOCKED(Mb,Gb); 1474008Ssaidi@eecs.umich.edu 0x1: CMPXCHG_LOCKED(Mv,Gv); 1484011Ssaidi@eecs.umich.edu 0x3: BTR_LOCKED(Mv,Gv); 1494011Ssaidi@eecs.umich.edu } 1504008Ssaidi@eecs.umich.edu 0x17: decode OPCODE_OP_BOTTOM3 { 1514394Ssaidi@eecs.umich.edu 0x2: decode MODRM_REG { 1524008Ssaidi@eecs.umich.edu 0x5: BTS_LOCKED(Mv,Ib); 1534362Sgblack@eecs.umich.edu 0x6: BTR_LOCKED(Mv,Ib); 1544008Ssaidi@eecs.umich.edu 0x7: BTC_LOCKED(Mv,Ib); 1554008Ssaidi@eecs.umich.edu } 1564008Ssaidi@eecs.umich.edu 0x3: BTC_LOCKED(Mv,Gv); 1574008Ssaidi@eecs.umich.edu } 1584008Ssaidi@eecs.umich.edu 0x18: decode OPCODE_OP_BOTTOM3 { 1594008Ssaidi@eecs.umich.edu 0x0: XADD_LOCKED(Mb,Gb); 160 0x1: XADD_LOCKED(Mv,Gv); 161 //0x7: group9(); 162 0x7: decode MODRM_REG { 163 0x1: WarnUnimpl::cmpxchg_Mq_LOCKED(); 164 } 165 } 166 } 167 default: M5InternalError::error( 168 {{"Unexpected first opcode byte in two byte opcode!"}}); 169 } 170 } 171 } 172} 173