Changeset 22508 in vbox
- Timestamp:
- Aug 27, 2009 11:38:33 AM (15 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/linux
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
r22355 r22508 239 239 cPages = cb >> PAGE_SHIFT; 240 240 cOrder = CalcPowerOf2Order(cPages); 241 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32) 242 paPages = alloc_pages(GFP_DMA32, cOrder); 243 if (!paPages) 244 #endif 241 245 #ifdef RT_ARCH_AMD64 242 /** @todo check out if there is a correct way of getting memory below 4GB (physically). 243 * GFP_DMA32 is available since Linux 2.6.15 */ 244 paPages = alloc_pages(GFP_DMA, cOrder); 246 paPages = alloc_pages(GFP_DMA, cOrder); 245 247 #else 246 /** XXX Wrong: GFP_USER can return page frames above 4GB! */ 247 paPages = alloc_pages(GFP_USER, cOrder); 248 # if defined(CONFIG_X86_PAE) 249 /** GFP_USER can return page frames above 4GB on PAE systems => GFP_DMA? */ 250 # endif 251 paPages = alloc_pages(GFP_USER, cOrder); 248 252 #endif 249 253 if (paPages) -
trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
r22355 r22508 524 524 int rc; 525 525 526 #ifdef RT_ARCH_AMD64 527 # ifdef GFP_DMA32526 /* Try to avoid GFP_DMA. GFM_DMA32 was introduced with Linux 2.6.15. */ 527 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32) 528 528 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, GFP_DMA32, false /* non-contiguous */); 529 529 if (RT_FAILURE(rc)) 530 # endif 530 #endif 531 #ifdef RT_ARCH_AMD64 531 532 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, GFP_DMA, false /* non-contiguous */); 532 533 #else 533 /** XXX Wrong: GFP_USER can return page frames above 4GB! */ 534 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, GFP_USER, false /* non-contiguous */); 534 # ifdef CONFIG_X86_PAE 535 /** XXX GFP_USER can return page frames above 4GB on PAE systems => GFP_DMA? */ 536 # endif 537 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, GFP_USER, false /* non-contiguous */); 535 538 #endif 536 539 if (RT_SUCCESS(rc)) … … 556 559 int rc; 557 560 558 #ifdef RT_ARCH_AMD64 559 # ifdef GFP_DMA32 561 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32) 560 562 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, GFP_DMA32, true /* contiguous */); 561 563 if (RT_FAILURE(rc)) 562 # endif 564 #endif 565 #ifdef RT_ARCH_AMD64 563 566 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, GFP_DMA, true /* contiguous */); 564 567 #else 565 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, GFP_USER, true /* contiguous */); 568 # if defined(CONFIG_X86_PAE) 569 /** XXX GFP_USER can return page frames above 4GB on PAE systems => GFP_DMA? */ 570 # endif 571 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, GFP_USER, true /* contiguous */); 566 572 #endif 567 573 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.