Index: trunk/src/VBox/Devices/Audio/DevIchHda.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevIchHda.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Audio/DevIchHda.cpp	(revision 63478)
@@ -1163,4 +1163,5 @@
 
 #ifdef IN_RING3
+
 DECLINLINE(uint32_t) hdaStreamUpdateLPIB(PHDASTATE pThis, PHDASTREAM pStream, uint32_t u32LPIB)
 {
@@ -1187,5 +1188,5 @@
     return u32LPIB;
 }
-#endif
+
 
 /**
@@ -1220,4 +1221,5 @@
 }
 
+
 /**
  * Retrieves the number of bytes of a FIFOW register.
@@ -1236,11 +1238,9 @@
     }
 
-#ifdef RT_STRICT
     Assert(RT_IS_POWER_OF_TWO(cb));
-#endif
     return cb;
 }
 
-#ifdef IN_RING3
+
 /**
  * Fetches the next BDLE to use for a stream.
@@ -1259,7 +1259,7 @@
     LogFlowFuncEnter();
 
-#ifdef DEBUG
-    uint32_t uOldBDLE = pStream->State.uCurBDLE;
-#endif
+# ifdef LOG_ENABLED
+    uint32_t const uOldBDLE = pStream->State.uCurBDLE;
+# endif
 
     PHDABDLE pBDLE = &pStream->State.BDLE;
@@ -1282,12 +1282,9 @@
     int rc = hdaBDLEFetch(pThis, pBDLE, pStream->u64BDLBase, pStream->State.uCurBDLE);
 
-#ifdef DEBUG
     LogFlowFunc(("[SD%RU8]: uOldBDLE=%RU16, uCurBDLE=%RU16, LVI=%RU32, rc=%Rrc, %R[bdle]\n",
                  pStream->u8SD, uOldBDLE, pStream->State.uCurBDLE, pStream->u16LVI, rc, pBDLE));
-#endif
-
     return rc;
 }
-#endif /* IN_RING3 */
+
 
 /**
@@ -1313,4 +1310,5 @@
 }
 
+
 /**
  * Returns the HDA stream of specified stream descriptor number.
@@ -1328,4 +1326,5 @@
     return &pThis->aStreams[uSD];
 }
+
 
 /**
@@ -1356,10 +1355,12 @@
     AssertPtrReturn(pStream, 0);
 
-#ifdef VBOX_HDA_WITH_FIFO
+# ifdef VBOX_HDA_WITH_FIFO
     return hdaSDFIFOWToBytes(HDA_STREAM_REG(pThis, FIFOW, pStream->u8SD));
-#else
+# else
     return 0;
-#endif
-}
+# endif
+}
+
+#endif /* IN_RING3 */
 
 static int hdaProcessInterrupt(PHDASTATE pThis)
@@ -1511,4 +1512,5 @@
 
 #ifdef IN_RING3
+
 static int hdaCmdSync(PHDASTATE pThis, bool fLocal)
 {
@@ -1524,5 +1526,5 @@
         if (RT_FAILURE(rc))
             AssertRCReturn(rc, rc);
-#ifdef DEBUG_CMD_BUFFER
+# ifdef DEBUG_CMD_BUFFER
         uint8_t i = 0;
         do
@@ -1545,5 +1547,5 @@
             i += 8;
         } while(i != 0);
-#endif
+# endif
     }
     else
@@ -1553,5 +1555,5 @@
         if (RT_FAILURE(rc))
             AssertRCReturn(rc, rc);
-#ifdef DEBUG_CMD_BUFFER
+# ifdef DEBUG_CMD_BUFFER
         uint8_t i = 0;
         do {
@@ -1569,5 +1571,5 @@
             i += 8;
         } while (i != 0);
-#endif
+# endif
     }
     return rc;
@@ -1700,5 +1702,5 @@
                  pStream->u8SD, pStream->u64BDLBase, pStream->u32CBL, pStream->u16LVI, pStream->u16FIFOS));
 
-#ifdef DEBUG
+# ifdef DEBUG
     uint64_t u64BaseDMA = RT_MAKE_U64(HDA_STREAM_REG(pThis, BDPL, pStream->u8SD),
                                       HDA_STREAM_REG(pThis, BDPU, pStream->u8SD));
@@ -1709,5 +1711,5 @@
 
     hdaBDLEDumpAll(pThis, u64BaseDMA, u16LVI + 1);
-#endif
+# endif
 
     return VINF_SUCCESS;
@@ -1721,8 +1723,8 @@
     const uint8_t uSD = pStream->u8SD;
 
-#ifdef VBOX_STRICT
+# ifdef VBOX_STRICT
     AssertReleaseMsg(!RT_BOOL(HDA_STREAM_REG(pThis, CTL, uSD) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN)),
                      ("[SD%RU8] Cannot reset stream while in running state\n", uSD));
-#endif
+# endif
 
     LogFunc(("[SD%RU8]: Reset\n", uSD));
@@ -1770,5 +1772,5 @@
 }
 
-#if 0 /* unused */
+# if 0 /* unused */
 static bool hdaStreamIsActive(PHDASTATE pThis, PHDASTREAM pStream)
 {
@@ -1781,5 +1783,5 @@
     return fActive;
 }
-#endif
+# endif
 
 static int hdaStreamSetActive(PHDASTATE pThis, PHDASTREAM pStream, bool fActive)
@@ -1824,14 +1826,14 @@
             pThis->cStreamsActive--;
 
-#ifndef VBOX_WITH_AUDIO_CALLBACKS
+# ifndef VBOX_WITH_AUDIO_CALLBACKS
         hdaTimerMaybeStop(pThis);
-#endif
+# endif
     }
     else
     {
         pThis->cStreamsActive++;
-#ifndef VBOX_WITH_AUDIO_CALLBACKS
+# ifndef VBOX_WITH_AUDIO_CALLBACKS
         hdaTimerMaybeStart(pThis);
-#endif
+# endif
     }
 
@@ -1854,5 +1856,5 @@
 }
 
-#if 0 /** @todo hdaStreamStart is unused */
+# if 0 /** @todo hdaStreamStart is unused */
 static int hdaStreamStart(PHDASTREAM pStream)
 {
@@ -1865,5 +1867,5 @@
     return VINF_SUCCESS;
 }
-#endif /* unused */
+# endif /* unused */
 
 static int hdaStreamStop(PHDASTREAM pStream)
@@ -1876,5 +1878,5 @@
         return VINF_SUCCESS;
 
-#if 0 /** @todo Does not work (yet), as EMT deadlocks then. */
+# if 0 /** @todo Does not work (yet), as EMT deadlocks then. */
     /*
      * Wait for the stream to stop.
@@ -1893,7 +1895,7 @@
                 pStream->u8Strm, fActive ? "active" : "stopped", rc));
     }
-#else
+# else
     int rc = VINF_SUCCESS;
-#endif
+# endif
 
     LogFlowFuncLeaveRC(rc);
@@ -1901,5 +1903,5 @@
 }
 
-#if defined(VBOX_WITH_HDA_INTERLEAVING_STREAMS_SUPPORT) || defined(VBOX_WITH_HDA_51_SURROUND)
+# if defined(VBOX_WITH_HDA_INTERLEAVING_STREAMS_SUPPORT) || defined(VBOX_WITH_HDA_51_SURROUND)
 static int hdaStreamChannelExtract(PPDMAUDIOSTREAMCHANNEL pChan, const void *pvBuf, size_t cbBuf)
 {
@@ -1949,7 +1951,7 @@
     return VINF_SUCCESS;
 }
-#endif /* defined(VBOX_WITH_HDA_INTERLEAVING_STREAMS_SUPPORT) || defined(VBOX_WITH_HDA_51_SURROUND) */
-
-#if 0 /** @todo hdaStreamChannelAdvance is unused */
+# endif /* defined(VBOX_WITH_HDA_INTERLEAVING_STREAMS_SUPPORT) || defined(VBOX_WITH_HDA_51_SURROUND) */
+
+# if 0 /** @todo hdaStreamChannelAdvance is unused */
 static int hdaStreamChannelAdvance(PPDMAUDIOSTREAMCHANNEL pChan, size_t cbAdv)
 {
@@ -1961,5 +1963,5 @@
     return VINF_SUCCESS;
 }
