VirtualBox

Changeset 101584 in vbox for trunk/src/VBox/VMM/include


Ignore:
Timestamp:
Oct 24, 2023 9:19:18 PM (15 months ago)
Author:
vboxsync
Message:

VMM/IEM: Native IEM_MC_IF_ECX_IS_NZ and IEM_MC_IF_RCX_IS_NZ implementations. bugref:10371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r101581 r101584  
    26052605
    26062606/**
     2607 * Emits code that jumps to @a idxLabel if @a iGprSrc is zero.
     2608 *
     2609 * The operand size is given by @a f64Bit.
     2610 */
     2611DECLINLINE(uint32_t) iemNativeEmitTestIfGprIsZeroAndJmpToLabel(PIEMRECOMPILERSTATE pReNative, uint32_t off,
     2612                                                               uint8_t iGprSrc, bool f64Bit, uint32_t idxLabel)
     2613{
     2614    Assert(idxLabel < pReNative->cLabels);
     2615
     2616#ifdef RT_ARCH_AMD64
     2617    /* test reg32,reg32  / test reg64,reg64 */
     2618    uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 3);
     2619    AssertReturn(pbCodeBuf, UINT32_MAX);
     2620    if (f64Bit)
     2621        pbCodeBuf[off++] = X86_OP_REX_W | (iGprSrc < 8 ? 0 : X86_OP_REX_R | X86_OP_REX_B);
     2622    else if (iGprSrc >= 8)
     2623        pbCodeBuf[off++] = X86_OP_REX_R | X86_OP_REX_B;
     2624    pbCodeBuf[off++] = 0x85;
     2625    pbCodeBuf[off++] = X86_MODRM_MAKE(X86_MOD_REG, iGprSrc & 7, iGprSrc & 7);
     2626    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     2627
     2628    /* jz idxLabel  */
     2629    off = iemNativeEmitJzToLabel(pReNative, off, idxLabel);
     2630
     2631#elif defined(RT_ARCH_ARM64)
     2632    uint32_t *pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 1);
     2633    AssertReturn(pu32CodeBuf, UINT32_MAX);
     2634    AssertReturn(iemNativeAddFixup(pReNative, off, idxLabel, kIemNativeFixupType_RelImm19At5), UINT32_MAX);
     2635    pu32CodeBuf[off++] = Armv8A64MkInstrCbzCbnz(false /*fJmpIfNotZero*/, 0, f64Bit);
     2636    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     2637
     2638#else
     2639# error "Port me!"
     2640#endif
     2641    return off;
     2642}
     2643
     2644
     2645/**
     2646 * Emits code that jumps to a new label if @a iGprSrc is zero.
     2647 *
     2648 * The operand size is given by @a f64Bit.
     2649 */
     2650DECLINLINE(uint32_t) iemNativeEmitTestIfGprIsZeroAndJmpToNewLabel(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint8_t iGprSrc,
     2651                                                                  bool f64Bit, IEMNATIVELABELTYPE enmLabelType, uint16_t uData)
     2652{
     2653    uint32_t const idxLabel = iemNativeLabelCreate(pReNative, enmLabelType, UINT32_MAX /*offWhere*/, uData);
     2654    AssertReturn(idxLabel != UINT32_MAX, UINT32_MAX);
     2655    return iemNativeEmitTestIfGprIsZeroAndJmpToLabel(pReNative, off, iGprSrc, f64Bit, idxLabel);
     2656}
     2657
     2658
     2659
     2660/**
    26072661 * Emits a call to a 64-bit address.
    26082662 */
     
    26322686
    26332687
    2634 
    26352688/** @} */
    26362689
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