Index: trunk/include/iprt/asm.h
===================================================================
--- trunk/include/iprt/asm.h	(revision 20624)
+++ trunk/include/iprt/asm.h	(revision 20785)
@@ -5447,4 +5447,5 @@
 /**
  * Sets a bit in a bitmap.
+ * @note    Address should be 32-bit aligned for performance reasons.
  *
  * @param   pvBitmap    Pointer to the bitmap.
@@ -5485,4 +5486,5 @@
 /**
  * Atomically sets a bit in a bitmap, ordered.
+ * @note    Address must be 32-bit aligned, otherwise the memory access isn't atomic!
  *
  * @param   pvBitmap    Pointer to the bitmap.
@@ -5494,4 +5496,5 @@
 DECLINLINE(void) ASMAtomicBitSet(volatile void *pvBitmap, int32_t iBit)
 {
+    AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap));
 # if RT_INLINE_ASM_USES_INTRIN
     _interlockedbittestandset((long *)pvBitmap, iBit);
@@ -5522,4 +5525,5 @@
 /**
  * Clears a bit in a bitmap.
+ * @note    Address should be 32-bit aligned for performance reasons.
  *
  * @param   pvBitmap    Pointer to the bitmap.
@@ -5560,4 +5564,5 @@
 /**
  * Atomically clears a bit in a bitmap, ordered.
+ * @note    Address must be 32-bit aligned, otherwise the memory access isn't atomic!
  *
  * @param   pvBitmap    Pointer to the bitmap.
@@ -5570,4 +5575,5 @@
 DECLINLINE(void) ASMAtomicBitClear(volatile void *pvBitmap, int32_t iBit)
 {
+    AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap));
 # if RT_INLINE_ASM_GNU_STYLE
     __asm__ __volatile__("lock; btrl %1, %0"
@@ -5596,4 +5602,5 @@
 /**
  * Toggles a bit in a bitmap.
+ * @note    Address should be 32-bit aligned for performance reasons.
  *
  * @param   pvBitmap    Pointer to the bitmap.
@@ -5633,4 +5640,5 @@
 /**
  * Atomically toggles a bit in a bitmap, ordered.
+ * @note    Address must be 32-bit aligned, otherwise the memory access isn't atomic!
  *
  * @param   pvBitmap    Pointer to the bitmap.
@@ -5642,4 +5650,5 @@
 DECLINLINE(void) ASMAtomicBitToggle(volatile void *pvBitmap, int32_t iBit)
 {
+    AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap));
 # if RT_INLINE_ASM_GNU_STYLE
     __asm__ __volatile__("lock; btcl %1, %0"
@@ -5668,4 +5677,5 @@
 /**
  * Tests and sets a bit in a bitmap.
+ * @note    Address should be 32-bit aligned for performance reasons.
  *
  * @returns true if the bit was set.
@@ -5715,4 +5725,5 @@
 /**
  * Atomically tests and sets a bit in a bitmap, ordered.
+ * @note    Address must be 32-bit aligned, otherwise the memory access isn't atomic!
  *
  * @returns true if the bit was set.
@@ -5727,4 +5738,5 @@
 {
     union { bool f; uint32_t u32; uint8_t u8; } rc;
+    AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap));
 # if RT_INLINE_ASM_USES_INTRIN
     rc.u8 = _interlockedbittestandset((long *)pvBitmap, iBit);
@@ -5761,4 +5773,5 @@
 /**
  * Tests and clears a bit in a bitmap.
+ * @note    Address should be 32-bit aligned for performance reasons.
  *
  * @returns true if the bit was set.
@@ -5808,4 +5821,5 @@
 /**
  * Atomically tests and clears a bit in a bitmap, ordered.
+ * @note    Address must be 32-bit aligned, otherwise the memory access isn't atomic!
  *
  * @returns true if the bit was set.
@@ -5821,4 +5835,5 @@
 {
     union { bool f; uint32_t u32; uint8_t u8; } rc;
+    AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap));
 # if RT_INLINE_ASM_USES_INTRIN
     rc.u8 = _interlockedbittestandreset((long *)pvBitmap, iBit);
@@ -5856,4 +5871,5 @@
 /**
  * Tests and toggles a bit in a bitmap.
+ * @note    Address should be 32-bit aligned for performance reasons.
  *
  * @returns true if the bit was set.
@@ -5903,4 +5919,5 @@
 /**
  * Atomically tests and toggles a bit in a bitmap, ordered.
+ * @note    Address must be 32-bit aligned, otherwise the memory access isn't atomic!
  *
  * @returns true if the bit was set.
@@ -5915,4 +5932,5 @@
 {
     union { bool f; uint32_t u32; uint8_t u8; } rc;
+    AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap));
 # if RT_INLINE_ASM_GNU_STYLE
     __asm__ __volatile__("lock; btcl %2, %1\n\t"
@@ -5947,4 +5965,5 @@
 /**
  * Tests if a bit in a bitmap is set.
+ * @note    Address should be 32-bit aligned for performance reasons.
  *
  * @returns true if the bit is set.
