Changeset 39744 in vbox for trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
- Timestamp:
- Jan 10, 2012 6:15:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.