diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2012-06-29 18:28:02 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2012-06-29 18:28:02 +0000 |
commit | b379fe51b4b09aed0cc4b3f93cc3820029d5f11b (patch) | |
tree | 0322c0b638add761378fa4ced1c7cc4fabe21668 /compiler-rt/lib | |
parent | 3f568c100ec0bfc3b699645249c04f20c8e69786 (diff) | |
download | bcm5719-llvm-b379fe51b4b09aed0cc4b3f93cc3820029d5f11b.tar.gz bcm5719-llvm-b379fe51b4b09aed0cc4b3f93cc3820029d5f11b.zip |
tsan/asan: second attemp on msvc atomics
llvm-svn: 159447
Diffstat (limited to 'compiler-rt/lib')
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h index 6bad94e3592..cf49631a75e 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h @@ -15,7 +15,14 @@ #ifndef SANITIZER_ATOMIC_MSVC_H #define SANITIZER_ATOMIC_MSVC_H -#include <intrin.h> +void _ReadWriteBarrier(); +#pragma intrinsic(_ReadWriteBarrier) +void _mm_mfence(); +#pragma intrinsic(_mm_mfence) +void _mm_pause(); +#pragma intrinsic(_mm_pause) +long _InterlockedExchangeAdd(long volatile * Addend, long Value); // NOLINT +#pragma intrinsic(_InterlockedExchangeAdd) namespace __sanitizer { @@ -79,9 +86,9 @@ INLINE u8 atomic_exchange(volatile atomic_uint8_t *a, DCHECK(!((uptr)a % sizeof(*a))); __asm { mov eax, a - mov cx, v - xchg [eax], cx // NOLINT - mov v, cx + mov cl, v + xchg [eax], cl // NOLINT + mov v, cl } return v; } @@ -92,9 +99,9 @@ INLINE u16 atomic_exchange(volatile atomic_uint16_t *a, DCHECK(!((uptr)a % sizeof(*a))); __asm { mov eax, a - mov cl, v - xchg [eax], cl // NOLINT - mov v, cl + mov cx, v + xchg [eax], cx // NOLINT + mov v, cx } return v; } |