VirtualBox

Changeset 26129 in vbox for trunk/src/VBox/VMM/PATM


Ignore:
Timestamp:
Feb 1, 2010 2:59:45 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57126
Message:

PATM: Check if we expanded a complex guest instruction into a patch stream (e.g. call)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PATM/PATM.cpp

    r26039 r26129  
    59495949            pCurPatchInstrGC += CpuNew.opsize;
    59505950            cbLeft           -= CpuNew.opsize;
     5951
     5952            /* Check if we expanded a complex guest instruction into a patch stream (e.g. call) */
     5953            if (!cbLeft)
     5954            {
     5955                pRec = (PRECPATCHTOGUEST)RTAvlU32GetBestFit(&pPatch->patch.Patch2GuestAddrTree, pCurPatchInstrGC - pVM->patm.s.pPatchMemGC, true);
     5956                if (pRec)
     5957                {
     5958                    unsigned cbFiller  = pRec->Core.Key + pVM->patm.s.pPatchMemGC - pCurPatchInstrGC;
     5959                    uint8_t *pPatchFillHC = patmPatchGCPtr2PatchHCPtr(pVM, pCurPatchInstrGC);
     5960
     5961                    Assert(!pRec->fDirty);
     5962
     5963                    if (cbFiller >= SIZEOF_NEARJUMP32)
     5964                    {
     5965                            pPatchFillHC[0] = 0xE9;
     5966                            *(uint32_t *)&pPatchFillHC[1] = cbFiller - SIZEOF_NEARJUMP32;
     5967#ifdef DEBUG
     5968                            char szBuf[256];
     5969                            szBuf[0] = '\0';
     5970                            DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurPatchInstrGC, 0, szBuf, sizeof(szBuf), NULL);
     5971                            Log(("FILL:  %s\n", szBuf));
     5972#endif
     5973                    }
     5974                    else
     5975                    {
     5976                        for (unsigned i = 0; i < cbFiller; i++)
     5977                        {
     5978                            pPatchFillHC[i] = 0x90; /* NOP */
     5979#ifdef DEBUG
     5980                            char szBuf[256];
     5981                            szBuf[0] = '\0';
     5982                            DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurPatchInstrGC, 0, szBuf, sizeof(szBuf), NULL);
     5983                            Log(("FILL:  %s\n", szBuf));
     5984#endif
     5985                        }
     5986                    }
     5987                }
     5988            }
    59515989        }
    59525990    }
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