Changeset 5610 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Nov 2, 2007 11:10:07 AM (17 years ago)
- Location:
- trunk/src/VBox/VMM/PATM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PATM/PATM.cpp
r5609 r5610 4692 4692 bool fValidPatchWrite = false; 4693 4693 4694 /* Quick check to see if the write is in the patched part of the page */ 4695 if ( pPatchPage->pLowestAddrGC > (RTGCPTR)((RTGCUINTPTR)GCPtr + cbWrite - 1) 4696 || pPatchPage->pHighestAddrGC < GCPtr) 4697 { 4698 break; 4699 } 4700 4694 4701 for (i=0;i<pPatchPage->cCount;i++) 4695 4702 { … … 4719 4726 } 4720 4727 4721 pPatchInstrGC = patmGuestGCPtrToPatchGCPtr(pVM, pPatch, pGuestPtrGC); 4728 /* Find the closest instruction from below; the above quick check ensured that we are indeed in patched code */ 4729 pPatchInstrGC = patmGuestGCPtrToClosestPatchGCPtr(pVM, pPatch, pGuestPtrGC); 4730 Assert(pPatchInstrGC); 4722 4731 if (pPatchInstrGC) 4723 4732 { … … 5624 5633 } 5625 5634 5635 /* Converts Guest code GC ptr to Patch code GC ptr (or nearest from below if no identical match) 5636 * 5637 * @returns corresponding GC pointer in patch block 5638 * @param pVM The VM to operate on. 5639 * @param pPatch Current patch block pointer 5640 * @param pInstrGC Guest context pointer to privileged instruction 5641 * 5642 */ 5643 RTGCPTR patmGuestGCPtrToClosestPatchGCPtr(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t*) pInstrGC) 5644 { 5645 PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pInstrGC, false); 5646 if (pGuestToPatchRec) 5647 return pVM->patm.s.pPatchMemGC + pGuestToPatchRec->PatchOffset; 5648 5649 return 0; 5650 } 5651 5626 5652 /* Converts Guest code GC ptr to Patch code GC ptr (if found) 5627 5653 * -
trunk/src/VBox/VMM/PATM/PATMInternal.h
r5605 r5610 524 524 RTGCPTR patmPatchGCPtr2GuestGCPtr(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *) pPatchGC); 525 525 RTGCPTR patmGuestGCPtrToPatchGCPtr(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t*) pInstrGC); 526 RTGCPTR patmGuestGCPtrToClosestPatchGCPtr(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t*) pInstrGC); 526 527 #endif 527 528 -
trunk/src/VBox/VMM/PATM/VMMGC/PATMGC.cpp
r5609 r5610 108 108 if (pPatchPage) 109 109 { 110 if ( pPatchPage->pLowestAddrGC <= (RTGCPTR)((RTGCUINTPTR)GCPtr + cbWrite)111 || pPatchPage->pHighestAddrGC >GCPtr)110 if ( pPatchPage->pLowestAddrGC > (RTGCPTR)((RTGCUINTPTR)GCPtr + cbWrite - 1) 111 || pPatchPage->pHighestAddrGC < GCPtr) 112 112 { 113 113 /* This part of the page was not patched; try to emulate the instruction. */
Note:
See TracChangeset
for help on using the changeset viewer.