Changeset 39744 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jan 10, 2012 6:15:04 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75626
- Location:
- trunk/src/VBox/Runtime/r0drv
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
r36555 r39744 508 508 } 509 509 510 rc = VERR_NO_MEMORY; 510 if (enmType == RTR0MEMOBJTYPE_PHYS_NC) 511 rc = VERR_NO_PHYS_MEMORY; 512 else if (enmType == RTR0MEMOBJTYPE_LOW) 513 rc = VERR_NO_LOW_MEMORY; 514 else if (enmType == RTR0MEMOBJTYPE_CONT) 515 rc = VERR_NO_CONT_MEMORY; 516 else 517 rc = VERR_NO_MEMORY; 511 518 } 512 519 else -
trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
r39657 r39744 45 45 #include "internal/memobj.h" 46 46 47 47 48 /******************************************************************************* 48 49 * Structures and Typedefs * … … 62 63 MALLOC_DEFINE(M_IPRTMOBJ, "iprtmobj", "IPRT - R0MemObj"); 63 64 65 64 66 /** 65 67 * Gets the virtual memory map the specified object is mapped into. … … 112 114 case RTR0MEMOBJTYPE_LOW: 113 115 case RTR0MEMOBJTYPE_CONT: 114 {115 116 rc = vm_map_remove(kernel_map, 116 117 (vm_offset_t)pMemFreeBSD->Core.pv, … … 118 119 AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); 119 120 break; 120 }121 121 122 122 case RTR0MEMOBJTYPE_LOCK: … … 223 223 static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages, 224 224 vm_paddr_t VmPhysAddrHigh, u_long uAlignment, 225 bool fContiguous, bool fWire )225 bool fContiguous, bool fWire, int rcNoMem) 226 226 { 227 227 if (fContiguous) … … 230 230 uAlignment, fWire) != NULL) 231 231 return VINF_SUCCESS; 232 else 233 return VERR_NO_MEMORY; 232 return rcNoMem; 234 233 } 235 234 … … 252 251 } 253 252 VM_OBJECT_UNLOCK(pObject); 254 return VERR_NO_MEMORY;253 return rcNoMem; 255 254 } 256 255 } … … 259 258 260 259 static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFREEBSD pMemFreeBSD, bool fExecutable, 261 vm_paddr_t VmPhysAddrHigh, bool fContiguous )260 vm_paddr_t VmPhysAddrHigh, bool fContiguous, int rcNoMem) 262 261 { 263 262 int rc; … … 275 274 { 276 275 rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, 277 VmPhysAddrHigh, PAGE_SIZE, fContiguous, false); 278 if (RT_SUCCESS(rc)) { 276 VmPhysAddrHigh, PAGE_SIZE, fContiguous, 277 false, rcNoMem); 278 if (RT_SUCCESS(rc)) 279 { 279 280 vm_map_wire(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb, 280 281 VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); … … 287 288 vm_map_remove(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb); 288 289 } 289 rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */290 rc = rcNoMem; /** @todo fix translation (borrow from darwin) */ 290 291 291 292 vm_object_deallocate(pMemFreeBSD->pObject); … … 300 301 return VERR_NO_MEMORY; 301 302 302 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false );303 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false, VERR_NO_MEMORY); 303 304 if (RT_FAILURE(rc)) 304 305 { … … 319 320 return VERR_NO_MEMORY; 320 321 321 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, false );322 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, false, VERR_NO_LOW_MEMORY); 322 323 if (RT_FAILURE(rc)) 323 324 { … … 338 339 return VERR_NO_MEMORY; 339 340 340 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, true );341 int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, true, VERR_NO_CONT_MEMORY); 341 342 if (RT_FAILURE(rc)) 342 343 { … … 354 355 size_t cb, 355 356 RTHCPHYS PhysHighest, size_t uAlignment, 356 bool fContiguous )357 bool fContiguous, int rcNoMem) 357 358 { 358 359 uint32_t cPages = atop(cb); … … 373 374 374 375 int rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, 375 uAlignment, fContiguous, true); 376 377 if (RT_FAILURE(rc)) { 378 vm_object_deallocate(pMemFreeBSD->pObject); 379 rtR0MemObjDelete(&pMemFreeBSD->Core); 380 } 381 else 376 uAlignment, fContiguous, true, rcNoMem); 377 if (RT_SUCCESS(rc)) 382 378 { 383 379 if (fContiguous) … … 392 388 *ppMem = &pMemFreeBSD->Core; 393 389 } 390 else 391 { 392 vm_object_deallocate(pMemFreeBSD->pObject); 393 rtR0MemObjDelete(&pMemFreeBSD->Core); 394 } 394 395 395 396 return rc; … … 399 400 DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) 400 401 { 401 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true );402 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true, VERR_NO_MEMORY); 402 403 } 403 404 … … 405 406 DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) 406 407 { 407 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false );408 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false, VERR_NO_PHYS_MEMORY); 408 409 } 409 410 … … 497 498 * The pvFixed address range must be within the VM space when specified. 498 499 */ 499 if ( pvFixed != (void *)-1500 if ( pvFixed != (void *)-1 500 501 && ( (vm_offset_t)pvFixed < vm_map_min(pMap) 501 502 || (vm_offset_t)pvFixed + cb > vm_map_max(pMap))) -
trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
r39705 r39744 180 180 * @param fFlagsLnx The page allocation flags (GPFs). 181 181 * @param fContiguous Whether the allocation must be contiguous. 182 * @param rcNoMem What to return when we're out of pages. 182 183 */ 183 184 static int rtR0MemObjLinuxAllocPages(PRTR0MEMOBJLNX *ppMemLnx, RTR0MEMOBJTYPE enmType, size_t cb, 184 size_t uAlignment, unsigned fFlagsLnx, bool fContiguous )185 size_t uAlignment, unsigned fFlagsLnx, bool fContiguous, int rcNoMem) 185 186 { 186 187 size_t iPage; … … 231 232 { 232 233 rtR0MemObjDelete(&pMemLnx->Core); 233 return VERR_NO_MEMORY;234 return rcNoMem; 234 235 } 235 236 } … … 245 246 __free_page(pMemLnx->apPages[iPage]); 246 247 rtR0MemObjDelete(&pMemLnx->Core); 247 return VERR_NO_MEMORY;248 return rcNoMem; 248 249 } 249 250 } … … 256 257 { 257 258 rtR0MemObjDelete(&pMemLnx->Core); 258 return VERR_NO_MEMORY;259 return rcNoMem; 259 260 } 260 261 for (iPage = 0; iPage < cPages; iPage++) … … 295 296 (unsigned long)cb, (unsigned long)uAlignment, rtR0MemObjLinuxOrder(cPages), (unsigned long)page_to_phys(pMemLnx->apPages[0])); 296 297 rtR0MemObjLinuxFreePages(pMemLnx); 297 return VERR_NO_MEMORY;298 return rcNoMem; 298 299 } 299 300 } … … 541 542 542 543 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22) 543 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER, false /* non-contiguous */); 544 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER, 545 false /* non-contiguous */, VERR_NO_MEMORY); 544 546 #else 545 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_USER, false /* non-contiguous */); 547 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_USER, 548 false /* non-contiguous */, VERR_NO_MEMORY); 546 549 #endif 547 550 if (RT_SUCCESS(rc)) … … 570 573 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32) 571 574 /* ZONE_DMA32: 0-4GB */ 572 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA32, false /* non-contiguous */); 575 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA32, 576 false /* non-contiguous */, VERR_NO_LOW_MEMORY); 573 577 if (RT_FAILURE(rc)) 574 578 #endif 575 579 #ifdef RT_ARCH_AMD64 576 580 /* ZONE_DMA: 0-16MB */ 577 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA, false /* non-contiguous */); 581 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA, 582 false /* non-contiguous */, VERR_NO_LOW_MEMORY); 578 583 #else 579 584 # ifdef CONFIG_X86_PAE 580 585 # endif 581 586 /* ZONE_NORMAL: 0-896MB */ 582 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_USER, false /* non-contiguous */); 587 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_USER, 588 false /* non-contiguous */, VERR_NO_LOW_MEMORY); 583 589 #endif 584 590 if (RT_SUCCESS(rc)) … … 606 612 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32) 607 613 /* ZONE_DMA32: 0-4GB */ 608 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32, true /* contiguous */); 614 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32, 615 true /* contiguous */, VERR_NO_CONT_MEMORY); 609 616 if (RT_FAILURE(rc)) 610 617 #endif 611 618 #ifdef RT_ARCH_AMD64 612 619 /* ZONE_DMA: 0-16MB */ 613 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA, true /* contiguous */); 620 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA, 621 true /* contiguous */, VERR_NO_CONT_MEMORY); 614 622 #else 615 623 /* ZONE_NORMAL (32-bit hosts): 0-896MB */ 616 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER, true /* contiguous */); 624 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER, 625 true /* contiguous */, VERR_NO_CONT_MEMORY); 617 626 #endif 618 627 if (RT_SUCCESS(rc)) … … 658 667 659 668 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, enmType, cb, uAlignment, fGfp, 660 enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */); 669 enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */, 670 VERR_NO_PHYS_MEMORY); 661 671 if (RT_FAILURE(rc)) 662 672 return rc; -
trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
r38958 r39744 273 273 if (rtR0MemObjNativeGetPagePhysAddr(*ppMem, iPage) >= _4G) 274 274 { 275 rc = VERR_NO_ MEMORY;275 rc = VERR_NO_LOW_MEMORY; 276 276 break; 277 277 } -
trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp
r36555 r39744 167 167 } 168 168 rtR0MemObjDelete(&pMemOs2->Core); 169 return RTErrConvertFromOS2(rc); 169 rc = RTErrConvertFromOS2(rc); 170 return rc == VERR_NO_MEMORY ? VERR_NO_LOW_MEMORY : rc; 170 171 } 171 172
Note:
See TracChangeset
for help on using the changeset viewer.