-#endif
+# endif
 
 static int hdaStreamChannelDataInit(PPDMAUDIOSTREAMCHANNELDATA pChanData, uint32_t fFlags)
@@ -1993,5 +1995,5 @@
 }
 
-#if defined(VBOX_WITH_HDA_INTERLEAVING_STREAMS_SUPPORT) || defined(VBOX_WITH_HDA_51_SURROUND)
+# if defined(VBOX_WITH_HDA_INTERLEAVING_STREAMS_SUPPORT) || defined(VBOX_WITH_HDA_51_SURROUND)
 
 static int hdaStreamChannelAcquireData(PPDMAUDIOSTREAMCHANNELDATA pChanData, void *pvData, size_t *pcbData)
@@ -2015,5 +2017,5 @@
 }
 
-#endif /* defined(VBOX_WITH_HDA_INTERLEAVING_STREAMS_SUPPORT) || defined(VBOX_WITH_HDA_51_SURROUND) */
+# endif /* defined(VBOX_WITH_HDA_INTERLEAVING_STREAMS_SUPPORT) || defined(VBOX_WITH_HDA_51_SURROUND) */
 
 # if 0 /* currently unused */
Index: trunk/src/VBox/Devices/Audio/DevSB16.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Audio/DevSB16.cpp	(revision 63478)
@@ -416,6 +416,6 @@
 }
 
-#ifdef DEBUG
-static inline void log_dsp(PSB16STATE pThis)
+#if 0 // unused // def DEBUG
+DECLINLINE(void) log_dsp(PSB16STATE pThis)
 {
     LogFlowFunc(("%s:%s:%d:%s:dmasize=%d:freq=%d:const=%d:speaker=%d\n",
Index: trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
===================================================================
--- trunk/src/VBox/Devices/Bus/DevPciIch9.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Bus/DevPciIch9.cpp	(revision 63478)
@@ -541,4 +541,6 @@
 }
 
+#ifdef IN_RING3
+
 /* return the global irq number corresponding to a given device irq
    pin. We could also use the bus number to have a more precise
@@ -553,4 +555,6 @@
 /* irqs corresponding to PCI irqs A-D, must match pci_irq_list in rombios.c */
 static const uint8_t aPciIrqs[4] = { 11, 10, 9, 5 };
+
+#endif /* IN_RING3 */
 
 /* Add one more level up request on APIC input line */
Index: trunk/src/VBox/Devices/Bus/MsiCommon.cpp
===================================================================
--- trunk/src/VBox/Devices/Bus/MsiCommon.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Bus/MsiCommon.cpp	(revision 63478)
@@ -99,4 +99,6 @@
 }
 
+#ifdef IN_RING3
+
 DECLINLINE(bool) msiBitJustCleared(uint32_t uOldValue,
                                    uint32_t uNewValue,
@@ -113,5 +115,4 @@
 }
 
-#ifdef IN_RING3
 void     MsiPciConfigWrite(PPDMDEVINS pDevIns, PCPDMPCIHLP pPciHlp, PPCIDEVICE pDev,
                            uint32_t u32Address, uint32_t val, unsigned len)
Index: trunk/src/VBox/Devices/EFI/DevEFI.cpp
===================================================================
--- trunk/src/VBox/Devices/EFI/DevEFI.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/EFI/DevEFI.cpp	(revision 63478)
@@ -1909,4 +1909,6 @@
 }
 
+
+#if 0 /* unused */
 /**
  * Helper that searches for a FFS file of a given type.
@@ -1922,5 +1924,5 @@
 efiFwVolFindFileByType(EFI_FFS_FILE_HEADER const *pFfsFile, uint8_t const *pbEnd, EFI_FV_FILETYPE FileType, uint32_t *pcbFile)
 {
-#define FFS_SIZE(hdr)   RT_MAKE_U32_FROM_U8((hdr)->Size[0], (hdr)->Size[1], (hdr)->Size[2], 0)
+# define FFS_SIZE(hdr)   RT_MAKE_U32_FROM_U8((hdr)->Size[0], (hdr)->Size[1], (hdr)->Size[2], 0)
     while ((uintptr_t)pFfsFile < (uintptr_t)pbEnd)
     {
@@ -1933,7 +1935,8 @@
         pFfsFile = (EFI_FFS_FILE_HEADER *)((uintptr_t)pFfsFile + RT_ALIGN(FFS_SIZE(pFfsFile), 8));
     }
-#undef FFS_SIZE
+# undef FFS_SIZE
     return NULL;
 }
+#endif /* unused */
 
 
Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp	(revision 63478)
@@ -3106,6 +3106,6 @@
             default:
 # ifdef VBOX_WITH_VMSVGA3D
-                if (    enmCmdId >= SVGA_3D_CMD_BASE
-                    &&  enmCmdId <  SVGA_3D_CMD_MAX)
+                if (    (int)enmCmdId >= SVGA_3D_CMD_BASE
+                    &&  (int)enmCmdId <  SVGA_3D_CMD_MAX)
                 {
                     /* All 3d commands start with a common header, which defines the size of the command. */
Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 63478)
@@ -1090,4 +1090,5 @@
 
 #ifdef RT_OS_DARWIN
+    RT_NOREF(pOldViewport);
     PVMSVGA3DSTATE pState = pThis->svga.p3dState;
     if (   pState
@@ -3601,4 +3602,5 @@
 
 #elif defined(RT_OS_DARWIN)
+    RT_NOREF(pState);
     vmsvga3dCocoaViewSetSize(pContext->cocoaView, pThis->svga.uWidth, pThis->svga.uHeight);
 
Index: trunk/src/VBox/Devices/Graphics/DevVGA.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 63478)
@@ -269,4 +269,5 @@
 *   Global Variables                                                                                                             *
 *********************************************************************************************************************************/
+#ifdef IN_RING3
 /* "Press F12 to select boot device." bitmap. */
 static const uint8_t g_abLogoF12BootText[] =
@@ -306,4 +307,5 @@
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
+#endif /* IN_RING3 */
 
 
Index: trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp	(revision 63478)
@@ -1039,9 +1039,11 @@
 }
 
-DECLINLINE(void) vboxVDMACrCtlRetain (PVBOXVDMACMD_CHROMIUM_CTL pCmd)
+#if 0 /* unused */
+DECLINLINE(void) vboxVDMACrCtlRetain(PVBOXVDMACMD_CHROMIUM_CTL pCmd)
 {
     PVBOXVDMACMD_CHROMIUM_CTL_PRIVATE pHdr = VBOXVDMACMD_CHROMIUM_CTL_PRIVATE_FROM_CTL(pCmd);
     ASMAtomicIncU32(&pHdr->cRefs);
 }
+#endif /* unused */
 
 DECLINLINE(int) vboxVDMACrCtlGetRc (PVBOXVDMACMD_CHROMIUM_CTL pCmd)
Index: trunk/src/VBox/Devices/Graphics/shaderlib/directx.c
===================================================================
--- trunk/src/VBox/Devices/Graphics/shaderlib/directx.c	(revision 63477)
+++ trunk/src/VBox/Devices/Graphics/shaderlib/directx.c	(revision 63478)
@@ -56,5 +56,7 @@
 
 /* The d3d device ID */
+#if 0 /* VBox: unused */
 static const GUID IID_D3DDEVICE_D3DUID = { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
+#endif
 
 
@@ -904,4 +906,5 @@
 };
 
+#if 0 /* VBox: unused */
 static const struct driver_version_information driver_version_table[] =
 {
@@ -960,4 +963,5 @@
     /* TODO: Add information about legacy ATI hardware, Intel and other cards. */
 };
