VirtualBox

Ignore:
Timestamp:
Jun 23, 2009 5:31:45 PM (16 years ago)
Author:
vboxsync
Message:

SUP: Bumped major version because of layout changes in RTLOGGER. Executed the todo list: retire old page alloc api and drop the windows lock/unlock hack (locking not used directly anywhere except as a fallback that doesn't apply to windows).

Location:
trunk/src/VBox/HostDrivers/Support
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r20528 r20860  
    142142static int      supdrvIOCtl_LoggerSettings(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLOGGERSETTINGS pReq);
    143143static SUPGIPMODE supdrvGipDeterminTscMode(PSUPDRVDEVEXT pDevExt);
    144 #ifdef RT_OS_WINDOWS
    145 static int      supdrvPageGetPhys(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cPages, PRTHCPHYS paPages);
    146 static bool     supdrvPageWasLockedByPageAlloc(PSUPDRVSESSION pSession, RTR3PTR pvR3);
    147 #endif /* RT_OS_WINDOWS */
    148144static int      supdrvGipCreate(PSUPDRVDEVEXT pDevExt);
    149145static void     supdrvGipDestroy(PSUPDRVDEVEXT pDevExt);
     
    178174DECLASM(int)    UNWIND_WRAP(SUPR0MemGetPhys)(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages);
    179175DECLASM(int)    UNWIND_WRAP(SUPR0MemFree)(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr);
    180 DECLASM(int)    UNWIND_WRAP(SUPR0PageAlloc)(PSUPDRVSESSION pSession, uint32_t cPages, PRTR3PTR ppvR3, PRTHCPHYS paPages);
     176DECLASM(int)    UNWIND_WRAP(SUPR0PageAllocEx)(PSUPDRVSESSION pSession, uint32_t cPages, uint32_t fFlags, PRTR3PTR ppvR3, PRTR0PTR ppvR0, PRTHCPHYS paPages);
    181177DECLASM(int)    UNWIND_WRAP(SUPR0PageFree)(PSUPDRVSESSION pSession, RTR3PTR pvR3);
    182178//DECLASM(int)    UNWIND_WRAP(SUPR0Printf)(const char *pszFormat, ...);
     
    333329    { "SUPR0MemGetPhys",                        (void *)UNWIND_WRAP(SUPR0MemGetPhys) },
    334330    { "SUPR0MemFree",                           (void *)UNWIND_WRAP(SUPR0MemFree) },
    335     { "SUPR0PageAlloc",                         (void *)UNWIND_WRAP(SUPR0PageAlloc) },
     331    { "SUPR0PageAllocEx",                       (void *)UNWIND_WRAP(SUPR0PageAllocEx) },
    336332    { "SUPR0PageFree",                          (void *)UNWIND_WRAP(SUPR0PageFree) },
    337333    { "SUPR0Printf",                            (void *)SUPR0Printf }, /** @todo needs wrapping? */
     
    12551251        }
    12561252
    1257         case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_IDT_INSTALL):
    1258         {
    1259             /* validate */
    1260             PSUPIDTINSTALL pReq = (PSUPIDTINSTALL)pReqHdr;
    1261             REQ_CHECK_SIZES(SUP_IOCTL_IDT_INSTALL);
    1262 
    1263             /* execute */
    1264             pReq->u.Out.u8Idt = 3;
    1265             pReq->Hdr.rc = VERR_NOT_SUPPORTED;
    1266             return 0;
    1267         }
    1268 
    1269         case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_IDT_REMOVE):
    1270         {
    1271             /* validate */
    1272             PSUPIDTREMOVE pReq = (PSUPIDTREMOVE)pReqHdr;
    1273             REQ_CHECK_SIZES(SUP_IOCTL_IDT_REMOVE);
    1274 
    1275             /* execute */
    1276             pReq->Hdr.rc = VERR_NOT_SUPPORTED;
    1277             return 0;
    1278         }
    1279 
    12801253        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_LOCK):
    12811254        {
     
    15311504            pSession->pVM = pReq->u.In.pVMR0;
    15321505            pReq->Hdr.rc = VINF_SUCCESS;
    1533             return 0;
    1534         }
    1535 
    1536         case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_ALLOC):
    1537         {
    1538             /* validate */
    1539             PSUPPAGEALLOC pReq = (PSUPPAGEALLOC)pReqHdr;
    1540             REQ_CHECK_EXPR(SUP_IOCTL_PAGE_ALLOC, pReq->Hdr.cbIn <= SUP_IOCTL_PAGE_ALLOC_SIZE_IN);
    1541             REQ_CHECK_SIZES_EX(SUP_IOCTL_PAGE_ALLOC, SUP_IOCTL_PAGE_ALLOC_SIZE_IN, SUP_IOCTL_PAGE_ALLOC_SIZE_OUT(pReq->u.In.cPages));
    1542 
    1543             /* execute */
    1544             pReq->Hdr.rc = SUPR0PageAlloc(pSession, pReq->u.In.cPages, &pReq->u.Out.pvR3, &pReq->u.Out.aPages[0]);
    1545             if (RT_FAILURE(pReq->Hdr.rc))
    1546                 pReq->Hdr.cbOut = sizeof(pReq->Hdr);
    15471506            return 0;
    15481507        }
     
    23372296    }
    23382297
    2339 #ifdef RT_OS_WINDOWS /* A temporary hack for windows, will be removed once all ring-3 code has been cleaned up. */
    2340     /* First check if we allocated it using SUPPageAlloc; if so then we don't need to lock it again */
    2341     rc = supdrvPageGetPhys(pSession, pvR3, cPages, paPages);
    2342     if (RT_SUCCESS(rc))
    2343         return rc;
    2344 #endif
    2345 
    23462298    /*
    23472299     * Let IPRT do the job.
     
    23892341    LogFlow(("SUPR0UnlockMem: pSession=%p pvR3=%p\n", pSession, (void *)pvR3));
    23902342    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
    2391 #ifdef RT_OS_WINDOWS
    2392     /*
    2393      * Temporary hack for windows - SUPR0PageFree will unlock SUPR0PageAlloc
    2394      * allocations; ignore this call.
    2395      */
    2396     if (supdrvPageWasLockedByPageAlloc(pSession, pvR3))
    2397     {
    2398         LogFlow(("Page will be unlocked in SUPR0PageFree -> ignore\n"));
    2399         return VINF_SUCCESS;
    2400     }
    2401 #endif
    24022343    return supdrvMemRelease(pSession, (RTHCUINTPTR)pvR3, MEMREF_TYPE_LOCKED);
    24032344}
     
    27092650
    27102651/**
    2711  * Allocates a chunk of memory with only a R3 mappings.
    2712  *
    2713  * The memory is fixed and it's possible to query the physical addresses using
    2714  * SUPR0MemGetPhys().
    2715  *
    2716  * @returns IPRT status code.
    2717  * @param   pSession    The session to associated the allocation with.
    2718  * @param   cPages      The number of pages to allocate.
    2719  * @param   ppvR3       Where to store the address of the Ring-3 mapping.
    2720  * @param   paPages     Where to store the addresses of the pages. Optional.
    2721  */
    2722 SUPR0DECL(int) SUPR0PageAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR3PTR ppvR3, PRTHCPHYS paPages)
    2723 {
    2724     AssertPtrReturn(ppvR3, VERR_INVALID_POINTER);
    2725     return SUPR0PageAllocEx(pSession, cPages, 0 /*fFlags*/, ppvR3, NULL, paPages);
    2726 }
    2727 
    2728 
    2729 /**
    27302652 * Allocates a chunk of memory with a kernel or/and a user mode mapping.
    27312653 *
     
    29852907
    29862908}
    2987 
    2988 
    2989 
    2990 #ifdef RT_OS_WINDOWS
    2991 /**
    2992  * Check if the pages were locked by SUPR0PageAlloc
    2993  *
    2994  * This function will be removed along with the lock/unlock hacks when
    2995  * we've cleaned up the ring-3 code properly.
    2996  *
    2997  * @returns boolean
    2998  * @param   pSession        The session to which the memory was allocated.
    2999  * @param   pvR3            The Ring-3 address returned by SUPR0PageAlloc().
    3000  */
    3001 static bool supdrvPageWasLockedByPageAlloc(PSUPDRVSESSION pSession, RTR3PTR pvR3)
    3002 {
    3003     PSUPDRVBUNDLE pBundle;
    3004     RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    3005     LogFlow(("SUPR0PageIsLockedByPageAlloc: pSession=%p pvR3=%p\n", pSession, (void *)pvR3));
    3006 
    3007     /*
    3008      * Search for the address.
    3009      */
    3010     RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp);
    3011     for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
    3012     {
    3013         if (pBundle->cUsed > 0)
    3014         {
    3015             unsigned i;
    3016             for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
    3017             {
    3018                 if (    pBundle->aMem[i].eType == MEMREF_TYPE_PAGE
    3019                     &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
    3020                     &&  pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
    3021                     &&  RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == pvR3)
    3022                 {
    3023                     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
    3024                     return true;
    3025                 }
    3026             }
    3027         }
    3028     }
    3029     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
    3030     return false;
    3031 }
    3032 
    3033 
    3034 /**
    3035  * Get the physical addresses of memory allocated using SUPR0PageAllocEx().
    3036  *
    3037  * This function will be removed along with the lock/unlock hacks when
    3038  * we've cleaned up the ring-3 code properly.
    3039  *
    3040  * @returns IPRT status code.
    3041  * @param   pSession        The session to which the memory was allocated.
    3042  * @param   pvR3            The Ring-3 address returned by SUPR0PageAlloc().
    3043  * @param   cPages          Number of pages in paPages
    3044  * @param   paPages         Where to store the physical addresses.
    3045  */
    3046 static int supdrvPageGetPhys(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cPages, PRTHCPHYS paPages)
    3047 {
    3048     PSUPDRVBUNDLE pBundle;
    3049     RTSPINLOCKTMP SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
    3050     LogFlow(("supdrvPageGetPhys: pSession=%p pvR3=%p cPages=%#lx paPages=%p\n", pSession, (void *)pvR3, (long)cPages, paPages));
    3051 
    3052     /*
    3053      * Search for the address.
    3054      */
    3055     RTSpinlockAcquire(pSession->Spinlock, &SpinlockTmp);
    3056     for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
    3057     {
    3058         if (pBundle->cUsed > 0)
    3059         {
    3060             unsigned i;
    3061             for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
    3062             {
    3063                 if (    pBundle->aMem[i].eType == MEMREF_TYPE_PAGE
    3064                     &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
    3065                     &&  pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
    3066                     &&  RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == pvR3)
    3067                 {
    3068                     uint32_t iPage;
    3069                     size_t cMaxPages = RTR0MemObjSize(pBundle->aMem[i].MemObj) >> PAGE_SHIFT;
    3070                     cPages = (uint32_t)RT_MIN(cMaxPages, cPages);
    3071                     for (iPage = 0; iPage < cPages; iPage++)
    3072                         paPages[iPage] = RTR0MemObjGetPagePhysAddr(pBundle->aMem[i].MemObj, iPage);
    3073                     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
    3074                     return VINF_SUCCESS;
    3075                 }
    3076             }
    3077         }
    3078     }
    3079     RTSpinlockRelease(pSession->Spinlock, &SpinlockTmp);
    3080     return VERR_INVALID_PARAMETER;
    3081 }
    3082 #endif /* RT_OS_WINDOWS */
    30832909
    30842910
  • trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h

    r20528 r20860  
    192192 *
    193193 * @todo Pending work on next major version change:
    194  *          - Eliminate supdrvPageWasLockedByPageAlloc and supdrvPageGetPhys.
    195  *          - Remove SUPR0PageAlloc in favor of SUPR0PageAllocEx, removing
    196  *            and renaming the related IOCtls too.
    197  */
    198 #define SUPDRV_IOC_VERSION                              0x000d0001
     194 *          - Nothing.
     195 */
     196#define SUPDRV_IOC_VERSION                              0x000e0000
    199197
    200198/** SUP_IOCTL_COOKIE. */
     
    272270
    273271
    274 /** @name SUP_IOCTL_IDT_INSTALL
    275  * Install IDT patch for calling processor.
    276  * @{
    277  */
    278 #define SUP_IOCTL_IDT_INSTALL                           SUP_CTL_CODE_SIZE(3, SUP_IOCTL_IDT_INSTALL_SIZE)
    279 #define SUP_IOCTL_IDT_INSTALL_SIZE                      sizeof(SUPIDTINSTALL)
    280 #define SUP_IOCTL_IDT_INSTALL_SIZE_IN                   sizeof(SUPREQHDR)
    281 #define SUP_IOCTL_IDT_INSTALL_SIZE_OUT                  sizeof(SUPIDTINSTALL)
    282 typedef struct SUPIDTINSTALL
    283 {
    284     /** The header. */
    285     SUPREQHDR               Hdr;
    286     union
    287     {
    288         struct
    289         {
    290             /** The IDT entry number. */
    291             uint8_t         u8Idt;
    292         } Out;
    293     } u;
    294 } SUPIDTINSTALL, *PSUPIDTINSTALL;
    295 /** @} */
    296 
    297 
    298 /** @name SUP_IOCTL_IDT_REMOVE
    299  * Remove IDT patch for calling processor.
    300  * @{
    301  */
    302 #define SUP_IOCTL_IDT_REMOVE                            SUP_CTL_CODE_SIZE(4, SUP_IOCTL_IDT_REMOVE_SIZE)
    303 #define SUP_IOCTL_IDT_REMOVE_SIZE                       sizeof(SUPIDTREMOVE)
    304 #define SUP_IOCTL_IDT_REMOVE_SIZE_IN                    sizeof(SUPIDTREMOVE)
    305 #define SUP_IOCTL_IDT_REMOVE_SIZE_OUT                   sizeof(SUPIDTREMOVE)
    306 typedef struct SUPIDTREMOVE
    307 {
    308     /** The header. */
    309     SUPREQHDR               Hdr;
    310 } SUPIDTREMOVE, *PSUPIDTREMOVE;
    311 /** @}*/
    312 
    313 
    314272/** @name SUP_IOCTL_LDR_OPEN
    315273 * Open an image.
    316274 * @{
    317275 */
    318 #define SUP_IOCTL_LDR_OPEN                              SUP_CTL_CODE_SIZE(5, SUP_IOCTL_LDR_OPEN_SIZE)
     276#define SUP_IOCTL_LDR_OPEN                              SUP_CTL_CODE_SIZE(3, SUP_IOCTL_LDR_OPEN_SIZE)
    319277#define SUP_IOCTL_LDR_OPEN_SIZE                         sizeof(SUPLDROPEN)
    320278#define SUP_IOCTL_LDR_OPEN_SIZE_IN                      sizeof(SUPLDROPEN)
     
    351309 * @{
    352310 */
    353 #define SUP_IOCTL_LDR_LOAD                              SUP_CTL_CODE_BIG(6)
     311#define SUP_IOCTL_LDR_LOAD                              SUP_CTL_CODE_BIG(4)
    354312#define SUP_IOCTL_LDR_LOAD_SIZE(cbImage)                RT_UOFFSETOF(SUPLDRLOAD, u.In.achImage[cbImage])
    355313#define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage)             RT_UOFFSETOF(SUPLDRLOAD, u.In.achImage[cbImage])
     
    464422 * @{
    465423 */
    466 #define SUP_IOCTL_LDR_FREE                              SUP_CTL_CODE_SIZE(7, SUP_IOCTL_LDR_FREE_SIZE)
     424#define SUP_IOCTL_LDR_FREE                              SUP_CTL_CODE_SIZE(5, SUP_IOCTL_LDR_FREE_SIZE)
    467425#define SUP_IOCTL_LDR_FREE_SIZE                         sizeof(SUPLDRFREE)
    468426#define SUP_IOCTL_LDR_FREE_SIZE_IN                      sizeof(SUPLDRFREE)
     
    488446 * @{
    489447 */
    490 #define SUP_IOCTL_LDR_GET_SYMBOL                        SUP_CTL_CODE_SIZE(8, SUP_IOCTL_LDR_GET_SYMBOL_SIZE)
     448#define SUP_IOCTL_LDR_GET_SYMBOL                        SUP_CTL_CODE_SIZE(6, SUP_IOCTL_LDR_GET_SYMBOL_SIZE)
    491449#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE                   sizeof(SUPLDRGETSYMBOL)
    492450#define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_IN                sizeof(SUPLDRGETSYMBOL)
     
    521479 * @{
    522480 */
    523 #define SUP_IOCTL_CALL_VMMR0(cbReq)                     SUP_CTL_CODE_SIZE(9, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq))
     481#define SUP_IOCTL_CALL_VMMR0(cbReq)                     SUP_CTL_CODE_SIZE(7, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq))
    524482#define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)                RT_UOFFSETOF(SUPCALLVMMR0, abReqPkt[cbReq])
    525483#define SUP_IOCTL_CALL_VMMR0_SIZE_IN(cbReq)             SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
     
    553511 * @{
    554512 */
    555 #define SUP_IOCTL_LOW_ALLOC                             SUP_CTL_CODE_BIG(10)
     513#define SUP_IOCTL_LOW_ALLOC                             SUP_CTL_CODE_BIG(8)
    556514#define SUP_IOCTL_LOW_ALLOC_SIZE(cPages)                ((uint32_t)RT_UOFFSETOF(SUPLOWALLOC, u.Out.aPages[cPages]))
    557515#define SUP_IOCTL_LOW_ALLOC_SIZE_IN                     (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In))
     
    586544 * @{
    587545 */
    588 #define SUP_IOCTL_LOW_FREE                              SUP_CTL_CODE_SIZE(11, SUP_IOCTL_LOW_FREE_SIZE)
     546#define SUP_IOCTL_LOW_FREE                              SUP_CTL_CODE_SIZE(9, SUP_IOCTL_LOW_FREE_SIZE)
    589547#define SUP_IOCTL_LOW_FREE_SIZE                         sizeof(SUPLOWFREE)
    590548#define SUP_IOCTL_LOW_FREE_SIZE_IN                      sizeof(SUPLOWFREE)
     
    606564
    607565
    608 /** @name SUP_IOCTL_PAGE_ALLOC
    609  * Allocate memory and map into the user process.
    610  * The memory is of course locked.
    611  * @{
    612  */
    613 #define SUP_IOCTL_PAGE_ALLOC                            SUP_CTL_CODE_BIG(12)
    614 #define SUP_IOCTL_PAGE_ALLOC_SIZE(cPages)               RT_UOFFSETOF(SUPPAGEALLOC, u.Out.aPages[cPages])
    615 #define SUP_IOCTL_PAGE_ALLOC_SIZE_IN                    (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOC, u.In))
    616 #define SUP_IOCTL_PAGE_ALLOC_SIZE_OUT(cPages)           SUP_IOCTL_PAGE_ALLOC_SIZE(cPages)
    617 typedef struct SUPPAGEALLOC
    618 {
    619     /** The header. */
    620     SUPREQHDR               Hdr;
    621     union
    622     {
    623         struct
    624         {
    625             /** Number of pages to allocate */
    626             uint32_t        cPages;
    627         } In;
    628         struct
    629         {
    630             /** Returned ring-3 address. */
    631             RTR3PTR         pvR3;
    632             /** The physical addresses of the allocated pages. */
    633             RTHCPHYS        aPages[1];
    634         } Out;
    635     } u;
    636 } SUPPAGEALLOC, *PSUPPAGEALLOC;
    637 /** @} */
    638 
    639 
    640 /** @name SUP_IOCTL_PAGE_FREE
    641  * Free memory allocated with SUP_IOCTL_PAGE_ALLOC or SUP_IOCTL_PAGE_ALLOC_EX.
    642  * @{
    643  */
    644 #define SUP_IOCTL_PAGE_FREE                             SUP_CTL_CODE_SIZE(13, SUP_IOCTL_PAGE_FREE_SIZE_IN)
    645 #define SUP_IOCTL_PAGE_FREE_SIZE                        sizeof(SUPPAGEFREE)
    646 #define SUP_IOCTL_PAGE_FREE_SIZE_IN                     sizeof(SUPPAGEFREE)
    647 #define SUP_IOCTL_PAGE_FREE_SIZE_OUT                    sizeof(SUPREQHDR)
    648 typedef struct SUPPAGEFREE
    649 {
    650     /** The header. */
    651     SUPREQHDR               Hdr;
    652     union
    653     {
    654         struct
    655         {
    656             /** Address of memory range to free. */
    657             RTR3PTR         pvR3;
    658         } In;
    659     } u;
    660 } SUPPAGEFREE, *PSUPPAGEFREE;
    661 /** @} */
    662 
    663 
    664 /** @name SUP_IOCTL_PAGE_LOCK
    665  * Pin down physical pages.
    666  * @{
    667  */
    668 #define SUP_IOCTL_PAGE_LOCK                             SUP_CTL_CODE_BIG(14)
    669 #define SUP_IOCTL_PAGE_LOCK_SIZE(cPages)                (RT_MAX((size_t)SUP_IOCTL_PAGE_LOCK_SIZE_IN, (size_t)SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages)))
    670 #define SUP_IOCTL_PAGE_LOCK_SIZE_IN                     (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In))
    671 #define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages)            RT_UOFFSETOF(SUPPAGELOCK, u.Out.aPages[cPages])
    672 typedef struct SUPPAGELOCK
    673 {
    674     /** The header. */
    675     SUPREQHDR               Hdr;
    676     union
    677     {
    678         struct
    679         {
    680             /** Start of page range. Must be PAGE aligned. */
    681             RTR3PTR         pvR3;
    682             /** The range size given as a page count. */
    683             uint32_t        cPages;
    684         } In;
    685 
    686         struct
    687         {
    688             /** Array of pages. */
    689             RTHCPHYS        aPages[1];
    690         } Out;
    691     } u;
    692 } SUPPAGELOCK, *PSUPPAGELOCK;
    693 /** @} */
    694 
    695 
    696 /** @name SUP_IOCTL_PAGE_UNLOCK
    697  * Unpin physical pages.
    698  * @{ */
    699 #define SUP_IOCTL_PAGE_UNLOCK                           SUP_CTL_CODE_SIZE(15, SUP_IOCTL_PAGE_UNLOCK_SIZE)
    700 #define SUP_IOCTL_PAGE_UNLOCK_SIZE                      sizeof(SUPPAGEUNLOCK)
    701 #define SUP_IOCTL_PAGE_UNLOCK_SIZE_IN                   sizeof(SUPPAGEUNLOCK)
    702 #define SUP_IOCTL_PAGE_UNLOCK_SIZE_OUT                  sizeof(SUPREQHDR)
    703 typedef struct SUPPAGEUNLOCK
    704 {
    705     /** The header. */
    706     SUPREQHDR               Hdr;
    707     union
    708     {
    709         struct
    710         {
    711             /** Start of page range of a range previuosly pinned. */
    712             RTR3PTR         pvR3;
    713         } In;
    714     } u;
    715 } SUPPAGEUNLOCK, *PSUPPAGEUNLOCK;
    716 /** @} */
    717 
    718 
    719 /** @name SUP_IOCTL_CONT_ALLOC
    720  * Allocate contious memory.
    721  * @{
    722  */
    723 #define SUP_IOCTL_CONT_ALLOC                            SUP_CTL_CODE_SIZE(16, SUP_IOCTL_CONT_ALLOC_SIZE)
    724 #define SUP_IOCTL_CONT_ALLOC_SIZE                       sizeof(SUPCONTALLOC)
    725 #define SUP_IOCTL_CONT_ALLOC_SIZE_IN                    (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCONTALLOC, u.In))
    726 #define SUP_IOCTL_CONT_ALLOC_SIZE_OUT                   sizeof(SUPCONTALLOC)
    727 typedef struct SUPCONTALLOC
    728 {
    729     /** The header. */
    730     SUPREQHDR               Hdr;
    731     union
    732     {
    733         struct
    734         {
    735             /** The allocation size given as a page count. */
    736             uint32_t        cPages;
    737         } In;
    738 
    739         struct
    740         {
    741             /** The address of the ring-0 mapping of the allocated memory. */
    742             RTR0PTR         pvR0;
    743             /** The address of the ring-3 mapping of the allocated memory. */
    744             RTR3PTR         pvR3;
    745             /** The physical address of the allocation. */
    746             RTHCPHYS        HCPhys;
    747         } Out;
    748     } u;
    749 } SUPCONTALLOC, *PSUPCONTALLOC;
    750 /** @} */
    751 
    752 
    753 /** @name SUP_IOCTL_CONT_FREE Input.
    754  * @{
    755  */
    756 /** Free contious memory. */
    757 #define SUP_IOCTL_CONT_FREE                             SUP_CTL_CODE_SIZE(17, SUP_IOCTL_CONT_FREE_SIZE)
    758 #define SUP_IOCTL_CONT_FREE_SIZE                        sizeof(SUPCONTFREE)
    759 #define SUP_IOCTL_CONT_FREE_SIZE_IN                     sizeof(SUPCONTFREE)
    760 #define SUP_IOCTL_CONT_FREE_SIZE_OUT                    sizeof(SUPREQHDR)
    761 typedef struct SUPCONTFREE
    762 {
    763     /** The header. */
    764     SUPREQHDR               Hdr;
    765     union
    766     {
    767         struct
    768         {
    769             /** The ring-3 address of the memory to free. */
    770             RTR3PTR         pvR3;
    771         } In;
    772     } u;
    773 } SUPCONTFREE, *PSUPCONTFREE;
    774 /** @} */
    775 
    776 
    777 /** @name SUP_IOCTL_GET_PAGING_MODE
    778  * Get the host paging mode.
    779  * @{
    780  */
    781 #define SUP_IOCTL_GET_PAGING_MODE                       SUP_CTL_CODE_SIZE(18, SUP_IOCTL_GET_PAGING_MODE_SIZE)
    782 #define SUP_IOCTL_GET_PAGING_MODE_SIZE                  sizeof(SUPGETPAGINGMODE)
    783 #define SUP_IOCTL_GET_PAGING_MODE_SIZE_IN               sizeof(SUPREQHDR)
    784 #define SUP_IOCTL_GET_PAGING_MODE_SIZE_OUT              sizeof(SUPGETPAGINGMODE)
    785 typedef struct SUPGETPAGINGMODE
    786 {
    787     /** The header. */
    788     SUPREQHDR               Hdr;
    789     union
    790     {
    791         struct
    792         {
    793             /** The paging mode. */
    794             SUPPAGINGMODE   enmMode;
    795         } Out;
    796     } u;
    797 } SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;
    798 /** @} */
    799 
    800 
    801 /** @name SUP_IOCTL_SET_VM_FOR_FAST
    802  * Set the VM handle for doing fast call ioctl calls.
    803  * @{
    804  */
    805 #define SUP_IOCTL_SET_VM_FOR_FAST                       SUP_CTL_CODE_SIZE(19, SUP_IOCTL_SET_VM_FOR_FAST_SIZE)
    806 #define SUP_IOCTL_SET_VM_FOR_FAST_SIZE                  sizeof(SUPSETVMFORFAST)
    807 #define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_IN               sizeof(SUPSETVMFORFAST)
    808 #define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_OUT              sizeof(SUPREQHDR)
    809 typedef struct SUPSETVMFORFAST
    810 {
    811     /** The header. */
    812     SUPREQHDR               Hdr;
    813     union
    814     {
    815         struct
    816         {
    817             /** The ring-0 VM handle (pointer). */
    818             PVMR0           pVMR0;
    819         } In;
    820     } u;
    821 } SUPSETVMFORFAST, *PSUPSETVMFORFAST;
    822 /** @} */
    823 
    824 
    825 /** @name SUP_IOCTL_GIP_MAP
    826  * Map the GIP into user space.
    827  * @{
    828  */
    829 #define SUP_IOCTL_GIP_MAP                               SUP_CTL_CODE_SIZE(20, SUP_IOCTL_GIP_MAP_SIZE)
    830 #define SUP_IOCTL_GIP_MAP_SIZE                          sizeof(SUPGIPMAP)
    831 #define SUP_IOCTL_GIP_MAP_SIZE_IN                       sizeof(SUPREQHDR)
    832 #define SUP_IOCTL_GIP_MAP_SIZE_OUT                      sizeof(SUPGIPMAP)
    833 typedef struct SUPGIPMAP
    834 {
    835     /** The header. */
    836     SUPREQHDR               Hdr;
    837     union
    838     {
    839         struct
    840         {
    841             /** The physical address of the GIP. */
    842             RTHCPHYS        HCPhysGip;
    843             /** Pointer to the read-only usermode GIP mapping for this session. */
    844             R3PTRTYPE(PSUPGLOBALINFOPAGE)   pGipR3;
    845             /** Pointer to the supervisor mode GIP mapping. */
    846             R0PTRTYPE(PSUPGLOBALINFOPAGE)   pGipR0;
    847         } Out;
    848     } u;
    849 } SUPGIPMAP, *PSUPGIPMAP;
    850 /** @} */
    851 
    852 
    853 /** @name SUP_IOCTL_GIP_UNMAP
    854  * Unmap the GIP.
    855  * @{
    856  */
    857 #define SUP_IOCTL_GIP_UNMAP                             SUP_CTL_CODE_SIZE(21, SUP_IOCTL_GIP_UNMAP_SIZE)
    858 #define SUP_IOCTL_GIP_UNMAP_SIZE                        sizeof(SUPGIPUNMAP)
    859 #define SUP_IOCTL_GIP_UNMAP_SIZE_IN                     sizeof(SUPGIPUNMAP)
    860 #define SUP_IOCTL_GIP_UNMAP_SIZE_OUT                    sizeof(SUPGIPUNMAP)
    861 typedef struct SUPGIPUNMAP
    862 {
    863     /** The header. */
    864     SUPREQHDR               Hdr;
    865 } SUPGIPUNMAP, *PSUPGIPUNMAP;
    866 /** @} */
    867 
    868 
    869 /** @name SUP_IOCTL_CALL_SERVICE
    870  * Call the a ring-0 service.
    871  *
    872  * @todo    Might have to convert this to a big request, just like
    873  *          SUP_IOCTL_CALL_VMMR0
    874  * @{
    875  */
    876 #define SUP_IOCTL_CALL_SERVICE(cbReq)                   SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq))
    877 #define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)              RT_UOFFSETOF(SUPCALLSERVICE, abReqPkt[cbReq])
    878 #define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq)           SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
    879 #define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq)          SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
    880 typedef struct SUPCALLSERVICE
    881 {
    882     /** The header. */
    883     SUPREQHDR               Hdr;
    884     union
    885     {
    886         struct
    887         {
    888             /** The service name. */
    889             char            szName[28];
    890             /** Which operation to execute. */
    891             uint32_t        uOperation;
    892             /** Argument to use when no request packet is supplied. */
    893             uint64_t        u64Arg;
    894         } In;
    895     } u;
    896     /** The request packet passed to SUP. */
    897     uint8_t                 abReqPkt[1];
    898 } SUPCALLSERVICE, *PSUPCALLSERVICE;
    899 /** @} */
    900 
    901566/** @name SUP_IOCTL_PAGE_ALLOC_EX
    902567 * Allocate memory and map it into kernel and/or user space. The memory is of
    903  * course locked. This is an extended version of SUP_IOCTL_PAGE_ALLOC and the
    904  * result should be freed using SUP_IOCTL_PAGE_FREE.
     568 * course locked. The result should be freed using SUP_IOCTL_PAGE_FREE.
    905569 *
    906570 * @remarks Allocations without a kernel mapping may fail with
    907  *          VERR_NOT_SUPPORTED on some platforms just like with
    908  *          SUP_IOCTL_PAGE_ALLOC.
    909  *
    910  * @{
    911  */
    912 #define SUP_IOCTL_PAGE_ALLOC_EX                         SUP_CTL_CODE_BIG(23)
     571 *          VERR_NOT_SUPPORTED on some platforms.
     572 *
     573 * @{
     574 */
     575#define SUP_IOCTL_PAGE_ALLOC_EX                         SUP_CTL_CODE_BIG(10)
    913576#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)            RT_UOFFSETOF(SUPPAGEALLOCEX, u.Out.aPages[cPages])
    914577#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN                 (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In))
     
    958621 * @{
    959622 */
    960 #define SUP_IOCTL_PAGE_MAP_KERNEL                       SUP_CTL_CODE_SIZE(24, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
     623#define SUP_IOCTL_PAGE_MAP_KERNEL                       SUP_CTL_CODE_SIZE(11, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
    961624#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE                  sizeof(SUPPAGEMAPKERNEL)
    962625#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN               sizeof(SUPPAGEMAPKERNEL)
     
    989652
    990653
     654/** @name SUP_IOCTL_PAGE_PROTECT
     655 * Changes the page level protection of the user and/or kernel mappings of
     656 * memory previously allocated by SUPR0PageAllocEx.
     657 *
     658 * @remarks Not necessarily supported on all platforms.
     659 *
     660 * @{
     661 */
     662#define SUP_IOCTL_PAGE_PROTECT                          SUP_CTL_CODE_SIZE(12, SUP_IOCTL_PAGE_PROTECT_SIZE)
     663#define SUP_IOCTL_PAGE_PROTECT_SIZE                     sizeof(SUPPAGEPROTECT)
     664#define SUP_IOCTL_PAGE_PROTECT_SIZE_IN                  sizeof(SUPPAGEPROTECT)
     665#define SUP_IOCTL_PAGE_PROTECT_SIZE_OUT                 sizeof(SUPPAGEPROTECT)
     666typedef struct SUPPAGEPROTECT
     667{
     668    /** The header. */
     669    SUPREQHDR               Hdr;
     670    union
     671    {
     672        struct
     673        {
     674            /** The pointer of to the previously allocated memory.
     675             * Pass NIL_RTR3PTR if the ring-0 mapping should remain unaffected. */
     676            RTR3PTR         pvR3;
     677            /** The pointer of to the previously allocated memory.
     678             * Pass NIL_RTR0PTR if the ring-0 mapping should remain unaffected. */
     679            RTR0PTR         pvR0;
     680            /** The offset to start changing protection at. */
     681            uint32_t        offSub;
     682            /** Size of the portion that should be changed. */
     683            uint32_t        cbSub;
     684            /** Protection flags, RTMEM_PROT_*. */
     685            uint32_t        fProt;
     686        } In;
     687    } u;
     688} SUPPAGEPROTECT, *PSUPPAGEPROTECT;
     689/** @} */
     690
     691
     692/** @name SUP_IOCTL_PAGE_FREE
     693 * Free memory allocated with SUP_IOCTL_PAGE_ALLOC_EX.
     694 * @{
     695 */
     696#define SUP_IOCTL_PAGE_FREE                             SUP_CTL_CODE_SIZE(13, SUP_IOCTL_PAGE_FREE_SIZE_IN)
     697#define SUP_IOCTL_PAGE_FREE_SIZE                        sizeof(SUPPAGEFREE)
     698#define SUP_IOCTL_PAGE_FREE_SIZE_IN                     sizeof(SUPPAGEFREE)
     699#define SUP_IOCTL_PAGE_FREE_SIZE_OUT                    sizeof(SUPREQHDR)
     700typedef struct SUPPAGEFREE
     701{
     702    /** The header. */
     703    SUPREQHDR               Hdr;
     704    union
     705    {
     706        struct
     707        {
     708            /** Address of memory range to free. */
     709            RTR3PTR         pvR3;
     710        } In;
     711    } u;
     712} SUPPAGEFREE, *PSUPPAGEFREE;
     713/** @} */
     714
     715
     716
     717
     718/** @name SUP_IOCTL_PAGE_LOCK
     719 * Pin down physical pages.
     720 * @{
     721 */
     722#define SUP_IOCTL_PAGE_LOCK                             SUP_CTL_CODE_BIG(14)
     723#define SUP_IOCTL_PAGE_LOCK_SIZE(cPages)                (RT_MAX((size_t)SUP_IOCTL_PAGE_LOCK_SIZE_IN, (size_t)SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages)))
     724#define SUP_IOCTL_PAGE_LOCK_SIZE_IN                     (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In))
     725#define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages)            RT_UOFFSETOF(SUPPAGELOCK, u.Out.aPages[cPages])
     726typedef struct SUPPAGELOCK
     727{
     728    /** The header. */
     729    SUPREQHDR               Hdr;
     730    union
     731    {
     732        struct
     733        {
     734            /** Start of page range. Must be PAGE aligned. */
     735            RTR3PTR         pvR3;
     736            /** The range size given as a page count. */
     737            uint32_t        cPages;
     738        } In;
     739
     740        struct
     741        {
     742            /** Array of pages. */
     743            RTHCPHYS        aPages[1];
     744        } Out;
     745    } u;
     746} SUPPAGELOCK, *PSUPPAGELOCK;
     747/** @} */
     748
     749
     750/** @name SUP_IOCTL_PAGE_UNLOCK
     751 * Unpin physical pages.
     752 * @{ */
     753#define SUP_IOCTL_PAGE_UNLOCK                           SUP_CTL_CODE_SIZE(15, SUP_IOCTL_PAGE_UNLOCK_SIZE)
     754#define SUP_IOCTL_PAGE_UNLOCK_SIZE                      sizeof(SUPPAGEUNLOCK)
     755#define SUP_IOCTL_PAGE_UNLOCK_SIZE_IN                   sizeof(SUPPAGEUNLOCK)
     756#define SUP_IOCTL_PAGE_UNLOCK_SIZE_OUT                  sizeof(SUPREQHDR)
     757typedef struct SUPPAGEUNLOCK
     758{
     759    /** The header. */
     760    SUPREQHDR               Hdr;
     761    union
     762    {
     763        struct
     764        {
     765            /** Start of page range of a range previuosly pinned. */
     766            RTR3PTR         pvR3;
     767        } In;
     768    } u;
     769} SUPPAGEUNLOCK, *PSUPPAGEUNLOCK;
     770/** @} */
     771
     772
     773/** @name SUP_IOCTL_CONT_ALLOC
     774 * Allocate contious memory.
     775 * @{
     776 */
     777#define SUP_IOCTL_CONT_ALLOC                            SUP_CTL_CODE_SIZE(16, SUP_IOCTL_CONT_ALLOC_SIZE)
     778#define SUP_IOCTL_CONT_ALLOC_SIZE                       sizeof(SUPCONTALLOC)
     779#define SUP_IOCTL_CONT_ALLOC_SIZE_IN                    (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPCONTALLOC, u.In))
     780#define SUP_IOCTL_CONT_ALLOC_SIZE_OUT                   sizeof(SUPCONTALLOC)
     781typedef struct SUPCONTALLOC
     782{
     783    /** The header. */
     784    SUPREQHDR               Hdr;
     785    union
     786    {
     787        struct
     788        {
     789            /** The allocation size given as a page count. */
     790            uint32_t        cPages;
     791        } In;
     792
     793        struct
     794        {
     795            /** The address of the ring-0 mapping of the allocated memory. */
     796            RTR0PTR         pvR0;
     797            /** The address of the ring-3 mapping of the allocated memory. */
     798            RTR3PTR         pvR3;
     799            /** The physical address of the allocation. */
     800            RTHCPHYS        HCPhys;
     801        } Out;
     802    } u;
     803} SUPCONTALLOC, *PSUPCONTALLOC;
     804/** @} */
     805
     806
     807/** @name SUP_IOCTL_CONT_FREE Input.
     808 * @{
     809 */
     810/** Free contious memory. */
     811#define SUP_IOCTL_CONT_FREE                             SUP_CTL_CODE_SIZE(17, SUP_IOCTL_CONT_FREE_SIZE)
     812#define SUP_IOCTL_CONT_FREE_SIZE                        sizeof(SUPCONTFREE)
     813#define SUP_IOCTL_CONT_FREE_SIZE_IN                     sizeof(SUPCONTFREE)
     814#define SUP_IOCTL_CONT_FREE_SIZE_OUT                    sizeof(SUPREQHDR)
     815typedef struct SUPCONTFREE
     816{
     817    /** The header. */
     818    SUPREQHDR               Hdr;
     819    union
     820    {
     821        struct
     822        {
     823            /** The ring-3 address of the memory to free. */
     824            RTR3PTR         pvR3;
     825        } In;
     826    } u;
     827} SUPCONTFREE, *PSUPCONTFREE;
     828/** @} */
     829
     830
     831/** @name SUP_IOCTL_GET_PAGING_MODE
     832 * Get the host paging mode.
     833 * @{
     834 */
     835#define SUP_IOCTL_GET_PAGING_MODE                       SUP_CTL_CODE_SIZE(18, SUP_IOCTL_GET_PAGING_MODE_SIZE)
     836#define SUP_IOCTL_GET_PAGING_MODE_SIZE                  sizeof(SUPGETPAGINGMODE)
     837#define SUP_IOCTL_GET_PAGING_MODE_SIZE_IN               sizeof(SUPREQHDR)
     838#define SUP_IOCTL_GET_PAGING_MODE_SIZE_OUT              sizeof(SUPGETPAGINGMODE)
     839typedef struct SUPGETPAGINGMODE
     840{
     841    /** The header. */
     842    SUPREQHDR               Hdr;
     843    union
     844    {
     845        struct
     846        {
     847            /** The paging mode. */
     848            SUPPAGINGMODE   enmMode;
     849        } Out;
     850    } u;
     851} SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;
     852/** @} */
     853
     854
     855/** @name SUP_IOCTL_SET_VM_FOR_FAST
     856 * Set the VM handle for doing fast call ioctl calls.
     857 * @{
     858 */
     859#define SUP_IOCTL_SET_VM_FOR_FAST                       SUP_CTL_CODE_SIZE(19, SUP_IOCTL_SET_VM_FOR_FAST_SIZE)
     860#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE                  sizeof(SUPSETVMFORFAST)
     861#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_IN               sizeof(SUPSETVMFORFAST)
     862#define SUP_IOCTL_SET_VM_FOR_FAST_SIZE_OUT              sizeof(SUPREQHDR)
     863typedef struct SUPSETVMFORFAST
     864{
     865    /** The header. */
     866    SUPREQHDR               Hdr;
     867    union
     868    {
     869        struct
     870        {
     871            /** The ring-0 VM handle (pointer). */
     872            PVMR0           pVMR0;
     873        } In;
     874    } u;
     875} SUPSETVMFORFAST, *PSUPSETVMFORFAST;
     876/** @} */
     877
     878
     879/** @name SUP_IOCTL_GIP_MAP
     880 * Map the GIP into user space.
     881 * @{
     882 */
     883#define SUP_IOCTL_GIP_MAP                               SUP_CTL_CODE_SIZE(20, SUP_IOCTL_GIP_MAP_SIZE)
     884#define SUP_IOCTL_GIP_MAP_SIZE                          sizeof(SUPGIPMAP)
     885#define SUP_IOCTL_GIP_MAP_SIZE_IN                       sizeof(SUPREQHDR)
     886#define SUP_IOCTL_GIP_MAP_SIZE_OUT                      sizeof(SUPGIPMAP)
     887typedef struct SUPGIPMAP
     888{
     889    /** The header. */
     890    SUPREQHDR               Hdr;
     891    union
     892    {
     893        struct
     894        {
     895            /** The physical address of the GIP. */
     896            RTHCPHYS        HCPhysGip;
     897            /** Pointer to the read-only usermode GIP mapping for this session. */
     898            R3PTRTYPE(PSUPGLOBALINFOPAGE)   pGipR3;
     899            /** Pointer to the supervisor mode GIP mapping. */
     900            R0PTRTYPE(PSUPGLOBALINFOPAGE)   pGipR0;
     901        } Out;
     902    } u;
     903} SUPGIPMAP, *PSUPGIPMAP;
     904/** @} */
     905
     906
     907/** @name SUP_IOCTL_GIP_UNMAP
     908 * Unmap the GIP.
     909 * @{
     910 */
     911#define SUP_IOCTL_GIP_UNMAP                             SUP_CTL_CODE_SIZE(21, SUP_IOCTL_GIP_UNMAP_SIZE)
     912#define SUP_IOCTL_GIP_UNMAP_SIZE                        sizeof(SUPGIPUNMAP)
     913#define SUP_IOCTL_GIP_UNMAP_SIZE_IN                     sizeof(SUPGIPUNMAP)
     914#define SUP_IOCTL_GIP_UNMAP_SIZE_OUT                    sizeof(SUPGIPUNMAP)
     915typedef struct SUPGIPUNMAP
     916{
     917    /** The header. */
     918    SUPREQHDR               Hdr;
     919} SUPGIPUNMAP, *PSUPGIPUNMAP;
     920/** @} */
     921
     922
     923/** @name SUP_IOCTL_CALL_SERVICE
     924 * Call the a ring-0 service.
     925 *
     926 * @todo    Might have to convert this to a big request, just like
     927 *          SUP_IOCTL_CALL_VMMR0
     928 * @{
     929 */
     930#define SUP_IOCTL_CALL_SERVICE(cbReq)                   SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq))
     931#define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)              RT_UOFFSETOF(SUPCALLSERVICE, abReqPkt[cbReq])
     932#define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq)           SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
     933#define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq)          SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
     934typedef struct SUPCALLSERVICE
     935{
     936    /** The header. */
     937    SUPREQHDR               Hdr;
     938    union
     939    {
     940        struct
     941        {
     942            /** The service name. */
     943            char            szName[28];
     944            /** Which operation to execute. */
     945            uint32_t        uOperation;
     946            /** Argument to use when no request packet is supplied. */
     947            uint64_t        u64Arg;
     948        } In;
     949    } u;
     950    /** The request packet passed to SUP. */
     951    uint8_t                 abReqPkt[1];
     952} SUPCALLSERVICE, *PSUPCALLSERVICE;
     953/** @} */
     954
     955
    991956/** @name SUP_IOCTL_LOGGER_SETTINGS
    992957 * Changes the ring-0 release or debug logger settings.
    993958 * @{
    994959 */
    995 #define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab)             SUP_CTL_CODE_SIZE(25, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
     960#define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab)             SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
    996961#define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab)        RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
    997962#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab)     RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
     
    10471012 * @{
    10481013 */
    1049 #define SUP_IOCTL_SEM_CREATE                            SUP_CTL_CODE_SIZE(26, SUP_IOCTL_SEM_CREATE_SIZE)
     1014#define SUP_IOCTL_SEM_CREATE                            SUP_CTL_CODE_SIZE(24, SUP_IOCTL_SEM_CREATE_SIZE)
    10501015#define SUP_IOCTL_SEM_CREATE_SIZE                       sizeof(SUPSEMCREATE)
    10511016#define SUP_IOCTL_SEM_CREATE_SIZE_IN                    sizeof(SUPSEMCREATE)
     
    10771042 * @{
    10781043 */
    1079 #define SUP_IOCTL_SEM_OP                                SUP_CTL_CODE_SIZE(27, SUP_IOCTL_SEM_OP_SIZE)
     1044#define SUP_IOCTL_SEM_OP                                SUP_CTL_CODE_SIZE(25, SUP_IOCTL_SEM_OP_SIZE)
    10801045#define SUP_IOCTL_SEM_OP_SIZE                           sizeof(SUPSEMOP)
    10811046#define SUP_IOCTL_SEM_OP_SIZE_IN                        sizeof(SUPSEMOP)
     
    11131078
    11141079
    1115 /** @name SUP_IOCTL_PAGE_PROTECT
    1116  * Changes the page level protection of the user and/or kernel mappings of
    1117  * memory previously allocated by SUPR0PageAllocEx.
    1118  *
    1119  * @remarks Not necessarily supported on all platforms.
    1120  *
    1121  * @{
    1122  */
    1123 #define SUP_IOCTL_PAGE_PROTECT                          SUP_CTL_CODE_SIZE(28, SUP_IOCTL_PAGE_PROTECT_SIZE)
    1124 #define SUP_IOCTL_PAGE_PROTECT_SIZE                     sizeof(SUPPAGEPROTECT)
    1125 #define SUP_IOCTL_PAGE_PROTECT_SIZE_IN                  sizeof(SUPPAGEPROTECT)
    1126 #define SUP_IOCTL_PAGE_PROTECT_SIZE_OUT                 sizeof(SUPPAGEPROTECT)
    1127 typedef struct SUPPAGEPROTECT
    1128 {
    1129     /** The header. */
    1130     SUPREQHDR               Hdr;
    1131     union
    1132     {
    1133         struct
    1134         {
    1135             /** The pointer of to the previously allocated memory.
    1136              * Pass NIL_RTR3PTR if the ring-0 mapping should remain unaffected. */
    1137             RTR3PTR         pvR3;
    1138             /** The pointer of to the previously allocated memory.
    1139              * Pass NIL_RTR0PTR if the ring-0 mapping should remain unaffected. */
    1140             RTR0PTR         pvR0;
    1141             /** The offset to start changing protection at. */
    1142             uint32_t        offSub;
    1143             /** Size of the portion that should be changed. */
    1144             uint32_t        cbSub;
    1145             /** Protection flags, RTMEM_PROT_*. */
    1146             uint32_t        fProt;
    1147         } In;
    1148     } u;
    1149 } SUPPAGEPROTECT, *PSUPPAGEPROTECT;
    1150 /** @} */
    1151 
    1152 
    11531080#pragma pack()                          /* paranoia */
    11541081
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r20791 r20860  
    125125
    126126/** The negotiated cookie. */
    127 uint32_t            g_u32Cookie = 0;
     127uint32_t                        g_u32Cookie = 0;
    128128/** The negotiated session cookie. */
    129 uint32_t            g_u32SessionCookie;
     129uint32_t                        g_u32SessionCookie;
    130130/** Session handle. */
    131 PSUPDRVSESSION      g_pSession;
     131PSUPDRVSESSION                  g_pSession;
    132132/** R0 SUP Functions used for resolving referenced to the SUPR0 module. */
    133 static PSUPQUERYFUNCS g_pFunctions;
     133static PSUPQUERYFUNCS           g_pFunctions;
    134134
    135135/** VMMR0 Load Address. */
    136 static RTR0PTR      g_pvVMMR0 = NIL_RTR0PTR;
     136static RTR0PTR                  g_pvVMMR0 = NIL_RTR0PTR;
    137137/** PAGE_ALLOC_EX sans kernel mapping support indicator. */
    138 static bool         g_fSupportsPageAllocNoKernel = true;
     138static bool                     g_fSupportsPageAllocNoKernel = true;
    139139/** Fake mode indicator. (~0 at first, 0 or 1 after first test) */
    140 static uint32_t     g_u32FakeMode = ~0;
     140static uint32_t                 g_u32FakeMode = ~0;
    141141
    142142
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrvA-win.asm

    r20528 r20860  
    7272NtWrapDyn2DrvFunctionWithAllRegParams  supdrvNtWrap, SUPR0MemGetPhys
    7373NtWrapDyn2DrvFunctionWithAllRegParams  supdrvNtWrap, SUPR0MemFree
    74 NtWrapDyn2DrvFunctionWithAllRegParams  supdrvNtWrap, SUPR0PageAlloc
     74NtWrapDyn2DrvFunctionWith6Params       supdrvNtWrap, SUPR0PageAllocEx
    7575NtWrapDyn2DrvFunctionWithAllRegParams  supdrvNtWrap, SUPR0PageFree
    7676;NtWrapDyn2DrvFunctionWithAllRegParams  supdrvNtWrap, SUPR0Printf            - cannot wrap this buster.
Note: See TracChangeset for help on using the changeset viewer.

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