Changeset 218 in vbox
- Timestamp:
- Jan 22, 2007 12:35:39 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
r217 r218 61 61 if (pMemDarwin->pMemDesc) 62 62 { 63 if (pMemDarwin->Core.enmType == RTR0MEMOBJTYPE_LOCK) 64 pMemDarwin->pMemDesc->complete(); 63 65 pMemDarwin->pMemDesc->release(); 64 66 pMemDarwin->pMemDesc = NULL; … … 88 90 89 91 case RTR0MEMOBJTYPE_LOCK: 90 AssertMsgFailed(("RTR0MEMOBJTYPE_LOCK\n"));91 return VERR_INTERNAL_ERROR;92 92 break; 93 93 … … 332 332 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb) 333 333 { 334 return VERR_NOT_IMPLEMENTED; 334 Assert(current_task() != kernel_task); 335 int rc = VERR_MEMOBJ_INIT_FAILED; 336 IOMemoryDescriptor *pMemDesc = IOMemoryDescriptor::withAddress((vm_address_t)pv, cb, kIODirectionInOut, current_task()); 337 if (pMemDesc) 338 { 339 IOReturn IORet = pMemDesc->prepare(kIODirectionInOut); 340 if (IORet == kIOReturnSuccess) 341 { 342 /* 343 * Create the IPRT memory object. 344 */ 345 PRTR0MEMOBJDARWIN pMemDarwin = (PRTR0MEMOBJDARWIN)rtR0MemObjNew(sizeof(*pMemDarwin), RTR0MEMOBJTYPE_LOCK, pv, cb); 346 if (pMemDarwin) 347 { 348 pMemDarwin->Core.u.Lock.Process = (RTPROCESS)current_task(); 349 pMemDarwin->pMemDesc = pMemDesc; 350 *ppMem = &pMemDarwin->Core; 351 return VINF_SUCCESS; 352 } 353 354 pMemDesc->complete(); 355 rc = VERR_NO_MEMORY; 356 } 357 else 358 rc = VERR_LOCK_FAILED; 359 pMemDesc->release(); 360 } 361 return rc; 335 362 } 336 363 … … 338 365 int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb) 339 366 { 340 return VERR_NOT_IMPLEMENTED; 367 int rc = VERR_MEMOBJ_INIT_FAILED; 368 IOMemoryDescriptor *pMemDesc = IOMemoryDescriptor::withAddress((vm_address_t)pv, cb, kIODirectionInOut, kernel_task); 369 if (pMemDesc) 370 { 371 IOReturn IORet = pMemDesc->prepare(kIODirectionInOut); 372 if (IORet == kIOReturnSuccess) 373 { 374 /* 375 * Create the IPRT memory object. 376 */ 377 PRTR0MEMOBJDARWIN pMemDarwin = (PRTR0MEMOBJDARWIN)rtR0MemObjNew(sizeof(*pMemDarwin), RTR0MEMOBJTYPE_LOCK, pv, cb); 378 if (pMemDarwin) 379 { 380 pMemDarwin->Core.u.Lock.Process = NIL_RTPROCESS; 381 pMemDarwin->pMemDesc = pMemDesc; 382 *ppMem = &pMemDarwin->Core; 383 return VINF_SUCCESS; 384 } 385 386 pMemDesc->complete(); 387 rc = VERR_NO_MEMORY; 388 } 389 else 390 rc = VERR_LOCK_FAILED; 391 pMemDesc->release(); 392 } 393 return rc; 341 394 } 342 395
Note:
See TracChangeset
for help on using the changeset viewer.