+#endif /* VBox: unused */
 
 
Index: trunk/src/VBox/Devices/Input/PS2K.cpp
===================================================================
--- trunk/src/VBox/Devices/Input/PS2K.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Input/PS2K.cpp	(revision 63478)
@@ -267,4 +267,9 @@
 } key_def;
 
+
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
+#ifdef IN_RING3
 /* USB to PS/2 conversion table for regular keys. */
 static const   key_def   aPS2Keys[] = {
@@ -461,13 +466,6 @@
 };
 
-
-/*********************************************************************************************************************************
-*   Global Variables                                                                                                             *
-*********************************************************************************************************************************/
-
-
-/*********************************************************************************************************************************
-*   Internal Functions                                                                                                           *
-*********************************************************************************************************************************/
+#endif /* IN_RING3 */
+
 
 
Index: trunk/src/VBox/Devices/Input/UsbKbd.cpp
===================================================================
--- trunk/src/VBox/Devices/Input/UsbKbd.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Input/UsbKbd.cpp	(revision 63478)
@@ -463,4 +463,5 @@
 
 
+#if 0 /* unused */
 /**
  * Checks if the queue is empty or not.
@@ -473,4 +474,5 @@
     return pQueue->pHead == NULL;
 }
+#endif /* unused */
 
 
Index: trunk/src/VBox/Devices/Input/UsbMouse.cpp
===================================================================
--- trunk/src/VBox/Devices/Input/UsbMouse.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Input/UsbMouse.cpp	(revision 63478)
@@ -1071,4 +1071,5 @@
 
 
+#if 0 /* unused */
 /**
  * Checks if the queue is empty or not.
@@ -1081,4 +1082,5 @@
     return pQueue->pHead == NULL;
 }
+#endif /* unused */
 
 
Index: trunk/src/VBox/Devices/Network/DevE1000.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/DevE1000.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Network/DevE1000.cpp	(revision 63478)
@@ -218,4 +218,5 @@
 #define E1K_CHIP_82545EM 2
 
+#ifdef IN_RING3
 /** Different E1000 chips. */
 static const struct E1kChips
@@ -226,18 +227,19 @@
     uint16_t uPCISubsystemId;
     const char *pcszName;
-} g_Chips[] =
+} g_aChips[] =
 {
     /* Vendor Device SSVendor SubSys  Name */
     { 0x8086,
       /* Temporary code, as MSI-aware driver dislike 0x100E. How to do that right? */
-#ifdef E1K_WITH_MSI
+# ifdef E1K_WITH_MSI
       0x105E,
-#else
+# else
       0x100E,
-#endif
+# endif
                       0x8086, 0x001E, "82540EM" }, /* Intel 82540EM-A in Intel PRO/1000 MT Desktop */
     { 0x8086, 0x1004, 0x8086, 0x1004, "82543GC" }, /* Intel 82543GC   in Intel PRO/1000 T  Server */
     { 0x8086, 0x100F, 0x15AD, 0x0750, "82545EM" }  /* Intel 82545EM-A in VMWare Network Adapter */
 };
+#endif /* IN_RING3 */
 
 
@@ -1552,4 +1554,5 @@
 }
 
+#ifdef IN_RING3
 /**
  * Cancel a timer.
@@ -1568,4 +1571,5 @@
     RT_NOREF1(pThis);
 }
+#endif /* IN_RING3 */
 
 #define e1kCsEnter(ps, rc) PDMCritSectEnter(&ps->cs, rc)
@@ -1748,4 +1752,6 @@
 }
 
+
+#if defined(E1K_WITH_RXD_CACHE) && defined(IN_RING3) /* currently only used in ring-3 due to stack space requirements of the caller */
 /**
  * Dump receive descriptor to debug log.
@@ -1777,4 +1783,5 @@
              E1K_SPEC_PRI(pDesc->status.u16Special)));
 }
+#endif /* E1K_WITH_RXD_CACHE && IN_RING3 */
 
 /**
@@ -1954,4 +1961,5 @@
 }
 
+#ifdef IN_RING3 /* currently only used in ring-3 due to stack space requirements of the caller */
 /**
  * Advance the head pointer of the receive descriptor queue.
@@ -1992,6 +2000,8 @@
     //e1kCsLeave(pThis);
 }
+#endif /* IN_RING3 */
 
 #ifdef E1K_WITH_RXD_CACHE
+
 /**
  * Return the number of RX descriptor that belong to the hardware.
@@ -2087,4 +2097,6 @@
 }
 
+# ifdef IN_RING3 /* currently only used in ring-3 due to stack space requirements of the caller */
+
 /**
  * Obtain the next RX descriptor from RXD cache, fetching descriptors from the
@@ -2111,4 +2123,5 @@
     return NULL;
 }
+
 
 /**
@@ -2136,5 +2149,4 @@
 }
 
-# ifdef IN_RING3 /* currently only used in ring-3 due to stack space requirements of the caller */
 /**
  * Store a fragment of received packet at the specifed address.
@@ -2154,4 +2166,5 @@
     STAM_PROFILE_ADV_STOP(&pThis->StatReceiveStore, a);
 }
+
 # endif
 
@@ -2206,4 +2219,5 @@
     STAM_PROFILE_ADV_STOP(&pThis->StatReceiveStore, a);
 }
+
 #endif /* !E1K_WITH_RXD_CACHE */
 
@@ -3244,5 +3258,5 @@
 #  ifndef E1K_NO_TAD
     e1kCancelTimer(pThis, pThis->CTX_SUFF(pTADTimer));
-#  endif /* E1K_NO_TAD */
+#  endif
     e1kRaiseInterrupt(pThis, ICR_TXDW);
 }
@@ -4451,5 +4465,5 @@
                 /* Cancel both timers if armed and fire immediately. */
                 e1kCancelTimer(pThis, pThis->CTX_SUFF(pTADTimer));
-# endif /* E1K_NO_TAD */
+# endif
 #endif /* E1K_USE_TX_TIMERS */
                 E1K_INC_ISTAT_CNT(pThis->uStatIntTx);
@@ -7018,5 +7032,5 @@
     pHlp->pfnPrintf(pHlp, "E1000 #%d: port=%RTiop mmio=%RGp mac-cfg=%RTmac %s%s%s\n",
                     pDevIns->iInstance, pThis->IOPortBase, pThis->addrMMReg,
-                    &pThis->macConfigured, g_Chips[pThis->eChip].pcszName,
+                    &pThis->macConfigured, g_aChips[pThis->eChip].pcszName,
                     pThis->fRCEnabled ? " GC" : "", pThis->fR0Enabled ? " R0" : "");
 
