VirtualBox

Changeset 14590 in vbox


Ignore:
Timestamp:
Nov 25, 2008 6:47:55 PM (16 years ago)
Author:
vboxsync
Message:

MMR3HyperAllocOnceNoRel converted to SUPR3PageAllocEx.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/MMHyper.cpp

    r14589 r14590  
    784784    AssertReturn(cbAligned >= cb, VERR_INVALID_PARAMETER);
    785785    uint32_t const  cPages = cb >> PAGE_SHIFT;
    786     int             rc;
    787     void           *pv;
    788     RTR0PTR         pvR0 = NIL_RTR0PTR;
    789 #if 0
    790     PSUPPAGE        paPages = NULL;
    791     rc = SUPPageAlloc(cbAligned >> PAGE_SHIFT, &pv); /** @todo #1865: heap allocation must be changed for osx (only). */
    792 #else /**@todo resume here. */
    793786    PSUPPAGE        paPages = (PSUPPAGE)MMR3HeapAlloc(pVM, MM_TAG_MM, cPages * sizeof(paPages[0]));
    794787    if (!paPages)
    795788        return VERR_NO_MEMORY;
    796     rc = SUPR3PageAllocEx(cPages,
    797                           0 /*fFlags*/,
    798                           &pv,
    799                           VMMIsHwVirtExtForced(pVM) ? &pvR0 : NULL,
    800                           paPages);
    801 #endif
     789    void           *pv;
     790    RTR0PTR         pvR0 = NIL_RTR0PTR;
     791    int rc = SUPR3PageAllocEx(cPages,
     792                              0 /*fFlags*/,
     793                              &pv,
     794                              VMMIsHwVirtExtForced(pVM) ? &pvR0 : NULL,
     795                              paPages);
    802796    if (RT_SUCCESS(rc))
    803797    {
     
    839833        return VINF_SUCCESS;
    840834    }
    841     AssertMsgFailed(("SUPPageAlloc(%d,) -> %Rrc\n", cbAligned >> PAGE_SHIFT, rc));
     835    AssertMsgFailed(("SUPR3PageAllocEx(%d,,,,) -> %Rrc\n", cbAligned >> PAGE_SHIFT, rc));
    842836
    843837    *ppHeap = NULL;
     
    945939
    946940    /*
    947      * Allocate the pages and the HMA space.
     941     * Allocate the pages and map them into HMA space.
    948942     */
    949943    cb = RT_ALIGN(cb, PAGE_SIZE);
    950     void *pvPages;
    951     int rc = SUPPageAlloc(cb >> PAGE_SHIFT, &pvPages);
     944    uint32_t const  cPages = cb >> PAGE_SHIFT;
     945    PSUPPAGE        paPages = (PSUPPAGE)RTMemTmpAlloc(cPages * sizeof(paPages[0]));
     946    if (!paPages)
     947        return VERR_NO_TMP_MEMORY;
     948    void           *pvPages;
     949    RTR0PTR         pvR0 = NIL_RTR0PTR;
     950    int rc = SUPR3PageAllocEx(cPages,
     951                              0 /*fFlags*/,
     952                              &pvPages,
     953                              VMMIsHwVirtExtForced(pVM) ? &pvR0 : NULL,
     954                              paPages);
    952955    if (RT_SUCCESS(rc))
    953956    {
     957        if (!VMMIsHwVirtExtForced(pVM))
     958            pvR0 = (uintptr_t)pvPages;
     959        memset(pvPages, 0, cb);
     960
    954961        RTGCPTR GCPtr;
    955         rc = MMR3HyperMapHCRam(pVM, pvPages, cb, true,
     962        rc = MMR3HyperMapPages(pVM,
     963                               pvPages,
     964                               pvR0,
     965                               cPages,
     966                               paPages,
    956967                               MMR3HeapAPrintf(pVM, MM_TAG_MM, "alloc once (%s)", mmR3GetTagName(enmTag)),
    957968                               &GCPtr);
     
    964975        }
    965976        AssertMsgFailed(("Failed to allocate %zd bytes! %Rrc\n", cb, rc));
    966         SUPPageFree(pvPages, cb >> PAGE_SHIFT);
     977        SUPR3PageFreeEx(pvPages, cPages);
     978
    967979
    968980        /*
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