Index: trunk/src/VBox/Devices/Makefile.kmk
===================================================================
--- trunk/src/VBox/Devices/Makefile.kmk	(revision 25992)
+++ trunk/src/VBox/Devices/Makefile.kmk	(revision 25993)
@@ -509,5 +509,7 @@
  	Network/DevPCNet.cpp \
  	Serial/DevSerial.cpp \
- 	Parallel/DevParallel.cpp
+ 	Parallel/DevParallel.cpp \
+	\
+	Network/DrvIntNet.cpp
 
  ifdef VBOX_DYNAMIC_NET_ATTACH
@@ -608,5 +610,7 @@
 	Network/DevPCNet.cpp \
 	Serial/DevSerial.cpp \
-	Parallel/DevParallel.cpp
+	Parallel/DevParallel.cpp \
+	\
+	Network/DrvIntNet.cpp
 
 ifdef VBOX_DYNAMIC_NET_ATTACH
Index: trunk/src/VBox/Devices/Network/DrvIntNet.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/DrvIntNet.cpp	(revision 25992)
+++ trunk/src/VBox/Devices/Network/DrvIntNet.cpp	(revision 25993)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Sun Microsystems, Inc.
+ * Copyright (C) 2006-2010 Sun Microsystems, Inc.
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -63,5 +63,5 @@
 
 /**
- * Block driver instance data.
+ * Internal networking driver instance data.
  *
  * @implements  PDMINETWORKCONNECTOR
@@ -70,51 +70,58 @@
 {
     /** The network interface. */
-    PDMINETWORKCONNECTOR    INetworkConnector;
+    PDMINETWORKCONNECTOR            INetworkConnectorR3;
     /** The network interface. */
-    PPDMINETWORKPORT        pPort;
+    R3PTRTYPE(PPDMINETWORKPORT)     pIPortR3;
     /** The network config interface.
      * Can (in theory at least) be NULL. */
-    PPDMINETWORKCONFIG      pConfigIf;
+    R3PTRTYPE(PPDMINETWORKCONFIG)   pIConfigIfR3;
     /** Pointer to the driver instance. */
-    PPDMDRVINS              pDrvIns;
+    PPDMDRVINSR3                    pDrvInsR3;
+    /** Pointer to the communication buffer. */
+    R3PTRTYPE(PINTNETBUF)           pBufR3;
     /** Interface handle. */
-    INTNETIFHANDLE          hIf;
-    /** Pointer to the communication buffer. */
-    PINTNETBUF              pBuf;
+    INTNETIFHANDLE                  hIf;
+
     /** The thread state. */
-    ASYNCSTATE volatile     enmState;
+    ASYNCSTATE volatile             enmState;
     /** Reader thread. */
-    RTTHREAD                Thread;
+    RTTHREAD                        Thread;
     /** Event semaphore the Thread waits on while the VM is suspended. */
-    RTSEMEVENT              EventSuspended;
+    RTSEMEVENT                      EventSuspended;
     /** Set if the link is down.
      * When the link is down all incoming packets will be dropped. */
-    bool volatile           fLinkDown;
+    bool volatile                   fLinkDown;
     /** Set if data transmission should start immediately and deactivate
      * as late as possible. */
-    bool                    fActivateEarlyDeactivateLate;
+    bool                            fActivateEarlyDeactivateLate;
+    /** Padding. */
+    bool                            afReserved[2];
+    /** The network name. */
+    char                            szNetwork[INTNET_MAX_NETWORK_NAME];
 
 #ifdef LOG_ENABLED
     /** The nano ts of the last transfer. */
-    uint64_t                u64LastTransferTS;
+    uint64_t                        u64LastTransferTS;
     /** The nano ts of the last receive. */
-    uint64_t                u64LastReceiveTS;
+    uint64_t                        u64LastReceiveTS;
 #endif
-
 #ifdef VBOX_WITH_STATISTICS
     /** Profiling packet transmit runs. */
-    STAMPROFILE             StatTransmit;
+    STAMPROFILE                     StatTransmit;
     /** Profiling packet receive runs. */
-    STAMPROFILEADV          StatReceive;
+    STAMPROFILEADV                  StatReceive;
 #endif /* VBOX_WITH_STATISTICS */