@@ -7375,10 +7389,10 @@
 static DECLCALLBACK(void) e1kConfigurePciDev(PPCIDEVICE pPciDev, E1KCHIP eChip)
 {
-    Assert(eChip < RT_ELEMENTS(g_Chips));
+    Assert(eChip < RT_ELEMENTS(g_aChips));
     /* Configure PCI Device, assume 32-bit mode ******************************/
-    PCIDevSetVendorId(pPciDev, g_Chips[eChip].uPCIVendorId);
-    PCIDevSetDeviceId(pPciDev, g_Chips[eChip].uPCIDeviceId);
-    PCIDevSetWord( pPciDev, VBOX_PCI_SUBSYSTEM_VENDOR_ID, g_Chips[eChip].uPCISubsystemVendorId);
-    PCIDevSetWord( pPciDev, VBOX_PCI_SUBSYSTEM_ID, g_Chips[eChip].uPCISubsystemId);
+    PCIDevSetVendorId(pPciDev, g_aChips[eChip].uPCIVendorId);
+    PCIDevSetDeviceId(pPciDev, g_aChips[eChip].uPCIDeviceId);
+    PCIDevSetWord( pPciDev, VBOX_PCI_SUBSYSTEM_VENDOR_ID, g_aChips[eChip].uPCISubsystemVendorId);
+    PCIDevSetWord( pPciDev, VBOX_PCI_SUBSYSTEM_ID, g_aChips[eChip].uPCISubsystemId);
 
     PCIDevSetWord( pPciDev, VBOX_PCI_COMMAND,            0x0000);
@@ -7568,5 +7582,5 @@
 
     LogRel(("%s Chip=%s LinkUpDelay=%ums EthernetCRC=%s GSO=%s Itr=%s ItrRx=%s R0=%s GC=%s\n", pThis->szPrf,
-            g_Chips[pThis->eChip].pcszName, pThis->cMsLinkUpDelay,
+            g_aChips[pThis->eChip].pcszName, pThis->cMsLinkUpDelay,
             pThis->fEthernetCRC ? "on" : "off",
             pThis->fGSOEnabled ? "enabled" : "disabled",
Index: trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/DevVirtioNet.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Network/DevVirtioNet.cpp	(revision 63478)
@@ -274,4 +274,6 @@
 AssertCompileSize(VNETCTLHDR, 2);
 
+#ifdef IN_RING3
+
 /** Returns true if large packets are written into several RX buffers. */
 DECLINLINE(bool) vnetMergeableRxBuffers(PVNETSTATE pThis)
@@ -289,4 +291,6 @@
     vpciCsLeave(&pThis->VPCI);
 }
+
+#endif /* IN_RING3 */
 
 DECLINLINE(int) vnetCsRxEnter(PVNETSTATE pThis, int rcBusy)
@@ -307,4 +311,5 @@
 }
 
+#ifdef IN_RING3
 /**
  * Dump a packet to debug log.
@@ -317,12 +322,13 @@
 DECLINLINE(void) vnetPacketDump(PVNETSTATE pThis, const uint8_t *pbPacket, size_t cb, const char *pszText)
 {
-#ifdef DEBUG
+# ifdef DEBUG
     Log(("%s %s packet #%d (%d bytes):\n",
          INSTANCE(pThis), pszText, ++pThis->u32PktNo, cb));
     Log3(("%.*Rhxd\n", cb, pbPacket));
-#else
+# else
     RT_NOREF4(pThis, pbPacket, cb, pszText);
-#endif
-}
+# endif
+}
+#endif /* IN_RING3 */
 
 /**
Index: trunk/src/VBox/Devices/Network/DrvIntNet.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/DrvIntNet.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Network/DrvIntNet.cpp	(revision 63478)
@@ -269,5 +269,5 @@
  * @param   pThis               The instance data..
  */
-DECLINLINE(int) drvIntNetSignalXmit(PDRVINTNET pThis)
+DECLINLINE(int) drvR0IntNetSignalXmit(PDRVINTNET pThis)
 {
     /// @todo if (!ASMAtomicXchgBool(&pThis->fXmitSignalled, true)) - needs careful optimizing.
@@ -279,5 +279,5 @@
     return VERR_TRY_AGAIN;
 }
-#endif
+#endif /* !IN_RING3 */
 
 
@@ -306,5 +306,5 @@
     {
         ASMAtomicUoWriteBool(&pThis->fXmitProcessRing, true);
-        drvIntNetSignalXmit(pThis);
+        drvR0IntNetSignalXmit(pThis);
         rc = VINF_SUCCESS;
     }
@@ -351,5 +351,5 @@
         rc = VERR_TRY_AGAIN;
 #else  /* IN_RING0 */
-        rc = drvIntNetSignalXmit(pThis);
+        rc = drvR0IntNetSignalXmit(pThis);
 #endif /* IN_RING0 */
     }
@@ -381,5 +381,5 @@
     PPDMSCATTERGATHER pSgBuf = &pThis->u.Sg;
     if (RT_UNLIKELY(pSgBuf->fFlags != 0))
-        return drvIntNetSignalXmit(pThis);
+        return drvR0IntNetSignalXmit(pThis);
 #endif
 
@@ -444,5 +444,5 @@
     {
         pThis->fXmitProcessRing = true;
-        rc = drvIntNetSignalXmit(pThis);
+        rc = drvR0IntNetSignalXmit(pThis);
     }
     else
Index: trunk/src/VBox/Devices/Network/DrvNAT.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/DrvNAT.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Network/DrvNAT.cpp	(revision 63478)
@@ -1145,4 +1145,6 @@
             else
                 LogRel(("NAT: DNS server list is empty (2)\n"));
+#else
+            RT_NOREF(hDynStor);
 #endif
             drvNATUpdateDNS(pThis, /* fFlapLink */ true);
Index: trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp	(revision 63478)
@@ -897,5 +897,5 @@
     return Addr.u == UINT32_MAX;
 }
-#endif
+#endif /* unused */
 
 
@@ -1032,5 +1032,4 @@
     return intnetR0IfAddrCacheLookup(pCache, pAddr, cbAddr);
 }
-
 
 #if 0 /* unused */
@@ -1220,5 +1219,4 @@
 
 #if 0 /* unused */
-
 /**
  * Deletes the address from all the interface caches except the specified one.
@@ -1252,6 +1250,5 @@
     RTSpinlockRelease(pNetwork->hAddrSpinlock);
 }
-
-#endif
+#endif /* unused */
 
 
Index: trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
===================================================================
--- trunk/src/VBox/Devices/Network/slirp/ip_icmp.c	(revision 63477)
+++ trunk/src/VBox/Devices/Network/slirp/ip_icmp.c	(revision 63478)
@@ -64,5 +64,5 @@
 /* The message sent when emulating PING */
 /* Be nice and tell them it's just a psuedo-ping packet */
-#if 0
+#if 0 /* unused */
 static const char icmp_ping_msg[] = "This is a psuedo-PING packet used by Slirp to emulate ICMP ECHO-REQUEST packets.\n";
 #endif
Index: trunk/src/VBox/Devices/Network/slirp/tftp.c
===================================================================
--- trunk/src/VBox/Devices/Network/slirp/tftp.c	(revision 63477)
+++ trunk/src/VBox/Devices/Network/slirp/tftp.c	(revision 63478)
@@ -196,4 +196,5 @@
 
 
+#if 0 /* unused */
 DECLINLINE(bool) tftpIsAcceptableOption(const char *pszOptionName)
 {
@@ -214,4 +215,5 @@
     return false;
 }
+#endif /* unused */
 
 
Index: trunk/src/VBox/Devices/PC/DevRTC.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevRTC.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/PC/DevRTC.cpp	(revision 63478)
@@ -264,4 +264,5 @@
 
 
+#ifdef IN_RING3
 DECLINLINE(int) to_bcd(PRTCSTATE pThis, int a)
 {
@@ -270,4 +271,5 @@
     return ((a / 10) << 4) | (a % 10);
 }
+#endif
 
 
Index: trunk/src/VBox/Devices/Storage/DevAHCI.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 63478)
@@ -5476,8 +5476,10 @@
 }
 
+#if 0 /* unused */
 DECLINLINE(uint8_t) ahciGetTagQueued(uint8_t *pCmdFis)
 {
     return pCmdFis[AHCI_CMDFIS_SECTC] >> 3;
 }
+#endif /* unused */
 
 /**
Index: trunk/src/VBox/Devices/Storage/DevATA.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DevATA.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Storage/DevATA.cpp	(revision 63478)
@@ -548,4 +548,5 @@
 
 
+#ifdef IN_RING3
 DECLINLINE(void) ataSetStatusValue(ATADevState *s, uint8_t stat)
 {
@@ -559,4 +560,5 @@
     }
 }
+#endif /* IN_RING3 */
 
 
@@ -722,6 +724,8 @@
 static const ATARequest g_ataDMARequest    = { ATA_AIO_DMA,            { { 0, 0, 0, 0, 0 } } };
 static const ATARequest g_ataPIORequest    = { ATA_AIO_PIO,            { { 0, 0, 0, 0, 0 } } };
