VirtualBox

Changeset 7772 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Apr 7, 2008 2:05:20 PM (17 years ago)
Author:
vboxsync
Message:

Use the new PDMDevHlpVMState, drop the fSaving flag.

File:
1 edited

Legend:

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

    r7769 r7772  
    193193    /** If set the link is temporarily down because of a saved state load. */
    194194    bool                                fLinkTempDown;
    195     /** This flag is set on SavePrep to prevent altering of memory after pgmR3Save() was called
    196      * @todo r=bird: This is inadequate, we are not supposed to do anything at all while the VM
    197      *               isn't running. Naturally, the problem really lies with the driver and not
    198      *               the pcnet code. We will have to address this properly at some time. */
    199     bool                                fSaving;
    200195
    201196    /** Number of times we've reported the link down. */
     
    203198    /** The configured MAC address. */
    204199    PDMMAC                              MacConfigured;
     200    /** Alignment padding. */
     201    uint8_t                             Alignment4[HC_ARCH_BITS == 64 ? 6 : 2];
    205202
    206203    /** The LED. */
     
    40234020
    40244021/**
    4025  * Prepares for state saving.
    4026  * We must stop the RX process to prevent altering of the main memory after saving.
     4022 * Serializes the receive thread, it may be working inside the critsect.
    40274023 *
    40284024 * @returns VBox status code.
     
    40364032    int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY);
    40374033    AssertRC(rc);
    4038 
    4039     pData->fSaving = true;
    4040     /* From now on drop all received packets to prevent altering of main memory after
    4041      * pgmR3Save() was called but before the RX thread is terminated */
    4042 
    40434034    PDMCritSectLeave(&pData->CritSect);
     4035
    40444036    return VINF_SUCCESS;
    40454037}
     
    40884080
    40894081/**
    4090  * Cleanup after saving.
     4082 * Serializes the receive thread, it may be working inside the critsect.
    40914083 *
    40924084 * @returns VBox status code.
     
    40944086 * @param   pSSMHandle  The handle to save the state to.
    40954087 */
    4096 static DECLCALLBACK(int) pcnetSaveDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
     4088static DECLCALLBACK(int) pcnetLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
    40974089{
    40984090    PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *);
     
    41004092    int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY);
    41014093    AssertRC(rc);
    4102     pData->fSaving = false;
    41034094    PDMCritSectLeave(&pData->CritSect);
     4095
    41044096    return VINF_SUCCESS;
    41054097}
     
    42744266    AssertReleaseRC(rc);
    42754267
    4276     if (!pData->fSaving)
    4277     {
    4278         if (cb > 70) /* unqualified guess */
    4279             pData->Led.Asserted.s.fReading = pData->Led.Actual.s.fReading = 1;
    4280         pcnetReceiveNoSync(pData, (const uint8_t *)pvBuf, cb);
    4281         pData->Led.Actual.s.fReading = 0;
    4282     }
    4283     /* otherwise junk the data to Nirwana. */
     4268    if (cb > 70) /* unqualified guess */
     4269        pData->Led.Asserted.s.fReading = pData->Led.Actual.s.fReading = 1;
     4270    pcnetReceiveNoSync(pData, (const uint8_t *)pvBuf, cb);
     4271    pData->Led.Actual.s.fReading = 0;
    42844272
    42854273    PDMCritSectLeave(&pData->CritSect);
     
    46844672        return rc;
    46854673    }
    4686 /** @todo r=bird: we're not locking down pcnet properly during saving and loading! */
    46874674    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance,
    46884675                              PCNET_SAVEDSTATE_VERSION, sizeof(*pData),
    4689                               pcnetSavePrep, pcnetSaveExec, pcnetSaveDone,
    4690                               NULL, pcnetLoadExec, NULL);
     4676                              pcnetSavePrep, pcnetSaveExec, NULL,
     4677                              pcnetLoadPrep, pcnetLoadExec, NULL);
    46914678    if (VBOX_FAILURE(rc))
    46924679        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