-
-    /** The network name. */
-    char                    szNetwork[INTNET_MAX_NETWORK_NAME];
-} DRVINTNET, *PDRVINTNET;
-
-
-/** Converts a pointer to DRVINTNET::INetworkConnector to a PDRVINTNET. */
-#define PDMINETWORKCONNECTOR_2_DRVINTNET(pInterface) ( (PDRVINTNET)((uintptr_t)pInterface - RT_OFFSETOF(DRVINTNET, INetworkConnector)) )
-
+} DRVINTNET;
+/** Pointer to instance data of the internal networking driver. */
+typedef DRVINTNET *PDRVINTNET;
+
+
+#ifdef IN_RING3
+
+/* -=-=-=-=- PDMINETWORKCONNECTOR -=-=-=-=- */
+
+/** Converts a pointer to DRVINTNET::INetworkConnectorR3 to a PDRVINTNET. */
+#define PDMINETWORKCONNECTOR_2_DRVINTNET(pInterface) \
+    RT_FROM_MEMBER(pInterface, DRVINTNET, INetworkConnectorR3)
 
 /**
@@ -124,7 +131,7 @@
  * @param   pThis       The driver instance.
  */
-static int drvIntNetUpdateMacAddress(PDRVINTNET pThis)
-{
-    if (!pThis->pConfigIf)
+static int drvR3IntNetUpdateMacAddress(PDRVINTNET pThis)
+{
+    if (!pThis->pIConfigIfR3)
         return VINF_SUCCESS;
 
@@ -134,10 +141,10 @@
     SetMacAddressReq.pSession = NIL_RTR0PTR;
     SetMacAddressReq.hIf = pThis->hIf;
-    int rc = pThis->pConfigIf->pfnGetMac(pThis->pConfigIf, &SetMacAddressReq.Mac);
+    int rc = pThis->pIConfigIfR3->pfnGetMac(pThis->pIConfigIfR3, &SetMacAddressReq.Mac);
     if (RT_SUCCESS(rc))
-        rc = PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SET_MAC_ADDRESS,
+        rc = PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvInsR3, VMMR0_DO_INTNET_IF_SET_MAC_ADDRESS,
                                      &SetMacAddressReq, sizeof(SetMacAddressReq));
 
-    Log(("drvIntNetUpdateMacAddress: %.*Rhxs rc=%Rrc\n", sizeof(SetMacAddressReq.Mac), &SetMacAddressReq.Mac, rc));
+    Log(("drvR3IntNetUpdateMacAddress: %.*Rhxs rc=%Rrc\n", sizeof(SetMacAddressReq.Mac), &SetMacAddressReq.Mac, rc));
     return rc;
 }
@@ -153,7 +160,7 @@
  * @param   fActive     The new state.
  */
