Changeset 23610 in vbox for trunk/src/VBox/Additions/common/VBoxGuestLib
- Timestamp:
- Oct 7, 2009 9:22:10 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 53284
- Location:
- trunk/src/VBox/Additions/common/VBoxGuestLib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/HGCMInternal.cpp
r21778 r23610 47 47 /** Linux needs to use bounce buffers since RTR0MemObjLockUser has unwanted 48 48 * side effects. */ 49 # define USE_BOUNC H_BUFFERS49 # define USE_BOUNCE_BUFFERS 50 50 #endif 51 51 … … 64 64 uint32_t iParm; 65 65 RTR0MEMOBJ hObj; 66 #ifdef USE_BOUNC H_BUFFERS66 #ifdef USE_BOUNCE_BUFFERS 67 67 void *pvSmallBuf; 68 68 #endif … … 274 274 if (cb != 0) 275 275 { 276 #ifdef USE_BOUNC H_BUFFERS276 #ifdef USE_BOUNCE_BUFFERS 277 277 void *pvSmallBuf = NULL; 278 278 #endif … … 280 280 RTR0MEMOBJ hObj; 281 281 int rc; 282 uint32_t fAccess = pSrcParm->type == VMMDevHGCMParmType_LinAddr_In 283 || pSrcParm->type == VMMDevHGCMParmType_LinAddr_Locked_In 284 ? RTMEM_PROT_READ 285 : RTMEM_PROT_READ | RTMEM_PROT_WRITE; 282 286 283 287 AssertReturn(iLockBuf < RT_ELEMENTS(pParmInfo->aLockBufs), VERR_INVALID_PARAMETER); … … 286 290 AssertMsgReturn(cb <= VBGLR0_MAX_HGCM_KERNEL_PARM, ("%#x > %#x\n", cb, VBGLR0_MAX_HGCM_KERNEL_PARM), 287 291 VERR_OUT_OF_RANGE); 288 rc = RTR0MemObjLockKernel(&hObj, (void *)pSrcParm->u.Pointer.u.linearAddr, cb );292 rc = RTR0MemObjLockKernel(&hObj, (void *)pSrcParm->u.Pointer.u.linearAddr, cb, fAccess); 289 293 if (RT_FAILURE(rc)) 290 294 { … … 306 310 } 307 311 308 #ifndef USE_BOUNC H_BUFFERS309 rc = RTR0MemObjLockUser(&hObj, (RTR3PTR)pSrcParm->u.Pointer.u.linearAddr, cb, NIL_RTR0PROCESS);312 #ifndef USE_BOUNCE_BUFFERS 313 rc = RTR0MemObjLockUser(&hObj, (RTR3PTR)pSrcParm->u.Pointer.u.linearAddr, cb, fAccess, NIL_RTR0PROCESS); 310 314 if (RT_FAILURE(rc)) 311 315 { … … 317 321 iParm, pSrcParm->type, cb, pSrcParm->u.Pointer.u.linearAddr, hObj)); 318 322 319 #else /* USE_BOUNC H_BUFFERS */323 #else /* USE_BOUNCE_BUFFERS */ 320 324 /* 321 325 * This is a bit massive, but we don't want to waste a … … 347 351 } 348 352 } 349 rc = RTR0MemObjLockKernel(&hObj, pvSmallBuf, cb );353 rc = RTR0MemObjLockKernel(&hObj, pvSmallBuf, cb, fAccess); 350 354 if (RT_FAILURE(rc)) 351 355 { … … 380 384 iParm, pSrcParm->type, cb, pSrcParm->u.Pointer.u.linearAddr, hObj)); 381 385 } 382 #endif /* USE_BOUNC H_BUFFERS */386 #endif /* USE_BOUNCE_BUFFERS */ 383 387 } 384 388 385 389 pParmInfo->aLockBufs[iLockBuf].iParm = iParm; 386 390 pParmInfo->aLockBufs[iLockBuf].hObj = hObj; 387 #ifdef USE_BOUNC H_BUFFERS391 #ifdef USE_BOUNCE_BUFFERS 388 392 pParmInfo->aLockBufs[iLockBuf].pvSmallBuf = pvSmallBuf; 389 393 #endif … … 541 545 if (pSrcParm->u.Pointer.size != 0) 542 546 { 543 #ifdef USE_BOUNC H_BUFFERS547 #ifdef USE_BOUNCE_BUFFERS 544 548 void *pvSmallBuf = pParmInfo->aLockBufs[iLockBuf].pvSmallBuf; 545 549 #endif … … 557 561 pDstParm->u.PageList.offset = offExtra; 558 562 pDstPgLst->flags = vbglR0HGCMInternalLinAddrTypeToPageListFlags(pSrcParm->type); 559 #ifdef USE_BOUNC H_BUFFERS563 #ifdef USE_BOUNCE_BUFFERS 560 564 if (fIsUser) 561 565 pDstPgLst->offFirstPage = (uintptr_t)pvSmallBuf & PAGE_OFFSET_MASK; … … 576 580 pDstParm->type = vbglR0HGCMInternalConvertLinAddrType(pSrcParm->type); 577 581 pDstParm->u.Pointer.size = pSrcParm->u.Pointer.size; 578 #ifdef USE_BOUNC H_BUFFERS582 #ifdef USE_BOUNCE_BUFFERS 579 583 if (fIsUser) 580 584 pDstParm->u.Pointer.u.linearAddr = pvSmallBuf … … 749 753 HGCMFunctionParameter *pDstParm = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo); 750 754 uint32_t cParms = pCallInfo->cParms; 751 #ifdef USE_BOUNC H_BUFFERS755 #ifdef USE_BOUNCE_BUFFERS 752 756 uint32_t iLockBuf = 0; 753 757 #endif … … 777 781 case VMMDevHGCMParmType_LinAddr_Locked_In: 778 782 case VMMDevHGCMParmType_LinAddr_In: 779 #ifdef USE_BOUNC H_BUFFERS783 #ifdef USE_BOUNCE_BUFFERS 780 784 if ( fIsUser 781 785 && iLockBuf < pParmInfo->cLockBufs … … 798 802 case VMMDevHGCMParmType_LinAddr: 799 803 { 800 #ifdef USE_BOUNC H_BUFFERS804 #ifdef USE_BOUNCE_BUFFERS 801 805 if (fIsUser) 802 806 { … … 830 834 } 831 835 832 #ifdef USE_BOUNC H_BUFFERS836 #ifdef USE_BOUNCE_BUFFERS 833 837 Assert(!fIsUser || pParmInfo->cLockBufs == iLockBuf); 834 838 #endif … … 904 908 { 905 909 RTR0MemObjFree(ParmInfo.aLockBufs[ParmInfo.cLockBufs].hObj, false /*fFreeMappings*/); 906 #ifdef USE_BOUNC H_BUFFERS910 #ifdef USE_BOUNCE_BUFFERS 907 911 RTMemTmpFree(ParmInfo.aLockBufs[ParmInfo.cLockBufs].pvSmallBuf); 908 912 #endif -
trunk/src/VBox/Additions/common/VBoxGuestLib/SysHlp.cpp
r21412 r23610 100 100 * know they aren't pagable. 101 101 */ 102 RTR0MEMOBJ MemObj = NIL_RTR0MEMOBJ; 102 RTR0MEMOBJ MemObj = NIL_RTR0MEMOBJ; 103 uint32_t fAccess = RTMEM_PROT_READ | (fWriteAccess ? RTMEM_PROT_WRITE : 0); 103 104 if ((fFlags & VBGLR0_HGCMCALL_F_MODE_MASK) == VBGLR0_HGCMCALL_F_USER) 104 rc = RTR0MemObjLockUser(&MemObj, (RTR3PTR)pv, u32Size, NIL_RTR0PROCESS);105 rc = RTR0MemObjLockUser(&MemObj, (RTR3PTR)pv, u32Size, fAccess, NIL_RTR0PROCESS); 105 106 else 106 rc = RTR0MemObjLockKernel(&MemObj, pv, u32Size );107 rc = RTR0MemObjLockKernel(&MemObj, pv, u32Size, fAccess); 107 108 if (RT_SUCCESS(rc)) 108 109 *ppvCtx = MemObj;
Note:
See TracChangeset
for help on using the changeset viewer.