Changeset 7772 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Apr 7, 2008 2:05:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r7769 r7772 193 193 /** If set the link is temporarily down because of a saved state load. */ 194 194 bool fLinkTempDown; 195 /** This flag is set on SavePrep to prevent altering of memory after pgmR3Save() was called196 * @todo r=bird: This is inadequate, we are not supposed to do anything at all while the VM197 * isn't running. Naturally, the problem really lies with the driver and not198 * the pcnet code. We will have to address this properly at some time. */199 bool fSaving;200 195 201 196 /** Number of times we've reported the link down. */ … … 203 198 /** The configured MAC address. */ 204 199 PDMMAC MacConfigured; 200 /** Alignment padding. */ 201 uint8_t Alignment4[HC_ARCH_BITS == 64 ? 6 : 2]; 205 202 206 203 /** The LED. */ … … 4023 4020 4024 4021 /** 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. 4027 4023 * 4028 4024 * @returns VBox status code. … … 4036 4032 int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY); 4037 4033 AssertRC(rc); 4038 4039 pData->fSaving = true;4040 /* From now on drop all received packets to prevent altering of main memory after4041 * pgmR3Save() was called but before the RX thread is terminated */4042 4043 4034 PDMCritSectLeave(&pData->CritSect); 4035 4044 4036 return VINF_SUCCESS; 4045 4037 } … … 4088 4080 4089 4081 /** 4090 * Cleanup after saving.4082 * Serializes the receive thread, it may be working inside the critsect. 4091 4083 * 4092 4084 * @returns VBox status code. … … 4094 4086 * @param pSSMHandle The handle to save the state to. 4095 4087 */ 4096 static DECLCALLBACK(int) pcnet SaveDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)4088 static DECLCALLBACK(int) pcnetLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle) 4097 4089 { 4098 4090 PCNetState *pData = PDMINS2DATA(pDevIns, PCNetState *); … … 4100 4092 int rc = PDMCritSectEnter(&pData->CritSect, VERR_SEM_BUSY); 4101 4093 AssertRC(rc); 4102 pData->fSaving = false;4103 4094 PDMCritSectLeave(&pData->CritSect); 4095 4104 4096 return VINF_SUCCESS; 4105 4097 } … … 4274 4266 AssertReleaseRC(rc); 4275 4267 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; 4284 4272 4285 4273 PDMCritSectLeave(&pData->CritSect); … … 4684 4672 return rc; 4685 4673 } 4686 /** @todo r=bird: we're not locking down pcnet properly during saving and loading! */4687 4674 rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 4688 4675 PCNET_SAVEDSTATE_VERSION, sizeof(*pData), 4689 pcnetSavePrep, pcnetSaveExec, pcnetSaveDone,4690 NULL, pcnetLoadExec, NULL);4676 pcnetSavePrep, pcnetSaveExec, NULL, 4677 pcnetLoadPrep, pcnetLoadExec, NULL); 4691 4678 if (VBOX_FAILURE(rc)) 4692 4679 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.