-static int drvIntNetSetActive(PDRVINTNET pThis, bool fActive)
-{
-    if (!pThis->pConfigIf)
+static int drvR3IntNetSetActive(PDRVINTNET pThis, bool fActive)
+{
+    if (!pThis->pIConfigIfR3)
         return VINF_SUCCESS;
 
@@ -164,8 +171,8 @@
     SetActiveReq.hIf = pThis->hIf;
     SetActiveReq.fActive = fActive;
-    int rc = PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SET_ACTIVE,
+    int rc = PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvInsR3, VMMR0_DO_INTNET_IF_SET_ACTIVE,
                                      &SetActiveReq, sizeof(SetActiveReq));
 
-    Log(("drvIntNetUpdateMacAddress: fActive=%d rc=%Rrc\n", fActive, rc));
+    Log(("drvR3IntNetSetActive: fActive=%d rc=%Rrc\n", fActive, rc));
     AssertRC(rc);
     return rc;
@@ -183,5 +190,5 @@
  * @remark  This is the same as INTNETRingWriteFrame
  */
-static int drvIntNetRingWriteFrame(PINTNETBUF pBuf, PINTNETRINGBUF pRingBuf, const void *pvFrame, uint32_t cbFrame)
+static int drvR3IntNetRingWriteFrame(PINTNETBUF pBuf, PINTNETRINGBUF pRingBuf, const void *pvFrame, uint32_t cbFrame)
 {
     /*
@@ -275,5 +282,5 @@
  * @thread  EMT
  */
-static DECLCALLBACK(int) drvIntNetSend(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb)
+static DECLCALLBACK(int) drvR3IntNetSend(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb)
 {
     PDRVINTNET pThis = PDMINETWORKCONNECTOR_2_DRVINTNET(pInterface);
@@ -282,8 +289,8 @@
 #ifdef LOG_ENABLED
     uint64_t u64Now = RTTimeProgramNanoTS();
-    LogFlow(("drvIntNetSend: %-4d bytes at %llu ns  deltas: r=%llu t=%llu\n",
+    LogFlow(("drvR3IntNetSend: %-4d bytes at %llu ns  deltas: r=%llu t=%llu\n",
              cb, u64Now, u64Now - pThis->u64LastReceiveTS, u64Now - pThis->u64LastTransferTS));
     pThis->u64LastTransferTS = u64Now;
-    Log2(("drvIntNetSend: pvBuf=%p cb=%#x\n"
+    Log2(("drvR3IntNetSend: pvBuf=%p cb=%#x\n"
           "%.*Rhxd\n",
           pvBuf, cb, cb, pvBuf));
@@ -293,7 +300,7 @@
      * Add the frame to the send buffer and push it onto the network.
      */
-    int rc = drvIntNetRingWriteFrame(pThis->pBuf, &pThis->pBuf->Send, pvBuf, (uint32_t)cb);
+    int rc = drvR3IntNetRingWriteFrame(pThis->pBufR3, &pThis->pBufR3->Send, pvBuf, (uint32_t)cb);
     if (    rc == VERR_BUFFER_OVERFLOW
-        &&  pThis->pBuf->cbSend < cb)
+        &&  pThis->pBufR3->cbSend < cb)
     {
         INTNETIFSENDREQ SendReq;
@@ -302,7 +309,7 @@
         SendReq.pSession = NIL_RTR0PTR;
         SendReq.hIf = pThis->hIf;
-        PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq));
-
-        rc = drvIntNetRingWriteFrame(pThis->pBuf, &pThis->pBuf->Send, pvBuf, (uint32_t)cb);
+        PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvInsR3, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq));
+
+        rc = drvR3IntNetRingWriteFrame(pThis->pBufR3, &pThis->pBufR3->Send, pvBuf, (uint32_t)cb);
     }
 
@@ -314,5 +321,5 @@
         SendReq.pSession = NIL_RTR0PTR;
         SendReq.hIf = pThis->hIf;
-        rc = PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq));
+        rc = PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvInsR3, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq));
     }
 
@@ -333,5 +340,5 @@
  * @thread  EMT
  */
-static DECLCALLBACK(void) drvIntNetSetPromiscuousMode(PPDMINETWORKCONNECTOR pInterface, bool fPromiscuous)
+static DECLCALLBACK(void) drvR3IntNetSetPromiscuousMode(PPDMINETWORKCONNECTOR pInterface, bool fPromiscuous)
 {
     PDRVINTNET pThis = PDMINETWORKCONNECTOR_2_DRVINTNET(pInterface);
@@ -342,6 +349,6 @@
     Req.hIf             = pThis->hIf;
     Req.fPromiscuous    = fPromiscuous;
-    int rc = PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE, &Req, sizeof(Req));
-    LogFlow(("drvIntNetSetPromiscuousMode: fPromiscuous=%RTbool\n", fPromiscuous));
+    int rc = PDMDrvHlpSUPCallVMMR0Ex(pThis->pDrvInsR3, VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE, &Req, sizeof(Req));
+    LogFlow(("drvR3IntNetSetPromiscuousMode: fPromiscuous=%RTbool\n", fPromiscuous));
     AssertRC(rc);
 }
@@ -355,5 +362,5 @@
  * @thread  EMT
  */
-static DECLCALLBACK(void) drvIntNetNotifyLinkChanged(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState)
+static DECLCALLBACK(void) drvR3IntNetNotifyLinkChanged(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState)
 {
     PDRVINTNET pThis = PDMINETWORKCONNECTOR_2_DRVINTNET(pInterface);
@@ -371,5 +378,5 @@
             break;
     }
-    LogFlow(("drvIntNetNotifyLinkChanged: enmLinkState=%d %d->%d\n", enmLinkState, pThis->fLinkDown, fLinkDown));
+    LogFlow(("drvR3IntNetNotifyLinkChanged: enmLinkState=%d %d->%d\n", enmLinkState, pThis->fLinkDown, fLinkDown));
     ASMAtomicXchgSize(&pThis->fLinkDown, fLinkDown);
 }
@@ -384,11 +391,11 @@
  * @param   pThis       Pointer to the instance data.
  */
