VirtualBox

Changeset 66463 in vbox


Ignore:
Timestamp:
Apr 6, 2017 5:58:25 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
114448
Message:

IEM,bs3-cpu-generated-1: Made the current testcases pass on AMD.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

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

    r66336 r66463  
    549549
    550550
     551/** Invalid with RM byte where both AMD and Intel decodes any additional
     552 *  address encoding bytes. */
     553FNIEMOPRM_DEF(iemOp_InvalidWithRMAllNeeded)
     554{
     555    IEMOP_MNEMONIC(InvalidWithRMAllNeeded, "InvalidWithRMAllNeeded");
     556#ifndef TST_IEM_CHECK_MC
     557    if ((bRm & X86_MODRM_MOD_MASK) != (3 << X86_MODRM_MOD_SHIFT))
     558    {
     559        RTGCPTR      GCPtrEff;
     560        VBOXSTRICTRC rcStrict = iemOpHlpCalcRmEffAddr(pVCpu, bRm, 0, &GCPtrEff);
     561        if (rcStrict != VINF_SUCCESS)
     562            return rcStrict;
     563    }
     564#endif
     565    IEMOP_HLP_DONE_DECODING();
     566    return IEMOP_RAISE_INVALID_OPCODE();
     567}
     568
     569
    551570/** Invalid with RM byte where intel requires 8-byte immediate.
    552571 * Intel will also need SIB and displacement if bRm indicates memory. */
     
    614633
    615634
     635/** Invalid opcode where both AMD and Intel requires Mod R/M sequence. */
     636FNIEMOP_DEF(iemOp_InvalidAllNeedRM)
     637{
     638    IEMOP_MNEMONIC(InvalidAllNeedRM, "InvalidAllNeedRM");
     639    uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); RT_NOREF(bRm);
     640#ifndef TST_IEM_CHECK_MC
     641    if ((bRm & X86_MODRM_MOD_MASK) != (3 << X86_MODRM_MOD_SHIFT))
     642    {
     643        RTGCPTR      GCPtrEff;
     644        VBOXSTRICTRC rcStrict = iemOpHlpCalcRmEffAddr(pVCpu, bRm, 0, &GCPtrEff);
     645        if (rcStrict != VINF_SUCCESS)
     646            return rcStrict;
     647    }
     648#endif
     649    IEMOP_HLP_DONE_DECODING();
     650    return IEMOP_RAISE_INVALID_OPCODE();
     651}
     652
     653
    616654/** Invalid opcode where intel requires Mod R/M sequence and 8-byte
    617655 *  immediate. */
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsOneByte.cpp.h

    r66462 r66463  
    19741974        {
    19751975            Log(("evex not supported by the guest CPU!\n"));
    1976             return FNIEMOP_CALL(iemOp_InvalidNeedRM);
     1976            return FNIEMOP_CALL(iemOp_InvalidAllNeedRM);
    19771977        }
    19781978        IEM_OPCODE_GET_NEXT_U8(&bRm);
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h

    r66462 r66463  
    60286028    IEMOP_MNEMONIC1(M_MEM, CLFLUSH, clflush, MbRO, DISOPTYPE_HARMLESS, IEMOPHINT_IGNORES_OP_SIZE);
    60296029    if (!IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fClFlush)
    6030         return IEMOP_RAISE_INVALID_OPCODE();
     6030        return FNIEMOP_CALL_1(iemOp_InvalidWithRMAllNeeded, bRm);
    60316031
    60326032    IEM_MC_BEGIN(2, 0);
     
    60536053    IEMOP_MNEMONIC1(M_MEM, CLFLUSHOPT, clflushopt, MbRO, DISOPTYPE_HARMLESS, IEMOPHINT_IGNORES_OP_SIZE);
    60546054    if (!IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fClFlushOpt)
    6055         return IEMOP_RAISE_INVALID_OPCODE();
     6055        return FNIEMOP_CALL_1(iemOp_InvalidWithRMAllNeeded, bRm);
    60566056
    60576057    IEM_MC_BEGIN(2, 0);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c

    r66462 r66463  
    121121    /** The encoding. */
    122122    BS3CG1ENC               enmEncoding;
     123    /** The non-invalid encoding.  This differs from enmEncoding when
     124     * Bs3Cg1CalcNoneIntelInvalidEncoding has been called. */
     125    BS3CG1ENC               enmEncodingNonInvalid;
    123126    /** The CPU test / CPU ID. */
    124127    BS3CG1CPU               enmCpuTest;
     
    22192222    {
    22202223        case BS3CG1ENC_MODRM_Gb_Eb:
     2224        case BS3CG1ENC_MODRM_Gv_Ma:
    22212225        case BS3CG1ENC_FIXED:
    22222226            return BS3CG1ENC_FIXED;
     
    27032707
    27042708                    default:
     2709                        if (pThis->enmEncoding != pThis->enmEncodingNonInvalid)
     2710                            goto l_advance_to_next;
    27052711                        return Bs3TestFailedF("Internal error: cbDst=%u idxField=%d (%d) offField=%#x: enmLocation=%u off=%#x idxField=%u",
    27062712                                              cbDst, idxField, idxOp, offField, pThis->aOperands[idxOp].enmLocation,
     
    29172923         * Advance to the next instruction.
    29182924         */
     2925l_advance_to_next:
    29192926        pbCode += cbValue;
    29202927        cbLeft -= cbValue;
     
    34973504         */
    34983505        PCBS3CG1INSTR pInstr = &g_aBs3Cg1Instructions[iInstr];
    3499         pThis->iInstr          = iInstr;
    3500         pThis->pTestHdr        = (PCBS3CG1TESTHDR)&g_abBs3Cg1Tests[pInstr->offTests];
    3501         pThis->fFlags          = pInstr->fFlags;
    3502         pThis->enmEncoding     = (BS3CG1ENC)pInstr->enmEncoding;
    3503         pThis->enmCpuTest      = (BS3CG1CPU)pInstr->enmCpuTest;
    3504         pThis->enmPrefixKind   = (BS3CG1PFXKIND)pInstr->enmPrefixKind;
    3505         pThis->enmXcptType     = (BS3CG1XCPTTYPE)pInstr->enmXcptType;
    3506         pThis->cchMnemonic     = pInstr->cchMnemonic;
     3506        pThis->iInstr                   = iInstr;
     3507        pThis->pTestHdr                 = (PCBS3CG1TESTHDR)&g_abBs3Cg1Tests[pInstr->offTests];
     3508        pThis->fFlags                   = pInstr->fFlags;
     3509        pThis->enmEncoding              = (BS3CG1ENC)pInstr->enmEncoding;
     3510        pThis->enmEncodingNonInvalid    = (BS3CG1ENC)pInstr->enmEncoding;
     3511        pThis->enmCpuTest               = (BS3CG1CPU)pInstr->enmCpuTest;
     3512        pThis->enmPrefixKind            = (BS3CG1PFXKIND)pInstr->enmPrefixKind;
     3513        pThis->enmXcptType              = (BS3CG1XCPTTYPE)pInstr->enmXcptType;
     3514        pThis->cchMnemonic              = pInstr->cchMnemonic;
    35073515        if (pThis->fAdvanceMnemonic)
    35083516            Bs3TestSubF("%s / %.*s", pThis->pszModeShort, pThis->cchMnemonic, pThis->pchMnemonic);
    3509         pThis->fAdvanceMnemonic = pInstr->fAdvanceMnemonic;
    3510         pThis->cOperands       = pInstr->cOperands;
    3511         pThis->cbOpcodes       = pInstr->cbOpcodes;
     3517        pThis->fAdvanceMnemonic         = pInstr->fAdvanceMnemonic;
     3518        pThis->cOperands                = pInstr->cOperands;
     3519        pThis->cbOpcodes                = pInstr->cbOpcodes;
    35123520        switch (pThis->cOperands)
    35133521        {
     
    35173525            case 1: pThis->aenmOperands[0] = (BS3CG1OP)pThis->pabOperands[0];
    35183526        }
    3519 
    35203527        switch (pThis->cbOpcodes)
    35213528        {
     
    35263533        }
    35273534
    3528         /* Switch the encoder for some of the invalid instructions on non-intel CPUs. */
    3529         if (   (pThis->fFlags & BS3CG1INSTR_F_INTEL_DECODES_INVALID)
    3530             && pThis->bCpuVendor != BS3CPUVENDOR_INTEL
    3531             && (   (pThis->fFlags & (BS3CG1INSTR_F_UNUSED | BS3CG1INSTR_F_INVALID))
    3532                 || (BS3_MODE_IS_64BIT_CODE(pThis->bMode) && (pThis->fFlags & BS3CG1INSTR_F_INVALID_64BIT)) ) )
    3533             pThis->enmEncoding = Bs3Cg1CalcNoneIntelInvalidEncoding(pThis->enmEncoding);
    3534 
    35353535        /*
    35363536         * Check if the CPU supports the instruction.
     
    35393539            || (pThis->fFlags & (BS3CG1INSTR_F_UNUSED | BS3CG1INSTR_F_INVALID)))
    35403540            fOuterInvalidInstr = true;
     3541
     3542        /* Switch the encoder for some of the invalid instructions on non-intel CPUs. */
     3543        if (   (pThis->fFlags & BS3CG1INSTR_F_INTEL_DECODES_INVALID)
     3544            && pThis->bCpuVendor != BS3CPUVENDOR_INTEL
     3545            && (   (pThis->fFlags & (BS3CG1INSTR_F_UNUSED | BS3CG1INSTR_F_INVALID))
     3546                || (BS3_MODE_IS_64BIT_CODE(pThis->bMode) && (pThis->fFlags & BS3CG1INSTR_F_INVALID_64BIT))
     3547                || fOuterInvalidInstr ) )
     3548            pThis->enmEncoding = Bs3Cg1CalcNoneIntelInvalidEncoding(pThis->enmEncoding);
    35413549
    35423550        for (iCpuSetup = 0;; iCpuSetup++)
     
    37053713#if 0
    37063714    /* (for debugging) */
    3707     if (bMode != BS3_MODE_PPV86)
     3715    if (bMode < BS3_MODE_LM16)
    37083716        return BS3TESTDOMODE_SKIPPED;
    37093717#endif
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