diff options
author | Torvald Riegel <triegel@redhat.com> | 2014-10-29 10:34:36 +0100 |
---|---|---|
committer | Torvald Riegel <triegel@redhat.com> | 2015-06-23 19:20:52 +0200 |
commit | c47ca9647f9b72692e62f94fe468cd5568f49129 (patch) | |
tree | 724bfcf502ac32b1117915e731dfad53083cf272 /sysdeps/i386 | |
parent | b2faf4eadf5e9e9a71abcfe4da71fad91707ccac (diff) | |
download | glibc-c47ca9647f9b72692e62f94fe468cd5568f49129.zip glibc-c47ca9647f9b72692e62f94fe468cd5568f49129.tar.gz glibc-c47ca9647f9b72692e62f94fe468cd5568f49129.tar.bz2 |
Fix atomic_full_barrier on x86 and x86_64.
This fixes BZ #17403 by defining atomic_full_barrier,
atomic_read_barrier, and atomic_write_barrier on x86 and x86_64. A full
barrier is implemented through an atomic idempotent modification to the
stack and not through using mfence because the latter can supposedly be
somewhat slower due to having to provide stronger guarantees wrt.
self-modifying code, for example.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r-- | sysdeps/i386/i486/bits/atomic.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h index 01c2b94..59165be 100644 --- a/sysdeps/i386/i486/bits/atomic.h +++ b/sysdeps/i386/i486/bits/atomic.h @@ -535,3 +535,10 @@ typedef uintmax_t uatomic_max_t; #define atomic_or(mem, mask) __arch_or_body (LOCK_PREFIX, mem, mask) #define catomic_or(mem, mask) __arch_or_body (__arch_cprefix, mem, mask) + +/* We don't use mfence because it is supposedly slower due to having to + provide stronger guarantees (e.g., regarding self-modifying code). */ +#define atomic_full_barrier() \ + __asm __volatile (LOCK_PREFIX "orl $0, (%%esp)" ::: "memory") +#define atomic_read_barrier() __asm ("" ::: "memory") +#define atomic_write_barrier() __asm ("" ::: "memory") |