1// Copyright (c) 2008 The Regents of The University of Michigan 2// All rights reserved. 3// 4// Redistribution and use in source and binary forms, with or without 5// modification, are permitted provided that the following conditions are 6// met: redistributions of source code must retain the above copyright 7// notice, this list of conditions and the following disclaimer; 8// redistributions in binary form must reproduce the above copyright 9// notice, this list of conditions and the following disclaimer in the 10// documentation and/or other materials provided with the distribution; 11// neither the name of the copyright holders nor the names of its 12// contributors may be used to endorse or promote products derived from 13// this software without specific prior written permission. 14// 15// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26// 27// Authors: Gabe Black 28 29// Copyright (c) 2007-2008 The Hewlett-Packard Development Company 30// All rights reserved. 31// 32// Redistribution and use of this software in source and binary forms, 33// with or without modification, are permitted provided that the 34// following conditions are met: 35// 36// The software must be used only for Non-Commercial Use which means any 37// use which is NOT directed to receiving any direct monetary 38// compensation for, or commercial advantage from such use. Illustrative 39// examples of non-commercial use are academic research, personal study, 40// teaching, education and corporate research & development. 41// Illustrative examples of commercial use are distributing products for 42// commercial advantage and providing services using the software for 43// commercial advantage. 44// 45// If you wish to use this software or functionality therein that may be 46// covered by patents for commercial use, please contact: 47// Director of Intellectual Property Licensing 48// Office of Strategy and Technology 49// Hewlett-Packard Company 50// 1501 Page Mill Road 51// Palo Alto, California 94304 52// 53// Redistributions of source code must retain the above copyright notice, 54// this list of conditions and the following disclaimer. Redistributions 55// in binary form must reproduce the above copyright notice, this list of 56// conditions and the following disclaimer in the documentation and/or 57// other materials provided with the distribution. Neither the name of 58// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 59// contributors may be used to endorse or promote products derived from 60// this software without specific prior written permission. No right of 61// sublicense is granted herewith. Derivatives of the software and 62// output created using the software may be prepared, but only for 63// Non-Commercial Uses. Derivatives of the software may be shared with 64// others provided: (i) the others agree to abide by the list of 65// conditions herein which includes the Non-Commercial Use restrictions; 66// and (ii) such Derivatives of the software include the above copyright 67// notice to acknowledge the contribution from this software where 68// applicable, this list of conditions and the disclaimer below. 69// 70// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 71// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 72// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 73// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 74// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 75// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 76// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 77// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 78// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 79// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 80// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 81// 82// Authors: Gabe Black 83 84//////////////////////////////////////////////////////////////////// 85// 86// Decode the two byte opcodes 87// 880x2: decode OPCODE_PREFIXA { 89 0x0F: decode OPCODE_OP_TOP5 { 90 format WarnUnimpl { 91 0x00: decode OPCODE_OP_BOTTOM3 { 92 //0x00: group6(); 93 0x00: decode MODRM_REG { 94 0x0: sldt_Mw_or_Rv(); 95 0x1: str_Mw_or_Rv(); 96 0x2: Inst::LLDT(Ew); 97 0x3: Inst::LTR(Ew); 98 0x4: verr_Mw_or_Rv(); 99 0x5: verw_Mw_or_Rv(); 100 //0x6: jmpe_Ev(); // IA-64 101 default: Inst::UD2(); 102 } 103 //0x01: group7(); // Ugly, ugly, ugly... 104 0x01: decode MODRM_MOD { 105 0x3: decode MODRM_REG { 106 0x0: decode MODRM_RM { 107 0x1: vmcall(); 108 0x2: vmlaunch(); 109 0x3: vmresume(); 110 0x4: vmxoff(); 111 default: Inst::UD2(); 112 } 113 0x1: decode MODRM_RM { 114 0x0: monitor(); 115 0x1: mwait(); 116 default: Inst::UD2(); 117 } 118 0x3: decode MODRM_RM { 119 0x0: vmrun(); 120 0x1: vmmcall(); 121 0x2: vmload(); 122 0x3: vmsave(); 123 0x4: stgi(); 124 0x5: clgi(); 125 0x6: skinit(); 126 0x7: invlpga(); 127 } 128 0x4: Inst::SMSW(Rv); 129 0x6: Inst::LMSW(Rv); 130 0x7: decode MODRM_RM { 131 0x0: Inst::SWAPGS(); 132 0x1: rdtscp(); 133 default: Inst::UD2(); 134 } 135 default: Inst::UD2(); 136 } 137 default: decode MODRM_REG { 138 0x0: sgdt_Ms(); 139 0x1: sidt_Ms(); 140 0x2: decode MODE_SUBMODE { 141 0x0: Inst::LGDT(M); 142 default: decode OPSIZE { 143 // 16 bit operand sizes are special, but only 144 // in legacy and compatability modes. 145 0x2: Inst::LGDT_16(M); 146 default: Inst::LGDT(M); 147 } 148 } 149 0x3: decode MODE_SUBMODE { 150 0x0: Inst::LIDT(M); 151 default: decode OPSIZE { 152 // 16 bit operand sizes are special, but only 153 // in legacy and compatability modes. 154 0x2: Inst::LIDT_16(M); 155 default: Inst::LIDT(M); 156 } 157 } 158 0x4: Inst::SMSW(Mw); 159 0x6: Inst::LMSW(Mw); 160 0x7: Inst::INVLPG(M); 161 default: Inst::UD2(); 162 } 163 } 164 0x02: lar_Gv_Ew(); 165 0x03: lsl_Gv_Ew(); 166 // sandpile.org doesn't seem to know what this is...? We'll 167 // use it for pseudo instructions. We've got 16 bits of space 168 // to play with so there can be quite a few pseudo 169 // instructions. 170 //0x04: loadall_or_reset_or_hang(); 171 0x4: decode IMMEDIATE { 172 format BasicOperate { 173#if FULL_SYSTEM 174 0x00: m5arm({{ 175 PseudoInst::arm(xc->tcBase()); 176 }}, IsNonSpeculative); 177 0x01: m5quiesce({{ 178 PseudoInst::quiesce(xc->tcBase()); 179 }}, IsNonSpeculative); 180 0x02: m5quiesceNs({{ 181 PseudoInst::quiesceNs(xc->tcBase(), Rdi); 182 }}, IsNonSpeculative); 183 0x03: m5quiesceCycle({{ 184 PseudoInst::quiesceCycles(xc->tcBase(), Rdi); 185 }}, IsNonSpeculative); 186 0x04: m5quiesceTime({{ 187 Rax = PseudoInst::quiesceTime(xc->tcBase()); 188 }}, IsNonSpeculative); 189#endif 190 0x07: m5rpns({{ 191 Rax = PseudoInst::rpns(xc->tcBase()); 192 }}, IsNonSpeculative); 193 0x21: m5exit({{ 194 PseudoInst::m5exit(xc->tcBase(), Rdi); 195 }}, IsNonSpeculative); 196#if FULL_SYSTEM 197 0x30: m5initparam({{ 198 Rax = xc->tcBase()->getCpuPtr()-> 199 system->init_param; 200 }}, IsNonSpeculative); 201 0x31: m5loadsymbol({{ 202 PseudoInst::loadsymbol(xc->tcBase()); 203 }}, IsNonSpeculative); 204#endif 205 0x40: m5resetstats({{ 206 PseudoInst::resetstats(xc->tcBase(), Rdi, Rsi); 207 }}, IsNonSpeculative); 208 0x41: m5dumpstats({{ 209 PseudoInst::dumpstats(xc->tcBase(), Rdi, Rsi); 210 }}, IsNonSpeculative); 211 0x42: m5dumpresetstats({{ 212 PseudoInst::dumpresetstats(xc->tcBase(), Rdi, Rsi); 213 }}, IsNonSpeculative); 214 0x43: m5checkpoint({{ 215 PseudoInst::m5checkpoint(xc->tcBase(), Rdi, Rsi); 216 }}, IsNonSpeculative); 217#if FULL_SYSTEM 218 0x50: m5readfile({{ 219 Rax = PseudoInst::readfile( 220 xc->tcBase(), Rdi, Rsi, Rdx); 221 }}, IsNonSpeculative); 222#endif 223 0x51: m5debugbreak({{ 224 PseudoInst::debugbreak(xc->tcBase()); 225 }}, IsNonSpeculative); 226 0x52: m5switchcpu({{ 227 PseudoInst::switchcpu(xc->tcBase()); 228 }}, IsNonSpeculative); 229#if FULL_SYSTEM 230 0x53: m5addsymbol({{ 231 PseudoInst::addsymbol(xc->tcBase(), Rdi, Rsi); 232 }}, IsNonSpeculative); 233#endif 234 0x54: m5panic({{ 235 panic("M5 panic instruction called at pc=%#x.\n", 236 xc->readPC()); 237 }}, IsNonSpeculative); 238 0x55: m5reserved1({{ 239 warn("M5 reserved opcode 1 ignored.\n"); 240 }}, IsNonSpeculative); 241 0x56: m5reserved2({{ 242 warn("M5 reserved opcode 2 ignored.\n"); 243 }}, IsNonSpeculative); 244 0x57: m5reserved3({{ 245 warn("M5 reserved opcode 3 ignored.\n"); 246 }}, IsNonSpeculative); 247 0x58: m5reserved4({{ 248 warn("M5 reserved opcode 4 ignored.\n"); 249 }}, IsNonSpeculative); 250 0x59: m5reserved5({{ 251 warn("M5 reserved opcode 5 ignored.\n"); 252 }}, IsNonSpeculative); 253 default: Inst::UD2(); 254 } 255 } 256#if FULL_SYSTEM 257 0x05: decode MODE_MODE { 258 0x0: decode MODE_SUBMODE { 259 0x0: Inst::SYSCALL_64(); 260 0x1: Inst::SYSCALL_COMPAT(); 261 } 262 0x1: Inst::SYSCALL_LEGACY(); 263 } 264#else 265 0x05: SyscallInst::syscall('xc->syscall(Rax)', IsSyscall); 266#endif 267 0x06: Inst::CLTS(); 268 0x07: decode MODE_SUBMODE { 269 0x0: decode OPSIZE { 270 // Return to 64 bit mode. 271 0x8: Inst::SYSRET_TO_64(); 272 // Return to compatibility mode. 273 default: Inst::SYSRET_TO_COMPAT(); 274 } 275 default: Inst::SYSRET_NON_64(); 276 } 277 } 278 0x01: decode OPCODE_OP_BOTTOM3 { 279 0x0: invd(); 280 0x1: wbinvd(); 281 0x2: Inst::UD2(); 282 0x3: Inst::UD2(); 283 0x4: Inst::UD2(); 284 0x5: Inst::PREFETCH(Mb); 285 0x6: FailUnimpl::femms(); 286 0x7: FailUnimpl::threednow(); 287 } 288 0x02: decode LEGACY_DECODEVAL { 289 // no prefix 290 0x0: decode OPCODE_OP_BOTTOM3 { 291 0x0: movups_Vo_Wo(); 292 0x1: movups_Wo_Vo(); 293 0x2: decode MODRM_MOD { 294 0x3: movhlps_Vq_VRq(); 295 default: movlps_Vq_Mq(); 296 } 297 0x3: movlps_Mq_Vq(); 298 0x4: Inst::UNPCKLPS(Vps,Wq); 299 0x5: Inst::UNPCKHPS(Vpd,Wq); 300 0x6: decode MODRM_MOD { 301 0x3: movlhps_Vq_VRq(); 302 default: movhps_Vq_Mq(); 303 } 304 0x7: movhps_Mq_Vq(); 305 } 306 // repe (0xF3) 307 0x4: decode OPCODE_OP_BOTTOM3 { 308 0x0: movss_Vd_Wd(); 309 0x1: movss_Wd_Vd(); 310 0x2: movsldup_Vo_Wo(); 311 0x6: movshdup_Vo_Wo(); 312 default: Inst::UD2(); 313 } 314 // operand size (0x66) 315 0x1: decode OPCODE_OP_BOTTOM3 { 316 0x0: movupd_Vo_Wo(); 317 0x1: movupd_Wo_Vo(); 318 0x2: Inst::MOVLPD(Vq,Mq); 319 0x3: Inst::MOVLPD(Mq,Vq); 320 0x4: Inst::UNPCKLPD(Vo,Wq); 321 0x5: Inst::UNPCKHPD(Vo,Wo); 322 0x6: movhpd_Vq_Mq(); 323 0x7: movhpd_Mq_Vq(); 324 } 325 // repne (0xF2) 326 0x8: decode OPCODE_OP_BOTTOM3 { 327 0x0: Inst::MOVSD(Vq,Wq); 328 0x1: Inst::MOVSD(Wq,Vq); 329 0x2: movddup_Vo_Wq(); 330 default: Inst::UD2(); 331 } 332 default: Inst::UD2(); 333 } 334 0x03: decode OPCODE_OP_BOTTOM3 { 335 //group17(); 336 0x0: decode MODRM_REG { 337 0x0: prefetch_nta(); 338 0x1: Inst::PREFETCH_T0(Mb); 339 0x2: prefetch_t1(); 340 0x3: prefetch_t2(); 341 default: Inst::HINT_NOP(); 342 } 343 0x1: Inst::HINT_NOP(); 344 0x2: Inst::HINT_NOP(); 345 0x3: Inst::HINT_NOP(); 346 0x4: Inst::HINT_NOP(); 347 0x5: Inst::HINT_NOP(); 348 0x6: Inst::HINT_NOP(); 349 0x7: Inst::HINT_NOP(); 350 } 351 0x04: decode LEGACY_DECODEVAL { 352 // no prefix 353 0x0: decode OPCODE_OP_BOTTOM3 { 354 0x0: Inst::MOV(Rd,Cd); 355 0x1: Inst::MOV(Rd,Dd); 356 0x2: Inst::MOV(Cd,Rd); 357 0x3: Inst::MOV(Dd,Rd); 358 0x4: mov_Rd_Td(); 359 0x6: mov_Td_Rd(); 360 default: Inst::UD2(); 361 } 362 // lock prefix (0xF0) 363 0x2: decode OPCODE_OP_BOTTOM3 { 364 0x0: mov_Rd_CR8D(); 365 0x2: mov_CR8D_Rd(); 366 } 367 default: Inst::UD2(); 368 } 369 0x05: decode LEGACY_DECODEVAL { 370 // no prefix 371 0x0: decode OPCODE_OP_BOTTOM3 { 372 //These moves should really use size o (octword), but 373 //because they are split in two, they use q (quadword). 374 0x0: Inst::MOVAPS(Vq,Wq); 375 0x1: Inst::MOVAPS(Wq,Vq);
| 1// Copyright (c) 2008 The Regents of The University of Michigan 2// All rights reserved. 3// 4// Redistribution and use in source and binary forms, with or without 5// modification, are permitted provided that the following conditions are 6// met: redistributions of source code must retain the above copyright 7// notice, this list of conditions and the following disclaimer; 8// redistributions in binary form must reproduce the above copyright 9// notice, this list of conditions and the following disclaimer in the 10// documentation and/or other materials provided with the distribution; 11// neither the name of the copyright holders nor the names of its 12// contributors may be used to endorse or promote products derived from 13// this software without specific prior written permission. 14// 15// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26// 27// Authors: Gabe Black 28 29// Copyright (c) 2007-2008 The Hewlett-Packard Development Company 30// All rights reserved. 31// 32// Redistribution and use of this software in source and binary forms, 33// with or without modification, are permitted provided that the 34// following conditions are met: 35// 36// The software must be used only for Non-Commercial Use which means any 37// use which is NOT directed to receiving any direct monetary 38// compensation for, or commercial advantage from such use. Illustrative 39// examples of non-commercial use are academic research, personal study, 40// teaching, education and corporate research & development. 41// Illustrative examples of commercial use are distributing products for 42// commercial advantage and providing services using the software for 43// commercial advantage. 44// 45// If you wish to use this software or functionality therein that may be 46// covered by patents for commercial use, please contact: 47// Director of Intellectual Property Licensing 48// Office of Strategy and Technology 49// Hewlett-Packard Company 50// 1501 Page Mill Road 51// Palo Alto, California 94304 52// 53// Redistributions of source code must retain the above copyright notice, 54// this list of conditions and the following disclaimer. Redistributions 55// in binary form must reproduce the above copyright notice, this list of 56// conditions and the following disclaimer in the documentation and/or 57// other materials provided with the distribution. Neither the name of 58// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 59// contributors may be used to endorse or promote products derived from 60// this software without specific prior written permission. No right of 61// sublicense is granted herewith. Derivatives of the software and 62// output created using the software may be prepared, but only for 63// Non-Commercial Uses. Derivatives of the software may be shared with 64// others provided: (i) the others agree to abide by the list of 65// conditions herein which includes the Non-Commercial Use restrictions; 66// and (ii) such Derivatives of the software include the above copyright 67// notice to acknowledge the contribution from this software where 68// applicable, this list of conditions and the disclaimer below. 69// 70// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 71// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 72// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 73// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 74// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 75// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 76// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 77// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 78// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 79// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 80// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 81// 82// Authors: Gabe Black 83 84//////////////////////////////////////////////////////////////////// 85// 86// Decode the two byte opcodes 87// 880x2: decode OPCODE_PREFIXA { 89 0x0F: decode OPCODE_OP_TOP5 { 90 format WarnUnimpl { 91 0x00: decode OPCODE_OP_BOTTOM3 { 92 //0x00: group6(); 93 0x00: decode MODRM_REG { 94 0x0: sldt_Mw_or_Rv(); 95 0x1: str_Mw_or_Rv(); 96 0x2: Inst::LLDT(Ew); 97 0x3: Inst::LTR(Ew); 98 0x4: verr_Mw_or_Rv(); 99 0x5: verw_Mw_or_Rv(); 100 //0x6: jmpe_Ev(); // IA-64 101 default: Inst::UD2(); 102 } 103 //0x01: group7(); // Ugly, ugly, ugly... 104 0x01: decode MODRM_MOD { 105 0x3: decode MODRM_REG { 106 0x0: decode MODRM_RM { 107 0x1: vmcall(); 108 0x2: vmlaunch(); 109 0x3: vmresume(); 110 0x4: vmxoff(); 111 default: Inst::UD2(); 112 } 113 0x1: decode MODRM_RM { 114 0x0: monitor(); 115 0x1: mwait(); 116 default: Inst::UD2(); 117 } 118 0x3: decode MODRM_RM { 119 0x0: vmrun(); 120 0x1: vmmcall(); 121 0x2: vmload(); 122 0x3: vmsave(); 123 0x4: stgi(); 124 0x5: clgi(); 125 0x6: skinit(); 126 0x7: invlpga(); 127 } 128 0x4: Inst::SMSW(Rv); 129 0x6: Inst::LMSW(Rv); 130 0x7: decode MODRM_RM { 131 0x0: Inst::SWAPGS(); 132 0x1: rdtscp(); 133 default: Inst::UD2(); 134 } 135 default: Inst::UD2(); 136 } 137 default: decode MODRM_REG { 138 0x0: sgdt_Ms(); 139 0x1: sidt_Ms(); 140 0x2: decode MODE_SUBMODE { 141 0x0: Inst::LGDT(M); 142 default: decode OPSIZE { 143 // 16 bit operand sizes are special, but only 144 // in legacy and compatability modes. 145 0x2: Inst::LGDT_16(M); 146 default: Inst::LGDT(M); 147 } 148 } 149 0x3: decode MODE_SUBMODE { 150 0x0: Inst::LIDT(M); 151 default: decode OPSIZE { 152 // 16 bit operand sizes are special, but only 153 // in legacy and compatability modes. 154 0x2: Inst::LIDT_16(M); 155 default: Inst::LIDT(M); 156 } 157 } 158 0x4: Inst::SMSW(Mw); 159 0x6: Inst::LMSW(Mw); 160 0x7: Inst::INVLPG(M); 161 default: Inst::UD2(); 162 } 163 } 164 0x02: lar_Gv_Ew(); 165 0x03: lsl_Gv_Ew(); 166 // sandpile.org doesn't seem to know what this is...? We'll 167 // use it for pseudo instructions. We've got 16 bits of space 168 // to play with so there can be quite a few pseudo 169 // instructions. 170 //0x04: loadall_or_reset_or_hang(); 171 0x4: decode IMMEDIATE { 172 format BasicOperate { 173#if FULL_SYSTEM 174 0x00: m5arm({{ 175 PseudoInst::arm(xc->tcBase()); 176 }}, IsNonSpeculative); 177 0x01: m5quiesce({{ 178 PseudoInst::quiesce(xc->tcBase()); 179 }}, IsNonSpeculative); 180 0x02: m5quiesceNs({{ 181 PseudoInst::quiesceNs(xc->tcBase(), Rdi); 182 }}, IsNonSpeculative); 183 0x03: m5quiesceCycle({{ 184 PseudoInst::quiesceCycles(xc->tcBase(), Rdi); 185 }}, IsNonSpeculative); 186 0x04: m5quiesceTime({{ 187 Rax = PseudoInst::quiesceTime(xc->tcBase()); 188 }}, IsNonSpeculative); 189#endif 190 0x07: m5rpns({{ 191 Rax = PseudoInst::rpns(xc->tcBase()); 192 }}, IsNonSpeculative); 193 0x21: m5exit({{ 194 PseudoInst::m5exit(xc->tcBase(), Rdi); 195 }}, IsNonSpeculative); 196#if FULL_SYSTEM 197 0x30: m5initparam({{ 198 Rax = xc->tcBase()->getCpuPtr()-> 199 system->init_param; 200 }}, IsNonSpeculative); 201 0x31: m5loadsymbol({{ 202 PseudoInst::loadsymbol(xc->tcBase()); 203 }}, IsNonSpeculative); 204#endif 205 0x40: m5resetstats({{ 206 PseudoInst::resetstats(xc->tcBase(), Rdi, Rsi); 207 }}, IsNonSpeculative); 208 0x41: m5dumpstats({{ 209 PseudoInst::dumpstats(xc->tcBase(), Rdi, Rsi); 210 }}, IsNonSpeculative); 211 0x42: m5dumpresetstats({{ 212 PseudoInst::dumpresetstats(xc->tcBase(), Rdi, Rsi); 213 }}, IsNonSpeculative); 214 0x43: m5checkpoint({{ 215 PseudoInst::m5checkpoint(xc->tcBase(), Rdi, Rsi); 216 }}, IsNonSpeculative); 217#if FULL_SYSTEM 218 0x50: m5readfile({{ 219 Rax = PseudoInst::readfile( 220 xc->tcBase(), Rdi, Rsi, Rdx); 221 }}, IsNonSpeculative); 222#endif 223 0x51: m5debugbreak({{ 224 PseudoInst::debugbreak(xc->tcBase()); 225 }}, IsNonSpeculative); 226 0x52: m5switchcpu({{ 227 PseudoInst::switchcpu(xc->tcBase()); 228 }}, IsNonSpeculative); 229#if FULL_SYSTEM 230 0x53: m5addsymbol({{ 231 PseudoInst::addsymbol(xc->tcBase(), Rdi, Rsi); 232 }}, IsNonSpeculative); 233#endif 234 0x54: m5panic({{ 235 panic("M5 panic instruction called at pc=%#x.\n", 236 xc->readPC()); 237 }}, IsNonSpeculative); 238 0x55: m5reserved1({{ 239 warn("M5 reserved opcode 1 ignored.\n"); 240 }}, IsNonSpeculative); 241 0x56: m5reserved2({{ 242 warn("M5 reserved opcode 2 ignored.\n"); 243 }}, IsNonSpeculative); 244 0x57: m5reserved3({{ 245 warn("M5 reserved opcode 3 ignored.\n"); 246 }}, IsNonSpeculative); 247 0x58: m5reserved4({{ 248 warn("M5 reserved opcode 4 ignored.\n"); 249 }}, IsNonSpeculative); 250 0x59: m5reserved5({{ 251 warn("M5 reserved opcode 5 ignored.\n"); 252 }}, IsNonSpeculative); 253 default: Inst::UD2(); 254 } 255 } 256#if FULL_SYSTEM 257 0x05: decode MODE_MODE { 258 0x0: decode MODE_SUBMODE { 259 0x0: Inst::SYSCALL_64(); 260 0x1: Inst::SYSCALL_COMPAT(); 261 } 262 0x1: Inst::SYSCALL_LEGACY(); 263 } 264#else 265 0x05: SyscallInst::syscall('xc->syscall(Rax)', IsSyscall); 266#endif 267 0x06: Inst::CLTS(); 268 0x07: decode MODE_SUBMODE { 269 0x0: decode OPSIZE { 270 // Return to 64 bit mode. 271 0x8: Inst::SYSRET_TO_64(); 272 // Return to compatibility mode. 273 default: Inst::SYSRET_TO_COMPAT(); 274 } 275 default: Inst::SYSRET_NON_64(); 276 } 277 } 278 0x01: decode OPCODE_OP_BOTTOM3 { 279 0x0: invd(); 280 0x1: wbinvd(); 281 0x2: Inst::UD2(); 282 0x3: Inst::UD2(); 283 0x4: Inst::UD2(); 284 0x5: Inst::PREFETCH(Mb); 285 0x6: FailUnimpl::femms(); 286 0x7: FailUnimpl::threednow(); 287 } 288 0x02: decode LEGACY_DECODEVAL { 289 // no prefix 290 0x0: decode OPCODE_OP_BOTTOM3 { 291 0x0: movups_Vo_Wo(); 292 0x1: movups_Wo_Vo(); 293 0x2: decode MODRM_MOD { 294 0x3: movhlps_Vq_VRq(); 295 default: movlps_Vq_Mq(); 296 } 297 0x3: movlps_Mq_Vq(); 298 0x4: Inst::UNPCKLPS(Vps,Wq); 299 0x5: Inst::UNPCKHPS(Vpd,Wq); 300 0x6: decode MODRM_MOD { 301 0x3: movlhps_Vq_VRq(); 302 default: movhps_Vq_Mq(); 303 } 304 0x7: movhps_Mq_Vq(); 305 } 306 // repe (0xF3) 307 0x4: decode OPCODE_OP_BOTTOM3 { 308 0x0: movss_Vd_Wd(); 309 0x1: movss_Wd_Vd(); 310 0x2: movsldup_Vo_Wo(); 311 0x6: movshdup_Vo_Wo(); 312 default: Inst::UD2(); 313 } 314 // operand size (0x66) 315 0x1: decode OPCODE_OP_BOTTOM3 { 316 0x0: movupd_Vo_Wo(); 317 0x1: movupd_Wo_Vo(); 318 0x2: Inst::MOVLPD(Vq,Mq); 319 0x3: Inst::MOVLPD(Mq,Vq); 320 0x4: Inst::UNPCKLPD(Vo,Wq); 321 0x5: Inst::UNPCKHPD(Vo,Wo); 322 0x6: movhpd_Vq_Mq(); 323 0x7: movhpd_Mq_Vq(); 324 } 325 // repne (0xF2) 326 0x8: decode OPCODE_OP_BOTTOM3 { 327 0x0: Inst::MOVSD(Vq,Wq); 328 0x1: Inst::MOVSD(Wq,Vq); 329 0x2: movddup_Vo_Wq(); 330 default: Inst::UD2(); 331 } 332 default: Inst::UD2(); 333 } 334 0x03: decode OPCODE_OP_BOTTOM3 { 335 //group17(); 336 0x0: decode MODRM_REG { 337 0x0: prefetch_nta(); 338 0x1: Inst::PREFETCH_T0(Mb); 339 0x2: prefetch_t1(); 340 0x3: prefetch_t2(); 341 default: Inst::HINT_NOP(); 342 } 343 0x1: Inst::HINT_NOP(); 344 0x2: Inst::HINT_NOP(); 345 0x3: Inst::HINT_NOP(); 346 0x4: Inst::HINT_NOP(); 347 0x5: Inst::HINT_NOP(); 348 0x6: Inst::HINT_NOP(); 349 0x7: Inst::HINT_NOP(); 350 } 351 0x04: decode LEGACY_DECODEVAL { 352 // no prefix 353 0x0: decode OPCODE_OP_BOTTOM3 { 354 0x0: Inst::MOV(Rd,Cd); 355 0x1: Inst::MOV(Rd,Dd); 356 0x2: Inst::MOV(Cd,Rd); 357 0x3: Inst::MOV(Dd,Rd); 358 0x4: mov_Rd_Td(); 359 0x6: mov_Td_Rd(); 360 default: Inst::UD2(); 361 } 362 // lock prefix (0xF0) 363 0x2: decode OPCODE_OP_BOTTOM3 { 364 0x0: mov_Rd_CR8D(); 365 0x2: mov_CR8D_Rd(); 366 } 367 default: Inst::UD2(); 368 } 369 0x05: decode LEGACY_DECODEVAL { 370 // no prefix 371 0x0: decode OPCODE_OP_BOTTOM3 { 372 //These moves should really use size o (octword), but 373 //because they are split in two, they use q (quadword). 374 0x0: Inst::MOVAPS(Vq,Wq); 375 0x1: Inst::MOVAPS(Wq,Vq);
|
376 0x2: decode MODRM_MOD { 377 0x3: cvtpi2pS_Vq_Pq(); 378 default: cvtpi2ps_Vq_Mq(); 379 }
| 376 0x2: Inst::CVTPI2PS(Vq,Qq);
|
380 0x3: movntps_Mo_Vo(); 381 0x4: cvttps2pi_Pq_Wq(); 382 0x5: cvtpS2pi_Pq_Wq(); 383 0x6: ucomiss_Vd_Wd(); 384 0x7: comiss_Vd_Wd(); 385 } 386 // repe (0xF3) 387 0x4: decode OPCODE_OP_BOTTOM3 {
| 377 0x3: movntps_Mo_Vo(); 378 0x4: cvttps2pi_Pq_Wq(); 379 0x5: cvtpS2pi_Pq_Wq(); 380 0x6: ucomiss_Vd_Wd(); 381 0x7: comiss_Vd_Wd(); 382 } 383 // repe (0xF3) 384 0x4: decode OPCODE_OP_BOTTOM3 {
|
388 0x2: cvtsi2ss_Vd_Ed();
| 385 0x2: Inst::CVTSI2SS(Vd,Ed);
|
389 0x4: cvttss2si_Gd_Wd(); 390 0x5: cvtss2si_Gd_Wd(); 391 default: Inst::UD2(); 392 } 393 // operand size (0x66) 394 0x1: decode OPCODE_OP_BOTTOM3 { 395 0x0: movapd_Vo_Wo(); 396 0x1: movapd_Wo_Vo();
| 386 0x4: cvttss2si_Gd_Wd(); 387 0x5: cvtss2si_Gd_Wd(); 388 default: Inst::UD2(); 389 } 390 // operand size (0x66) 391 0x1: decode OPCODE_OP_BOTTOM3 { 392 0x0: movapd_Vo_Wo(); 393 0x1: movapd_Wo_Vo();
|
397 0x2: decode MODRM_MOD { 398 0x3: cvtpi2pd_Vo_Pq(); 399 default: cvtpi2pd_Vo_Mq(); 400 }
| 394 0x2: Inst::CVTPI2PD(Vo,Qq);
|
401 0x3: movntpd_Mo_Vo(); 402 0x4: cvttpd2pi_Pq_Wo(); 403 0x5: cvtpd2pi_Pq_Wo(); 404 0x6: Inst::UCOMISD(Vq,Wq); 405 0x7: comisd_Vq_Wq(); 406 } 407 // repne (0xF2) 408 0x8: decode OPCODE_OP_BOTTOM3 { 409 // The size of the V operand should be q, not dp 410 0x2: Inst::CVTSI2SD(Vdp,Edp); 411 // The size of the W operand should be q, not dp 412 0x4: Inst::CVTTSD2SI(Gdp,Wdp); 413 0x5: cvtsd2si_Gd_Wq(); 414 default: Inst::UD2(); 415 } 416 default: Inst::UD2(); 417 } 418 0x06: decode OPCODE_OP_BOTTOM3 { 419 0x0: Inst::WRMSR(); 420 0x1: Inst::RDTSC(); 421 0x2: Inst::RDMSR(); 422 0x3: rdpmc(); 423#if FULL_SYSTEM 424 0x4: sysenter(); 425#else 426 0x4: SyscallInst::sysenter('xc->syscall(Rax)', IsSyscall); 427#endif 428 0x5: sysexit(); 429 0x6: Inst::UD2(); 430 0x7: getsec(); 431 } 432 0x07: decode OPCODE_OP_BOTTOM3 { 433 0x0: three_byte_opcode(); 434 0x1: three_byte_opcode(); 435 0x2: three_byte_opcode(); 436 0x3: three_byte_opcode(); 437 0x4: three_byte_opcode(); 438 0x5: three_byte_opcode(); 439 0x6: three_byte_opcode(); 440 0x7: three_byte_opcode(); 441 } 442 format Inst { 443 0x08: decode OPCODE_OP_BOTTOM3 { 444 0x0: CMOVO(Gv,Ev); 445 0x1: CMOVNO(Gv,Ev); 446 0x2: CMOVB(Gv,Ev); 447 0x3: CMOVNB(Gv,Ev); 448 0x4: CMOVZ(Gv,Ev); 449 0x5: CMOVNZ(Gv,Ev); 450 0x6: CMOVBE(Gv,Ev); 451 0x7: CMOVNBE(Gv,Ev); 452 } 453 0x09: decode OPCODE_OP_BOTTOM3 { 454 0x0: CMOVS(Gv,Ev); 455 0x1: CMOVNS(Gv,Ev); 456 0x2: CMOVP(Gv,Ev); 457 0x3: CMOVNP(Gv,Ev); 458 0x4: CMOVL(Gv,Ev); 459 0x5: CMOVNL(Gv,Ev); 460 0x6: CMOVLE(Gv,Ev); 461 0x7: CMOVNLE(Gv,Ev); 462 } 463 } 464 0x0A: decode LEGACY_DECODEVAL { 465 // no prefix 466 0x0: decode OPCODE_OP_BOTTOM3 { 467 0x0: movmskps_Gd_VRo(); 468 0x1: Inst::SQRTPS(Vo,Wo); 469 0x2: rqsrtps_Vo_Wo(); 470 0x3: rcpps_Vo_Wo(); 471 0x4: Inst::ANDPS(Vo,Wo); 472 0x5: Inst::ANDNPS(Vo,Wo); 473 0x6: Inst::ORPS(Vo,Wo); 474 0x7: Inst::XORPS(Vo,Wo); 475 } 476 // repe (0xF3) 477 0x4: decode OPCODE_OP_BOTTOM3 { 478 0x1: Inst::SQRTSS(Vd,Wd); 479 0x2: rsqrtss_Vd_Wd(); 480 0x3: rcpss_Vd_Wd(); 481 default: Inst::UD2(); 482 } 483 // operand size (0x66) 484 0x1: decode OPCODE_OP_BOTTOM3 { 485 0x0: movmskpd_Gd_VRo(); 486 0x1: Inst::SQRTPD(Vo,Wo); 487 0x4: Inst::ANDPD(Vo,Wo); 488 0x5: Inst::ANDNPD(Vo,Wo); 489 0x6: Inst::ORPD(Vo,Wo); 490 //This really should be type o, but it works on q sized 491 //chunks at a time. 492 0x7: Inst::XORPD(Vq,Wq); 493 default: Inst::UD2(); 494 } 495 format Inst { 496 // repne (0xF2) 497 0x8: decode OPCODE_OP_BOTTOM3 { 498 0x1: Inst::SQRTSD(Vq,Wq); 499 default: UD2(); 500 } 501 default: UD2(); 502 } 503 } 504 0x0B: decode LEGACY_DECODEVAL { 505 // no prefix 506 0x0: decode OPCODE_OP_BOTTOM3 { 507 0x0: Inst::ADDPS(Vo,Wo); 508 0x1: Inst::MULPS(Vo,Wo); 509 0x2: cvtps2pd_Vo_Wq();
| 395 0x3: movntpd_Mo_Vo(); 396 0x4: cvttpd2pi_Pq_Wo(); 397 0x5: cvtpd2pi_Pq_Wo(); 398 0x6: Inst::UCOMISD(Vq,Wq); 399 0x7: comisd_Vq_Wq(); 400 } 401 // repne (0xF2) 402 0x8: decode OPCODE_OP_BOTTOM3 { 403 // The size of the V operand should be q, not dp 404 0x2: Inst::CVTSI2SD(Vdp,Edp); 405 // The size of the W operand should be q, not dp 406 0x4: Inst::CVTTSD2SI(Gdp,Wdp); 407 0x5: cvtsd2si_Gd_Wq(); 408 default: Inst::UD2(); 409 } 410 default: Inst::UD2(); 411 } 412 0x06: decode OPCODE_OP_BOTTOM3 { 413 0x0: Inst::WRMSR(); 414 0x1: Inst::RDTSC(); 415 0x2: Inst::RDMSR(); 416 0x3: rdpmc(); 417#if FULL_SYSTEM 418 0x4: sysenter(); 419#else 420 0x4: SyscallInst::sysenter('xc->syscall(Rax)', IsSyscall); 421#endif 422 0x5: sysexit(); 423 0x6: Inst::UD2(); 424 0x7: getsec(); 425 } 426 0x07: decode OPCODE_OP_BOTTOM3 { 427 0x0: three_byte_opcode(); 428 0x1: three_byte_opcode(); 429 0x2: three_byte_opcode(); 430 0x3: three_byte_opcode(); 431 0x4: three_byte_opcode(); 432 0x5: three_byte_opcode(); 433 0x6: three_byte_opcode(); 434 0x7: three_byte_opcode(); 435 } 436 format Inst { 437 0x08: decode OPCODE_OP_BOTTOM3 { 438 0x0: CMOVO(Gv,Ev); 439 0x1: CMOVNO(Gv,Ev); 440 0x2: CMOVB(Gv,Ev); 441 0x3: CMOVNB(Gv,Ev); 442 0x4: CMOVZ(Gv,Ev); 443 0x5: CMOVNZ(Gv,Ev); 444 0x6: CMOVBE(Gv,Ev); 445 0x7: CMOVNBE(Gv,Ev); 446 } 447 0x09: decode OPCODE_OP_BOTTOM3 { 448 0x0: CMOVS(Gv,Ev); 449 0x1: CMOVNS(Gv,Ev); 450 0x2: CMOVP(Gv,Ev); 451 0x3: CMOVNP(Gv,Ev); 452 0x4: CMOVL(Gv,Ev); 453 0x5: CMOVNL(Gv,Ev); 454 0x6: CMOVLE(Gv,Ev); 455 0x7: CMOVNLE(Gv,Ev); 456 } 457 } 458 0x0A: decode LEGACY_DECODEVAL { 459 // no prefix 460 0x0: decode OPCODE_OP_BOTTOM3 { 461 0x0: movmskps_Gd_VRo(); 462 0x1: Inst::SQRTPS(Vo,Wo); 463 0x2: rqsrtps_Vo_Wo(); 464 0x3: rcpps_Vo_Wo(); 465 0x4: Inst::ANDPS(Vo,Wo); 466 0x5: Inst::ANDNPS(Vo,Wo); 467 0x6: Inst::ORPS(Vo,Wo); 468 0x7: Inst::XORPS(Vo,Wo); 469 } 470 // repe (0xF3) 471 0x4: decode OPCODE_OP_BOTTOM3 { 472 0x1: Inst::SQRTSS(Vd,Wd); 473 0x2: rsqrtss_Vd_Wd(); 474 0x3: rcpss_Vd_Wd(); 475 default: Inst::UD2(); 476 } 477 // operand size (0x66) 478 0x1: decode OPCODE_OP_BOTTOM3 { 479 0x0: movmskpd_Gd_VRo(); 480 0x1: Inst::SQRTPD(Vo,Wo); 481 0x4: Inst::ANDPD(Vo,Wo); 482 0x5: Inst::ANDNPD(Vo,Wo); 483 0x6: Inst::ORPD(Vo,Wo); 484 //This really should be type o, but it works on q sized 485 //chunks at a time. 486 0x7: Inst::XORPD(Vq,Wq); 487 default: Inst::UD2(); 488 } 489 format Inst { 490 // repne (0xF2) 491 0x8: decode OPCODE_OP_BOTTOM3 { 492 0x1: Inst::SQRTSD(Vq,Wq); 493 default: UD2(); 494 } 495 default: UD2(); 496 } 497 } 498 0x0B: decode LEGACY_DECODEVAL { 499 // no prefix 500 0x0: decode OPCODE_OP_BOTTOM3 { 501 0x0: Inst::ADDPS(Vo,Wo); 502 0x1: Inst::MULPS(Vo,Wo); 503 0x2: cvtps2pd_Vo_Wq();
|
510 0x3: cvtdq2ps_Vo_Wo();
| 504 0x3: Inst::CVTDQ2PS(Vo,Wo);
|
511 0x4: Inst::SUBPS(Vo,Wo); 512 0x5: Inst::MINPS(Vo,Wo); 513 0x6: Inst::DIVPS(Vo,Wo); 514 0x7: Inst::MAXPS(Vo,Wo); 515 } 516 // repe (0xF3) 517 0x4: decode OPCODE_OP_BOTTOM3 { 518 0x0: Inst::ADDSS(Vd,Wd); 519 0x1: Inst::MULSS(Vd,Wd); 520 0x2: cvtss2sd_Vq_Wd(); 521 0x3: cvttps2dq_Vo_Wo(); 522 0x4: Inst::SUBSS(Vd,Wd); 523 0x5: Inst::MINSS(Vd,Wd); 524 0x6: Inst::DIVSS(Vd,Wd); 525 0x7: Inst::MAXSS(Vd,Wd); 526 } 527 // operand size (0x66) 528 0x1: decode OPCODE_OP_BOTTOM3 { 529 0x0: Inst::ADDPD(Vo,Wo); 530 0x1: Inst::MULPD(Vo,Wo); 531 0x2: cvtpd2ps_Vo_Wo(); 532 0x3: cvtps2dq_Vo_Wo(); 533 0x4: Inst::SUBPD(Vo,Wo); 534 0x5: Inst::MINPD(Vo,Wo); 535 0x6: Inst::DIVPD(Vo,Wo); 536 0x7: Inst::MAXPD(Vo,Wo); 537 } 538 // repne (0xF2) 539 0x8: decode OPCODE_OP_BOTTOM3 { 540 0x0: Inst::ADDSD(Vq,Wq); 541 0x1: Inst::MULSD(Vq,Wq); 542 0x2: cvtsd2ss_Vd_Wq(); 543 0x4: Inst::SUBSD(Vq,Wq); 544 0x5: Inst::MINSD(Vq,Wq); 545 0x6: Inst::DIVSD(Vq,Wq); 546 0x7: Inst::MAXSD(Vq,Wq); 547 default: Inst::UD2(); 548 } 549 default: Inst::UD2(); 550 } 551 0x0C: decode LEGACY_DECODEVAL { 552 // no prefix 553 0x0: decode OPCODE_OP_BOTTOM3 { 554 0x0: Inst::PUNPCKLBW(Pq,Qd); 555 0x1: Inst::PUNPCKLWD(Pq,Qd); 556 0x2: Inst::PUNPCKLDQ(Pq,Qd); 557 0x3: Inst::PACKSSWB(Pq,Qq); 558 0x4: pcmpgtb_Pq_Qq(); 559 0x5: pcmpgtw_Pq_Qq(); 560 0x6: pcmpgtd_Pq_Qq(); 561 0x7: Inst::PACKUSWB(Pq,Qq); 562 } 563 // operand size (0x66) 564 0x1: decode OPCODE_OP_BOTTOM3 { 565 0x0: Inst::PUNPCKLBW(Vo,Wq); 566 0x1: Inst::PUNPCKLWD(Vo,Wq); 567 0x2: Inst::PUNPCKLDQ(Vo,Wq); 568 0x3: Inst::PACKSSWB(Vo,Wo); 569 0x4: pcmpgtb_Vo_Wo(); 570 0x5: pcmpgtw_Vo_Wo(); 571 0x6: pcmpgtd_Vo_Wo(); 572 0x7: Inst::PACKUSWB(Vo,Wo); 573 } 574 default: Inst::UD2(); 575 } 576 0x0D: decode LEGACY_DECODEVAL { 577 // no prefix 578 0x0: decode OPCODE_OP_BOTTOM3 { 579 0x0: Inst::PUNPCKHBW(Pq,Qq); 580 0x1: Inst::PUNPCKHWD(Pq,Qq); 581 0x2: Inst::PUNPCKHDQ(Pq,Qq); 582 0x3: Inst::PACKSSDW(Pq,Qq); 583 0x6: Inst::MOVD(Pq,Edp); 584 0x7: Inst::MOVQ(Pq,Qq); 585 default: Inst::UD2(); 586 } 587 // repe (0xF3) 588 0x4: decode OPCODE_OP_BOTTOM3 { 589 0x7: movdqu_Vo_Wo(); 590 default: Inst::UD2(); 591 } 592 // operand size (0x66) 593 0x1: decode OPCODE_OP_BOTTOM3 { 594 0x0: Inst::PUNPCKHBW(Vo,Wo); 595 0x1: Inst::PUNPCKHWD(Vo,Wo); 596 0x2: Inst::PUNPCKHDQ(Vo,Wo); 597 0x3: Inst::PACKSSDW(Vo,Wo); 598 0x4: Inst::PUNPCKLQDQ(Vo,Wq); 599 0x5: Inst::PUNPCKHQDQ(Vo,Wq); 600 0x6: movd_Vo_Ed(); 601 0x7: movdqa_Vo_Wo(); 602 } 603 default: Inst::UD2(); 604 } 605 0x0E: decode LEGACY_DECODEVAL { 606 // no prefix 607 0x0: decode OPCODE_OP_BOTTOM3 { 608 0x0: pshufw_Pq_Qq_Ib(); 609 //0x1: group13_pshimw(); 610 0x1: decode MODRM_REG { 611 0x2: decode LEGACY_OP { 612 0x0: psrlw_PRq_Ib(); 613 0x1: psrlw_VRo_Ib(); 614 } 615 0x4: decode LEGACY_OP { 616 0x0: psraw_PRq_Ib(); 617 0x1: psraw_VRo_Ib(); 618 } 619 0x6: decode LEGACY_OP { 620 0x0: psllw_PRq_Ib(); 621 0x1: psllw_VRo_Ib(); 622 } 623 default: Inst::UD2(); 624 } 625 //0x2: group14_pshimd(); 626 0x2: decode MODRM_REG { 627 0x2: decode LEGACY_OP { 628 0x0: psrld_PRq_Ib(); 629 0x1: psrld_VRo_Ib(); 630 } 631 0x4: decode LEGACY_OP { 632 0x0: psrad_PRq_Ib(); 633 0x1: psrad_VRo_Ib(); 634 } 635 0x6: decode LEGACY_OP { 636 0x0: pslld_PRq_Ib(); 637 0x1: pslld_VRo_Ib(); 638 } 639 default: Inst::UD2(); 640 } 641 //0x3: group15_pshimq(); 642 0x3: decode MODRM_REG { 643 0x2: decode LEGACY_OP { 644 0x0: psrlq_PRq_Ib(); 645 0x1: psrlq_VRo_Ib(); 646 } 647 0x3: decode LEGACY_OP { 648 0x0: Inst::UD2(); 649 0x1: psrldq_VRo_Ib(); 650 } 651 0x6: decode LEGACY_OP { 652 0x0: psllq_PRq_Ib(); 653 0x1: psllq_VRo_Ib(); 654 } 655 0x7: decode LEGACY_OP { 656 0x0: Inst::UD2(); 657 0x1: pslldq_VRo_Ib(); 658 } 659 default: Inst::UD2(); 660 } 661 0x4: pcmpeqb_Pq_Qq(); 662 0x5: pcmpeqw_Pq_Qq(); 663 0x6: pcmpeqd_Pq_Qq(); 664 0x7: emms(); 665 } 666 // repe (0xF3) 667 0x4: decode OPCODE_OP_BOTTOM3 { 668 0x0: pshufhw_Vo_Wo_Ib(); 669 default: Inst::UD2(); 670 } 671 // operand size (0x66) 672 0x1: decode OPCODE_OP_BOTTOM3 { 673 0x0: pshufd_Vo_Wo_Ib(); 674 //0x1: group13_pshimw(); 675 0x1: decode MODRM_REG { 676 0x2: decode LEGACY_OP { 677 0x0: psrlw_PRq_Ib(); 678 0x1: psrlw_VRo_Ib(); 679 } 680 0x4: decode LEGACY_OP { 681 0x0: psraw_PRq_Ib(); 682 0x1: psraw_VRo_Ib(); 683 } 684 0x6: decode LEGACY_OP { 685 0x0: psllw_PRq_Ib(); 686 0x1: psllw_VRo_Ib(); 687 } 688 default: Inst::UD2(); 689 } 690 //0x2: group14_pshimd(); 691 0x2: decode MODRM_REG { 692 0x2: decode LEGACY_OP { 693 0x0: psrld_PRq_Ib(); 694 0x1: psrld_VRo_Ib(); 695 } 696 0x4: decode LEGACY_OP { 697 0x0: psrad_PRq_Ib(); 698 0x1: psrad_VRo_Ib(); 699 } 700 0x6: decode LEGACY_OP { 701 0x0: pslld_PRq_Ib(); 702 0x1: pslld_VRo_Ib(); 703 } 704 default: Inst::UD2(); 705 } 706 //0x3: group15_pshimq(); 707 0x3: decode MODRM_REG { 708 0x2: decode LEGACY_OP { 709 0x0: psrlq_PRq_Ib(); 710 0x1: psrlq_VRo_Ib(); 711 } 712 0x3: decode LEGACY_OP { 713 0x0: Inst::UD2(); 714 0x1: psrldq_VRo_Ib(); 715 } 716 0x6: decode LEGACY_OP { 717 0x0: psllq_PRq_Ib(); 718 0x1: psllq_VRo_Ib(); 719 } 720 0x7: decode LEGACY_OP { 721 0x0: Inst::UD2(); 722 0x1: pslldq_VRo_Ib(); 723 } 724 default: Inst::UD2(); 725 } 726 0x4: pcmpeqb_Vo_Wo(); 727 0x5: pcmpeqw_Vo_Wo(); 728 0x6: pcmpeqd_Vo_Wo(); 729 default: Inst::UD2(); 730 } 731 // repne (0xF2) 732 0x8: decode OPCODE_OP_BOTTOM3 { 733 0x0: pshuflw_Vo_Wo_Ib(); 734 default: Inst::UD2(); 735 } 736 default: Inst::UD2(); 737 } 738 0x0F: decode LEGACY_DECODEVAL { 739 // no prefix 740 0x0: decode OPCODE_OP_BOTTOM3 { 741 0x0: vmread_Ed_or_Eq_Gd_or_Gq(); 742 0x1: vmwrite_Gd_or_Gq_Ed_or_Eq(); 743 0x6: Inst::MOVD(Edp,Pdp); 744 0x7: Inst::MOVQ(Qq,Pq); 745 default: Inst::UD2(); 746 } 747 // repe (0xF3) 748 0x4: decode OPCODE_OP_BOTTOM3 { 749 0x6: Inst::MOVQ(Vq,Wq); 750 0x7: movdqu_Wo_Vo(); 751 default: Inst::UD2(); 752 } 753 // operand size (0x66) 754 0x1: decode OPCODE_OP_BOTTOM3 { 755 0x4: haddpd_Vo_Wo(); 756 0x5: hsubpd_Vo_Wo(); 757 0x6: movd_Ed_Vd(); 758 0x7: movdqa_Wo_Vo(); 759 default: Inst::UD2(); 760 } 761 // repne (0xF2) 762 0x8: decode OPCODE_OP_BOTTOM3 { 763 0x4: haddps_Vo_Wo(); 764 0x5: hsubps_Vo_Wo(); 765 default: Inst::UD2(); 766 } 767 default: Inst::UD2(); 768 } 769 format Inst { 770 0x10: decode OPCODE_OP_BOTTOM3 { 771 0x0: JO(Jz); 772 0x1: JNO(Jz); 773 0x2: JB(Jz); 774 0x3: JNB(Jz); 775 0x4: JZ(Jz); 776 0x5: JNZ(Jz); 777 0x6: JBE(Jz); 778 0x7: JNBE(Jz); 779 } 780 0x11: decode OPCODE_OP_BOTTOM3 { 781 0x0: JS(Jz); 782 0x1: JNS(Jz); 783 0x2: JP(Jz); 784 0x3: JNP(Jz); 785 0x4: JL(Jz); 786 0x5: JNL(Jz); 787 0x6: JLE(Jz); 788 0x7: JNLE(Jz); 789 } 790 0x12: decode OPCODE_OP_BOTTOM3 { 791 0x0: SETO(Eb); 792 0x1: SETNO(Eb); 793 0x2: SETB(Eb); 794 0x3: SETNB(Eb); 795 0x4: SETZ(Eb); 796 0x5: SETNZ(Eb); 797 0x6: SETBE(Eb); 798 0x7: SETNBE(Eb); 799 } 800 0x13: decode OPCODE_OP_BOTTOM3 { 801 0x0: SETS(Eb); 802 0x1: SETNS(Eb); 803 0x2: SETP(Eb); 804 0x3: SETNP(Eb); 805 0x4: SETL(Eb); 806 0x5: SETNL(Eb); 807 0x6: SETLE(Eb); 808 0x7: SETNLE(Eb); 809 } 810 } 811 0x14: decode OPCODE_OP_BOTTOM3 { 812 0x0: push_fs(); 813 0x1: pop_fs(); 814 0x2: CPUIDInst::CPUID({{ 815 CpuidResult result; 816 success = doCpuid(xc->tcBase(), bits(Rax, 31, 0), result); 817 Rax = result.rax; 818 Rbx = result.rbx; 819 Rcx = result.rcx; 820 Rdx = result.rdx; 821 }}); 822 0x3: Inst::BT(Ev,Gv); 823 0x4: Inst::SHLD(Ev,Gv,Ib); 824 0x5: Inst::SHLD(Ev,Gv); 825 0x6: xbts_and_cmpxchg(); 826 0x7: ibts_and_cmpxchg(); 827 } 828 0x15: decode OPCODE_OP_BOTTOM3 { 829 0x0: push_gs(); 830 0x1: pop_gs(); 831 0x2: rsm_smm(); 832 0x3: Inst::BTS(Ev,Gv); 833 0x4: Inst::SHRD(Ev,Gv,Ib); 834 0x5: Inst::SHRD(Ev,Gv); 835 //0x6: group16(); 836 0x6: decode MODRM_REG { 837 0x0: fxsave(); 838 0x1: fxrstor(); 839 0x2: ldmxcsr(); 840 0x3: stmxcsr(); 841 0x4: Inst::UD2(); 842 0x5: decode MODRM_MOD { 843 0x3: BasicOperate::LFENCE( 844 {{/*Nothing*/}}, IsReadBarrier); 845 default: Inst::UD2(); 846 } 847 0x6: decode MODRM_MOD { 848 0x3: BasicOperate::MFENCE( 849 {{/*Nothing*/}}, IsMemBarrier); 850 default: Inst::UD2(); 851 } 852 0x7: decode MODRM_MOD { 853 0x3: BasicOperate::SFENCE( 854 {{/*Nothing*/}}, IsWriteBarrier); 855 default: Inst::UD2(); 856 } 857 } 858 0x7: Inst::IMUL(Gv,Ev); 859 } 860 0x16: decode OPCODE_OP_BOTTOM3 { 861 0x0: Inst::CMPXCHG(Eb,Gb); 862 0x1: Inst::CMPXCHG(Ev,Gv); 863 0x2: lss_Gz_Mp(); 864 0x3: Inst::BTR(Ev,Gv); 865 0x4: lfs_Gz_Mp(); 866 0x5: lgs_Gz_Mp(); 867 //The size of the second operand in these instructions should 868 //really be "b" or "w", but it's set to v in order to have a 869 //consistent register size. This shouldn't affect behavior. 870 0x6: Inst::MOVZX_B(Gv,Ev); 871 0x7: Inst::MOVZX_W(Gv,Ev); 872 } 873 0x17: decode OPCODE_OP_BOTTOM3 { 874 0x0: jmpe_Jz(); // IA-64? 875 format Inst { 876 //0x1: group11_UD2(); 877 0x1: UD2(); 878 //0x2: group8_Ev_Ib(); 879 0x2: decode MODRM_REG { 880 0x4: BT(Ev,Ib); 881 0x5: BTS(Ev,Ib); 882 0x6: BTR(Ev,Ib); 883 0x7: BTC(Ev,Ib); 884 default: UD2(); 885 } 886 0x3: BTC(Ev,Gv); 887 } 888 0x4: Inst::BSF(Gv,Ev); 889 0x5: Inst::BSR(Gv,Ev); 890 //The size of the second operand in these instructions should 891 //really be "b" or "w", but it's set to v in order to have a 892 //consistent register size. This shouldn't affect behavior. 893 0x6: Inst::MOVSX_B(Gv,Ev); 894 0x7: Inst::MOVSX_W(Gv,Ev); 895 } 896 0x18: decode OPCODE_OP_BOTTOM3 { 897 0x0: Inst::XADD(Eb,Gb); 898 0x1: Inst::XADD(Ev,Gv); 899 //0x7: group9(); 900 0x7: decode MODRM_REG { 901 //Also CMPXCHG16B 902 0x1: Inst::CMPXCHG8B(Mdp); 903 0x6: decode LEGACY_OP { 904 0x1: vmclear_Mq(); 905 default: decode LEGACY_REP { 906 0x1: vmxon_Mq(); 907 0x0: vmptrld_Mq(); 908 } 909 } 910 0x7: vmptrst_Mq(); 911 default: Inst::UD2(); 912 } 913 default: decode LEGACY_DECODEVAL { 914 // no prefix 915 0x0: decode OPCODE_OP_BOTTOM3 { 916 0x2: cmpccps_Vo_Wo_Ib();
| 505 0x4: Inst::SUBPS(Vo,Wo); 506 0x5: Inst::MINPS(Vo,Wo); 507 0x6: Inst::DIVPS(Vo,Wo); 508 0x7: Inst::MAXPS(Vo,Wo); 509 } 510 // repe (0xF3) 511 0x4: decode OPCODE_OP_BOTTOM3 { 512 0x0: Inst::ADDSS(Vd,Wd); 513 0x1: Inst::MULSS(Vd,Wd); 514 0x2: cvtss2sd_Vq_Wd(); 515 0x3: cvttps2dq_Vo_Wo(); 516 0x4: Inst::SUBSS(Vd,Wd); 517 0x5: Inst::MINSS(Vd,Wd); 518 0x6: Inst::DIVSS(Vd,Wd); 519 0x7: Inst::MAXSS(Vd,Wd); 520 } 521 // operand size (0x66) 522 0x1: decode OPCODE_OP_BOTTOM3 { 523 0x0: Inst::ADDPD(Vo,Wo); 524 0x1: Inst::MULPD(Vo,Wo); 525 0x2: cvtpd2ps_Vo_Wo(); 526 0x3: cvtps2dq_Vo_Wo(); 527 0x4: Inst::SUBPD(Vo,Wo); 528 0x5: Inst::MINPD(Vo,Wo); 529 0x6: Inst::DIVPD(Vo,Wo); 530 0x7: Inst::MAXPD(Vo,Wo); 531 } 532 // repne (0xF2) 533 0x8: decode OPCODE_OP_BOTTOM3 { 534 0x0: Inst::ADDSD(Vq,Wq); 535 0x1: Inst::MULSD(Vq,Wq); 536 0x2: cvtsd2ss_Vd_Wq(); 537 0x4: Inst::SUBSD(Vq,Wq); 538 0x5: Inst::MINSD(Vq,Wq); 539 0x6: Inst::DIVSD(Vq,Wq); 540 0x7: Inst::MAXSD(Vq,Wq); 541 default: Inst::UD2(); 542 } 543 default: Inst::UD2(); 544 } 545 0x0C: decode LEGACY_DECODEVAL { 546 // no prefix 547 0x0: decode OPCODE_OP_BOTTOM3 { 548 0x0: Inst::PUNPCKLBW(Pq,Qd); 549 0x1: Inst::PUNPCKLWD(Pq,Qd); 550 0x2: Inst::PUNPCKLDQ(Pq,Qd); 551 0x3: Inst::PACKSSWB(Pq,Qq); 552 0x4: pcmpgtb_Pq_Qq(); 553 0x5: pcmpgtw_Pq_Qq(); 554 0x6: pcmpgtd_Pq_Qq(); 555 0x7: Inst::PACKUSWB(Pq,Qq); 556 } 557 // operand size (0x66) 558 0x1: decode OPCODE_OP_BOTTOM3 { 559 0x0: Inst::PUNPCKLBW(Vo,Wq); 560 0x1: Inst::PUNPCKLWD(Vo,Wq); 561 0x2: Inst::PUNPCKLDQ(Vo,Wq); 562 0x3: Inst::PACKSSWB(Vo,Wo); 563 0x4: pcmpgtb_Vo_Wo(); 564 0x5: pcmpgtw_Vo_Wo(); 565 0x6: pcmpgtd_Vo_Wo(); 566 0x7: Inst::PACKUSWB(Vo,Wo); 567 } 568 default: Inst::UD2(); 569 } 570 0x0D: decode LEGACY_DECODEVAL { 571 // no prefix 572 0x0: decode OPCODE_OP_BOTTOM3 { 573 0x0: Inst::PUNPCKHBW(Pq,Qq); 574 0x1: Inst::PUNPCKHWD(Pq,Qq); 575 0x2: Inst::PUNPCKHDQ(Pq,Qq); 576 0x3: Inst::PACKSSDW(Pq,Qq); 577 0x6: Inst::MOVD(Pq,Edp); 578 0x7: Inst::MOVQ(Pq,Qq); 579 default: Inst::UD2(); 580 } 581 // repe (0xF3) 582 0x4: decode OPCODE_OP_BOTTOM3 { 583 0x7: movdqu_Vo_Wo(); 584 default: Inst::UD2(); 585 } 586 // operand size (0x66) 587 0x1: decode OPCODE_OP_BOTTOM3 { 588 0x0: Inst::PUNPCKHBW(Vo,Wo); 589 0x1: Inst::PUNPCKHWD(Vo,Wo); 590 0x2: Inst::PUNPCKHDQ(Vo,Wo); 591 0x3: Inst::PACKSSDW(Vo,Wo); 592 0x4: Inst::PUNPCKLQDQ(Vo,Wq); 593 0x5: Inst::PUNPCKHQDQ(Vo,Wq); 594 0x6: movd_Vo_Ed(); 595 0x7: movdqa_Vo_Wo(); 596 } 597 default: Inst::UD2(); 598 } 599 0x0E: decode LEGACY_DECODEVAL { 600 // no prefix 601 0x0: decode OPCODE_OP_BOTTOM3 { 602 0x0: pshufw_Pq_Qq_Ib(); 603 //0x1: group13_pshimw(); 604 0x1: decode MODRM_REG { 605 0x2: decode LEGACY_OP { 606 0x0: psrlw_PRq_Ib(); 607 0x1: psrlw_VRo_Ib(); 608 } 609 0x4: decode LEGACY_OP { 610 0x0: psraw_PRq_Ib(); 611 0x1: psraw_VRo_Ib(); 612 } 613 0x6: decode LEGACY_OP { 614 0x0: psllw_PRq_Ib(); 615 0x1: psllw_VRo_Ib(); 616 } 617 default: Inst::UD2(); 618 } 619 //0x2: group14_pshimd(); 620 0x2: decode MODRM_REG { 621 0x2: decode LEGACY_OP { 622 0x0: psrld_PRq_Ib(); 623 0x1: psrld_VRo_Ib(); 624 } 625 0x4: decode LEGACY_OP { 626 0x0: psrad_PRq_Ib(); 627 0x1: psrad_VRo_Ib(); 628 } 629 0x6: decode LEGACY_OP { 630 0x0: pslld_PRq_Ib(); 631 0x1: pslld_VRo_Ib(); 632 } 633 default: Inst::UD2(); 634 } 635 //0x3: group15_pshimq(); 636 0x3: decode MODRM_REG { 637 0x2: decode LEGACY_OP { 638 0x0: psrlq_PRq_Ib(); 639 0x1: psrlq_VRo_Ib(); 640 } 641 0x3: decode LEGACY_OP { 642 0x0: Inst::UD2(); 643 0x1: psrldq_VRo_Ib(); 644 } 645 0x6: decode LEGACY_OP { 646 0x0: psllq_PRq_Ib(); 647 0x1: psllq_VRo_Ib(); 648 } 649 0x7: decode LEGACY_OP { 650 0x0: Inst::UD2(); 651 0x1: pslldq_VRo_Ib(); 652 } 653 default: Inst::UD2(); 654 } 655 0x4: pcmpeqb_Pq_Qq(); 656 0x5: pcmpeqw_Pq_Qq(); 657 0x6: pcmpeqd_Pq_Qq(); 658 0x7: emms(); 659 } 660 // repe (0xF3) 661 0x4: decode OPCODE_OP_BOTTOM3 { 662 0x0: pshufhw_Vo_Wo_Ib(); 663 default: Inst::UD2(); 664 } 665 // operand size (0x66) 666 0x1: decode OPCODE_OP_BOTTOM3 { 667 0x0: pshufd_Vo_Wo_Ib(); 668 //0x1: group13_pshimw(); 669 0x1: decode MODRM_REG { 670 0x2: decode LEGACY_OP { 671 0x0: psrlw_PRq_Ib(); 672 0x1: psrlw_VRo_Ib(); 673 } 674 0x4: decode LEGACY_OP { 675 0x0: psraw_PRq_Ib(); 676 0x1: psraw_VRo_Ib(); 677 } 678 0x6: decode LEGACY_OP { 679 0x0: psllw_PRq_Ib(); 680 0x1: psllw_VRo_Ib(); 681 } 682 default: Inst::UD2(); 683 } 684 //0x2: group14_pshimd(); 685 0x2: decode MODRM_REG { 686 0x2: decode LEGACY_OP { 687 0x0: psrld_PRq_Ib(); 688 0x1: psrld_VRo_Ib(); 689 } 690 0x4: decode LEGACY_OP { 691 0x0: psrad_PRq_Ib(); 692 0x1: psrad_VRo_Ib(); 693 } 694 0x6: decode LEGACY_OP { 695 0x0: pslld_PRq_Ib(); 696 0x1: pslld_VRo_Ib(); 697 } 698 default: Inst::UD2(); 699 } 700 //0x3: group15_pshimq(); 701 0x3: decode MODRM_REG { 702 0x2: decode LEGACY_OP { 703 0x0: psrlq_PRq_Ib(); 704 0x1: psrlq_VRo_Ib(); 705 } 706 0x3: decode LEGACY_OP { 707 0x0: Inst::UD2(); 708 0x1: psrldq_VRo_Ib(); 709 } 710 0x6: decode LEGACY_OP { 711 0x0: psllq_PRq_Ib(); 712 0x1: psllq_VRo_Ib(); 713 } 714 0x7: decode LEGACY_OP { 715 0x0: Inst::UD2(); 716 0x1: pslldq_VRo_Ib(); 717 } 718 default: Inst::UD2(); 719 } 720 0x4: pcmpeqb_Vo_Wo(); 721 0x5: pcmpeqw_Vo_Wo(); 722 0x6: pcmpeqd_Vo_Wo(); 723 default: Inst::UD2(); 724 } 725 // repne (0xF2) 726 0x8: decode OPCODE_OP_BOTTOM3 { 727 0x0: pshuflw_Vo_Wo_Ib(); 728 default: Inst::UD2(); 729 } 730 default: Inst::UD2(); 731 } 732 0x0F: decode LEGACY_DECODEVAL { 733 // no prefix 734 0x0: decode OPCODE_OP_BOTTOM3 { 735 0x0: vmread_Ed_or_Eq_Gd_or_Gq(); 736 0x1: vmwrite_Gd_or_Gq_Ed_or_Eq(); 737 0x6: Inst::MOVD(Edp,Pdp); 738 0x7: Inst::MOVQ(Qq,Pq); 739 default: Inst::UD2(); 740 } 741 // repe (0xF3) 742 0x4: decode OPCODE_OP_BOTTOM3 { 743 0x6: Inst::MOVQ(Vq,Wq); 744 0x7: movdqu_Wo_Vo(); 745 default: Inst::UD2(); 746 } 747 // operand size (0x66) 748 0x1: decode OPCODE_OP_BOTTOM3 { 749 0x4: haddpd_Vo_Wo(); 750 0x5: hsubpd_Vo_Wo(); 751 0x6: movd_Ed_Vd(); 752 0x7: movdqa_Wo_Vo(); 753 default: Inst::UD2(); 754 } 755 // repne (0xF2) 756 0x8: decode OPCODE_OP_BOTTOM3 { 757 0x4: haddps_Vo_Wo(); 758 0x5: hsubps_Vo_Wo(); 759 default: Inst::UD2(); 760 } 761 default: Inst::UD2(); 762 } 763 format Inst { 764 0x10: decode OPCODE_OP_BOTTOM3 { 765 0x0: JO(Jz); 766 0x1: JNO(Jz); 767 0x2: JB(Jz); 768 0x3: JNB(Jz); 769 0x4: JZ(Jz); 770 0x5: JNZ(Jz); 771 0x6: JBE(Jz); 772 0x7: JNBE(Jz); 773 } 774 0x11: decode OPCODE_OP_BOTTOM3 { 775 0x0: JS(Jz); 776 0x1: JNS(Jz); 777 0x2: JP(Jz); 778 0x3: JNP(Jz); 779 0x4: JL(Jz); 780 0x5: JNL(Jz); 781 0x6: JLE(Jz); 782 0x7: JNLE(Jz); 783 } 784 0x12: decode OPCODE_OP_BOTTOM3 { 785 0x0: SETO(Eb); 786 0x1: SETNO(Eb); 787 0x2: SETB(Eb); 788 0x3: SETNB(Eb); 789 0x4: SETZ(Eb); 790 0x5: SETNZ(Eb); 791 0x6: SETBE(Eb); 792 0x7: SETNBE(Eb); 793 } 794 0x13: decode OPCODE_OP_BOTTOM3 { 795 0x0: SETS(Eb); 796 0x1: SETNS(Eb); 797 0x2: SETP(Eb); 798 0x3: SETNP(Eb); 799 0x4: SETL(Eb); 800 0x5: SETNL(Eb); 801 0x6: SETLE(Eb); 802 0x7: SETNLE(Eb); 803 } 804 } 805 0x14: decode OPCODE_OP_BOTTOM3 { 806 0x0: push_fs(); 807 0x1: pop_fs(); 808 0x2: CPUIDInst::CPUID({{ 809 CpuidResult result; 810 success = doCpuid(xc->tcBase(), bits(Rax, 31, 0), result); 811 Rax = result.rax; 812 Rbx = result.rbx; 813 Rcx = result.rcx; 814 Rdx = result.rdx; 815 }}); 816 0x3: Inst::BT(Ev,Gv); 817 0x4: Inst::SHLD(Ev,Gv,Ib); 818 0x5: Inst::SHLD(Ev,Gv); 819 0x6: xbts_and_cmpxchg(); 820 0x7: ibts_and_cmpxchg(); 821 } 822 0x15: decode OPCODE_OP_BOTTOM3 { 823 0x0: push_gs(); 824 0x1: pop_gs(); 825 0x2: rsm_smm(); 826 0x3: Inst::BTS(Ev,Gv); 827 0x4: Inst::SHRD(Ev,Gv,Ib); 828 0x5: Inst::SHRD(Ev,Gv); 829 //0x6: group16(); 830 0x6: decode MODRM_REG { 831 0x0: fxsave(); 832 0x1: fxrstor(); 833 0x2: ldmxcsr(); 834 0x3: stmxcsr(); 835 0x4: Inst::UD2(); 836 0x5: decode MODRM_MOD { 837 0x3: BasicOperate::LFENCE( 838 {{/*Nothing*/}}, IsReadBarrier); 839 default: Inst::UD2(); 840 } 841 0x6: decode MODRM_MOD { 842 0x3: BasicOperate::MFENCE( 843 {{/*Nothing*/}}, IsMemBarrier); 844 default: Inst::UD2(); 845 } 846 0x7: decode MODRM_MOD { 847 0x3: BasicOperate::SFENCE( 848 {{/*Nothing*/}}, IsWriteBarrier); 849 default: Inst::UD2(); 850 } 851 } 852 0x7: Inst::IMUL(Gv,Ev); 853 } 854 0x16: decode OPCODE_OP_BOTTOM3 { 855 0x0: Inst::CMPXCHG(Eb,Gb); 856 0x1: Inst::CMPXCHG(Ev,Gv); 857 0x2: lss_Gz_Mp(); 858 0x3: Inst::BTR(Ev,Gv); 859 0x4: lfs_Gz_Mp(); 860 0x5: lgs_Gz_Mp(); 861 //The size of the second operand in these instructions should 862 //really be "b" or "w", but it's set to v in order to have a 863 //consistent register size. This shouldn't affect behavior. 864 0x6: Inst::MOVZX_B(Gv,Ev); 865 0x7: Inst::MOVZX_W(Gv,Ev); 866 } 867 0x17: decode OPCODE_OP_BOTTOM3 { 868 0x0: jmpe_Jz(); // IA-64? 869 format Inst { 870 //0x1: group11_UD2(); 871 0x1: UD2(); 872 //0x2: group8_Ev_Ib(); 873 0x2: decode MODRM_REG { 874 0x4: BT(Ev,Ib); 875 0x5: BTS(Ev,Ib); 876 0x6: BTR(Ev,Ib); 877 0x7: BTC(Ev,Ib); 878 default: UD2(); 879 } 880 0x3: BTC(Ev,Gv); 881 } 882 0x4: Inst::BSF(Gv,Ev); 883 0x5: Inst::BSR(Gv,Ev); 884 //The size of the second operand in these instructions should 885 //really be "b" or "w", but it's set to v in order to have a 886 //consistent register size. This shouldn't affect behavior. 887 0x6: Inst::MOVSX_B(Gv,Ev); 888 0x7: Inst::MOVSX_W(Gv,Ev); 889 } 890 0x18: decode OPCODE_OP_BOTTOM3 { 891 0x0: Inst::XADD(Eb,Gb); 892 0x1: Inst::XADD(Ev,Gv); 893 //0x7: group9(); 894 0x7: decode MODRM_REG { 895 //Also CMPXCHG16B 896 0x1: Inst::CMPXCHG8B(Mdp); 897 0x6: decode LEGACY_OP { 898 0x1: vmclear_Mq(); 899 default: decode LEGACY_REP { 900 0x1: vmxon_Mq(); 901 0x0: vmptrld_Mq(); 902 } 903 } 904 0x7: vmptrst_Mq(); 905 default: Inst::UD2(); 906 } 907 default: decode LEGACY_DECODEVAL { 908 // no prefix 909 0x0: decode OPCODE_OP_BOTTOM3 { 910 0x2: cmpccps_Vo_Wo_Ib();
|
917 0x3: cvtdq2ps_Vo_Wo();
| 911 0x3: Inst::CVTDQ2PS(Vo,Wo);
|
918 0x4: Inst::SUBPS(Vo,Wo); 919 0x5: Inst::MINPS(Vo,Wo); 920 0x6: Inst::DIVPS(Vo,Wo); 921 } 922 // repe (0xF3) 923 0x4: decode OPCODE_OP_BOTTOM3 { 924 0x2: cmpccss_Vd_Wd_Ib(); 925 default: Inst::UD2(); 926 } 927 // operand size (0x66) 928 0x1: decode OPCODE_OP_BOTTOM3 { 929 0x2: cmpccpd_Vo_Wo_Ib(); 930 0x4: Inst::SUBPD(Vo,Wo); 931 0x5: Inst::MINPD(Vo,Wo); 932 0x6: Inst::DIVPD(Vo,Wo); 933 default: Inst::UD2(); 934 } 935 // repne (0xF2) 936 0x8: decode OPCODE_OP_BOTTOM3 { 937 0x2: cmpccsd_Vq_Wq_Ib(); 938 default: Inst::UD2(); 939 } 940 default: Inst::UD2(); 941 } 942 } 943 0x19: decode OPSIZE { 944 4: Inst::BSWAP_D(Bd); 945 8: Inst::BSWAP_Q(Bq); 946 default: Inst::UD2(); 947 } 948 0x1A: decode LEGACY_DECODEVAL { 949 // no prefix 950 0x0: decode OPCODE_OP_BOTTOM3 { 951 0x1: psrlw_Pq_Qq(); 952 0x2: psrld_Pq_Qq(); 953 0x3: psrlq_Pq_Qq(); 954 0x4: paddq_Pq_Qq(); 955 0x5: pmullw_Pq_Qq(); 956 0x7: pmovmskb_Gd_PRq(); 957 default: Inst::UD2(); 958 } 959 // repe (0xF3) 960 0x4: decode OPCODE_OP_BOTTOM3 { 961 0x6: movq2dq_Vo_PRq(); 962 default: Inst::UD2(); 963 } 964 // operand size (0x66) 965 0x1: decode OPCODE_OP_BOTTOM3 { 966 0x0: addsubpd_Vo_Wo(); 967 0x1: psrlw_Vo_Wo(); 968 0x2: psrld_Vo_Wo(); 969 0x3: psrlq_Vo_Wo(); 970 0x4: paddq_Vo_Wo(); 971 0x5: pmullw_Vo_Wo(); 972 0x6: Inst::MOVQ(Wq,Vq); 973 0x7: pmovmskb_Gd_VRo(); 974 } 975 // repne (0xF2) 976 0x8: decode OPCODE_OP_BOTTOM3 { 977 0x0: addsubps_Vo_Wo(); 978 0x6: movdq2q_Pq_VRq(); 979 default: Inst::UD2(); 980 } 981 default: Inst::UD2(); 982 } 983 0x1B: decode LEGACY_DECODEVAL { 984 // no prefix 985 0x0: decode OPCODE_OP_BOTTOM3 { 986 0x0: psubusb_Pq_Qq(); 987 0x1: psubusw_Pq_Qq(); 988 0x2: pminub_Pq_Qq(); 989 0x3: Inst::PAND(Pq,Qq); 990 0x4: paddusb_Pq_Qq(); 991 0x5: paddusw_Pq_Qq(); 992 0x6: pmaxub_Pq_Qq(); 993 0x7: Inst::PANDN(Pq,Qq); 994 } 995 // operand size (0x66) 996 0x1: decode OPCODE_OP_BOTTOM3 { 997 0x0: psubusb_Vo_Wo(); 998 0x1: psubusw_Vo_Wo(); 999 0x2: pminub_Vo_Wo(); 1000 0x3: Inst::PAND(Vo,Wo); 1001 0x4: paddusb_Vo_Wo(); 1002 0x5: paddusw_Vo_Wo(); 1003 0x6: pmaxub_Vo_Wo(); 1004 0x7: Inst::PANDN(Vo,Wo); 1005 } 1006 default: Inst::UD2(); 1007 } 1008 0x1C: decode LEGACY_DECODEVAL { 1009 // no prefix 1010 0x0: decode OPCODE_OP_BOTTOM3 { 1011 0x0: pavgb_Pq_Qq(); 1012 0x1: psraw_Pq_Qq(); 1013 0x2: psrad_Pq_Qq(); 1014 0x3: pavgw_Pq_Qq(); 1015 0x4: pmulhuw_Pq_Qq(); 1016 0x5: pmulhw_Pq_Qq(); 1017 0x7: movntq_Mq_Pq(); 1018 default: Inst::UD2(); 1019 } 1020 // repe (0xF3) 1021 0x4: decode OPCODE_OP_BOTTOM3 {
| 912 0x4: Inst::SUBPS(Vo,Wo); 913 0x5: Inst::MINPS(Vo,Wo); 914 0x6: Inst::DIVPS(Vo,Wo); 915 } 916 // repe (0xF3) 917 0x4: decode OPCODE_OP_BOTTOM3 { 918 0x2: cmpccss_Vd_Wd_Ib(); 919 default: Inst::UD2(); 920 } 921 // operand size (0x66) 922 0x1: decode OPCODE_OP_BOTTOM3 { 923 0x2: cmpccpd_Vo_Wo_Ib(); 924 0x4: Inst::SUBPD(Vo,Wo); 925 0x5: Inst::MINPD(Vo,Wo); 926 0x6: Inst::DIVPD(Vo,Wo); 927 default: Inst::UD2(); 928 } 929 // repne (0xF2) 930 0x8: decode OPCODE_OP_BOTTOM3 { 931 0x2: cmpccsd_Vq_Wq_Ib(); 932 default: Inst::UD2(); 933 } 934 default: Inst::UD2(); 935 } 936 } 937 0x19: decode OPSIZE { 938 4: Inst::BSWAP_D(Bd); 939 8: Inst::BSWAP_Q(Bq); 940 default: Inst::UD2(); 941 } 942 0x1A: decode LEGACY_DECODEVAL { 943 // no prefix 944 0x0: decode OPCODE_OP_BOTTOM3 { 945 0x1: psrlw_Pq_Qq(); 946 0x2: psrld_Pq_Qq(); 947 0x3: psrlq_Pq_Qq(); 948 0x4: paddq_Pq_Qq(); 949 0x5: pmullw_Pq_Qq(); 950 0x7: pmovmskb_Gd_PRq(); 951 default: Inst::UD2(); 952 } 953 // repe (0xF3) 954 0x4: decode OPCODE_OP_BOTTOM3 { 955 0x6: movq2dq_Vo_PRq(); 956 default: Inst::UD2(); 957 } 958 // operand size (0x66) 959 0x1: decode OPCODE_OP_BOTTOM3 { 960 0x0: addsubpd_Vo_Wo(); 961 0x1: psrlw_Vo_Wo(); 962 0x2: psrld_Vo_Wo(); 963 0x3: psrlq_Vo_Wo(); 964 0x4: paddq_Vo_Wo(); 965 0x5: pmullw_Vo_Wo(); 966 0x6: Inst::MOVQ(Wq,Vq); 967 0x7: pmovmskb_Gd_VRo(); 968 } 969 // repne (0xF2) 970 0x8: decode OPCODE_OP_BOTTOM3 { 971 0x0: addsubps_Vo_Wo(); 972 0x6: movdq2q_Pq_VRq(); 973 default: Inst::UD2(); 974 } 975 default: Inst::UD2(); 976 } 977 0x1B: decode LEGACY_DECODEVAL { 978 // no prefix 979 0x0: decode OPCODE_OP_BOTTOM3 { 980 0x0: psubusb_Pq_Qq(); 981 0x1: psubusw_Pq_Qq(); 982 0x2: pminub_Pq_Qq(); 983 0x3: Inst::PAND(Pq,Qq); 984 0x4: paddusb_Pq_Qq(); 985 0x5: paddusw_Pq_Qq(); 986 0x6: pmaxub_Pq_Qq(); 987 0x7: Inst::PANDN(Pq,Qq); 988 } 989 // operand size (0x66) 990 0x1: decode OPCODE_OP_BOTTOM3 { 991 0x0: psubusb_Vo_Wo(); 992 0x1: psubusw_Vo_Wo(); 993 0x2: pminub_Vo_Wo(); 994 0x3: Inst::PAND(Vo,Wo); 995 0x4: paddusb_Vo_Wo(); 996 0x5: paddusw_Vo_Wo(); 997 0x6: pmaxub_Vo_Wo(); 998 0x7: Inst::PANDN(Vo,Wo); 999 } 1000 default: Inst::UD2(); 1001 } 1002 0x1C: decode LEGACY_DECODEVAL { 1003 // no prefix 1004 0x0: decode OPCODE_OP_BOTTOM3 { 1005 0x0: pavgb_Pq_Qq(); 1006 0x1: psraw_Pq_Qq(); 1007 0x2: psrad_Pq_Qq(); 1008 0x3: pavgw_Pq_Qq(); 1009 0x4: pmulhuw_Pq_Qq(); 1010 0x5: pmulhw_Pq_Qq(); 1011 0x7: movntq_Mq_Pq(); 1012 default: Inst::UD2(); 1013 } 1014 // repe (0xF3) 1015 0x4: decode OPCODE_OP_BOTTOM3 {
|
1022 0x6: cvtdq2pd_Vo_Wq();
| 1016 0x6: Inst::CVTDQ2PD(Vo,Wq);
|
1023 default: Inst::UD2(); 1024 } 1025 // operand size (0x66) 1026 0x1: decode OPCODE_OP_BOTTOM3 { 1027 0x0: pavgb_Vo_Wo(); 1028 0x1: psraw_Vo_Wo(); 1029 0x2: psrad_Vo_Wo(); 1030 0x3: pavgw_Vo_Wo(); 1031 0x4: pmulhuw_Vo_Wo(); 1032 0x5: pmulhw_Vo_Wo(); 1033 0x6: cvttpd2dq_Vo_Wo(); 1034 0x7: movntdq_Mo_Vo(); 1035 } 1036 // repne (0xF2) 1037 0x8: decode OPCODE_OP_BOTTOM3 { 1038 0x6: cvtpd2dq_Vo_Wo(); 1039 default: Inst::UD2(); 1040 } 1041 default: Inst::UD2(); 1042 } 1043 0x1D: decode LEGACY_DECODEVAL { 1044 // no prefix 1045 0x0: decode OPCODE_OP_BOTTOM3 { 1046 0x0: psubsb_Pq_Qq(); 1047 0x1: psubsw_Pq_Qq(); 1048 0x2: pminsw_Pq_Qq(); 1049 0x3: Inst::POR(Pq,Qq); 1050 0x4: paddsb_Pq_Qq(); 1051 0x5: paddsw_Pq_Qq(); 1052 0x6: pmaxsw_Pq_Qq(); 1053 0x7: Inst::PXOR(Pq,Qq); 1054 } 1055 // operand size (0x66) 1056 0x1: decode OPCODE_OP_BOTTOM3 { 1057 0x0: psubsb_Vo_Wo(); 1058 0x1: psubsw_Vo_Wo(); 1059 0x2: pminsw_Vo_Wo(); 1060 0x3: Inst::POR(Vo,Wo); 1061 0x4: paddsb_Vo_Wo(); 1062 0x5: paddsw_Vo_Wo(); 1063 0x6: pmaxsw_Vo_Wo(); 1064 0x7: Inst::PXOR(Vo,Wo); 1065 } 1066 default: Inst::UD2(); 1067 } 1068 0x1E: decode LEGACY_DECODEVAL { 1069 // no prefix 1070 0x0: decode OPCODE_OP_BOTTOM3 { 1071 0x1: psllw_Pq_Qq(); 1072 0x2: pslld_Pq_Qq(); 1073 0x3: psllq_Pq_Qq(); 1074 0x4: pmuludq_Pq_Qq(); 1075 0x5: pmaddwd_Pq_Qq(); 1076 0x6: psadbw_Pq_Qq(); 1077 0x7: maskmovq_Pq_PRq(); 1078 default: Inst::UD2(); 1079 } 1080 // operand size (0x66) 1081 0x1: decode OPCODE_OP_BOTTOM3 { 1082 0x1: psllw_Vo_Wo(); 1083 0x2: pslld_Vo_Wo(); 1084 0x3: psllq_Vo_Wo(); 1085 0x4: pmuludq_Vo_Wo(); 1086 0x5: pmaddwd_Vo_Wo(); 1087 0x6: psadbw_Vo_Wo(); 1088 0x7: maskmovdqu_Vo_VRo(); 1089 default: Inst::UD2(); 1090 } 1091 // repne (0xF2) 1092 0x8: decode OPCODE_OP_BOTTOM3 { 1093 0x0: lddqu_Vo_Mo(); 1094 default: Inst::UD2(); 1095 } 1096 default: Inst::UD2(); 1097 } 1098 0x1F: decode LEGACY_DECODEVAL { 1099 // no prefix 1100 0x0: decode OPCODE_OP_BOTTOM3 { 1101 0x0: psubb_Pq_Qq(); 1102 0x1: psubw_Pq_Qq(); 1103 0x2: psubd_Pq_Qq(); 1104 0x3: psubq_Pq_Qq(); 1105 0x4: paddb_Pq_Qq(); 1106 0x5: paddw_Pq_Qq(); 1107 0x6: paddd_Pq_Qq(); 1108 0x7: Inst::UD2(); 1109 } 1110 // operand size (0x66) 1111 0x1: decode OPCODE_OP_BOTTOM3 { 1112 0x0: psubb_Vo_Wo(); 1113 0x1: psubw_Vo_Wo(); 1114 0x2: psubd_Vo_Wo(); 1115 0x3: psubq_Vo_Wo(); 1116 0x4: paddb_Vo_Wo(); 1117 0x5: paddw_Vo_Wo(); 1118 0x6: paddd_Vo_Wo(); 1119 0x7: Inst::UD2(); 1120 } 1121 default: Inst::UD2(); 1122 } 1123 default: FailUnimpl::twoByteOps(); 1124 } 1125 } 1126 default: M5InternalError::error( 1127 {{"Unexpected first opcode byte in two byte opcode!"}}); 1128}
| 1017 default: Inst::UD2(); 1018 } 1019 // operand size (0x66) 1020 0x1: decode OPCODE_OP_BOTTOM3 { 1021 0x0: pavgb_Vo_Wo(); 1022 0x1: psraw_Vo_Wo(); 1023 0x2: psrad_Vo_Wo(); 1024 0x3: pavgw_Vo_Wo(); 1025 0x4: pmulhuw_Vo_Wo(); 1026 0x5: pmulhw_Vo_Wo(); 1027 0x6: cvttpd2dq_Vo_Wo(); 1028 0x7: movntdq_Mo_Vo(); 1029 } 1030 // repne (0xF2) 1031 0x8: decode OPCODE_OP_BOTTOM3 { 1032 0x6: cvtpd2dq_Vo_Wo(); 1033 default: Inst::UD2(); 1034 } 1035 default: Inst::UD2(); 1036 } 1037 0x1D: decode LEGACY_DECODEVAL { 1038 // no prefix 1039 0x0: decode OPCODE_OP_BOTTOM3 { 1040 0x0: psubsb_Pq_Qq(); 1041 0x1: psubsw_Pq_Qq(); 1042 0x2: pminsw_Pq_Qq(); 1043 0x3: Inst::POR(Pq,Qq); 1044 0x4: paddsb_Pq_Qq(); 1045 0x5: paddsw_Pq_Qq(); 1046 0x6: pmaxsw_Pq_Qq(); 1047 0x7: Inst::PXOR(Pq,Qq); 1048 } 1049 // operand size (0x66) 1050 0x1: decode OPCODE_OP_BOTTOM3 { 1051 0x0: psubsb_Vo_Wo(); 1052 0x1: psubsw_Vo_Wo(); 1053 0x2: pminsw_Vo_Wo(); 1054 0x3: Inst::POR(Vo,Wo); 1055 0x4: paddsb_Vo_Wo(); 1056 0x5: paddsw_Vo_Wo(); 1057 0x6: pmaxsw_Vo_Wo(); 1058 0x7: Inst::PXOR(Vo,Wo); 1059 } 1060 default: Inst::UD2(); 1061 } 1062 0x1E: decode LEGACY_DECODEVAL { 1063 // no prefix 1064 0x0: decode OPCODE_OP_BOTTOM3 { 1065 0x1: psllw_Pq_Qq(); 1066 0x2: pslld_Pq_Qq(); 1067 0x3: psllq_Pq_Qq(); 1068 0x4: pmuludq_Pq_Qq(); 1069 0x5: pmaddwd_Pq_Qq(); 1070 0x6: psadbw_Pq_Qq(); 1071 0x7: maskmovq_Pq_PRq(); 1072 default: Inst::UD2(); 1073 } 1074 // operand size (0x66) 1075 0x1: decode OPCODE_OP_BOTTOM3 { 1076 0x1: psllw_Vo_Wo(); 1077 0x2: pslld_Vo_Wo(); 1078 0x3: psllq_Vo_Wo(); 1079 0x4: pmuludq_Vo_Wo(); 1080 0x5: pmaddwd_Vo_Wo(); 1081 0x6: psadbw_Vo_Wo(); 1082 0x7: maskmovdqu_Vo_VRo(); 1083 default: Inst::UD2(); 1084 } 1085 // repne (0xF2) 1086 0x8: decode OPCODE_OP_BOTTOM3 { 1087 0x0: lddqu_Vo_Mo(); 1088 default: Inst::UD2(); 1089 } 1090 default: Inst::UD2(); 1091 } 1092 0x1F: decode LEGACY_DECODEVAL { 1093 // no prefix 1094 0x0: decode OPCODE_OP_BOTTOM3 { 1095 0x0: psubb_Pq_Qq(); 1096 0x1: psubw_Pq_Qq(); 1097 0x2: psubd_Pq_Qq(); 1098 0x3: psubq_Pq_Qq(); 1099 0x4: paddb_Pq_Qq(); 1100 0x5: paddw_Pq_Qq(); 1101 0x6: paddd_Pq_Qq(); 1102 0x7: Inst::UD2(); 1103 } 1104 // operand size (0x66) 1105 0x1: decode OPCODE_OP_BOTTOM3 { 1106 0x0: psubb_Vo_Wo(); 1107 0x1: psubw_Vo_Wo(); 1108 0x2: psubd_Vo_Wo(); 1109 0x3: psubq_Vo_Wo(); 1110 0x4: paddb_Vo_Wo(); 1111 0x5: paddw_Vo_Wo(); 1112 0x6: paddd_Vo_Wo(); 1113 0x7: Inst::UD2(); 1114 } 1115 default: Inst::UD2(); 1116 } 1117 default: FailUnimpl::twoByteOps(); 1118 } 1119 } 1120 default: M5InternalError::error( 1121 {{"Unexpected first opcode byte in two byte opcode!"}}); 1122}
|