VirtualBox

Changeset 66391 in vbox


Ignore:
Timestamp:
Apr 2, 2017 2:56:59 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
114343
Message:

IEM: Implemented stmxcsr Md (0f ae !11/3).

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/disopcode.h

    r66334 r66391  
    10601060#define OP_PARM_WqZxReg         OP_PARM_Wq              /**< Annotates that register targets get their upper bits cleared. */
    10611061#define OP_PARM_MbRO            OP_PARM_Mb              /**< Annotates readonly memory byte operand. */
     1062#define OP_PARM_MdWO            OP_PARM_Md              /**< Annotates write only memory byte operand. */
    10621063
    10631064/** @} */
  • trunk/src/VBox/VMM/VMMAll/IEMAll.cpp

    r66357 r66391  
    65646564
    65656565/**
    6566  * Hook for actualizing the guest XMM0..15 register state for read only.
     6566 * Hook for actualizing the guest XMM0..15 and MXCSR register state for read
     6567 * only.
    65676568 *
    65686569 * This is necessary in ring-0 and raw-mode context (nop in ring-3).
     
    65816582
    65826583/**
    6583  * Hook for actualizing the guest XMM0..15 register state for read+write.
     6584 * Hook for actualizing the guest XMM0..15 and MXCSR register state for
     6585 * read+write.
    65846586 *
    65856587 * This is necessary in ring-0 and raw-mode context (nop in ring-3).
     
    1142711429 * Ensures the guest SSE state in the CPUMCTX is up to date. */
    1142811430#define IEM_MC_PREPARE_SSE_USAGE()              iemFpuPrepareUsageSse(pVCpu)
    11429 /** Actualizes the guest XMM0..15 register state for read-only access. */
     11431/** Actualizes the guest XMM0..15 and MXCSR register state for read-only access. */
    1143011432#define IEM_MC_ACTUALIZE_SSE_STATE_FOR_READ()   iemFpuActualizeSseStateForRead(pVCpu)
    11431 /** Actualizes the guest XMM0..15 register state for read-write access. */
     11433/** Actualizes the guest XMM0..15 and MXCSR register state for read-write access. */
    1143211434#define IEM_MC_ACTUALIZE_SSE_STATE_FOR_CHANGE() iemFpuActualizeSseStateForChange(pVCpu)
    1143311435
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h

    r66356 r66391  
    70567056
    70577057/**
     7058 * Implements 'STMXCSR'.
     7059 *
     7060 * @param   GCPtrEff        The address of the image.
     7061 */
     7062IEM_CIMPL_DEF_2(iemCImpl_stmxcsr, uint8_t, iEffSeg, RTGCPTR, GCPtrEff)
     7063{
     7064    PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
     7065
     7066    /*
     7067     * Raise exceptions.
     7068     */
     7069    if (   !(pCtx->cr0 & X86_CR0_EM)
     7070        && (pCtx->cr4 & X86_CR4_OSFXSR))
     7071    {
     7072        if (!(pCtx->cr0 & X86_CR0_TS))
     7073        {
     7074            /*
     7075             * Do the job.
     7076             */
     7077            VBOXSTRICTRC rcStrict = iemMemStoreDataU32(pVCpu, iEffSeg, GCPtrEff, pCtx->CTX_SUFF(pXState)->x87.MXCSR);
     7078            if (rcStrict == VINF_SUCCESS)
     7079            {
     7080                iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     7081                return VINF_SUCCESS;
     7082            }
     7083            return rcStrict;
     7084        }
     7085        return iemRaiseDeviceNotAvailable(pVCpu);
     7086    }
     7087    return iemRaiseUndefinedOpcode(pVCpu);
     7088}
     7089
     7090
     7091/**
    70587092 * Commmon routine for fnstenv and fnsave.
    70597093 *
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsPython.py

    r66334 r66391  
    175175    'Ma':   ( 'IDX_UseModRM',       'rm',     '%Ma',  'Ma',      ), ##< Only used by BOUND.
    176176    'MbRO': ( 'IDX_UseModRM',       'rm',     '%Mb',  'Mb',      ),
     177    'MdWO': ( 'IDX_UseModRM',       'rm',     '%Md',  'Md',      ),
    177178    'Mq':   ( 'IDX_UseModRM',       'rm',     '%Mq',  'Mq',      ),
    178179
     
    847848        'oz.r14':       ( 'uint', 'both',   ),
    848849        'oz.r15':       ( 'uint', 'both',   ),
     850        # FPU Registers
     851        'fcw':          ( 'uint', 'both',   ),
     852        'fsw':          ( 'uint', 'both',   ),
     853        'ftw':          ( 'uint', 'both',   ),
     854        'fop':          ( 'uint', 'both',   ),
     855        'fpuip':        ( 'uint', 'both',   ),
     856        'fpucs':        ( 'uint', 'both',   ),
     857        'fpudp':        ( 'uint', 'both',   ),
     858        'fpuds':        ( 'uint', 'both',   ),
     859        'mxcsr':        ( 'uint', 'both',   ),
     860        'st0':          ( 'uint', 'both',   ),
     861        'st1':          ( 'uint', 'both',   ),
     862        'st2':          ( 'uint', 'both',   ),
     863        'st3':          ( 'uint', 'both',   ),
     864        'st4':          ( 'uint', 'both',   ),
     865        'st5':          ( 'uint', 'both',   ),
     866        'st6':          ( 'uint', 'both',   ),
     867        'st7':          ( 'uint', 'both',   ),
     868        # MMX registers.
     869        'mm0':          ( 'uint', 'both',   ),
     870        'mm1':          ( 'uint', 'both',   ),
     871        'mm2':          ( 'uint', 'both',   ),
     872        'mm3':          ( 'uint', 'both',   ),
     873        'mm4':          ( 'uint', 'both',   ),
     874        'mm5':          ( 'uint', 'both',   ),
     875        'mm6':          ( 'uint', 'both',   ),
     876        'mm7':          ( 'uint', 'both',   ),
     877        # SSE registers.
     878        'xmm0':         ( 'uint', 'both',   ),
     879        'xmm1':         ( 'uint', 'both',   ),
     880        'xmm2':         ( 'uint', 'both',   ),
     881        'xmm3':         ( 'uint', 'both',   ),
     882        'xmm4':         ( 'uint', 'both',   ),
     883        'xmm5':         ( 'uint', 'both',   ),
     884        'xmm6':         ( 'uint', 'both',   ),
     885        'xmm7':         ( 'uint', 'both',   ),
     886        'xmm8':         ( 'uint', 'both',   ),
     887        'xmm9':         ( 'uint', 'both',   ),
     888        'xmm10':        ( 'uint', 'both',   ),
     889        'xmm11':        ( 'uint', 'both',   ),
     890        'xmm12':        ( 'uint', 'both',   ),
     891        'xmm13':        ( 'uint', 'both',   ),
     892        'xmm14':        ( 'uint', 'both',   ),
     893        'xmm15':        ( 'uint', 'both',   ),
     894        'xmm0.lo':      ( 'uint', 'both',   ),
     895        'xmm1.lo':      ( 'uint', 'both',   ),
     896        'xmm2.lo':      ( 'uint', 'both',   ),
     897        'xmm3.lo':      ( 'uint', 'both',   ),
     898        'xmm4.lo':      ( 'uint', 'both',   ),
     899        'xmm5.lo':      ( 'uint', 'both',   ),
     900        'xmm6.lo':      ( 'uint', 'both',   ),
     901        'xmm7.lo':      ( 'uint', 'both',   ),
     902        'xmm8.lo':      ( 'uint', 'both',   ),
     903        'xmm9.lo':      ( 'uint', 'both',   ),
     904        'xmm10.lo':     ( 'uint', 'both',   ),
     905        'xmm11.lo':     ( 'uint', 'both',   ),
     906        'xmm12.lo':     ( 'uint', 'both',   ),
     907        'xmm13.lo':     ( 'uint', 'both',   ),
     908        'xmm14.lo':     ( 'uint', 'both',   ),
     909        'xmm15.lo':     ( 'uint', 'both',   ),
     910        'xmm0.hi':      ( 'uint', 'both',   ),
     911        'xmm1.hi':      ( 'uint', 'both',   ),
     912        'xmm2.hi':      ( 'uint', 'both',   ),
     913        'xmm3.hi':      ( 'uint', 'both',   ),
     914        'xmm4.hi':      ( 'uint', 'both',   ),
     915        'xmm5.hi':      ( 'uint', 'both',   ),
     916        'xmm6.hi':      ( 'uint', 'both',   ),
     917        'xmm7.hi':      ( 'uint', 'both',   ),
     918        'xmm8.hi':      ( 'uint', 'both',   ),
     919        'xmm9.hi':      ( 'uint', 'both',   ),
     920        'xmm10.hi':     ( 'uint', 'both',   ),
     921        'xmm11.hi':     ( 'uint', 'both',   ),
     922        'xmm12.hi':     ( 'uint', 'both',   ),
     923        'xmm13.hi':     ( 'uint', 'both',   ),
     924        'xmm14.hi':     ( 'uint', 'both',   ),
     925        'xmm15.hi':     ( 'uint', 'both',   ),
     926        'xmm0.lo.zx':   ( 'uint', 'both',   ),
     927        'xmm1.lo.zx':   ( 'uint', 'both',   ),
     928        'xmm2.lo.zx':   ( 'uint', 'both',   ),
     929        'xmm3.lo.zx':   ( 'uint', 'both',   ),
     930        'xmm4.lo.zx':   ( 'uint', 'both',   ),
     931        'xmm5.lo.zx':   ( 'uint', 'both',   ),
     932        'xmm6.lo.zx':   ( 'uint', 'both',   ),
     933        'xmm7.lo.zx':   ( 'uint', 'both',   ),
     934        'xmm8.lo.zx':   ( 'uint', 'both',   ),
     935        'xmm9.lo.zx':   ( 'uint', 'both',   ),
     936        'xmm10.lo.zx':  ( 'uint', 'both',   ),
     937        'xmm11.lo.zx':  ( 'uint', 'both',   ),
     938        'xmm12.lo.zx':  ( 'uint', 'both',   ),
     939        'xmm13.lo.zx':  ( 'uint', 'both',   ),
     940        'xmm14.lo.zx':  ( 'uint', 'both',   ),
     941        'xmm15.lo.zx':  ( 'uint', 'both',   ),
     942        'xmm0.dw0':     ( 'uint', 'both',   ),
     943        'xmm1.dw0':     ( 'uint', 'both',   ),
     944        'xmm2.dw0':     ( 'uint', 'both',   ),
     945        'xmm3.dw0':     ( 'uint', 'both',   ),
     946        'xmm4.dw0':     ( 'uint', 'both',   ),
     947        'xmm5.dw0':     ( 'uint', 'both',   ),
     948        'xmm6.dw0':     ( 'uint', 'both',   ),
     949        'xmm7.dw0':     ( 'uint', 'both',   ),
     950        'xmm8.dw0':     ( 'uint', 'both',   ),
     951        'xmm9.dw0':     ( 'uint', 'both',   ),
     952        'xmm10.dw0':    ( 'uint', 'both',   ),
     953        'xmm11.dw0':    ( 'uint', 'both',   ),
     954        'xmm12.dw0':    ( 'uint', 'both',   ),
     955        'xmm13.dw0':    ( 'uint', 'both',   ),
     956        'xmm14.dw0':    ( 'uint', 'both',   ),
     957        'xmm15_dw0':    ( 'uint', 'both',   ),
     958        # AVX registers.
     959        'ymm0':         ( 'uint', 'both',   ),
     960        'ymm1':         ( 'uint', 'both',   ),
     961        'ymm2':         ( 'uint', 'both',   ),
     962        'ymm3':         ( 'uint', 'both',   ),
     963        'ymm4':         ( 'uint', 'both',   ),
     964        'ymm5':         ( 'uint', 'both',   ),
     965        'ymm6':         ( 'uint', 'both',   ),
     966        'ymm7':         ( 'uint', 'both',   ),
     967        'ymm8':         ( 'uint', 'both',   ),
     968        'ymm9':         ( 'uint', 'both',   ),
     969        'ymm10':        ( 'uint', 'both',   ),
     970        'ymm11':        ( 'uint', 'both',   ),
     971        'ymm12':        ( 'uint', 'both',   ),
     972        'ymm13':        ( 'uint', 'both',   ),
     973        'ymm14':        ( 'uint', 'both',   ),
     974        'ymm15':        ( 'uint', 'both',   ),
     975
    849976        # Special ones.
    850977        'value.xcpt':   ( 'uint', 'output', ),
     
    11271254
    11281255        # The /r form:
    1129         if sOpcode[0] == '/' and sOpcode[1].isdigit() and len(sOpcode) == 2:
    1130             return int(sOpcode[1:]) << 3;
     1256        if len(sOpcode) == 4 and sOpcode.startswith('/') and sOpcode[-1].isdigit():
     1257            return int(sOpcode[-1:]) << 3;
     1258
     1259        # The 11/r form:
     1260        if len(sOpcode) == 4 and sOpcode.startswith('11/') and sOpcode[-1].isdigit():
     1261            return (int(sOpcode[-1:]) << 3) | 0xc0;
     1262
     1263        # The !11/r form (returns mod=1):
     1264        ## @todo this doesn't really work...
     1265        if len(sOpcode) == 5 and sOpcode.startswith('!11/') and sOpcode[-1].isdigit():
     1266            return (int(sOpcode[-1:]) << 3) | 0x80;
    11311267
    11321268        raise Exception('unsupported opcode byte spec "%s" for %s' % (sOpcode, self,));
     
    17971933        if _isValidOpcodeByte(sOpcode):
    17981934            pass;
    1799         elif len(sOpcode) == 2 and sOpcode[0] == '/' and sOpcode[1] in '012345678':
     1935        elif len(sOpcode) == 2 and sOpcode.startswith('/') and sOpcode[-1] in '012345678':
     1936            pass;
     1937        elif len(sOpcode) == 4 and sOpcode.startswith('11/') and sOpcode[-1] in '012345678':
     1938            pass;
     1939        elif len(sOpcode) == 5 and sOpcode.startswith('!11/') and sOpcode[-1] in '012345678':
    18001940            pass;
    18011941        else:
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h

    r66342 r66391  
    57975797    IEM_MC_CALC_RM_EFF_ADDR(GCPtrEff, bRm, 0);
    57985798    IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
     5799    IEM_MC_ACTUALIZE_FPU_STATE_FOR_READ();
    57995800    IEM_MC_ASSIGN(iEffSeg, pVCpu->iem.s.iEffSeg);
    58005801    IEM_MC_CALL_CIMPL_3(iemCImpl_fxsave, iEffSeg, GCPtrEff, enmEffOpSize);
     
    58175818    IEM_MC_CALC_RM_EFF_ADDR(GCPtrEff, bRm, 0);
    58185819    IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
     5820    IEM_MC_ACTUALIZE_FPU_STATE_FOR_CHANGE();
    58195821    IEM_MC_ASSIGN(iEffSeg, pVCpu->iem.s.iEffSeg);
    58205822    IEM_MC_CALL_CIMPL_3(iemCImpl_fxrstor, iEffSeg, GCPtrEff, enmEffOpSize);
     
    58275829FNIEMOP_STUB_1(iemOp_Grp15_ldmxcsr,  uint8_t, bRm);
    58285830
    5829 /** Opcode 0x0f 0xae mem/3. */
    5830 FNIEMOP_STUB_1(iemOp_Grp15_stmxcsr,  uint8_t, bRm);
     5831
     5832/**
     5833 * @opmaps      grp15
     5834 * @opcode      !11/3
     5835 * @oppfx       none
     5836 * @opcpuid     sse
     5837 * @opgroup     og_cachectl
     5838 * @optest      mxcsr=0      -> op1=0
     5839 * @optest      mxcsr=0x2083 -> op1=0x2083
     5840 * @oponlytest
     5841 */
     5842FNIEMOP_DEF_1(iemOp_Grp15_stmxcsr,  uint8_t, bRm)
     5843{
     5844    IEMOP_MNEMONIC1(M_MEM, STMXCSR, stmxcsr, MdWO, DISOPTYPE_HARMLESS, IEMOPHINT_IGNORES_OP_SIZE);
     5845    if (!IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSse)
     5846        return IEMOP_RAISE_INVALID_OPCODE();
     5847
     5848    IEM_MC_BEGIN(2, 1);
     5849    IEM_MC_ARG(uint8_t,         iEffSeg,                                 0);
     5850    IEM_MC_ARG(RTGCPTR,         GCPtrEff,                                1);
     5851    IEM_MC_CALC_RM_EFF_ADDR(GCPtrEff, bRm, 0);
     5852    IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
     5853    IEM_MC_ACTUALIZE_SSE_STATE_FOR_READ();
     5854    IEM_MC_ASSIGN(iEffSeg, pVCpu->iem.s.iEffSeg);
     5855    IEM_MC_CALL_CIMPL_2(iemCImpl_stmxcsr, iEffSeg, GCPtrEff);
     5856    IEM_MC_END();
     5857    return VINF_SUCCESS;
     5858}
     5859
    58315860
    58325861/** Opcode 0x0f 0xae mem/4. */
     
    58415870/**
    58425871 * @opmaps      grp15
    5843  * @opcode      /7
     5872 * @opcode      !11/7
    58445873 * @oppfx       none
    58455874 * @opcpuid     clfsh
     
    58665895/**
    58675896 * @opmaps      grp15
    5868  * @opcode      /7
     5897 * @opcode      !11/7
    58695898 * @oppfx       0x66
    58705899 * @opcpuid     clflushopt
     
    65596588 * @opinvalid   intel-modrm
    65606589 * @optest      op1=1 op2=2 ->
    6561  * @oponlytest
    65626590 */
    65636591FNIEMOP_DEF(iemOp_Grp10)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c

    r66334 r66391  
    405405    /* [BS3CG1DST_FPUDS] = */       2,
    406406    /* [BS3CG1DST_MXCSR] = */       4,
    407     /* [BS3CG1DST_MXCSR_MASK] = */  4,
    408407    /* [BS3CG1DST_ST0] = */         12,
    409408    /* [BS3CG1DST_ST1] = */         12,
     
    633632    /* [BS3CG1DST_FPUDS] = */       sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, Ctx.x87.DS),
    634633    /* [BS3CG1DST_MXCSR] = */       sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, Ctx.x87.MXCSR),
    635     /* [BS3CG1DST_MXCSR_MASK] = */  sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, Ctx.x87.MXCSR_MASK),
    636634    /* [BS3CG1DST_ST0] = */         sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, Ctx.x87.aRegs[0]),
    637635    /* [BS3CG1DST_ST1] = */         sizeof(BS3REGCTX) + RT_OFFSETOF(BS3EXTCTX, Ctx.x87.aRegs[1]),
     
    15581556            break;
    15591557
     1558        case BS3CG1ENC_MODRM_MdWO:
     1559            if (iEncoding == 0)
     1560            {
     1561                off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)) - 1;
     1562                off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off,
     1563                                               (pThis->abCurInstr[off] & X86_MODRM_REG_MASK) >> X86_MODRM_REG_SHIFT,
     1564                                               4, 0, BS3CG1OPLOC_MEM_RW);
     1565            }
     1566            else
     1567                break;
     1568            pThis->cbCurInstr = off;
     1569            iEncoding++;
     1570            break;
    15601571
    15611572        case BS3CG1ENC_FIXED:
     
    18261837            pThis->aOperands[0].cbOp = 1;
    18271838            pThis->aOperands[0].enmLocation = BS3CG1OPLOC_MEM;
     1839            break;
     1840
     1841        case BS3CG1ENC_MODRM_MdWO:
     1842            pThis->iRmOp             = 0;
     1843            pThis->aOperands[0].cbOp = 4;
     1844            pThis->aOperands[0].enmLocation = BS3CG1OPLOC_MEM_RW;
    18281845            break;
    18291846
     
    26752692                //CHECK_FIELD(x87.Rsrvd2,   "Rsrvd2: %#06x, expected %#06x");
    26762693                CHECK_FIELD(x87.MXCSR,      "MXCSR:  %#010x, expected %#010x");
    2677                 //CHECK_FIELD(x87.MXCSR_MASK, "MXCSR_MASK: %#010x, expected %#010x");
    26782694#undef CHECK_FIELD
    26792695                for (i = 0; i < RT_ELEMENTS(pExpect->Ctx.x87.aRegs); i++)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1.h

    r66334 r66391  
    7070    BS3CG1OP_Ma,
    7171    BS3CG1OP_MbRO,
     72    BS3CG1OP_MdWO,
    7273    BS3CG1OP_Mq,
    7374
     
    103104    BS3CG1ENC_MODRM_Vdq_Wdq,
    104105    BS3CG1ENC_MODRM_MbRO,
     106    BS3CG1ENC_MODRM_MdWO,
    105107
    106108    BS3CG1ENC_FIXED,
     
    420422    BS3CG1DST_FPUDS,
    421423    BS3CG1DST_MXCSR,
    422     BS3CG1DST_MXCSR_MASK,
    423424    BS3CG1DST_ST0,
    424425    BS3CG1DST_ST1,
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