Changeset 26130 in vbox for trunk/src/VBox/VMM/PATM
- Timestamp:
- Feb 1, 2010 3:06:46 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57127
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PATM/PATM.cpp
r26129 r26130 5953 5953 if (!cbLeft) 5954 5954 { 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) 5957 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) 5958 pRec = (PRECPATCHTOGUEST)RTAvlU32GetBestFit(&pPatch->patch.Patch2GuestAddrTree, pCurPatchInstrGC - pVM->patm.s.pPatchMemGC, true); 5959 if (pRec) 5964 5960 { 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 { 5965 5969 pPatchFillHC[0] = 0xE9; 5966 *(uint32_t *)&pPatchFillHC[1] = cbFiller - SIZEOF_NEARJUMP32;5970 *(uint32_t *)&pPatchFillHC[1] = cbFiller - SIZEOF_NEARJUMP32; 5967 5971 #ifdef DEBUG 5968 5972 char szBuf[256]; … … 5971 5975 Log(("FILL: %s\n", szBuf)); 5972 5976 #endif 5973 } 5974 else 5975 { 5976 for (unsigned i = 0; i < cbFiller; i++) 5977 } 5978 else 5977 5979 { 5978 pPatchFillHC[i] = 0x90; /* NOP */ 5980 for (unsigned i = 0; i < cbFiller; i++) 5981 { 5982 pPatchFillHC[i] = 0x90; /* NOP */ 5979 5983 #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 } 5985 5990 } 5986 5991 }
Note:
See TracChangeset
for help on using the changeset viewer.