VirtualBox

Changeset 102 in vbox


Ignore:
Timestamp:
Jan 17, 2007 2:28:45 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
17548
Message:

Guest2PatchAddrTree / RECGUESTTOPATCH: changed from PV to GCPtr AVL tree.

Location:
trunk/src/VBox/VMM/PATM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PATM/PATM.cpp

    r93 r102  
    11561156    if (enmType == PATM_LOOKUP_BOTHDIR)
    11571157    {
    1158         pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGet(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)PatchOffset); /** @todo bird: this doesn't look right. check it out later. */
     1158        pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGet(&pPatch->Guest2PatchAddrTree, pInstrGC);
    11591159        if (!pGuestToPatchRec)
    11601160        {
    11611161            pGuestToPatchRec = (PRECGUESTTOPATCH)(pPatchToGuestRec+1);
    1162             pGuestToPatchRec->Core.Key    = (AVLPVKEY)pInstrGC;
     1162            pGuestToPatchRec->Core.Key    = pInstrGC;
    11631163            pGuestToPatchRec->PatchOffset = PatchOffset;
    11641164
    1165             ret = RTAvlPVInsert(&pPatch->Guest2PatchAddrTree, &pGuestToPatchRec->Core);
     1165            ret = RTAvlGCPtrInsert(&pPatch->Guest2PatchAddrTree, &pGuestToPatchRec->Core);
    11661166            Assert(ret);
    11671167        }
     
    11811181void patmr3RemoveP2GLookupRecord(PVM pVM, PPATCHINFO pPatch, RTGCPTR pPatchInstrGC)
    11821182{
    1183     PAVLU32NODECORE  pNode;
    1184     PAVLPVNODECORE   pNode2;
    1185     PRECPATCHTOGUEST pPatchToGuestRec;
    1186     uint32_t         PatchOffset = pPatchInstrGC - pVM->patm.s.pPatchMemGC;  /* Offset in memory reserved for PATM. */
     1183    PAVLU32NODECORE     pNode;
     1184    PAVLGCPTRNODECORE   pNode2;
     1185    PRECPATCHTOGUEST    pPatchToGuestRec;
     1186    uint32_t            PatchOffset = pPatchInstrGC - pVM->patm.s.pPatchMemGC;  /* Offset in memory reserved for PATM. */
    11871187
    11881188    pPatchToGuestRec = (PRECPATCHTOGUEST)RTAvlU32Get(&pPatch->Patch2GuestAddrTree, PatchOffset);
     
    11951195
    11961196            Assert(pGuestToPatchRec->Core.Key);
    1197             pNode2 = RTAvlPVRemove(&pPatch->Guest2PatchAddrTree, pGuestToPatchRec->Core.Key);
     1197            pNode2 = RTAvlGCPtrRemove(&pPatch->Guest2PatchAddrTree, pGuestToPatchRec->Core.Key);
    11981198            Assert(pNode2);
    11991199        }
     
    44164416
    44174417    /* Get the closest guest instruction (from below) */
    4418     PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)pPage, true);
     4418    PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage, true);
    44194419    Assert(pGuestToPatchRec);
    44204420    if (pGuestToPatchRec)
     
    44324432            {
    44334433                /* Get the closest guest instruction (from above) */
    4434                 pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)(pPage-1), false);
     4434                pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage-1, false);
    44354435
    44364436                if (pGuestToPatchRec)
     
    44454445
    44464446    /* Get the closest guest instruction (from above) */
    4447     pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)(pPage+PAGE_SIZE-1), false);
     4447    pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage+PAGE_SIZE-1, false);
    44484448    Assert(pGuestToPatchRec);
    44494449    if (pGuestToPatchRec)
     
    45474547    {
    45484548        /* Get the closest guest instruction (from above) */
    4549         PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)pPage, true);
     4549        PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage, true);
    45504550        if (    pGuestToPatchRec
    45514551            &&  PAGE_ADDRESS(pGuestToPatchRec->Core.Key) == PAGE_ADDRESS(pPage)
     
    45804580    {
    45814581        /* Get the closest guest instruction (from above) */
    4582         PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)pPage, true);
     4582        PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage, true);
    45834583        if (    pGuestToPatchRec
    4584             &&  PAGE_ADDRESS(pGuestToPatchRec->Core.Key) == PAGE_ADDRESS(pPage)
     4584            &&  PAGE_ADDRESS(pGuestToPatchRec->Core.Key) == PAGE_ADDRESS(pPage) /** @todo bird: PAGE_ADDRESS is for the current context really. check out these. */
    45854585           )
    45864586        {
     
    54315431 *
    54325432 */
    5433 RTGCPTR patmGuestGCPtrToPatchGCPtr(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t*)pInstrGC)
     5433RTGCPTR patmGuestGCPtrToPatchGCPtr(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t*) pInstrGC)
    54345434{
    54355435    if (pPatch->Guest2PatchAddrTree)
    54365436    {
    5437         PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGet(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)pInstrGC);
     5437        PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGet(&pPatch->Guest2PatchAddrTree, pInstrGC);
    54385438        if (pGuestToPatchRec)
    54395439            return pVM->patm.s.pPatchMemGC + pGuestToPatchRec->PatchOffset;
  • trunk/src/VBox/VMM/PATM/PATMInternal.h

    r93 r102  
    187187{
    188188    /** The key is a GC virtual address. */
    189     AVLPVNODECORE   Core;
     189    AVLGCPTRNODECORE    Core;
    190190
    191191    /** Patch offset (relative to PATM::pPatchMemGC / PATM::pPatchMemHC). */
    192     uint32_t        PatchOffset;
     192    uint32_t            PatchOffset;
    193193} RECGUESTTOPATCH, *PRECGUESTTOPATCH;
    194194
     
    259259     */
    260260    HCPTRTYPE(PAVLU32NODECORE) Patch2GuestAddrTree;
    261     HCPTRTYPE(PAVLPVNODECORE) Guest2PatchAddrTree;
     261    HCPTRTYPE(PAVLGCPTRNODECORE) Guest2PatchAddrTree;
    262262    uint32_t                  nrPatch2GuestRecs;
    263263
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette