Index: /trunk/include/iprt/asm.h
===================================================================
--- /trunk/include/iprt/asm.h	(revision 30110)
+++ /trunk/include/iprt/asm.h	(revision 30111)
@@ -470,4 +470,27 @@
 #endif
 }
+
+
+/**
+ * Convenience macro for avoiding the annoying casting with ASMAtomicXchgPtr.
+ *
+ * @returns Current *pv value
+ * @param   ppv     Pointer to the pointer variable to update.
+ * @param   pv      The pointer value to assign to *ppv.
+ * @param   Type    The type of *ppv, sans volatile.
+ */
+#ifdef __GNUC__
+# define ASMAtomicXchgPtrT(ppv, pv, Type) \
+    __extension__ \
+    ({\
+        __typeof__(*(ppv)) volatile * const ppvTypeChecked = (ppv); \
+        Type                          const pvTypeChecked  = (pv); \
+        Type pvTypeCheckedRet = (__typeof__(*(ppv))) ASMAtomicXchgPtr((void * volatile *)ppvTypeChecked, (void *)pvTypeChecked); \
+        pvTypeCheckedRet; \
+     })
+#else
+# define ASMAtomicXchgPtrT(ppv, pv, Type) \
+    (Type)ASMAtomicXchgPtr((void * volatile *)(ppv), (void *)(pv))
+#endif
 
 
@@ -849,5 +872,5 @@
  * @param   pvOld       The old value to *ppv compare with.
  */
-DECLINLINE(bool) ASMAtomicCmpXchgPtr(void * volatile *ppv, const void *pvNew, const void *pvOld)
+DECLINLINE(bool) ASMAtomicCmpXchgPtrVoid(void * volatile *ppv, const void *pvNew, const void *pvOld)
 {
 #if ARCH_BITS == 32
@@ -859,4 +882,33 @@
 #endif
 }
+
+
+/**
+ * Atomically Compare and Exchange a pointer value, ordered.
+ *
+ * @returns true if xchg was done.
+ * @returns false if xchg wasn't done.
+ *
+ * @param   ppv         Pointer to the value to update.
+ * @param   pvNew       The new value to assigned to *ppv.
+ * @param   pvOld       The old value to *ppv compare with.
+ *
+ * @remarks This is relatively type safe on GCC platforms.
+ */
+#ifdef __GNUC__
+# define ASMAtomicCmpXchgPtr(ppv, pvNew, pvOld) \
+    __extension__ \
+    ({\
+        __typeof__(*(ppv)) volatile * const ppvTypeChecked   = (ppv); \
+        __typeof__(*(ppv))            const pvNewTypeChecked = (pvNew); \
+        __typeof__(*(ppv))            const pvOldTypeChecked = (pvOld); \
+        bool fMacroRet = ASMAtomicCmpXchgPtrVoid((void * volatile *)ppvTypeChecked, \
+                                                 (void *)pvNewTypeChecked, (void *)pvOldTypeChecked); \
+        fMacroRet; \
+     })
+#else
+# define ASMAtomicCmpXchgPtr(ppv, pvNew, pvOld) \
+    ASMAtomicCmpXchgPtrVoid((void * volatile *)(ppv), (void *)(pvNew), (void *)(pvOld))
+#endif
 
 
@@ -1176,5 +1228,5 @@
  * @param   ppvOld      Pointer store the old value at.
  */
-DECLINLINE(bool) ASMAtomicCmpXchgExPtr(void * volatile *ppv, const void *pvNew, const void *pvOld, void **ppvOld)
+DECLINLINE(bool) ASMAtomicCmpXchgExPtrVoid(void * volatile *ppv, const void *pvNew, const void *pvOld, void **ppvOld)
 {
 #if ARCH_BITS == 32
@@ -1186,4 +1238,37 @@
 #endif
 }
+
+
+/**
+ * Atomically Compare and Exchange a pointer value, additionally
+ * passing back old value, ordered.
+ *
+ * @returns true if xchg was done.
+ * @returns false if xchg wasn't done.
+ *
+ * @param   ppv         Pointer to the value to update.
+ * @param   pvNew       The new value to assigned to *ppv.
+ * @param   pvOld       The old value to *ppv compare with.
+ * @param   ppvOld      Pointer store the old value at.
+ *
+ * @remarks This is relatively type safe on GCC platforms.
+ */
+#ifdef __GNUC__
+# define ASMAtomicCmpXchgExPtr(ppv, pvNew, pvOld, ppvOld) \
+    __extension__ \
+    ({\
+        __typeof__(*(ppv)) volatile * const ppvTypeChecked    = (ppv); \
+        __typeof__(*(ppv))            const pvNewTypeChecked  = (pvNew); \
+        __typeof__(*(ppv))            const pvOldTypeChecked  = (pvOld); \
+        __typeof__(*(ppv)) *          const ppvOldTypeChecked = (ppvOld); \
+        bool fMacroRet = ASMAtomicCmpXchgExPtrVoid((void * volatile *)ppvTypeChecked, \
+                                                   (void *)pvNewTypeChecked, (void *)pvOldTypeChecked, \
+                                                   (void **)ppvOld); \
+        fMacroRet; \
+     })
+#else
+# define ASMAtomicCmpXchgExPtr(ppv, pvNew, pvOld, ppvOld) \
+    ASMAtomicCmpXchgExPtrVoid((void * volatile *)(ppv), (void *)(pvNew), (void *)pvOld, (void **)ppvOld)
+#endif
 
 
@@ -1903,4 +1988,7 @@
  * @returns Current *pv value
  * @param   ppv     Pointer to the pointer variable to read.
+ *
+ * @remarks Please use ASMAtomicReadPtrT, it provides better type safety and
+ *          requires less typing (no casts).
  */
 DECLINLINE(void *) ASMAtomicReadPtr(void * volatile *ppv)
@@ -1915,10 +2003,33 @@
 }
 
-
-/**
- * Atomically reads a pointer value, unordered.
+/**
+ * Convenience macro for avoiding the annoying casting with ASMAtomicReadPtr.
  *
  * @returns Current *pv value
  * @param   ppv     Pointer to the pointer variable to read.
+ * @param   Type    The type of *ppv, sans volatile.
+ */
+#ifdef __GNUC__
+# define ASMAtomicReadPtrT(ppv, Type) \
+    __extension__ \
+    ({\
+        __typeof__(*(ppv)) volatile *ppvTypeChecked = (ppv); \
+        Type pvTypeChecked = (__typeof__(*(ppv))) ASMAtomicReadPtr((void * volatile *)ppvTypeChecked); \
+        pvTypeChecked; \
+     })
+#else
+# define ASMAtomicReadPtrT(ppv, Type) \
+    (Type)ASMAtomicReadPtr((void * volatile *)(ppv))
+#endif
+
+
+/**
+ * Atomically reads a pointer value, unordered.
+ *
+ * @returns Current *pv value
+ * @param   ppv     Pointer to the pointer variable to read.
+ *
+ * @remarks Please use ASMAtomicUoReadPtrT, it provides better type safety and
+ *          requires less typing (no casts).
  */
 DECLINLINE(void *) ASMAtomicUoReadPtr(void * volatile *ppv)
@@ -1932,4 +2043,25 @@
 #endif
 }
+
+
+/**
+ * Convenience macro for avoiding the annoying casting with ASMAtomicUoReadPtr.
+ *
+ * @returns Current *pv value
+ * @param   ppv     Pointer to the pointer variable to read.
+ * @param   Type    The type of *ppv, sans volatile.
+ */
+#ifdef __GNUC__
+# define ASMAtomicUoReadPtrT(ppv, Type) \
+    __extension__ \
+    ({\
+        __typeof__(*(ppv)) volatile * const ppvTypeChecked = (ppv); \
+        Type pvTypeChecked = (__typeof__(*(ppv))) ASMAtomicUoReadPtr((void * volatile *)ppvTypeChecked); \
+        pvTypeChecked; \
+     })
+#else
+# define ASMAtomicUoReadPtrT(ppv, Type) \
+    (Type)ASMAtomicUoReadPtr((void * volatile *)(ppv))
+#endif
 
 
@@ -2286,7 +2418,7 @@
  * @returns Current *pv value
  * @param   ppv     Pointer to the pointer variable.
- * @param   pv      The pointer value to assigne to *ppv.
- */
-DECLINLINE(void) ASMAtomicWritePtr(void * volatile *ppv, const void *pv)
+ * @param   pv      The pointer value to assign to *ppv.
+ */
+DECLINLINE(void) ASMAtomicWritePtrVoid(void * volatile *ppv, const void *pv)
 {
 #if ARCH_BITS == 32
@@ -2301,20 +2433,74 @@
 
 /**
- * Atomically writes a pointer value, unordered.
+ * Convenience macro for avoiding the annoying casting with ASMAtomicWritePtr.
  *
  * @returns Current *pv value
  * @param   ppv     Pointer to the pointer variable.
- * @param   pv      The pointer value to assigne to *ppv.
- */
-DECLINLINE(void) ASMAtomicUoWritePtr(void * volatile *ppv, const void *pv)
-{
-#if ARCH_BITS == 32
-    ASMAtomicUoWriteU32((volatile uint32_t *)(void *)ppv, (uint32_t)pv);
-#elif ARCH_BITS == 64
-    ASMAtomicUoWriteU64((volatile uint64_t *)(void *)ppv, (uint64_t)pv);
-#else
-# error "ARCH_BITS is bogus"
-#endif
-}
+ * @param   pv      The pointer value to assign to *ppv. If NULL, you may have
+ *                  to cast it to the right pointer type for GCC to be happy.
+ *
+ * @remarks This is relatively type safe on GCC platforms when @a pv isn't
+ *          NULL.
+ */
+#ifdef __GNUC__
+# define ASMAtomicWritePtr(ppv, pv) \
+    do \
+    { \
+        __typeof__(*(ppv)) volatile * const ppvTypeChecked = (ppv); \
+        __typeof__(*(ppv))            const pvTypeChecked  = (pv); \
+        \
+        AssertCompile(sizeof(*ppv) == sizeof(void *)); \
+        AssertCompile(sizeof(pv) == sizeof(void *)); \
+        Assert(!( (uintptr_t)ppv & ((ARCH_BITS / 8) - 1) )); \
+        \
+        ASMAtomicWritePtrVoid((void * volatile *)(ppvTypeChecked), (void *)(pvTypeChecked)); \
+    } while (0)
+#else
+# define ASMAtomicWritePtr(ppv, pv) \
+    do \
+    { \
+        AssertCompile(sizeof(*ppv) == sizeof(void *)); \
+        AssertCompile(sizeof(pv) == sizeof(void *)); \
+        Assert(!( (uintptr_t)ppv & ((ARCH_BITS / 8) - 1) )); \
+        \
+        ASMAtomicWritePtrVoid((void * volatile *)(ppv), (void *)(pv)); \
+    } while (0)
+#endif
+
+
+/**
+ * Convenience macro for avoiding the annoying casting involved when using
+ * ASMAtomicWritePtr.
+ *
+ * @returns Current *pv value
+ * @param   ppv     Pointer to the pointer variable.
+ * @param   pv      The pointer value to assign to *ppv.
+ *
+ * @remarks This is relatively type safe on GCC platforms when @a pv isn't
+ *          NULL.
+ */
+#ifdef __GNUC__
+# define ASMAtomicUoWritePtr(ppv, pv) \
+    do \
+    { \
+        __typeof__(*(ppv)) volatile * const ppvTypeChecked = (ppv); \
+        __typeof__(*(ppv))            const pvTypeChecked  = (pv); \
+        \
+        AssertCompile(sizeof(*ppv) == sizeof(void *)); \
+        AssertCompile(sizeof(pv) == sizeof(void *)); \
+        Assert(!( (uintptr_t)ppv & ((ARCH_BITS / 8) - 1) )); \
+        \
+        *(ppvTypeChecked) = pvTypeChecked; \
+    } while (0)
+#else
+# define ASMAtomicUoWritePtr(ppv, pv) \
+    do \
+    { \
+        AssertCompile(sizeof(*ppv) == sizeof(void *)); \
+        AssertCompile(sizeof(pv) == sizeof(void *)); \
+        Assert(!( (uintptr_t)ppv & ((ARCH_BITS / 8) - 1) )); \
+        *(ppv) = pv; \
+    } while (0)
+#endif
 
 
Index: /trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
===================================================================
--- /trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp	(revision 30110)
+++ /trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp	(revision 30111)
@@ -1775,5 +1775,5 @@
                     PINTNETDSTTAB pOld = pIf->pDstTab;
                     if (   pOld
-                        && ASMAtomicCmpXchgPtr((void * volatile *)&pIf->pDstTab, pNew, pOld))
+                        && ASMAtomicCmpXchgPtr(&pIf->pDstTab, pNew, pOld))
                     {
                         RTMemFree(pOld);
@@ -3294,5 +3294,5 @@
          * Grab the destination table.
          */
-        PINTNETDSTTAB pDstTab = (PINTNETDSTTAB)ASMAtomicXchgPtr((void * volatile *)&pIf->pDstTab, NULL);
+        PINTNETDSTTAB pDstTab = ASMAtomicXchgPtrT(&pIf->pDstTab, NULL, PINTNETDSTTAB);
         if (RT_LIKELY(pDstTab))
         {
@@ -3357,5 +3357,5 @@
              */
             Assert(!pIf->pDstTab);
-            ASMAtomicWritePtr((void * volatile *)&pIf->pDstTab, pDstTab);
+            ASMAtomicWritePtr(&pIf->pDstTab, pDstTab);
         }
         else
Index: /trunk/src/VBox/Devices/Storage/DevAHCI.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 30110)
+++ /trunk/src/VBox/Devices/Storage/DevAHCI.cpp	(revision 30111)
@@ -3892,5 +3892,5 @@
     bool fAssertIntr = false;
     PAHCI pAhci = pAhciPort->CTX_SUFF(pAhci);
-    PAHCIPORTTASKSTATE pTaskErr = (PAHCIPORTTASKSTATE)ASMAtomicReadPtr((void * volatile *)&pAhciPort->pTaskErr);
+    PAHCIPORTTASKSTATE pTaskErr = ASMAtomicReadPtrT(&pAhciPort->pTaskErr, PAHCIPORTTASKSTATE);
 
     ahciLog(("%s: Building SDB FIS\n", __FUNCTION__));
@@ -4900,5 +4900,5 @@
                         pAhciPortTaskState->cbTransfer, rcReq));
         }
-        ASMAtomicCmpXchgPtr((void * volatile *)&pAhciPort->pTaskErr, pAhciPortTaskState, NULL);
+        ASMAtomicCmpXchgPtr(&pAhciPort->pTaskErr, pAhciPortTaskState, NULL);
     }
     else
@@ -4932,5 +4932,5 @@
         cOutstandingTasks = ASMAtomicDecU32(&pAhciPort->uActTasksActive);
         ahciLog(("%s: After decrement uActTasksActive=%u\n", __FUNCTION__, cOutstandingTasks));
-        if (RT_SUCCESS(rcReq) && !ASMAtomicReadPtr((void * volatile *)&pAhciPort->pTaskErr))
+        if (RT_SUCCESS(rcReq) && !ASMAtomicReadPtrT(&pAhciPort->pTaskErr, PAHCIPORTTASKSTATE))
             ASMAtomicOrU32(&pAhciPort->u32QueuedTasksFinished, (1 << pAhciPortTaskState->uTag));
 
@@ -5190,5 +5190,5 @@
                     {
                         LogFlow(("Reading error page\n"));
-                        PAHCIPORTTASKSTATE pTaskErr = (PAHCIPORTTASKSTATE)ASMAtomicXchgPtr((void * volatile *)&pAhciPort->pTaskErr, NULL);
+                        PAHCIPORTTASKSTATE pTaskErr = ASMAtomicXchgPtrT(&pAhciPort->pTaskErr, NULL, PAHCIPORTTASKSTATE);
                         if (pTaskErr)
                         {
Index: /trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp	(revision 30110)
+++ /trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp	(revision 30111)
@@ -490,5 +490,5 @@
     Assert(pReqActive->pIoReq == pIoReq);
 
-    ASMAtomicXchgPtr((void * volatile *)&pReqActive->pIoReq, NULL);
+    ASMAtomicWritePtr(&pReqActive->pIoReq, NULL);
 }
 
@@ -520,5 +520,5 @@
         {
             PDRVDISKAIOREQACTIVE pReqActive = &pThis->apReqActive[i];
-            PDRVDISKAIOREQ pIoReq = (PDRVDISKAIOREQ)ASMAtomicReadPtr((void * volatile *)&pReqActive->pIoReq);
+            PDRVDISKAIOREQ pIoReq = ASMAtomicReadPtrT(&pReqActive->pIoReq, PDRVDISKAIOREQ);
 
             if (   pIoReq
Index: /trunk/src/VBox/Devices/Storage/DrvVD.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvVD.cpp	(revision 30110)
+++ /trunk/src/VBox/Devices/Storage/DrvVD.cpp	(revision 30111)
@@ -1159,6 +1159,6 @@
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
 
-    RTSEMFASTMUTEX mutex = (RTSEMFASTMUTEX)ASMAtomicXchgPtr((void **)&pThis->MergeCompleteMutex,
-                                                            (void *)NIL_RTSEMFASTMUTEX);
+    RTSEMFASTMUTEX mutex;
+    ASMAtomicXchgHandle(&pThis->MergeCompleteMutex, NIL_RTSEMFASTMUTEX, &mutex);
     if (mutex != NIL_RTSEMFASTMUTEX)
     {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.cpp	(revision 30110)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.cpp	(revision 30111)
@@ -92,5 +92,5 @@
      * ASMAtomic(Cmp)XchgPtr and a struct { cAllocated; cRects; aRects[1]; }
      * *mRegion, *mUnusedRegion; should suffice (and permit you to reuse allocations). */
-    RegionRects *rgnRcts = (RegionRects *)ASMAtomicXchgPtr((void * volatile *) &mRegionUnused, NULL);
+    RegionRects *rgnRcts = ASMAtomicXchgPtrT(&mRegionUnused, NULL, RegionRects *);
     if (rgnRcts && rgnRcts->allocated < aCount)
     {
@@ -143,8 +143,8 @@
 //    printf ("..................................\n");
 
-    void *pvOld = ASMAtomicXchgPtr((void * volatile *)&mRegion, rgnRcts);
-    if (    pvOld
-        &&  !ASMAtomicCmpXchgPtr((void * volatile *)&mRegionUnused, pvOld, NULL))
-        RTMemFree (pvOld);
+    RegionRects *pOld = ASMAtomicXchgPtrT(&mRegion, rgnRcts, RegionRects *);
+    if (    pOld
+        &&  !ASMAtomicCmpXchgPtr(&mRegionUnused, pOld, NULL))
+        RTMemFree(pOld);
 
     QApplication::postEvent(m_pMachineView, new UISetRegionEvent (reg));
@@ -203,5 +203,5 @@
 #endif
         /* Grab the current visible region. */
-        RegionRects *rgnRcts = (RegionRects *)ASMAtomicXchgPtr((void * volatile *)&mRegion, NULL);
+        RegionRects *rgnRcts = ASMAtomicXchgPtrT(&mRegion, NULL, RegionRects *);
         if (rgnRcts)
         {
@@ -216,6 +216,6 @@
             }
             /* Put back the visible region, free if we cannot (2+ SetVisibleRegion calls). */
-            if (    !ASMAtomicCmpXchgPtr((void * volatile *)&mRegion, rgnRcts, NULL)
-                &&  !ASMAtomicCmpXchgPtr((void * volatile *)&mRegionUnused, rgnRcts, NULL))
+            if (    !ASMAtomicCmpXchgPtr(&mRegion, rgnRcts, NULL)
+                &&  !ASMAtomicCmpXchgPtr(&mRegionUnused, rgnRcts, NULL))
                 RTMemFree(rgnRcts);
         }
Index: /trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/SUPLib.cpp	(revision 30110)
+++ /trunk/src/VBox/HostDrivers/Support/SUPLib.cpp	(revision 30111)
@@ -508,7 +508,7 @@
         if (g_pSUPGlobalInfoPage)
         {
-            ASMAtomicXchgPtr((void * volatile *)&g_pSUPGlobalInfoPage, NULL);
-            ASMAtomicXchgPtr((void * volatile *)&g_pSUPGlobalInfoPageR0, NULL);
-            ASMAtomicXchgSize(&g_HCPhysSUPGlobalInfoPage, NIL_RTHCPHYS);
+            ASMAtomicWritePtr((void * volatile *)&g_pSUPGlobalInfoPage, NULL);
+            ASMAtomicWritePtr((void * volatile *)&g_pSUPGlobalInfoPageR0, NULL);
+            ASMAtomicWriteSize(&g_HCPhysSUPGlobalInfoPage, NIL_RTHCPHYS);
             /* just a little safe guard against threads using the page. */
             RTThreadSleep(50);
Index: /trunk/src/VBox/HostDrivers/Support/SUPR0IdcClient.c
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/SUPR0IdcClient.c	(revision 30110)
+++ /trunk/src/VBox/HostDrivers/Support/SUPR0IdcClient.c	(revision 30111)
@@ -125,5 +125,5 @@
             &&  (Req.u.Out.uSessionVersion & UINT32_C(0xffff0000)) == (SUPDRV_IDC_VERSION & UINT32_C(0xffff0000)))
         {
-            ASMAtomicCmpXchgPtr((void * volatile *)&g_pMainHandle, pHandle, NULL);
+            ASMAtomicCmpXchgPtr(&g_pMainHandle, pHandle, NULL);
             return rc;
         }
@@ -167,5 +167,5 @@
     {
         pHandle->s.pSession = NULL;
-        ASMAtomicCmpXchgPtr((void * volatile *)&g_pMainHandle, NULL, pHandle);
+        ASMAtomicCmpXchgPtr(&g_pMainHandle, NULL, pHandle);
     }
     return rc;
@@ -203,5 +203,5 @@
 PSUPDRVIDCHANDLE supR0IdcGetHandleFromSession(PSUPDRVSESSION pSession)
 {
-    PSUPDRVIDCHANDLE pHandle = (PSUPDRVIDCHANDLE)ASMAtomicUoReadPtr((void * volatile *)&g_pMainHandle);
+    PSUPDRVIDCHANDLE pHandle = ASMAtomicUoReadPtrT(&g_pMainHandle, PSUPDRVIDCHANDLE);
     if (    VALID_PTR(pHandle)
         &&  pHandle->s.pSession == pSession)
Index: /trunk/src/VBox/HostDrivers/Support/SUPSvcGrant.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/SUPSvcGrant.cpp	(revision 30110)
+++ /trunk/src/VBox/HostDrivers/Support/SUPSvcGrant.cpp	(revision 30111)
@@ -179,5 +179,5 @@
      * Clean up the session.
      */
-    PSUPSVCGRANT pParent = (PSUPSVCGRANT)ASMAtomicReadPtr((void * volatile *)&pThis->pParent);
+    PSUPSVCGRANT pParent = ASMAtomicReadPtrT(&pThis->pParent, PSUPSVCGRANT);
     if (pParent)
         RTCritSectEnter(&pParent->CritSect);
@@ -975,5 +975,5 @@
     unsigned cSessions = 0;
     for (PSUPSVCGRANTSESSION pCur = pThis->pSessionHead; pCur; pCur = pCur->pNext)
-        ASMAtomicWritePtr((void * volatile *)&pCur->pParent, NULL);
+        ASMAtomicWritePtr(&pCur->pParent, NULL);
 
     RTCritSectLeave(&pThis->CritSect);
Index: /trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp	(revision 30110)
+++ /trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp	(revision 30111)
@@ -236,5 +236,5 @@
     if (!ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost))
     {
-        pIfNet = (ifnet_t)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pIfNet);
+        pIfNet = ASMAtomicUoReadPtrT(&pThis->u.s.pIfNet, ifnet_t);
         if (pIfNet)
             ifnet_reference(pIfNet);
@@ -666,9 +666,9 @@
     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
 
-    pIfNet = (ifnet_t)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pIfNet);
+    pIfNet = ASMAtomicUoReadPtrT(&pThis->u.s.pIfNet, ifnet_t);
     int cPromisc = VALID_PTR(pIfNet) ? VBOX_GET_PCOUNT(pIfNet) : - 1;
 
-    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pIfNet, NULL);
-    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pIfFilter, NULL);
+    ASMAtomicUoWritePtr(&pThis->u.s.pIfNet, NULL);
+    ASMAtomicUoWritePtr(&pThis->u.s.pIfFilter, NULL);
     ASMAtomicWriteBool(&pThis->u.s.fNeedSetPromiscuous, false);
     pThis->u.s.fSetPromiscuous = false;
@@ -914,5 +914,5 @@
     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
-    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pIfNet, pIfNet);
+    ASMAtomicUoWritePtr(&pThis->u.s.pIfNet, pIfNet);
     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
 
