VirtualBox

Changeset 14592 in vbox for trunk/src/VBox/VMM/PGMPhys.cpp


Ignore:
Timestamp:
Nov 25, 2008 8:05:50 PM (16 years ago)
Author:
vboxsync
Message:

PGMR3PhysRegister: Use MMR3HyperAllocOnceNoRel instead of muching about with SUPPageAlloc and doing it own its own. Made MMR3HyperAllocOnceNoRel install a fence page after each mapping.

File:
1 edited

Legend:

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

    r14589 r14592  
    674674    PSUPPAGE paPages = (PSUPPAGE)RTMemTmpAlloc(cPages * sizeof(SUPPAGE));
    675675    if (RT_SUCCESS(rc))
    676         rc = SUPPageAllocLockedEx(cPages, &pvPages, paPages);
     676        rc = SUPR3PageAllocEx(cPages, 0 /*fFlags*/, &pvPages, NULL /*pR0Ptr*/, paPages);
    677677    if (RT_SUCCESS(rc))
    678678    {
     
    723723        }
    724724
    725         SUPPageFreeLocked(pvPages, cPages);
     725        SUPR3PageFreeEx(pvPages, cPages);
    726726    }
    727727    RTMemTmpFree(paPages);
     
    787787             * Free the memory.
    788788             */
    789             int rc2 = SUPPageFreeLocked(pCur->pvR3, pCur->RamRange.cb >> PAGE_SHIFT);
     789            int rc2 = SUPR3PageFreeEx(pCur->pvR3, pCur->RamRange.cb >> PAGE_SHIFT);
    790790            AssertRC(rc2);
    791791            if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
     
    17271727    size_t          cbRam = RT_OFFSETOF(PGMRAMRANGE, aPages[cb >> PAGE_SHIFT]);
    17281728    PPGMRAMRANGE    pNew;
    1729     RTRCPTR         RCPtrNew;
    17301729    int             rc = VERR_NO_MEMORY;
    17311730    if (cbRam > PAGE_SIZE / 2)
    17321731    {   /* large */
    17331732        cbRam = RT_ALIGN_Z(cbRam, PAGE_SIZE);
    1734         rc = SUPPageAlloc(cbRam >> PAGE_SHIFT, (void **)&pNew);
    1735         if (RT_SUCCESS(rc))
    1736         {
    1737             RTGCPTR GCPtrNew;
    1738             rc = MMR3HyperMapHCRam(pVM, pNew, cbRam, true,
    1739                                    MMR3HeapAPrintf(pVM, MM_TAG_PGM_PHYS, "ram range (%s)", pszDesc),
    1740                                    &GCPtrNew);
    1741             if (RT_SUCCESS(rc))
    1742             {
    1743                 RCPtrNew = GCPtrNew;
    1744                 Assert(MMHyperR3ToRC(pVM, pNew) == GCPtrNew && RCPtrNew == GCPtrNew);
    1745                 rc = MMR3HyperReserve(pVM, PAGE_SIZE, "fence", NULL);
    1746             }
    1747             else
    1748             {
    1749                 AssertMsgFailed(("MMR3HyperMapHCRam(,,%#x,,,) -> %Rrc\n", cbRam, rc));
    1750                 SUPPageFree(pNew, cbRam >> PAGE_SHIFT);
    1751             }
    1752         }
    1753         else
    1754             AssertMsgFailed(("SUPPageAlloc(%#x,,) -> %Rrc\n", cbRam >> PAGE_SHIFT, rc));
    1755 
    1756     }
    1757 /** @todo Make VGA and VMMDev register their memory at init time before the hma size is fixated. */
    1758     if (RT_FAILURE(rc))
    1759     {   /* small + fallback (vga) */
     1733        rc = MMR3HyperAllocOnceNoRel(pVM, cbRam, PAGE_SIZE, MM_TAG_PGM_PHYS, (void **)&pNew);
     1734        AssertMsgRC(rc, ("MMR3HyperAllocOnceNoRel(,%#x,,) -> %Rrc\n", cbRam, rc));
     1735    }
     1736    else
     1737    {   /* small */
    17601738        rc = MMHyperAlloc(pVM, cbRam, 16, MM_TAG_PGM, (void **)&pNew);
    1761         if (RT_SUCCESS(rc))
    1762             RCPtrNew = MMHyperR3ToRC(pVM, pNew);
    1763         else
    1764             AssertMsgFailed(("MMHyperAlloc(,%#x,,,) -> %Rrc\n", cbRam, cb));
     1739        AssertMsgRC(rc, ("MMHyperAlloc(,%#x,,,) -> %Rrc\n", cbRam, rc));
    17651740    }
    17661741    if (RT_SUCCESS(rc))
     
    18221797            pPrev->pNextR3 = pNew;
    18231798            pPrev->pNextR0 = MMHyperCCToR0(pVM, pNew);
    1824             pPrev->pNextRC = RCPtrNew;
     1799            pPrev->pNextRC = MMHyperCCToRC(pVM, pNew);
    18251800        }
    18261801        else
     
    18281803            pVM->pgm.s.pRamRangesR3 = pNew;
    18291804            pVM->pgm.s.pRamRangesR0 = MMHyperCCToR0(pVM, pNew);
    1830             pVM->pgm.s.pRamRangesRC = RCPtrNew;
     1805            pVM->pgm.s.pRamRangesRC = MMHyperCCToRC(pVM, pNew);
    18311806        }
    18321807        pgmUnlock(pVM);
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