Changeset 25777 in vbox
- Timestamp:
- Jan 12, 2010 4:53:18 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56535
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PATM/PATM.cpp
r25647 r25777 186 186 * Debugger commands. 187 187 */ 188 static bool fRegisteredCmds = false;189 if (! fRegisteredCmds)190 { 191 int rc = DBGCRegisterCommands(&g_aCmds[0], RT_ELEMENTS(g_aCmds));192 if (RT_SUCCESS(rc ))193 fRegisteredCmds = true;188 static bool s_fRegisteredCmds = false; 189 if (!s_fRegisteredCmds) 190 { 191 int rc2 = DBGCRegisterCommands(&g_aCmds[0], RT_ELEMENTS(g_aCmds)); 192 if (RT_SUCCESS(rc2)) 193 s_fRegisteredCmds = true; 194 194 } 195 195 #endif … … 1703 1703 RTRCPTR pNextInstrGC = 0; /* by default no inhibit irq */ 1704 1704 1705 /* *In a sequence of instructions that inhibit irqs, only the first one actually inhibits irqs. */1705 /* In a sequence of instructions that inhibit irqs, only the first one actually inhibits irqs. */ 1706 1706 if (!(pPatch->flags & PATMFL_INHIBIT_IRQS)) 1707 1707 { … … 1718 1718 unsigned opsize; 1719 1719 int disret; 1720 RCPTRTYPE(uint8_t *) p NextInstrGC, pReturnInstrGC;1720 RCPTRTYPE(uint8_t *) pReturnInstrGC; 1721 1721 R3PTRTYPE(uint8_t *) pNextInstrHC; 1722 1722 … … 2574 2574 if (rc == VINF_SUCCESS) 2575 2575 { 2576 DISCPUSTATE cpu; 2577 char szOutput[256]; 2578 uint32_t opsize, i = 0; 2579 bool disret; 2580 2576 i = 0; 2581 2577 while(i < pPatch->cbPrivInstr) 2582 2578 { … … 3267 3263 if (pPatchPage->aPatch[i]) 3268 3264 { 3269 PPATCHINFO pPatch = pPatchPage->aPatch[i];3270 3271 if ( (pPatch ->flags & PATMFL_DUPLICATE_FUNCTION)3272 && pPatch ->uState == PATCH_ENABLED)3265 PPATCHINFO pPatch2 = pPatchPage->aPatch[i]; 3266 3267 if ( (pPatch2->flags & PATMFL_DUPLICATE_FUNCTION) 3268 && pPatch2->uState == PATCH_ENABLED) 3273 3269 { 3274 pPatchTargetGC = patmGuestGCPtrToPatchGCPtr(pVM, pPatch , pInstrGC);3270 pPatchTargetGC = patmGuestGCPtrToPatchGCPtr(pVM, pPatch2, pInstrGC); 3275 3271 if (pPatchTargetGC) 3276 3272 { 3277 3273 uint32_t offsetPatch = pPatchTargetGC - pVM->patm.s.pPatchMemGC; 3278 PRECPATCHTOGUEST pPatchToGuestRec = (PRECPATCHTOGUEST)RTAvlU32GetBestFit(&pPatch ->Patch2GuestAddrTree, offsetPatch, false);3274 PRECPATCHTOGUEST pPatchToGuestRec = (PRECPATCHTOGUEST)RTAvlU32GetBestFit(&pPatch2->Patch2GuestAddrTree, offsetPatch, false); 3279 3275 Assert(pPatchToGuestRec); 3280 3276 3281 3277 pPatchToGuestRec->fJumpTarget = true; 3282 Assert(pPatchTargetGC != pPatch ->pPrivInstrGC);3283 Log(("patmCreateTrampoline: generating jump to code inside patch at %RRv\n", pPatch ->pPrivInstrGC));3284 pPatch ->flags |= PATMFL_EXTERNAL_JUMP_INSIDE;3278 Assert(pPatchTargetGC != pPatch2->pPrivInstrGC); 3279 Log(("patmCreateTrampoline: generating jump to code inside patch at %RRv\n", pPatch2->pPrivInstrGC)); 3280 pPatch2->flags |= PATMFL_EXTERNAL_JUMP_INSIDE; 3285 3281 break; 3286 3282 } … … 5235 5231 5236 5232 // let's first check if the guest code is still the same 5237 int rc = PGMPhysSimpleReadGCPtr(VMMGetCpu0(pVM), temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump);5238 AssertRC(rc );5233 int rc2 = PGMPhysSimpleReadGCPtr(VMMGetCpu0(pVM), temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 5234 AssertRC(rc2); 5239 5235 5240 5236 if (memcmp(temp, pPatch->aPrivInstr, pPatch->cbPatchJump)) … … 5248 5244 } 5249 5245 5250 rc = patmGenJumpToPatch(pVM, pPatch, false);5251 AssertRC(rc );5252 if (RT_FAILURE(rc ))5253 return rc ;5246 rc2 = patmGenJumpToPatch(pVM, pPatch, false); 5247 AssertRC(rc2); 5248 if (RT_FAILURE(rc2)) 5249 return rc2; 5254 5250 5255 5251 #ifdef DEBUG … … 5274 5270 5275 5271 /* Let's first check if the guest code is still the same. */ 5276 int rc = PGMPhysSimpleReadGCPtr(VMMGetCpu0(pVM), temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump);5277 AssertRC(rc );5272 int rc2 = PGMPhysSimpleReadGCPtr(VMMGetCpu0(pVM), temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 5273 AssertRC(rc2); 5278 5274 5279 5275 if (memcmp(temp, pPatch->aPrivInstr, pPatch->cbPatchJump)) … … 5286 5282 } 5287 5283 5288 rc = patmActivateInt3Patch(pVM, pPatch);5289 if (RT_FAILURE(rc ))5290 return rc ;5284 rc2 = patmActivateInt3Patch(pVM, pPatch); 5285 if (RT_FAILURE(rc2)) 5286 return rc2; 5291 5287 } 5292 5288 … … 5631 5627 if (pPatch->flags & PATMFL_CODE_MONITORED) 5632 5628 { 5633 intrc = patmRemovePatchPages(pVM, pPatch);5629 rc = patmRemovePatchPages(pVM, pPatch); 5634 5630 AssertRCReturn(rc, rc); 5635 5631 } … … 6197 6193 { 6198 6194 RTRCPTR retaddr; 6199 PCPUMCTX pCtx ;6200 6201 pCtx = CPUMQueryGuestCtxPtr(pVCpu);6202 6203 rc = PGMPhysSimpleReadGCPtr(pVCpu, &retaddr, pCtx ->esp, sizeof(retaddr));6195 PCPUMCTX pCtx2; 6196 6197 pCtx2 = CPUMQueryGuestCtxPtr(pVCpu); 6198 6199 rc = PGMPhysSimpleReadGCPtr(pVCpu, &retaddr, pCtx2->esp, sizeof(retaddr)); 6204 6200 AssertRC(rc); 6205 6201
Note:
See TracChangeset
for help on using the changeset viewer.