one_byte_opcodes.isa revision 4519:f8da6b45573f
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 one byte opcodes 59// 60 610x1: decode OPCODE_OP_TOP5 { 62 format WarnUnimpl { 63 0x00: decode OPCODE_OP_BOTTOM3 { 64 0x4: ADD(); 65 0x5: ADD(); 66 0x6: push_ES(); 67 0x7: pop_ES(); 68 default: ADD(); 69 } 70 0x01: decode OPCODE_OP_BOTTOM3 { 71 0x0: or_Eb_Gb(); 72 0x1: or_Ev_Gv(); 73 0x2: or_Gb_Eb(); 74 0x3: or_Gv_Ev(); 75 0x4: or_Al_Ib(); 76 0x5: or_rAX_Iz(); 77 0x6: push_CS(); 78 //Any time this is seen, it should generate a two byte opcode 79 0x7: M5InternalError::error( 80 {{"Saw a one byte opcode whose value was 0x0F!"}}); 81 } 82 0x02: decode OPCODE_OP_BOTTOM3 { 83 0x0: adc_Eb_Gb(); 84 0x1: adc_Ev_Gv(); 85 0x2: adc_Gb_Eb(); 86 0x3: adc_Gv_Ev(); 87 0x4: adc_Al_Ib(); 88 0x5: adc_rAX_Iz(); 89 0x6: push_SS(); 90 0x7: pop_SS(); 91 } 92 0x03: decode OPCODE_OP_BOTTOM3 { 93 0x0: sbb_Eb_Gb(); 94 0x1: sbb_Ev_Gv(); 95 0x2: sbb_Gb_Eb(); 96 0x3: sbb_Gv_Ev(); 97 0x4: sbb_Al_Ib(); 98 0x5: sbb_rAX_Iz(); 99 0x6: push_DS(); 100 0x7: pop_DS(); 101 } 102 0x04: decode OPCODE_OP_BOTTOM3 { 103 0x0: and_Eb_Gb(); 104 0x1: and_Ev_Gv(); 105 0x2: and_Gb_Eb(); 106 0x3: and_Gv_Ev(); 107 0x4: and_Al_Ib(); 108 0x5: and_rAX_Iz(); 109 0x6: M5InternalError::error( 110 {{"Tried to execute the ES segment override prefix!"}}); 111 0x7: daa(); 112 } 113 0x05: decode OPCODE_OP_BOTTOM3 { 114 0x0: sub_Eb_Gb(); 115 0x1: sub_Ev_Gv(); 116 0x2: sub_Gb_Eb(); 117 0x3: sub_Gv_Ev(); 118 0x4: sub_Al_Ib(); 119 0x5: sub_rAX_Iz(); 120 0x6: M5InternalError::error( 121 {{"Tried to execute the CS segment override prefix!"}}); 122 0x7: das(); 123 } 124 0x06: decode OPCODE_OP_BOTTOM3 { 125 0x4: Inst::XOR(ALIb); 126 0x5: Inst::XOR(rAX,Iz); 127 0x6: M5InternalError::error( 128 {{"Tried to execute the SS segment override prefix!"}}); 129 0x7: aaa(); 130 default: MultiInst::XOR(EbGb, EvGv, GbEb, GvEv); 131 } 132 0x07: decode OPCODE_OP_BOTTOM3 { 133 0x0: cmp_Eb_Gb(); 134 0x1: cmp_Ev_Gv(); 135 0x2: cmp_Gb_Eb(); 136 0x3: cmp_Gv_Ev(); 137 0x4: cmp_Al_Ib(); 138 0x5: cmp_rAX_Iz(); 139 0x6: M5InternalError::error( 140 {{"Tried to execute the DS segment override prefix!"}}); 141 0x7: aas(); 142 } 143 0x08: decode OPCODE_OP_BOTTOM3 { 144 0x0: inc_eAX(); 145 0x1: inc_eCX(); 146 0x2: inc_eDX(); 147 0x3: inc_eBX(); 148 0x4: inc_eSP(); 149 0x5: inc_eBP(); 150 0x6: inc_eSI(); 151 0x7: inc_eDI(); 152 } 153 0x09: decode OPCODE_OP_BOTTOM3 { 154 0x0: dec_eAX(); 155 0x1: dec_eCX(); 156 0x2: dec_eDX(); 157 0x3: dec_eBX(); 158 0x4: dec_eSP(); 159 0x5: dec_eBP(); 160 0x6: dec_eSI(); 161 0x7: dec_eDI(); 162 } 163 0x0A: decode OPCODE_OP_BOTTOM3 { 164 0x0: push_rAX(); 165 0x1: push_rCX(); 166 0x2: push_rDX(); 167 0x3: push_rBX(); 168 0x4: push_rSP(); 169 0x5: push_rBP(); 170 0x6: push_rSI(); 171 0x7: push_rDI(); 172 } 173 0x0B: decode OPCODE_OP_BOTTOM3 { 174 0x0: pop_rAX(); 175 0x1: pop_rCX(); 176 0x2: pop_rDX(); 177 0x3: pop_rBX(); 178 0x4: pop_rSP(); 179 0x5: pop_rBP(); 180 0x6: pop_rSI(); 181 0x7: pop_rDI(); 182 } 183 0x0C: decode OPCODE_OP_BOTTOM3 { 184 0x0: pusha(); 185 0x1: popa(); 186 0x2: bound_Gv_Ma(); 187 0x3: arpl_Ew_Gw(); 188 0x4: M5InternalError::error( 189 {{"Tried to execute the FS segment override prefix!"}}); 190 0x5: M5InternalError::error( 191 {{"Tried to execute the GS segment override prefix!"}}); 192 0x6: M5InternalError::error( 193 {{"Tried to execute the operand size override prefix!"}}); 194 0x7: M5InternalError::error( 195 {{"Tried to execute the DS address size override prefix!"}}); 196 } 197 0x0D: decode OPCODE_OP_BOTTOM3 { 198 0x0: push_Iz(); 199 0x1: imul_Gv_Ev_Iz(); 200 0x2: push_Ib(); 201 0x3: imul_Gv_Ev_Ib(); 202 0x4: ins_Yb_Dx(); 203 0x5: ins_Yz_Dx(); 204 0x6: outs_Dx_Xb(); 205 0x7: outs_Dx_Xz(); 206 } 207 0x0E: decode OPCODE_OP_BOTTOM3 { 208 0x0: jo_Jb(); 209 0x1: jno_Jb(); 210 0x2: jb_Jb(); 211 0x3: jnb_Jb(); 212 0x4: jz_Jb(); 213 0x5: jnz_Jb(); 214 0x6: jbe_Jb(); 215 0x7: jnbe_Jb(); 216 } 217 0x0F: decode OPCODE_OP_BOTTOM3 { 218 0x0: js_Jb(); 219 0x1: jns_Jb(); 220 0x2: jp_Jb(); 221 0x3: jnp_Jb(); 222 0x4: jl_Jb(); 223 0x5: jnl_Jb(); 224 0x6: jle_Jb(); 225 0x7: jnke_Jb(); 226 } 227 0x10: decode OPCODE_OP_BOTTOM3 { 228 0x0: group1_Eb_Ib(); 229 0x1: group1_Ev_Iz(); 230 0x2: group1_Eb_Ib(); 231 0x3: group1_Ev_Ib(); 232 0x4: test_Eb_Gb(); 233 0x5: test_Ev_Gv(); 234 0x6: xchg_Eb_Gb(); 235 0x7: xchg_Ev_Gv(); 236 } 237 0x11: decode OPCODE_OP_BOTTOM3 { 238 0x0: MOV(); 239 0x1: MOV(); 240 0x2: MOV(); 241 0x3: MOV(); 242 0x4: mov_MwRv_Sw(); //What to do with this one? 243 0x5: lea_Gv_M(); 244 0x6: mov_Sw_MwRv(); 245 0x7: group10_Ev(); //Make sure this is Ev 246 } 247 0x12: decode OPCODE_OP_BOTTOM3 { 248 0x0: nop_or_pause(); //Check for repe prefix 249 0x1: xchg_rCX_rAX(); 250 0x2: xchg_rDX_rAX(); 251 0x3: xchg_rVX_rAX(); 252 0x4: xchg_rSP_rAX(); 253 0x5: xchg_rBP_rAX(); 254 0x6: xchg_rSI_rAX(); 255 0x7: xchg_rDI_rAX(); 256 } 257 0x13: decode OPCODE_OP_BOTTOM3 { 258 0x0: cbw_or_cwde_or_cdqe_rAX(); 259 0x1: cwd_or_cdq_or_cqo_rAX_rDX(); 260 0x2: call_Ap(); 261 0x3: fwait(); //aka wait 262 0x4: pushf_Fv(); 263 0x5: popf_Fv(); 264 0x6: sahf(); 265 0x7: lahf(); 266 } 267 0x14: decode OPCODE_OP_BOTTOM3 { 268 0x0: mov_Al_Ob(); 269 0x1: mov_rAX_Ov(); 270 0x2: mov_Ob_Al(); 271 0x3: mov_Ov_rAX(); 272 0x4: movs_Yb_Xb(); 273 0x5: movs_Yv_Xv(); 274 0x6: cmps_Yb_Xb(); 275 0x7: cmps_Yv_Xv(); 276 } 277 0x15: decode OPCODE_OP_BOTTOM3 { 278 0x0: test_Al_Ib(); 279 0x1: test_rAX_Iz(); 280 0x2: stos_Yb_Al(); 281 0x3: stos_Yv_rAX(); 282 0x4: lods_Al_Xb(); 283 0x5: lods_rAX_Xv(); 284 0x6: scas_Yb_Al(); 285 0x7: scas_Yv_rAX(); 286 } 287 0x16: decode OPCODE_OP_BOTTOM3 { 288 0x0: mov_Al_Ib(); 289 0x1: mov_Cl_Ib(); 290 0x2: mov_Dl_Ib(); 291 0x3: mov_Bl_Ib(); 292 0x4: mov_Ah_Ib(); 293 0x5: mov_Ch_Ib(); 294 0x6: mov_Dh_Ib(); 295 0x7: mov_Bh_Ib(); 296 } 297 0x17: decode OPCODE_OP_BOTTOM3 { 298 0x0: mov_rAX_Iv(); 299 0x1: mov_rCX_Iv(); 300 0x2: mov_rDX_Iv(); 301 0x3: mov_rBX_Iv(); 302 0x4: mov_rSP_Iv(); 303 0x5: mov_rBP_Iv(); 304 0x6: mov_rSI_Iv(); 305 0x7: mov_rDI_Iv(); 306 } 307 0x18: decode OPCODE_OP_BOTTOM3 { 308 0x0: group2_Eb_Ib(); 309 0x1: group2_Ev_Ib(); 310 0x2: ret_near_Iw(); 311 0x3: ret_near(); 312 0x4: les_Gz_Mp(); 313 0x5: lds_Gz_Mp(); 314 0x6: group12_Eb_Ib(); 315 0x7: group12_Ev_Iz(); 316 } 317 0x19: decode OPCODE_OP_BOTTOM3 { 318 0x0: enter_Iw_Ib(); 319 0x1: leave(); 320 0x2: ret_far_Iw(); 321 0x3: ret_far(); 322 0x4: int3(); 323 0x5: int_Ib(); 324 0x6: into(); 325 0x7: iret(); 326 } 327 0x1A: decode OPCODE_OP_BOTTOM3 { 328 0x0: group2_Eb_1(); 329 0x1: group2_Ev_1(); 330 0x2: group2_Eb_Cl(); 331 0x3: group2_Ev_Cl(); 332 0x4: aam_Ib(); 333 0x5: aad_Ib(); 334 0x6: salc(); 335 0x7: xlat(); 336 } 337 0x1B: decode OPCODE_OP_BOTTOM3 { 338 0x0: esc0(); 339 0x1: esc1(); 340 0x2: esc2(); 341 0x3: esc3(); 342 0x4: esc4(); 343 0x5: esc5(); 344 0x6: esc6(); 345 0x7: esc7(); 346 } 347 0x1C: decode OPCODE_OP_BOTTOM3 { 348 0x0: loopne_Jb(); 349 0x1: loope_Jb(); 350 0x2: loop_Jb(); 351 0x3: jcxz_or_jecx_or_jrcx(); 352 0x4: in_Al_Ib(); 353 0x5: in_eAX_Ib(); 354 0x6: out_Ib_Al(); 355 0x7: out_Ib_eAX(); 356 } 357 0x1D: decode OPCODE_OP_BOTTOM3 { 358 0x0: call_Jz(); 359 0x1: jmp_Jz(); 360 0x2: jmp_Ap(); 361 0x3: jmp_Jb(); 362 0x4: in_Al_Dx(); 363 0x5: in_eAX_Dx(); 364 0x6: out_Dx_Al(); 365 0x7: out_Dx_eAX(); 366 } 367 0x1E: decode OPCODE_OP_BOTTOM3 { 368 0x0: M5InternalError::error( 369 {{"Tried to execute the lock prefix!"}}); 370 0x1: int1(); 371 0x2: M5InternalError::error( 372 {{"Tried to execute the repne prefix!"}}); 373 0x3: M5InternalError::error( 374 {{"Tried to execute the rep/repe prefix!"}}); 375 0x4: hlt(); 376 0x5: cmc(); 377 0x6: group3_Eb(); 378 0x7: group3_Ev(); 379 } 380 0x1F: decode OPCODE_OP_BOTTOM3 { 381 0x0: clc(); 382 0x1: stc(); 383 0x2: cli(); 384 0x3: sti(); 385 0x4: cld(); 386 0x5: std(); 387 0x6: group4(); 388 0x7: group5(); 389 } 390 } 391 default: FailUnimpl::oneByteOps(); 392} 393