Changeset 13144 in vbox for trunk/src/VBox/VMM/PATM
- Timestamp:
- Oct 9, 2008 10:44:11 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 37653
- Location:
- trunk/src/VBox/VMM/PATM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PATM/CSAM.cpp
r12989 r13144 630 630 if (PAGE_ADDRESS(pInstrGC) != PAGE_ADDRESS(pSrc + size - 1) && !PATMIsPatchGCAddr(pVM, pSrc)) 631 631 { 632 return PGMPhys ReadGCPtr(pVM, pDest, pSrc, size);632 return PGMPhysSimpleReadGCPtr(pVM, pDest, pSrc, size); 633 633 } 634 634 else … … 1206 1206 { 1207 1207 addr = 0; 1208 PGMPhys ReadGCPtr(pVM, &addr, (RTRCUINTPTR)cpu.param1.disp32, sizeof(addr));1208 PGMPhysSimpleReadGCPtr(pVM, &addr, (RTRCUINTPTR)cpu.param1.disp32, sizeof(addr)); 1209 1209 } 1210 1210 else … … 1357 1357 Assert((pInstr & PAGE_OFFSET_MASK) == 0); 1358 1358 1359 rc = PGMPhys ReadGCPtr(pVM, &val[0], pInstr, sizeof(val[0]));1359 rc = PGMPhysSimpleReadGCPtr(pVM, &val[0], pInstr, sizeof(val[0])); 1360 1360 AssertMsg(VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT, ("rc = %Vrc\n", rc)); 1361 1361 if (rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT) … … 1365 1365 } 1366 1366 1367 rc = PGMPhys ReadGCPtr(pVM, &val[1], pInstr+1024, sizeof(val[0]));1367 rc = PGMPhysSimpleReadGCPtr(pVM, &val[1], pInstr+1024, sizeof(val[0])); 1368 1368 AssertMsg(VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT, ("rc = %Vrc\n", rc)); 1369 1369 if (rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT) … … 1373 1373 } 1374 1374 1375 rc = PGMPhys ReadGCPtr(pVM, &val[2], pInstr+2048, sizeof(val[0]));1375 rc = PGMPhysSimpleReadGCPtr(pVM, &val[2], pInstr+2048, sizeof(val[0])); 1376 1376 AssertMsg(VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT, ("rc = %Vrc\n", rc)); 1377 1377 if (rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT) … … 1381 1381 } 1382 1382 1383 rc = PGMPhys ReadGCPtr(pVM, &val[3], pInstr+3072, sizeof(val[0]));1383 rc = PGMPhysSimpleReadGCPtr(pVM, &val[3], pInstr+3072, sizeof(val[0])); 1384 1384 AssertMsg(VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT, ("rc = %Vrc\n", rc)); 1385 1385 if (rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT) … … 1389 1389 } 1390 1390 1391 rc = PGMPhys ReadGCPtr(pVM, &val[4], pInstr+4092, sizeof(val[0]));1391 rc = PGMPhysSimpleReadGCPtr(pVM, &val[4], pInstr+4092, sizeof(val[0])); 1392 1392 AssertMsg(VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT, ("rc = %Vrc\n", rc)); 1393 1393 if (rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT) … … 2340 2340 { 2341 2341 /* Slow method when it crosses a page boundary. */ 2342 rc = PGMPhys ReadGCPtr(pVM, aIDT, GCPtrIDT, cGates*sizeof(VBOXIDTE));2342 rc = PGMPhysSimpleReadGCPtr(pVM, aIDT, GCPtrIDT, cGates*sizeof(VBOXIDTE)); 2343 2343 if (VBOX_FAILURE(rc)) 2344 2344 { -
trunk/src/VBox/VMM/PATM/PATM.cpp
r12989 r13144 560 560 if (PAGE_ADDRESS(pDisInfo->pInstrGC) != PAGE_ADDRESS(pSrc + size - 1) && !PATMIsPatchGCAddr(pDisInfo->pVM, pSrc)) 561 561 { 562 return PGMPhys ReadGCPtr(pDisInfo->pVM, pDest, pSrc, size);562 return PGMPhysSimpleReadGCPtr(pDisInfo->pVM, pDest, pSrc, size); 563 563 } 564 564 else … … 654 654 *(RTRCPTR *)&oldInstr[pPatch->patch.cbPrivInstr - sizeof(RTRCPTR)] = pRec->pDest; 655 655 656 rc = PGMPhys ReadGCPtr(pVM, curInstr, pPatch->patch.pPrivInstrGC, pPatch->patch.cbPrivInstr);656 rc = PGMPhysSimpleReadGCPtr(pVM, curInstr, pPatch->patch.pPrivInstrGC, pPatch->patch.cbPrivInstr); 657 657 Assert(VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT); 658 658 … … 681 681 { 682 682 *(RTRCPTR *)&curInstr[pPatch->patch.cbPrivInstr - sizeof(RTRCPTR)] = pRec->pDest; 683 rc = PGMPhys WriteGCPtrDirty(pVM, pRec->pSource, curInstr, pPatch->patch.cbPrivInstr);683 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pRec->pSource, curInstr, pPatch->patch.cbPrivInstr); 684 684 AssertRC(rc); 685 685 } … … 731 731 * Read old patch jump and compare it to the one we previously installed 732 732 */ 733 rc = PGMPhys ReadGCPtr(pVM, temp, pPatch->patch.pPrivInstrGC, pPatch->patch.cbPatchJump);733 rc = PGMPhysSimpleReadGCPtr(pVM, temp, pPatch->patch.pPrivInstrGC, pPatch->patch.cbPatchJump); 734 734 Assert(VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT); 735 735 … … 754 754 if (VBOX_SUCCESS(rc)) 755 755 { 756 rc = PGMPhys WriteGCPtrDirty(pVM, pJumpOffGC, &displ, sizeof(displ));756 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pJumpOffGC, &displ, sizeof(displ)); 757 757 AssertRC(rc); 758 758 } … … 2532 2532 *(uint32_t *)&temp[1] = (RTRCUINTPTR)PATCHCODE_PTR_GC(pPatch) - ((RTRCUINTPTR)pPatch->pPrivInstrGC + SIZEOF_NEARJUMP32); //return address 2533 2533 } 2534 rc = PGMPhys WriteGCPtrDirty(pVM, pPatch->pPrivInstrGC, temp, pPatch->cbPatchJump);2534 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pPatch->pPrivInstrGC, temp, pPatch->cbPatchJump); 2535 2535 AssertRC(rc); 2536 2536 … … 2570 2570 2571 2571 /* Restore original code (privileged instruction + following instructions that were overwritten because of the 5/6 byte jmp). */ 2572 int rc = PGMPhys WriteGCPtrDirty(pVM, pPatch->pPrivInstrGC, pPatch->aPrivInstr, pPatch->cbPatchJump);2572 int rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pPatch->pPrivInstrGC, pPatch->aPrivInstr, pPatch->cbPatchJump); 2573 2573 #ifdef DEBUG 2574 2574 if (rc == VINF_SUCCESS) … … 2629 2629 *(uint32_t *)&temp[1] = (uint32_t)pTargetGC - ((uint32_t)pPatch->pPrivInstrGC + SIZEOF_NEARJUMP32); //return address 2630 2630 2631 rc = PGMPhys WriteGCPtrDirty(pVM, pPatch->pPrivInstrGC, temp, pPatch->cbPatchJump);2631 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pPatch->pPrivInstrGC, temp, pPatch->cbPatchJump); 2632 2632 AssertRC(rc); 2633 2633 … … 2795 2795 pPatch->cbPatchJump = SIZEOF_NEARJUMP32; 2796 2796 2797 rc = PGMPhys ReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPatchJump);2797 rc = PGMPhysSimpleReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 2798 2798 AssertRC(rc); 2799 2799 … … 3527 3527 pPatch->cbPatchJump = SIZEOF_NEARJUMP32; 3528 3528 3529 rc = PGMPhys ReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPatchJump);3529 rc = PGMPhysSimpleReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 3530 3530 AssertRC(rc); 3531 3531 … … 3603 3603 3604 3604 /* Save original instruction. */ 3605 rc = PGMPhys ReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPrivInstr);3605 rc = PGMPhysSimpleReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPrivInstr); 3606 3606 AssertRC(rc); 3607 3607 … … 3609 3609 3610 3610 /* Replace address with that of the cached item. */ 3611 rc = PGMPhys WriteGCPtrDirty(pVM, pInstrGC + pCpu->opsize - sizeof(RTRCPTR), &pVM->patm.s.mmio.pCachedData, sizeof(RTRCPTR));3611 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pInstrGC + pCpu->opsize - sizeof(RTRCPTR), &pVM->patm.s.mmio.pCachedData, sizeof(RTRCPTR)); 3612 3612 AssertRC(rc); 3613 3613 if (VBOX_FAILURE(rc)) … … 3716 3716 3717 3717 /* Replace first opcode byte with 'int 3'. */ 3718 rc = PGMPhys WriteGCPtrDirty(pVM, pPatch->pPrivInstrGC, &ASMInt3, sizeof(ASMInt3));3718 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pPatch->pPrivInstrGC, &ASMInt3, sizeof(ASMInt3)); 3719 3719 AssertRC(rc); 3720 3720 … … 3740 3740 3741 3741 /* Restore first opcode byte. */ 3742 rc = PGMPhys WriteGCPtrDirty(pVM, pPatch->pPrivInstrGC, pPatch->aPrivInstr, sizeof(ASMInt3));3742 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pPatch->pPrivInstrGC, pPatch->aPrivInstr, sizeof(ASMInt3)); 3743 3743 AssertRC(rc); 3744 3744 return rc; … … 3776 3776 3777 3777 /* Save the original instruction. */ 3778 rc = PGMPhys ReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPrivInstr);3778 rc = PGMPhysSimpleReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPrivInstr); 3779 3779 AssertRC(rc); 3780 3780 pPatch->cbPatchJump = sizeof(ASMInt3); /* bit of a misnomer in this case; size of replacement instruction. */ … … 3880 3880 pPatch->cbPatchJump = pCpu->opsize; 3881 3881 3882 rc = PGMPhys ReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPatchJump);3882 rc = PGMPhysSimpleReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 3883 3883 AssertRC(rc); 3884 3884 … … 5010 5010 5011 5011 /* Let's first check if the guest code is still the same. */ 5012 rc = PGMPhys ReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump);5012 rc = PGMPhysSimpleReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 5013 5013 Assert(rc == VINF_SUCCESS || rc == VERR_PAGE_TABLE_NOT_PRESENT || rc == VERR_PAGE_NOT_PRESENT); 5014 5014 if (rc == VINF_SUCCESS) … … 5052 5052 5053 5053 /* Let's first check if the guest code is still the same. */ 5054 rc = PGMPhys ReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump);5054 rc = PGMPhysSimpleReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 5055 5055 Assert(rc == VINF_SUCCESS || rc == VERR_PAGE_TABLE_NOT_PRESENT || rc == VERR_PAGE_NOT_PRESENT); 5056 5056 if (rc == VINF_SUCCESS) … … 5234 5234 5235 5235 // let's first check if the guest code is still the same 5236 int rc = PGMPhys ReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump);5236 int rc = PGMPhysSimpleReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 5237 5237 AssertRC(rc); 5238 5238 … … 5273 5273 5274 5274 /* Let's first check if the guest code is still the same. */ 5275 int rc = PGMPhys ReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump);5275 int rc = PGMPhysSimpleReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 5276 5276 AssertRC(rc); 5277 5277 … … 5919 5919 5920 5920 /* Copy the new instruction. */ 5921 rc = PGMPhys ReadGCPtr(pVM, pCurPatchInstrHC, pCurInstrGC, CpuNew.opsize);5921 rc = PGMPhysSimpleReadGCPtr(pVM, pCurPatchInstrHC, pCurInstrGC, CpuNew.opsize); 5922 5922 AssertRC(rc); 5923 5923 … … 6188 6188 AssertRC(rc); 6189 6189 6190 rc = PGMPhys ReadGCPtr(pVM, &retaddr, pCtx->esp, sizeof(retaddr));6190 rc = PGMPhysSimpleReadGCPtr(pVM, &retaddr, pCtx->esp, sizeof(retaddr)); 6191 6191 AssertRC(rc); 6192 6192 -
trunk/src/VBox/VMM/PATM/PATMGuest.cpp
r9220 r13144 111 111 /* check the epilog of KiFastSystemCall */ 112 112 lpfnKiFastSystemCall = pInstrGC - 2; 113 rc = PGMPhys ReadGCPtr(pVM, uTemp, lpfnKiFastSystemCall, sizeof(uFnKiFastSystemCall));113 rc = PGMPhysSimpleReadGCPtr(pVM, uTemp, lpfnKiFastSystemCall, sizeof(uFnKiFastSystemCall)); 114 114 if ( VBOX_FAILURE(rc) 115 115 || memcmp(uFnKiFastSystemCall, uTemp, sizeof(uFnKiFastSystemCall))) … … 121 121 for (i=0;i<64;i++) 122 122 { 123 rc = PGMPhys ReadGCPtr(pVM, uTemp, pInstrGC + i, sizeof(uFnKiIntSystemCall));123 rc = PGMPhysSimpleReadGCPtr(pVM, uTemp, pInstrGC + i, sizeof(uFnKiIntSystemCall)); 124 124 if(VBOX_FAILURE(rc)) 125 125 { … … 146 146 147 147 // make a copy of the guest code bytes that will be overwritten 148 rc = PGMPhys ReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, SIZEOF_NEARJUMP32);148 rc = PGMPhysSimpleReadGCPtr(pVM, pPatch->aPrivInstr, pPatch->pPrivInstrGC, SIZEOF_NEARJUMP32); 149 149 AssertRC(rc); 150 150 … … 152 152 uTemp[0] = 0xE9; 153 153 *(RTGCPTR32 *)&uTemp[1] = lpfnKiIntSystemCall - (pInstrGC + SIZEOF_NEARJUMP32); 154 rc = PGMPhys WriteGCPtrDirty(pVM, pInstrGC, uTemp, SIZEOF_NEARJUMP32);154 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pInstrGC, uTemp, SIZEOF_NEARJUMP32); 155 155 if (VBOX_FAILURE(rc)) 156 156 { … … 189 189 /* Guest OS specific patch; check heuristics first */ 190 190 191 rc = PGMPhys ReadGCPtr(pVM, uTemp, pInstrGC, RT_MAX(sizeof(uFnOpenBSDHandlerPrefix1), sizeof(uFnOpenBSDHandlerPrefix2)));192 if ( VBOX_FAILURE(rc) 191 rc = PGMPhysSimpleReadGCPtr(pVM, uTemp, pInstrGC, RT_MAX(sizeof(uFnOpenBSDHandlerPrefix1), sizeof(uFnOpenBSDHandlerPrefix2))); 192 if ( VBOX_FAILURE(rc) 193 193 || ( memcmp(uFnOpenBSDHandlerPrefix1, uTemp, sizeof(uFnOpenBSDHandlerPrefix1)) 194 194 && memcmp(uFnOpenBSDHandlerPrefix2, uTemp, sizeof(uFnOpenBSDHandlerPrefix2)))) -
trunk/src/VBox/VMM/PATM/PATMPatch.cpp
r12600 r13144 404 404 static int patmPatchReadBytes(PVM pVM, uint8_t *pDest, RTRCPTR pSrc, uint32_t cb) 405 405 { 406 int rc = PGMPhys ReadGCPtr(pVM, pDest, pSrc, cb);406 int rc = PGMPhysSimpleReadGCPtr(pVM, pDest, pSrc, cb); 407 407 AssertRCReturn(rc, rc); 408 408 /* -
trunk/src/VBox/VMM/PATM/PATMSSM.cpp
r12600 r13144 360 360 rc = SSMR3GetS32(pSSM, &patmInfo.uCurrentPatchIdx); 361 361 AssertRCReturn(rc, rc); 362 362 363 363 AssertCompile(sizeof(patmInfo.pPatchedInstrGCLowest) == sizeof(RTRCPTR)); 364 364 rc = SSMR3GetRCPtr(pSSM, &patmInfo.pPatchedInstrGCLowest); … … 400 400 rc = SSMR3GetU32(pSSM, &patmInfo.savedstate.cPatches); 401 401 AssertRCReturn(rc, rc); 402 402 403 403 } 404 404 #endif … … 440 440 Log(("pGCStackGC %VRv vs old %VRv\n", pVM->patm.s.pGCStackGC, patmInfo.pGCStackGC)); 441 441 Log(("pCPUMCtxGC %VRv vs old %VRv\n", pVM->patm.s.pCPUMCtxGC, patmInfo.pCPUMCtxGC)); 442 442 443 443 444 444 /** @note patch statistics are not restored. */ … … 670 670 /* 671 671 * Correct absolute fixups in the global patch. (helper functions) 672 * Bit of a mess. Uses the new patch record, but restored patch functions. 672 * Bit of a mess. Uses the new patch record, but restored patch functions. 673 673 */ 674 674 PRELOCREC pRec = 0; … … 731 731 break; 732 732 733 if ( *pFixup >= patmInfo.pGCStateGC 733 if ( *pFixup >= patmInfo.pGCStateGC 734 734 && *pFixup < patmInfo.pGCStateGC + sizeof(PATMGCSTATE)) 735 735 { … … 738 738 } 739 739 else 740 if ( *pFixup >= patmInfo.pCPUMCtxGC 740 if ( *pFixup >= patmInfo.pCPUMCtxGC 741 741 && *pFixup < patmInfo.pCPUMCtxGC + sizeof(CPUMCTX)) 742 742 { … … 848 848 } 849 849 else 850 if ( *pFixup >= patmInfo.pStatsGC 850 if ( *pFixup >= patmInfo.pStatsGC 851 851 && *pFixup < patmInfo.pStatsGC + PATM_STAT_MEMSIZE) 852 852 { … … 855 855 } 856 856 else 857 if ( *pFixup >= patmInfo.pGCStackGC 857 if ( *pFixup >= patmInfo.pGCStackGC 858 858 && *pFixup < patmInfo.pGCStackGC + PATM_STACK_TOTAL_SIZE) 859 859 { … … 862 862 } 863 863 else 864 if ( *pFixup >= patmInfo.pPatchMemGC 864 if ( *pFixup >= patmInfo.pPatchMemGC 865 865 && *pFixup < patmInfo.pPatchMemGC + patmInfo.cbPatchMem) 866 866 { … … 956 956 * Read old patch jump and compare it to the one we previously installed 957 957 */ 958 int rc = PGMPhys ReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump);958 int rc = PGMPhysSimpleReadGCPtr(pVM, temp, pPatch->pPrivInstrGC, pPatch->cbPatchJump); 959 959 Assert(VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT); 960 960 … … 979 979 if (VBOX_SUCCESS(rc)) 980 980 { 981 rc = PGMPhys WriteGCPtrDirty(pVM, pJumpOffGC, &displ, sizeof(displ));981 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pJumpOffGC, &displ, sizeof(displ)); 982 982 AssertRC(rc); 983 983 } … … 1006 1006 pRec->pSource = pSource; 1007 1007 break; 1008 1008 1009 1009 } 1010 1010 }
Note:
See TracChangeset
for help on using the changeset viewer.