Changeset 20860 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Jun 23, 2009 5:31:45 PM (16 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r20528 r20860 142 142 static int supdrvIOCtl_LoggerSettings(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLOGGERSETTINGS pReq); 143 143 static SUPGIPMODE supdrvGipDeterminTscMode(PSUPDRVDEVEXT pDevExt); 144 #ifdef RT_OS_WINDOWS145 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 */148 144 static int supdrvGipCreate(PSUPDRVDEVEXT pDevExt); 149 145 static void supdrvGipDestroy(PSUPDRVDEVEXT pDevExt); … … 178 174 DECLASM(int) UNWIND_WRAP(SUPR0MemGetPhys)(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages); 179 175 DECLASM(int) UNWIND_WRAP(SUPR0MemFree)(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr); 180 DECLASM(int) UNWIND_WRAP(SUPR0PageAlloc )(PSUPDRVSESSION pSession, uint32_t cPages, PRTR3PTR ppvR3, PRTHCPHYS paPages);176 DECLASM(int) UNWIND_WRAP(SUPR0PageAllocEx)(PSUPDRVSESSION pSession, uint32_t cPages, uint32_t fFlags, PRTR3PTR ppvR3, PRTR0PTR ppvR0, PRTHCPHYS paPages); 181 177 DECLASM(int) UNWIND_WRAP(SUPR0PageFree)(PSUPDRVSESSION pSession, RTR3PTR pvR3); 182 178 //DECLASM(int) UNWIND_WRAP(SUPR0Printf)(const char *pszFormat, ...); … … 333 329 { "SUPR0MemGetPhys", (void *)UNWIND_WRAP(SUPR0MemGetPhys) }, 334 330 { "SUPR0MemFree", (void *)UNWIND_WRAP(SUPR0MemFree) }, 335 { "SUPR0PageAlloc ", (void *)UNWIND_WRAP(SUPR0PageAlloc) },331 { "SUPR0PageAllocEx", (void *)UNWIND_WRAP(SUPR0PageAllocEx) }, 336 332 { "SUPR0PageFree", (void *)UNWIND_WRAP(SUPR0PageFree) }, 337 333 { "SUPR0Printf", (void *)SUPR0Printf }, /** @todo needs wrapping? */ … … 1255 1251 } 1256 1252 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 1280 1253 case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_LOCK): 1281 1254 { … … 1531 1504 pSession->pVM = pReq->u.In.pVMR0; 1532 1505 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);1547 1506 return 0; 1548 1507 } … … 2337 2296 } 2338 2297 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 #endif2345 2346 2298 /* 2347 2299 * Let IPRT do the job. … … 2389 2341 LogFlow(("SUPR0UnlockMem: pSession=%p pvR3=%p\n", pSession, (void *)pvR3)); 2390 2342 AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER); 2391 #ifdef RT_OS_WINDOWS2392 /*2393 * Temporary hack for windows - SUPR0PageFree will unlock SUPR0PageAlloc2394 * 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 #endif2402 2343 return supdrvMemRelease(pSession, (RTHCUINTPTR)pvR3, MEMREF_TYPE_LOCKED); 2403 2344 } … … 2709 2650 2710 2651 /** 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 using2714 * 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 /**2730 2652 * Allocates a chunk of memory with a kernel or/and a user mode mapping. 2731 2653 * … … 2985 2907 2986 2908 } 2987 2988 2989 2990 #ifdef RT_OS_WINDOWS2991 /**2992 * Check if the pages were locked by SUPR0PageAlloc2993 *2994 * This function will be removed along with the lock/unlock hacks when2995 * we've cleaned up the ring-3 code properly.2996 *2997 * @returns boolean2998 * @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_PAGE3019 && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ3020 && pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ3021 && 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 when3038 * 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 paPages3044 * @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_PAGE3064 && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ3065 && pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ3066 && 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 */3083 2909 3084 2910 -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r20528 r20860 192 192 * 193 193 * @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 199 197 200 198 /** SUP_IOCTL_COOKIE. */ … … 272 270 273 271 274 /** @name SUP_IOCTL_IDT_INSTALL275 * 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 SUPIDTINSTALL283 {284 /** The header. */285 SUPREQHDR Hdr;286 union287 {288 struct289 {290 /** The IDT entry number. */291 uint8_t u8Idt;292 } Out;293 } u;294 } SUPIDTINSTALL, *PSUPIDTINSTALL;295 /** @} */296 297 298 /** @name SUP_IOCTL_IDT_REMOVE299 * 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 SUPIDTREMOVE307 {308 /** The header. */309 SUPREQHDR Hdr;310 } SUPIDTREMOVE, *PSUPIDTREMOVE;311 /** @}*/312 313 314 272 /** @name SUP_IOCTL_LDR_OPEN 315 273 * Open an image. 316 274 * @{ 317 275 */ 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) 319 277 #define SUP_IOCTL_LDR_OPEN_SIZE sizeof(SUPLDROPEN) 320 278 #define SUP_IOCTL_LDR_OPEN_SIZE_IN sizeof(SUPLDROPEN) … … 351 309 * @{ 352 310 */ 353 #define SUP_IOCTL_LDR_LOAD SUP_CTL_CODE_BIG( 6)311 #define SUP_IOCTL_LDR_LOAD SUP_CTL_CODE_BIG(4) 354 312 #define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_UOFFSETOF(SUPLDRLOAD, u.In.achImage[cbImage]) 355 313 #define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage) RT_UOFFSETOF(SUPLDRLOAD, u.In.achImage[cbImage]) … … 464 422 * @{ 465 423 */ 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) 467 425 #define SUP_IOCTL_LDR_FREE_SIZE sizeof(SUPLDRFREE) 468 426 #define SUP_IOCTL_LDR_FREE_SIZE_IN sizeof(SUPLDRFREE) … … 488 446 * @{ 489 447 */ 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) 491 449 #define SUP_IOCTL_LDR_GET_SYMBOL_SIZE sizeof(SUPLDRGETSYMBOL) 492 450 #define SUP_IOCTL_LDR_GET_SYMBOL_SIZE_IN sizeof(SUPLDRGETSYMBOL) … … 521 479 * @{ 522 480 */ 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)) 524 482 #define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) RT_UOFFSETOF(SUPCALLVMMR0, abReqPkt[cbReq]) 525 483 #define SUP_IOCTL_CALL_VMMR0_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) … … 553 511 * @{ 554 512 */ 555 #define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG( 10)513 #define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG(8) 556 514 #define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_UOFFSETOF(SUPLOWALLOC, u.Out.aPages[cPages])) 557 515 #define SUP_IOCTL_LOW_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In)) … … 586 544 * @{ 587 545 */ 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) 589 547 #define SUP_IOCTL_LOW_FREE_SIZE sizeof(SUPLOWFREE) 590 548 #define SUP_IOCTL_LOW_FREE_SIZE_IN sizeof(SUPLOWFREE) … … 606 564 607 565 608 /** @name SUP_IOCTL_PAGE_ALLOC609 * 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 SUPPAGEALLOC618 {619 /** The header. */620 SUPREQHDR Hdr;621 union622 {623 struct624 {625 /** Number of pages to allocate */626 uint32_t cPages;627 } In;628 struct629 {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_FREE641 * 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 SUPPAGEFREE649 {650 /** The header. */651 SUPREQHDR Hdr;652 union653 {654 struct655 {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_LOCK665 * 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 SUPPAGELOCK673 {674 /** The header. */675 SUPREQHDR Hdr;676 union677 {678 struct679 {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 struct687 {688 /** Array of pages. */689 RTHCPHYS aPages[1];690 } Out;691 } u;692 } SUPPAGELOCK, *PSUPPAGELOCK;693 /** @} */694 695 696 /** @name SUP_IOCTL_PAGE_UNLOCK697 * 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 SUPPAGEUNLOCK704 {705 /** The header. */706 SUPREQHDR Hdr;707 union708 {709 struct710 {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_ALLOC720 * 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 SUPCONTALLOC728 {729 /** The header. */730 SUPREQHDR Hdr;731 union732 {733 struct734 {735 /** The allocation size given as a page count. */736 uint32_t cPages;737 } In;738 739 struct740 {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 SUPCONTFREE762 {763 /** The header. */764 SUPREQHDR Hdr;765 union766 {767 struct768 {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_MODE778 * 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 SUPGETPAGINGMODE786 {787 /** The header. */788 SUPREQHDR Hdr;789 union790 {791 struct792 {793 /** The paging mode. */794 SUPPAGINGMODE enmMode;795 } Out;796 } u;797 } SUPGETPAGINGMODE, *PSUPGETPAGINGMODE;798 /** @} */799 800 801 /** @name SUP_IOCTL_SET_VM_FOR_FAST802 * 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 SUPSETVMFORFAST810 {811 /** The header. */812 SUPREQHDR Hdr;813 union814 {815 struct816 {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_MAP826 * 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 SUPGIPMAP834 {835 /** The header. */836 SUPREQHDR Hdr;837 union838 {839 struct840 {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_UNMAP854 * 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 SUPGIPUNMAP862 {863 /** The header. */864 SUPREQHDR Hdr;865 } SUPGIPUNMAP, *PSUPGIPUNMAP;866 /** @} */867 868 869 /** @name SUP_IOCTL_CALL_SERVICE870 * Call the a ring-0 service.871 *872 * @todo Might have to convert this to a big request, just like873 * SUP_IOCTL_CALL_VMMR0874 * @{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 SUPCALLSERVICE881 {882 /** The header. */883 SUPREQHDR Hdr;884 union885 {886 struct887 {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 901 566 /** @name SUP_IOCTL_PAGE_ALLOC_EX 902 567 * 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. 905 569 * 906 570 * @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) 913 576 #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) RT_UOFFSETOF(SUPPAGEALLOCEX, u.Out.aPages[cPages]) 914 577 #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In)) … … 958 621 * @{ 959 622 */ 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) 961 624 #define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE sizeof(SUPPAGEMAPKERNEL) 962 625 #define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN sizeof(SUPPAGEMAPKERNEL) … … 989 652 990 653 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) 666 typedef 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) 700 typedef 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]) 726 typedef 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) 757 typedef 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) 781 typedef 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) 815 typedef 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) 839 typedef 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) 863 typedef 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) 887 typedef 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) 915 typedef 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) 934 typedef 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 991 956 /** @name SUP_IOCTL_LOGGER_SETTINGS 992 957 * Changes the ring-0 release or debug logger settings. 993 958 * @{ 994 959 */ 995 #define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab) SUP_CTL_CODE_SIZE(2 5, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))960 #define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab) SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab)) 996 961 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab) RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab]) 997 962 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab) RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab]) … … 1047 1012 * @{ 1048 1013 */ 1049 #define SUP_IOCTL_SEM_CREATE SUP_CTL_CODE_SIZE(2 6, SUP_IOCTL_SEM_CREATE_SIZE)1014 #define SUP_IOCTL_SEM_CREATE SUP_CTL_CODE_SIZE(24, SUP_IOCTL_SEM_CREATE_SIZE) 1050 1015 #define SUP_IOCTL_SEM_CREATE_SIZE sizeof(SUPSEMCREATE) 1051 1016 #define SUP_IOCTL_SEM_CREATE_SIZE_IN sizeof(SUPSEMCREATE) … … 1077 1042 * @{ 1078 1043 */ 1079 #define SUP_IOCTL_SEM_OP SUP_CTL_CODE_SIZE(2 7, SUP_IOCTL_SEM_OP_SIZE)1044 #define SUP_IOCTL_SEM_OP SUP_CTL_CODE_SIZE(25, SUP_IOCTL_SEM_OP_SIZE) 1080 1045 #define SUP_IOCTL_SEM_OP_SIZE sizeof(SUPSEMOP) 1081 1046 #define SUP_IOCTL_SEM_OP_SIZE_IN sizeof(SUPSEMOP) … … 1113 1078 1114 1079 1115 /** @name SUP_IOCTL_PAGE_PROTECT1116 * Changes the page level protection of the user and/or kernel mappings of1117 * 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 SUPPAGEPROTECT1128 {1129 /** The header. */1130 SUPREQHDR Hdr;1131 union1132 {1133 struct1134 {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 1153 1080 #pragma pack() /* paranoia */ 1154 1081 -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r20791 r20860 125 125 126 126 /** The negotiated cookie. */ 127 uint32_t g_u32Cookie = 0;127 uint32_t g_u32Cookie = 0; 128 128 /** The negotiated session cookie. */ 129 uint32_t g_u32SessionCookie;129 uint32_t g_u32SessionCookie; 130 130 /** Session handle. */ 131 PSUPDRVSESSION g_pSession;131 PSUPDRVSESSION g_pSession; 132 132 /** R0 SUP Functions used for resolving referenced to the SUPR0 module. */ 133 static PSUPQUERYFUNCS g_pFunctions;133 static PSUPQUERYFUNCS g_pFunctions; 134 134 135 135 /** VMMR0 Load Address. */ 136 static RTR0PTR g_pvVMMR0 = NIL_RTR0PTR;136 static RTR0PTR g_pvVMMR0 = NIL_RTR0PTR; 137 137 /** PAGE_ALLOC_EX sans kernel mapping support indicator. */ 138 static bool g_fSupportsPageAllocNoKernel = true;138 static bool g_fSupportsPageAllocNoKernel = true; 139 139 /** Fake mode indicator. (~0 at first, 0 or 1 after first test) */ 140 static uint32_t g_u32FakeMode = ~0;140 static uint32_t g_u32FakeMode = ~0; 141 141 142 142 -
trunk/src/VBox/HostDrivers/Support/win/SUPDrvA-win.asm
r20528 r20860 72 72 NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0MemGetPhys 73 73 NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0MemFree 74 NtWrapDyn2DrvFunctionWith AllRegParams supdrvNtWrap, SUPR0PageAlloc74 NtWrapDyn2DrvFunctionWith6Params supdrvNtWrap, SUPR0PageAllocEx 75 75 NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0PageFree 76 76 ;NtWrapDyn2DrvFunctionWithAllRegParams supdrvNtWrap, SUPR0Printf - cannot wrap this buster.
Note:
See TracChangeset
for help on using the changeset viewer.