-2009-08-06 Ivan Maidanski <ivmai@mail.ru>
+2009-09-10 Ivan Maidanski <ivmai@mail.ru>
+ (diff109_cvs)
+ * src/atomic_ops/sysdeps/msftc/x86.h: Fix comments (prefix
+ ASSUME_WINDOWS98 with "AO_").
+ * src/atomic_ops/sysdeps/msftc/x86.h: Prefix ASSUME_VISTA macro with
+ "AO_".
+ * src/atomic_ops/sysdeps/msftc/x86.h (AO_nop_full): Replace
+ K&R-style function definition with ANSI C one.
+ * src/atomic_ops/sysdeps/msftc/x86.h (AO_test_and_set_full):
+ Replace AO_TS_SET with its value 0xff (some compilers does not like
+ C enum consts inside inline assembler).
+ * src/atomic_ops/sysdeps/msftc/x86.h (AO_test_and_set_full): Add
+ comment about "missing return value" warning.
+ * src/atomic_ops/sysdeps/msftc/x86.h
+ (AO_OLD_STYLE_INTERLOCKED_COMPARE_EXCHANGE): New macro.
+ * src/atomic_ops/sysdeps/msftc/x86.h (AO_compare_and_swap_full): Use
+ _InterlockedCompareExchange() with args and result of PVOID type
+ if AO_OLD_STYLE_INTERLOCKED_COMPARE_EXCHANGE is defined (mostly for
+ DigitalMars compiler support).
+ * src/atomic_ops/sysdeps/msftc/x86.h
+ (AO_compare_double_and_swap_double_full): Swap all "val1" and "val2"
+ variables ("val1" is the lowest part of AO_double_t).
+ * src/atomic_ops/sysdeps/msftc/x86.h
+ (AO_compare_double_and_swap_double_full): Rename to
+ AO_double_compare_and_swap_full (as it has 3 args).
+ * src/atomic_ops/sysdeps/msftc/x86.h: Replace C++ style comment
+ with ANSI C one.
+
+2009-09-10 Ivan Maidanski <ivmai@mail.ru>
* src/atomic_ops/sysdeps/gcc/x86_64.h: Remove comments about i486
and 32-bit WinChips.
* src/atomic_ops/sysdeps/msftc/x86_64.h: Ditto.
*/
/* The following really assume we have a 486 or better. */
-/* If ASSUME_WINDOWS98 is defined, we assume Windows 98 or newer. */
-/* If ASSUME_VISTA is defined, we assume Windows Server 2003, Vista */
+/* If AO_ASSUME_WINDOWS98 is defined, we assume Windows 98 or newer. */
+/* If AO_ASSUME_VISTA is defined, we assume Windows Server 2003, Vista */
/* or later. */
#include "../all_aligned_atomic_load_store.h"
#if defined(AO_USE_PENTIUM4_INSTRS)
AO_INLINE void
-AO_nop_full()
+AO_nop_full(void)
{
__asm { mfence }
}
{
__asm
{
- mov eax,AO_TS_SET ;
+ mov eax,0xff ; /* AO_TS_SET */
mov ebx,addr ;
xchg byte ptr [ebx],al ;
}
+ /* Ignore possible "missing return value" warning here. */
}
#define AO_HAVE_test_and_set_full
AO_compare_and_swap_full(volatile AO_t *addr,
AO_t old, AO_t new_val)
{
+# ifdef AO_OLD_STYLE_INTERLOCKED_COMPARE_EXCHANGE
+ return _InterlockedCompareExchange((PVOID volatile *)addr,
+ (PVOID)new_val, (PVOID)old)
+ == (PVOID)old;
+# else
return _InterlockedCompareExchange((LONG volatile *)addr,
(LONG)new_val, (LONG)old)
== (LONG)old;
+# endif
}
#define AO_HAVE_compare_and_swap_full
-#endif /* ASSUME_WINDOWS98 */
+#endif /* AO_ASSUME_WINDOWS98 */
#ifdef _WIN64
# error wrong architecture
#endif
-#ifdef ASSUME_VISTA
+#ifdef AO_ASSUME_VISTA
/* NEC LE-IT: whenever we run on a pentium class machine we have that
* certain function */
AO_t old_val1, AO_t old_val2,
AO_t new_val1, AO_t new_val2)
{
- __int64 oldv = (__int64)old_val2 | ((__int64)old_val1 << 32);
- __int64 newv = (__int64)new_val2 | ((__int64)new_val1 << 32);
+ __int64 oldv = (__int64)old_val1 | ((__int64)old_val2 << 32);
+ __int64 newv = (__int64)new_val1 | ((__int64)new_val2 << 32);
return _InterlockedCompareExchange64((__int64 volatile *)addr,
newv, oldv) == oldv;
}
#ifdef __cplusplus
AO_INLINE int
-AO_compare_double_and_swap_double_full(volatile AO_double_t *addr,
- AO_double_t old_val,
- AO_double_t new_val)
+AO_double_compare_and_swap_full(volatile AO_double_t *addr,
+ AO_double_t old_val, AO_double_t new_val)
{
return _InterlockedCompareExchange64((__int64 volatile *)addr,
new_val.AO_whole, old_val.AO_whole) == old_val.AO_whole;
}
#define AO_HAVE_double_compare_and_swap_full
-#endif // __cplusplus
-#endif /* ASSUME_VISTA */
+#endif /* __cplusplus */
+#endif /* AO_ASSUME_VISTA */
#include "../ao_t_is_int.h"