Index: /trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp	(revision 80646)
+++ /trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp	(revision 80647)
@@ -131,4 +131,5 @@
 
 #define SCSI_CONFIG_ACCESSOR(member) \
+    do \
     { \
         uint32_t uIntraOffset = uOffset - RT_UOFFSETOF(VIRTIOSCSI_CONFIG_T, member); \
@@ -138,7 +139,8 @@
             memcpy((char *)pv, (const char *)(((char *)&pThis->virtioScsiConfig.member) + uIntraOffset), cb); \
         LOG_ACCESSOR(member); \
-    }
+    } while(0)
 
 #define SCSI_CONFIG_ACCESSOR_READONLY(member) \
+    do \
     { \
         uint32_t uIntraOffset = uOffset - RT_UOFFSETOF(VIRTIOSCSI_CONFIG_T, member); \
@@ -150,5 +152,5 @@
             LOG_ACCESSOR(member); \
         } \
-    }
+    } while(0)
 
 #define VIRTIO_IN_DIRECTION(pMediaExTxDirEnumValue) \
@@ -1450,52 +1452,32 @@
     int rc = VINF_SUCCESS;
     if (MATCH_SCSI_CONFIG(uNumQueues))
-    {
         SCSI_CONFIG_ACCESSOR_READONLY(uNumQueues);
-    }
     else
     if (MATCH_SCSI_CONFIG(uSegMax))
-    {
         SCSI_CONFIG_ACCESSOR_READONLY(uSegMax);
-    }
     else
     if (MATCH_SCSI_CONFIG(uMaxSectors))
-    {
         SCSI_CONFIG_ACCESSOR_READONLY(uMaxSectors);
-    }
     else
     if (MATCH_SCSI_CONFIG(uCmdPerLun))
-    {
         SCSI_CONFIG_ACCESSOR_READONLY(uCmdPerLun);
-    }
     else
     if (MATCH_SCSI_CONFIG(uEventInfoSize))
-    {
         SCSI_CONFIG_ACCESSOR_READONLY(uEventInfoSize);
-    }
     else
     if (MATCH_SCSI_CONFIG(uSenseSize))
-    {
         SCSI_CONFIG_ACCESSOR(uSenseSize);
-    }
     else
     if (MATCH_SCSI_CONFIG(uCdbSize))
-    {
         SCSI_CONFIG_ACCESSOR(uCdbSize);
-    }
     else
     if (MATCH_SCSI_CONFIG(uMaxChannel))
-    {
         SCSI_CONFIG_ACCESSOR_READONLY(uMaxChannel);
-    }
     else
     if (MATCH_SCSI_CONFIG(uMaxTarget))
-    {
         SCSI_CONFIG_ACCESSOR_READONLY(uMaxTarget);
-    }
     else
     if (MATCH_SCSI_CONFIG(uMaxLun))