+# ifdef IN_RING3
 static const ATARequest g_ataResetARequest = { ATA_AIO_RESET_ASSERTED, { { 0, 0, 0, 0, 0 } } };
 static const ATARequest g_ataResetCRequest = { ATA_AIO_RESET_CLEARED,  { { 0, 0, 0, 0, 0 } } };
+# endif
 
 # ifdef IN_RING3
@@ -1166,4 +1170,6 @@
 }
 
+
+#if 0 /* unused */
 /**
  * Compares two MSF values.
@@ -1193,4 +1199,5 @@
     return iRes;
 }
+#endif /* unused */
 
 static void ataR3CmdOK(ATADevState *s, uint8_t status)
Index: trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DevBusLogic.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Storage/DevBusLogic.cpp	(revision 63478)
@@ -304,8 +304,10 @@
 #define ISA_BASE_DISABLED   6
 
+#ifdef IN_RING3
 static uint16_t const g_aISABases[NUM_ISA_BASES] =
 {
     0x330, 0x334, 0x230, 0x234, 0x130, 0x134, 0, 0
 };
+#endif
 /** @}  */
 
Index: trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DrvHostBase.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/Storage/DrvHostBase.cpp	(revision 63478)
@@ -664,4 +664,5 @@
 static void drvHostBaseDADoneCallback(DADiskRef DiskRef, DADissenterRef DissenterRef, void *pvContext)
 {
+    RT_NOREF(DiskRef);
     int *prc = (int *)pvContext;
     if (!DissenterRef)
@@ -792,8 +793,10 @@
 {
 # ifdef RT_OS_DARWIN
+    RT_NOREF(fReadOnly);
+
     /* Darwin is kind of special... */
     Assert(!pFileDevice); NOREF(pFileDevice);
     Assert(!pThis->cbBlock);
-    Assert(!pThis->MasterPort);
+    Assert(pThis->MasterPort == IO_OBJECT_NULL);
     Assert(!pThis->ppMMCDI);
     Assert(!pThis->ppScsiTaskDI);
@@ -818,5 +821,5 @@
      * do the search and get a collection of keyboards.
      */
-    io_iterator_t DVDServices = NULL;
+    io_iterator_t DVDServices = IO_OBJECT_NULL;
     IOReturn irc = IOServiceGetMatchingServices(pThis->MasterPort, RefMatchingDict, &DVDServices);
     AssertMsgReturn(irc == kIOReturnSuccess, ("irc=%d\n", irc), VERR_NOT_FOUND);
@@ -1138,5 +1141,7 @@
         RTFileClose(pThis->hFileDevice);
     pThis->hFileDevice = hFileDevice;
-#endif /* !RT_OS_DARWIN */
+#else  /* RT_OS_DARWIN */
+    RT_NOREF(pThis);
+#endif /* RT_OS_DARWIN */
     return VINF_SUCCESS;
 }
@@ -1792,8 +1797,8 @@
         pThis->ppMMCDI = NULL;
     }
-    if (pThis->MasterPort)
+    if (pThis->MasterPort != IO_OBJECT_NULL)
     {
         mach_port_deallocate(mach_task_self(), pThis->MasterPort);
-        pThis->MasterPort = 0;
+        pThis->MasterPort = IO_OBJECT_NULL;
     }
     if (pThis->pDASession)
@@ -1875,5 +1880,5 @@
     pThis->ThreadPoller                     = NIL_RTTHREAD;
 #ifdef RT_OS_DARWIN
-    pThis->MasterPort                       = NULL;
+    pThis->MasterPort                       = IO_OBJECT_NULL;
     pThis->ppMMCDI                          = NULL;
     pThis->ppScsiTaskDI                     = NULL;
Index: trunk/src/VBox/Devices/USB/DevOHCI.cpp
===================================================================
--- trunk/src/VBox/Devices/USB/DevOHCI.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/USB/DevOHCI.cpp	(revision 63478)
@@ -772,8 +772,42 @@
 #ifndef VBOX_DEVICE_STRUCT_TESTCASE
 
+#ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
+/*
+ * Explain
+ */
+typedef struct OHCIDESCREADSTATS
+{
+    uint32_t cReads;
+    uint32_t cPageChange;
+    uint32_t cMinReadsPerPage;
+    uint32_t cMaxReadsPerPage;
+
+    uint32_t cReadsLastPage;
+    uint32_t u32LastPageAddr;
+} OHCIDESCREADSTATS;
+typedef OHCIDESCREADSTATS *POHCIDESCREADSTATS;
+
+typedef struct OHCIPHYSREADSTATS
+{
+    OHCIDESCREADSTATS ed;
+    OHCIDESCREADSTATS td;
+    OHCIDESCREADSTATS all;
+
+    uint32_t cCrossReads;
+    uint32_t cCacheReads;
+    uint32_t cPageReads;
+} OHCIPHYSREADSTATS;
+typedef OHCIPHYSREADSTATS *POHCIPHYSREADSTATS;
+typedef OHCIPHYSREADSTATS const *PCOHCIPHYSREADSTATS;
+#endif /* VBOX_WITH_OHCI_PHYS_READ_STATS */
+
 
 /*********************************************************************************************************************************
 *   Global Variables                                                                                                             *
 *********************************************************************************************************************************/
+#if defined(VBOX_WITH_OHCI_PHYS_READ_STATS) && defined(IN_RING3)
+static OHCIPHYSREADSTATS g_PhysReadState;
+#endif
+
 #if defined(LOG_ENABLED) && defined(IN_RING3)
 static bool g_fLogBulkEPs = false;
@@ -873,4 +907,6 @@
 }
 
+#ifdef IN_RING3
+
 /**
  * Set an interrupt, use the wrapper ohciSetInterrupt.
@@ -895,8 +931,6 @@
  * Set an interrupt wrapper macro for logging purposes.
  */
-#define ohciSetInterrupt(ohci, a_rcBusy, intr) ohciSetInterruptInt(ohci, a_rcBusy, intr, #intr)
-#define ohciR3SetInterrupt(ohci, intr) ohciSetInterruptInt(ohci, VERR_IGNORED, intr, #intr)
-
-#ifdef IN_RING3
+# define ohciR3SetInterrupt(ohci, intr) ohciSetInterruptInt(ohci, VERR_IGNORED, intr, #intr)
+
 
 /* Carry out a hardware remote wakeup */
@@ -1217,5 +1251,4 @@
         VUSBIDevReset(pThis->RootHub.pIDev, fResetOnLinux, NULL, NULL, NULL);
 }
