Changeset 31437 in vbox
- Timestamp:
- Aug 6, 2010 12:01:55 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 64503
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PATM/PATM.cpp
r31064 r31437 138 138 * 139 139 */ 140 Assert(sizeof(PATMGCSTATE) < PAGE_SIZE); /* * @notehardcoded dependencies on this exist. */140 Assert(sizeof(PATMGCSTATE) < PAGE_SIZE); /* Note: hardcoded dependencies on this exist. */ 141 141 pVM->patm.s.pGCStateHC = (PPATMGCSTATE)((uint8_t *)pVM->patm.s.pGCStackHC + PATM_STACK_TOTAL_SIZE); 142 142 pVM->patm.s.pGCStateGC = MMHyperR3ToRC(pVM, pVM->patm.s.pGCStateHC); … … 1577 1577 return rc; 1578 1578 1579 /* * @noteNever do a direct return unless a failure is encountered! */1579 /* Note: Never do a direct return unless a failure is encountered! */ 1580 1580 1581 1581 /* Clear recompilation of next instruction flag; we are doing that right here. */ … … 1888 1888 1889 1889 case OP_MOV_DR: 1890 /* * @note: currently we let DRx writes cause a trap d; our trap handler will decide to interpret it or not. */1890 /* Note: currently we let DRx writes cause a trap d; our trap handler will decide to interpret it or not. */ 1891 1891 if (pCpu->pCurInstr->param2 == OP_PARM_Dd) 1892 1892 { … … 1899 1899 1900 1900 case OP_MOV_CR: 1901 /* * @note: currently we let CRx writes cause a trap d; our trap handler will decide to interpret it or not. */1901 /* Note: currently we let CRx writes cause a trap d; our trap handler will decide to interpret it or not. */ 1902 1902 if (pCpu->pCurInstr->param2 == OP_PARM_Cd) 1903 1903 { … … 2345 2345 } 2346 2346 2347 /* * @noteafter a cli we must continue to a proper exit point */2347 /* Note: after a cli we must continue to a proper exit point */ 2348 2348 if (cpunext.pCurInstr->opcode != OP_CLI) 2349 2349 { … … 2668 2668 case OP_PUSHF: 2669 2669 /* We can 'call' a cli or pushf patch. It will either return to the original guest code when IF is set again, or fault. */ 2670 /* * @notespecial precautions are taken when disabling and enabling such patches. */2670 /* Note: special precautions are taken when disabling and enabling such patches. */ 2671 2671 pPatch->flags |= PATMFL_CALLABLE_AS_FUNCTION; 2672 2672 break; … … 2717 2717 2718 2718 /***************************************************************************************************************************/ 2719 /* * @note We can't insert *any* code before a sysenter handler; some linux guests have an invalid stack at this point!!!!!*/2719 /* Note: We can't insert *any* code before a sysenter handler; some linux guests have an invalid stack at this point!!!!! */ 2720 2720 /***************************************************************************************************************************/ 2721 2721 #ifdef VBOX_WITH_STATISTICS … … 3152 3152 cpu.mode = (pPatch->flags & PATMFL_CODE32) ? CPUMODE_32BIT : CPUMODE_16BIT; 3153 3153 3154 /* * @noteSet the PATM interrupt flag here; it was cleared before the patched call. (!!!) */3154 /* Note: Set the PATM interrupt flag here; it was cleared before the patched call. (!!!) */ 3155 3155 rc = patmPatchGenSetPIF(pVM, pPatch, pInstrGC); 3156 3156 if (RT_FAILURE(rc)) … … 3303 3303 pPatch->uCurPatchOffset = 0; 3304 3304 3305 /* * @noteSet the PATM interrupt flag here; it was cleared before the patched call. (!!!) */3305 /* Note: Set the PATM interrupt flag here; it was cleared before the patched call. (!!!) */ 3306 3306 rc = patmPatchGenSetPIF(pVM, pPatch, pInstrGC); 3307 3307 if (RT_FAILURE(rc)) … … 3775 3775 int rc; 3776 3776 3777 /* * @noteDo not use patch memory here! It might called during patch installation too. */3777 /* Note: Do not use patch memory here! It might called during patch installation too. */ 3778 3778 3779 3779 #ifdef LOG_ENABLED … … 4029 4029 } 4030 4030 4031 /* * @notethe OpenBSD specific check will break if we allow additional patches to be installed (int 3)) */4031 /* Note: the OpenBSD specific check will break if we allow additional patches to be installed (int 3)) */ 4032 4032 if (!(flags & PATMFL_GUEST_SPECIFIC)) 4033 4033 { … … 4036 4036 } 4037 4037 4038 /* * @noteobsolete */4038 /* Note: obsolete */ 4039 4039 if ( PATMIsPatchGCAddr(pVM, pInstrGC) 4040 4040 && (flags & PATMFL_MMIO_ACCESS)) … … 4773 4773 int rc = PATMR3RemovePatch(pVM, pPatch->pPrivInstrGC); 4774 4774 if (rc == VINF_SUCCESS) 4775 /* * @notejump back to the start as the pPatchPage has been deleted or changed */4775 /* Note: jump back to the start as the pPatchPage has been deleted or changed */ 4776 4776 goto loop_start; 4777 4777 … … 4815 4815 PATMR3MarkDirtyPatch(pVM, pPatch); 4816 4816 4817 /* * @notejump back to the start as the pPatchPage has been deleted or changed */4817 /* Note: jump back to the start as the pPatchPage has been deleted or changed */ 4818 4818 goto loop_start; 4819 4819 } … … 4854 4854 if (pPatch->cInvalidWrites > PATM_MAX_INVALID_WRITES) 4855 4855 { 4856 /* * @notepossibly dangerous assumption that all future writes will be harmless. */4856 /* Note: possibly dangerous assumption that all future writes will be harmless. */ 4857 4857 if (pPatch->flags & PATMFL_IDTHANDLER) 4858 4858 { … … 4868 4868 PATMR3MarkDirtyPatch(pVM, pPatch); 4869 4869 } 4870 /* * @notejump back to the start as the pPatchPage has been deleted or changed */4870 /* Note: jump back to the start as the pPatchPage has been deleted or changed */ 4871 4871 goto invalid_write_loop_start; 4872 4872 } … … 5002 5002 5003 5003 /* Clear the IDT entries for the patch we're disabling. */ 5004 /* * @notevery important as we clear IF in the patch itself */5004 /* Note: very important as we clear IF in the patch itself */ 5005 5005 /** @todo this needs to be changed */ 5006 5006 if (pPatch->flags & PATMFL_IDTHANDLER) … … 5363 5363 Log(("PATMRemovePatch %RRv\n", pPatch->pPrivInstrGC)); 5364 5364 5365 /* * @noteNEVER EVER REUSE PATCH MEMORY */5366 /* * @notePATMR3DisablePatch puts a breakpoint (0xCC) at the entry of this patch */5365 /* Note: NEVER EVER REUSE PATCH MEMORY */ 5366 /* Note: PATMR3DisablePatch puts a breakpoint (0xCC) at the entry of this patch */ 5367 5367 5368 5368 if (pPatchRec->patch.pPatchBlockOffset) … … 5403 5403 #endif 5404 5404 5405 /* * @noteno need to free Guest2PatchAddrTree as those records share memory with Patch2GuestAddrTree records. */5405 /* Note: no need to free Guest2PatchAddrTree as those records share memory with Patch2GuestAddrTree records. */ 5406 5406 patmEmptyTreeU32(pVM, &pPatch->Patch2GuestAddrTree); 5407 5407 pPatch->nrPatch2GuestRecs = 0; … … 5415 5415 MMR3HeapFree(pPatchRec->patch.pTempInfo); 5416 5416 5417 /* * @notemight fail, because it has already been removed (e.g. during reset). */5417 /* Note: might fail, because it has already been removed (e.g. during reset). */ 5418 5418 RTAvloU32Remove(&pVM->patm.s.PatchLookupTreeHC->PatchTree, pPatchRec->Core.Key); 5419 5419 … … 5657 5657 return VINF_SUCCESS; 5658 5658 5659 /* * @notewe don't restore patch pages for patches that are not enabled! */5660 /* * @notebe careful when changing this behaviour!! */5659 /* Note: we don't restore patch pages for patches that are not enabled! */ 5660 /* Note: be careful when changing this behaviour!! */ 5661 5661 5662 5662 /* The patch pages are no longer marked for self-modifying code detection */ … … 5852 5852 uint32_t cbDirty; 5853 5853 PRECPATCHTOGUEST pRec; 5854 RTRCPTR const pOrgInstrGC = pPatchToGuestRec->pOrgInstrGC; 5854 5855 PVMCPU pVCpu = VMMGetCpu0(pVM); 5855 5856 Log(("patmR3HandleDirtyInstr: dirty instruction at %RRv (%RRv)\n", pEip, pPatchToGuestRec->pOrgInstrGC)); 5856 Log(("patmR3HandleDirtyInstr: dirty instruction at %RRv (%RRv)\n", pEip, pOrgInstrGC)); 5857 5857 5858 5858 pRec = pPatchToGuestRec; 5859 pCurInstrGC = p PatchToGuestRec->pOrgInstrGC;5859 pCurInstrGC = pOrgInstrGC; 5860 5860 pCurPatchInstrGC = pEip; 5861 5861 cbDirty = 0; … … 5867 5867 if (pRec->fJumpTarget) 5868 5868 { 5869 LogRel(("PATM: patmR3HandleDirtyInstr: dirty instruction at %RRv (%RRv) ignored, because instruction in function was reused as target of jump\n", pEip, p PatchToGuestRec->pOrgInstrGC));5869 LogRel(("PATM: patmR3HandleDirtyInstr: dirty instruction at %RRv (%RRv) ignored, because instruction in function was reused as target of jump\n", pEip, pOrgInstrGC)); 5870 5870 pRec->fDirty = false; 5871 5871 return VERR_PATCHING_REFUSED; … … 5898 5898 pRec->fDirty = false; 5899 5899 5900 /* *Remove old lookup record. */5900 /* Remove old lookup record. */ 5901 5901 patmr3RemoveP2GLookupRecord(pVM, &pPatch->patch, pCurPatchInstrGC); 5902 pCurPatchInstrGC = NULL; 5902 5903 5903 5904 pCurPatchInstrGC += CpuOld.opsize; … … 5936 5937 RTRCPTR pTargetGC = PATMResolveBranch(&CpuNew, pCurInstrGC); 5937 5938 5938 if ( pTargetGC >= p PatchToGuestRec->pOrgInstrGC5939 && pTargetGC <= p PatchToGuestRec->pOrgInstrGC + cbDirty5939 if ( pTargetGC >= pOrgInstrGC 5940 && pTargetGC <= pOrgInstrGC + cbDirty 5940 5941 ) 5941 5942 { … … 6087 6088 6088 6089 /* Find the patch record. */ 6089 /* * @notethere might not be a patch to guest translation record (global function) */6090 /* Note: there might not be a patch to guest translation record (global function) */ 6090 6091 offset = pEip - pVM->patm.s.pPatchMemGC; 6091 6092 pvPatchCoreOffset = RTAvloU32GetBestFit(&pVM->patm.s.PatchLookupTreeHC->PatchTreeByPatchAddr, offset, false);
Note:
See TracChangeset
for help on using the changeset viewer.