VirtualBox

Changeset 105739 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Aug 19, 2024 11:42:23 PM (5 months ago)
Author:
vboxsync
Message:

VMM/IEM: Don't try save IEMNATIVE_REG_FIXED_TMP0 together with other in-use volatile registers when making calls (todo 10). bugref:10720

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

Legend:

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

    r105657 r105739  
    85608560                                     ? iemNativeLabelCreate(pReNative, kIemNativeLabelType_TlbLookup, UINT32_MAX, uTlbSeqNo)
    85618561                                     : UINT32_MAX;
    8562 //off=iemNativeEmitBrk(pReNative, off, 0);
     8562
    85638563    /*
    85648564     * Jump to the TLB lookup code.
     
    1016210162{
    1016310163    /* Grab the MXCSR register, it must not be call volatile or we end up freeing it when setting up the call below. */
    10164     uint8_t const  idxRegMxCsr = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_MxCsr,
    10165                                                                  kIemNativeGstRegUse_ForUpdate, true /*fNoVolatileRegs*/);
     10164    uint8_t const idxRegMxCsr = iemNativeRegAllocTmpForGuestReg(pReNative, &off, kIemNativeGstReg_MxCsr,
     10165                                                                kIemNativeGstRegUse_ForUpdate, true /*fNoVolatileRegs*/);
    1016610166    AssertRelease(!(RT_BIT_32(idxRegMxCsr) & IEMNATIVE_CALL_VOLATILE_GREG_MASK));
    1016710167
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r105724 r105739  
    43914391
    43924392    /* fKeepVars will reduce this mask. */
    4393     uint32_t fRegsToFree = IEMNATIVE_CALL_VOLATILE_GREG_MASK;
     4393    uint32_t fRegsToFree = IEMNATIVE_CALL_VOLATILE_NOTMP_GREG_MASK;
     4394
     4395#ifdef RT_ARCH_ARM64
     4396AssertCompile(IEMNATIVE_CALL_VOLATILE_NOTMP_GREG_MASK == UINT32_C(0x37fff));
     4397#endif
    43944398
    43954399    /*
     
    43984402    if (cArgs > RT_ELEMENTS(g_aidxIemNativeCallRegs))
    43994403        cArgs = RT_ELEMENTS(g_aidxIemNativeCallRegs);
    4400     uint32_t fRegsToMove = IEMNATIVE_CALL_VOLATILE_GREG_MASK
    4401 #ifdef IEMNATIVE_REG_FIXED_TMP0
    4402                          & ~RT_BIT_32(IEMNATIVE_REG_FIXED_TMP0)
    4403 #endif
    4404 #ifdef IEMNATIVE_REG_FIXED_TMP1
    4405                          & ~RT_BIT_32(IEMNATIVE_REG_FIXED_TMP1)
    4406 #endif
     4404    uint32_t fRegsToMove = IEMNATIVE_CALL_VOLATILE_NOTMP_GREG_MASK
    44074405#ifdef IEMNATIVE_REG_FIXED_PC_DBG
    44084406                         & ~RT_BIT_32(IEMNATIVE_REG_FIXED_PC_DBG)
     
    44824480    {
    44834481        Log12(("iemNativeRegMoveAndFreeAndFlushAtCall: bmHstRegsWithGstShadow %#RX32 -> %#RX32; removed %#RX32\n",
    4484                pReNative->Core.bmHstRegsWithGstShadow, pReNative->Core.bmHstRegsWithGstShadow & ~IEMNATIVE_CALL_VOLATILE_GREG_MASK, fHstRegsWithGstShadow));
     4482               pReNative->Core.bmHstRegsWithGstShadow, pReNative->Core.bmHstRegsWithGstShadow & ~IEMNATIVE_CALL_VOLATILE_GREG_MASK,
     4483               fHstRegsWithGstShadow));
    44854484        pReNative->Core.bmHstRegsWithGstShadow &= ~fHstRegsWithGstShadow;
    44864485        do
     
    77777776iemNativeVarSaveVolatileRegsPreHlpCall(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t fHstRegsNotToSave)
    77787777{
    7779     uint32_t fHstRegs = pReNative->Core.bmHstRegs & IEMNATIVE_CALL_VOLATILE_GREG_MASK & ~fHstRegsNotToSave;
     7778    uint32_t fHstRegs = pReNative->Core.bmHstRegs & IEMNATIVE_CALL_VOLATILE_NOTMP_GREG_MASK & ~fHstRegsNotToSave;
    77807779    if (fHstRegs)
    77817780    {
     
    79187917iemNativeVarRestoreVolatileRegsPostHlpCall(PIEMRECOMPILERSTATE pReNative, uint32_t off, uint32_t fHstRegsNotToSave)
    79197918{
    7920     uint32_t fHstRegs = pReNative->Core.bmHstRegs & IEMNATIVE_CALL_VOLATILE_GREG_MASK & ~fHstRegsNotToSave;
     7919    uint32_t fHstRegs = pReNative->Core.bmHstRegs & IEMNATIVE_CALL_VOLATILE_NOTMP_GREG_MASK & ~fHstRegsNotToSave;
    79217920    if (fHstRegs)
    79227921    {
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r105718 r105739  
    184184/** @def IEMNATIVE_REG_FIXED_TMP0
    185185 * Dedicated temporary register.
     186 * @note This has extremely short lifetime, must be used with great care to make
     187 *       sure any calling code or code being called is making use of it.
     188 *       It will definitely not survive a call or anything of that nature.
    186189 * @todo replace this by a register allocator and content tracker.  */
    187190/** @def IEMNATIVE_REG_FIXED_MASK
     
    409412# endif
    410413#endif
     414
     415/** @def IEMNATIVE_CALL_VOLATILE_NOTMP_GREG_MASK
     416 * Variant of IEMNATIVE_CALL_VOLATILE_GREG_MASK that excludes
     417 * IEMNATIVE_REG_FIXED_TMP0 on hosts that uses it. */
     418#ifdef IEMNATIVE_REG_FIXED_TMP0
     419# ifdef IEMNATIVE_REG_FIXED_TMP1
     420#  define IEMNATIVE_CALL_VOLATILE_NOTMP_GREG_MASK   (  IEMNATIVE_CALL_VOLATILE_GREG_MASK \
     421                                                     & ~(  RT_BIT_32(IEMNATIVE_REG_FIXED_TMP0) \
     422                                                         | RT_BIT_32(IEMNATIVE_REG_FIXED_TMP1)))
     423# else
     424#  define IEMNATIVE_CALL_VOLATILE_NOTMP_GREG_MASK   (IEMNATIVE_CALL_VOLATILE_GREG_MASK & ~RT_BIT_32(IEMNATIVE_REG_FIXED_TMP0))
     425# endif
     426#else
     427# define IEMNATIVE_CALL_VOLATILE_NOTMP_GREG_MASK    IEMNATIVE_CALL_VOLATILE_GREG_MASK
     428#endif
    411429/** @} */
    412430
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