VirtualBox

Changeset 30948 in vbox


Ignore:
Timestamp:
Jul 21, 2010 11:27:40 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63836
Message:

PGMSavedState: Apply zero page detection to teleportation as well as normal saving. Avoid goto and corrected the comment.

File:
1 edited

Legend:

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

    r30744 r30948  
    15961596                        if (RT_SUCCESS(rc))
    15971597                        {
    1598                             /* Skip allocated pages that are zero. */
    1599                             if (    !fLiveSave
    1600                                 &&  ASMMemIsZeroPage(pvPage))
    1601                             {
    1602                                 fZero = true;
    1603                                 goto save_zero_page;
    1604                             }
    1605 
    16061598                            memcpy(abPage, pvPage, PAGE_SIZE);
    16071599#ifdef PGMLIVESAVERAMPAGE_WITH_CRC32
     
    16131605                        AssertLogRelMsgRCReturn(rc, ("rc=%Rrc GCPhys=%RGp\n", rc, GCPhys), rc);
    16141606
    1615                         if (GCPhys == GCPhysLast + PAGE_SIZE)
    1616                             SSMR3PutU8(pSSM, PGM_STATE_REC_RAM_RAW);
     1607                        /* Try save some memory when restoring. */
     1608                        if (!ASMMemIsZeroPage(pvPage))
     1609                        {
     1610                            if (GCPhys == GCPhysLast + PAGE_SIZE)
     1611                                SSMR3PutU8(pSSM, PGM_STATE_REC_RAM_RAW);
     1612                            else
     1613                            {
     1614                                SSMR3PutU8(pSSM, PGM_STATE_REC_RAM_RAW | PGM_STATE_REC_FLAG_ADDR);
     1615                                SSMR3PutGCPhys(pSSM, GCPhys);
     1616                            }
     1617                            rc = SSMR3PutMem(pSSM, abPage, PAGE_SIZE);
     1618                        }
    16171619                        else
    16181620                        {
    1619                             SSMR3PutU8(pSSM, PGM_STATE_REC_RAM_RAW | PGM_STATE_REC_FLAG_ADDR);
    1620                             SSMR3PutGCPhys(pSSM, GCPhys);
     1621                            if (GCPhys == GCPhysLast + PAGE_SIZE)
     1622                                rc = SSMR3PutU8(pSSM, PGM_STATE_REC_RAM_ZERO);
     1623                            else
     1624                            {
     1625                                SSMR3PutU8(pSSM, PGM_STATE_REC_RAM_ZERO | PGM_STATE_REC_FLAG_ADDR);
     1626                                rc = SSMR3PutGCPhys(pSSM, GCPhys);
     1627                            }
    16211628                        }
    1622                         rc = SSMR3PutMem(pSSM, abPage, PAGE_SIZE);
    16231629                    }
    16241630                    else
    16251631                    {
    1626 save_zero_page:
    16271632                        /*
    16281633                         * Dirty zero page.
     
    26012606                            ||  PGM_PAGE_IS_BALLOONED(pPage))
    26022607                            break;
    2603                         AssertLogRelMsgReturn(PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ALLOCATED, ("GCPhys=%RGp %R[pgmpage]\n", GCPhys, pPage), VERR_INTERNAL_ERROR_5); 
     2608                        AssertLogRelMsgReturn(PGM_PAGE_GET_STATE(pPage) == PGM_PAGE_STATE_ALLOCATED, ("GCPhys=%RGp %R[pgmpage]\n", GCPhys, pPage), VERR_INTERNAL_ERROR_5);
    26042609                        /* Allocated before (prealloc), so free it now. */
    26052610                        rc = pgmPhysFreePage(pVM, pReq, &cPendingPages, pPage, GCPhys);
Note: See TracChangeset for help on using the changeset viewer.

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