VirtualBox

Changeset 1480

Show
Ignore:
Timestamp:
03/14/07 19:27:47 (2 years ago)
Author:
vboxsync
Message:

No longer require contiguous memory for the VM structure.
Did long overdue IOCtl cleanup wrt R3/R0 pointers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/mm.h

    r834 r1480  
    2525#include <VBox/types.h> 
    2626#include <VBox/x86.h> 
     27#include <VBox/sup.h> 
    2728 
    2829 
     
    767768 
    768769/** 
     770 * Maps locked R3 virtual memory into the hypervisor region in the GC. 
     771 * 
     772 * @return VBox status code. 
     773 * 
     774 * @param   pVM         VM handle. 
     775 * @param   pvR3        The ring-3 address of the memory, must be page aligned. 
     776 * @param   pvR0        The ring-0 address of the memory, must be page aligned. (optional) 
     777 * @param   cPages      The number of pages. 
     778 * @param   paPages     The page descriptors. 
     779 * @param   pszDesc     Mapping description. 
     780 * @param   pGCPtr      Where to store the GC address corresponding to pvHC. 
     781 */ 
     782MMR3DECL(int) MMR3HyperMapPages(PVM pVM, void *pvR3, RTR0PTR pvR0, size_t cPages, PCSUPPAGE paPages, const char *pszDesc, PRTGCPTR pGCPtr); 
     783 
     784/** 
    769785 * Reserves a hypervisor memory area. 
    770786 * Most frequent usage is fence pages and dynamically mappings like the guest PD and PDPTR. 
  • trunk/include/VBox/sup.h

    r1027 r1480  
    3333 */ 
    3434 
    35 /** Physical page. 
     35/**  
     36 * Physical page descriptor. 
    3637 */ 
    3738#pragma pack(4) /* space is more important. */ 
     
    4243    /** Reserved entry for internal use by the caller. */ 
    4344    RTHCUINTPTR     uReserved; 
    44 } SUPPAGE, *PSUPPAGE
     45} SUPPAGE
    4546#pragma pack() 
     47/** Pointer to a page descriptor. */ 
     48typedef SUPPAGE *PSUPPAGE; 
     49/** Pointer to a const page descriptor. */ 
     50typedef const SUPPAGE *PCSUPPAGE; 
    4651 
    4752/** 
     
    428433 *                      The pointer stored here on success must be passed to SUPLowFree when 
    429434 *                      the memory should be released. 
     435 * @param   ppvPagesR0  Where to store the ring-0 pointer to the allocated memory. optional. 
    430436 * @param   paPages     Where to store the physical addresses of the individual pages. 
    431437 */ 
    432 SUPR3DECL(int) SUPLowAlloc(unsigned cPages, void **ppvPages, PSUPPAGE paPages); 
     438SUPR3DECL(int) SUPLowAlloc(unsigned cPages, void **ppvPages, PRTR0PTR ppvPagesR0, PSUPPAGE paPages); 
    433439 
    434440/** 
     
    537543SUPR0DECL(int) SUPR0ObjVerifyAccess(void *pvObj, PSUPDRVSESSION pSession, const char *pszObjName); 
    538544 
    539 SUPR0DECL(int) SUPR0LockMem(PSUPDRVSESSION pSession, void *pvR3, unsigned cb, PSUPPAGE paPages); 
    540 SUPR0DECL(int) SUPR0UnlockMem(PSUPDRVSESSION pSession, void *pvR3); 
    541 SUPR0DECL(int) SUPR0ContAlloc(PSUPDRVSESSION pSession, unsigned cb, void **ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys); 
    542 SUPR0DECL(int) SUPR0ContFree(PSUPDRVSESSION pSession, void *pv); 
    543 SUPR0DECL(int) SUPR0LowAlloc(PSUPDRVSESSION pSession, unsigned cPages, void **ppvR3, PSUPPAGE paPages); 
    544 SUPR0DECL(int) SUPR0LowFree(PSUPDRVSESSION pSession, void *pv); 
    545 SUPR0DECL(int) SUPR0MemAlloc(PSUPDRVSESSION pSession, unsigned cb, void **ppvR0, void **ppvR3); 
    546 SUPR0DECL(int) SUPR0MemGetPhys(PSUPDRVSESSION pSession, void *pv, PSUPPAGE paPages); 
    547 SUPR0DECL(int) SUPR0MemFree(PSUPDRVSESSION pSession, void *pv); 
    548 SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PCSUPGLOBALINFOPAGE *ppGip, RTHCPHYS *pHCPhysGid); 
     545SUPR0DECL(int) SUPR0LockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cb, PSUPPAGE paPages); 
     546SUPR0DECL(int) SUPR0UnlockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3); 
     547SUPR0DECL(int) SUPR0ContAlloc(PSUPDRVSESSION pSession, uint32_t cb, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys); 
     548SUPR0DECL(int) SUPR0ContFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr); 
     549SUPR0DECL(int) SUPR0LowAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PSUPPAGE paPages); 
     550SUPR0DECL(int) SUPR0LowFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr); 
     551SUPR0DECL(int) SUPR0MemAlloc(PSUPDRVSESSION pSession, uint32_t cb, PRTR0PTR ppvR0, PRTR3PTR ppvR3); 
     552SUPR0DECL(int) SUPR0MemGetPhys(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages); 
     553SUPR0DECL(int) SUPR0MemFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr); 
     554SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PCSUPGLOBALINFOPAGE *ppGip, PRTHCPHYS pHCPhysGid); 
    549555SUPR0DECL(int) SUPR0GipUnmap(PSUPDRVSESSION pSession); 
    550556SUPR0DECL(int) SUPR0Printf(const char *pszFormat, ...); 
  • trunk/include/VBox/vm.h

    r1283 r1480  
    2828#include <VBox/stam.h> 
    2929#include <VBox/vmapi.h> 
     30#include <VBox/sup.h> 
    3031 
    3132 
     
    227228     */ 
    228229    volatile uint32_t           fForcedActions; 
    229     /** Physical address (real) of this structure. */ 
    230     RTHCPHYS                    HCPhysVM
     230    /** Pointer to the array of page descriptors for the VM structure allocation. */ 
     231    R3PTRTYPE(PSUPPAGE)         paVMPagesR3
    231232    /** Session handle. For use when calling SUPR0 APIs. */ 
    232233    HCPTRTYPE(PSUPDRVSESSION)   pSession; 
     
    318319 
    319320    /* padding to make gnuc put the StatQemuToGC where msc does. */ 
    320 #if HC_ARCH_BITS == 32 
     321/*#if HC_ARCH_BITS == 32 
    321322    uint32_t            padding0; 
    322 #endif 
     323#endif*/ 
    323324 
    324325    /** Profiling the total time from Qemu to GC. */ 
  • trunk/include/VBox/vm.mac

    r1283 r1480  
    4040    .enmVMState         resd 1 
    4141    .fForcedActions     resd 1 
    42     .HCPhysVM           resq
     42    .paVMPagesR3        RTR3PTR_RES
    4343    .pSession           RTR3PTR_RES 1 
    4444    .pNext              RTHCPTR_RES 1 
  • trunk/include/VBox/vmapi.h

    r869 r1480  
    3636 * @{ */ 
    3737 
    38 /** @def VM_PHYS_ADDR 
    39  * Converts address of data within the VM structure to the equivalent 
    40  * physical address. 
    41  * 
    42  * @returns physical address. 
    43  * @param   pVM     Pointer to the VM. 
    44  * @param   pvInVM  Pointer within the VM. 
    45  */ 
    46 #define VM_PHYS_ADDR(pVM, pvInVM)   ( pVM->PhysVM + (uint32_t)((uintptr_t)pvInVM - (uintptr_t)pVM) ) 
    47  
    4838/** @def VM_GUEST_ADDR 
    49  * Converts host address of data within the VM structure to the equivalent 
     39 * Converts a current context address of data within the VM structure to the equivalent 
    5040 * guest address. 
    5141 * 
    5242 * @returns guest virtual address. 
    5343 * @param   pVM     Pointer to the VM. 
    54  * @param   pvInVM  HC Pointer within the VM. 
    55  */ 
    56 #define VM_GUEST_ADDR(pVM, pvInVM)     ( (RTGCPTR)((RTGCUINTPTR)pVM->pVMGC + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMHC)) ) 
     44 * @param   pvInVM  CC Pointer within the VM. 
     45 */ 
     46#ifdef IN_RING3 
     47# define VM_GUEST_ADDR(pVM, pvInVM)     ( (RTGCPTR)((RTGCUINTPTR)pVM->pVMGC + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMR3)) ) 
     48#elif defined(IN_RING0) 
     49# define VM_GUEST_ADDR(pVM, pvInVM)     ( (RTGCPTR)((RTGCUINTPTR)pVM->pVMGC + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMR0)) ) 
     50#else 
     51# define VM_GUEST_ADDR(pVM, pvInVM)     ( (RTGCPTR)(pvInVM) ) 
     52#endif  
     53 
     54/** @def VM_R3_ADDR 
     55 * Converts a current context address of data within the VM structure to the equivalent 
     56 * ring-3 host address. 
     57 * 
     58 * @returns host virtual address. 
     59 * @param   pVM     Pointer to the VM. 
     60 * @param   pvInVM  CC pointer within the VM. 
     61 */ 
     62#ifdef IN_GC 
     63# define VM_R3_ADDR(pVM, pvInVM)       ( (RTR3PTR)((RTR3UINTPTR)pVM->pVMR3 + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMGC)) ) 
     64#elif defined(IN_RING0) 
     65# define VM_R3_ADDR(pVM, pvInVM)       ( (RTR3PTR)((RTR3UINTPTR)pVM->pVMR3 + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMR0)) ) 
     66#else 
     67# define VM_R3_ADDR(pVM, pvInVM)       ( (RTR3PTR)(pvInVM) ) 
     68#endif  
     69 
     70 
     71/** @def VM_R0_ADDR 
     72 * Converts a current context address of data within the VM structure to the equivalent 
     73 * ring-0 host address. 
     74 * 
     75 * @returns host virtual address. 
     76 * @param   pVM     Pointer to the VM. 
     77 * @param   pvInVM  CC pointer within the VM. 
     78 */ 
     79#ifdef IN_GC 
     80# define VM_R0_ADDR(pVM, pvInVM)       ( (RTR0PTR)((RTR0UINTPTR)pVM->pVMR0 + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMGC)) ) 
     81#elif defined(IN_RING3) 
     82# define VM_R0_ADDR(pVM, pvInVM)       ( (RTR0PTR)((RTR0UINTPTR)pVM->pVMR0 + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMR3)) ) 
     83#else 
     84# define VM_R0_ADDR(pVM, pvInVM)       ( (RTR0PTR)(pvInVM) ) 
     85#endif  
    5786 
    5887/** @def VM_HOST_ADDR 
     
    6392 * @param   pVM     Pointer to the VM. 
    6493 * @param   pvInVM  GC Pointer within the VM. 
     94 * @deprecated 
    6595 */ 
    6696#define VM_HOST_ADDR(pVM, pvInVM)     ( (RTHCPTR)((RTHCUINTPTR)pVM->pVMHC + (uint32_t)((uintptr_t)(pvInVM) - (uintptr_t)pVM->pVMGC)) ) 
     97 
    6798 
    6899 
  • trunk/src/VBox/HostDrivers/Support/SUPDRV.h

    r1193 r1480  
    357357    /** Pointer to the R3 mapping of the memory. 
    358358     * Set to NULL if N/A. */ 
    359     void               *pvR3; 
     359    RTR3PTR             pvR3; 
    360360    /** Size of the locked memory. */ 
    361361    unsigned            cb; 
     
    662662int  VBOXCALL   supdrvOSLockMemOne(PSUPDRVMEMREF pMem, PSUPPAGE paPages); 
    663663void VBOXCALL   supdrvOSUnlockMemOne(PSUPDRVMEMREF pMem); 
    664 int  VBOXCALL   supdrvOSContAllocOne(PSUPDRVMEMREF pMem, void **ppvR0, void **ppvR3, PRTHCPHYS pHCPhys); 
     664int  VBOXCALL   supdrvOSContAllocOne(PSUPDRVMEMREF pMem, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys); 
    665665void VBOXCALL   supdrvOSContFreeOne(PSUPDRVMEMREF pMem); 
    666 int  VBOXCALL   supdrvOSLowAllocOne(PSUPDRVMEMREF pMem, void **ppvR3, PSUPPAGE paPages); 
     666int  VBOXCALL   supdrvOSLowAllocOne(PSUPDRVMEMREF pMem, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PSUPPAGE paPages); 
    667667void VBOXCALL   supdrvOSLowFreeOne(PSUPDRVMEMREF pMem); 
    668 int  VBOXCALL   supdrvOSMemAllocOne(PSUPDRVMEMREF pMem, void **ppvR0, void **ppvR3); 
     668int  VBOXCALL   supdrvOSMemAllocOne(PSUPDRVMEMREF pMem, PRTR0PTR ppvR0, PRTR3PTR ppvR3); 
    669669void VBOXCALL   supdrvOSMemGetPages(PSUPDRVMEMREF pMem, PSUPPAGE paPages); 
    670670void VBOXCALL   supdrvOSMemFreeOne(PSUPDRVMEMREF pMem); 
  • trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h

    r1193 r1480  
    181181#define SUPCOOKIE_MAGIC             "The Magic Word!" 
    182182/** Current interface version. */ 
    183 #define SUPDRVIOC_VERSION           0x00040000 
     183#define SUPDRVIOC_VERSION           0x00040001 
    184184 
    185185/** SUP_IOCTL_COOKIE Output. */ 
     
    263263    uint32_t    u32SessionCookie; 
    264264    /** Start of page range. Must be PAGE aligned. */ 
    265     void       *pv
     265    RTR3PTR     pvR3
    266266    /** Size of the range. Must be PAGE aligned. */ 
    267267    uint32_t    cb; 
     
    285285    uint32_t    u32SessionCookie; 
    286286    /** Start of page range of a range previuosly pinned. */ 
    287     void        *pv
     287    RTR3PTR     pvR3
    288288} SUPUNPINPAGES_IN, *PSUPUNPINPAGES_IN; 
    289289 
     
    320320    /** Session cookie. */ 
    321321    uint32_t    u32SessionCookie; 
    322     /** The address (virtual, not physical address) of the memory to free. */ 
    323     void       *pv
     322    /** The ring-3 address of the memory to free. */ 
     323    RTR3PTR     pvR3
    324324} SUPCONTFREE_IN, *PSUPCONTFREE_IN; 
    325325 
     
    511511typedef struct SUPLOWALLOC_OUT 
    512512{ 
    513     /** The address (virtual & linear) of the allocated memory. */ 
    514     void       *pvVirt; 
     513    /** The ring-3 address of the allocated memory. */ 
     514    RTR3PTR     pvR3; 
     515    /** The ring-0 address of the allocated memory. */ 
     516    RTR0PTR     pvR0; 
    515517    /** Array of pages. */ 
    516518    SUPPAGE     aPages[1]; 
     
    525527    /** Session cookie. */ 
    526528    uint32_t    u32SessionCookie; 
    527     /** The address (virtual, not physical address) of the memory to free. */ 
    528     void       *pv
     529    /** The ring-3 address of the memory to free. */ 
     530    RTR3PTR     pvR3
    529531} SUPLOWFREE_IN, *PSUPLOWFREE_IN; 
    530532 
  • trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c

    r1193 r1480  
    146146__BEGIN_DECLS 
    147147static int      supdrvMemAdd(PSUPDRVMEMREF pMem, PSUPDRVSESSION pSession); 
    148 static int      supdrvMemRelease(PSUPDRVSESSION pSession, void *pv, SUPDRVMEMREFTYPE eType); 
     148static int      supdrvMemRelease(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, SUPDRVMEMREFTYPE eType); 
    149149#ifndef VBOX_WITHOUT_IDT_PATCHING 
    150150static int      supdrvIOCtl_IdtInstall(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPIDTINSTALL_IN pIn, PSUPIDTINSTALL_OUT pOut); 
     
    644644                ||  cbOut != sizeof(*pOut)) 
    645645            { 
    646                 dprintf(("SUP_IOCTL_COOKIE: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    647                          cbIn, sizeof(*pIn), cbOut, sizeof(*pOut))); 
     646                dprintf(("SUP_IOCTL_COOKIE: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     647                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
    648648                return SUPDRV_ERR_INVALID_PARAM; 
    649649            } 
     
    685685                ||  cbOut < sizeof(*pOut)) 
    686686            { 
    687                 dprintf(("SUP_IOCTL_QUERY_FUNCS: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    688                          cbIn, sizeof(*pIn), cbOut, sizeof(*pOut))); 
     687                dprintf(("SUP_IOCTL_QUERY_FUNCS: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     688                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
    689689                return SUPDRV_ERR_INVALID_PARAM; 
    690690            } 
     
    723723                ||  cbOut != sizeof(*pOut)) 
    724724            { 
    725                 dprintf(("SUP_IOCTL_INSTALL: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    726                          cbIn, sizeof(*pIn), cbOut, sizeof(*pOut))); 
     725                dprintf(("SUP_IOCTL_INSTALL: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     726                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
    727727                return SUPDRV_ERR_INVALID_PARAM; 
    728728            } 
     
    756756                ||  cbOut != 0) 
    757757            { 
    758                 dprintf(("SUP_IOCTL_REMOVE: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    759                          cbIn, sizeof(*pIn), cbOut, 0)); 
     758                dprintf(("SUP_IOCTL_REMOVE: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     759                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
    760760                return SUPDRV_ERR_INVALID_PARAM; 
    761761            } 
     
    788788                ||  cbOut < sizeof(*pOut)) 
    789789            { 
    790                 dprintf(("SUP_IOCTL_PINPAGES: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    791                          cbIn, sizeof(*pIn), cbOut, sizeof(*pOut))); 
     790                dprintf(("SUP_IOCTL_PINPAGES: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     791                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
    792792                return SUPDRV_ERR_INVALID_PARAM; 
    793793            } 
     
    799799                return SUPDRV_ERR_INVALID_MAGIC; 
    800800            } 
    801             if (pIn->cb <= 0 || !pIn->pv
    802             { 
    803                 dprintf(("SUP_IOCTL_PINPAGES: Illegal request %p %d\n", pIn->pv, pIn->cb)); 
     801            if (pIn->cb <= 0 || !pIn->pvR3
     802            { 
     803                dprintf(("SUP_IOCTL_PINPAGES: Illegal request %p %d\n", (void *)pIn->pvR3, pIn->cb)); 
    804804                return SUPDRV_ERR_INVALID_PARAM; 
    805805            } 
     
    815815             */ 
    816816            *pcbReturned = RT_OFFSETOF(SUPPINPAGES_OUT, aPages[pIn->cb >> PAGE_SHIFT]); 
    817             rc = SUPR0LockMem(pSession, pIn->pv, pIn->cb, &pOut->aPages[0]); 
     817            rc = SUPR0LockMem(pSession, pIn->pvR3, pIn->cb, &pOut->aPages[0]); 
    818818            if (rc) 
    819819                *pcbReturned = 0; 
     
    832832                ||  cbOut != 0) 
    833833            { 
    834                 dprintf(("SUP_IOCTL_UNPINPAGES: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    835                          cbIn, sizeof(*pIn), cbOut, 0)); 
     834                dprintf(("SUP_IOCTL_UNPINPAGES: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     835                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
    836836                return SUPDRV_ERR_INVALID_PARAM; 
    837837            } 
     
    847847             * Execute. 
    848848             */ 
    849             return SUPR0UnlockMem(pSession, pIn->pv); 
     849            return SUPR0UnlockMem(pSession, pIn->pvR3); 
    850850        } 
    851851 
     
    862862                ||  cbOut < sizeof(*pOut)) 
    863863            { 
    864                 dprintf(("SUP_IOCTL_CONT_ALLOC: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    865                          cbIn, sizeof(*pIn), cbOut, sizeof(*pOut))); 
     864                dprintf(("SUP_IOCTL_CONT_ALLOC: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     865                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
    866866                return SUPDRV_ERR_INVALID_PARAM; 
    867867            } 
     
    894894                ||  cbOut != 0) 
    895895            { 
    896                 dprintf(("SUP_IOCTL_CONT_FREE: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    897                          cbIn, sizeof(*pIn), cbOut, 0)); 
     896                dprintf(("SUP_IOCTL_CONT_FREE: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     897                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
    898898                return SUPDRV_ERR_INVALID_PARAM; 
    899899            } 
     
    909909             * Execute. 
    910910             */ 
    911             return SUPR0ContFree(pSession, pIn->pv); 
     911            return SUPR0ContFree(pSession, (RTHCUINTPTR)pIn->pvR3); 
    912912        } 
    913913 
     
    924924                ||  cbOut != sizeof(*pOut)) 
    925925            { 
    926                 dprintf(("SUP_IOCTL_LDR_OPEN: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    927                          cbIn, sizeof(*pIn), cbOut, sizeof(*pOut))); 
     926                dprintf(("SUP_IOCTL_LDR_OPEN: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     927                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
    928928                return SUPDRV_ERR_INVALID_PARAM; 
    929929            } 
     
    972972                ||  cbOut != 0) 
    973973            { 
    974                 dprintf(("SUP_IOCTL_LDR_LOAD: Invalid input/output sizes. cbIn=%d expected greater than %d. cbOut=%d expected %d.\n", 
    975                          cbIn, sizeof(*pIn), cbOut, 0)); 
     974                dprintf(("SUP_IOCTL_LDR_LOAD: Invalid input/output sizes. cbIn=%ld expected greater than %ld. cbOut=%ld expected %ld.\n", 
     975                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
    976976                return SUPDRV_ERR_INVALID_PARAM; 
    977977            } 
     
    10551055                ||  cbOut != 0) 
    10561056            { 
    1057                 dprintf(("SUP_IOCTL_LDR_FREE: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    1058                          cbIn, sizeof(*pIn), cbOut, 0)); 
     1057                dprintf(("SUP_IOCTL_LDR_FREE: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1058                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
    10591059                return SUPDRV_ERR_INVALID_PARAM; 
    10601060            } 
     
    11021102            if (pszEnd - &pIn->szSymbol[0] >= 1024) 
    11031103            { 
    1104                 dprintf(("SUP_IOCTL_LDR_GET_SYMBOL: The symbol name too long (%d chars, max is %d)!\n", 
    1105                          pszEnd - &pIn->szSymbol[0], 1024)); 
     1104                dprintf(("SUP_IOCTL_LDR_GET_SYMBOL: The symbol name too long (%ld chars, max is %d)!\n", 
     1105                         (long)(pszEnd - &pIn->szSymbol[0]), 1024)); 
    11061106                return SUPDRV_ERR_INVALID_PARAM; 
    11071107            } 
     
    11251125                ||  cbOut != sizeof(*pOut)) 
    11261126            { 
    1127                 dprintf(("SUP_IOCTL_CALL_VMMR0: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    1128                          cbIn, sizeof(*pIn), cbOut, sizeof(*pOut))); 
     1127                dprintf(("SUP_IOCTL_CALL_VMMR0: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1128                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
    11291129                return SUPDRV_ERR_INVALID_PARAM; 
    11301130            } 
     
    11641164                ||  cbOut != sizeof(*pOut)) 
    11651165            { 
    1166                 dprintf(("SUP_IOCTL_GET_PAGING_MODE: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    1167                          cbIn, sizeof(*pIn), cbOut, sizeof(*pOut))); 
     1166                dprintf(("SUP_IOCTL_GET_PAGING_MODE: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1167                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
    11681168                return SUPDRV_ERR_INVALID_PARAM; 
    11691169            } 
     
    11991199                ||  cbOut < sizeof(*pOut)) 
    12001200            { 
    1201                 dprintf(("SUP_IOCTL_LOW_ALLOC: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    1202                          cbIn, sizeof(*pIn), cbOut, sizeof(*pOut))); 
     1201                dprintf(("SUP_IOCTL_LOW_ALLOC: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1202                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 
    12031203                return SUPDRV_ERR_INVALID_PARAM; 
    12041204            } 
     
    12211221             */ 
    12221222            *pcbReturned = RT_OFFSETOF(SUPLOWALLOC_OUT, aPages[pIn->cPages]); 
    1223             rc = SUPR0LowAlloc(pSession, pIn->cPages, &pOut->pvVirt, &pOut->aPages[0]); 
     1223            rc = SUPR0LowAlloc(pSession, pIn->cPages, &pOut->pvR0, &pOut->pvR3, &pOut->aPages[0]); 
    12241224            if (rc) 
    12251225                *pcbReturned = 0; 
     
    12381238                ||  cbOut != 0) 
    12391239            { 
    1240                 dprintf(("SUP_IOCTL_LOW_FREE: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    1241                          cbIn, sizeof(*pIn), cbOut, 0)); 
     1240                dprintf(("SUP_IOCTL_LOW_FREE: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1241                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
    12421242                return SUPDRV_ERR_INVALID_PARAM; 
    12431243            } 
     
    12531253             * Execute. 
    12541254             */ 
    1255             return SUPR0LowFree(pSession, pIn->pv); 
     1255            return SUPR0LowFree(pSession, (RTHCUINTPTR)pIn->pvR3); 
    12561256        } 
    12571257 
     
    12691269                ||  cbOut != sizeof(*pOut)) 
    12701270            { 
    1271                 dprintf(("SUP_IOCTL_GIP_MAP: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    1272                          cbIn, sizeof(*pIn), cbOut, 0)); 
     1271                dprintf(("SUP_IOCTL_GIP_MAP: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1272                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
    12731273                return SUPDRV_ERR_INVALID_PARAM; 
    12741274            } 
     
    13041304                ||  cbOut != 0) 
    13051305            { 
    1306                 dprintf(("SUP_IOCTL_GIP_UNMAP: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    1307                          cbIn, sizeof(*pIn), cbOut, 0)); 
     1306                dprintf(("SUP_IOCTL_GIP_UNMAP: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1307                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
    13081308                return SUPDRV_ERR_INVALID_PARAM; 
    13091309            } 
     
    13331333                ||  cbOut != 0) 
    13341334            { 
    1335                 dprintf(("SUP_IOCTL_SET_VM_FOR_FAST: Invalid input/output sizes. cbIn=%d expected %d. cbOut=%d expected %d.\n", 
    1336                          cbIn, sizeof(*pIn), cbOut, 0)); 
     1335                dprintf(("SUP_IOCTL_SET_VM_FOR_FAST: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 
     1336                         (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)0)); 
    13371337                return SUPDRV_ERR_INVALID_PARAM; 
    13381338            } 
     
    17321732 *                      This must be page aligned. 
    17331733 */ 
    1734 SUPR0DECL(int) SUPR0LockMem(PSUPDRVSESSION pSession, void *pvR3, unsigned cb, PSUPPAGE paPages) 
     1734SUPR0DECL(int) SUPR0LockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cb, PSUPPAGE paPages) 
    17351735{ 
    17361736    int             rc; 
    17371737    SUPDRVMEMREF    Mem = {0}; 
    17381738    dprintf(("SUPR0LockMem: pSession=%p pvR3=%p cb=%d paPages=%p\n", 
    1739              pSession, pvR3, cb, paPages)); 
     1739             pSession, (void *)pvR3, cb, paPages)); 
    17401740 
    17411741    /* 
    17421742     * Verify input. 
    17431743     */ 
    1744     if (RT_ALIGN_R3PT(pvR3, PAGE_SIZE, void *) != pvR3 || !pvR3) 
    1745     { 
    1746         dprintf(("pvR3 (%p) must be page aligned and not NULL!\n", pvR3)); 
     1744    if (RT_ALIGN_R3PT(pvR3, PAGE_SIZE, RTR3PTR) != pvR3 || !pvR3) 
     1745    { 
     1746        dprintf(("pvR3 (%p) must be page aligned and not NULL!\n", (void *)pvR3)); 
    17471747        return SUPDRV_ERR_INVALID_PARAM; 
    17481748    } 
    1749     if (RT_ALIGN(cb, PAGE_SIZE) != cb) 
     1749    if (RT_ALIGN_Z(cb, PAGE_SIZE) != cb) 
    17501750    { 
    17511751        dprintf(("cb (%u) must be page aligned!\n", cb)); 
     
    18221822 * @param   pvR3        Memory to unlock. 
    18231823 */ 
    1824 SUPR0DECL(int) SUPR0UnlockMem(PSUPDRVSESSION pSession, void *pvR3) 
    1825 { 
    1826     dprintf(("SUPR0UnlockMem: pSession=%p pvR3=%p\n", pSession, pvR3)); 
    1827     return supdrvMemRelease(pSession, pvR3, MEMREF_TYPE_LOCKED); 
     1824SUPR0DECL(int) SUPR0UnlockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3) 
     1825{ 
     1826    dprintf(("SUPR0UnlockMem: pSession=%p pvR3=%p\n", pSession, (void *)pvR3)); 
     1827    return supdrvMemRelease(pSession, (RTHCUINTPTR)pvR3, MEMREF_TYPE_LOCKED); 
    18281828} 
    18291829 
     
    18371837 * @param   pSession    Session data. 
    18381838 * @param   cb          Number of bytes to allocate. 
    1839  * @param   ppvR0       Where to put the address of Ring-0 mapping the allocated memory. optional 
     1839 * @param   ppvR0       Where to put the address of Ring-0 mapping the allocated memory. 
    18401840 * @param   ppvR3       Where to put the address of Ring-3 mapping the allocated memory. 
    18411841 * @param   pHCPhys     Where to put the physical address of allocated memory. 
    18421842 */ 
    1843 SUPR0DECL(int) SUPR0ContAlloc(PSUPDRVSESSION pSession, unsigned cb, void **ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys) 
     1843SUPR0DECL(int) SUPR0ContAlloc(PSUPDRVSESSION pSession, uint32_t cb, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys) 
    18441844{ 
    18451845    int             rc; 
     
    18501850     * Validate input. 
    18511851     */ 
    1852     if (!pSession || !ppvR3 || !pHCPhys) 
    1853     { 
    1854         dprintf(("Null pointer. All of these should be set: pSession=%p ppvR3=%p pHCPhys=%p\n", 
    1855                  pSession, ppvR3, pHCPhys)); 
     1852    if (!pSession || !ppvR3 || !ppvR0 || !pHCPhys) 
     1853    { 
     1854        dprintf(("Null pointer. All of these should be set: pSession=%p ppvR0=%p ppvR3=%p pHCPhys=%p\n", 
     1855                 pSession, ppvR0, ppvR3, pHCPhys)); 
    18561856        return SUPDRV_ERR_INVALID_PARAM; 
    18571857 
     
    18791879            if (!rc) 
    18801880            { 
    1881                 if (ppvR0) 
    1882                     *ppvR0 = RTR0MemObjAddress(Mem.MemObj); 
    1883                 *ppvR3 = RTR0MemObjAddress(Mem.MapObjR3); 
     1881                *ppvR0 = RTR0MemObjAddress(Mem.MemObj); 
     1882                *ppvR3 = (RTR3PTR)RTR0MemObjAddress(Mem.MapObjR3); 
    18841883                *pHCPhys = RTR0MemObjGetPagePhysAddr(Mem.MemObj, 0); 
    18851884                return 0; 
     
    18991898     */ 
    19001899    Mem.pvR0    = NULL; 
    1901     Mem.pvR3    = NULL
     1900    Mem.pvR3    = NIL_RTR3PTR
    19021901    Mem.eType   = MEMREF_TYPE_CONT; 
    19031902    Mem.cb      = cb; 
     
    19261925 * @returns SUPDRV_ERR_* on failure. 
    19271926 * @param   pSession    The session to which the memory was allocated. 
    1928  * @param   pv          Pointer to the memory
    1929  */ 
    1930 SUPR0DECL(int) SUPR0ContFree(PSUPDRVSESSION pSession, void *pv
    1931 { 
    1932     dprintf(("SUPR0ContFree: pSession=%p pv=%p\n", pSession, pv)); 
    1933     return supdrvMemRelease(pSession, pv, MEMREF_TYPE_CONT); 
     1927 * @param   uPtr        Pointer to the memory (ring-3 or ring-0)
     1928 */ 
     1929SUPR0DECL(int) SUPR0ContFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr
     1930{ 
     1931    dprintf(("SUPR0ContFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr)); 
     1932    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_CONT); 
    19341933} 
    19351934 
     
    19421941 * @param   pSession    Session data. 
    19431942 * @param   cPages      Number of pages to allocate. 
     1943 * @param   ppvR0       Where to put the address of Ring-0 mapping of the allocated memory. 
    19441944 * @param   ppvR3       Where to put the address of Ring-3 mapping of the allocated memory. 
    19451945 * @param   paPages     Where to put the physical addresses of allocated memory. 
    19461946 */ 
    1947 SUPR0DECL(int) SUPR0LowAlloc(PSUPDRVSESSION pSession, unsigned cPages, void **ppvR3, PSUPPAGE paPages) 
     1947SUPR0DECL(int) SUPR0LowAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PSUPPAGE paPages) 
    19481948{ 
    19491949    unsigned        iPage; 
    19501950    int             rc; 
    19511951    SUPDRVMEMREF    Mem = {0}; 
    1952     dprintf(("SUPR0LowAlloc: pSession=%p cPages=%d ppvR3=%p paPages=%p\n", pSession, cPages, ppvR3, paPages)); 
     1952    dprintf(("SUPR0LowAlloc: pSession=%p cPages=%d ppvR3=%p ppvR0=%p paPages=%p\n", pSession, cPages, ppvR3, ppvR0, paPages)); 
    19531953 
    19541954    /* 
    19551955     * Validate input. 
    19561956     */ 
    1957     if (!pSession || !ppvR3 || !paPages) 
    1958     { 
    1959         dprintf(("Null pointer. All of these should be set: pSession=%p ppvR3=%p paPages=%p\n", 
    1960                  pSession, ppvR3, paPages)); 
     1957    if (!pSession || !ppvR3 || !ppvR0 || !paPages) 
     1958    { 
     1959        dprintf(("Null pointer. All of these should be set: pSession=%p ppvR3=%p ppvR0=%p paPages=%p\n", 
     1960                 pSession, ppvR3, ppvR0, paPages)); 
    19611961        return SUPDRV_ERR_INVALID_PARAM; 
    19621962 
     
    19901990                    AssertMsg(!(paPages[iPage].Phys & (PAGE_SIZE - 1)), ("iPage=%d Phys=%VHp\n", paPages[iPage].Phys)); 
    19911991                } 
    1992                 /*if (ppvR0) 
    1993                     *ppvR0 = RTR0MemObjAddress(Mem.MemObj); */ 
     1992                *ppvR0 = RTR0MemObjAddress(Mem.MemObj); 
    19941993                *ppvR3 = RTR0MemObjAddress(Mem.MapObjR3); 
    19951994                return 0; 
     
    20102009     */ 
    20112010    Mem.pvR0    = NULL; 
    2012     Mem.pvR3    = NULL
     2011    Mem.pvR3    = NIL_RTR3PTR
    20132012    Mem.eType   = MEMREF_TYPE_LOW; 
    20142013    Mem.cb      = cPages << PAGE_SHIFT; 
    2015     rc = supdrvOSLowAllocOne(&Mem, ppvR3, paPages); 
     2014    rc = supdrvOSLowAllocOne(&Mem, ppvR0, ppvR3, paPages); 
    20162015    if (rc) 
    20172016        return rc; 
    20182017    AssertMsg(!((uintptr_t)*ppvR3 & (PAGE_SIZE - 1)), ("Memory is not page aligned! virt=%p\n", *ppvR3)); 
     2018    AssertMsg(!((uintptr_t)*ppvR0 & (PAGE_SIZE - 1)), ("Memory is not page aligned! virt=%p\n", *ppvR0)); 
    20192019    for (iPage = 0; iPage < cPages; iPage++) 
    20202020        AssertMsg(!(paPages[iPage].Phys & (PAGE_SIZE - 1)), ("iPage=%d Phys=%VHp\n", paPages[iPage].Phys)); 
     
    20372037 * @returns SUPDRV_ERR_* on failure. 
    20382038 * @param   pSession    The session to which the memory was allocated. 
    2039  * @param   pv          Pointer to the memory
    2040  */ 
    2041 SUPR0DECL(int) SUPR0LowFree(PSUPDRVSESSION pSession, void *pv
    2042 { 
    2043     dprintf(("SUPR0LowFree: pSession=%p pv=%p\n", pSession, pv)); 
    2044     return supdrvMemRelease(pSession, pv, MEMREF_TYPE_LOW); 
     2039 * @param   uPtr        Pointer to the memory (ring-3 or ring-0)
     2040 */ 
     2041SUPR0DECL(int) SUPR0LowFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr
     2042{ 
     2043    dprintf(("SUPR0LowFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr)); 
     2044    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_LOW); 
    20452045} 
    20462046 
     
    20572057 * @param   ppvR3       Where to store the address of the Ring-3 mapping. 
    20582058 */ 
    2059 SUPR0DECL(int) SUPR0MemAlloc(PSUPDRVSESSION pSession, unsigned cb, void **ppvR0, void **ppvR3) 
     2059SUPR0DECL(int) SUPR0MemAlloc(PSUPDRVSESSION pSession, uint32_t cb, PRTR0PTR ppvR0, PRTR3PTR ppvR3) 
    20602060{ 
    20612061    int             rc; 
     
    20962096            { 
    20972097                *ppvR0 = RTR0MemObjAddress(Mem.MemObj); 
    2098                 *ppvR3 = RTR0MemObjAddress(Mem.MapObjR3); 
     2098                *ppvR3 = (RTR3PTR)RTR0MemObjAddress(Mem.MapObjR3); 
    20992099                return 0; 
    21002100            } 
     
    21132113     */ 
    21142114    Mem.pvR0    = NULL; 
    2115     Mem.pvR3    = NULL
     2115    Mem.pvR3    = NIL_RTR3PTR
    21162116    Mem.eType   = MEMREF_TYPE_MEM; 
    21172117    Mem.cb      = cb; 
     
    21392139 * @returns SUPDRV_ERR_* on failure. 
    21402140 * @param   pSession        The session to which the memory was allocated. 
    2141  * @param   pv              The Ring-0 or Ring-3 address returned by SUPR0MemAlloc(). 
    2142  */ 
    2143 SUPR0DECL(int) SUPR0MemGetPhys(PSUPDRVSESSION pSession, void *pv, PSUPPAGE paPages) 
     2141 * @param   uPtr            The Ring-0 or Ring-3 address returned by SUPR0MemAlloc(). 
     2142 * @param   paPages         Where to store the physical addresses. 
     2143 */ 
     2144SUPR0DECL(int) SUPR0MemGetPhys(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages) 
    21442145{ 
    21452146    PSUPDRVBUNDLE pBundle; 
    21462147    RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER; 
    2147     dprintf(("SUPR0MemGetPhys: pSession=%p pv=%p paPages=%p\n", pSession, pv, paPages)); 
     2148    dprintf(("SUPR0MemGetPhys: pSession=%p uPtr=%p paPages=%p\n", pSession, (void *)uPtr, paPages)); 
    21482149 
    21492150    /* 
     
    21552156        return SUPDRV_ERR_INVALID_PARAM; 
    21562157    } 
    2157     if (!pv || !paPages) 
    2158     { 
    2159         dprintf(("Illegal address pv=%p or/and paPages=%p\n", pv, paPages)); 
     2158    if (!uPtr || !paPages) 
     2159    { 
     2160        dprintf(("Illegal address uPtr=%p or/and paPages=%p\n", (void *)uPtr, paPages)); 
    21602161        return SUPDRV_ERR_INVALID_PARAM; 
    21612162    } 
     
    21752176                if (    pBundle->aMem[i].eType == MEMREF_TYPE_MEM 
    21762177                    &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ 
    2177                     &&  (   RTR0MemObjAddress(pBundle->aMem[i].MemObj) == pv 
     2178                    &&  (   (RTHCUINTPTR)RTR0MemObjAddress(pBundle->aMem[i].MemObj) == uPtr 
    21782179                         || (   pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ 
    2179                              && RTR0MemObjAddress(pBundle->aMem[i].MapObjR3) == pv
     2180                             && (RTHCUINTPTR)RTR0MemObjAddress(pBundle->aMem[i].MapObjR3) == uPtr
    21802181                        ) 
    21812182                   ) 
     
    21932194#else /* !USE_NEW_OS_INTERFACE */ 
    21942195                if (    pBundle->aMem[i].eType == MEMREF_TYPE_MEM 
    2195                     &&  (   pBundle->aMem[i].pvR0 == pv 
    2196                          || pBundle->aMem[i].pvR3 == pv)) 
     2196                    &&  (   (RTHCUINTPTR)pBundle->aMem[i].pvR0 == uPtr 
     2197                         || (RTHCUINTPTR)pBundle->aMem[i].pvR3 == uPtr)) 
    21972198                { 
    21982199                    supdrvOSMemGetPages(&pBundle->aMem[i], paPages); 
     
    22052206    } 
    22062207    RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp); 
    2207     dprintf(("Failed to find %p!!!\n", pv)); 
     2208    dprintf(("Failed to find %p!!!\n", (void *)uPtr)); 
    22082209    return SUPDRV_ERR_INVALID_PARAM; 
    22092210} 
     
    22162217 * @returns SUPDRV_ERR_* on failure. 
    22172218 * @param   pSession        The session owning the allocation. 
    2218  * @param   pv              The Ring-0 or Ring-3 address returned by SUPR0MemAlloc(). 
    2219  */ 
    2220 SUPR0DECL(int) SUPR0MemFree(PSUPDRVSESSION pSession, void *pv
    2221 { 
    2222     dprintf(("SUPR0MemFree: pSession=%p pv=%p\n", pSession, pv)); 
    2223     return supdrvMemRelease(pSession, pv, MEMREF_TYPE_MEM); 
     2219 * @param   uPtr            The Ring-0 or Ring-3 address returned by SUPR0MemAlloc(). 
     2220 */ 
     2221SUPR0DECL(int) SUPR0MemFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr
     2222{ 
     2223    dprintf(("SUPR0MemFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr)); 
     2224    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_MEM); 
    22242225} 
    22252226 
     
    22382239 *          and remove the session as a GIP user. 
    22392240 */ 
    2240 SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PCSUPGLOBALINFOPAGE *ppGip, RTHCPHYS *pHCPhysGid) 
     2241SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PCSUPGLOBALINFOPAGE *ppGip, PRTHCPHYS pHCPhysGid) 
    22412242{ 
    22422243    int                     rc = 0; 
     
    24612462 * @returns SUPDRV_ERR_INVALID_PARAM on failure. 
    24622463 * @param   pSession    Session data. 
    2463  * @param   pv          Pointer to memory. This is matched against both the R0 and R3 addresses. 
     2464 * @param   uPtr        Pointer to memory. This is matched against both the R0 and R3 addresses. 
    24642465 * @param   eType       Memory type. 
    24652466 */ 
    2466 static int supdrvMemRelease(PSUPDRVSESSION pSession, void *pv, SUPDRVMEMREFTYPE eType) 
     2467static int supdrvMemRelease(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, SUPDRVMEMREFTYPE eType) 
    24672468{ 
    24682469    PSUPDRVBUNDLE pBundle; 
     
    24772478        return SUPDRV_ERR_I