VirtualBox

Changeset 101584 in vbox


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

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllInstPython.py

    r101583 r101584  
    28832883    'IEM_MC_IF_CX_IS_NZ_AND_EFL_BIT_NOT_SET':                    (McBlock.parseMcGenericCond,       True,  False, ),
    28842884    'IEM_MC_IF_CX_IS_NZ_AND_EFL_BIT_SET':                        (McBlock.parseMcGenericCond,       True,  False, ),
    2885     'IEM_MC_IF_ECX_IS_NZ':                                       (McBlock.parseMcGenericCond,       True,  False, ),
     2885    'IEM_MC_IF_ECX_IS_NZ':                                       (McBlock.parseMcGenericCond,       True,  True, ),
    28862886    'IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_NOT_SET':                   (McBlock.parseMcGenericCond,       True,  False, ),
    28872887    'IEM_MC_IF_ECX_IS_NZ_AND_EFL_BIT_SET':                       (McBlock.parseMcGenericCond,       True,  False, ),
     
    29012901    'IEM_MC_IF_LOCAL_IS_Z':                                      (McBlock.parseMcGenericCond,       True,  False, ),
    29022902    'IEM_MC_IF_MXCSR_XCPT_PENDING':                              (McBlock.parseMcGenericCond,       True,  False, ),
    2903     'IEM_MC_IF_RCX_IS_NZ':                                       (McBlock.parseMcGenericCond,       True,  False, ),
     2903    'IEM_MC_IF_RCX_IS_NZ':                                       (McBlock.parseMcGenericCond,       True,  True, ),
    29042904    'IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_NOT_SET':                   (McBlock.parseMcGenericCond,       True,  False, ),
    29052905    'IEM_MC_IF_RCX_IS_NZ_AND_EFL_BIT_SET':                       (McBlock.parseMcGenericCond,       True,  False, ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r101583 r101584  
    45614561    do {
    45624562
    4563 /** Emits code for IEM_MC_IF_EFL_BIT_NOT_SET_AND_BITS_EQ and
    4564  *  IEM_MC_IF_EFL_BIT_SET_OR_BITS_NE. */
     4563/** Emits code for IEM_MC_IF_CX_IS_NZ. */
    45654564DECLINLINE(uint32_t) iemNativeEmitIfCxIsNotZero(PIEMRECOMPILERSTATE pReNative, uint32_t off)
    45664565{
     
    45734572    AssertReturn(idxGstRcxReg != UINT8_MAX, UINT32_MAX);
    45744573    off = iemNativeEmitTestAnyBitsInGprAndJmpToLabelIfNoneSet(pReNative, off, idxGstRcxReg, UINT16_MAX, pEntry->idxLabelElse);
     4574    iemNativeRegFreeTmp(pReNative, idxGstRcxReg);
     4575
     4576    iemNativeCondStartIfBlock(pReNative, off);
     4577    return off;
     4578}
     4579
     4580
     4581#define IEM_MC_IF_ECX_IS_NZ() \
     4582    off = iemNativeEmitIfRcxEcxIsNotZero(pReNative, off, false /*f64Bit*/); \
     4583    AssertReturn(off != UINT32_MAX, UINT32_MAX); \
     4584    do {
     4585
     4586#define IEM_MC_IF_RCX_IS_NZ() \
     4587    off = iemNativeEmitIfRcxEcxIsNotZero(pReNative, off, true /*f64Bit*/); \
     4588    AssertReturn(off != UINT32_MAX, UINT32_MAX); \
     4589    do {
     4590
     4591/** Emits code for IEM_MC_IF_ECX_IS_NZ and IEM_MC_IF_RCX_IS_NZ. */
     4592DECLINLINE(uint32_t) iemNativeEmitIfRcxEcxIsNotZero(PIEMRECOMPILERSTATE pReNative, uint32_t off, bool f64Bit)
     4593{
     4594    PIEMNATIVECOND pEntry = iemNativeCondPushIf(pReNative);
     4595    AssertReturn(pEntry, UINT32_MAX);
     4596
     4597    uint8_t const idxGstRcxReg = iemNativeRegAllocTmpForGuestReg(pReNative, &off,
     4598                                                                 (IEMNATIVEGSTREG)(kIemNativeGstReg_GprFirst + X86_GREG_xCX),
     4599                                                                 kIemNativeGstRegUse_ReadOnly);
     4600    AssertReturn(idxGstRcxReg != UINT8_MAX, UINT32_MAX);
     4601    off = iemNativeEmitTestIfGprIsZeroAndJmpToLabel(pReNative, off, idxGstRcxReg, f64Bit, pEntry->idxLabelElse);
    45754602    iemNativeRegFreeTmp(pReNative, idxGstRcxReg);
    45764603
  • 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