-static int drvIntNetAsyncIoWaitForSpace(PDRVINTNET pThis)
-{
-    LogFlow(("drvIntNetAsyncIoWaitForSpace:\n"));
+static int drvR3IntNetAsyncIoWaitForSpace(PDRVINTNET pThis)
+{
+    LogFlow(("drvR3IntNetAsyncIoWaitForSpace:\n"));
     STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a);
-    int rc = pThis->pPort->pfnWaitReceiveAvail(pThis->pPort, RT_INDEFINITE_WAIT);
+    int rc = pThis->pIPortR3->pfnWaitReceiveAvail(pThis->pIPortR3, RT_INDEFINITE_WAIT);
     STAM_PROFILE_ADV_START(&pThis->StatReceive, a);
-    LogFlow(("drvIntNetAsyncIoWaitForSpace: returns %Rrc\n", rc));
+    LogFlow(("drvR3IntNetAsyncIoWaitForSpace: returns %Rrc\n", rc));
     return rc;
 }
@@ -402,8 +409,8 @@
  * @param   pThis       The driver instance data.
  */
-static int drvIntNetAsyncIoRun(PDRVINTNET pThis)
-{
-    PPDMDRVINS pDrvIns = pThis->pDrvIns;
-    LogFlow(("drvIntNetAsyncIoRun: pThis=%p\n", pThis));
+static int drvR3IntNetAsyncIoRun(PDRVINTNET pThis)
+{
+    PPDMDRVINS pDrvIns = pThis->pDrvInsR3;
+    LogFlow(("drvR3IntNetAsyncIoRun: pThis=%p\n", pThis));
 
     /*
@@ -411,6 +418,6 @@
      */
     STAM_PROFILE_ADV_START(&pThis->StatReceive, a);
-    PINTNETBUF      pBuf     = pThis->pBuf;
-    PINTNETRINGBUF  pRingBuf = &pThis->pBuf->Recv;
+    PINTNETBUF      pBuf     = pThis->pBufR3;
+    PINTNETRINGBUF  pRingBuf = &pBuf->Recv;
     for (;;)
     {
@@ -426,5 +433,5 @@
             {
                 STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a);
-                LogFlow(("drvIntNetAsyncIoRun: returns VERR_STATE_CHANGED (state changed - #0)\n"));
+                LogFlow(("drvR3IntNetAsyncIoRun: returns VERR_STATE_CHANGED (state changed - #0)\n"));
                 return VERR_STATE_CHANGED;
             }
@@ -439,17 +446,17 @@
                  */
                 size_t cbFrame = pHdr->cbFrame;
-                int rc = pThis->pPort->pfnWaitReceiveAvail(pThis->pPort, 0);
+                int rc = pThis->pIPortR3->pfnWaitReceiveAvail(pThis->pIPortR3, 0);
                 if (rc == VINF_SUCCESS)
                 {
 #ifdef LOG_ENABLED
                     uint64_t u64Now = RTTimeProgramNanoTS();
-                    LogFlow(("drvIntNetAsyncIoRun: %-4d bytes at %llu ns  deltas: r=%llu t=%llu\n",
+                    LogFlow(("drvR3IntNetAsyncIoRun: %-4d bytes at %llu ns  deltas: r=%llu t=%llu\n",
                              cbFrame, u64Now, u64Now - pThis->u64LastReceiveTS, u64Now - pThis->u64LastTransferTS));
                     pThis->u64LastReceiveTS = u64Now;
-                    Log2(("drvIntNetAsyncIoRun: cbFrame=%#x\n"
+                    Log2(("drvR3IntNetAsyncIoRun: cbFrame=%#x\n"
                           "%.*Rhxd\n",
                           cbFrame, cbFrame, INTNETHdrGetFramePtr(pHdr, pBuf)));
 #endif
-                    rc = pThis->pPort->pfnReceive(pThis->pPort, INTNETHdrGetFramePtr(pHdr, pBuf), cbFrame);
+                    rc = pThis->pIPortR3->pfnReceive(pThis->pIPortR3, INTNETHdrGetFramePtr(pHdr, pBuf), cbFrame);
                     AssertRC(rc);
 
@@ -462,5 +469,5 @@
                      * Wait for sufficient space to become available and then retry.
                      */
-                    rc = drvIntNetAsyncIoWaitForSpace(pThis);
+                    rc = drvR3IntNetAsyncIoWaitForSpace(pThis);
                     if (RT_FAILURE(rc))
                     {
@@ -477,5 +484,5 @@
                         {
                             STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a);
-                            LogFlow(("drvIntNetAsyncIoRun: returns %Rrc (wait-for-space)\n", rc));
+                            LogFlow(("drvR3IntNetAsyncIoRun: returns %Rrc (wait-for-space)\n", rc));
                             return rc;
                         }
@@ -500,5 +507,5 @@
         {
             STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a);
-            LogFlow(("drvIntNetAsyncIoRun: returns VINF_SUCCESS (state changed - #1)\n"));
+            LogFlow(("drvR3IntNetAsyncIoRun: returns VINF_SUCCESS (state changed - #1)\n"));
             return VERR_STATE_CHANGED;
         }
@@ -515,5 +522,5 @@
             &&  rc != VERR_INTERRUPTED)
         {
-            LogFlow(("drvIntNetAsyncIoRun: returns %Rrc\n", rc));
+            LogFlow(("drvR3IntNetAsyncIoRun: returns %Rrc\n", rc));
             return rc;
         }
@@ -530,8 +537,8 @@
  * @param   pvUser          Pointer to a DRVINTNET structure.
  */
-static DECLCALLBACK(int) drvIntNetAsyncIoThread(RTTHREAD ThreadSelf, void *pvUser)
+static DECLCALLBACK(int) drvR3IntNetAsyncIoThread(RTTHREAD ThreadSelf, void *pvUser)
 {
     PDRVINTNET pThis = (PDRVINTNET)pvUser;
-    LogFlow(("drvIntNetAsyncIoThread: pThis=%p\n", pThis));
+    LogFlow(("drvR3IntNetAsyncIoThread: pThis=%p\n", pThis));
     STAM_PROFILE_ADV_START(&pThis->StatReceive, a);
 
@@ -550,5 +557,5 @@
                     &&  rc != VERR_TIMEOUT)
                 {
-                    LogFlow(("drvIntNetAsyncIoThread: returns %Rrc\n", rc));
+                    LogFlow(("drvR3IntNetAsyncIoThread: returns %Rrc\n", rc));
                     return rc;
                 }
@@ -558,9 +565,9 @@
             case ASYNCSTATE_RUNNING:
             {
-                int rc = drvIntNetAsyncIoRun(pThis);
+                int rc = drvR3IntNetAsyncIoRun(pThis);
                 if (    rc != VERR_STATE_CHANGED
                     &&  RT_FAILURE(rc))
                 {
-                    LogFlow(("drvIntNetAsyncIoThread: returns %Rrc\n", rc));
+                    LogFlow(("drvR3IntNetAsyncIoThread: returns %Rrc\n", rc));
                     return rc;
                 }
@@ -571,5 +578,5 @@
                 AssertMsgFailed(("Invalid state %d\n", enmState));
             case ASYNCSTATE_TERMINATE:
-                LogFlow(("drvIntNetAsyncIoThread: returns VINF_SUCCESS\n"));
+                LogFlow(("drvR3IntNetAsyncIoThread: returns VINF_SUCCESS\n"));
                 return VINF_SUCCESS;
         }
@@ -577,9 +584,10 @@
 }
 
+/* -=-=-=-=- PDMINETWORKCONNECTOR -=-=-=-=- */
 
 /**
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
  */
-static DECLCALLBACK(void *) drvIntNetQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+static DECLCALLBACK(void *) drvR3IntNetQueryInterface(PPDMIBASE pInterface, const char *pszIID)
 {
     PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
@@ -587,8 +595,9 @@
 
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
-    PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKCONNECTOR, &pThis->INetworkConnector);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMINETWORKCONNECTOR, &pThis->INetworkConnectorR3);
     return NULL;
 }
 
+/* -=-=-=-=- PDMDRVREG -=-=-=-=- */
 
 /**
@@ -597,12 +606,12 @@
  * @param   pDrvIns     The driver instance.
  */
-static DECLCALLBACK(void) drvIntNetPowerOff(PPDMDRVINS pDrvIns)
-{
-    LogFlow(("drvIntNetPowerOff\n"));
+static DECLCALLBACK(void) drvR3IntNetPowerOff(PPDMDRVINS pDrvIns)
+{
+    LogFlow(("drvR3IntNetPowerOff\n"));
     PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
     if (!pThis->fActivateEarlyDeactivateLate)
     {
         ASMAtomicXchgSize(&pThis->enmState, ASYNCSTATE_SUSPENDED);
-        drvIntNetSetActive(pThis, false /* fActive */);
+        drvR3IntNetSetActive(pThis, false /* fActive */);
     }
 }
@@ -614,7 +623,7 @@
  * @param   pDrvIns     The driver instance.
  */
-static DECLCALLBACK(void) drvIntNetResume(PPDMDRVINS pDrvIns)
-{
-    LogFlow(("drvIntNetPowerResume\n"));
+static DECLCALLBACK(void) drvR3IntNetResume(PPDMDRVINS pDrvIns)
+{
+    LogFlow(("drvR3IntNetPowerResume\n"));
     PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
     if (!pThis->fActivateEarlyDeactivateLate)
@@ -622,9 +631,9 @@
         ASMAtomicXchgSize(&pThis->enmState, ASYNCSTATE_RUNNING);
         RTSemEventSignal(pThis->EventSuspended);
-        drvIntNetUpdateMacAddress(pThis); /* (could be a state restore) */
-        drvIntNetSetActive(pThis, true /* fActive */);
+        drvR3IntNetUpdateMacAddress(pThis); /* (could be a state restore) */
+        drvR3IntNetSetActive(pThis, true /* fActive */);
     }
     if (   PDMDrvHlpVMTeleportedAndNotFullyResumedYet(pDrvIns)
-        && pThis->pConfigIf)
+        && pThis->pIConfigIfR3)
     {
         /*
@@ -645,7 +654,7 @@
         Frame.Hdr.DstMac.au16[2] = 0xffff;
         Frame.Hdr.EtherType      = RT_H2BE_U16(0x801e);
-        int rc = pThis->pConfigIf->pfnGetMac(pThis->pConfigIf, &Frame.Hdr.SrcMac);
+        int rc = pThis->pIConfigIfR3->pfnGetMac(pThis->pIConfigIfR3, &Frame.Hdr.SrcMac);
         if (RT_SUCCESS(rc))
-            rc = drvIntNetSend(&pThis->INetworkConnector, &Frame, sizeof(Frame));
+            rc = drvR3IntNetSend(&pThis->INetworkConnectorR3, &Frame, sizeof(Frame));
         if (RT_FAILURE(rc))
             LogRel(("IntNet#%u: Sending dummy frame failed: %Rrc\n", pDrvIns->iInstance, rc));
@@ -659,12 +668,12 @@
  * @param   pDrvIns     The driver instance.
  */
-static DECLCALLBACK(void) drvIntNetSuspend(PPDMDRVINS pDrvIns)
-{
-    LogFlow(("drvIntNetPowerSuspend\n"));
+static DECLCALLBACK(void) drvR3IntNetSuspend(PPDMDRVINS pDrvIns)
+{
+    LogFlow(("drvR3IntNetPowerSuspend\n"));
     PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
     if (!pThis->fActivateEarlyDeactivateLate)
     {
         ASMAtomicXchgSize(&pThis->enmState, ASYNCSTATE_SUSPENDED);
-        drvIntNetSetActive(pThis, false /* fActive */);
+        drvR3IntNetSetActive(pThis, false /* fActive */);
     }
 }
@@ -676,7 +685,7 @@
  * @param   pDrvIns     The driver instance.
  */
-static DECLCALLBACK(void) drvIntNetPowerOn(PPDMDRVINS pDrvIns)
-{
-    LogFlow(("drvIntNetPowerOn\n"));
+static DECLCALLBACK(void) drvR3IntNetPowerOn(PPDMDRVINS pDrvIns)
+{
+    LogFlow(("drvR3IntNetPowerOn\n"));
     PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
     if (!pThis->fActivateEarlyDeactivateLate)
@@ -684,6 +693,6 @@
         ASMAtomicXchgSize(&pThis->enmState, ASYNCSTATE_RUNNING);
         RTSemEventSignal(pThis->EventSuspended);
-        drvIntNetUpdateMacAddress(pThis);
-        drvIntNetSetActive(pThis, true /* fActive */);
+        drvR3IntNetUpdateMacAddress(pThis);
+        drvR3IntNetSetActive(pThis, true /* fActive */);
     }
 }
@@ -698,7 +707,7 @@
  * @param   pDrvIns     The driver instance data.
  */
-static DECLCALLBACK(void) drvIntNetDestruct(PPDMDRVINS pDrvIns)
-{
-    LogFlow(("drvIntNetDestruct\n"));
+static DECLCALLBACK(void) drvR3IntNetDestruct(PPDMDRVINS pDrvIns)
+{
+    LogFlow(("drvR3IntNetDestruct\n"));
     PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
 
@@ -747,10 +756,10 @@
      * Deregister statistics in case we're being detached.
      */
-    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBuf->cbStatRecv);
-    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBuf->cbStatSend);
-    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBuf->cStatRecvs);
-    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBuf->cStatSends);
-    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBuf->cStatLost);
-    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBuf->cStatYieldsNok);
+    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBufR3->cbStatRecv);
+    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBufR3->cbStatSend);
+    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBufR3->cStatRecvs);
+    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBufR3->cStatSends);
+    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBufR3->cStatLost);
+    PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->pBufR3->cStatYieldsNok);
 #ifdef VBOX_WITH_STATISTICS
     PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReceive);
