VirtualBox

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


Ignore:
Timestamp:
Nov 23, 2019 11:42:19 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134948
Message:

DevPCNet: Set up critsect correctly for ring-0/raw-mode too. bugref:9218

File:
1 edited

Legend:

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

    r82137 r82138  
    44294429 * @callback_method_impl{FNSSMDEVLIVEEXEC, Pass 0 only.}
    44304430 */
    4431 static DECLCALLBACK(int) pcnetLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
     4431static DECLCALLBACK(int) pcnetR3LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
    44324432{
    44334433    RT_NOREF(uPass);
     
    44424442 *      Serializes the receive thread, it may be working inside the critsect.}
    44434443 */
    4444 static DECLCALLBACK(int) pcnetSavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     4444static DECLCALLBACK(int) pcnetR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    44454445{
    44464446    RT_NOREF(pSSM);
     
    44584458 * @callback_method_impl{FNSSMDEVSAVEEXEC}
    44594459 */
    4460 static DECLCALLBACK(int) pcnetSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     4460static DECLCALLBACK(int) pcnetR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    44614461{
    44624462    PPCNETSTATE     pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
     
    44954495 *      Serializes the receive thread, it may be working inside the critsect.}
    44964496 */
    4497 static DECLCALLBACK(int) pcnetLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     4497static DECLCALLBACK(int) pcnetR3LoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    44984498{
    44994499    PPCNETSTATE     pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
     
    45254525 * @callback_method_impl{FNSSMDEVLOADEXEC}
    45264526 */
    4527 static DECLCALLBACK(int) pcnetLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
     4527static DECLCALLBACK(int) pcnetR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    45284528{
    45294529    PPCNETSTATE     pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
     
    46294629 * @callback_method_impl{FNSSMDEVLOADDONE}
    46304630 */
    4631 static DECLCALLBACK(int) pcnetLoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     4631static DECLCALLBACK(int) pcnetR3LoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    46324632{
    46334633    RT_NOREF(pSSM);
     
    49114911 * @interface_method_impl{PDMDEVREG,pfnPowerOff}
    49124912 */
    4913 static DECLCALLBACK(void) pcnetPowerOff(PPDMDEVINS pDevIns)
     4913static DECLCALLBACK(void) pcnetR3PowerOff(PPDMDEVINS pDevIns)
    49144914{
    49154915    /* Poke thread waiting for buffer space. */
     
    49234923 * One port on the network card has been disconnected from the network.
    49244924 */
    4925 static DECLCALLBACK(void) pcnetDetach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
     4925static DECLCALLBACK(void) pcnetR3Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
    49264926{
    49274927    RT_NOREF(fFlags);
    49284928    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
    4929     Log(("#%d pcnetDetach:\n", PCNET_INST_NR));
     4929    Log(("#%d pcnetR3Detach:\n", PCNET_INST_NR));
    49304930
    49314931    AssertLogRelReturnVoid(iLUN == 0);
     
    49534953 * One port on the network card has been connected to a network.
    49544954 */
    4955 static DECLCALLBACK(int) pcnetAttach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
     4955static DECLCALLBACK(int) pcnetR3Attach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
    49564956{
    49574957    RT_NOREF(fFlags);
    49584958    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
    4959     LogFlow(("#%d pcnetAttach:\n", PCNET_INST_NR));
     4959    LogFlow(("#%d pcnetR3Attach:\n", PCNET_INST_NR));
    49604960
    49614961    AssertLogRelReturn(iLUN == 0, VERR_PDM_NO_SUCH_LUN);
     
    50005000 * @interface_method_impl{PDMDEVREG,pfnSuspend}
    50015001 */
    5002 static DECLCALLBACK(void) pcnetSuspend(PPDMDEVINS pDevIns)
     5002static DECLCALLBACK(void) pcnetR3Suspend(PPDMDEVINS pDevIns)
    50035003{
    50045004    /* Poke thread waiting for buffer space. */
     
    50105010 * @interface_method_impl{PDMDEVREG,pfnReset}
    50115011 */
    5012 static DECLCALLBACK(void) pcnetReset(PPDMDEVINS pDevIns)
     5012static DECLCALLBACK(void) pcnetR3Reset(PPDMDEVINS pDevIns)
    50135013{
    50145014    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
     
    50285028 * @interface_method_impl{PDMDEVREG,pfnRelocate}
    50295029 */
    5030 static DECLCALLBACK(void) pcnetRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
     5030static DECLCALLBACK(void) pcnetR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
    50315031{
    50325032    RT_NOREF(offDelta);
     
    50425042 * @interface_method_impl{PDMDEVREG,pfnDestruct}
    50435043 */
    5044 static DECLCALLBACK(int) pcnetDestruct(PPDMDEVINS pDevIns)
     5044static DECLCALLBACK(int) pcnetR3Destruct(PPDMDEVINS pDevIns)
    50455045{
    50465046    PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
     
    50635063 * @interface_method_impl{PDMDEVREG,pfnConstruct}
    50645064 */
    5065 static DECLCALLBACK(int) pcnetConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
     5065static DECLCALLBACK(int) pcnetR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
    50665066{
    50675067    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
     
    53165316
    53175317    rc = PDMDevHlpSSMRegisterEx(pDevIns, PCNET_SAVEDSTATE_VERSION, sizeof(*pThis), NULL,
    5318                                 NULL,          pcnetLiveExec, NULL,
    5319                                 pcnetSavePrep, pcnetSaveExec, NULL,
    5320                                 pcnetLoadPrep, pcnetLoadExec, pcnetLoadDone);
     5318                                NULL,            pcnetR3LiveExec, NULL,
     5319                                pcnetR3SavePrep, pcnetR3SaveExec, NULL,
     5320                                pcnetR3LoadPrep, pcnetR3LoadExec, pcnetR3LoadDone);
    53215321    AssertRCReturn(rc, rc);
    53225322
     
    54575457}
    54585458
    5459 #endif /* IN_RING3 */
     5459#else  /* !IN_RING3 */
     5460
     5461/**
     5462 * @callback_method_impl{PDMDEVREGR0,pfnConstruct}
     5463 */
     5464static DECLCALLBACK(int) pcnetRZConstruct(PPDMDEVINS pDevIns)
     5465{
     5466    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
     5467    PPCNETSTATE pThis = PDMDEVINS_2_DATA(pDevIns, PPCNETSTATE);
     5468
     5469    int rc = PDMDevHlpSetDeviceCritSect(pDevIns, &pThis->CritSect);
     5470    AssertRCReturn(rc, rc);
     5471
     5472    return VINF_SUCCESS;
     5473}
     5474
     5475#endif /* !IN_RING3 */
    54605476
    54615477/**
     
    54845500    /* .pszRCMod = */               "VBoxDDRC.rc",
    54855501    /* .pszR0Mod = */               "VBoxDDR0.r0",
    5486     /* .pfnConstruct = */           pcnetConstruct,
    5487     /* .pfnDestruct = */            pcnetDestruct,
    5488     /* .pfnRelocate = */            pcnetRelocate,
     5502    /* .pfnConstruct = */           pcnetR3Construct,
     5503    /* .pfnDestruct = */            pcnetR3Destruct,
     5504    /* .pfnRelocate = */            pcnetR3Relocate,
    54895505    /* .pfnMemSetup = */            NULL,
    54905506    /* .pfnPowerOn = */             NULL,
    5491     /* .pfnReset = */               pcnetReset,
    5492     /* .pfnSuspend = */             pcnetSuspend,
     5507    /* .pfnReset = */               pcnetR3Reset,
     5508    /* .pfnSuspend = */             pcnetR3Suspend,
    54935509    /* .pfnResume = */              NULL,
    5494     /* .pfnAttach = */              pcnetAttach,
    5495     /* .pfnDetach = */              pcnetDetach,
     5510    /* .pfnAttach = */              pcnetR3Attach,
     5511    /* .pfnDetach = */              pcnetR3Detach,
    54965512    /* .pfnQueryInterface = */      NULL,
    54975513    /* .pfnInitComplete = */        NULL,
    5498     /* .pfnPowerOff = */            pcnetPowerOff,
     5514    /* .pfnPowerOff = */            pcnetR3PowerOff,
    54995515    /* .pfnSoftReset = */           NULL,
    55005516    /* .pfnReserved0 = */           NULL,
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