Index: trunk/src/VBox/VMM/PATM/PATM.cpp
===================================================================
--- trunk/src/VBox/VMM/PATM/PATM.cpp	(revision 101)
+++ trunk/src/VBox/VMM/PATM/PATM.cpp	(revision 102)
@@ -1156,12 +1156,12 @@
     if (enmType == PATM_LOOKUP_BOTHDIR)
     {
-        pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGet(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)PatchOffset); /** @todo bird: this doesn't look right. check it out later. */
+        pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGet(&pPatch->Guest2PatchAddrTree, pInstrGC);
         if (!pGuestToPatchRec)
         {
             pGuestToPatchRec = (PRECGUESTTOPATCH)(pPatchToGuestRec+1);
-            pGuestToPatchRec->Core.Key    = (AVLPVKEY)pInstrGC;
+            pGuestToPatchRec->Core.Key    = pInstrGC;
             pGuestToPatchRec->PatchOffset = PatchOffset;
 
-            ret = RTAvlPVInsert(&pPatch->Guest2PatchAddrTree, &pGuestToPatchRec->Core);
+            ret = RTAvlGCPtrInsert(&pPatch->Guest2PatchAddrTree, &pGuestToPatchRec->Core);
             Assert(ret);
         }
@@ -1181,8 +1181,8 @@
 void patmr3RemoveP2GLookupRecord(PVM pVM, PPATCHINFO pPatch, RTGCPTR pPatchInstrGC)
 {
-    PAVLU32NODECORE  pNode;
-    PAVLPVNODECORE   pNode2;
-    PRECPATCHTOGUEST pPatchToGuestRec;
-    uint32_t         PatchOffset = pPatchInstrGC - pVM->patm.s.pPatchMemGC;  /* Offset in memory reserved for PATM. */
+    PAVLU32NODECORE     pNode;
+    PAVLGCPTRNODECORE   pNode2;
+    PRECPATCHTOGUEST    pPatchToGuestRec;
+    uint32_t            PatchOffset = pPatchInstrGC - pVM->patm.s.pPatchMemGC;  /* Offset in memory reserved for PATM. */
 
     pPatchToGuestRec = (PRECPATCHTOGUEST)RTAvlU32Get(&pPatch->Patch2GuestAddrTree, PatchOffset);
@@ -1195,5 +1195,5 @@
 
             Assert(pGuestToPatchRec->Core.Key);
-            pNode2 = RTAvlPVRemove(&pPatch->Guest2PatchAddrTree, pGuestToPatchRec->Core.Key);
+            pNode2 = RTAvlGCPtrRemove(&pPatch->Guest2PatchAddrTree, pGuestToPatchRec->Core.Key);
             Assert(pNode2);
         }
@@ -4416,5 +4416,5 @@
 
     /* Get the closest guest instruction (from below) */
-    PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)pPage, true);
+    PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage, true);
     Assert(pGuestToPatchRec);
     if (pGuestToPatchRec)
@@ -4432,5 +4432,5 @@
             {
                 /* Get the closest guest instruction (from above) */
-                pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)(pPage-1), false);
+                pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage-1, false);
 
                 if (pGuestToPatchRec)
@@ -4445,5 +4445,5 @@
 
     /* Get the closest guest instruction (from above) */
-    pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)(pPage+PAGE_SIZE-1), false);
+    pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage+PAGE_SIZE-1, false);
     Assert(pGuestToPatchRec);
     if (pGuestToPatchRec)
@@ -4547,5 +4547,5 @@
     {
         /* Get the closest guest instruction (from above) */
-        PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)pPage, true);
+        PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage, true);
         if (    pGuestToPatchRec
             &&  PAGE_ADDRESS(pGuestToPatchRec->Core.Key) == PAGE_ADDRESS(pPage)
@@ -4580,7 +4580,7 @@
     {
         /* Get the closest guest instruction (from above) */
-        PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGetBestFit(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)pPage, true);
+        PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGetBestFit(&pPatch->Guest2PatchAddrTree, pPage, true);
         if (    pGuestToPatchRec
-            &&  PAGE_ADDRESS(pGuestToPatchRec->Core.Key) == PAGE_ADDRESS(pPage)
+            &&  PAGE_ADDRESS(pGuestToPatchRec->Core.Key) == PAGE_ADDRESS(pPage) /** @todo bird: PAGE_ADDRESS is for the current context really. check out these. */
            )
         {
@@ -5431,9 +5431,9 @@
  *
  */
-RTGCPTR patmGuestGCPtrToPatchGCPtr(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t*)pInstrGC)
+RTGCPTR patmGuestGCPtrToPatchGCPtr(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t*) pInstrGC)
 {
     if (pPatch->Guest2PatchAddrTree)
     {
-        PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlPVGet(&pPatch->Guest2PatchAddrTree, (AVLPVKEY)pInstrGC);
+        PRECGUESTTOPATCH pGuestToPatchRec = (PRECGUESTTOPATCH)RTAvlGCPtrGet(&pPatch->Guest2PatchAddrTree, pInstrGC);
         if (pGuestToPatchRec)
             return pVM->patm.s.pPatchMemGC + pGuestToPatchRec->PatchOffset;
Index: trunk/src/VBox/VMM/PATM/PATMInternal.h
===================================================================
--- trunk/src/VBox/VMM/PATM/PATMInternal.h	(revision 101)
+++ trunk/src/VBox/VMM/PATM/PATMInternal.h	(revision 102)
@@ -187,8 +187,8 @@
 {
     /** The key is a GC virtual address. */
-    AVLPVNODECORE   Core;
+    AVLGCPTRNODECORE    Core;
 
     /** Patch offset (relative to PATM::pPatchMemGC / PATM::pPatchMemHC). */
-    uint32_t        PatchOffset;
+    uint32_t            PatchOffset;
 } RECGUESTTOPATCH, *PRECGUESTTOPATCH;
 
@@ -259,5 +259,5 @@
      */
     HCPTRTYPE(PAVLU32NODECORE) Patch2GuestAddrTree;
-    HCPTRTYPE(PAVLPVNODECORE) Guest2PatchAddrTree;
+    HCPTRTYPE(PAVLGCPTRNODECORE) Guest2PatchAddrTree;
     uint32_t                  nrPatch2GuestRecs;
 
