VirtualBox

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


Ignore:
Timestamp:
Feb 1, 2010 3:06:46 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57127
Message:

PATM: Correction

File:
1 edited

Legend:

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

    r26129 r26130  
    59535953            if (!cbLeft)
    59545954            {
    5955                 pRec = (PRECPATCHTOGUEST)RTAvlU32GetBestFit(&pPatch->patch.Patch2GuestAddrTree, pCurPatchInstrGC - pVM->patm.s.pPatchMemGC, true);
    5956                 if (pRec)
     5955                /* If the next patch instruction doesn't correspond to the next guest instruction, then we have some extra room to fill. */
     5956                if (RTAvlU32Get(&pPatch->patch.Patch2GuestAddrTree, pCurPatchInstrGC - pVM->patm.s.pPatchMemGC) == NULL)
    59575957                {
    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)
     5958                    pRec = (PRECPATCHTOGUEST)RTAvlU32GetBestFit(&pPatch->patch.Patch2GuestAddrTree, pCurPatchInstrGC - pVM->patm.s.pPatchMemGC, true);
     5959                    if (pRec)
    59645960                    {
     5961                        unsigned cbFiller  = pRec->Core.Key + pVM->patm.s.pPatchMemGC - pCurPatchInstrGC;
     5962                        uint8_t *pPatchFillHC = patmPatchGCPtr2PatchHCPtr(pVM, pCurPatchInstrGC);
     5963
     5964                        Assert(!pRec->fDirty);
     5965
     5966                        Log(("Room left in patched instruction stream (%d bytes)\n", cbFiller));
     5967                        if (cbFiller >= SIZEOF_NEARJUMP32)
     5968                        {
    59655969                            pPatchFillHC[0] = 0xE9;
    5966                             *(uint32_t *)&pPatchFillHC[1] = cbFiller - SIZEOF_NEARJUMP32;
     5970                             *(uint32_t *)&pPatchFillHC[1] = cbFiller - SIZEOF_NEARJUMP32;
    59675971#ifdef DEBUG
    59685972                            char szBuf[256];
     
    59715975                            Log(("FILL:  %s\n", szBuf));
    59725976#endif
    5973                     }
    5974                     else
    5975                     {
    5976                         for (unsigned i = 0; i < cbFiller; i++)
     5977                        }
     5978                        else
    59775979                        {
    5978                             pPatchFillHC[i] = 0x90; /* NOP */
     5980                            for (unsigned i = 0; i < cbFiller; i++)
     5981                            {
     5982                                pPatchFillHC[i] = 0x90; /* NOP */
    59795983#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
     5984                                char szBuf[256];
     5985                                szBuf[0] = '\0';
     5986                                DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, pCtx->cs, pCurPatchInstrGC, 0, szBuf, sizeof(szBuf), NULL);
     5987                                Log(("FILL:  %s\n", szBuf));
     5988#endif
     5989                            }
    59855990                        }
    59865991                    }
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