-#endif /* IN_RING3 */
 
 /**
@@ -1243,8 +1276,8 @@
 {
     ohciPhysRead(pThis, Addr, pau32s, c32s * sizeof(uint32_t));
-#ifndef RT_LITTLE_ENDIAN
+# ifndef RT_LITTLE_ENDIAN
     for(int i = 0; i < c32s; i++)
         pau32s[i] = RT_H2LE_U32(pau32s[i]);
-#endif
+# endif
 }
 
@@ -1254,7 +1287,7 @@
 DECLINLINE(void) ohciPutDWords(POHCI pThis, uint32_t Addr, const uint32_t *pau32s, int cu32s)
 {
-#ifdef RT_LITTLE_ENDIAN
+# ifdef RT_LITTLE_ENDIAN
     ohciPhysWrite(pThis, Addr, pau32s, cu32s << 2);
-#else
+# else
     for (int i = 0; i < c32s; i++, pau32s++, Addr += sizeof(*pau32s))
     {
@@ -1262,36 +1295,12 @@
         ohciPhysWrite(pThis, Addr, (uint8_t *)&u32Tmp, sizeof(u32Tmp));
     }
-#endif
-}
-
-
-#ifdef IN_RING3
-
-#ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
-struct DescReadStats
-{
-    uint32_t cReads;
-    uint32_t cPageChange;
-    uint32_t cMinReadsPerPage;
-    uint32_t cMaxReadsPerPage;
-
-    uint32_t cReadsLastPage;
-    uint32_t u32LastPageAddr;
-};
-
-struct PhysReadStats
-{
-    struct DescReadStats ed;
-    struct DescReadStats td;
-    struct DescReadStats all;
-
-    uint32_t cCrossReads;
-    uint32_t cCacheReads;
-    uint32_t cPageReads;
-};
-
-static struct PhysReadStats physReadStats;
-
-static void descReadStatsReset(struct DescReadStats *p)
+# endif
+}
+
+
+
+# ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
+
+static void descReadStatsReset(POHCIDESCREADSTATS p)
 {
     p->cReads = 0;
@@ -1304,5 +1313,5 @@
 }
 
-static void physReadStatsReset(struct PhysReadStats *p)
+static void physReadStatsReset(POHCIPHYSREADSTATS p)
 {
     descReadStatsReset(&p->ed);
@@ -1315,5 +1324,5 @@
 }
 
-static void physReadStatsUpdateDesc(struct DescReadStats *p, uint32_t u32Addr)
+static void physReadStatsUpdateDesc(POHCIDESCREADSTATS p, uint32_t u32Addr)
 {
     const uint32_t u32PageAddr = u32Addr & ~UINT32_C(0xFFF);
@@ -1345,5 +1354,5 @@
 }
 
-static void physReadStatsPrint(struct PhysReadStats *p)
+static void physReadStatsPrint(PCOHCIPHYSREADSTATS p)
 {
     p->ed.cMinReadsPerPage = RT_MIN(p->ed.cMinReadsPerPage, p->ed.cReadsLastPage);
@@ -1370,7 +1379,8 @@
     physReadStatsReset(p);
 }
-#endif /* VBOX_WITH_OHCI_PHYS_READ_STATS */
-
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+
+# endif /* VBOX_WITH_OHCI_PHYS_READ_STATS */
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+
 static POHCIPAGECACHE ohciPhysReadCacheAlloc(void)
 {
@@ -1399,20 +1409,20 @@
                               pPageCache->au8PhysReadCache, sizeof(pPageCache->au8PhysReadCache));
             pPageCache->GCPhysReadCacheAddr = PageAddr;
-#ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
-            ++physReadStats.cPageReads;
-#endif
+#  ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
+            ++g_PhysReadState.cPageReads;
+#  endif
         }
 
         memcpy(pvBuf, &pPageCache->au8PhysReadCache[GCPhys & PAGE_OFFSET_MASK], cbBuf);
-#ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
-        ++physReadStats.cCacheReads;
-#endif
+#  ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
+        ++g_PhysReadState.cCacheReads;
+#  endif
     }
     else
     {
         PDMDevHlpPhysRead(pThis->pDevInsR3, GCPhys, pvBuf, cbBuf);
-#ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
-        ++physReadStats.cCrossReads;
-#endif
+#  ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
+        ++g_PhysReadState.cCrossReads;
+#  endif
     }
 }
@@ -1427,5 +1437,6 @@
     ohciPhysReadCacheRead(pThis, pThis->pCacheTD, TdAddr, pTd, sizeof(*pTd));
 }
-#endif /* VBOX_WITH_OHCI_PHYS_READ_CACHE */
+
+# endif /* VBOX_WITH_OHCI_PHYS_READ_CACHE */
 
 /**
@@ -1434,8 +1445,8 @@
 DECLINLINE(void) ohciReadEd(POHCI pThis, uint32_t EdAddr, POHCIED pEd)
 {
-#ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
-    physReadStatsUpdateDesc(&physReadStats.ed, EdAddr);
-    physReadStatsUpdateDesc(&physReadStats.all, EdAddr);
-#endif
+# ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
+    physReadStatsUpdateDesc(&g_PhysReadState.ed, EdAddr);
+    physReadStatsUpdateDesc(&g_PhysReadState.all, EdAddr);
+# endif
     ohciGetDWords(pThis, EdAddr, (uint32_t *)pEd, sizeof(*pEd) >> 2);
 }
@@ -1446,10 +1457,10 @@
 DECLINLINE(void) ohciReadTd(POHCI pThis, uint32_t TdAddr, POHCITD pTd)
 {
-#ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
-    physReadStatsUpdateDesc(&physReadStats.td, TdAddr);
-    physReadStatsUpdateDesc(&physReadStats.all, TdAddr);
-#endif
+# ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
+    physReadStatsUpdateDesc(&g_PhysReadState.td, TdAddr);
+    physReadStatsUpdateDesc(&g_PhysReadState.all, TdAddr);
+# endif
     ohciGetDWords(pThis, TdAddr, (uint32_t *)pTd, sizeof(*pTd) >> 2);
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (LogIs3Enabled())
     {
@@ -1468,5 +1479,5 @@
               pTd->be,
               pTd->hwinfo & TD_HWINFO_UNKNOWN_MASK));
-#if 0
+#  if 0
         if (LogIs3Enabled())
         {
@@ -1493,7 +1504,7 @@
                   sizeof(abXpTd), &abXpTd[0]));
         }
-#endif
-    }
-#endif
+#  endif
+    }
+# endif
 }
 
@@ -1504,5 +1515,5 @@
 {
     ohciGetDWords(pThis, ITdAddr, (uint32_t *)pITd, sizeof(*pITd) / sizeof(uint32_t));
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (LogIs3Enabled())
     {
@@ -1526,5 +1537,5 @@
               pITd->aPSW[7] >> 12, pITd->aPSW[7] & 0xfff));
     }
-#endif
+# endif
 }
 
@@ -1535,5 +1546,5 @@
 DECLINLINE(void) ohciWriteEd(POHCI pThis, uint32_t EdAddr, PCOHCIED pEd)
 {
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (LogIs3Enabled())
     {
@@ -1558,5 +1569,5 @@
               EdOld.NextED != pEd->NextED ? "*" : "", pEd->NextED));
     }
-#endif
+# endif
 
     ohciPutDWords(pThis, EdAddr, (uint32_t *)pEd, sizeof(*pEd) >> 2);
@@ -1569,5 +1580,5 @@
 DECLINLINE(void) ohciWriteTd(POHCI pThis, uint32_t TdAddr, PCOHCITD pTd, const char *pszLogMsg)
 {
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (LogIs3Enabled())
     {
@@ -1588,7 +1599,7 @@
               pszLogMsg));
     }
-#else
+# else
     RT_NOREF(pszLogMsg);
-#endif
+# endif
     ohciPutDWords(pThis, TdAddr, (uint32_t *)pTd, sizeof(*pTd) >> 2);
 }
@@ -1599,5 +1610,5 @@
 DECLINLINE(void) ohciWriteITd(POHCI pThis, uint32_t ITdAddr, PCOHCIITD pITd, const char *pszLogMsg)
 {
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (LogIs3Enabled())
     {
@@ -1625,12 +1636,12 @@
               (ITdOld.aPSW[7] >> 12) != (pITd->aPSW[7] >> 12) ? "*" : "", pITd->aPSW[7] >> 12,  (ITdOld.aPSW[7] & 0xfff) != (pITd->aPSW[7] & 0xfff) ? "*" : "", pITd->aPSW[7] & 0xfff));
     }
-#else
+# else
     RT_NOREF(pszLogMsg);
-#endif
+# endif
     ohciPutDWords(pThis, ITdAddr, (uint32_t *)pITd, sizeof(*pITd) / sizeof(uint32_t));
 }
 
 
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
 
 /**
@@ -1770,5 +1781,5 @@
 }
 
-#endif /* LOG_ENABLED */
+# endif /* LOG_ENABLED */
 
 
@@ -1804,7 +1815,7 @@
     if (i >= 0)
     {
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
         pUrb->pHci->u32FrameNo = pThis->HcFmNumber;
-#endif
+# endif
         pThis->aInFlight[i].GCPhysTD = GCPhysTD;
         pThis->aInFlight[i].pUrb = pUrb;
@@ -1908,9 +1919,9 @@
     if (i >= 0)
     {
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
         const int cFramesInFlight = pThis->HcFmNumber - pThis->aInFlight[i].pUrb->pHci->u32FrameNo;
-#else
+# else
         const int cFramesInFlight = 0;
-#endif
+# endif
         Log2(("ohci_in_flight_remove: reaping TD=%#010x %d frames (%#010x-%#010x)\n",
               GCPhysTD, cFramesInFlight, pThis->aInFlight[i].pUrb->pHci->u32FrameNo, pThis->HcFmNumber));
@@ -1946,5 +1957,5 @@
 
 
-#if defined(VBOX_STRICT) || defined(LOG_ENABLED)
+# if defined(VBOX_STRICT) || defined(LOG_ENABLED)
 
 /**
@@ -1981,5 +1992,5 @@
 {
     int i = ohci_in_done_queue_find(pThis, GCPhysTD);
-#if 0
+#  if 0
     /* This condition has been observed with the USB tablet emulation or with
      * a real USB mouse and an SMP XP guest.  I am also not sure if this is
@@ -1993,10 +2004,10 @@
      */
     AssertMsg(i < 0, ("TD %#010x (i=%d)\n", GCPhysTD, i));
-#endif
+#  endif
     return i < 0;
 }
 
 
-# ifdef VBOX_STRICT
+#  ifdef VBOX_STRICT
 /**
  * Adds a TD to the in-done-queue tracking, checking that it's not there already.
@@ -2010,6 +2021,6 @@
         pThis->aInDoneQueue[pThis->cInDoneQueue++].GCPhysTD = GCPhysTD;
 }
-# endif /* VBOX_STRICT */
-#endif /* defined(VBOX_STRICT) || defined(LOG_ENABLED) */
+#  endif /* VBOX_STRICT */
+# endif /* defined(VBOX_STRICT) || defined(LOG_ENABLED) */
 
 
@@ -2524,11 +2535,11 @@
          * Move on to the done list and write back the modified TD.
          */
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
         if (!pThis->done)
             pThis->u32FmDoneQueueTail = pThis->HcFmNumber;
-# ifdef VBOX_STRICT
+#  ifdef VBOX_STRICT
         ohci_in_done_queue_add(pThis, ITdAddr);
+#  endif
 # endif
-#endif
         pITd->NextTD = pThis->done;
         pThis->done = ITdAddr;
@@ -2663,11 +2674,11 @@
          * Move on to the done list and write back the modified TD.
          */
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
         if (!pThis->done)
             pThis->u32FmDoneQueueTail = pThis->HcFmNumber;
-# ifdef VBOX_STRICT
+#  ifdef VBOX_STRICT
         ohci_in_done_queue_add(pThis, TdAddr);
+#  endif
 # endif
-#endif
         pTd->NextTD = pThis->done;
         pThis->done = TdAddr;
@@ -2943,7 +2954,7 @@
     if (ohciIsTdInFlight(pThis, TdAddr))
         return false;
-#if defined(VBOX_STRICT) || defined(LOG_ENABLED)
+# if defined(VBOX_STRICT) || defined(LOG_ENABLED)
     ohci_in_done_queue_check(pThis, TdAddr);
-#endif
+# endif
     return ohciServiceTd(pThis, enmType, pEd, EdAddr, TdAddr, &TdAddr, pszListName);
 }
