- Timestamp:
- Jan 27, 2007 10:28:29 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/memobj.h
r1 r392 126 126 * @param pv User virtual address. This is rounded down to a page boundrary. 127 127 * @param cb Number of bytes to lock. This is rounded up to nearest page boundrary. 128 * @param R0Process The process to lock pages in. NIL_R0PROCESS is an alias for the current one. 128 129 * 129 130 * @remark RTR0MemObjGetAddress() will return the rounded down address. 130 131 */ 131 RTR0DECL(int) RTR0MemObjLockUser(PRTR0MEMOBJ pMemObj, void *pv, size_t cb );132 RTR0DECL(int) RTR0MemObjLockUser(PRTR0MEMOBJ pMemObj, void *pv, size_t cb, RTR0PROCESS R0Process); 132 133 133 134 /** … … 188 189 * @param uAlignment The alignment of the reserved memory. 189 190 * Supported values are 0 (alias for PAGE_SIZE), PAGE_SIZE, _2M and _4M. 190 */ 191 RTR0DECL(int) RTR0MemObjReserveUser(PRTR0MEMOBJ pMemObj, void *pvFixed, size_t cb, size_t uAlignment); 191 * @param R0Process The process to reserve the memory in. NIL_R0PROCESS is an alias for the current one. 192 */ 193 RTR0DECL(int) RTR0MemObjReserveUser(PRTR0MEMOBJ pMemObj, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process); 192 194 193 195 /** … … 214 216 * Supported values are 0 (alias for PAGE_SIZE), PAGE_SIZE, _2M and _4M. 215 217 * @param fProt Combination of RTMEM_PROT_* flags (except RTMEM_PROT_NONE). 216 */ 217 RTR0DECL(int) RTR0MemObjMapUser(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt); 218 * @param R0Process The process to map the memory into. NIL_R0PROCESS is an alias for the current one. 219 */ 220 RTR0DECL(int) RTR0MemObjMapUser(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process); 218 221 219 222 #endif /* IN_RING0 */ -
trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c
r387 r392 33 33 #include <iprt/spinlock.h> 34 34 #include <iprt/thread.h> 35 #include <iprt/process.h> 35 36 #include <iprt/log.h> 36 37 #ifdef VBOX_WITHOUT_IDT_PATCHING … … 1727 1728 */ 1728 1729 Mem.eType = MEMREF_TYPE_LOCKED; 1729 rc = RTR0MemObjLockUser(&Mem.MemObj, pvR3, cb );1730 rc = RTR0MemObjLockUser(&Mem.MemObj, pvR3, cb, RTR0ProcHandleSelf()); 1730 1731 if (RT_SUCCESS(rc)) 1731 1732 { … … 1832 1833 { 1833 1834 int rc2; 1834 rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (void *)-1, 0, RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ); 1835 rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (void *)-1, 0, 1836 RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf()); 1835 1837 if (RT_SUCCESS(rc)) 1836 1838 { … … 1936 1938 { 1937 1939 int rc2; 1938 rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (void *)-1, 0, RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ); 1940 rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (void *)-1, 0, 1941 RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf()); 1939 1942 if (RT_SUCCESS(rc)) 1940 1943 { … … 2046 2049 { 2047 2050 int rc2; 2048 rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (void*)-1, 0, RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ); 2051 rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (void*)-1, 0, 2052 RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf()); 2049 2053 if (RT_SUCCESS(rc)) 2050 2054 { … … 2220 2224 #ifdef USE_NEW_OS_INTERFACE 2221 2225 if (pSession->GipMapObjR3 == NIL_RTR0MEMOBJ) 2222 rc = RTR0MemObjMapUser(&pSession->GipMapObjR3, pDevExt->GipMemObj, (void*)-1, 0, RTMEM_PROT_READ); 2226 rc = RTR0MemObjMapUser(&pSession->GipMapObjR3, pDevExt->GipMemObj, (void*)-1, 0, 2227 RTMEM_PROT_READ, RTR0ProcHandleSelf()); 2223 2228 if (RT_SUCCESS(rc)) 2224 2229 { -
trunk/src/VBox/Runtime/include/internal/memobj.h
r385 r392 264 264 * @param pv User virtual address, page aligned. 265 265 * @param cb Number of bytes to lock, page aligned. 266 */ 267 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb); 266 * @param R0Process The process to lock pages in. 267 */ 268 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, RTR0PROCESS R0Process); 268 269 269 270 /** … … 317 318 * @param cb The number of bytes to reserve, page aligned. 318 319 * @param uAlignment The alignment of the reserved memory; PAGE_SIZE, _2M or _4M. 319 */ 320 int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment); 320 * @param R0Process The process to reserve the memory in. 321 */ 322 int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process); 321 323 322 324 /** … … 341 343 * @param uAlignment The alignment of the reserved memory; PAGE_SIZE, _2M or _4M. 342 344 * @param fProt Combination of RTMEM_PROT_* flags (except RTMEM_PROT_NONE). 343 */ 344 int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt); 345 * @param R0Process The process to map the memory into. 346 */ 347 int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process); 345 348 346 349 /** -
trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
r385 r392 423 423 424 424 425 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb )426 { 427 return rtR0MemObjNativeLock(ppMem, pv, cb, current_task());425 int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, RTR0PROCESS R0Process) 426 { 427 return rtR0MemObjNativeLock(ppMem, pv, cb, (task_t)R0Process); 428 428 } 429 429 … … 441 441 442 442 443 int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment )443 int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) 444 444 { 445 445 return VERR_NOT_IMPLEMENTED; … … 490 490 491 491 492 int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt )492 int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) 493 493 { 494 494 /* … … 499 499 if (pMemToMapDarwin->pMemDesc) 500 500 { 501 Assert(current_task() != kernel_task); 502 IOMemoryMap *pMemMap = pMemToMapDarwin->pMemDesc->map(current_task(), kIOMapAnywhere, 501 IOMemoryMap *pMemMap = pMemToMapDarwin->pMemDesc->map((task_t)R0Process, kIOMapAnywhere, 503 502 kIOMapAnywhere | kIOMapDefaultCache); 504 503 if (pMemMap) … … 515 514 if (pMemDarwin) 516 515 { 517 pMemDarwin->Core.u.Mapping.R0Process = R TR0ProcHandleSelf();516 pMemDarwin->Core.u.Mapping.R0Process = R0Process; 518 517 pMemDarwin->pMemMap = pMemMap; 519 518 *ppMem = &pMemDarwin->Core; -
trunk/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
r217 r392 27 27 #include <iprt/memobj.h> 28 28 #include <iprt/alloc.h> 29 #include <iprt/process.h> 29 30 #include <iprt/assert.h> 30 31 #include <iprt/err.h> … … 389 390 * @param pv User virtual address. This is rounded down to a page boundrary. 390 391 * @param cb Number of bytes to lock. This is rounded up to nearest page boundrary. 392 * @param R0Process The process to lock pages in. NIL_R0PROCESS is an alias for the current one. 391 393 * 392 394 * @remark RTR0MemObjGetAddress() will return the rounded down address. 393 395 */ 394 RTR0DECL(int) RTR0MemObjLockUser(PRTR0MEMOBJ pMemObj, void *pv, size_t cb )396 RTR0DECL(int) RTR0MemObjLockUser(PRTR0MEMOBJ pMemObj, void *pv, size_t cb, RTR0PROCESS R0Process) 395 397 { 396 398 /* sanity checks. */ … … 401 403 AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER); 402 404 void * const pvAligned = (void *)((uintptr_t)pv & ~(uintptr_t)PAGE_OFFSET_MASK); 405 if (R0Process == NIL_RTR0PROCESS) 406 R0Process = RTR0ProcHandleSelf(); 403 407 404 408 /* do the allocation. */ 405 return rtR0MemObjNativeLockUser(pMemObj, pvAligned, cbAligned );409 return rtR0MemObjNativeLockUser(pMemObj, pvAligned, cbAligned, R0Process); 406 410 } 407 411 … … 522 526 * @param uAlignment The alignment of the reserved memory. 523 527 * Supported values are 0 (alias for PAGE_SIZE), PAGE_SIZE, _2M and _4M. 524 */ 525 RTR0DECL(int) RTR0MemObjReserveUser(PRTR0MEMOBJ pMemObj, void *pvFixed, size_t cb, size_t uAlignment) 528 * @param R0Process The process to reserve the memory in. NIL_R0PROCESS is an alias for the current one. 529 */ 530 RTR0DECL(int) RTR0MemObjReserveUser(PRTR0MEMOBJ pMemObj, void *pvFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) 526 531 { 527 532 /* sanity checks. */ … … 536 541 if (pvFixed != (void *)-1) 537 542 AssertReturn(!((uintptr_t)pvFixed & (uAlignment - 1)), VERR_INVALID_PARAMETER); 543 if (R0Process == NIL_RTR0PROCESS) 544 R0Process = RTR0ProcHandleSelf(); 538 545 539 546 /* do the reservation. */ 540 return rtR0MemObjNativeReserveUser(pMemObj, pvFixed, cbAligned, uAlignment );547 return rtR0MemObjNativeReserveUser(pMemObj, pvFixed, cbAligned, uAlignment, R0Process); 541 548 } 542 549 … … 607 614 * Supported values are 0 (alias for PAGE_SIZE), PAGE_SIZE, _2M and _4M. 608 615 * @param fProt Combination of RTMEM_PROT_* flags (except RTMEM_PROT_NONE). 609 */ 610 RTR0DECL(int) RTR0MemObjMapUser(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt) 616 * @param R0Process The process to map the memory into. NIL_R0PROCESS is an alias for the current one. 617 */ 618 RTR0DECL(int) RTR0MemObjMapUser(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) 611 619 { 612 620 /* sanity checks. */ … … 626 634 AssertReturn(fProt != RTMEM_PROT_NONE, VERR_INVALID_PARAMETER); 627 635 AssertReturn(!(fProt & ~(RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC)), VERR_INVALID_PARAMETER); 628 636 if (R0Process == NIL_RTR0PROCESS) 637 R0Process = RTR0ProcHandleSelf(); 629 638 630 639 /* do the mapping. */ 631 640 PRTR0MEMOBJINTERNAL pNew; 632 int rc = rtR0MemObjNativeMapUser(&pNew, pMemToMap, pvFixed, uAlignment, fProt );641 int rc = rtR0MemObjNativeMapUser(&pNew, pMemToMap, pvFixed, uAlignment, fProt, R0Process); 633 642 if (RT_SUCCESS(rc)) 634 643 {
Note:
See TracChangeset
for help on using the changeset viewer.