two_byte_opcodes.isa revision 4730:77e3e9b15e7e
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: Inst::UD2(); 84 0x3: UD2(); 85 0x4: Inst::UD2(); 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: Inst::UD2(); 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 format Inst { 231 0x10: decode OPCODE_OP_BOTTOM3 { 232 0x0: JO(Jz); 233 0x1: JNO(Jz); 234 0x2: JB(Jz); 235 0x3: JNB(Jz); 236 0x4: JZ(Jz); 237 0x5: JNZ(Jz); 238 0x6: JBE(Jz); 239 0x7: JNBE(Jz); 240 } 241 0x11: decode OPCODE_OP_BOTTOM3 { 242 0x0: JS(Jz); 243 0x1: JNS(Jz); 244 0x2: JP(Jz); 245 0x3: JNP(Jz); 246 0x4: JL(Jz); 247 0x5: JNL(Jz); 248 0x6: JLE(Jz); 249 0x7: JNLE(Jz); 250 } 251 } 252 0x12: decode OPCODE_OP_BOTTOM3 { 253 0x0: seto_Eb(); 254 0x1: setno_Eb(); 255 0x2: setb_Eb(); 256 0x3: setnb_Eb(); 257 0x4: setz_Eb(); 258 0x5: setnz_Eb(); 259 0x6: setbe_Eb(); 260 0x7: setnbe_Eb(); 261 } 262 0x13: decode OPCODE_OP_BOTTOM3 { 263 0x0: sets_Eb(); 264 0x1: setns_Eb(); 265 0x2: setp_Eb(); 266 0x3: setnp_Eb(); 267 0x4: setl_Eb(); 268 0x5: setnl_Eb(); 269 0x6: setle_Eb(); 270 0x7: setnle_Eb(); 271 } 272 0x14: decode OPCODE_OP_BOTTOM3 { 273 0x0: push_fs(); 274 0x1: pop_fs(); 275 0x2: cpuid(); 276 0x3: bt_Ev_Gv(); 277 0x4: shld_Ev_Gv_Ib(); 278 0x5: shld_Ev_Gv_rCl(); 279 0x6: xbts_and_cmpxchg(); 280 0x7: ibts_and_cmpxchg(); 281 } 282 0x15: decode OPCODE_OP_BOTTOM3 { 283 0x0: push_gs(); 284 0x1: pop_gs(); 285 0x2: rsm_smm(); 286 0x3: bts_Ev_Gv(); 287 0x4: shrd_Ev_Gv_Ib(); 288 0x5: shrd_Ev_Gv_rCl(); 289 0x6: group16(); 290 0x7: Inst::IMUL(Gv,Ev); 291 } 292 0x16: decode OPCODE_OP_BOTTOM3 { 293 0x0: cmpxchg_Eb_Gb(); 294 0x1: cmpxchg_Ev_Gv(); 295 0x2: lss_Gz_Mp(); 296 0x3: btr_Ev_Gv(); 297 0x4: lfs_Gz_Mp(); 298 0x5: lgs_Gz_Mp(); 299 0x6: Inst::MOVZX_B(Gv,Eb); 300 0x7: Inst::MOVZX_W(Gv,Ew); 301 } 302 0x17: decode OPCODE_OP_BOTTOM3 { 303 0x0: jmpe_Jz(); // IA-64? 304 0x1: group11_UD2(); 305 0x2: group8_Ev_Ib(); 306 0x3: btc_Ev_Gv(); 307 0x4: bsf_Gv_Ev(); 308 0x5: bsr_Gv_Ev(); 309 0x6: Inst::MOVSX_B(Gv,Eb); 310 0x7: Inst::MOVSX_W(Gv,Ew); 311 } 312 0x18: decode OPCODE_OP_BOTTOM3 { 313 0x0: holder(); 314 0x1: holder(); 315 0x2: holder(); 316 0x3: holder(); 317 0x4: holder(); 318 0x5: holder(); 319 0x6: holder(); 320 0x7: holder(); 321 } 322 0x19: bswap_B(); 323 0x1A: decode OPCODE_OP_BOTTOM3 { 324 0x0: holder(); 325 0x1: holder(); 326 0x2: holder(); 327 0x3: holder(); 328 0x4: holder(); 329 0x5: holder(); 330 0x6: holder(); 331 0x7: holder(); 332 } 333 0x1B: decode OPCODE_OP_BOTTOM3 { 334 0x0: holder(); 335 0x1: holder(); 336 0x2: holder(); 337 0x3: holder(); 338 0x4: holder(); 339 0x5: holder(); 340 0x6: holder(); 341 0x7: holder(); 342 } 343 0x1C: decode OPCODE_OP_BOTTOM3 { 344 0x0: holder(); 345 0x1: holder(); 346 0x2: holder(); 347 0x3: holder(); 348 0x4: holder(); 349 0x5: holder(); 350 0x6: holder(); 351 0x7: holder(); 352 } 353 0x1D: decode OPCODE_OP_BOTTOM3 { 354 0x0: holder(); 355 0x1: holder(); 356 0x2: holder(); 357 0x3: holder(); 358 0x4: holder(); 359 0x5: holder(); 360 0x6: holder(); 361 0x7: holder(); 362 } 363 0x1E: decode OPCODE_OP_BOTTOM3 { 364 0x0: holder(); 365 0x1: holder(); 366 0x2: holder(); 367 0x3: holder(); 368 0x4: holder(); 369 0x5: holder(); 370 0x6: holder(); 371 0x7: holder(); 372 } 373 0x1F: decode OPCODE_OP_BOTTOM3 { 374 0x0: holder(); 375 0x1: holder(); 376 0x2: holder(); 377 0x3: holder(); 378 0x4: holder(); 379 0x5: holder(); 380 0x6: holder(); 381 0x7: holder(); 382 } 383 default: FailUnimpl::twoByteOps(); 384 } 385 } 386 default: M5InternalError::error( 387 {{"Unexpected first opcode byte in two byte opcode!"}}); 388} 389