@@ -2973,14 +2984,14 @@
     }   Head;
 
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
     ohciPhysReadCacheClear(pThis->pCacheTD);
-#endif
+# endif
 
     /* read the head */
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
     ohciReadTdCached(pThis, TdAddr, &Head.Td);
-#else
+# else
     ohciReadTd(pThis, TdAddr, &Head.Td);
-#endif
+# endif
     ohciBufInit(&Head.Buf, Head.Td.cbp, Head.Td.be);
     Head.TdAddr = TdAddr;
@@ -3000,9 +3011,9 @@
         pCur->pNext = NULL;
         pCur->TdAddr = pTail->Td.NextTD & ED_PTR_MASK;
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
         ohciReadTdCached(pThis, pCur->TdAddr, &pCur->Td);
-#else
+# else
         ohciReadTd(pThis, pCur->TdAddr, &pCur->Td);
-#endif
+# endif
         ohciBufInit(&pCur->Buf, pCur->Td.cbp, pCur->Td.be);
 
@@ -3121,7 +3132,7 @@
     if (ohciIsTdInFlight(pThis, TdAddr))
         return false;
-#if defined(VBOX_STRICT) || defined(LOG_ENABLED)
+# if defined(VBOX_STRICT) || defined(LOG_ENABLED)
     ohci_in_done_queue_check(pThis, TdAddr);
-#endif
+# endif
     return ohciServiceTdMultiple(pThis, enmType, pEd, EdAddr, TdAddr, &TdAddr, pszListName);
 }
@@ -3274,7 +3285,7 @@
     AssertCompile(sizeof(pUrb->paTds[0].TdCopy) >= sizeof(*pITd));
     memcpy(pUrb->paTds[0].TdCopy, pITd, sizeof(*pITd));
-#if 0 /* color the data */
+# if 0 /* color the data */
     memset(pUrb->abData, 0xfe, cbTotal);
-#endif
+# endif
 
     /* copy the data */
@@ -3399,5 +3410,5 @@
         else
         {
-#if 1
+# if 1
             /*
              * Ok, the launch window for this TD has passed.
@@ -3422,5 +3433,5 @@
                 break;
             }
-#else /* BAD IDEA: */
+# else /* BAD IDEA: */
             /*
              * Ok, the launch window for this TD has passed.
@@ -3439,5 +3450,5 @@
                 break;
             }
-#endif
+# endif
         }
 
@@ -3484,10 +3495,10 @@
 static void ohciServiceBulkList(POHCI pThis)
 {
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (g_fLogBulkEPs)
         ohciDumpEdList(pThis, pThis->bulk_head, "Bulk before", true);
     if (pThis->bulk_cur)
         Log(("ohciServiceBulkList: bulk_cur=%#010x before listprocessing!!! HCD have positioned us!!!\n", pThis->bulk_cur));
-#endif
+# endif
 
     /*
@@ -3504,9 +3515,9 @@
     {
         OHCIED Ed;
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
         ohciReadEdCached(pThis, EdAddr, &Ed);
-#else
+# else
         ohciReadEd(pThis, EdAddr, &Ed);
-#endif
+# endif
         Assert(!(Ed.hwinfo & ED_HWINFO_ISO)); /* the guest is screwing us */
         if (ohciIsEdReady(&Ed))
@@ -3515,5 +3526,5 @@
             pThis->fBulkNeedsCleaning = true;
 
-#if 1
+# if 1
             /*
 
@@ -3525,5 +3536,5 @@
              */
             ohciServiceHeadTdMultiple(pThis, VUSBXFERTYPE_BULK, &Ed, EdAddr, "Bulk");
-#else
+# else
             /*
              * This alternative code was used before we started reassembling URBs from
@@ -3550,5 +3561,5 @@
                 } while (ohciIsEdReady(&Ed));
             }
-#endif
+# endif
         }
         else
@@ -3572,8 +3583,8 @@
     }
 
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (g_fLogBulkEPs)
         ohciDumpEdList(pThis, pThis->bulk_head, "Bulk after ", true);
-#endif
+# endif
 }
 
@@ -3588,10 +3599,10 @@
 static void ohciUndoBulkList(POHCI pThis)
 {
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (g_fLogBulkEPs)
         ohciDumpEdList(pThis, pThis->bulk_head, "Bulk before", true);
     if (pThis->bulk_cur)
         Log(("ohciUndoBulkList: bulk_cur=%#010x before list processing!!! HCD has positioned us!!!\n", pThis->bulk_cur));
-#endif
+# endif
 
     /* This flag follows OHCI_STATUS_BLF, but BLF doesn't change when list processing is disabled. */
@@ -3602,9 +3613,9 @@
     {
         OHCIED Ed;
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
         ohciReadEdCached(pThis, EdAddr, &Ed);
-#else
+# else
         ohciReadEd(pThis, EdAddr, &Ed);
-#endif
+# endif
         Assert(!(Ed.hwinfo & ED_HWINFO_ISO)); /* the guest is screwing us */
         if (ohciIsEdPresent(&Ed))
@@ -3633,10 +3644,10 @@
 static void ohciServiceCtrlList(POHCI pThis)
 {
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (g_fLogControlEPs)
         ohciDumpEdList(pThis, pThis->ctrl_head, "Ctrl before", true);
     if (pThis->ctrl_cur)
         Log(("ohciServiceCtrlList: ctrl_cur=%010x before list processing!!! HCD have positioned us!!!\n", pThis->ctrl_cur));
-#endif
+# endif
 
     /*
@@ -3656,5 +3667,5 @@
         if (ohciIsEdReady(&Ed))
         {
-#if 1
+# if 1
             /*
              * Control TDs depends on order and stage. Only one can be in-flight
@@ -3673,9 +3684,9 @@
                 ohciReadEd(pThis, EdAddr, &Ed); /* It might have been updated on URB completion. */
             } while (ohciIsEdReady(&Ed));
-#else
+# else
             /* Simplistic, for debugging. */
             ohciServiceHeadTd(pThis, VUSBXFERTYPE_CTRL, &Ed, EdAddr, "Control");
             pThis->status |= OHCI_STATUS_CLF;
-#endif
+# endif
         }
 
@@ -3684,8 +3695,8 @@
     }
 
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (g_fLogControlEPs)
         ohciDumpEdList(pThis, pThis->ctrl_head, "Ctrl after ", true);
