locked_opcodes.isa revision 6098
16098Sgblack@eecs.umich.edu// Copyright (c) 2007-2008 The Hewlett-Packard Development Company 26098Sgblack@eecs.umich.edu// All rights reserved. 36098Sgblack@eecs.umich.edu// 46098Sgblack@eecs.umich.edu// Redistribution and use of this software in source and binary forms, 56098Sgblack@eecs.umich.edu// with or without modification, are permitted provided that the 66098Sgblack@eecs.umich.edu// following conditions are met: 76098Sgblack@eecs.umich.edu// 86098Sgblack@eecs.umich.edu// The software must be used only for Non-Commercial Use which means any 96098Sgblack@eecs.umich.edu// use which is NOT directed to receiving any direct monetary 106098Sgblack@eecs.umich.edu// compensation for, or commercial advantage from such use. Illustrative 116098Sgblack@eecs.umich.edu// examples of non-commercial use are academic research, personal study, 126098Sgblack@eecs.umich.edu// teaching, education and corporate research & development. 136098Sgblack@eecs.umich.edu// Illustrative examples of commercial use are distributing products for 146098Sgblack@eecs.umich.edu// commercial advantage and providing services using the software for 156098Sgblack@eecs.umich.edu// commercial advantage. 166098Sgblack@eecs.umich.edu// 176098Sgblack@eecs.umich.edu// If you wish to use this software or functionality therein that may be 186098Sgblack@eecs.umich.edu// covered by patents for commercial use, please contact: 196098Sgblack@eecs.umich.edu// Director of Intellectual Property Licensing 206098Sgblack@eecs.umich.edu// Office of Strategy and Technology 216098Sgblack@eecs.umich.edu// Hewlett-Packard Company 226098Sgblack@eecs.umich.edu// 1501 Page Mill Road 236098Sgblack@eecs.umich.edu// Palo Alto, California 94304 246098Sgblack@eecs.umich.edu// 256098Sgblack@eecs.umich.edu// Redistributions of source code must retain the above copyright notice, 266098Sgblack@eecs.umich.edu// this list of conditions and the following disclaimer. Redistributions 276098Sgblack@eecs.umich.edu// in binary form must reproduce the above copyright notice, this list of 286098Sgblack@eecs.umich.edu// conditions and the following disclaimer in the documentation and/or 296098Sgblack@eecs.umich.edu// other materials provided with the distribution. Neither the name of 306098Sgblack@eecs.umich.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 316098Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 326098Sgblack@eecs.umich.edu// this software without specific prior written permission. No right of 336098Sgblack@eecs.umich.edu// sublicense is granted herewith. Derivatives of the software and 346098Sgblack@eecs.umich.edu// output created using the software may be prepared, but only for 356098Sgblack@eecs.umich.edu// Non-Commercial Uses. Derivatives of the software may be shared with 366098Sgblack@eecs.umich.edu// others provided: (i) the others agree to abide by the list of 376098Sgblack@eecs.umich.edu// conditions herein which includes the Non-Commercial Use restrictions; 386098Sgblack@eecs.umich.edu// and (ii) such Derivatives of the software include the above copyright 396098Sgblack@eecs.umich.edu// notice to acknowledge the contribution from this software where 406098Sgblack@eecs.umich.edu// applicable, this list of conditions and the disclaimer below. 416098Sgblack@eecs.umich.edu// 426098Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 436098Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 446098Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 456098Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 466098Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 476098Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 486098Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 496098Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 506098Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 516098Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 526098Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 536098Sgblack@eecs.umich.edu// 546098Sgblack@eecs.umich.edu// Authors: Gabe Black 556098Sgblack@eecs.umich.edu 566098Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////// 576098Sgblack@eecs.umich.edu// 586098Sgblack@eecs.umich.edu// Decode opcodes with the lock prefix. Opcodes which shouldn't have that 596098Sgblack@eecs.umich.edu// prefix should effectively decode to UD2. 606098Sgblack@eecs.umich.edu// 616098Sgblack@eecs.umich.edu 626098Sgblack@eecs.umich.edu// All the memory references in these instructions happen through modrm bytes. 636098Sgblack@eecs.umich.edu// We therefore only need to make sure the modrm byte encodes a memory 646098Sgblack@eecs.umich.edu// reference to make sure these are the memory forms of these instructions. 656098Sgblack@eecs.umich.edu0x1: decode MODRM_MOD { 666098Sgblack@eecs.umich.edu format Inst { 676098Sgblack@eecs.umich.edu 0x3: UD2(); 686098Sgblack@eecs.umich.edu default: decode OPCODE_NUM { 696098Sgblack@eecs.umich.edu 0x1: decode OPCODE_OP_TOP5 { 706098Sgblack@eecs.umich.edu 0x00: decode OPCODE_OP_BOTTOM3 { 716098Sgblack@eecs.umich.edu default: MultiInst::ADD_LOCKED(OPCODE_OP_BOTTOM3, 726098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 736098Sgblack@eecs.umich.edu } 746098Sgblack@eecs.umich.edu 0x01: decode OPCODE_OP_BOTTOM3 { 756098Sgblack@eecs.umich.edu default: MultiInst::OR_LOCKED(OPCODE_OP_BOTTOM3, 766098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 776098Sgblack@eecs.umich.edu } 786098Sgblack@eecs.umich.edu 0x02: decode OPCODE_OP_BOTTOM3 { 796098Sgblack@eecs.umich.edu default: MultiInst::ADC_LOCKED(OPCODE_OP_BOTTOM3, 806098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 816098Sgblack@eecs.umich.edu } 826098Sgblack@eecs.umich.edu 0x03: decode OPCODE_OP_BOTTOM3 { 836098Sgblack@eecs.umich.edu default: MultiInst::SBB_LOCKED(OPCODE_OP_BOTTOM3, 846098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 856098Sgblack@eecs.umich.edu } 866098Sgblack@eecs.umich.edu 0x04: decode OPCODE_OP_BOTTOM3 { 876098Sgblack@eecs.umich.edu default: MultiInst::AND_LOCKED(OPCODE_OP_BOTTOM3, 886098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 896098Sgblack@eecs.umich.edu } 906098Sgblack@eecs.umich.edu 0x05: decode OPCODE_OP_BOTTOM3 { 916098Sgblack@eecs.umich.edu default: MultiInst::SUB_LOCKED(OPCODE_OP_BOTTOM3, 926098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 936098Sgblack@eecs.umich.edu } 946098Sgblack@eecs.umich.edu 0x06: decode OPCODE_OP_BOTTOM3 { 956098Sgblack@eecs.umich.edu default: MultiInst::XOR_LOCKED(OPCODE_OP_BOTTOM3, 966098Sgblack@eecs.umich.edu [Mb,Gb], [Mv,Gv]); 976098Sgblack@eecs.umich.edu } 986098Sgblack@eecs.umich.edu 0x10: decode OPCODE_OP_BOTTOM3 { 996098Sgblack@eecs.umich.edu 0x0: decode MODRM_REG { 1006098Sgblack@eecs.umich.edu 0x0: ADD_LOCKED(Mb,Ib); 1016098Sgblack@eecs.umich.edu 0x1: OR_LOCKED(Mb,Ib); 1026098Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mb,Ib); 1036098Sgblack@eecs.umich.edu 0x3: SBB_LOCKED(Mb,Ib); 1046098Sgblack@eecs.umich.edu 0x4: AND_LOCKED(Mb,Ib); 1056098Sgblack@eecs.umich.edu 0x5: SUB_LOCKED(Mb,Ib); 1066098Sgblack@eecs.umich.edu 0x6: XOR_LOCKED(Mb,Ib); 1076098Sgblack@eecs.umich.edu } 1086098Sgblack@eecs.umich.edu 0x1: decode MODRM_REG { 1096098Sgblack@eecs.umich.edu 0x0: ADD_LOCKED(Mv,Iz); 1106098Sgblack@eecs.umich.edu 0x1: OR_LOCKED(Mv,Iz); 1116098Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mv,Iz); 1126098Sgblack@eecs.umich.edu 0x3: SBB_LOCKED(Mv,Iz); 1136098Sgblack@eecs.umich.edu 0x4: AND_LOCKED(Mv,Iz); 1146098Sgblack@eecs.umich.edu 0x5: SUB_LOCKED(Mv,Iz); 1156098Sgblack@eecs.umich.edu 0x6: XOR_LOCKED(Mv,Iz); 1166098Sgblack@eecs.umich.edu } 1176098Sgblack@eecs.umich.edu 0x2: decode MODE_SUBMODE { 1186098Sgblack@eecs.umich.edu 0x0: UD2(); 1196098Sgblack@eecs.umich.edu default: decode MODRM_REG { 1206098Sgblack@eecs.umich.edu 0x0: ADD_LOCKED(Mb,Ib); 1216098Sgblack@eecs.umich.edu 0x1: OR_LOCKED(Mb,Ib); 1226098Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mb,Ib); 1236098Sgblack@eecs.umich.edu 0x3: SBB_LOCKED(Mb,Ib); 1246098Sgblack@eecs.umich.edu 0x4: AND_LOCKED(Mb,Ib); 1256098Sgblack@eecs.umich.edu 0x5: SUB_LOCKED(Mb,Ib); 1266098Sgblack@eecs.umich.edu 0x6: XOR_LOCKED(Mb,Ib); 1276098Sgblack@eecs.umich.edu } 1286098Sgblack@eecs.umich.edu } 1296098Sgblack@eecs.umich.edu //0x3: group1_Ev_Ib(); 1306098Sgblack@eecs.umich.edu 0x3: decode MODRM_REG { 1316098Sgblack@eecs.umich.edu 0x0: ADD_LOCKED(Mv,Ib); 1326098Sgblack@eecs.umich.edu 0x1: OR_LOCKED(Mv,Ib); 1336098Sgblack@eecs.umich.edu 0x2: ADC_LOCKED(Mv,Ib); 1346098Sgblack@eecs.umich.edu 0x3: SBB_LOCKED(Mv,Ib); 1356098Sgblack@eecs.umich.edu 0x4: AND_LOCKED(Mv,Ib); 1366098Sgblack@eecs.umich.edu 0x5: SUB_LOCKED(Mv,Ib); 1376098Sgblack@eecs.umich.edu 0x6: XOR_LOCKED(Mv,Ib); 1386098Sgblack@eecs.umich.edu } 1396098Sgblack@eecs.umich.edu 0x6: XCHG_LOCKED(Mb,Gb); 1406098Sgblack@eecs.umich.edu 0x7: XCHG_LOCKED(Mv,Gv); 1416098Sgblack@eecs.umich.edu } 1426098Sgblack@eecs.umich.edu 0x1E: decode OPCODE_OP_BOTTOM3 { 1436098Sgblack@eecs.umich.edu //0x6: group3_Eb(); 1446098Sgblack@eecs.umich.edu 0x6: decode MODRM_REG { 1456098Sgblack@eecs.umich.edu 0x2: NOT_LOCKED(Mb); 1466098Sgblack@eecs.umich.edu 0x3: NEG_LOCKED(Mb); 1476098Sgblack@eecs.umich.edu } 1486098Sgblack@eecs.umich.edu //0x7: group3_Ev(); 1496098Sgblack@eecs.umich.edu 0x7: decode MODRM_REG { 1506098Sgblack@eecs.umich.edu 0x2: NOT_LOCKED(Mv); 1516098Sgblack@eecs.umich.edu 0x3: NEG_LOCKED(Mv); 1526098Sgblack@eecs.umich.edu } 1536098Sgblack@eecs.umich.edu } 1546098Sgblack@eecs.umich.edu 0x1F: decode OPCODE_OP_BOTTOM3 { 1556098Sgblack@eecs.umich.edu 0x6: decode MODRM_REG { 1566098Sgblack@eecs.umich.edu 0x0: INC_LOCKED(Mb); 1576098Sgblack@eecs.umich.edu 0x1: DEC_LOCKED(Mb); 1586098Sgblack@eecs.umich.edu default: UD2(); 1596098Sgblack@eecs.umich.edu } 1606098Sgblack@eecs.umich.edu //0x7: group5(); 1616098Sgblack@eecs.umich.edu 0x7: decode MODRM_REG { 1626098Sgblack@eecs.umich.edu 0x0: INC_LOCKED(Mv); 1636098Sgblack@eecs.umich.edu 0x1: DEC_LOCKED(Mv); 1646098Sgblack@eecs.umich.edu } 1656098Sgblack@eecs.umich.edu } 1666098Sgblack@eecs.umich.edu } 1676098Sgblack@eecs.umich.edu 0x2: decode OPCODE_PREFIXA { 1686098Sgblack@eecs.umich.edu 0x0F: decode OPCODE_OP_TOP5 { 1696098Sgblack@eecs.umich.edu 0x15: decode OPCODE_OP_BOTTOM3 { 1706098Sgblack@eecs.umich.edu 0x3: BTS_LOCKED(Mv,Gv); 1716098Sgblack@eecs.umich.edu } 1726098Sgblack@eecs.umich.edu 0x16: decode OPCODE_OP_BOTTOM3 { 1736098Sgblack@eecs.umich.edu 0x0: CMPXCHG_LOCKED(Mb,Gb); 1746098Sgblack@eecs.umich.edu 0x1: CMPXCHG_LOCKED(Mv,Gv); 1756098Sgblack@eecs.umich.edu 0x3: BTR_LOCKED(Mv,Gv); 1766098Sgblack@eecs.umich.edu } 1776098Sgblack@eecs.umich.edu 0x17: decode OPCODE_OP_BOTTOM3 { 1786098Sgblack@eecs.umich.edu 0x2: decode MODRM_REG { 1796098Sgblack@eecs.umich.edu 0x5: BTS_LOCKED(Mv,Ib); 1806098Sgblack@eecs.umich.edu 0x6: BTR_LOCKED(Mv,Ib); 1816098Sgblack@eecs.umich.edu 0x7: BTC_LOCKED(Mv,Ib); 1826098Sgblack@eecs.umich.edu } 1836098Sgblack@eecs.umich.edu 0x3: BTC_LOCKED(Mv,Gv); 1846098Sgblack@eecs.umich.edu } 1856098Sgblack@eecs.umich.edu 0x18: decode OPCODE_OP_BOTTOM3 { 1866098Sgblack@eecs.umich.edu 0x0: XADD_LOCKED(Mb,Gb); 1876098Sgblack@eecs.umich.edu 0x1: XADD_LOCKED(Mv,Gv); 1886098Sgblack@eecs.umich.edu //0x7: group9(); 1896098Sgblack@eecs.umich.edu 0x7: decode MODRM_REG { 1906098Sgblack@eecs.umich.edu 0x1: WarnUnimpl::cmpxchg_Mq_LOCKED(); 1916098Sgblack@eecs.umich.edu } 1926098Sgblack@eecs.umich.edu } 1936098Sgblack@eecs.umich.edu } 1946098Sgblack@eecs.umich.edu default: M5InternalError::error( 1956098Sgblack@eecs.umich.edu {{"Unexpected first opcode byte in two byte opcode!"}}); 1966098Sgblack@eecs.umich.edu } 1976098Sgblack@eecs.umich.edu } 1986098Sgblack@eecs.umich.edu } 1996098Sgblack@eecs.umich.edu} 200