@@ -765,5 +774,5 @@
  * @copydoc FNPDMDRVCONSTRUCT
  */
-static DECLCALLBACK(int) drvIntNetConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
+static DECLCALLBACK(int) drvR3IntNetConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
 {
     PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
@@ -773,16 +782,16 @@
      * Init the static parts.
      */
-    pThis->pDrvIns                      = pDrvIns;
-    pThis->hIf                          = INTNET_HANDLE_INVALID;
-    pThis->Thread                       = NIL_RTTHREAD;
-    pThis->EventSuspended               = NIL_RTSEMEVENT;
-    pThis->enmState                     = ASYNCSTATE_SUSPENDED;
-    pThis->fActivateEarlyDeactivateLate = false;
+    pThis->pDrvInsR3                                = pDrvIns;
+    pThis->hIf                                      = INTNET_HANDLE_INVALID;
+    pThis->Thread                                   = NIL_RTTHREAD;
+    pThis->EventSuspended                           = NIL_RTSEMEVENT;
+    pThis->enmState                                 = ASYNCSTATE_SUSPENDED;
+    pThis->fActivateEarlyDeactivateLate             = false;
     /* IBase */
-    pDrvIns->IBase.pfnQueryInterface    = drvIntNetQueryInterface;
+    pDrvIns->IBase.pfnQueryInterface                = drvR3IntNetQueryInterface;
     /* INetwork */
-    pThis->INetworkConnector.pfnSend                = drvIntNetSend;
-    pThis->INetworkConnector.pfnSetPromiscuousMode  = drvIntNetSetPromiscuousMode;
-    pThis->INetworkConnector.pfnNotifyLinkChanged   = drvIntNetNotifyLinkChanged;
+    pThis->INetworkConnectorR3.pfnSend              = drvR3IntNetSend;
+    pThis->INetworkConnectorR3.pfnSetPromiscuousMode= drvR3IntNetSetPromiscuousMode;
+    pThis->INetworkConnectorR3.pfnNotifyLinkChanged = drvR3IntNetNotifyLinkChanged;
 
     /*
@@ -818,11 +827,11 @@
      * Query the network port interface.
      */
-    pThis->pPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMINETWORKPORT);
-    if (!pThis->pPort)
+    pThis->pIPortR3 = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMINETWORKPORT);
+    if (!pThis->pIPortR3)
     {
         AssertMsgFailed(("Configuration error: the above device/driver didn't export the network port interface!\n"));
         return VERR_PDM_MISSING_INTERFACE_ABOVE;
     }
