VirtualBox

Changeset 65761 in vbox


Ignore:
Timestamp:
Feb 13, 2017 12:15:26 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113476
Message:

IEM: VEX decoding updates.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsOneByte.cpp.h

    r65758 r65761  
    52495249FNIEMOP_DEF(iemOp_les_Gv_Mp_vex2)
    52505250{
     5251    /* The LES instruction is invalid 64-bit mode. In legacy and
     5252       compatability mode it is invalid with MOD=3.
     5253       The use as a VEX prefix is made possible by assigning the inverted
     5254       REX.R to the top MOD bit, and the top bit in the inverted register
     5255       specifier to the bottom MOD bit, thereby effectively limiting 32-bit
     5256       to accessing registers 0..7 in this VEX form. */
    52515257    uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm);
    52525258    if (   pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT
     
    52545260    {
    52555261        IEMOP_MNEMONIC(vex2_prefix, "2-byte-vex");
    5256         /* The LES instruction is invalid 64-bit mode. In legacy and
    5257            compatability mode it is invalid with MOD=3.
    5258            The use as a VEX prefix is made possible by assigning the inverted
    5259            REX.R to the top MOD bit, and the top bit in the inverted register
    5260            specifier to the bottom MOD bit, thereby effectively limiting 32-bit
    5261            to accessing registers 0..7 in this VEX form. */
    5262         /** @todo VEX: Just use new tables for it. */
     5262        if (IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fAvx)
     5263        {
     5264            uint8_t bOpcode; IEM_OPCODE_GET_NEXT_U8(&bOpcode);
     5265            if (   (  pVCpu->iem.s.fPrefixes
     5266                    & (IEM_OP_PRF_SIZE_OP | IEM_OP_PRF_REPZ | IEM_OP_PRF_REPNZ | IEM_OP_PRF_LOCK | IEM_OP_PRF_REX))
     5267                == 0)
     5268            {
     5269                pVCpu->iem.s.fPrefixes |= IEM_OP_PRF_VEX;
     5270                pVCpu->iem.s.uRexReg    = ~bRm >> (7 - 3);
     5271                pVCpu->iem.s.uVex3rdReg = (~bRm >> 3) & 0xf;
     5272                pVCpu->iem.s.uVexLength = (bRm >> 2) & 1;
     5273                pVCpu->iem.s.idxPrefix  = bRm & 0x3;
     5274
     5275                /** @todo VEX: Just use new tables and decoders. */
     5276                IEMOP_BITCH_ABOUT_STUB();
     5277                return VERR_IEM_INSTR_NOT_IMPLEMENTED;
     5278            }
     5279            Log(("VEX2: Invalid prefix mix!\n"));
     5280        }
     5281        else
     5282            Log(("VEX2: AVX support disabled!\n"));
     5283
     5284        /* @todo does intel completely decode the sequence with SIB/disp before \#UD? */
    52635285        return IEMOP_RAISE_INVALID_OPCODE();
    52645286    }
     
    52885310
    52895311    IEMOP_MNEMONIC(vex3_prefix, "3-byte-vex");
    5290     /** @todo Test when exctly the VEX conformance checks kick in during
    5291      * instruction decoding and fetching (using \#PF). */
    5292     uint8_t bVex1;   IEM_OPCODE_GET_NEXT_U8(&bVex1);
    5293     uint8_t bVex2;   IEM_OPCODE_GET_NEXT_U8(&bVex2);
    5294     uint8_t bOpcode; IEM_OPCODE_GET_NEXT_U8(&bOpcode);
    5295 #if 0 /* will make sense of this next week... */
    5296     if (   !(pVCpu->iem.s.fPrefixes & (IEM_OP_PRF_REPNZ | IEM_OP_PRF_REPZ | IEM_OP_PRF_REPZ | IEM_OP_PRF_SIZE_OP | IEM_OP_PRF_REX))
    5297         &&
    5298         )
    5299     {
    5300 
    5301     }
    5302 #endif
    5303 
    5304     /** @todo VEX: Just use new tables for it. */
     5312    if (IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fAvx)
     5313    {
     5314        /** @todo Test when exctly the VEX conformance checks kick in during
     5315         * instruction decoding and fetching (using \#PF). */
     5316        uint8_t bVex2;   IEM_OPCODE_GET_NEXT_U8(&bVex2);
     5317        uint8_t bOpcode; IEM_OPCODE_GET_NEXT_U8(&bOpcode);
     5318        if (   (  pVCpu->iem.s.fPrefixes
     5319                & (IEM_OP_PRF_SIZE_OP | IEM_OP_PRF_REPZ | IEM_OP_PRF_REPNZ | IEM_OP_PRF_LOCK | IEM_OP_PRF_REX))
     5320            == 0)
     5321        {
     5322            pVCpu->iem.s.fPrefixes |= IEM_OP_PRF_VEX;
     5323            if (bVex2 & 0x80 /* VEX.W */)
     5324                pVCpu->iem.s.fPrefixes |= IEM_OP_PRF_SIZE_REX_W;
     5325            pVCpu->iem.s.uRexReg    = ~bRm >> (7 - 3);
     5326            pVCpu->iem.s.uRexIndex  = ~bRm >> (6 - 3);
     5327            pVCpu->iem.s.uRexB      = ~bRm >> (5 - 3);
     5328            pVCpu->iem.s.uVex3rdReg = (~bVex2 >> 3) & 0xf;
     5329            pVCpu->iem.s.uVexLength = (bVex2 >> 2) & 1;
     5330            pVCpu->iem.s.idxPrefix  = bVex2 & 0x3;
     5331
     5332            /** @todo VEX: Just use new tables and decoders. */
     5333            switch (bRm & 0xf)
     5334            {
     5335                case 1: /* 0x0f lead opcode byte. */
     5336                    IEMOP_BITCH_ABOUT_STUB();
     5337                    return VERR_IEM_INSTR_NOT_IMPLEMENTED;
     5338
     5339                case 2: /* 0x0f 0x38 lead opcode bytes. */
     5340                    IEMOP_BITCH_ABOUT_STUB();
     5341                    return VERR_IEM_INSTR_NOT_IMPLEMENTED;
     5342
     5343                case 3: /* 0x0f 0x3a lead opcode bytes. */
     5344                    IEMOP_BITCH_ABOUT_STUB();
     5345                    return VERR_IEM_INSTR_NOT_IMPLEMENTED;
     5346
     5347                default:
     5348                    Log(("VEX3: Invalid vvvv value: %#x!\n", bRm & 0xf));
     5349                    return IEMOP_RAISE_INVALID_OPCODE();
     5350            }
     5351        }
     5352        else
     5353            Log(("VEX3: Invalid prefix mix!\n"));
     5354    }
     5355    else
     5356        Log(("VEX3: AVX support disabled!\n"));
    53055357    return IEMOP_RAISE_INVALID_OPCODE();
    53065358}
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r65587 r65761  
    837837 * For testing whether any REX prefix is present, use  IEM_OP_PRF_REX instead. */
    838838#define IEM_OP_PRF_REX_MASK  (IEM_OP_PRF_REX | IEM_OP_PRF_REX_R | IEM_OP_PRF_REX_B | IEM_OP_PRF_REX_X | IEM_OP_PRF_SIZE_REX_W )
     839
     840#define IEM_OP_PRF_VEX                  RT_BIT_32(28) /**< Indiciates VEX prefix. */
     841#define IEM_OP_PRF_EVEX                 RT_BIT_32(29) /**< Indiciates EVEX prefix. */
    839842/** @} */
    840843
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette