VirtualBox

Changeset 103801 in vbox


Ignore:
Timestamp:
Mar 11, 2024 10:36:07 PM (12 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
162170
Message:

VMM/IEM: Implemented iemNativeEmit_xor_r_i_efl and enabled it for both hosts. bugref:10376

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

Legend:

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

    r103800 r103801  
    18461846    IEMOP_MNEMONIC2(FIXED, XOR, xor, AL, Ib, DISOPTYPE_HARMLESS, IEMOPHINT_IGNORES_OP_SIZES);
    18471847    IEMOP_VERIFICATION_UNDEFINED_EFLAGS(X86_EFL_AF);
    1848     IEMOP_BODY_BINARY_AL_Ib(xor, 0);
     1848    IEMOP_BODY_BINARY_AL_Ib(xor, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64);
    18491849}
    18501850
     
    18591859    IEMOP_MNEMONIC2(FIXED, XOR, xor, rAX, Iz, DISOPTYPE_HARMLESS, IEMOPHINT_IGNORES_OP_SIZES);
    18601860    IEMOP_VERIFICATION_UNDEFINED_EFLAGS(X86_EFL_AF);
    1861     IEMOP_BODY_BINARY_rAX_Iz_RW(xor, 0);
     1861    IEMOP_BODY_BINARY_rAX_Iz_RW(xor, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64);
    18621862}
    18631863
     
    44524452{
    44534453    IEMOP_MNEMONIC(xor_Eb_Ib, "xor Eb,Ib");
    4454     IEMOP_BODY_BINARY_Eb_Ib_RW(xor, 0, 0);
     4454    IEMOP_BODY_BINARY_Eb_Ib_RW(xor, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64, 0);
    44554455}
    44564456
     
    50255025{
    50265026    IEMOP_MNEMONIC(xor_Ev_Iz, "xor Ev,Iz");
    5027     IEMOP_BODY_BINARY_Ev_Iz_RW(xor, 0, 0);
     5027    IEMOP_BODY_BINARY_Ev_Iz_RW(xor, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64, 0);
    50285028}
    50295029
     
    55835583{
    55845584    IEMOP_MNEMONIC(xor_Ev_Ib, "xor Ev,Ib");
    5585     IEMOP_BODY_BINARY_Ev_Ib_RW(xor, 0, 0);
     5585    IEMOP_BODY_BINARY_Ev_Ib_RW(xor, RT_ARCH_VAL_AMD64 | RT_ARCH_VAL_ARM64, 0);
    55865586}
    55875587
  • trunk/src/VBox/VMM/VMMAll/target-x86/IEMAllN8veEmit-x86.h

    r103800 r103801  
    467467    uint8_t const idxRegSrc = iemNativeVarRegisterAcquire(pReNative, idxVarSrc, &off, true /*fInitialized*/);
    468468#ifdef RT_ARCH_AMD64
    469     /* On AMD64 we just use the correctly size AND instruction harvest the EFLAGS. */
     469    /* On AMD64 we just use the correctly sized AND instruction harvest the EFLAGS. */
    470470    off = iemNativeEmitAmd64OneByteModRmInstrRREx(iemNativeInstrBufEnsure(pReNative, off, 4), off,
    471471                                                  0x22, 0x23, cOpBits, idxRegDst, idxRegSrc);
     
    500500    uint8_t const idxRegDst = iemNativeVarRegisterAcquire(pReNative, idxVarDst, &off, true /*fInitialized*/);
    501501#ifdef RT_ARCH_AMD64
    502     /* On AMD64 we just use the correctly size AND instruction harvest the EFLAGS. */
     502    /* On AMD64 we just use the correctly sized AND instruction harvest the EFLAGS. */
    503503    PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 8);
    504504    off = iemNativeEmitAmd64OneByteModRmInstrRIEx(pCodeBuf, off, 0x80, 0x83, 0x81, cOpBits, cImmBits, 4, idxRegDst, uImmOp);
     
    556556                                       : iemNativeVarRegisterAcquire(pReNative, idxVarSrc, &off, true /*fInitialized*/);
    557557#ifdef RT_ARCH_AMD64
    558     /* On AMD64 we just use the correctly size TEST instruction harvest the EFLAGS. */
     558    /* On AMD64 we just use the correctly sized TEST instruction harvest the EFLAGS. */
    559559    off = iemNativeEmitAmd64OneByteModRmInstrRREx(iemNativeInstrBufEnsure(pReNative, off, 4), off,
    560560                                                  0x84, 0x85, cOpBits, idxRegSrc, idxRegDst);
     
    598598    uint8_t const idxRegDst = iemNativeVarRegisterAcquire(pReNative, idxVarDst, &off, true /*fInitialized*/);
    599599#ifdef RT_ARCH_AMD64
    600     /* On AMD64 we just use the correctly size AND instruction harvest the EFLAGS. */
     600    /* On AMD64 we just use the correctly sized AND instruction harvest the EFLAGS. */
    601601    PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 8);
    602602    off = iemNativeEmitAmd64OneByteModRmInstrRIEx(pCodeBuf, off, 0xf6, 0xcc, 0xf7, cOpBits, cImmBits, 0, idxRegDst, uImmOp);
     
    658658    uint8_t const idxRegSrc = iemNativeVarRegisterAcquire(pReNative, idxVarSrc, &off, true /*fInitialized*/);
    659659#ifdef RT_ARCH_AMD64
    660     /* On AMD64 we just use the correctly size OR instruction harvest the EFLAGS. */
     660    /* On AMD64 we just use the correctly sized OR instruction harvest the EFLAGS. */
    661661    off = iemNativeEmitAmd64OneByteModRmInstrRREx(iemNativeInstrBufEnsure(pReNative, off, 4), off,
    662662                                                  0x0a, 0x0b, cOpBits, idxRegDst, idxRegSrc);
     
    692692    uint8_t const idxRegDst = iemNativeVarRegisterAcquire(pReNative, idxVarDst, &off, true /*fInitialized*/);
    693693#ifdef RT_ARCH_AMD64
    694     /* On AMD64 we just use the correctly size OR instruction harvest the EFLAGS. */
     694    /* On AMD64 we just use the correctly sized OR instruction harvest the EFLAGS. */
    695695    PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 8);
    696696    off = iemNativeEmitAmd64OneByteModRmInstrRIEx(pCodeBuf, off, 0x80, 0x83, 0x81, cOpBits, cImmBits, 1, idxRegDst, uImmOp);
     
    741741    uint8_t const idxRegSrc = iemNativeVarRegisterAcquire(pReNative, idxVarSrc, &off, true /*fInitialized*/);
    742742#ifdef RT_ARCH_AMD64
    743     /* On AMD64 we just use the correctly size OR instruction harvest the EFLAGS. */
     743    /* On AMD64 we just use the correctly sized OR instruction harvest the EFLAGS. */
    744744    off = iemNativeEmitAmd64OneByteModRmInstrRREx(iemNativeInstrBufEnsure(pReNative, off, 4), off,
    745745                                                  0x32, 0x33, cOpBits, idxRegDst, idxRegSrc);
     
    773773                          uint8_t idxVarDst, uint64_t uImmOp, uint8_t idxVarEfl, uint8_t cOpBits, uint8_t cImmBits)
    774774{
    775     RT_NOREF(pReNative, off, idxVarDst, uImmOp, idxVarEfl, cOpBits, cImmBits);
     775    uint8_t const idxRegDst = iemNativeVarRegisterAcquire(pReNative, idxVarDst, &off, true /*fInitialized*/);
     776#ifdef RT_ARCH_AMD64
     777    /* On AMD64 we just use the correctly sized XOR instruction harvest the EFLAGS. */
     778    PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 8);
     779    off = iemNativeEmitAmd64OneByteModRmInstrRIEx(pCodeBuf, off, 0x80, 0x83, 0x81, cOpBits, cImmBits, 6, idxRegDst, uImmOp);
     780    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     781
     782    off = iemNativeEmitEFlagsForLogical(pReNative, off, idxVarEfl);
     783
     784#elif defined(RT_ARCH_ARM64)
     785    /* On ARM64 we use 32-bit OR for the 8-bit and 16-bit bit ones, and of
     786       course the immediate variant when possible to save a register load.  */
     787    uint32_t uImmSizeLen, uImmRotations;
     788    if (  cOpBits > 32
     789        ? Armv8A64ConvertMask64ToImmRImmS(uImmOp, &uImmSizeLen, &uImmRotations)
     790        : Armv8A64ConvertMask32ToImmRImmS(uImmOp, &uImmSizeLen, &uImmRotations))
     791    {
     792        PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
     793        pCodeBuf[off++] = Armv8A64MkInstrEorImm(idxRegDst, idxRegDst, uImmSizeLen, uImmRotations, cOpBits > 32 /*f64Bit*/);
     794    }
     795    else
     796    {
     797        uint8_t const idxRegTmpImm = iemNativeRegAllocTmpImm(pReNative, &off, uImmOp);
     798        PIEMNATIVEINSTR const pCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
     799        pCodeBuf[off++] = Armv8A64MkInstrEor(idxRegDst, idxRegDst, idxRegTmpImm, cOpBits > 32 /*f64Bit*/);
     800        iemNativeRegFreeTmpImm(pReNative, idxRegTmpImm);
     801    }
     802    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     803
     804    off = iemNativeEmitEFlagsForLogical(pReNative, off, idxVarEfl, cOpBits, idxRegDst);
     805    RT_NOREF_PV(cImmBits)
     806
     807#else
     808# error "Port me"
     809#endif
     810    iemNativeVarRegisterRelease(pReNative, idxVarDst);
    776811    return off;
    777812}
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