@@ -940,9 +940,9 @@
 
         RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
-        pIfNet = (ifnet_t)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pIfNet);
+        pIfNet = ASMAtomicUoReadPtrT(&pThis->u.s.pIfNet, ifnet_t);
         if (pIfNet && !err)
         {
             ASMAtomicUoWriteBool(&pThis->fDisconnectedFromHost, false);
-            ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pIfFilter, pIfFilter);
+            ASMAtomicUoWritePtr(&pThis->u.s.pIfFilter, pIfFilter);
             pIfNet = NULL; /* don't dereference it */
         }
@@ -1162,7 +1162,7 @@
      */
     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
-    pIfFilter = (interface_filter_t)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pIfFilter);
+    pIfFilter = ASMAtomicUoReadPtrT(&pThis->u.s.pIfFilter, interface_filter_t);
     if (pIfFilter)
-        ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pIfFilter, NULL);
+        ASMAtomicUoWritePtr(&pThis->u.s.pIfFilter, NULL);
     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
 
Index: /trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
===================================================================
--- /trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c	(revision 30110)
+++ /trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c	(revision 30111)
@@ -498,5 +498,5 @@
     int error;
 
-    ifp = (void *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.ifp);
+    ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *);
 
     if (fDst & INTNETTRUNKDIR_WIRE)
@@ -568,5 +568,5 @@
     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
 
-    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.ifp, ifp);
+    ASMAtomicUoWritePtr(&pThis->u.s.ifp, ifp);
     pThis->u.s.node = node;
     bcopy(IF_LLADDR(ifp), &pThis->u.s.MacAddr, ETHER_ADDR_LEN);
@@ -611,5 +611,5 @@
     struct ifnet *ifp, *ifp0;
 
-    ifp = (struct ifnet *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.ifp);
+    ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *);
     /*
      * Attempt to check if the interface is still there and re-initialize if
@@ -669,6 +669,6 @@
     Log(("%s: fActive:%d\n", __func__, fActive));
 
-    ifp = (struct ifnet *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.ifp);
-    node = (node_p)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.node);
+    ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *);
+    node = ASMAtomicUoReadPtrT(&pThis->u.s.node, node_p);
 
     memset(&ifreq, 0, sizeof(struct ifreq));
Index: /trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
===================================================================
--- /trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c	(revision 30110)
+++ /trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c	(revision 30111)
@@ -171,5 +171,5 @@
 #ifdef VBOXNETFLT_WITH_QDISC
 //#define QDISC_LOG(x) printk x
-#define QDISC_LOG(x)
+#define QDISC_LOG(x) do { } while (0)
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
@@ -593,6 +593,6 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
         pPriv->ppSaved[0] = pDev->qdisc_sleeping;
-        ASMAtomicWritePtr((void * volatile *)&pDev->qdisc_sleeping, pNew);
-        ASMAtomicWritePtr((void * volatile *)&pDev->qdisc, pNew);
+        ASMAtomicWritePtr(&pDev->qdisc_sleeping, pNew);
+        ASMAtomicWritePtr(&pDev->qdisc, pNew);
 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */
         for (i = 0; i < pDev->num_tx_queues; i++)
@@ -601,6 +601,6 @@
 
             pPriv->ppSaved[i] = pQueue->qdisc_sleeping;
-            ASMAtomicWritePtr((void * volatile *)&pQueue->qdisc_sleeping, pNew);
-            ASMAtomicWritePtr((void * volatile *)&pQueue->qdisc, pNew);
+            ASMAtomicWritePtr(&pQueue->qdisc_sleeping, pNew);
+            ASMAtomicWritePtr(&pQueue->qdisc, pNew);
             if (i)
                 atomic_inc(&pNew->refcnt);
@@ -609,5 +609,5 @@
 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
         pPriv->ppSaved[pDev->num_tx_queues] = pDev->qdisc;
-        ASMAtomicWritePtr((void * volatile *)&pDev->qdisc, pNew);
+        ASMAtomicWritePtr(&pDev->qdisc, pNew);
         atomic_inc(&pNew->refcnt);
 # endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) */
@@ -619,5 +619,5 @@
         pPriv = qdisc_priv(pExisting);
     }
-    ASMAtomicWritePtr((void * volatile *)&pPriv->pVBoxNetFlt, pThis);
+    ASMAtomicWritePtr(&pPriv->pVBoxNetFlt, pThis);
     QDISC_LOG(("vboxNetFltLinuxInstallQdisc: pThis=%p\n", pPriv->pVBoxNetFlt));
 }
@@ -631,5 +631,5 @@
     struct Qdisc *pQdisc;
     if (!pDev)
-        pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
+        pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
     if (!VALID_PTR(pDev))
     {
@@ -651,7 +651,7 @@
     pPriv = qdisc_priv(pQdisc);
     Assert(pPriv->pVBoxNetFlt == pThis);
-    ASMAtomicWritePtr((void * volatile *)&pPriv->pVBoxNetFlt, NULL);
-
-    QDISC_LOG(("vboxNetFltLinuxQdiscRemove: refcnt=%d num_tx_queues=%d\n", 
+    ASMAtomicWritePtr(&pPriv->pVBoxNetFlt, NULL);
+
+    QDISC_LOG(("vboxNetFltLinuxQdiscRemove: refcnt=%d num_tx_queues=%d\n",
                atomic_read(&pQdisc->refcnt), pDev->num_tx_queues));
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
@@ -659,8 +659,6 @@
     if (pPriv->ppSaved[0])
     {
-        ASMAtomicWritePtr((void * volatile *)&pDev->qdisc_sleeping,
-                          pPriv->ppSaved[0]);
-        ASMAtomicWritePtr((void * volatile *)&pDev->qdisc,
-                          pPriv->ppSaved[0]);
+        ASMAtomicWritePtr(&pDev->qdisc_sleeping, pPriv->ppSaved[0]);
+        ASMAtomicWritePtr(&pDev->qdisc, pPriv->ppSaved[0]);
         pPriv->ppSaved[0] = NULL;
         while (QDISC_IS_BUSY(pDev, pQdisc))
@@ -675,8 +673,6 @@
         {
             Assert(pQueue->qdisc_sleeping == pQdisc);
-            ASMAtomicWritePtr((void * volatile *)&pQueue->qdisc_sleeping,
-                              pPriv->ppSaved[i]);
-            ASMAtomicWritePtr((void * volatile *)&pQueue->qdisc, 
-                              pPriv->ppSaved[i]);
+            ASMAtomicWritePtr(&pQueue->qdisc_sleeping, pPriv->ppSaved[i]);
+            ASMAtomicWritePtr(&pQueue->qdisc, pPriv->ppSaved[i]);
             pPriv->ppSaved[i] = NULL;
             while (QDISC_IS_BUSY(pDev, pQdisc))
@@ -687,6 +683,5 @@
     /* Newer kernels store root qdisc in netdev structure as well. */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
-    ASMAtomicWritePtr((void * volatile *)&pDev->qdisc, 
-                      pPriv->ppSaved[pDev->num_tx_queues]);
+    ASMAtomicWritePtr(&pDev->qdisc, pPriv->ppSaved[pDev->num_tx_queues]);
     pPriv->ppSaved[pDev->num_tx_queues] = NULL;
     while (QDISC_IS_BUSY(pDev, pQdisc))
@@ -912,5 +907,5 @@
 
     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp); /* (this isn't necessary, but so what) */
-    ASMAtomicXchgPtr((void * volatile *)&pDev->netdev_ops, pOverride);
+    ASMAtomicWritePtr((void * volatile *)&pDev->netdev_ops, pOverride);
     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
 }
@@ -930,5 +925,5 @@
     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
     if (!pDev)
-        pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
+        pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
     if (VALID_PTR(pDev))
     {
@@ -939,5 +934,5 @@
            )
         {
-            ASMAtomicXchgPtr((void * volatile *)&pDev->netdev_ops, pOverride->pOrgOps);
+            ASMAtomicWritePtr((void * volatile *)&pDev->netdev_ops, pOverride->pOrgOps);
             ASMAtomicWriteU32(&pOverride->u32Magic, 0);
         }
@@ -990,5 +985,5 @@
     return pDev;
 #else
-    return (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
+    return ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
 #endif
 }
@@ -1060,5 +1055,5 @@
      * Allocate a packet and copy over the data.
      */
-    pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
+    pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
     pPkt = dev_alloc_skb(pSG->cbTotal + NET_IP_ALIGN);
     if (RT_UNLIKELY(!pPkt))
@@ -1282,5 +1277,5 @@
 
     pThis = VBOX_FLT_PT_TO_INST(pPacketType);
-    pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
+    pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
     if (pThis->u.s.pDev != pSkbDev)
     {
@@ -1820,5 +1815,5 @@
 
         pSwitchPort = pThis->pSwitchPort; /* this doesn't need to be here, but it doesn't harm. */
-        pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
+        pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
         if (pDev)
             fFeatures = pDev->features;
@@ -1887,9 +1882,9 @@
 
     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
-    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pDev, pDev);
+    ASMAtomicUoWritePtr(&pThis->u.s.pDev, pDev);
     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
 
     Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) retained. ref=%d\n", pDev, pDev->name, atomic_read(&pDev->refcnt)));
-    Log(("vboxNetFltLinuxAttachToInterface: Got pDev=%p pThis=%p pThis->u.s.pDev=%p\n", pDev, pThis, ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev)));
+    Log(("vboxNetFltLinuxAttachToInterface: Got pDev=%p pThis=%p pThis->u.s.pDev=%p\n", pDev, pThis, ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *)));
 
     /* Get the mac address while we still have a valid net_device reference. */
@@ -1916,5 +1911,5 @@
      */
     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
-    pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
+    pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
     if (pDev)
     {
@@ -1951,5 +1946,5 @@
 #endif /* VBOXNETFLT_WITH_QDISC */
         RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
-        ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pDev, NULL);
+        ASMAtomicUoWritePtr(&pThis->u.s.pDev, NULL);
         RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
         dev_put(pDev);
@@ -1978,5 +1973,5 @@
     ASMAtomicWriteBool(&pThis->u.s.fRegistered, false);
     ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
-    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pDev, NULL);
+    ASMAtomicUoWritePtr(&pThis->u.s.pDev, NULL);
     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
 
@@ -2068,5 +2063,5 @@
 
     Log(("VBoxNetFlt: got event %s(0x%lx) on %s, pDev=%p pThis=%p pThis->u.s.pDev=%p\n",
-         vboxNetFltLinuxGetNetDevEventName(ulEventType), ulEventType, pDev->name, pDev, pThis, ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev)));
+         vboxNetFltLinuxGetNetDevEventName(ulEventType), ulEventType, pDev->name, pDev, pThis, ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *)));
     if (    ulEventType == NETDEV_REGISTER
         && !strcmp(pDev->name, pThis->szName))