-    {
         SCSI_CONFIG_ACCESSOR_READONLY(uMaxLun);
-    }
     else
     {
@@ -2110,5 +2092,5 @@
     PVIRTIOSCSI  pThis = PDMINS_2_DATA(pDevIns, PVIRTIOSCSI);
 
-    for (int qIdx = 0; qIdx < VIRTQ_MAX_CNT; qIdx++)
+    for (int qIdx = 0; qIdx < VIRTIOSCSI_QUEUE_CNT; qIdx++)
     {
         PWORKER pWorker = &pThis->aWorker[qIdx];
Index: /trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp
===================================================================
--- /trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp	(revision 80646)
+++ /trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp	(revision 80647)
@@ -36,58 +36,4 @@
 #define QUEUENAME(qIdx) (pVirtio->virtqProxy[qIdx].szVirtqName)
 
-/**
- * Formats the logging of a memory-mapped I/O input or output value
- *
- * @param   pszFunc     - To avoid displaying this function's name via __FUNCTION__ or Log2Func()
- * @param   pszMember   - Name of struct member
- * @param   pv          - Pointer to value
- * @param   cb          - Size of value
- * @param   uOffset     - Offset into member where value starts
- * @param   fWrite      - True if write I/O
- * @param   fHasIndex   - True if the member is indexed
- * @param   idx         - The index, if fHasIndex is true
- */
-void virtioLogMappedIoValue(const char *pszFunc, const char *pszMember, size_t uMemberSize,
-                        const void *pv, uint32_t cb, uint32_t uOffset, bool fWrite,
-                        bool fHasIndex, uint32_t idx)
-{
-
-#define FMTHEX(fmtout, val, cNybbles) \
-    fmtout[cNybbles] = '\0'; \
-    for (uint8_t i = 0; i < cNybbles; i++) \
-        fmtout[(cNybbles - i) - 1] = "0123456789abcdef"[(val >> (i * 4)) & 0xf];
-
-#define MAX_STRING   64
-    char pszIdx[MAX_STRING] = { 0 };
-    char pszDepiction[MAX_STRING] = { 0 };
-    char pszFormattedVal[MAX_STRING] = { 0 };
-    if (fHasIndex)
-        RTStrPrintf(pszIdx, sizeof(pszIdx), "[%d]", idx);
-    if (cb == 1 || cb == 2 || cb == 4 || cb == 8)
-    {
-        /* manually padding with 0's instead of \b due to different impl of %x precision than printf() */
-        uint64_t val = 0;
-        memcpy((char *)&val, pv, cb);
-        FMTHEX(pszFormattedVal, val, cb * 2);
-        if (uOffset != 0 || cb != uMemberSize) /* display bounds if partial member access */
-            RTStrPrintf(pszDepiction, sizeof(pszDepiction), "%s%s[%d:%d]",
-                        pszMember, pszIdx, uOffset, uOffset + cb - 1);
-        else
-            RTStrPrintf(pszDepiction, sizeof(pszDepiction), "%s%s", pszMember, pszIdx);
-        RTStrPrintf(pszDepiction, sizeof(pszDepiction), "%-30s", pszDepiction);
-        uint32_t first = 0;
-        for (uint8_t i = 0; i < sizeof(pszDepiction); i++)
-            if (pszDepiction[i] == ' ' && first++)
-                pszDepiction[i] = '.';
-        Log6Func(("%s: Guest %s %s 0x%s\n",
-                  pszFunc, fWrite ? "wrote" : "read ", pszDepiction, pszFormattedVal));
-    }
-    else /* odd number or oversized access, ... log inline hex-dump style */
-    {
-        Log6Func(("%s: Guest %s %s%s[%d:%d]: %.*Rhxs\n",
-              pszFunc, fWrite ? "wrote" : "read ", pszMember,
-              pszIdx, uOffset, uOffset + cb, cb, pv));
-    }
-}
 
 /**
@@ -664,52 +610,40 @@
         }
     }
-    else if (MATCH_COMMON_CFG(uMsixConfig))
-    {
+    else
+    if (MATCH_COMMON_CFG(uMsixConfig))
         COMMON_CFG_ACCESSOR(uMsixConfig);
-    }
-    else if (MATCH_COMMON_CFG(uDeviceFeaturesSelect))
-    {
+    else
+    if (MATCH_COMMON_CFG(uDeviceFeaturesSelect))
         COMMON_CFG_ACCESSOR(uDeviceFeaturesSelect);
-    }
-    else if (MATCH_COMMON_CFG(uDriverFeaturesSelect))
-    {
+    else
+    if (MATCH_COMMON_CFG(uDriverFeaturesSelect))
         COMMON_CFG_ACCESSOR(uDriverFeaturesSelect);
-    }
-    else if (MATCH_COMMON_CFG(uConfigGeneration))
-    {
+    else
+    if (MATCH_COMMON_CFG(uConfigGeneration))
         COMMON_CFG_ACCESSOR_READONLY(uConfigGeneration);
-    }
-    else if (MATCH_COMMON_CFG(uQueueSelect))
-    {
+    else
+    if (MATCH_COMMON_CFG(uQueueSelect))
         COMMON_CFG_ACCESSOR(uQueueSelect);
-    }
-    else if (MATCH_COMMON_CFG(uQueueSize))
-    {
+    else
+    if (MATCH_COMMON_CFG(uQueueSize))
         COMMON_CFG_ACCESSOR_INDEXED(uQueueSize, pVirtio->uQueueSelect);
-    }
-    else if (MATCH_COMMON_CFG(uQueueMsixVector))
-    {
+    else
+    if (MATCH_COMMON_CFG(uQueueMsixVector))
         COMMON_CFG_ACCESSOR_INDEXED(uQueueMsixVector, pVirtio->uQueueSelect);
-    }
-    else if (MATCH_COMMON_CFG(uQueueEnable))
-    {
+    else
+    if (MATCH_COMMON_CFG(uQueueEnable))
         COMMON_CFG_ACCESSOR_INDEXED(uQueueEnable, pVirtio->uQueueSelect);
-    }
-    else if (MATCH_COMMON_CFG(uQueueNotifyOff))
-    {
+    else
+    if (MATCH_COMMON_CFG(uQueueNotifyOff))
         COMMON_CFG_ACCESSOR_INDEXED_READONLY(uQueueNotifyOff, pVirtio->uQueueSelect);
-    }
-    else if (MATCH_COMMON_CFG(pGcPhysQueueDesc))
-    {
+    else
+    if (MATCH_COMMON_CFG(pGcPhysQueueDesc))
         COMMON_CFG_ACCESSOR_INDEXED(pGcPhysQueueDesc, pVirtio->uQueueSelect);
-    }
-    else if (MATCH_COMMON_CFG(pGcPhysQueueAvail))
-    {
+    else
+    if (MATCH_COMMON_CFG(pGcPhysQueueAvail))
         COMMON_CFG_ACCESSOR_INDEXED(pGcPhysQueueAvail, pVirtio->uQueueSelect);
-    }
-    else if (MATCH_COMMON_CFG(pGcPhysQueueUsed))
-    {
+    else
+    if (MATCH_COMMON_CFG(pGcPhysQueueUsed))
         COMMON_CFG_ACCESSOR_INDEXED(pGcPhysQueueUsed, pVirtio->uQueueSelect);
-    }
     else
     {
@@ -1458,5 +1392,4 @@
 
     return rc;
-
 }
 
@@ -1492,4 +1425,60 @@
  }
 
+
+/**
+ * Formats the logging of a memory-mapped I/O input or output value
+ *
+ * @param   pszFunc     - To avoid displaying this function's name via __FUNCTION__ or Log2Func()
+ * @param   pszMember   - Name of struct member
+ * @param   pv          - Pointer to value
+ * @param   cb          - Size of value
+ * @param   uOffset     - Offset into member where value starts
+ * @param   fWrite      - True if write I/O
+ * @param   fHasIndex   - True if the member is indexed
+ * @param   idx         - The index, if fHasIndex is true
+ */
+void virtioLogMappedIoValue(const char *pszFunc, const char *pszMember, size_t uMemberSize,
+                        const void *pv, uint32_t cb, uint32_t uOffset, bool fWrite,
+                        bool fHasIndex, uint32_t idx)
+{
+
+#define FMTHEX(fmtout, val, cNybbles) \
+    fmtout[cNybbles] = '\0'; \
+    for (uint8_t i = 0; i < cNybbles; i++) \
+        fmtout[(cNybbles - i) - 1] = "0123456789abcdef"[(val >> (i * 4)) & 0xf];
+
+#define MAX_STRING   64
+    char pszIdx[MAX_STRING] = { 0 };
+    char pszDepiction[MAX_STRING] = { 0 };
+    char pszFormattedVal[MAX_STRING] = { 0 };
+    if (fHasIndex)
+        RTStrPrintf(pszIdx, sizeof(pszIdx), "[%d]", idx);
+    if (cb == 1 || cb == 2 || cb == 4 || cb == 8)
+    {
+        /* manually padding with 0's instead of \b due to different impl of %x precision than printf() */
+        uint64_t val = 0;
+        memcpy((char *)&val, pv, cb);
+        FMTHEX(pszFormattedVal, val, cb * 2);
+        if (uOffset != 0 || cb != uMemberSize) /* display bounds if partial member access */
+            RTStrPrintf(pszDepiction, sizeof(pszDepiction), "%s%s[%d:%d]",
+                        pszMember, pszIdx, uOffset, uOffset + cb - 1);
+        else
+            RTStrPrintf(pszDepiction, sizeof(pszDepiction), "%s%s", pszMember, pszIdx);
+        RTStrPrintf(pszDepiction, sizeof(pszDepiction), "%-30s", pszDepiction);
+        uint32_t first = 0;
+        for (uint8_t i = 0; i < sizeof(pszDepiction); i++)
+            if (pszDepiction[i] == ' ' && first++)
+                pszDepiction[i] = '.';
+        Log6Func(("%s: Guest %s %s 0x%s\n",
+                  pszFunc, fWrite ? "wrote" : "read ", pszDepiction, pszFormattedVal));
+    }
+    else /* odd number or oversized access, ... log inline hex-dump style */
+    {
+        Log6Func(("%s: Guest %s %s%s[%d:%d]: %.*Rhxs\n",
+              pszFunc, fWrite ? "wrote" : "read ", pszMember,
+              pszIdx, uOffset, uOffset + cb, cb, pv));
+    }
+}
+
 #endif /* IN_RING3 */
 
Index: /trunk/src/VBox/Devices/VirtIO/Virtio_1_0_impl.h
===================================================================
--- /trunk/src/VBox/Devices/VirtIO/Virtio_1_0_impl.h	(revision 80646)
+++ /trunk/src/VBox/Devices/VirtIO/Virtio_1_0_impl.h	(revision 80647)
@@ -300,4 +300,5 @@
 
 #define COMMON_CFG_ACCESSOR(member) \
+    do \
     { \
         uint32_t uIntraOff = uOffset - RT_OFFSETOF(VIRTIO_PCI_COMMON_CFG_T, member); \
@@ -307,7 +308,8 @@
             memcpy((char *)pv, (const char *)(((char *)&pVirtio->member) + uIntraOff), cb); \
         LOG_COMMON_CFG_ACCESS(member); \
-    }
+    } while(0)
 
 #define COMMON_CFG_ACCESSOR_INDEXED(member, idx) \
+    do \
     { \
         uint32_t uIntraOff = uOffset - RT_OFFSETOF(VIRTIO_PCI_COMMON_CFG_T, member); \
@@ -317,7 +319,8 @@
             memcpy((char *)pv, (const char *)(((char *)(pVirtio->member + idx)) + uIntraOff), cb); \
         LOG_COMMON_CFG_ACCESS_INDEXED(member, idx); \
-    }
+    } while(0)
 
 #define COMMON_CFG_ACCESSOR_READONLY(member) \
+    do \
     { \
         uint32_t uIntraOff = uOffset - RT_OFFSETOF(VIRTIO_PCI_COMMON_CFG_T, member); \
@@ -329,7 +332,8 @@
             LOG_COMMON_CFG_ACCESS(member); \
         } \
-    }
+    } while(0)
 
 #define COMMON_CFG_ACCESSOR_INDEXED_READONLY(member, idx) \
+    do \
     { \
         uint32_t uIntraOff = uOffset - RT_OFFSETOF(VIRTIO_PCI_COMMON_CFG_T, member); \
@@ -341,5 +345,5 @@
             LOG_COMMON_CFG_ACCESS_INDEXED(member, idx); \
         } \
-    }
+    } while(0)
 
 #define DRIVER_OK(pVirtio) (pVirtio->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK)
