VirtualBox

Changeset 9063 in vbox for trunk/src/VBox/Runtime/r0drv


Ignore:
Timestamp:
May 23, 2008 8:50:12 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
31160
Message:

Workaround for #2833.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp

    r8245 r9063  
    249249    int rc = VERR_NO_CONT_MEMORY;
    250250    AssertCompile(sizeof(IOPhysicalAddress) == 4);
     251
     252    /// @todo
     253    // Use IOBufferMemoryDescriptor::inTaskWithPhysicalMask(kernel_task, kIOMemoryKernelUserShared | kIODirectionInOut,
     254    //                                                      cb, (_4G - 1) ^ PAGE_OFFSET_MASK);
     255#if 1 /* seems to work fine for cb == PAGE_SIZE, the other variant doesn't. */
     256    IOPhysicalAddress PhysAddrIgnored = 0;
     257    void *pv = IOMallocContiguous(cb, PAGE_SIZE, &PhysAddrIgnored);
     258#else
    251259    void *pv = IOMallocContiguous(cb, PAGE_SIZE, NULL);
     260#endif
    252261    if (pv)
    253262    {
     
    278287            else
    279288            {
     289                printf("rtR0MemObjNativeAllocCont: PhysAddr=%llx cb=%#x\n", (unsigned long long)PhysAddr, cb);
    280290                AssertMsgFailed(("PhysAddr=%llx\n", (unsigned long long)PhysAddr));
    281291                rc = VERR_INTERNAL_ERROR;
     
    287297        IOFreeContiguous(pv, cb);
    288298    }
     299
     300    /*
     301     * Workaround for odd IOMallocContiguous behavior, just in case.
     302     */
     303    if (rc == VERR_INTERNAL_ERROR && cb <= PAGE_SIZE)
     304        rc = rtR0MemObjNativeAllocCont(ppMem, cb + PAGE_SIZE, fExecutable);
    289305    return rc;
    290306}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette