Changeset 53172 in vbox for trunk/src/VBox/Disassembler/DisasmCore.cpp
- Timestamp:
- Oct 31, 2014 5:44:19 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmCore.cpp
r53155 r53172 709 709 unsigned index = pDis->SIB.Bits.Index; 710 710 711 unsigned regtype; 712 if (pDis->uAddrMode == DISCPUMODE_32BIT) 713 regtype = DISUSE_REG_GEN32; 714 else 715 regtype = DISUSE_REG_GEN64; 711 unsigned regtype, vregtype; 712 /* There's no way to distinguish between SIB and VSIB 713 * and having special parameter to parse explicitly VSIB 714 * is not an options since only one instruction (gather) 715 * supports it currently. May be changed in the future. */ 716 if (pDis->uAddrMode == DISCPUMODE_32BIT) 717 regtype = DISUSE_REG_GEN32; 718 else 719 regtype = DISUSE_REG_GEN64; 720 if (pDis->pCurInstr->uOpcode == OP_GATHER) 721 vregtype = (VEXREG_IS256B(pDis->bVexDestReg) ? DISUSE_REG_YMM : DISUSE_REG_XMM); 722 else 723 vregtype = regtype; 716 724 717 725 if (index != 4) 718 726 { 719 pParam->fUse |= DISUSE_INDEX |regtype;720 721 722 723 724 725 726 727 pParam->fUse |= DISUSE_INDEX | vregtype; 728 pParam->Index.idxGenReg = index; 729 730 if (scale != 0) 731 { 732 pParam->fUse |= DISUSE_SCALE; 733 pParam->uScale = (1<<scale); 734 } 727 735 } 728 736 … … 2488 2496 pOpCode = g_aVexOpcodesMap[0] + pDis->bOpCode; 2489 2497 break; 2490 // OPSIZE0x66 prefix2498 // 0x66 prefix 2491 2499 case 1: 2492 2500 pOpCode = g_aVexOpcodesMap_66H[0] + pDis->bOpCode; 2493 2501 2494 /* TODO: Check if we need to set this prefix */2495 pDis->fPrefix |= DISPREFIX_OPSIZE;2496 if (pDis->uCpuMode == DISCPUMODE_16BIT)2497 pDis->uOpMode = DISCPUMODE_32BIT;2498 else2499 pDis->uOpMode = DISCPUMODE_16BIT; /* for 32 and 64 bits mode (there is no 32 bits operand size override prefix) */2500 2502 break; 2501 2503 2502 // REPE0xF3 prefix2504 // 0xF3 prefix 2503 2505 case 2: 2504 2506 pOpCode = g_aVexOpcodesMap_F3H[0] + pDis->bOpCode; 2505 2507 break; 2506 2508 2507 // REPNE0xF2 prefix2509 // 0xF2 prefix 2508 2510 case 3: 2509 2511 pOpCode = g_aVexOpcodesMap_F2H[0] + pDis->bOpCode; … … 2530 2532 uint8_t implOpcode = (byte1 & 0x1f); 2531 2533 2532 if (pDis->uCpuMode == DISCPUMODE_64BIT) 2533 { 2534 // REX.RXB 2535 if (~(byte1 & 0xe0)) 2536 { 2537 pDis->fRexPrefix = (byte1 >> 5) ^ 7; 2538 if (pDis->fRexPrefix) 2539 pDis->fPrefix |= DISPREFIX_REX; 2540 } 2541 2542 // REX.W 2543 if (!(byte2 & 0x80)) 2544 { 2545 pDis->fRexPrefix |= DISPREFIX_REX_FLAGS_W; 2546 if (pDis->fRexPrefix) 2547 pDis->fPrefix |= DISPREFIX_REX; 2548 } 2549 } 2534 // REX.RXB 2535 if (pDis->uCpuMode == DISCPUMODE_64BIT && ~(byte1 & 0xe0)) 2536 pDis->fRexPrefix |= (byte1 >> 5) ^ 7; 2537 2538 // VEX.W 2539 pDis->bVexWFlag = !(byte2 & 0x80); 2540 2541 if (pDis->fRexPrefix) 2542 pDis->fPrefix |= DISPREFIX_REX; 2550 2543 2551 2544 switch(byte2 & 3) … … 2570 2563 } 2571 2564 break; 2572 // OPSIZE0x66 prefix2565 // 0x66 prefix 2573 2566 case 1: 2574 2567 if (implOpcode >= 1 && implOpcode <= 3) // Other values are #UD. … … 2577 2570 if (pOpCode != NULL) 2578 2571 pOpCode = &pOpCode[pDis->bOpCode]; 2579 /* TODO: check if we need to set this prefix */2580 pDis->fPrefix |= DISPREFIX_OPSIZE;2581 if (pDis->uCpuMode == DISCPUMODE_16BIT)2582 pDis->uOpMode = DISCPUMODE_32BIT;2583 else2584 pDis->uOpMode = DISCPUMODE_16BIT; /* for 32 and 64 bits mode (there is no 32 bits operand size override prefix) */2585 2572 } 2586 2573 break; 2587 2574 2588 // REPE0xF3 prefix2575 // 0xF3 prefix 2589 2576 case 2: 2590 2577 if (implOpcode >= 1 && implOpcode <= 3) // Other values are #UD. … … 2608 2595 break; 2609 2596 2610 // REPNE0xF2 prefix2597 // 0xF2 prefix 2611 2598 case 3: 2612 2599 if (implOpcode >= 1 && implOpcode <= 3) // Other values are #UD. … … 2824 2811 2825 2812 /* Check if this is a VEX prefix. Not for 32-bit mode. */ 2826 if ( (opcode == OP_LES || opcode == OP_LDS)2827 && ( disReadByte(pDis, offInstr) & 0xc0) == 0xc02828 && ( opcode != OP_LES || pDis->uCpuMode == DISCPUMODE_64BIT || !(disReadByte(pDis, offInstr + 1) & 0x80)))2813 if (pDis->uCpuMode != DISCPUMODE_64BIT 2814 && (opcode == OP_LES || opcode == OP_LDS) 2815 && (disReadByte(pDis, offInstr) & 0xc0) == 0xc0) 2829 2816 { 2830 2817 paOneByteMap = g_aOneByteMapX64;
Note:
See TracChangeset
for help on using the changeset viewer.