@@ -2076,5 +2071,5 @@
     else
     {
-        pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
+        pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
         if (pDev == ptr)
         {
@@ -2111,9 +2106,8 @@
 int  vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *pvIfData, PINTNETSG pSG, uint32_t fDst)
 {
-    NOREF(pvIfData);
-
     struct net_device * pDev;
     int err;
     int rc = VINF_SUCCESS;
+    NOREF(pvIfData);
 
     LogFlow(("vboxNetFltPortOsXmit: pThis=%p (%s)\n", pThis, pThis->szName));
@@ -2274,5 +2268,5 @@
 
     RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
-    pDev = (struct net_device *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pDev);
+    pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
     fRegistered = ASMAtomicUoReadBool(&pThis->u.s.fRegistered);
     RTSpinlockReleaseNoInts(pThis->hSpinlock, &Tmp);
Index: /trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
===================================================================
--- /trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c	(revision 30110)
+++ /trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c	(revision 30111)
@@ -777,12 +777,12 @@
      * the one that we will associate this stream with.
      */
-    ASMAtomicUoWritePtr((void * volatile *)&pStream->pThis, pThis);
+    ASMAtomicUoWritePtr(&pStream->pThis, pThis);
     pStream->Type = g_VBoxNetFltSolarisStreamType;
     switch (pStream->Type)
     {
-        case kIp4Stream:        ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pvIp4Stream, pStream);        break;
-        case kIp6Stream:        ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pvIp6Stream, pStream);        break;
-        case kArpStream:        ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pvArpStream, pStream);        break;
-        case kPromiscStream:    ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pvPromiscStream, pStream);    break;
+        case kIp4Stream:        ASMAtomicUoWritePtr(&pThis->u.s.pvIp4Stream, pStream);        break;
+        case kIp6Stream:        ASMAtomicUoWritePtr(&pThis->u.s.pvIp6Stream, pStream);        break;
+        case kArpStream:        ASMAtomicUoWritePtr(&pThis->u.s.pvArpStream, pStream);        break;
+        case kPromiscStream:    ASMAtomicUoWritePtr(&pThis->u.s.pvPromiscStream, pStream);    break;
         default:    /* Heh. */
         {
@@ -924,5 +924,5 @@
             RTTimerStop(pPromiscStream->pIp6Timer);
             RTTimerDestroy(pPromiscStream->pIp6Timer);
-            ASMAtomicUoWritePtr((void * volatile *)&pPromiscStream->pIp6Timer, NULL);
+            ASMAtomicUoWritePtr(&pPromiscStream->pIp6Timer, NULL);
         }
 #endif
@@ -999,5 +999,5 @@
     {
         fSendUpstream = false;
-        pThis = ASMAtomicUoReadPtr((void * volatile *)&pStream->pThis);
+        pThis = ASMAtomicUoReadPtrT(&pStream->pThis, PVBOXNETFLTINS);
         if (RT_LIKELY(pThis))
         {
@@ -2476,5 +2476,5 @@
         && RT_LIKELY(pTimer))
     {
-        vboxnetflt_stream_t *pIp6Stream  = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvIp6Stream);
+        vboxnetflt_stream_t *pIp6Stream  = ASMAtomicUoReadPtrT(pThis->u.s.pvIp6Stream, vboxnetflt_stream_t *);
         bool fIp6Attaching = ASMAtomicUoReadBool(&pThis->u.s.fAttaching);
         if (   !pIp6Stream
@@ -2512,5 +2512,5 @@
 
     int rc = VERR_GENERAL_FAILURE;
-    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream);
+    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvPromiscStream, vboxnetflt_promisc_stream_t *);
     if (RT_LIKELY(pPromiscStream))
     {
@@ -2572,5 +2572,5 @@
 
 #ifdef VBOXNETFLT_SOLARIS_IPV6_POLLING
-    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream);
+    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvPromiscStream, vboxnetflt_promisc_stream_t *);
     if (   pPromiscStream
         && pPromiscStream->pIp6Timer == NULL)
@@ -2578,5 +2578,5 @@
         RTTimerStop(pPromiscStream->pIp6Timer);
         RTTimerDestroy(pPromiscStream->pIp6Timer);
-        ASMAtomicUoWritePtr((void * volatile *)&pPromiscStream->pIp6Timer, NULL);
+        ASMAtomicUoWritePtr(&pPromiscStream->pIp6Timer, NULL);
     }
 #endif
@@ -3198,5 +3198,5 @@
     Assert(pStream->Type == kPromiscStream);
 
-    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream);
+    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvPromiscStream, vboxnetflt_promisc_stream_t *);
     if (RT_UNLIKELY(!pPromiscStream))
     {
@@ -3579,5 +3579,5 @@
      * Enable/disable promiscuous mode.
      */
-    vboxnetflt_stream_t *pStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream);
+    vboxnetflt_stream_t *pStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvPromiscStream, vboxnetflt_stream_t *);
     if (pStream)
     {
@@ -3804,5 +3804,5 @@
         }
 #else
-        vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream);
+        vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvPromiscStream, vboxnetflt_promisc_stream_t *);
         if (RT_LIKELY(pPromiscStream))
         {
@@ -3830,5 +3830,5 @@
          * We either bind to both or neither; so atomic reading one should be sufficient.
          */
-        vboxnetflt_stream_t *pIp4Stream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvIp4Stream);
+        vboxnetflt_stream_t *pIp4Stream = ASMAtomicUoReadPtrT(&pThis->u.s.pvIp4Stream, vboxnetflt_stream_t *);
         if (!pIp4Stream)
             return rc;
@@ -3849,5 +3849,5 @@
                 LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_HOST ARP\n"));
 
-                vboxnetflt_stream_t *pArpStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvArpStream);
+                vboxnetflt_stream_t *pArpStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvArpStream, vboxnetflt_stream_t *);
                 if (pArpStream)
                 {
@@ -3876,5 +3876,5 @@
             else
             {
-                 vboxnetflt_stream_t *pIp6Stream  = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvIp6Stream);
+                 vboxnetflt_stream_t *pIp6Stream  = ASMAtomicUoReadPtrT(&pThis->u.s.pvIp6Stream, vboxnetflt_stream_t *);
                  if (   pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPV6)
                      && pIp6Stream)
Index: /trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.h
===================================================================
--- /trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.h	(revision 30110)
+++ /trunk/src/VBox/HostDrivers/VBoxNetFlt/win/VBoxNetFlt-win.h	(revision 30111)
@@ -202,5 +202,5 @@
 
 /** assignes the packet to the packet info */
-#define SET_PACKET_TO_INFO(_pPacketInfo, _pPacket) (ASMAtomicUoWritePtr((void * volatile *)&(_pPacketInfo)->pPacket, (_pPacket)))
+#define SET_PACKET_TO_INFO(_pPacketInfo, _pPacket) (ASMAtomicUoWritePtr(&(_pPacketInfo)->pPacket, (_pPacket)))
 
 /** returns the flags the packet info contains */
Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 30110)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 30111)
@@ -8088,5 +8088,5 @@
         if (RT_FAILURE(rc))
             pLed = NULL;
-        ASMAtomicXchgPtr((void * volatile *)&pData->papLeds[iLUN - pData->iFirstLUN], pLed);
+        ASMAtomicWritePtr(&pData->papLeds[iLUN - pData->iFirstLUN], pLed);
         Log(("drvStatus_UnitChanged: iLUN=%d pLed=%p\n", iLUN, pLed));
     }
@@ -8123,5 +8123,5 @@
         unsigned iLed = pData->iLastLUN - pData->iFirstLUN + 1;
         while (iLed-- > 0)
-            ASMAtomicXchgPtr((void * volatile *)&pData->papLeds[iLed], NULL);
+            ASMAtomicWritePtr(&pData->papLeds[iLed], NULL);
     }
 }
Index: /trunk/src/VBox/Main/VirtualBoxBase.cpp
===================================================================
--- /trunk/src/VBox/Main/VirtualBoxBase.cpp	(revision 30110)
+++ /trunk/src/VBox/Main/VirtualBoxBase.cpp	(revision 30111)
@@ -91,8 +91,8 @@
         // one of the locking classes listed at the top of AutoLock.h
         RWLockHandle *objLock = new RWLockHandle(getLockingClass());
-        if (!ASMAtomicCmpXchgPtr ((void * volatile *) &mObjectLock, objLock, NULL))
+        if (!ASMAtomicCmpXchgPtr(&mObjectLock, objLock, NULL))
         {
             delete objLock;
-            objLock = (RWLockHandle *) ASMAtomicReadPtr ((void * volatile *) &mObjectLock);
+            objLock = ASMAtomicReadPtrT(&mObjectLock, RWLockHandle *);
         }
         return objLock;
Index: /trunk/src/VBox/Runtime/common/alloc/memcache.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/alloc/memcache.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/common/alloc/memcache.cpp	(revision 30111)
@@ -308,15 +308,15 @@
 
             /* Make it the hint. */
-            ASMAtomicWritePtr((void * volatile *)&pThis->pPageHint, pPage);
+            ASMAtomicWritePtr(&pThis->pPageHint, pPage);
 
             /* Link the page. */
             PRTMEMCACHEPAGE pPrevPage = pThis->pPageHead;
             if (!pPrevPage)
-                ASMAtomicWritePtr((void * volatile *)&pThis->pPageHead, pPage);
+                ASMAtomicWritePtr(&pThis->pPageHead, pPage);
             else
             {
                 while (pPrevPage->pNext)
                     pPrevPage = pPrevPage->pNext;
-                ASMAtomicWritePtr((void * volatile *)&pPrevPage->pNext, pPage);
+                ASMAtomicWritePtr(&pPrevPage->pNext, pPage);
             }
 
@@ -359,5 +359,5 @@
      * Try grab a free object from the stack.
      */
-    PRTMEMCACHEFREEOBJ pObj = (PRTMEMCACHEFREEOBJ)ASMAtomicUoReadPtr((void * volatile *)&pThis->pFreeTop);
+    PRTMEMCACHEFREEOBJ pObj = ASMAtomicUoReadPtrT(&pThis->pFreeTop, PRTMEMCACHEFREEOBJ);
     if (pObj)
     {
@@ -365,11 +365,11 @@
         do
         {
-            pNext = (PRTMEMCACHEFREEOBJ)ASMAtomicUoReadPtr((void * volatile *)&pObj->pNext);
-            if (ASMAtomicCmpXchgPtr((void * volatile *)&pThis->pFreeTop, pNext, pObj))
+            pNext = ASMAtomicUoReadPtrT(&pObj->pNext, PRTMEMCACHEFREEOBJ);
+            if (ASMAtomicCmpXchgPtr(&pThis->pFreeTop, pNext, pObj))
             {
                 *ppvObj = pObj;
                 return VINF_SUCCESS;
             }
-            pObj = (PRTMEMCACHEFREEOBJ)ASMAtomicUoReadPtr((void * volatile *)&pThis->pFreeTop);
+            pObj = ASMAtomicUoReadPtrT(&pThis->pFreeTop, PRTMEMCACHEFREEOBJ);
         } while (pObj);
     }
@@ -400,5 +400,5 @@
      * Grab a free object at the page level.
      */
-    PRTMEMCACHEPAGE pPage = (PRTMEMCACHEPAGE)ASMAtomicReadPtr((void * volatile *)&pThis->pPageHint);
+    PRTMEMCACHEPAGE pPage = ASMAtomicReadPtrT(&pThis->pPageHint, PRTMEMCACHEPAGE);
     int32_t iObj = pPage ? rtMemCacheGrabObj(pPage) : -1;
     if (iObj < 0)
@@ -412,5 +412,5 @@
                 {
                     if (iObj > 0)
-                        ASMAtomicWritePtr((void * volatile *)&pThis->pPageHint, pPage);
+                        ASMAtomicWritePtr(&pThis->pPageHint, pPage);
                     break;
                 }
@@ -511,7 +511,7 @@
         do
         {
-            pNext = (PRTMEMCACHEFREEOBJ)ASMAtomicUoReadPtr((void * volatile *)&pThis->pFreeTop);
+            pNext = ASMAtomicUoReadPtrT(&pThis->pFreeTop, PRTMEMCACHEFREEOBJ);
             pObj->pNext = pNext;
-        } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pThis->pFreeTop, pObj, pNext));
+        } while (!ASMAtomicCmpXchgPtr(&pThis->pFreeTop, pObj, pNext));
     }
     else
Index: /trunk/src/VBox/Runtime/common/log/log.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/log/log.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/common/log/log.cpp	(revision 30111)
@@ -1826,5 +1826,5 @@
 RTDECL(PRTLOGGER) RTLogSetDefaultInstance(PRTLOGGER pLogger)
 {
-    return (PRTLOGGER)ASMAtomicXchgPtr((void * volatile *)&g_pLogger, pLogger);
+    return ASMAtomicXchgPtrT(&g_pLogger, pLogger, PRTLOGGER);
 }
 RT_EXPORT_SYMBOL(RTLogSetDefaultInstance);
