Changeset 4132 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Aug 13, 2007 4:11:06 PM (17 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDRV.h
r4071 r4132 28 28 #include <iprt/asm.h> 29 29 #include <VBox/sup.h> 30 #if def USE_NEW_OS_INTERFACE30 #if defined(USE_NEW_OS_INTERFACE) || defined(USB_NEW_OS_INTERFACE_FOR_LOW) 31 31 # include <iprt/memobj.h> 32 32 # include <iprt/time.h> … … 424 424 #endif 425 425 } mem; 426 #if defined(USB_NEW_OS_INTERFACE_FOR_LOW) 427 struct 428 { 429 /** The memory object handle. */ 430 RTR0MEMOBJ MemObj; 431 /** The ring-3 mapping memory object handle. */ 432 RTR0MEMOBJ MapObjR3; 433 } iprt; 434 #endif 426 435 } u; 427 436 #endif /* !USE_NEW_OS_INTERFACE */ -
trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c
r4071 r4132 3863 3863 int VBOXCALL supdrvOSLowAllocOne(PSUPDRVMEMREF pMem, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PSUPPAGE paPagesOut) 3864 3864 { 3865 #if defined(USB_NEW_OS_INTERFACE_FOR_LOW) /* a temp hack */ 3866 int rc = RTR0MemObjAllocLow(&pMem->u.iprt.MemObj, pMem->cb, true /* executable ring-0 mapping */); 3867 if (RT_SUCCESS(rc)) 3868 { 3869 int rc2; 3870 rc = RTR0MemObjMapUser(&pMem->u.iprt.MapObjR3, pMem->u.iprt.MemObj, (void *)-1, 0, 3871 RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf()); 3872 if (RT_SUCCESS(rc)) 3873 { 3874 pMem->eType = MEMREF_TYPE_LOW; 3875 pMem->pvR0 = RTR0MemObjAddress(pMem->u.iprt.MemObj); 3876 pMem->pvR3 = (RTR3PTR)RTR0MemObjAddress(pMem->u.iprt.MapObjR3); 3877 if (!rc) 3878 { 3879 size_t cPages = pMem->cb >> PAGE_SHIFT; 3880 size_t iPage; 3881 for (iPage = 0; iPage < cPages; iPage++) 3882 { 3883 paPagesOut[iPage].Phys = RTR0MemObjGetPagePhysAddr(pMem->u.iprt.MemObj, iPage); 3884 paPagesOut[iPage].uReserved = 0; 3885 AssertMsg(!(paPagesOut[iPage].Phys & (PAGE_SIZE - 1)), ("iPage=%d Phys=%VHp\n", paPagesOut[iPage].Phys)); 3886 } 3887 *ppvR0 = RTR0MemObjAddress(pMem->u.iprt.MemObj); 3888 *ppvR3 = (RTR3PTR)RTR0MemObjAddress(pMem->u.iprt.MapObjR3); 3889 return 0; 3890 } 3891 3892 rc2 = RTR0MemObjFree(pMem->u.iprt.MapObjR3, false); 3893 AssertRC(rc2); 3894 } 3895 3896 rc2 = RTR0MemObjFree(pMem->u.iprt.MemObj, false); 3897 AssertRC(rc2); 3898 } 3899 #else 3865 3900 RTHCPHYS HCPhys; 3866 3901 int rc = supdrvOSContAllocOne(pMem, ppvR0, ppvR3, &HCPhys); … … 3875 3910 } 3876 3911 return rc; 3912 #endif 3877 3913 } 3878 3914 … … 3884 3920 */ 3885 3921 void VBOXCALL supdrvOSLowFreeOne(PSUPDRVMEMREF pMem) 3886 { 3922 { 3923 # if defined(USB_NEW_OS_INTERFACE_FOR_LOW) 3924 if (pMem->u.iprt.MapObjR3) 3925 { 3926 int rc = RTR0MemObjFree(pMem->u.iprt.MapObjR3, false); 3927 AssertRC(rc); /** @todo figure out how to handle this. */ 3928 } 3929 if (pMem->u.iprt.MemObj) 3930 { 3931 int rc = RTR0MemObjFree(pMem->u.iprt.MemObj, false); 3932 AssertRC(rc); /** @todo figure out how to handle this. */ 3933 } 3934 # else 3887 3935 supdrvOSContFreeOne(pMem); 3936 # endif 3888 3937 } 3889 3938 #endif /* !SUPDRV_OS_HAVE_LOW */
Note:
See TracChangeset
for help on using the changeset viewer.