VirtualBox

Changeset 47284 in vbox


Ignore:
Timestamp:
Jul 19, 2013 11:31:20 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
87418
Message:

Fixed jmp far [indirect] and call far [indirect] to no cause #UD. These instructions seems to be misbehaving on AMD when REX.W is used (it's ignored according to my observations - needs verification).

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

Legend:

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

    r47282 r47284  
    1556715567            return VINF_SUCCESS;
    1556815568
     15569        case IEMMODE_64BIT:
     15570            /** @todo testcase: AMD does not seem to believe in the case (see bs-cpu-xcpt-1)
     15571             *        and will apparently ignore REX.W, at least for the jmp far qword [rsp]
     15572             *        and call far qword [rsp] encodings. */
     15573            if (!IEM_IS_GUEST_CPU_AMD(pIemCpu))
     15574            {
     15575                IEM_MC_BEGIN(3, 1);
     15576                IEM_MC_ARG(uint16_t,        u16Sel,                         0);
     15577                IEM_MC_ARG(uint64_t,        offSeg,                         1);
     15578                IEM_MC_ARG_CONST(IEMMODE,   enmEffOpSize, IEMMODE_16BIT,    2);
     15579                IEM_MC_LOCAL(RTGCPTR, GCPtrEffSrc);
     15580                IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0);
     15581                IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
     15582                IEM_MC_FETCH_MEM_U64(offSeg, pIemCpu->iEffSeg, GCPtrEffSrc);
     15583                IEM_MC_FETCH_MEM_U16_DISP(u16Sel, pIemCpu->iEffSeg, GCPtrEffSrc, 8);
     15584                IEM_MC_CALL_CIMPL_3(pfnCImpl, u16Sel, offSeg, enmEffOpSize);
     15585                IEM_MC_END();
     15586                return VINF_SUCCESS;
     15587            }
     15588            /* AMD falls thru. */
     15589
    1556915590        case IEMMODE_32BIT:
    1557015591            IEM_MC_BEGIN(3, 1);
     
    1558115602            return VINF_SUCCESS;
    1558215603
    15583         case IEMMODE_64BIT:
    15584             /** @todo AMD does not believe in the case (see bs-cpu-xcpt-1) and will
    15585              *        apparently ignore REX.W, at least for the jmp far qword [rsp] and
    15586              *        call far qword [rsp] encodings. */
    15587             IEM_MC_BEGIN(3, 1);
    15588             IEM_MC_ARG(uint16_t,        u16Sel,                         0);
    15589             IEM_MC_ARG(uint64_t,        offSeg,                         1);
    15590             IEM_MC_ARG_CONST(IEMMODE,   enmEffOpSize, IEMMODE_16BIT,    2);
    15591             IEM_MC_LOCAL(RTGCPTR, GCPtrEffSrc);
    15592             IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0);
    15593             IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
    15594             IEM_MC_FETCH_MEM_U64(offSeg, pIemCpu->iEffSeg, GCPtrEffSrc);
    15595             IEM_MC_FETCH_MEM_U16_DISP(u16Sel, pIemCpu->iEffSeg, GCPtrEffSrc, 8);
    15596             IEM_MC_CALL_CIMPL_3(pfnCImpl, u16Sel, offSeg, enmEffOpSize);
    15597             IEM_MC_END();
    15598             return VINF_SUCCESS;
    15599 
    1560015604        IEM_NOT_REACHED_DEFAULT_CASE_RET();
    1560115605    }
     
    1570415708{
    1570515709    IEMOP_MNEMONIC("jmpf Ep");
    15706     IEMOP_HLP_NO_64BIT(); /** @todo this isn't quite right I'm afraid... */
    1570715710    return FNIEMOP_CALL_2(iemOpHlp_Grp5_far_Ep, bRm, iemCImpl_FarJmp);
    1570815711}
  • trunk/src/VBox/VMM/testcase/tstIEMCheckMc.cpp

    r47138 r47284  
    134134#define IEM_IS_AMD_CPUID_FEATURES_ANY_PRESENT(a_fEdx, a_fEcx) (g_fRandom)
    135135#define IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(a_fEdx)      (g_fRandom)
     136#define IEM_IS_GUEST_CPU_AMD(a_pIemCpu)                     (g_fRandom)
     137#define IEM_IS_GUEST_CPU_INTEL(a_pIemCpu)                   (g_fRandom)
    136138
    137139#define iemRecalEffOpSize(a_pIemCpu)                        do { } while (0)
Note: See TracChangeset for help on using the changeset viewer.

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