VirtualBox

Changeset 104784 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 26, 2024 5:45:30 PM (6 months ago)
Author:
vboxsync
Message:

VMM/IEM: Add helper to ignore the VEX.W prefix for non 64-bit code as required by some instructions, fixes some bootsector testcases, bugref:9898

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

Legend:

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

    r104722 r104784  
    22752275{
    22762276    IEMOP_MNEMONIC3(VEX_RVM, ANDN, andn, Gy, By, Ey, DISOPTYPE_HARMLESS, IEMOPHINT_VEX_L_ZERO);
     2277    IEMOP_HLP_IGNORE_VEX_W_PREFIX_IF_NOT_IN_64BIT();
    22772278    IEMOP_VERIFICATION_UNDEFINED_EFLAGS(X86_EFL_AF | X86_EFL_PF);
    22782279    uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm);
     
    23772378/** Body for the vex group 17 instructions. */
    23782379#define IEMOP_BODY_By_Ey(a_Instr) \
     2380    IEMOP_HLP_IGNORE_VEX_W_PREFIX_IF_NOT_IN_64BIT(); \
    23792381    IEMOP_VERIFICATION_UNDEFINED_EFLAGS(X86_EFL_AF | X86_EFL_PF); \
    23802382    if (IEM_IS_MODRM_REG_MODE(bRm)) \
     
    25452547/** Body for BZHI, BEXTR, ++; assumes VEX.L must be 0. */
    25462548#define IEMOP_BODY_Gy_Ey_By(a_Instr, a_fFeatureMember, a_fUndefFlags) \
     2549    IEMOP_HLP_IGNORE_VEX_W_PREFIX_IF_NOT_IN_64BIT(); \
    25472550    IEMOP_VERIFICATION_UNDEFINED_EFLAGS(a_fUndefFlags); \
    25482551    uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); \
     
    26412644/** Body for SARX, SHLX, SHRX; assumes VEX.L must be 0. */
    26422645#define IEMOP_BODY_Gy_Ey_By_NoEflags(a_Instr, a_fFeatureMember) \
     2646    IEMOP_HLP_IGNORE_VEX_W_PREFIX_IF_NOT_IN_64BIT(); \
    26432647    uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); \
    26442648    if (IEM_IS_MODRM_REG_MODE(bRm)) \
     
    27402744/** Body for PDEP and PEXT (similar to ANDN, except no EFLAGS). */
    27412745#define IEMOP_BODY_Gy_By_Ey_NoEflags(a_Instr, a_fFeatureMember) \
     2746    IEMOP_HLP_IGNORE_VEX_W_PREFIX_IF_NOT_IN_64BIT(); \
    27422747    uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); \
    27432748    if (IEM_IS_MODRM_REG_MODE(bRm)) \
     
    28552860{
    28562861    IEMOP_MNEMONIC4(VEX_RVM, MULX, mulx, Gy, By, Ey, rDX, DISOPTYPE_HARMLESS, IEMOPHINT_VEX_L_ZERO);
     2862    IEMOP_HLP_IGNORE_VEX_W_PREFIX_IF_NOT_IN_64BIT();
    28572863    uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm);
    28582864    if (IEM_IS_MODRM_REG_MODE(bRm))
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstVexMap3.cpp.h

    r104369 r104784  
    17861786{
    17871787    IEMOP_MNEMONIC3(VEX_RMI, RORX, rorx, Gy, Ey, Ib, DISOPTYPE_HARMLESS, IEMOPHINT_VEX_L_ZERO | IEMOPHINT_VEX_V_ZERO);
     1788    IEMOP_HLP_IGNORE_VEX_W_PREFIX_IF_NOT_IN_64BIT();
    17881789    uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm);
    17891790    if (IEM_IS_MODRM_REG_MODE(bRm))
  • trunk/src/VBox/VMM/include/IEMOpHlp.h

    r104272 r104784  
    411411    } while (0)
    412412
     413/** The instruction ignores any REX.W/VEX.W prefix if not in 64-bit mode. */
     414#define IEMOP_HLP_IGNORE_VEX_W_PREFIX_IF_NOT_IN_64BIT() \
     415    do \
     416    { \
     417        if (!IEM_IS_64BIT_CODE(pVCpu)) \
     418            pVCpu->iem.s.fPrefixes &= ~IEM_OP_PRF_SIZE_REX_W; \
     419    } while (0)
     420
    413421/**
    414422 * Done decoding.
  • trunk/src/VBox/VMM/testcase/tstIEMCheckMc.cpp

    r104439 r104784  
    164164#define IEMOP_HLP_DEFAULT_64BIT_OP_SIZE_AND_INTEL_IGNORES_OP_SIZE_PREFIX()                          do { } while (0)
    165165#define IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE(a_szPrf)      do { } while (0)
     166#define IEMOP_HLP_IGNORE_VEX_W_PREFIX_IF_NOT_IN_64BIT()     do { } while (0)
    166167#define IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX()            do { } while (0)
    167168#define IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX_EX(a_fFeature)                                       do { } while (0)
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