two_byte_opcodes.isa revision 4712
1// Copyright (c) 2007 The Hewlett-Packard Development Company 2// All rights reserved. 3// 4// Redistribution and use of this software in source and binary forms, 5// with or without modification, are permitted provided that the 6// following conditions are met: 7// 8// The software must be used only for Non-Commercial Use which means any 9// use which is NOT directed to receiving any direct monetary 10// compensation for, or commercial advantage from such use. Illustrative 11// examples of non-commercial use are academic research, personal study, 12// teaching, education and corporate research & development. 13// Illustrative examples of commercial use are distributing products for 14// commercial advantage and providing services using the software for 15// commercial advantage. 16// 17// If you wish to use this software or functionality therein that may be 18// covered by patents for commercial use, please contact: 19// Director of Intellectual Property Licensing 20// Office of Strategy and Technology 21// Hewlett-Packard Company 22// 1501 Page Mill Road 23// Palo Alto, California 94304 24// 25// Redistributions of source code must retain the above copyright notice, 26// this list of conditions and the following disclaimer. Redistributions 27// in binary form must reproduce the above copyright notice, this list of 28// conditions and the following disclaimer in the documentation and/or 29// other materials provided with the distribution. Neither the name of 30// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 31// contributors may be used to endorse or promote products derived from 32// this software without specific prior written permission. No right of 33// sublicense is granted herewith. Derivatives of the software and 34// output created using the software may be prepared, but only for 35// Non-Commercial Uses. Derivatives of the software may be shared with 36// others provided: (i) the others agree to abide by the list of 37// conditions herein which includes the Non-Commercial Use restrictions; 38// and (ii) such Derivatives of the software include the above copyright 39// notice to acknowledge the contribution from this software where 40// applicable, this list of conditions and the disclaimer below. 41// 42// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 43// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 44// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 45// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 46// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 48// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53// 54// Authors: Gabe Black 55 56//////////////////////////////////////////////////////////////////// 57// 58// Decode the two byte opcodes 59// 600x2: decode OPCODE_PREFIXA { 61 0x0F: decode OPCODE_OP_TOP5 { 62 format WarnUnimpl { 63 0x00: decode OPCODE_OP_BOTTOM3 { 64 0x00: group6(); 65 0x01: group7(); 66 0x02: lar_Gv_Ew(); 67 0x03: lsl_Gv_Ew(); 68 //sandpile.org doesn't seem to know what this is... ? 69 0x04: loadall_or_reset_or_hang(); 70#if FULL_SYSTEM 71 0x05: syscall(); 72#else 73 0x05: SyscallInst::syscall('xc->syscall(rax)'); 74#endif 75 0x06: clts(); 76 //sandpile.org says (AMD) after sysret, so I might want to check 77 //if that means amd64 or AMD machines 78 0x07: loadall_or_sysret(); 79 } 80 0x01: decode OPCODE_OP_BOTTOM3 { 81 0x0: invd(); 82 0x1: wbinvd(); 83 0x2: This_should_be_an_illegal_instruction(); 84 0x3: UD1(); 85 0x4: This_should_be_an_illegal_instruction(); 86 0x5: threednow(); 87 0x6: threednow(); 88 0x7: threednow(); 89 } 90 0x02: decode OPCODE_OP_BOTTOM3 { 91 0x0: holder(); 92 0x1: holder(); 93 0x2: holder(); 94 0x3: holder(); 95 0x4: holder(); 96 0x5: holder(); 97 0x6: holder(); 98 0x7: holder(); 99 } 100 0x03: decode OPCODE_OP_BOTTOM3 { 101 0x0: group17(); 102 0x1: group17(); 103 0x2: group17(); 104 0x3: group17(); 105 0x4: group17(); 106 0x5: group17(); 107 0x6: group17(); 108 0x7: group17(); 109 } 110 0x04: decode OPCODE_OP_BOTTOM3 { 111 0x0: holder(); 112 0x1: holder(); 113 0x2: holder(); 114 0x3: holder(); 115 0x4: holder(); 116 0x5: holder(); 117 0x6: holder(); 118 0x7: holder(); 119 } 120 0x05: decode OPCODE_OP_BOTTOM3 { 121 0x0: holder(); 122 0x1: holder(); 123 0x2: holder(); 124 0x3: holder(); 125 0x4: holder(); 126 0x5: holder(); 127 0x6: holder(); 128 0x7: holder(); 129 } 130 0x06: decode OPCODE_OP_BOTTOM3 { 131 0x0: wrmsr(); 132 0x1: rdtsc(); 133 0x2: rdmsr(); 134 0x3: rdpmc(); 135 0x4: sysenter(); 136 0x5: sysexit(); 137 0x6: This_should_be_an_illegal_instruction(); 138 0x7: getsec(); 139 } 140 0x07: decode OPCODE_OP_BOTTOM3 { 141 0x0: three_byte_opcode(); 142 0x1: three_byte_opcode(); 143 0x2: three_byte_opcode(); 144 0x3: three_byte_opcode(); 145 0x4: three_byte_opcode(); 146 0x5: three_byte_opcode(); 147 0x6: three_byte_opcode(); 148 0x7: three_byte_opcode(); 149 } 150 0x08: decode OPCODE_OP_BOTTOM3 { 151 0x0: cmovo_Gv_Ev(); 152 0x1: cmovno_Gv_Ev(); 153 0x2: cmovb_Gv_Ev(); 154 0x3: cmovnb_Gv_Ev(); 155 0x4: cmovz_Gv_Ev(); 156 0x5: cmovnz_Gv_Ev(); 157 0x6: cmovbe_Gv_Ev(); 158 0x7: cmovnbe_Gv_Ev(); 159 } 160 0x09: decode OPCODE_OP_BOTTOM3 { 161 0x0: cmovs_Gv_Ev(); 162 0x1: cmovns_Gv_Ev(); 163 0x2: cmovp_Gv_Ev(); 164 0x3: cmovnp_Gv_Ev(); 165 0x4: cmovl_Gv_Ev(); 166 0x5: cmovnl_Gv_Ev(); 167 0x6: cmovle_Gv_Ev(); 168 0x7: cmovnle_Gv_Ev(); 169 } 170 0x0A: decode OPCODE_OP_BOTTOM3 { 171 0x0: holder(); 172 0x1: holder(); 173 0x2: holder(); 174 0x3: holder(); 175 0x4: holder(); 176 0x5: holder(); 177 0x6: holder(); 178 0x7: holder(); 179 } 180 0x0B: decode OPCODE_OP_BOTTOM3 { 181 0x0: holder(); 182 0x1: holder(); 183 0x2: holder(); 184 0x3: holder(); 185 0x4: holder(); 186 0x5: holder(); 187 0x6: holder(); 188 0x7: holder(); 189 } 190 0x0C: decode OPCODE_OP_BOTTOM3 { 191 0x0: holder(); 192 0x1: holder(); 193 0x2: holder(); 194 0x3: holder(); 195 0x4: holder(); 196 0x5: holder(); 197 0x6: holder(); 198 0x7: holder(); 199 } 200 0x0D: decode OPCODE_OP_BOTTOM3 { 201 0x0: holder(); 202 0x1: holder(); 203 0x2: holder(); 204 0x3: holder(); 205 0x4: holder(); 206 0x5: holder(); 207 0x6: holder(); 208 0x7: holder(); 209 } 210 0x0E: decode OPCODE_OP_BOTTOM3 { 211 0x0: holder(); 212 0x1: holder(); 213 0x2: holder(); 214 0x3: holder(); 215 0x4: holder(); 216 0x5: holder(); 217 0x6: holder(); 218 0x7: holder(); 219 } 220 0x0F: decode OPCODE_OP_BOTTOM3 { 221 0x0: holder(); 222 0x1: holder(); 223 0x2: holder(); 224 0x3: holder(); 225 0x4: holder(); 226 0x5: holder(); 227 0x6: holder(); 228 0x7: holder(); 229 } 230 0x10: decode OPCODE_OP_BOTTOM3 { 231 0x0: jo_Jz(); 232 0x1: jno_Jz(); 233 0x2: jb_Jz(); 234 0x3: Inst::JNB(Jz); 235 0x4: Inst::JZ(Jz); 236 0x5: Inst::JNZ(Jz); 237 0x6: Inst::JBE(Jz); 238 0x7: jnbe_Jz(); 239 } 240 0x11: decode OPCODE_OP_BOTTOM3 { 241 0x0: js_Jz(); 242 0x1: jns_Jz(); 243 0x2: jp_Jz(); 244 0x3: jnp_Jz(); 245 0x4: jl_Jz(); 246 0x5: jnl_Jz(); 247 0x6: jle_Jz(); 248 0x7: jnle_Jz(); 249 } 250 0x12: decode OPCODE_OP_BOTTOM3 { 251 0x0: seto_Eb(); 252 0x1: setno_Eb(); 253 0x2: setb_Eb(); 254 0x3: setnb_Eb(); 255 0x4: setz_Eb(); 256 0x5: setnz_Eb(); 257 0x6: setbe_Eb(); 258 0x7: setnbe_Eb(); 259 } 260 0x13: decode OPCODE_OP_BOTTOM3 { 261 0x0: sets_Eb(); 262 0x1: setns_Eb(); 263 0x2: setp_Eb(); 264 0x3: setnp_Eb(); 265 0x4: setl_Eb(); 266 0x5: setnl_Eb(); 267 0x6: setle_Eb(); 268 0x7: setnle_Eb(); 269 } 270 0x14: decode OPCODE_OP_BOTTOM3 { 271 0x0: push_fs(); 272 0x1: pop_fs(); 273 0x2: cpuid(); 274 0x3: bt_Ev_Gv(); 275 0x4: shld_Ev_Gv_Ib(); 276 0x5: shld_Ev_Gv_rCl(); 277 0x6: xbts_and_cmpxchg(); 278 0x7: ibts_and_cmpxchg(); 279 } 280 0x15: decode OPCODE_OP_BOTTOM3 { 281 0x0: push_gs(); 282 0x1: pop_gs(); 283 0x2: rsm_smm(); 284 0x3: bts_Ev_Gv(); 285 0x4: shrd_Ev_Gv_Ib(); 286 0x5: shrd_Ev_Gv_rCl(); 287 0x6: group16(); 288 0x7: imul_Gv_Ev(); 289 } 290 0x16: decode OPCODE_OP_BOTTOM3 { 291 0x0: cmpxchg_Eb_Gb(); 292 0x1: cmpxchg_Ev_Gv(); 293 0x2: lss_Gz_Mp(); 294 0x3: btr_Ev_Gv(); 295 0x4: lfs_Gz_Mp(); 296 0x5: lgs_Gz_Mp(); 297 0x6: Inst::MOVZX_B(Gv,Eb); 298 0x7: Inst::MOVZX_W(Gv,Ew); 299 } 300 0x17: decode OPCODE_OP_BOTTOM3 { 301 0x0: jmpe_Jz(); // IA-64? 302 0x1: group11_UD2(); 303 0x2: group8_Ev_Ib(); 304 0x3: btc_Ev_Gv(); 305 0x4: bsf_Gv_Ev(); 306 0x5: bsr_Gv_Ev(); 307 0x6: movsx_Gv_Eb(); 308 0x7: movsx_Gv_Ew(); 309 } 310 0x18: decode OPCODE_OP_BOTTOM3 { 311 0x0: holder(); 312 0x1: holder(); 313 0x2: holder(); 314 0x3: holder(); 315 0x4: holder(); 316 0x5: holder(); 317 0x6: holder(); 318 0x7: holder(); 319 } 320 0x19: decode OPCODE_OP_BOTTOM3 { 321 0x0: bswap_rAx(); 322 0x1: bswap_rCx(); 323 0x2: bswap_rDx(); 324 0x3: bswap_rBx(); 325 0x4: bswap_rSP(); 326 0x5: bswap_rBP(); 327 0x6: bswap_rSI(); 328 0x7: bswap_rDI(); 329 } 330 0x1A: decode OPCODE_OP_BOTTOM3 { 331 0x0: holder(); 332 0x1: holder(); 333 0x2: holder(); 334 0x3: holder(); 335 0x4: holder(); 336 0x5: holder(); 337 0x6: holder(); 338 0x7: holder(); 339 } 340 0x1B: decode OPCODE_OP_BOTTOM3 { 341 0x0: holder(); 342 0x1: holder(); 343 0x2: holder(); 344 0x3: holder(); 345 0x4: holder(); 346 0x5: holder(); 347 0x6: holder(); 348 0x7: holder(); 349 } 350 0x1C: decode OPCODE_OP_BOTTOM3 { 351 0x0: holder(); 352 0x1: holder(); 353 0x2: holder(); 354 0x3: holder(); 355 0x4: holder(); 356 0x5: holder(); 357 0x6: holder(); 358 0x7: holder(); 359 } 360 0x1D: decode OPCODE_OP_BOTTOM3 { 361 0x0: holder(); 362 0x1: holder(); 363 0x2: holder(); 364 0x3: holder(); 365 0x4: holder(); 366 0x5: holder(); 367 0x6: holder(); 368 0x7: holder(); 369 } 370 0x1E: decode OPCODE_OP_BOTTOM3 { 371 0x0: holder(); 372 0x1: holder(); 373 0x2: holder(); 374 0x3: holder(); 375 0x4: holder(); 376 0x5: holder(); 377 0x6: holder(); 378 0x7: holder(); 379 } 380 0x1F: decode OPCODE_OP_BOTTOM3 { 381 0x0: holder(); 382 0x1: holder(); 383 0x2: holder(); 384 0x3: holder(); 385 0x4: holder(); 386 0x5: holder(); 387 0x6: holder(); 388 0x7: holder(); 389 } 390 default: FailUnimpl::twoByteOps(); 391 } 392 } 393 default: M5InternalError::error( 394 {{"Unexpected first opcode byte in two byte opcode!"}}); 395} 396