Lines Matching refs:pPatchRec
905 PATMPATCHREC *pPatchRec;
916 rc = MMHyperAlloc(pVM, sizeof(PATMPATCHREC), 0, MM_TAG_PATM_PATCH, (void **)&pPatchRec);
924 patmR3PatchConvertSSM2Mem(pPatchRec, &patch);
926 Log(("Restoring patch %RRv -> %RRv state %x\n", pPatchRec->patch.pPrivInstrGC, patmInfo.pPatchMemGC + pPatchRec->patch.pPatchBlockOffset, pPatchRec->patch.uState));
927 bool ret = RTAvloU32Insert(&pVM->patm.s.PatchLookupTreeHC->PatchTree, &pPatchRec->Core);
929 if (pPatchRec->patch.uState != PATCH_REFUSED)
931 if (pPatchRec->patch.pPatchBlockOffset)
934 ret = RTAvloU32Insert(&pVM->patm.s.PatchLookupTreeHC->PatchTreeByPatchAddr, &pPatchRec->CoreOffset);
935 AssertMsg(ret, ("Inserting patch %RRv offset %08RX32 failed!!\n", pPatchRec->patch.pPrivInstrGC, pPatchRec->CoreOffset.Key));
939 pPatchRec->patch.pTempInfo = 0;
943 cacheRec.pPatch = &pPatchRec->patch;
945 uint8_t *pPrivInstrHC = patmR3GCVirtToHCVirt(pVM, &cacheRec, pPatchRec->patch.pPrivInstrGC);
951 pPatchRec->patch.FixupTree = 0;
952 pPatchRec->patch.nrFixups = 0; /* increased by patmPatchAddReloc32 */
974 if (pPatchRec->patch.uState != PATCH_REFUSED)
977 && (pPatchRec->patch.flags & PATMFL_PATCHED_GUEST_CODE))
979 Assert(pPatchRec->patch.cbPatchJump == SIZEOF_NEARJUMP32 || pPatchRec->patch.cbPatchJump == SIZEOF_NEAR_COND_JUMP32);
980 unsigned offset2 = (pPatchRec->patch.cbPatchJump == SIZEOF_NEARJUMP32) ? 1 : 2;
986 rc = patmCorrectFixup(pVM, uVersion, patmInfo, &pPatchRec->patch, &rec, offset, pFixup);
990 rc = patmPatchAddReloc32(pVM, &pPatchRec->patch, rec.pRelocPos, rec.uType, rec.pSource, rec.pDest);
999 Assert(pPatchRec->patch.nrPatch2GuestRecs || pPatchRec->patch.uState == PATCH_REFUSED || (pPatchRec->patch.flags & (PATMFL_SYSENTER_XP | PATMFL_IDTHANDLER | PATMFL_TRAPHANDLER | PATMFL_INT3_REPLACEMENT)));
1001 pPatchRec->patch.Patch2GuestAddrTree = 0;
1002 pPatchRec->patch.Guest2PatchAddrTree = 0;
1003 if (pPatchRec->patch.nrPatch2GuestRecs)
1006 uint32_t nrPatch2GuestRecs = pPatchRec->patch.nrPatch2GuestRecs;
1008 pPatchRec->patch.nrPatch2GuestRecs = 0; /* incremented by patmr3AddP2GLookupRecord */
1015 patmR3AddP2GLookupRecord(pVM, &pPatchRec->patch, (uintptr_t)rec.Core.Key + pVM->patm.s.pPatchMemHC, rec.pOrgInstrGC, rec.enmType, rec.fDirty);
1017 Assert(pPatchRec->patch.Patch2GuestAddrTree);
1020 if (pPatchRec->patch.flags & PATMFL_CODE_MONITORED)
1023 rc = patmInsertPatchPages(pVM, &pPatchRec->patch);
1028 if ( pPatchRec->patch.uState != PATCH_REFUSED
1029 && !(pPatchRec->patch.flags & PATMFL_INT3_REPLACEMENT))
1031 pPatchRec->patch.pTempInfo = (PPATCHINFOTEMP)MMR3HeapAllocZ(pVM, MM_TAG_PATM_PATCH, sizeof(PATCHINFOTEMP));
1033 patmr3DisasmCodeStream(pVM, PATCHCODE_PTR_GC(&pPatchRec->patch), PATCHCODE_PTR_GC(&pPatchRec->patch), patmr3DisasmCallback, &pPatchRec->patch);
1035 MMR3HeapFree(pPatchRec->patch.pTempInfo);
1036 pPatchRec->patch.pTempInfo = NULL;
1041 && pPatchRec->patch.uState == PATCH_ENABLED)
1043 Log(("Remove patch %RGv due to failed HC address translation\n", pPatchRec->patch.pPrivInstrGC));
1044 PATMR3RemovePatch(pVM, pPatchRec->patch.pPrivInstrGC);