@@ -1861,5 +1861,5 @@
             if (g_aPerThreadLoggers[i].NativeThread == Self)
             {
-                ASMAtomicXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].uKey, (void *)uKey);
+                ASMAtomicWritePtr((void * volatile *)&g_aPerThreadLoggers[i].uKey, (void *)uKey);
                 g_aPerThreadLoggers[i].pLogger = pLogger;
                 return VINF_SUCCESS;
@@ -1885,6 +1885,6 @@
                     &&  ASMAtomicCmpXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].NativeThread, (void *)Self, (void *)NIL_RTNATIVETHREAD))
                 {
-                    ASMAtomicXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].uKey, (void *)uKey);
-                    ASMAtomicXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].pLogger, pLogger);
+                    ASMAtomicWritePtr((void * volatile *)&g_aPerThreadLoggers[i].uKey, (void *)uKey);
+                    ASMAtomicWritePtr(&g_aPerThreadLoggers[i].pLogger, pLogger);
                     return VINF_SUCCESS;
                 }
@@ -1905,7 +1905,7 @@
                 ||  g_aPerThreadLoggers[i].uKey == uKey)
             {
-                ASMAtomicXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].uKey, NULL);
-                ASMAtomicXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].pLogger, NULL);
-                ASMAtomicXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].NativeThread, (void *)NIL_RTNATIVETHREAD);
+                ASMAtomicWritePtr((void * volatile *)&g_aPerThreadLoggers[i].uKey, (void *)NULL);
+                ASMAtomicWritePtr(&g_aPerThreadLoggers[i].pLogger, (PRTLOGGER)NULL);
+                ASMAtomicWriteHandle(&g_aPerThreadLoggers[i].NativeThread, NIL_RTNATIVETHREAD);
                 ASMAtomicDecS32(&g_cPerThreadLoggers);
             }
Index: /trunk/src/VBox/Runtime/common/log/logrel.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/log/logrel.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/common/log/logrel.cpp	(revision 30111)
@@ -96,5 +96,5 @@
 RTDECL(PRTLOGGER) RTLogRelSetDefaultInstance(PRTLOGGER pLogger)
 {
-    return (PRTLOGGER)ASMAtomicXchgPtr((void * volatile *)&g_pRelLogger, pLogger);
+    return ASMAtomicXchgPtrT(&g_pRelLogger, pLogger, PRTLOGGER);
 }
 RT_EXPORT_SYMBOL(RTLogRelSetDefaultInstance);
Index: /trunk/src/VBox/Runtime/common/misc/assert.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/misc/assert.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/common/misc/assert.cpp	(revision 30111)
@@ -107,7 +107,7 @@
      * Fill in the globals.
      */
-    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertExpr, (void *)pszExpr);
-    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFile, (void *)pszFile);
-    ASMAtomicUoWritePtr((void * volatile *)&g_pszRTAssertFunction, (void *)pszFunction);
+    ASMAtomicUoWritePtr(&g_pszRTAssertExpr, pszExpr);
+    ASMAtomicUoWritePtr(&g_pszRTAssertFile, pszFile);
+    ASMAtomicUoWritePtr(&g_pszRTAssertFunction, pszFunction);
     ASMAtomicUoWriteU32(&g_u32RTAssertLine, uLine);
     RTStrPrintf(g_szRTAssertMsg1, sizeof(g_szRTAssertMsg1),
Index: /trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp	(revision 30111)
@@ -341,5 +341,5 @@
 DECL_FORCE_INLINE(PRTLOCKVALRECUNION) rtLockValidatorReadRecUnionPtr(PRTLOCKVALRECUNION volatile *ppRec)
 {
-    PRTLOCKVALRECUNION p = (PRTLOCKVALRECUNION)ASMAtomicReadPtr((void * volatile *)ppRec);
+    PRTLOCKVALRECUNION p = ASMAtomicReadPtrT(ppRec, PRTLOCKVALRECUNION);
     RTLOCKVAL_ASSERT_PTR_ALIGN(p);
     return p;
@@ -351,5 +351,5 @@
 {
     RTLOCKVAL_ASSERT_PTR_ALIGN(pRecNew);
-    ASMAtomicWritePtr((void * volatile *)ppRec, pRecNew);
+    ASMAtomicWritePtr(ppRec, pRecNew);
 }
 
@@ -358,5 +358,5 @@
 DECL_FORCE_INLINE(PRTTHREADINT) rtLockValidatorReadThreadHandle(RTTHREAD volatile *phThread)
 {
-    PRTTHREADINT p = (PRTTHREADINT)ASMAtomicReadPtr((void * volatile *)phThread);
+    PRTTHREADINT p = ASMAtomicReadPtrT(phThread, PRTTHREADINT);
     RTLOCKVAL_ASSERT_PTR_ALIGN(p);
     return p;
@@ -367,5 +367,5 @@
 DECL_FORCE_INLINE(PRTLOCKVALRECSHRDOWN) rtLockValidatorUoReadSharedOwner(PRTLOCKVALRECSHRDOWN volatile *ppOwner)
 {
-    PRTLOCKVALRECSHRDOWN p = (PRTLOCKVALRECSHRDOWN)ASMAtomicUoReadPtr((void * volatile *)ppOwner);
+    PRTLOCKVALRECSHRDOWN p = ASMAtomicUoReadPtrT(ppOwner, PRTLOCKVALRECSHRDOWN);
     RTLOCKVAL_ASSERT_PTR_ALIGN(p);
     return p;
@@ -819,15 +819,15 @@
     if (pSrc)
     {
-        ASMAtomicUoWriteU32(&pDst->uLine,                           pSrc->uLine);
-        ASMAtomicUoWritePtr((void * volatile *)&pDst->pszFile,      pSrc->pszFile);
-        ASMAtomicUoWritePtr((void * volatile *)&pDst->pszFunction,  pSrc->pszFunction);
-        ASMAtomicUoWritePtr((void * volatile *)&pDst->uId,          (void *)pSrc->uId);
+        ASMAtomicUoWriteU32(&pDst->uLine,        pSrc->uLine);
+        ASMAtomicUoWritePtr(&pDst->pszFile,      pSrc->pszFile);
+        ASMAtomicUoWritePtr(&pDst->pszFunction,  pSrc->pszFunction);
+        ASMAtomicUoWritePtr((void * volatile *)&pDst->uId, (void *)pSrc->uId);
     }
     else
     {
-        ASMAtomicUoWriteU32(&pDst->uLine,                           0);
-        ASMAtomicUoWritePtr((void * volatile *)&pDst->pszFile,      NULL);
-        ASMAtomicUoWritePtr((void * volatile *)&pDst->pszFunction,  NULL);
-        ASMAtomicUoWritePtr((void * volatile *)&pDst->uId,          0);
+        ASMAtomicUoWriteU32(&pDst->uLine,        0);
+        ASMAtomicUoWritePtr(&pDst->pszFile,      NULL);
+        ASMAtomicUoWritePtr(&pDst->pszFunction,  NULL);
+        ASMAtomicUoWritePtr(&pDst->uId, (RTHCUINTPTR)0);
     }
 }
@@ -1359,5 +1359,5 @@
                 if (    !(*ppHashEntry)
                     ||  (*ppHashEntry)->cLookups + 128 < cLookups)
-                    ASMAtomicWritePtr((void * volatile *)ppHashEntry, &pChunk->aRefs[i]);
+                    ASMAtomicWritePtr(ppHashEntry, &pChunk->aRefs[i]);
 
 #ifdef RTLOCKVAL_WITH_CLASS_HASH_STATS
@@ -1469,5 +1469,5 @@
                     pNew->aRefs[0].fAutodidacticism = fAutodidacticism;
 
-                    ASMAtomicWritePtr((void * volatile *)&pChunk->pNext, pNew);
+                    ASMAtomicWritePtr(&pChunk->pNext, pNew);
                     rtLockValidatorClassRetain(pPriorClass);
                     rc = VINF_SUCCESS;
@@ -1547,5 +1547,5 @@
         if (RT_UNLIKELY(ppCoreNext))
             break;
-        pSibling = (PRTLOCKVALRECUNION)ASMAtomicXchgPtr((void * volatile *)ppCoreNext, NULL);
+        pSibling = ASMAtomicXchgPtrT(ppCoreNext, NULL, PRTLOCKVALRECUNION);
     }
 }
@@ -3472,5 +3472,5 @@
     {
         PRTLOCKVALRECSHRDOWN volatile *papOwners = pRec->papOwners;
-        ASMAtomicUoWritePtr((void * volatile *)&pRec->papOwners, NULL);
+        ASMAtomicUoWritePtr(&pRec->papOwners, NULL);
         ASMAtomicUoWriteU32(&pRec->cAllocated, 0);
 
@@ -3815,5 +3815,5 @@
                 }
 
-                ASMAtomicWritePtr((void * volatile *)&pShared->papOwners, papOwners);
+                ASMAtomicWritePtr(&pShared->papOwners, papOwners);
                 ASMAtomicWriteU32(&pShared->cAllocated, cAllocated);
             }
@@ -3858,5 +3858,5 @@
             for (uint32_t iEntry = 0; iEntry < cMax; iEntry++)
             {
-                if (ASMAtomicCmpXchgPtr((void * volatile *)&papOwners[iEntry], pEntry, NULL))
+                if (ASMAtomicCmpXchgPtr(&papOwners[iEntry], pEntry, NULL))
                 {
                     rtLockValidatorSerializeDetectionLeave();
@@ -3889,5 +3889,5 @@
     AssertReturnVoidStmt(pShared->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC, rtLockValidatorSerializeDetectionLeave());
     if (RT_UNLIKELY(   iEntry >= pShared->cAllocated
-                    || !ASMAtomicCmpXchgPtr((void * volatile *)&pShared->papOwners[iEntry], NULL, pEntry)))
+                    || !ASMAtomicCmpXchgPtr(&pShared->papOwners[iEntry], NULL, pEntry)))
     {
         /* this shouldn't happen yet... */
@@ -3896,5 +3896,5 @@
         uint32_t const                  cMax      = pShared->cAllocated;
         for (iEntry = 0; iEntry < cMax; iEntry++)
-            if (ASMAtomicCmpXchgPtr((void * volatile *)&papOwners[iEntry], NULL, pEntry))
+            if (ASMAtomicCmpXchgPtr(&papOwners[iEntry], NULL, pEntry))
                break;
         AssertReturnVoidStmt(iEntry < cMax, rtLockValidatorSerializeDetectionLeave());
@@ -3931,5 +3931,5 @@
         while (iEntry < cEntries)
         {
-            PRTLOCKVALRECSHRDOWN pEntry = (PRTLOCKVALRECSHRDOWN)ASMAtomicXchgPtr((void * volatile *)&papEntries[iEntry], NULL);
+            PRTLOCKVALRECSHRDOWN pEntry = ASMAtomicXchgPtrT(&papEntries[iEntry], NULL, PRTLOCKVALRECSHRDOWN);
             if (pEntry)
             {
Index: /trunk/src/VBox/Runtime/common/misc/req.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/misc/req.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/common/misc/req.cpp	(revision 30111)
@@ -129,5 +129,5 @@
          * Get pending requests.
          */
-        PRTREQ pReqs = (PRTREQ)ASMAtomicXchgPtr((void * volatile *)&pQueue->pReqs, NULL);
+        PRTREQ pReqs = ASMAtomicXchgPtrT(&pQueue->pReqs, NULL, PRTREQ);
         if (!pReqs)
         {
@@ -393,5 +393,5 @@
     for (unsigned cIterations = 0;; cIterations++)
     {
-        PRTREQ pHead = (PRTREQ)ASMAtomicXchgPtr((void * volatile *)ppHead, pList);
+        PRTREQ pHead = ASMAtomicXchgPtrT(ppHead, pList, PRTREQ);
         if (!pHead)
             return;
@@ -400,8 +400,8 @@
             pTail = pTail->pNext;
         pTail->pNext = pList;
-        if (ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (void *)pHead, pList))
+        if (ASMAtomicCmpXchgPtr(ppHead, pHead, pList))
             return;
         pTail->pNext = NULL;
-        if (ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (void *)pHead, NULL))
+        if (ASMAtomicCmpXchgPtr(ppHead, pHead, NULL))
             return;
         pList = pHead;
@@ -478,7 +478,7 @@
         PRTREQ pReq = *ppHead;
         if (    pReq
-            &&  !ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (pNext = pReq->pNext), pReq)
+            &&  !ASMAtomicCmpXchgPtr(ppHead, (pNext = pReq->pNext), pReq)
             &&  (pReq = *ppHead)
-            &&  !ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (pNext = pReq->pNext), pReq))
+            &&  !ASMAtomicCmpXchgPtr(ppHead, (pNext = pReq->pNext), pReq))
             pReq = NULL;
         if (pReq)