-    pThis->pConfigIf = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMINETWORKCONFIG);
+    pThis->pIConfigIfR3 = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMINETWORKCONFIG);
 
     /*
@@ -1081,5 +1090,5 @@
                                    N_("Failed to get ring-3 buffer for the newly created interface to '%s'"), pThis->szNetwork);
     AssertRelease(VALID_PTR(GetRing3BufferReq.pRing3Buf));
-    pThis->pBuf = GetRing3BufferReq.pRing3Buf;
+    pThis->pBufR3 = GetRing3BufferReq.pRing3Buf;
 
     /*
@@ -1087,5 +1096,5 @@
      * Note! Using a PDM thread here doesn't fit with the IsService=true operation.
      */
-    rc = RTThreadCreate(&pThis->Thread, drvIntNetAsyncIoThread, pThis, _128K, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "INTNET");
+    rc = RTThreadCreate(&pThis->Thread, drvR3IntNetAsyncIoThread, pThis, _128K, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "INTNET");
     if (RT_FAILURE(rc))
     {
@@ -1094,10 +1103,10 @@
     }
 
-    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBuf->cbStatRecv,       STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_BYTES, "Number of received bytes.",    "/Net/IntNet%d/Bytes/Received", pDrvIns->iInstance);
-    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBuf->cbStatSend,       STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_BYTES, "Number of sent bytes.",        "/Net/IntNet%d/Bytes/Sent", pDrvIns->iInstance);
-    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBuf->cStatRecvs,       STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_COUNT, "Number of received packets.",  "/Net/IntNet%d/Packets/Received", pDrvIns->iInstance);
-    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBuf->cStatSends,       STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_COUNT, "Number of sent packets.",      "/Net/IntNet%d/Packets/Sent", pDrvIns->iInstance);
-    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBuf->cStatLost,        STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_COUNT, "Number of sent packets.",      "/Net/IntNet%d/Packets/Lost", pDrvIns->iInstance);
-    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBuf->cStatYieldsNok,   STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_COUNT, "Number of times yielding didn't help fix an overflow.",  "/Net/IntNet%d/YieldNok", pDrvIns->iInstance);
+    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBufR3->cbStatRecv,     STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_BYTES, "Number of received bytes.",    "/Net/IntNet%d/Bytes/Received", pDrvIns->iInstance);
+    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBufR3->cbStatSend,     STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_BYTES, "Number of sent bytes.",        "/Net/IntNet%d/Bytes/Sent", pDrvIns->iInstance);
+    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBufR3->cStatRecvs,     STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_COUNT, "Number of received packets.",  "/Net/IntNet%d/Packets/Received", pDrvIns->iInstance);
+    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBufR3->cStatSends,     STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_COUNT, "Number of sent packets.",      "/Net/IntNet%d/Packets/Sent", pDrvIns->iInstance);
+    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBufR3->cStatLost,      STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_COUNT, "Number of sent packets.",      "/Net/IntNet%d/Packets/Lost", pDrvIns->iInstance);
+    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->pBufR3->cStatYieldsNok, STAMTYPE_COUNTER,   STAMVISIBILITY_ALWAYS,  STAMUNIT_COUNT, "Number of times yielding didn't help fix an overflow.",  "/Net/IntNet%d/YieldNok", pDrvIns->iInstance);
 #ifdef VBOX_WITH_STATISTICS
     PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReceive,            STAMTYPE_PROFILE,   STAMVISIBILITY_ALWAYS,  STAMUNIT_TICKS_PER_CALL, "Profiling packet receive runs.",  "/Net/IntNet%d/Receive", pDrvIns->iInstance);