-#endif
+# endif
 }
 
@@ -3707,5 +3718,5 @@
     ohciGetDWords(pThis, pThis->hcca + iList * sizeof(EdAddr), &EdAddr, 1);
 
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     const uint32_t EdAddrHead = EdAddr;
     if (g_fLogInterruptEPs)
@@ -3715,5 +3726,5 @@
         ohciDumpEdList(pThis, EdAddrHead, sz, true);
     }
-#endif
+# endif
 
     /*
@@ -3723,9 +3734,9 @@
     {
         OHCIED Ed;
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
         ohciReadEdCached(pThis, EdAddr, &Ed);
-#else
+# else
         ohciReadEd(pThis, EdAddr, &Ed);
-#endif
+# endif
 
         if (ohciIsEdReady(&Ed))
@@ -3771,5 +3782,5 @@
     }
 
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     if (g_fLogInterruptEPs)
     {
@@ -3778,5 +3789,5 @@
         ohciDumpEdList(pThis, EdAddrHead, sz, true);
     }
-#endif
+# endif
 }
 
@@ -3811,11 +3822,11 @@
         Log(("ohci: Writeback Done (%#010x) on frame %#x (age %#x)\n", hcca.done,
              pThis->HcFmNumber, pThis->HcFmNumber - pThis->u32FmDoneQueueTail));
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
         ohciDumpTdQueue(pThis, hcca.done & ED_PTR_MASK, "DoneQueue");
-#endif
+# endif
         Assert(RT_OFFSETOF(struct ohci_hcca, done) == 4);
-#if defined(VBOX_STRICT) || defined(LOG_ENABLED)
+# if defined(VBOX_STRICT) || defined(LOG_ENABLED)
         ohci_in_done_queue_zap(pThis);
-#endif
+# endif
         fWriteDoneHeadInterrupt = true;
     }
@@ -3859,9 +3870,9 @@
     Assert(cLeft == 0);
 
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
     /* Get hcca data to minimize calls to ohciGetDWords/PDMDevHlpPhysRead. */
     uint32_t au32HCCA[OHCI_HCCA_NUM_INTR];
     ohciGetDWords(pThis, pThis->hcca, au32HCCA, OHCI_HCCA_NUM_INTR);
-#endif
+# endif
 
     /* Go over all bulk/control/interrupt endpoint lists; any URB found in these lists
@@ -3879,9 +3890,9 @@
             break;
         default:
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
             EdAddr = au32HCCA[i];
-#else
+# else
             ohciGetDWords(pThis, pThis->hcca + i * sizeof(EdAddr), &EdAddr, 1);
-#endif
+# endif
             break;
         }
@@ -3890,9 +3901,9 @@
             OHCIED Ed;
             OHCITD Td;
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
             ohciReadEdCached(pThis, EdAddr, &Ed);
-#else
+# else
             ohciReadEd(pThis, EdAddr, &Ed);
-#endif
+# endif
             uint32_t TdAddr = Ed.HeadP & ED_PTR_MASK;
             uint32_t TailP  = Ed.TailP & ED_PTR_MASK;
@@ -3901,14 +3912,14 @@
                 && (TdAddr != TailP))
             {
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
                 ohciPhysReadCacheClear(pThis->pCacheTD);
-#endif
+# endif
                 do
                 {
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
                     ohciReadTdCached(pThis, TdAddr, &Td);
-#else
+# else
                     ohciReadTd(pThis, TdAddr, &Td);
-#endif
+# endif
                     j = ohci_in_flight_find(pThis, TdAddr);
                     if (j > -1)
@@ -3956,7 +3967,7 @@
 static void ohciStartOfFrame(POHCI pThis)
 {
-#ifdef LOG_ENABLED
+# ifdef LOG_ENABLED
     const uint32_t status_old = pThis->status;
-#endif
+# endif
 
     /*
@@ -3973,5 +3984,5 @@
                         ||  pThis->hcca < ~OHCI_HCCA_MASK);
 
-#if 1
+# if 1
     /*
      * Update the HCCA.
@@ -3980,5 +3991,5 @@
     if (fValidHCCA)
         ohciUpdateHCCA(pThis);
-#endif
+# endif
 
     /* "After writing to HCCA, HC will set SF in HcInterruptStatus" - guest isn't executing, so ignore the order! */
@@ -4022,5 +4033,5 @@
         ohciUndoBulkList(pThis);    /* If list disabled but not empty, abort endpoints. */
 
-#if 0
+# if 0
     /*
      * Update the HCCA after processing the lists and everything. A bit experimental.
@@ -4037,7 +4048,7 @@
      */
     ohciUpdateHCCA(pThis);
-#endif
-
-#ifdef LOG_ENABLED
+# endif
+
+# ifdef LOG_ENABLED
     if (pThis->status ^ status_old)
     {
@@ -4052,5 +4063,5 @@
               chg & (3<<16)? "*" : "", (val >> 16) & 3));
     }
-#endif
+# endif
 }
 
@@ -4078,12 +4089,12 @@
     pThis->fIdle = true;
 
-#ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
-    physReadStatsReset(&physReadStats);
-#endif
-
-#ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
+# ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
+    physReadStatsReset(&g_PhysReadState);
+# endif
+
+# ifdef VBOX_WITH_OHCI_PHYS_READ_CACHE
     ohciPhysReadCacheClear(pThis->pCacheED);
     ohciPhysReadCacheClear(pThis->pCacheTD);
-#endif
+# endif
 
     /* Frame boundary, so do EOF stuff here. */
@@ -4098,7 +4109,7 @@
     ohciStartOfFrame(pThis);
 
-#ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
-    physReadStatsPrint(&physReadStats);
-#endif
+# ifdef VBOX_WITH_OHCI_PHYS_READ_STATS
+    physReadStatsPrint(&g_PhysReadState);
+# endif
 
     RTCritSectLeave(&pThis->CritSect);
Index: trunk/src/VBox/Devices/VirtIO/Virtio.cpp
===================================================================
--- trunk/src/VBox/Devices/VirtIO/Virtio.cpp	(revision 63477)
+++ trunk/src/VBox/Devices/VirtIO/Virtio.cpp	(revision 63478)
@@ -623,4 +623,5 @@
 }
 
+#if 0 /* unused */
 /**
  * Sets 32-bit register in PCI configuration space.
@@ -635,4 +636,5 @@
     *(uint32_t*)&refPciDev.config[uOffset] = u32Value;
 }
+#endif /* unused */
 
 
