VirtualBox

Changeset 6155 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 19, 2007 3:43:45 PM (17 years ago)
Author:
vboxsync
Message:

PGMPhys: Fixed the error handling when SUPPageAlloc fails in pgmr3PhysGrowRange()

File:
1 edited

Legend:

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

    r5999 r6155  
    411411    Log(("pgmr3PhysGrowRange: allocate chunk of size 0x%X at %VGp\n", PGM_DYNAMIC_CHUNK_SIZE, GCPhys));
    412412
    413     unsigned    cPages = PGM_DYNAMIC_CHUNK_SIZE >> PAGE_SHIFT;
    414     rc = SUPPageAlloc(cPages, &pvRam);
    415     if (VBOX_SUCCESS(rc))
    416     {
     413    unsigned cPages = PGM_DYNAMIC_CHUNK_SIZE >> PAGE_SHIFT;
     414
     415    for (;;)
     416    {
     417        rc = SUPPageAlloc(cPages, &pvRam);
     418        if (VBOX_SUCCESS(rc))
     419        {
     420
     421            rc = MMR3PhysRegisterEx(pVM, pvRam, GCPhys, PGM_DYNAMIC_CHUNK_SIZE, 0, MM_PHYS_TYPE_DYNALLOC_CHUNK, "Main Memory");
     422            if (VBOX_SUCCESS(rc))
     423                return rc;
     424
     425            SUPPageFree(pvRam, cPages);
     426        }
     427
    417428        VMSTATE enmVMState = VMR3GetState(pVM);
    418 
    419         rc = MMR3PhysRegisterEx(pVM, pvRam, GCPhys, PGM_DYNAMIC_CHUNK_SIZE, 0, MM_PHYS_TYPE_DYNALLOC_CHUNK, "Main Memory");
    420         if (    VBOX_SUCCESS(rc)
    421             ||  enmVMState != VMSTATE_RUNNING)
    422         {
    423             if (VBOX_FAILURE(rc))
    424             {
    425                 AssertMsgFailed(("Out of memory while trying to allocate a guest RAM chunk at %VGp!\n", GCPhys));
    426                 LogRel(("PGM: Out of memory while trying to allocate a guest RAM chunk at %VGp (VMstate=%s)!\n", GCPhys, VMR3GetStateName(enmVMState)));
    427             }
     429        if (enmVMState != VMSTATE_RUNNING)
     430        {
     431            AssertMsgFailed(("Out of memory while trying to allocate a guest RAM chunk at %VGp!\n", GCPhys));
     432            LogRel(("PGM: Out of memory while trying to allocate a guest RAM chunk at %VGp (VMstate=%s)!\n", GCPhys, VMR3GetStateName(enmVMState)));
    428433            return rc;
    429434        }
    430 
    431         SUPPageFree(pvRam, cPages);
    432435
    433436        LogRel(("pgmr3PhysGrowRange: out of memory. pause until the user resumes execution.\n"));
     
    444447        /* Retry */
    445448        LogRel(("pgmr3PhysGrowRange: VM execution resumed -> retry.\n"));
    446         return pgmr3PhysGrowRange(pVM, GCPhys);
    447     }
    448     LogRel(("pgmr3PhysGrowRange %VGp SUPPageAlloc %x pages failed with %Vrc\n", GCPhys, cPages, rc));
    449     return rc;
     449    }
    450450}
    451451
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