Lines Matching defs:pPatch
145 static int patmCorrectFixup(PVM pVM, unsigned ulSSMVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec,
578 * @param pPatch The memory record.
581 static void patmR3PatchConvertSSM2Mem(PPATMPATCHREC pPatch, PPATMPATCHRECSSM pPatchSSM)
586 pPatch->Core.Key = pPatchSSM->Core.Key;
587 pPatch->CoreOffset.Key = pPatchSSM->CoreOffset.Key;
588 pPatch->patch.uState = pPatchSSM->patch.uState;
589 pPatch->patch.uOldState = pPatchSSM->patch.uOldState;
590 pPatch->patch.uOpMode = pPatchSSM->patch.uOpMode;
591 pPatch->patch.pPrivInstrGC = pPatchSSM->patch.pPrivInstrGC;
592 pPatch->patch.unusedHC = pPatchSSM->patch.unusedHC;
593 memcpy(&pPatch->patch.aPrivInstr[0], &pPatchSSM->patch.aPrivInstr[0], MAX_INSTR_SIZE);
594 pPatch->patch.cbPrivInstr = pPatchSSM->patch.cbPrivInstr;
595 pPatch->patch.opcode = pPatchSSM->patch.opcode;
596 pPatch->patch.cbPatchJump = pPatchSSM->patch.cbPatchJump;
597 pPatch->patch.pPatchJumpDestGC = pPatchSSM->patch.pPatchJumpDestGC;
598 pPatch->patch.pPatchBlockOffset = pPatchSSM->patch.pPatchBlockOffset;
599 pPatch->patch.cbPatchBlockSize = pPatchSSM->patch.cbPatchBlockSize;
600 pPatch->patch.uCurPatchOffset = pPatchSSM->patch.uCurPatchOffset;
601 pPatch->patch.flags = pPatchSSM->patch.flags;
602 pPatch->patch.pInstrGCLowest = pPatchSSM->patch.pInstrGCLowest;
603 pPatch->patch.pInstrGCHighest = pPatchSSM->patch.pInstrGCHighest;
604 pPatch->patch.FixupTree = pPatchSSM->patch.FixupTree;
605 pPatch->patch.nrFixups = pPatchSSM->patch.nrFixups;
606 pPatch->patch.nrJumpRecs = pPatchSSM->patch.nrJumpRecs;
607 pPatch->patch.JumpTree = pPatchSSM->patch.JumpTree;
608 pPatch->patch.Patch2GuestAddrTree = pPatchSSM->patch.Patch2GuestAddrTree;
609 pPatch->patch.Guest2PatchAddrTree = pPatchSSM->patch.Guest2PatchAddrTree;
610 pPatch->patch.nrPatch2GuestRecs = pPatchSSM->patch.nrPatch2GuestRecs;
611 pPatch->patch.unused = pPatchSSM->patch.unused;
612 pPatch->patch.pTempInfo = pPatchSSM->patch.pTempInfo;
613 pPatch->patch.cCodeWrites = pPatchSSM->patch.cCodeWrites;
614 pPatch->patch.cTraps = pPatchSSM->patch.cTraps;
615 pPatch->patch.cInvalidWrites = pPatchSSM->patch.cInvalidWrites;
616 pPatch->patch.uPatchIdx = pPatchSSM->patch.uPatchIdx;
617 pPatch->patch.bDirtyOpcode = pPatchSSM->patch.bDirtyOpcode;
618 pPatch->patch.pTrampolinePatchesHead = NULL;
626 * @param pPatch The memory version to save.
628 static void patmR3PatchConvertMem2SSM(PPATMPATCHRECSSM pPatchSSM, PPATMPATCHREC pPatch)
630 pPatchSSM->Core = pPatch->Core;
631 pPatchSSM->CoreOffset = pPatch->CoreOffset;
632 pPatchSSM->patch.uState = pPatch->patch.uState;
633 pPatchSSM->patch.uOldState = pPatch->patch.uOldState;
634 pPatchSSM->patch.uOpMode = pPatch->patch.uOpMode;
635 pPatchSSM->patch.pPrivInstrGC = pPatch->patch.pPrivInstrGC;
636 pPatchSSM->patch.unusedHC = pPatch->patch.unusedHC;
637 memcpy(&pPatchSSM->patch.aPrivInstr[0], &pPatch->patch.aPrivInstr[0], MAX_INSTR_SIZE);
638 pPatchSSM->patch.cbPrivInstr = pPatch->patch.cbPrivInstr;
639 pPatchSSM->patch.opcode = pPatch->patch.opcode;
640 pPatchSSM->patch.cbPatchJump = pPatch->patch.cbPatchJump;
641 pPatchSSM->patch.pPatchJumpDestGC = pPatch->patch.pPatchJumpDestGC;
642 pPatchSSM->patch.pPatchBlockOffset = pPatch->patch.pPatchBlockOffset;
643 pPatchSSM->patch.cbPatchBlockSize = pPatch->patch.cbPatchBlockSize;
644 pPatchSSM->patch.uCurPatchOffset = pPatch->patch.uCurPatchOffset;
645 pPatchSSM->patch.flags = pPatch->patch.flags;
646 pPatchSSM->patch.pInstrGCLowest = pPatch->patch.pInstrGCLowest;
647 pPatchSSM->patch.pInstrGCHighest = pPatch->patch.pInstrGCHighest;
648 pPatchSSM->patch.FixupTree = pPatch->patch.FixupTree;
649 pPatchSSM->patch.nrFixups = pPatch->patch.nrFixups;
650 pPatchSSM->patch.nrJumpRecs = pPatch->patch.nrJumpRecs;
651 pPatchSSM->patch.JumpTree = pPatch->patch.JumpTree;
652 pPatchSSM->patch.Patch2GuestAddrTree = pPatch->patch.Patch2GuestAddrTree;
653 pPatchSSM->patch.Guest2PatchAddrTree = pPatch->patch.Guest2PatchAddrTree;
654 pPatchSSM->patch.nrPatch2GuestRecs = pPatch->patch.nrPatch2GuestRecs;
655 pPatchSSM->patch.unused = pPatch->patch.unused;
656 pPatchSSM->patch.pTempInfo = pPatch->patch.pTempInfo;
657 pPatchSSM->patch.cCodeWrites = pPatch->patch.cCodeWrites;
658 pPatchSSM->patch.cTraps = pPatch->patch.cTraps;
659 pPatchSSM->patch.cInvalidWrites = pPatch->patch.cInvalidWrites;
660 pPatchSSM->patch.uPatchIdx = pPatch->patch.uPatchIdx;
661 pPatchSSM->patch.bDirtyOpcode = pPatch->patch.bDirtyOpcode;
676 PPATMPATCHREC pPatch = (PPATMPATCHREC)pNode;
681 Assert(!(pPatch->patch.flags & PATMFL_GLOBAL_FUNCTIONS));
683 patmR3PatchConvertMem2SSM(&patch, pPatch);
693 Assert(pPatch->patch.JumpTree == 0);
694 Assert(!pPatch->patch.pTempInfo || pPatch->patch.pTempInfo->DisasmJumpTree == 0);
695 Assert(!pPatch->patch.pTempInfo || pPatch->patch.pTempInfo->IllegalInstrTree == 0);
706 RTAvlPVDoWithAll(&pPatch->patch.FixupTree, true, patmCountLeafPV, &nrFixupRecs);
707 AssertMsg(nrFixupRecs == pPatch->patch.nrFixups, ("Fixup inconsistency! counted %d vs %d\n", nrFixupRecs, pPatch->patch.nrFixups));
709 rc = RTAvlPVDoWithAll(&pPatch->patch.FixupTree, true, patmSaveFixupRecords, pVM);
714 RTAvlU32DoWithAll(&pPatch->patch.Patch2GuestAddrTree, true, patmCountLeaf, &nrLookupRecords);
715 Assert(nrLookupRecords == pPatch->patch.nrPatch2GuestRecs);
718 rc = RTAvlU32DoWithAll(&pPatch->patch.Patch2GuestAddrTree, true, patmSaveP2GLookupRecords, pVM);
943 cacheRec.pPatch = &pPatchRec->patch;
1097 * @param pPatch Patch record
1102 static int patmCorrectFixup(PVM pVM, unsigned uVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec,
1435 if ( pPatch->uState == PATCH_ENABLED
1436 && (pPatch->flags & PATMFL_PATCHED_GUEST_CODE))
1446 Assert(pRec->pSource - pPatch->cbPatchJump == pPatch->pPrivInstrGC);
1448 if (pPatch->cbPatchJump == SIZEOF_NEAR_COND_JUMP32)
1450 Assert(pPatch->flags & PATMFL_JUMP_CONFLICT);
1452 pJumpOffGC = pPatch->pPrivInstrGC + 2; //two byte opcode
1453 oldJump[0] = pPatch->aPrivInstr[0];
1454 oldJump[1] = pPatch->aPrivInstr[1];
1459 if (pPatch->cbPatchJump == SIZEOF_NEARJUMP32)
1461 pJumpOffGC = pPatch->pPrivInstrGC + 1; //one byte opcode
1467 AssertMsgFailed(("Invalid patch jump size %d\n", pPatch->cbPatchJump));
1470 Assert(pPatch->cbPatchJump <= sizeof(temp));
1475 int rc = PGMPhysSimpleReadGCPtr(VMMGetCpu0(pVM), temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump);
1480 RTRCPTR pPage = pPatch->pPrivInstrGC & PAGE_BASE_GC_MASK;
1486 if (memcmp(temp, oldJump, pPatch->cbPatchJump))
1493 pPatch->uState = PATCH_DISABLED;
1516 Assert(!(pPatch->flags & PATMFL_GLOBAL_FUNCTIONS));