@@ -486,10 +486,10 @@
             Assert(pReq->pNext == pNext); NOREF(pReq);
 #else
-        PRTREQ pReq = (PRTREQ)ASMAtomicXchgPtr((void * volatile *)ppHead, NULL);
+        PRTREQ pReq = ASMAtomicXchgPtrT(ppHead, NULL, PRTREQ);
         if (pReq)
         {
             PRTREQ pNext = pReq->pNext;
             if (    pNext
-                &&  !ASMAtomicCmpXchgPtr((void * volatile *)ppHead, pNext, NULL))
+                &&  !ASMAtomicCmpXchgPtr(ppHead, pNext, NULL))
             {
                 vmr3ReqJoinFree(pQueue, pReq->pNext);
@@ -621,6 +621,6 @@
         {
             pNext = *ppHead;
-            ASMAtomicXchgPtr((void * volatile *)&pReq->pNext, pNext);
-        } while (!ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (void *)pReq, (void *)pNext));
+            ASMAtomicWritePtr(&pReq->pNext, pNext);
+        } while (!ASMAtomicCmpXchgPtr(ppHead, pReq, pNext));
     }
     else
@@ -691,5 +691,5 @@
         pReq->pNext = pNext;
         ASMAtomicWriteBool(&pQueue->fBusy, true);
-    } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pQueue->pReqs, (void *)pReq, (void *)pNext));
+    } while (!ASMAtomicCmpXchgPtr(&pQueue->pReqs, pReq, pNext));
 
     /*
@@ -931,5 +931,5 @@
     if (ASMAtomicReadBool(&pQueue->fBusy))
         return true;
-    if (ASMAtomicReadPtr((void * volatile *)&pQueue->pReqs) != NULL)
+    if (ASMAtomicReadPtrT(&pQueue->pReqs, PRTREQ) != NULL)
         return true;
     if (ASMAtomicReadBool(&pQueue->fBusy))
Index: /trunk/src/VBox/Runtime/common/misc/thread.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/misc/thread.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/common/misc/thread.cpp	(revision 30111)
@@ -1349,5 +1349,5 @@
             if (   pThread->LockValidator.pRec
                 && pThread->LockValidator.enmRecState == enmCurState)
-                ASMAtomicWritePtr((void * volatile *)&pThread->LockValidator.pRec, NULL);
+                ASMAtomicWritePtr(&pThread->LockValidator.pRec, NULL);
         }
         /* This is a bit ugly... :-/ */
@@ -1355,5 +1355,5 @@
                      || enmActualState == RTTHREADSTATE_INITIALIZING)
                  && pThread->LockValidator.pRec)
-            ASMAtomicWritePtr((void * volatile *)&pThread->LockValidator.pRec, NULL);
+            ASMAtomicWritePtr(&pThread->LockValidator.pRec, NULL);
         Assert(   pThread->LockValidator.pRec == NULL
                || RTTHREAD_IS_SLEEPING(enmActualState));
Index: /trunk/src/VBox/Runtime/generic/tls-generic.cpp
===================================================================
--- /trunk/src/VBox/Runtime/generic/tls-generic.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/generic/tls-generic.cpp	(revision 30111)
@@ -89,5 +89,5 @@
         return VERR_INVALID_PARAMETER;
 
-    ASMAtomicWritePtr((void * volatile *)&g_apfnDestructors[iTls], NULL);
+    ASMAtomicWritePtr(&g_apfnDestructors[iTls], NULL);
     rtThreadClearTlsEntry(iTls);
     ASMAtomicBitClear(&g_au32AllocatedBitmap[0], iTls);
Index: /trunk/src/VBox/Runtime/r3/darwin/sched-darwin.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/darwin/sched-darwin.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/r3/darwin/sched-darwin.cpp	(revision 30111)
@@ -270,5 +270,5 @@
         }
     Assert(pProcessPriority != &g_aDefaultPriority);
-    ASMAtomicUoWritePtr((void **)&g_pProcessPriority, pProcessPriority);
+    ASMAtomicUoWritePtr(&g_pProcessPriority, pProcessPriority);
 
     return VINF_SUCCESS;
Index: /trunk/src/VBox/Runtime/r3/posix/fileaio-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/fileaio-posix.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/r3/posix/fileaio-posix.cpp	(revision 30111)
@@ -198,6 +198,5 @@
         for (unsigned iSlot = 0; iSlot < RT_ELEMENTS(pCtxInt->apReqsNewHead); iSlot++)
         {
-            PRTFILEAIOREQINTERNAL pReqHead = (PRTFILEAIOREQINTERNAL)ASMAtomicXchgPtr((void* volatile*)&pCtxInt->apReqsNewHead[iSlot],
-                                                                                     NULL);
+            PRTFILEAIOREQINTERNAL pReqHead = ASMAtomicXchgPtrT(&pCtxInt->apReqsNewHead[iSlot], NULL, PRTFILEAIOREQINTERNAL);
 
             while (  (pCtxInt->iFirstFree < pCtxInt->cReqsWaitMax)
@@ -249,5 +248,5 @@
 
         /* Check if a request needs to be canceled. */
-        PRTFILEAIOREQINTERNAL pReqToCancel = (PRTFILEAIOREQINTERNAL)ASMAtomicReadPtr((void* volatile*)&pCtxInt->pReqToCancel);
+        PRTFILEAIOREQINTERNAL pReqToCancel = ASMAtomicReadPtrT(&pCtxInt->pReqToCancel, PRTFILEAIOREQINTERNAL);
         if (pReqToCancel)
         {
@@ -487,5 +486,5 @@
 
         Assert(!pCtxInt->pReqToCancel);
-        ASMAtomicWritePtr((void* volatile*)&pCtxInt->pReqToCancel, pReqInt);
+        ASMAtomicWritePtr(&pCtxInt->pReqToCancel, pReqInt);
         rtFileAioCtxWakeup(pCtxInt);
 
@@ -494,5 +493,5 @@
         AssertRC(rc);
 
-        ASMAtomicWritePtr((void* volatile*)&pCtxInt->pReqToCancel, NULL);
+        ASMAtomicWritePtr(&pCtxInt->pReqToCancel, NULL);
         pReqInt->Rc = VERR_FILE_AIO_CANCELED;
         RTFILEAIOREQ_SET_STATE(pReqInt, COMPLETED);
@@ -819,5 +818,5 @@
         unsigned iSlot = 0;
         while (  (iSlot < RT_ELEMENTS(pCtxInt->apReqsNewHead))
-               && !ASMAtomicCmpXchgPtr((void * volatile *)&pCtxInt->apReqsNewHead[iSlot], pHead, NULL))
+               && !ASMAtomicCmpXchgPtr(&pCtxInt->apReqsNewHead[iSlot], pHead, NULL))
             iSlot++;
 
@@ -825,6 +824,5 @@
         {
             /* Nothing found. */
-            PRTFILEAIOREQINTERNAL pOldHead = (PRTFILEAIOREQINTERNAL)ASMAtomicXchgPtr((void * volatile *)&pCtxInt->apReqsNewHead[0],
-                                                                                      NULL);
+            PRTFILEAIOREQINTERNAL pOldHead = ASMAtomicXchgPtrT(&pCtxInt->apReqsNewHead[0], NULL, PRTFILEAIOREQINTERNAL);
 
             /* Find the end of the current head and link the old list to the current. */
@@ -835,5 +833,5 @@
             pTail->pNext = pOldHead;
 
-            ASMAtomicXchgPtr((void * volatile *)&pCtxInt->apReqsNewHead[0], pHead);
+            ASMAtomicWritePtr(&pCtxInt->apReqsNewHead[0], pHead);
         }
 
Index: /trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp	(revision 30111)
@@ -52,10 +52,10 @@
 /** @todo move this to r3/posix/something.h. */
 #ifdef RT_OS_SOLARIS
-# define ATOMIC_GET_PTHREAD_T(pvVar, pThread) ASMAtomicReadSize(pvVar, pThread)
-# define ATOMIC_SET_PTHREAD_T(pvVar, pThread) ASMAtomicWriteSize(pvVar, pThread)
+# define ATOMIC_GET_PTHREAD_T(ppvVar, pThread) ASMAtomicReadSize(ppvVar, pThread)
+# define ATOMIC_SET_PTHREAD_T(ppvVar, pThread) ASMAtomicWriteSize(ppvVar, pThread)
 #else
 AssertCompileSize(pthread_t, sizeof(void *));
-# define ATOMIC_GET_PTHREAD_T(pvVar, pThread) do { *(pThread) = (pthread_t)ASMAtomicReadPtr((void *volatile *)pvVar); } while (0)
-# define ATOMIC_SET_PTHREAD_T(pvVar, pThread) ASMAtomicWritePtr((void *volatile *)pvVar, (void *)pThread)
+# define ATOMIC_GET_PTHREAD_T(ppvVar, pThread) do { *(pThread) = (pthread_t)ASMAtomicReadPtr((void * volatile *)ppvVar); } while (0)
+# define ATOMIC_SET_PTHREAD_T(ppvVar, pThread) ASMAtomicWritePtr((void * volatile *)ppvVar, (void *)pThread)
 #endif
 
Index: /trunk/src/VBox/Runtime/r3/stream.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/stream.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/r3/stream.cpp	(revision 30111)
@@ -143,5 +143,5 @@
         if (RT_SUCCESS(rc))
         {
-            if (RT_LIKELY(ASMAtomicCmpXchgPtr((void * volatile *)&pStream->pCritSect, pCritSect, NULL)))
+            if (RT_LIKELY(ASMAtomicCmpXchgPtr(&pStream->pCritSect, pCritSect, NULL)))
                 return VINF_SUCCESS;
 
@@ -153,5 +153,5 @@
 
     /* Handle the lost race case... */
-    pCritSect = (PRTCRITSECT)ASMAtomicReadPtr((void * volatile *)&pStream->pCritSect);
+    pCritSect = ASMAtomicReadPtrT(&pStream->pCritSect, PRTCRITSECT);
     if (pCritSect)
         return RTCritSectEnter(pCritSect);
Index: /trunk/src/VBox/Runtime/r3/win/semmutex-win.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/semmutex-win.cpp	(revision 30110)
+++ /trunk/src/VBox/Runtime/r3/win/semmutex-win.cpp	(revision 30111)
@@ -138,5 +138,5 @@
     AssertReturn(ASMAtomicCmpXchgU32(&pThis->u32Magic, RTSEMMUTEX_MAGIC_DEAD, RTSEMMUTEX_MAGIC), VERR_INVALID_HANDLE);
     HANDLE hMtx = pThis->hMtx;
-    ASMAtomicWritePtr((void * volatile *)&pThis->hMtx, (void *)INVALID_HANDLE_VALUE);
+    ASMAtomicWritePtr(&pThis->hMtx, INVALID_HANDLE_VALUE);
 
     int rc = VINF_SUCCESS;
Index: /trunk/src/VBox/VMM/PDMAsyncCompletionFile.cpp
===================================================================
--- /trunk/src/VBox/VMM/PDMAsyncCompletionFile.cpp	(revision 30110)
+++ /trunk/src/VBox/VMM/PDMAsyncCompletionFile.cpp	(revision 30111)
@@ -120,5 +120,5 @@
      * Get pending tasks.
      */
-    pTasks = (PPDMACTASKFILE)ASMAtomicXchgPtr((void * volatile *)&pEndpoint->pTasksNewHead, NULL);
+    pTasks = ASMAtomicXchgPtrT(&pEndpoint->pTasksNewHead, NULL, PPDMACTASKFILE);
 
     /* Reverse the list to process in FIFO order. */
@@ -185,5 +185,5 @@
     AssertRCReturn(rc, rc);
 
-    ASMAtomicWritePtr((void * volatile *)&pAioMgr->BlockingEventData.AddEndpoint.pEndpoint, pEndpoint);
+    ASMAtomicWritePtr(&pAioMgr->BlockingEventData.AddEndpoint.pEndpoint, pEndpoint);
     rc = pdmacFileAioMgrWaitForBlockingEvent(pAioMgr, PDMACEPFILEAIOMGRBLOCKINGEVENT_ADD_ENDPOINT);
 
@@ -191,5 +191,5 @@
 
     if (RT_SUCCESS(rc))
-        ASMAtomicWritePtr((void * volatile *)&pEndpoint->pAioMgr, pAioMgr);
+        ASMAtomicWritePtr(&pEndpoint->pAioMgr, pAioMgr);
 
     return rc;
@@ -203,5 +203,5 @@
     AssertRCReturn(rc, rc);
 
-    ASMAtomicWritePtr((void * volatile *)&pAioMgr->BlockingEventData.RemoveEndpoint.pEndpoint, pEndpoint);
+    ASMAtomicWritePtr(&pAioMgr->BlockingEventData.RemoveEndpoint.pEndpoint, pEndpoint);
     rc = pdmacFileAioMgrWaitForBlockingEvent(pAioMgr, PDMACEPFILEAIOMGRBLOCKINGEVENT_REMOVE_ENDPOINT);
 
@@ -218,5 +218,5 @@
     AssertRCReturn(rc, rc);
 
-    ASMAtomicWritePtr((void * volatile *)&pAioMgr->BlockingEventData.CloseEndpoint.pEndpoint, pEndpoint);
+    ASMAtomicWritePtr(&pAioMgr->BlockingEventData.CloseEndpoint.pEndpoint, pEndpoint);
     rc = pdmacFileAioMgrWaitForBlockingEvent(pAioMgr, PDMACEPFILEAIOMGRBLOCKINGEVENT_CLOSE_ENDPOINT);
 
@@ -247,7 +247,7 @@
         pNext = pEndpoint->pTasksNewHead;
         pTask->pNext = pNext;
-    } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pEndpoint->pTasksNewHead, (void *)pTask, (void *)pNext));
-
-    pdmacFileAioMgrWakeup((PPDMACEPFILEMGR)ASMAtomicReadPtr((void * volatile *)&pEndpoint->pAioMgr));
+    } while (!ASMAtomicCmpXchgPtr(&pEndpoint->pTasksNewHead, pTask, pNext));
+
+    pdmacFileAioMgrWakeup(ASMAtomicReadPtrT(&pEndpoint->pAioMgr, PPDMACEPFILEMGR));
 
     return VINF_SUCCESS;
