VirtualBox

Changeset 6817 in vbox


Ignore:
Timestamp:
Feb 5, 2008 9:51:06 PM (17 years ago)
Author:
vboxsync
Message:

Fixed to reservation update code.

File:
1 edited

Legend:

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

    r6802 r6817  
    301301                              N_("Insufficient free memory to start the VM (cbRam=%#RX64 enmPolicy=%d enmPriority=%d)"),
    302302                              cbRam, enmPolicy, enmPriority);
    303         return VMSetError(pVM, rc, RT_SRC_POS, "GMMR3InitialReservation(,%#RX64,0,0,%d,%d).",
     303        return VMSetError(pVM, rc, RT_SRC_POS, "GMMR3InitialReservation(,%#RX64,0,0,%d,%d)",
    304304                          cbRam >> PAGE_SHIFT, enmPolicy, enmPriority);
    305305    }
     
    321321    if (RT_SUCCESS(rc) && fPreAlloc)
    322322    {
    323         /** @todo implement RamPreAlloc if it makes sense. */
     323        /** @todo implement RamPreAlloc if it is *really* needed - in PGM preferably. (lazy bird) */
    324324        return VM_SET_ERROR(pVM, VERR_NOT_IMPLEMENTED, "TODO: RamPreAlloc");
    325325    }
     
    548548MMR3DECL(int) MMR3IncreaseBaseReservation(PVM pVM, uint64_t cAddBasePages)
    549549{
    550     LogFlow(("MMR3IncreaseBaseReservation: +%RU64 (%RU64 -> %RU64\n", cAddBasePages,
    551              pVM->mm.s.cBasePages, pVM->mm.s.cBasePages + cAddBasePages));
     550    uint64_t cOld = pVM->mm.s.cBasePages;
    552551    pVM->mm.s.cBasePages += cAddBasePages;
    553     return mmR3UpdateReservation(pVM);
     552    LogFlow(("MMR3IncreaseBaseReservation: +%RU64 (%RU64 -> %RU64\n", cAddBasePages, cOld, pVM->mm.s.cBasePages));
     553    int rc = mmR3UpdateReservation(pVM);
     554    if (RT_FAILURE(rc))
     555    {
     556        VMSetError(pVM, rc, RT_SRC_POS, N_("Failed to reserved physical memory for the RAM (%#RX64 -> %#RX64)"), cOld, pVM->mm.s.cBasePages);
     557        pVM->mm.s.cBasePages = cOld;
     558    }
     559    return rc;
    554560}
    555561
     
    564570 * @param   cAddFixedPages  The number of pages to add.
    565571 */
    566 MMR3DECL(int) MMR3AddFixedReservation(PVM pVM, uint32_t cAddFixedPages)
    567 {
    568     LogFlow(("MMR3AddFixedReservation: +%u (%u -> %u)\n", cAddFixedPages,
    569              pVM->mm.s.cFixedPages, pVM->mm.s.cFixedPages + cAddFixedPages));
     572MMR3DECL(int) MMR3IncreaseFixedReservation(PVM pVM, uint32_t cAddFixedPages)
     573{
     574    const uint32_t cOld = pVM->mm.s.cFixedPages;
    570575    pVM->mm.s.cFixedPages += cAddFixedPages;
    571     return mmR3UpdateReservation(pVM);
     576    LogFlow(("MMR3AddFixedReservation: +%u (%u -> %u)\n", cAddFixedPages, cOld, pVM->mm.s.cFixedPages));
     577    int rc = mmR3UpdateReservation(pVM);
     578    if (RT_FAILURE(rc))
     579    {
     580        VMSetError(pVM, rc, RT_SRC_POS, N_("Failed to reserve physical memory (%#x -> %#x)"), cOld, pVM->mm.s.cFixedPages);
     581        pVM->mm.s.cFixedPages = cOld;
     582    }
     583    return rc;
    572584}
    573585
     
    584596MMR3DECL(int) MMR3UpdateShadowReservation(PVM pVM, uint32_t cShadowPages)
    585597{
    586     LogFlow(("MMR3UpdateShadowReservation: %u -> %u\n", pVM->mm.s.cShadowPages, cShadowPages));
     598    const uint32_t cOld = pVM->mm.s.cShadowPages;
    587599    pVM->mm.s.cShadowPages = cShadowPages;
    588     return mmR3UpdateReservation(pVM);
     600    LogFlow(("MMR3UpdateShadowReservation: %u -> %u\n", cOld, pVM->mm.s.cShadowPages));
     601    int rc = mmR3UpdateReservation(pVM);
     602    if (RT_FAILURE(rc))
     603    {
     604        VMSetError(pVM, rc, RT_SRC_POS, N_("Failed to reserve physical memory for shadow page tables (%#x -> %#x)"), cOld, pVM->mm.s.cShadowPages);
     605        pVM->mm.s.cShadowPages = cOld;
     606    }
     607    return rc;
    589608}
    590609
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