Changeset 41738 in vbox for trunk/src/VBox/Disassembler
- Timestamp:
- Jun 15, 2012 1:25:47 AM (12 years ago)
- Location:
- trunk/src/VBox/Disassembler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmCore.cpp
r41737 r41738 358 358 // segment override prefix byte 359 359 case OP_SEG: 360 pCpu->idxSegPrefix = (DISSELREG)(paOneByteMap[codebyte]. param1 - OP_PARM_REG_SEG_START);360 pCpu->idxSegPrefix = (DISSELREG)(paOneByteMap[codebyte].fParam1 - OP_PARM_REG_SEG_START); 361 361 /* Segment prefixes for CS, DS, ES and SS are ignored in long mode. */ 362 362 if ( pCpu->uCpuMode != DISCPUMODE_64BIT … … 414 414 /* REX prefix byte */ 415 415 pCpu->fPrefix |= DISPREFIX_REX; 416 pCpu->fRexPrefix = DISPREFIX_REX_OP_2_FLAGS(paOneByteMap[codebyte]. param1);416 pCpu->fRexPrefix = DISPREFIX_REX_OP_2_FLAGS(paOneByteMap[codebyte].fParam1); 417 417 iByte += sizeof(uint8_t); 418 418 … … 459 459 * Note! Multibyte opcodes are always marked harmless until the final byte. 460 460 */ 461 if ((pOp-> optype & pCpu->fFilter) == 0)461 if ((pOp->fOpType & pCpu->fFilter) == 0) 462 462 { 463 463 fFiltered = true; … … 471 471 472 472 // Should contain the parameter type on input 473 pCpu->param1.param = pOp-> param1;474 pCpu->param2.param = pOp-> param2;475 pCpu->param3.param = pOp-> param3;473 pCpu->param1.param = pOp->fParam1; 474 pCpu->param2.param = pOp->fParam2; 475 pCpu->param3.param = pOp->fParam3; 476 476 477 477 /* Correct the operand size if the instruction is marked as forced or default 64 bits */ 478 478 if (pCpu->uCpuMode == DISCPUMODE_64BIT) 479 479 { 480 if (pOp-> optype & DISOPTYPE_FORCED_64_OP_SIZE)480 if (pOp->fOpType & DISOPTYPE_FORCED_64_OP_SIZE) 481 481 pCpu->uOpMode = DISCPUMODE_64BIT; 482 482 else 483 if ( (pOp-> optype & DISOPTYPE_DEFAULT_64_OP_SIZE)483 if ( (pOp->fOpType & DISOPTYPE_DEFAULT_64_OP_SIZE) 484 484 && !(pCpu->fPrefix & DISPREFIX_OPSIZE)) 485 485 pCpu->uOpMode = DISCPUMODE_64BIT; 486 486 } 487 487 else 488 if (pOp-> optype & DISOPTYPE_FORCED_32_OP_SIZE_X86)488 if (pOp->fOpType & DISOPTYPE_FORCED_32_OP_SIZE_X86) 489 489 { 490 490 /* Forced 32 bits operand size for certain instructions (mov crx, mov drx). */ … … 534 534 535 535 // Should contain the parameter type on input 536 pCpu->param1.param = fpop-> param1;537 pCpu->param2.param = fpop-> param2;536 pCpu->param1.param = fpop->fParam1; 537 pCpu->param2.param = fpop->fParam2; 538 538 } 539 539 else … … 547 547 * @note Multibyte opcodes are always marked harmless until the final byte. 548 548 */ 549 if ((fpop-> optype & pCpu->fFilter) == 0)549 if ((fpop->fOpType & pCpu->fFilter) == 0) 550 550 pCpu->pfnDisasmFnTable = g_apfnCalcSize; 551 551 else … … 557 557 { 558 558 /* Note: redundant, but just in case this ever changes */ 559 if (fpop-> optype & DISOPTYPE_FORCED_64_OP_SIZE)559 if (fpop->fOpType & DISOPTYPE_FORCED_64_OP_SIZE) 560 560 pCpu->uOpMode = DISCPUMODE_64BIT; 561 561 else 562 if ( (fpop-> optype & DISOPTYPE_DEFAULT_64_OP_SIZE)562 if ( (fpop->fOpType & DISOPTYPE_DEFAULT_64_OP_SIZE) 563 563 && !(pCpu->fPrefix & DISPREFIX_OPSIZE)) 564 564 pCpu->uOpMode = DISCPUMODE_64BIT; … … 1077 1077 * encoding of the MOD field in the MODR/M byte. 1078 1078 */ 1079 if (pOp-> optype & DISOPTYPE_MOD_FIXED_11)1079 if (pOp->fOpType & DISOPTYPE_MOD_FIXED_11) 1080 1080 pCpu->ModRM.Bits.Mod = 3; 1081 1081 … … 1123 1123 * encoding of the MOD field in the MODR/M byte. 1124 1124 */ 1125 if (pOp-> optype & DISOPTYPE_MOD_FIXED_11)1125 if (pOp->fOpType & DISOPTYPE_MOD_FIXED_11) 1126 1126 pCpu->ModRM.Bits.Mod = 3; 1127 1127 … … 1568 1568 /* Use 64-bit registers. */ 1569 1569 pParam->base.reg_gen = pParam->param - OP_PARM_REG_GEN32_START; 1570 if ( (pOp-> optype & DISOPTYPE_REXB_EXTENDS_OPREG)1570 if ( (pOp->fOpType & DISOPTYPE_REXB_EXTENDS_OPREG) 1571 1571 && pParam == &pCpu->param1 /* ugly assumption that it only applies to the first parameter */ 1572 1572 && (pCpu->fPrefix & DISPREFIX_REX) … … 1612 1612 if (pCpu->uOpMode == DISCPUMODE_64BIT) 1613 1613 { 1614 if ( (pOp-> optype & DISOPTYPE_REXB_EXTENDS_OPREG)1614 if ( (pOp->fOpType & DISOPTYPE_REXB_EXTENDS_OPREG) 1615 1615 && pParam == &pCpu->param1 /* ugly assumption that it only applies to the first parameter */ 1616 1616 && (pCpu->fPrefix & DISPREFIX_REX) -
trunk/src/VBox/Disassembler/DisasmFormatYasm.cpp
r41737 r41738 675 675 if ( pParam->param != OP_PARM_Ev 676 676 || pOp->uOpcode != OP_MOV 677 || ( pOp-> param1 != OP_PARM_Sw678 && pOp-> param2 != OP_PARM_Sw))677 || ( pOp->fParam1 != OP_PARM_Sw 678 && pOp->fParam2 != OP_PARM_Sw)) 679 679 PUT_SIZE_OVERRIDE(); 680 680 PUT_C('['); … … 792 792 case DISUSE_IMMEDIATE8: 793 793 if ( (fFlags & DIS_FMT_FLAGS_STRICT) 794 && ( (pOp-> param1 >= OP_PARM_REG_GEN8_START && pOp->param1 <= OP_PARM_REG_GEN8_END)795 || (pOp-> param2 >= OP_PARM_REG_GEN8_START && pOp->param2 <= OP_PARM_REG_GEN8_END))794 && ( (pOp->fParam1 >= OP_PARM_REG_GEN8_START && pOp->fParam1 <= OP_PARM_REG_GEN8_END) 795 || (pOp->fParam2 >= OP_PARM_REG_GEN8_START && pOp->fParam2 <= OP_PARM_REG_GEN8_END)) 796 796 ) 797 797 PUT_SZ("strict byte "); … … 803 803 || ( (fFlags & DIS_FMT_FLAGS_STRICT) 804 804 && ( (int8_t)pParam->parval == (int16_t)pParam->parval 805 || (pOp-> param1 >= OP_PARM_REG_GEN16_START && pOp->param1 <= OP_PARM_REG_GEN16_END)806 || (pOp-> param2 >= OP_PARM_REG_GEN16_START && pOp->param2 <= OP_PARM_REG_GEN16_END))805 || (pOp->fParam1 >= OP_PARM_REG_GEN16_START && pOp->fParam1 <= OP_PARM_REG_GEN16_END) 806 || (pOp->fParam2 >= OP_PARM_REG_GEN16_START && pOp->fParam2 <= OP_PARM_REG_GEN16_END)) 807 807 ) 808 808 ) … … 826 826 || ( (fFlags & DIS_FMT_FLAGS_STRICT) 827 827 && ( (int8_t)pParam->parval == (int32_t)pParam->parval 828 || (pOp-> param1 >= OP_PARM_REG_GEN32_START && pOp->param1 <= OP_PARM_REG_GEN32_END)829 || (pOp-> param2 >= OP_PARM_REG_GEN32_START && pOp->param2 <= OP_PARM_REG_GEN32_END))828 || (pOp->fParam1 >= OP_PARM_REG_GEN32_START && pOp->fParam1 <= OP_PARM_REG_GEN32_END) 829 || (pOp->fParam2 >= OP_PARM_REG_GEN32_START && pOp->fParam2 <= OP_PARM_REG_GEN32_END)) 830 830 ) 831 831 ) … … 1302 1302 { 1303 1303 Assert(pCpu->fPrefix & DISPREFIX_ADDRSIZE); 1304 if ( pCpu->pCurInstr-> param3 == OP_PARM_NONE1305 && pCpu->pCurInstr-> param2 == OP_PARM_NONE1306 && ( pCpu->pCurInstr-> param1 >= OP_PARM_REG_GEN32_START1307 && pCpu->pCurInstr-> param1 <= OP_PARM_REG_GEN32_END))1304 if ( pCpu->pCurInstr->fParam3 == OP_PARM_NONE 1305 && pCpu->pCurInstr->fParam2 == OP_PARM_NONE 1306 && ( pCpu->pCurInstr->fParam1 >= OP_PARM_REG_GEN32_START 1307 && pCpu->pCurInstr->fParam1 <= OP_PARM_REG_GEN32_END)) 1308 1308 return true; 1309 1309 } … … 1319 1319 1320 1320 case OP_JMP: 1321 if ( pCpu->pCurInstr-> param1 != OP_PARM_Jb1322 && pCpu->pCurInstr-> param1 != OP_PARM_Jv)1321 if ( pCpu->pCurInstr->fParam1 != OP_PARM_Jb 1322 && pCpu->pCurInstr->fParam1 != OP_PARM_Jv) 1323 1323 break; 1324 1324 /* fall thru */ … … 1352 1352 case OP_POP: 1353 1353 case OP_PUSH: 1354 if ( pCpu->pCurInstr-> param1 >= OP_PARM_REG_SEG_START1355 && pCpu->pCurInstr-> param1 <= OP_PARM_REG_SEG_END)1354 if ( pCpu->pCurInstr->fParam1 >= OP_PARM_REG_SEG_START 1355 && pCpu->pCurInstr->fParam1 <= OP_PARM_REG_SEG_END) 1356 1356 return true; 1357 1357 if ( (fPrefixes & ~DISPREFIX_OPSIZE) 1358 && pCpu->pCurInstr-> param1 >= OP_PARM_REG_GEN32_START1359 && pCpu->pCurInstr-> param1 <= OP_PARM_REG_GEN32_END)1358 && pCpu->pCurInstr->fParam1 >= OP_PARM_REG_GEN32_START 1359 && pCpu->pCurInstr->fParam1 <= OP_PARM_REG_GEN32_END) 1360 1360 return true; 1361 1361 break; … … 1373 1373 /* Implicit 8-bit register instructions doesn't mix with operand size. */ 1374 1374 if ( (fPrefixes & DISPREFIX_OPSIZE) 1375 && ( ( pCpu->pCurInstr-> param1 == OP_PARM_Gb /* r8 */1376 && pCpu->pCurInstr-> param2 == OP_PARM_Eb /* r8/mem8 */)1377 || ( pCpu->pCurInstr-> param2 == OP_PARM_Gb /* r8 */1378 && pCpu->pCurInstr-> param1 == OP_PARM_Eb /* r8/mem8 */))1375 && ( ( pCpu->pCurInstr->fParam1 == OP_PARM_Gb /* r8 */ 1376 && pCpu->pCurInstr->fParam2 == OP_PARM_Eb /* r8/mem8 */) 1377 || ( pCpu->pCurInstr->fParam2 == OP_PARM_Gb /* r8 */ 1378 && pCpu->pCurInstr->fParam1 == OP_PARM_Eb /* r8/mem8 */)) 1379 1379 ) 1380 1380 { … … 1415 1415 case OP_XOR: 1416 1416 case OP_CMP: 1417 if ( ( pCpu->pCurInstr-> param1 == OP_PARM_Gb /* r8 */1418 && pCpu->pCurInstr-> param2 == OP_PARM_Eb /* r8/mem8 */)1419 || ( pCpu->pCurInstr-> param1 == OP_PARM_Gv /* rX */1420 && pCpu->pCurInstr-> param2 == OP_PARM_Ev /* rX/memX */))1417 if ( ( pCpu->pCurInstr->fParam1 == OP_PARM_Gb /* r8 */ 1418 && pCpu->pCurInstr->fParam2 == OP_PARM_Eb /* r8/mem8 */) 1419 || ( pCpu->pCurInstr->fParam1 == OP_PARM_Gv /* rX */ 1420 && pCpu->pCurInstr->fParam2 == OP_PARM_Ev /* rX/memX */)) 1421 1421 return true; 1422 1422 … … 1448 1448 1449 1449 /* shl eax,1 will be assembled to the form without the immediate byte. */ 1450 if ( pCpu->pCurInstr-> param2 == OP_PARM_Ib1450 if ( pCpu->pCurInstr->fParam2 == OP_PARM_Ib 1451 1451 && (uint8_t)pCpu->param2.parval == 1) 1452 1452 {
Note:
See TracChangeset
for help on using the changeset viewer.