Index: /trunk/src/VBox/VMM/PDMAsyncCompletionFileNormal.cpp
===================================================================
--- /trunk/src/VBox/VMM/PDMAsyncCompletionFileNormal.cpp	(revision 30110)
+++ /trunk/src/VBox/VMM/PDMAsyncCompletionFileNormal.cpp	(revision 30111)
@@ -1194,5 +1194,5 @@
         case PDMACEPFILEAIOMGRBLOCKINGEVENT_ADD_ENDPOINT:
         {
-            PPDMASYNCCOMPLETIONENDPOINTFILE pEndpointNew = (PPDMASYNCCOMPLETIONENDPOINTFILE)ASMAtomicReadPtr((void * volatile *)&pAioMgr->BlockingEventData.AddEndpoint.pEndpoint);
+            PPDMASYNCCOMPLETIONENDPOINTFILE pEndpointNew = ASMAtomicReadPtrT(&pAioMgr->BlockingEventData.AddEndpoint.pEndpoint, PPDMASYNCCOMPLETIONENDPOINTFILE);
             AssertMsg(VALID_PTR(pEndpointNew), ("Adding endpoint event without a endpoint to add\n"));
 
@@ -1213,5 +1213,5 @@
         case PDMACEPFILEAIOMGRBLOCKINGEVENT_REMOVE_ENDPOINT:
         {
-            PPDMASYNCCOMPLETIONENDPOINTFILE pEndpointRemove = (PPDMASYNCCOMPLETIONENDPOINTFILE)ASMAtomicReadPtr((void * volatile *)&pAioMgr->BlockingEventData.RemoveEndpoint.pEndpoint);
+            PPDMASYNCCOMPLETIONENDPOINTFILE pEndpointRemove = ASMAtomicReadPtrT(&pAioMgr->BlockingEventData.RemoveEndpoint.pEndpoint, PPDMASYNCCOMPLETIONENDPOINTFILE);
             AssertMsg(VALID_PTR(pEndpointRemove), ("Removing endpoint event without a endpoint to remove\n"));
 
@@ -1222,5 +1222,5 @@
         case PDMACEPFILEAIOMGRBLOCKINGEVENT_CLOSE_ENDPOINT:
         {
-            PPDMASYNCCOMPLETIONENDPOINTFILE pEndpointClose = (PPDMASYNCCOMPLETIONENDPOINTFILE)ASMAtomicReadPtr((void * volatile *)&pAioMgr->BlockingEventData.CloseEndpoint.pEndpoint);
+            PPDMASYNCCOMPLETIONENDPOINTFILE pEndpointClose = ASMAtomicReadPtrT(&pAioMgr->BlockingEventData.CloseEndpoint.pEndpoint, PPDMASYNCCOMPLETIONENDPOINTFILE);
             AssertMsg(VALID_PTR(pEndpointClose), ("Close endpoint event without a endpoint to close\n"));
 
Index: /trunk/src/VBox/VMM/PDMQueue.cpp
===================================================================
--- /trunk/src/VBox/VMM/PDMQueue.cpp	(revision 30110)
+++ /trunk/src/VBox/VMM/PDMQueue.cpp	(revision 30111)
@@ -710,5 +710,5 @@
      * Get the lists.
      */
-    PPDMQUEUEITEMCORE pItems   = (PPDMQUEUEITEMCORE)ASMAtomicXchgPtr((void * volatile *)&pQueue->pPendingR3, NULL);
+    PPDMQUEUEITEMCORE pItems   = ASMAtomicXchgPtrT(&pQueue->pPendingR3, NULL, PPDMQUEUEITEMCORE);
     RTRCPTR           pItemsRC = ASMAtomicXchgRCPtr(&pQueue->pPendingRC, NIL_RTRCPTR);
     RTR0PTR           pItemsR0 = ASMAtomicXchgR0Ptr(&pQueue->pPendingR0, NIL_RTR0PTR);
@@ -835,7 +835,7 @@
         for (;;)
         {
-            if (ASMAtomicCmpXchgPtr((void * volatile *)&pQueue->pPendingR3, pItems, NULL))
+            if (ASMAtomicCmpXchgPtr(&pQueue->pPendingR3, pItems, NULL))
                 break;
-            PPDMQUEUEITEMCORE pPending = (PPDMQUEUEITEMCORE)ASMAtomicXchgPtr((void * volatile *)&pQueue->pPendingR3, NULL);
+            PPDMQUEUEITEMCORE pPending = ASMAtomicXchgPtrT(&pQueue->pPendingR3, NULL, PPDMQUEUEITEMCORE);
             if (pPending)
             {
Index: /trunk/src/VBox/VMM/SSM.cpp
===================================================================
--- /trunk/src/VBox/VMM/SSM.cpp	(revision 30110)
+++ /trunk/src/VBox/VMM/SSM.cpp	(revision 30111)
@@ -1899,7 +1899,7 @@
     for (;;)
     {
-        PSSMSTRMBUF pCurFreeHead = (PSSMSTRMBUF)ASMAtomicUoReadPtr((void * volatile *)&pStrm->pFree);
-        ASMAtomicUoWritePtr((void * volatile *)&pBuf->pNext, pCurFreeHead);
-        if (ASMAtomicCmpXchgPtr((void * volatile *)&pStrm->pFree, pBuf, pCurFreeHead))
+        PSSMSTRMBUF pCurFreeHead = ASMAtomicUoReadPtrT(&pStrm->pFree, PSSMSTRMBUF);
+        ASMAtomicUoWritePtr(&pBuf->pNext, pCurFreeHead);
+        if (ASMAtomicCmpXchgPtr(&pStrm->pFree, pBuf, pCurFreeHead))
         {
             int rc = RTSemEventSignal(pStrm->hEvtFree);
@@ -1923,5 +1923,5 @@
     for (;;)
     {
-        PSSMSTRMBUF pMine = (PSSMSTRMBUF)ASMAtomicUoReadPtr((void * volatile *)&pStrm->pFree);
+        PSSMSTRMBUF pMine = ASMAtomicUoReadPtrT(&pStrm->pFree, PSSMSTRMBUF);
         if (!pMine)
         {
@@ -1944,5 +1944,5 @@
         }
 
-        if (ASMAtomicCmpXchgPtr((void * volatile *)&pStrm->pFree, pMine->pNext, pMine))
+        if (ASMAtomicCmpXchgPtr(&pStrm->pFree, pMine->pNext, pMine))
         {
             pMine->offStream    = UINT64_MAX;
@@ -1968,7 +1968,7 @@
     for (;;)
     {
-        PSSMSTRMBUF pCurHead = (PSSMSTRMBUF)ASMAtomicUoReadPtr((void * volatile *)&pStrm->pHead);
-        ASMAtomicUoWritePtr((void * volatile *)&pBuf->pNext, pCurHead);
-        if (ASMAtomicCmpXchgPtr((void * volatile *)&pStrm->pHead, pBuf, pCurHead))
+        PSSMSTRMBUF pCurHead = ASMAtomicUoReadPtrT(&pStrm->pHead, PSSMSTRMBUF);
+        ASMAtomicUoWritePtr(&pBuf->pNext, pCurHead);
+        if (ASMAtomicCmpXchgPtr(&pStrm->pHead, pBuf, pCurHead))
         {
             int rc = RTSemEventSignal(pStrm->hEvtHead);
@@ -2021,5 +2021,5 @@
         }
 
-        pMine = (PSSMSTRMBUF)ASMAtomicXchgPtr((void * volatile *)&pStrm->pHead, NULL);
+        pMine = ASMAtomicXchgPtrT(&pStrm->pHead, NULL, PSSMSTRMBUF);
         if (pMine)
             pStrm->pPending = ssmR3StrmReverseList(pMine);
@@ -2117,5 +2117,5 @@
      * Grab the pending list and write it out.
      */
-    PSSMSTRMBUF pHead = (PSSMSTRMBUF)ASMAtomicXchgPtr((void * volatile *)&pStrm->pHead, NULL);
+    PSSMSTRMBUF pHead = ASMAtomicXchgPtrT(&pStrm->pHead, NULL, PSSMSTRMBUF);
     if (!pHead)
         return VINF_SUCCESS;
@@ -2823,5 +2823,5 @@
             if (ASMAtomicReadBool(&pStrm->fTerminating))
             {
-                if (!ASMAtomicReadPtr((void * volatile *)&pStrm->pHead))
+                if (!ASMAtomicReadPtrT(&pStrm->pHead, PSSMSTRMBUF))
                 {
                     Log(("ssmR3StrmIoThread: quitting writing because of pending termination.\n"));
@@ -2830,5 +2830,5 @@
                 Log(("ssmR3StrmIoThread: postponing termination because of pending buffers.\n"));
             }
-            else if (!ASMAtomicReadPtr((void * volatile *)&pStrm->pHead))
+            else if (!ASMAtomicReadPtrT(&pStrm->pHead, PSSMSTRMBUF))
             {
                 rc = RTSemEventWait(pStrm->hEvtHead, RT_INDEFINITE_WAIT);
Index: /trunk/src/VBox/VMM/VM.cpp
===================================================================
--- /trunk/src/VBox/VMM/VM.cpp	(revision 30110)
+++ /trunk/src/VBox/VMM/VM.cpp	(revision 30111)
@@ -2424,5 +2424,5 @@
     for (unsigned i = 0; i < 10; i++)
     {
-        PVMREQ pReqHead = (PVMREQ)ASMAtomicXchgPtr((void * volatile *)&pUVM->vm.s.pReqs, NULL);
+        PVMREQ pReqHead = ASMAtomicXchgPtrT(&pUVM->vm.s.pReqs, NULL, PVMREQ);
         AssertMsg(!pReqHead, ("This isn't supposed to happen! VMR3Destroy caller has to serialize this.\n"));
         if (!pReqHead)
@@ -2449,5 +2449,5 @@
         for (unsigned i = 0; i < 10; i++)
         {
-            PVMREQ pReqHead = (PVMREQ)ASMAtomicXchgPtr((void * volatile *)&pUVCpu->vm.s.pReqs, NULL);
+            PVMREQ pReqHead = ASMAtomicXchgPtrT(&pUVCpu->vm.s.pReqs, NULL, PVMREQ);
             AssertMsg(!pReqHead, ("This isn't supposed to happen! VMR3Destroy caller has to serialize this.\n"));
             if (!pReqHead)
Index: /trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp	(revision 30110)
+++ /trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp	(revision 30111)
@@ -85,5 +85,5 @@
         pvNext = ASMAtomicUoReadPtr((void * volatile *)&pQueue->CTX_SUFF(pPending));
         ASMAtomicUoWritePtr((void * volatile *)&pItem->CTX_SUFF(pNext), pvNext);
-    } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pQueue->CTX_SUFF(pPending), pItem, pvNext));
+    } while (!ASMAtomicCmpXchgPtr(&pQueue->CTX_SUFF(pPending), pItem, pvNext));
 #else
     PPDMQUEUEITEMCORE pNext;
@@ -92,5 +92,5 @@
         pNext = pQueue->CTX_SUFF(pPending);
         pItem->CTX_SUFF(pNext) = pNext;
-    } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pQueue->CTX_SUFF(pPending), pItem, pNext));
+    } while (!ASMAtomicCmpXchgPtr(&pQueue->CTX_SUFF(pPending), pItem, pNext));
 #endif
 
Index: /trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp	(revision 30110)
+++ /trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp	(revision 30111)
@@ -1067,10 +1067,10 @@
     pHandle->iNext = pGVMM->iFreeHead;
     pGVMM->iFreeHead = iHandle;
-    ASMAtomicXchgPtr((void * volatile *)&pHandle->pGVM, NULL);
-    ASMAtomicXchgPtr((void * volatile *)&pHandle->pVM, NULL);
-    ASMAtomicXchgPtr((void * volatile *)&pHandle->pvObj, NULL);
-    ASMAtomicXchgPtr((void * volatile *)&pHandle->pSession, NULL);
-    ASMAtomicXchgSize(&pHandle->hEMT0, NIL_RTNATIVETHREAD);
-    ASMAtomicXchgSize(&pHandle->ProcId, NIL_RTPROCESS);
+    ASMAtomicWritePtr(&pHandle->pGVM,               (PGVM)NULL);
+    ASMAtomicWritePtr(&pHandle->pVM,                 (PVM)NULL);
+    ASMAtomicWritePtr(&pHandle->pvObj,            (void *)NULL);
+    ASMAtomicWritePtr(&pHandle->pSession, (PSUPDRVSESSION)NULL);
+    ASMAtomicWriteSize(&pHandle->hEMT0,     NIL_RTNATIVETHREAD);
+    ASMAtomicWriteSize(&pHandle->ProcId,         NIL_RTPROCESS);
 
     gvmmR0UsedUnlock(pGVMM);
Index: /trunk/src/VBox/VMM/VMMR0/PGMR0.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR0/PGMR0.cpp	(revision 30110)
+++ /trunk/src/VBox/VMM/VMMR0/PGMR0.cpp	(revision 30111)
@@ -198,5 +198,6 @@
  * @param   pvFault             The fault address.
  */
-VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault)
+VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr,
+                                              PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault)
 {
     int rc;
Index: /trunk/src/VBox/VMM/VMReq.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMReq.cpp	(revision 30110)
+++ /trunk/src/VBox/VMM/VMReq.cpp	(revision 30111)
@@ -480,5 +480,5 @@
     for (unsigned cIterations = 0;; cIterations++)
     {
-        PVMREQ pHead = (PVMREQ)ASMAtomicXchgPtr((void * volatile *)ppHead, pList);
+        PVMREQ pHead = ASMAtomicXchgPtrT(ppHead, pList, PVMREQ);
         if (!pHead)
             return;
@@ -486,11 +486,11 @@
         while (pTail->pNext)
             pTail = pTail->pNext;
-        ASMAtomicWritePtr((void * volatile *)&pTail->pNext, pList);
+        ASMAtomicWritePtr(&pTail->pNext, pList);
         ASMCompilerBarrier();
-        if (ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (void *)pHead, pList))
+        if (ASMAtomicCmpXchgPtr(ppHead, pHead, pList))
             return;
-        ASMAtomicWritePtr((void * volatile *)&pTail->pNext, NULL);
+        ASMAtomicWritePtr(&pTail->pNext, NULL);
         ASMCompilerBarrier();
-        if (ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (void *)pHead, NULL))
+        if (ASMAtomicCmpXchgPtr(ppHead, pHead, NULL))
             return;
         pList = pHead;
@@ -594,7 +594,7 @@
         PVMREQ pReq = *ppHead;
         if (    pReq
-            &&  !ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (pNext = pReq->pNext), pReq)
+            &&  !ASMAtomicCmpXchgPtr(ppHead, (pNext = pReq->pNext), pReq)
             &&  (pReq = *ppHead)
-            &&  !ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (pNext = pReq->pNext), pReq))
+            &&  !ASMAtomicCmpXchgPtr(ppHead, (pNext = pReq->pNext), pReq))
             pReq = NULL;
         if (pReq)
@@ -602,10 +602,10 @@
             Assert(pReq->pNext == pNext); NOREF(pReq);
 #else
-        PVMREQ pReq = (PVMREQ)ASMAtomicXchgPtr((void * volatile *)ppHead, NULL);
+        PVMREQ pReq = ASMAtomicXchgPtrT(ppHead, NULL, PVMREQ);
         if (pReq)
         {
             PVMREQ pNext = pReq->pNext;
             if (    pNext
-                &&  !ASMAtomicCmpXchgPtr((void * volatile *)ppHead, pNext, NULL))
+                &&  !ASMAtomicCmpXchgPtr(ppHead, pNext, NULL))
             {
                 STAM_COUNTER_INC(&pUVM->vm.s.StatReqAllocRaces);
@@ -750,8 +750,8 @@
         do
         {
-            pNext = (PVMREQ)ASMAtomicUoReadPtr((void * volatile *)ppHead);
-            ASMAtomicWritePtr((void * volatile *)&pReq->pNext, pNext);
+            pNext = ASMAtomicUoReadPtrT(ppHead, PVMREQ);
+            ASMAtomicWritePtr(&pReq->pNext, pNext);
             ASMCompilerBarrier();
-        } while (!ASMAtomicCmpXchgPtr((void * volatile *)ppHead, (void *)pReq, (void *)pNext));
+        } while (!ASMAtomicCmpXchgPtr(ppHead, pReq, pNext));
     }
     else
