VirtualBox

Changeset 104798 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 28, 2024 7:04:30 AM (6 months ago)
Author:
vboxsync
Message:

VMM/IEM: Introduce IEMNATIVE_WITH_RECOMPILER_EPILOGUE_SINGLETON as an experiment to unify the epilog for all TBs into single instance, enabling it only for arm64 right now, bugref:10677

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veHlpA-arm64.S

    r104367 r104798  
    9595        br      x2
    9696
     97#ifdef IEMNATIVE_WITH_RECOMPILER_EPILOGUE_SINGLETON
     98/**
     99 * This is the common epilog for all TBs, restoring all volatile registers
     100 * and cleaning up the stack frame. This is a direct jump target and not a
     101 * real function to call using bl/blr.
     102 */
     103ALIGNCODE(IEM_HLP_FUNCTION_ALIGNMENT)
     104BEGINPROC_HIDDEN iemNativeTbEpilog
     105        ldp     x19, x20, [sp, #IEMNATIVE_FRAME_VAR_SIZE]!
     106        ldp     x21, x22, [sp, #0x10]
     107        ldp     x23, x24, [sp, #0x20]
     108        ldp     x25, x26, [sp, #0x30]
     109        ldp     x27, x28, [sp, #0x40]
     110        ldp     x29, x30, [sp, #0x50]
     111        add     sp, sp, #IEMNATIVE_FRAME_SAVE_REG_SIZE
     112# ifdef RT_OS_DARWIN
     113        retab
     114# else
     115        ret
     116# endif
     117#endif
     118
    97119
    98120/**
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r104797 r104798  
    66626662    IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK(pReNative, off, X86_EFL_STATUS_BITS);
    66636663
     6664#ifdef IEMNATIVE_WITH_RECOMPILER_EPILOGUE_SINGLETON
     6665    //off = iemNativeEmitBrk(pReNative, off, 0x7777);
     6666    off = iemNativeEmitJmpImm(pReNative, off, (uintptr_t)iemNativeTbEpilog);
     6667#else
    66646668    /*
    66656669     * Restore registers and return.
    66666670     */
    6667 #ifdef RT_ARCH_AMD64
     6671# ifdef RT_ARCH_AMD64
    66686672    uint8_t * const pbCodeBuf = iemNativeInstrBufEnsure(pReNative, off, 20);
    66696673
     
    66836687    pbCodeBuf[off++] = X86_OP_REX_B;            /* pop r12 */
    66846688    pbCodeBuf[off++] = 0x58 + X86_GREG_x12 - 8;
    6685 # ifdef RT_OS_WINDOWS
     6689#  ifdef RT_OS_WINDOWS
    66866690    pbCodeBuf[off++] = 0x58 + X86_GREG_xDI;     /* pop rdi */
    66876691    pbCodeBuf[off++] = 0x58 + X86_GREG_xSI;     /* pop rsi */
    6688 # endif
     6692#  endif
    66896693    pbCodeBuf[off++] = 0x58 + X86_GREG_xBX;     /* pop rbx */
    66906694    pbCodeBuf[off++] = 0xc9;                    /* leave */
     
    66926696    pbCodeBuf[off++] = 0xcc;                    /* int3 poison */
    66936697
    6694 #elif RT_ARCH_ARM64
     6698# elif RT_ARCH_ARM64
    66956699    uint32_t * const pu32CodeBuf = iemNativeInstrBufEnsure(pReNative, off, 10);
    66966700
     
    67196723
    67206724    /* retab / ret */
    6721 # ifdef RT_OS_DARWIN /** @todo See todo on pacibsp in the prolog. */
     6725#  ifdef RT_OS_DARWIN /** @todo See todo on pacibsp in the prolog. */
    67226726    if (1)
    67236727        pu32CodeBuf[off++] = ARMV8_A64_INSTR_RETAB;
    67246728    else
     6729#  endif
     6730        pu32CodeBuf[off++] = ARMV8_A64_INSTR_RET;
     6731
     6732# else
     6733#  error "port me"
    67256734# endif
    6726         pu32CodeBuf[off++] = ARMV8_A64_INSTR_RET;
    6727 
    6728 #else
    6729 # error "port me"
    6730 #endif
    67316735    IEMNATIVE_ASSERT_INSTR_BUF_ENSURE(pReNative, off);
     6736#endif /* IEMNATIVE_WITH_RECOMPILER_EPILOGUE_SINGLETON */
    67326737
    67336738    /* HACK: For IEMNATIVE_STRICT_EFLAGS_SKIPPING_EMIT_CHECK. */
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r104797 r104798  
    8282#endif
    8383
     84/** @def IEMNATIVE_WITH_RECOMPILER_EPILOGUE_SINGLETON
     85 * Enables having only a single epilogue for native TBs. */
     86#if defined(RT_ARCH_ARM64) || defined(DOXYGEN_RUNNING)
     87# define IEMNATIVE_WITH_RECOMPILER_EPILOGUE_SINGLETON
     88#endif
    8489
    8590/** @name Stack Frame Layout
     
    25802585#endif
    25812586
     2587#ifdef IEMNATIVE_WITH_RECOMPILER_EPILOGUE_SINGLETON
     2588/** The common epilog jumped to from a TB.
     2589 * @note This is not a callable function! */
     2590extern "C" IEM_DECL_NATIVE_HLP_DEF(int, iemNativeTbEpilog, (void));
     2591#endif
     2592
    25822593#endif /* !RT_IN_ASSEMBLER - ASM-NOINC-END */
    25832594
  • trunk/src/VBox/VMM/include/IEMN8veRecompilerEmit.h

    r104797 r104798  
    76637663
    76647664
     7665/**
     7666 * Emits an indirect jump to an immediate 64-bit address (uses the temporary GPR).
     7667 */
     7668DECL_INLINE_THROW(uint32_t) iemNativeEmitJmpImm(PIEMRECOMPILERSTATE pReNative, uint32_t off, uintptr_t uPfn)
     7669{
     7670    off = iemNativeEmitLoadGprImm64(pReNative, off, IEMNATIVE_REG_FIXED_TMP0, uPfn);
     7671    return iemNativeEmitJmpViaGpr(pReNative, off, IEMNATIVE_REG_FIXED_TMP0);
     7672}
     7673
     7674
    76657675/*********************************************************************************************************************************
    76667676*   Calls.                                                                                                                       *
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