@@ -1112,6 +1121,6 @@
         ASMAtomicXchgSize(&pThis->enmState, ASYNCSTATE_RUNNING);
         RTSemEventSignal(pThis->EventSuspended);
-        drvIntNetUpdateMacAddress(pThis);
-        drvIntNetSetActive(pThis, true /* fActive */);
+        drvR3IntNetUpdateMacAddress(pThis);
+        drvR3IntNetSetActive(pThis, true /* fActive */);
     }
 
@@ -1130,11 +1139,15 @@
     "IntNet",
     /* szRCMod */
-    "",
+    "VBoxDD",
     /* szR0Mod */
-    "",
+    "VBoxDD",
     /* pszDescription */
     "Internal Networking Transport Driver",
     /* fFlags */
+#ifdef VBOX_WITH_R0_AND_RC_DRIVERS
+    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT | PDM_DRVREG_FLAGS_R0 | PDM_DRVREG_FLAGS_RC,
+#else
     PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+#endif
     /* fClass. */
     PDM_DRVREG_CLASS_NETWORK,
@@ -1144,7 +1157,7 @@
     sizeof(DRVINTNET),
     /* pfnConstruct */
-    drvIntNetConstruct,
+    drvR3IntNetConstruct,
     /* pfnDestruct */
-    drvIntNetDestruct,
+    drvR3IntNetDestruct,
     /* pfnRelocate */
     NULL,
@@ -1152,11 +1165,11 @@
     NULL,
     /* pfnPowerOn */
-    drvIntNetPowerOn,
+    drvR3IntNetPowerOn,
     /* pfnReset */
     NULL,
     /* pfnSuspend */
-    drvIntNetSuspend,
+    drvR3IntNetSuspend,
     /* pfnResume */
-    drvIntNetResume,
+    drvR3IntNetResume,
     /* pfnAttach */
     NULL,
@@ -1164,5 +1177,5 @@
     NULL,
     /* pfnPowerOff */
-    drvIntNetPowerOff,
+    drvR3IntNetPowerOff,
     /* pfnSoftReset */
     NULL,
@@ -1171,2 +1184,4 @@
 };
 
+#endif /* IN_RING3 */
+
