VirtualBox

Changeset 49813 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 6, 2013 1:41:50 PM (11 years ago)
Author:
vboxsync
Message:

DevPCNet: register a dummy MMIO2 region to be compatible to old saved states but drop it later

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r49809 r49813  
    5555#include <VBox/vmm/pdmnetifs.h>
    5656#include <VBox/vmm/pgm.h>
     57#include <VBox/version.h>
    5758#include <iprt/asm.h>
    5859#include <iprt/assert.h>
     
    403404    bool                                fAm79C973;
    404405    /* Link speed to be reported through CSR68. */
    405     bool                                Alignment5;
     406    bool                                fSharedRegion;
    406407    /* Alignment padding. */
    407408    uint32_t                            u32LinkSpeed;
     
    39143915
    39153916
    3916 /**
    3917  * @callback_method_impl{FNPCIIOREGIONMAP, VBox specific MMIO2 interface.}
    3918  */
    3919 static DECLCALLBACK(int) pcnetMMIOSharedMap(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion,
    3920                                             RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType)
    3921 {
    3922     if (GCPhysAddress != NIL_RTGCPHYS)
    3923         return PDMDevHlpMMIO2Map(pPciDev->pDevIns, iRegion, GCPhysAddress);
    3924 
    3925     /* nothing to clean up */
    3926     return VINF_SUCCESS;
    3927 }
    3928 
    3929 
    39303917/* -=-=-=-=-=- Debug Info Handler -=-=-=-=-=- */
    39313918
     
    42594246
    42604247/**
    4261  * @callback_method_impl{FNSSMDEVLOADPREP,
     4248 * @callback_method_impl{FNSSMDEVLOADPREP},
    42624249 *      Serializes the receive thread, it may be working inside the critsect.}
    42634250 */
     
    42684255    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
    42694256    AssertRC(rc);
     4257
     4258    uint32_t uVer = SSMR3HandleVersion(pSSM);
     4259    if (    uVer  < VBOX_FULL_VERSION_MAKE(4, 3,  6)
     4260        || (   uVer >= VBOX_FULL_VERSION_MAKE(4, 3, 51)
     4261            && uVer <  VBOX_FULL_VERSION_MAKE(4, 3, 53)))
     4262    {
     4263        /* older saved states contain the shared memory region which was never used for ages. */
     4264        void *pvSharedMMIOR3;
     4265        rc = PDMDevHlpMMIO2Register(pDevIns, 2, _512K, 0, (void **)&pvSharedMMIOR3, "PCNetSh");
     4266        if (RT_FAILURE(rc))
     4267            rc = PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     4268                                     N_("Failed to allocate the dummy shmem region for the PCNet device"));
     4269        pThis->fSharedRegion = true;
     4270    }
    42704271    PDMCritSectLeave(&pThis->CritSect);
    42714272
    4272     return VINF_SUCCESS;
     4273    return rc;
    42734274}
    42744275
     
    43774378}
    43784379
     4380/**
     4381 * @callback_method_impl{FNSSMDEVLOADDONE}
     4382 */
     4383static DECLCALLBACK(int) pcnetLoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     4384{
     4385    PPCNETSTATE pThis = PDMINS_2_DATA(pDevIns, PPCNETSTATE);
     4386    int rc = VINF_SUCCESS;
     4387    if (pThis->fSharedRegion)
     4388    {
     4389        /* drop this dummy region */
     4390        rc = PDMDevHlpMMIO2Deregister(pDevIns, 2);
     4391        pThis->fSharedRegion = false;
     4392    }
     4393    return rc;
     4394}
    43794395
    43804396/* -=-=-=-=-=- PCNETSTATE::INetworkDown -=-=-=-=-=- */
     
    49564972        return rc;
    49574973
    4958     /** XXX remove! */
    4959 #define PCNET_GUEST_SHARED_MEMORY_SIZE _512K
    4960     void *pvSharedMMIOR3;
    4961     rc = PDMDevHlpMMIO2Register(pDevIns, 2, PCNET_GUEST_SHARED_MEMORY_SIZE, 0, (void **)&pvSharedMMIOR3, "PCNetSh");
    4962     if (RT_FAILURE(rc))
    4963         return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
    4964                                    N_("Failed to allocate %u bytes of memory for the PCNet device"),
    4965                                    PCNET_GUEST_SHARED_MEMORY_SIZE);
    4966 
    49674974#ifdef PCNET_NO_POLLING
    49684975    /*
     
    50015008                                NULL,          pcnetLiveExec, NULL,
    50025009                                pcnetSavePrep, pcnetSaveExec, NULL,
    5003                                 pcnetLoadPrep, pcnetLoadExec, NULL);
     5010                                pcnetLoadPrep, pcnetLoadExec, pcnetLoadDone);
    50045011    if (RT_FAILURE(rc))
    50055012        return rc;
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