@@ -857,8 +857,8 @@
         do
         {
-            pNext = (PVMREQ)ASMAtomicUoReadPtr((void * volatile *)&pUVCpu->vm.s.pReqs);
-            ASMAtomicWritePtr((void * volatile *)&pReq->pNext, pNext);
+            pNext = ASMAtomicUoReadPtrT(&pUVCpu->vm.s.pReqs, PVMREQ);
+            ASMAtomicWritePtr(&pReq->pNext, pNext);
             ASMCompilerBarrier();
-        } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pUVCpu->vm.s.pReqs, (void *)pReq, (void *)pNext));
+        } while (!ASMAtomicCmpXchgPtr(&pUVCpu->vm.s.pReqs, pReq, pNext));
 
         /*
@@ -891,8 +891,8 @@
         do
         {
-            pNext = (PVMREQ)ASMAtomicUoReadPtr((void * volatile *)&pUVM->vm.s.pReqs);
-            ASMAtomicWritePtr((void * volatile *)&pReq->pNext, pNext);
+            pNext = ASMAtomicUoReadPtrT(&pUVM->vm.s.pReqs, PVMREQ);
+            ASMAtomicWritePtr(&pReq->pNext, pNext);
             ASMCompilerBarrier();
-        } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pUVM->vm.s.pReqs, (void *)pReq, (void *)pNext));
+        } while (!ASMAtomicCmpXchgPtr(&pUVM->vm.s.pReqs, pReq, pNext));
 
         /*
@@ -996,7 +996,7 @@
  * @param   idDstCpu            VMCPUID_ANY or virtual CPU ID.
  * @param   pReqList            The list of requests.
- * @param   ppvReqs             Pointer to the list head.
- */
-static PVMREQ vmR3ReqProcessUTooManyHelper(PUVM pUVM, VMCPUID idDstCpu, PVMREQ pReqList, void * volatile *ppvReqs)
+ * @param   ppReqs              Pointer to the list head.
+ */
+static PVMREQ vmR3ReqProcessUTooManyHelper(PUVM pUVM, VMCPUID idDstCpu, PVMREQ pReqList, PVMREQ volatile *ppReqs)
 {
     STAM_COUNTER_INC(&pUVM->vm.s.StatReqMoreThan1);
@@ -1009,9 +1009,9 @@
         pReqRet = pReqRet->pNext;
     } while (pReqRet->pNext);
-    ASMAtomicWritePtr((void * volatile *)&pPrev->pNext, NULL);
+    ASMAtomicWritePtr(&pPrev->pNext, NULL);
 
     /* Push the others back onto the list (end of it). */
     Log2(("VMR3ReqProcess: Pushing back %p %p...\n", pReqList, pReqList->pNext));
-    if (RT_UNLIKELY(!ASMAtomicCmpXchgPtr(ppvReqs, pReqList, NULL)))
+    if (RT_UNLIKELY(!ASMAtomicCmpXchgPtr(ppReqs, pReqList, NULL)))
     {
         STAM_COUNTER_INC(&pUVM->vm.s.StatReqPushBackRaces);
@@ -1019,5 +1019,5 @@
         {
             ASMNopPause();
-            PVMREQ pReqList2 = (PVMREQ)ASMAtomicXchgPtr(ppvReqs, NULL);
+            PVMREQ pReqList2 = ASMAtomicXchgPtrT(ppReqs, NULL, PVMREQ);
             if (pReqList2)
             {
@@ -1025,8 +1025,8 @@
                 while (pLast->pNext)
                     pLast = pLast->pNext;
-                ASMAtomicWritePtr((void * volatile *)&pLast->pNext, pReqList);
+                ASMAtomicWritePtr(&pLast->pNext, pReqList);
                 pReqList = pReqList2;
             }
-        } while (!ASMAtomicCmpXchgPtr(ppvReqs, pReqList, NULL));
+        } while (!ASMAtomicCmpXchgPtr(ppReqs, pReqList, NULL));
     }
 
@@ -1078,8 +1078,8 @@
          * rest back so that we're reentrant.
          */
-        void * volatile *ppvReqs;
+        PVMREQ volatile *ppReqs;
         if (idDstCpu == VMCPUID_ANY)
         {
-            ppvReqs = (void * volatile *)&pUVM->vm.s.pReqs;
+            ppReqs = &pUVM->vm.s.pReqs;
             if (RT_LIKELY(pUVM->pVM))
                 VM_FF_CLEAR(pUVM->pVM, VM_FF_REQUEST);
@@ -1089,14 +1089,14 @@
             Assert(idDstCpu < pUVM->cCpus);
             Assert(pUVM->aCpus[idDstCpu].vm.s.NativeThreadEMT == RTThreadNativeSelf());
-            ppvReqs = (void * volatile *)&pUVM->aCpus[idDstCpu].vm.s.pReqs;
+            ppReqs = &pUVM->aCpus[idDstCpu].vm.s.pReqs;
             if (RT_LIKELY(pUVM->pVM))
                 VMCPU_FF_CLEAR(&pUVM->pVM->aCpus[idDstCpu], VMCPU_FF_REQUEST);
         }
 
-        PVMREQ pReq = (PVMREQ)ASMAtomicXchgPtr(ppvReqs, NULL);
+        PVMREQ pReq = ASMAtomicXchgPtrT(ppReqs, NULL, PVMREQ);
         if (!pReq)
             break;
         if (RT_UNLIKELY(pReq->pNext))
-            pReq = vmR3ReqProcessUTooManyHelper(pUVM, idDstCpu, pReq, ppvReqs);
+            pReq = vmR3ReqProcessUTooManyHelper(pUVM, idDstCpu, pReq, ppReqs);
 
         /*
