From 97b63ffb6ee2900ddcc76323393441e64abed5d0 Mon Sep 17 00:00:00 2001 From: ivmai Date: Sun, 13 Mar 2011 10:50:36 +0000 Subject: 2011-03-13 Ivan Maidanski * src/atomic_ops/sysdeps/emul_cas.h: Fix a typo in a comment; expand all tabs to spaces. * src/atomic_ops/sysdeps/gcc/x86.h (AO_test_and_set_full): Recognize AO_XCHGB_RET_WORD new macro (to workaround a bug). * src/atomic_ops/sysdeps/gcc/x86_64.h (AO_test_and_set_full): Ditto. --- ChangeLog | 9 +++++++++ src/atomic_ops/sysdeps/emul_cas.h | 24 ++++++++++++------------ src/atomic_ops/sysdeps/gcc/x86.h | 7 ++++++- src/atomic_ops/sysdeps/gcc/x86_64.h | 7 ++++++- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b16707..70a183e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-03-13 Ivan Maidanski + + * src/atomic_ops/sysdeps/emul_cas.h: Fix a typo in a comment; + expand all tabs to spaces. + * src/atomic_ops/sysdeps/gcc/x86.h (AO_test_and_set_full): + Recognize AO_XCHGB_RET_WORD new macro (to workaround a bug). + * src/atomic_ops/sysdeps/gcc/x86_64.h (AO_test_and_set_full): + Ditto. + 2011-02-19 Ivan Maidanski * src/atomic_ops.c: Include sys/time.h (to get timespec) for NaCl. diff --git a/src/atomic_ops/sysdeps/emul_cas.h b/src/atomic_ops/sysdeps/emul_cas.h index 4187f9f..13fb227 100644 --- a/src/atomic_ops/sysdeps/emul_cas.h +++ b/src/atomic_ops/sysdeps/emul_cas.h @@ -1,23 +1,23 @@ /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * SOFTWARE. */ /* @@ -27,7 +27,7 @@ * Including this file will generate an error if AO_compare_and_swap_full() * cannot be made available. * This will be included from platform-specific atomic_ops files - * id appropriate, and if AO_FORCE_CAS is defined. It should not be + * if appropriate, and if AO_FORCE_CAS is defined. It should not be * included directly, especially since it affects the implementation * of other atomic update primitives. * The implementation assumes that only AO_store_XXX and AO_test_and_set_XXX @@ -44,23 +44,23 @@ #endif int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old, - AO_t new_val); + AO_t new_val); int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, - AO_t old_val1, AO_t old_val2, - AO_t new_val1, AO_t new_val2); + AO_t old_val1, AO_t old_val2, + AO_t new_val1, AO_t new_val2); void AO_store_full_emulation(volatile AO_t *addr, AO_t val); #define AO_compare_and_swap_full(addr, old, newval) \ - AO_compare_and_swap_emulation(addr, old, newval) + AO_compare_and_swap_emulation(addr, old, newval) #define AO_HAVE_compare_and_swap_full #ifndef AO_HAVE_compare_double_and_swap_double # define AO_compare_double_and_swap_double_full(addr, old1, old2, \ - newval1, newval2) \ - AO_compare_double_and_swap_double_emulation(addr, old1, old2, \ - newval1, newval2) + newval1, newval2) \ + AO_compare_double_and_swap_double_emulation(addr, old1, old2, \ + newval1, newval2) # define AO_HAVE_compare_double_and_swap_double_full #endif diff --git a/src/atomic_ops/sysdeps/gcc/x86.h b/src/atomic_ops/sysdeps/gcc/x86.h index 8f73ac6..d6b95af 100644 --- a/src/atomic_ops/sysdeps/gcc/x86.h +++ b/src/atomic_ops/sysdeps/gcc/x86.h @@ -109,7 +109,12 @@ AO_or_full (volatile AO_t *p, AO_t incr) AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { - unsigned char oldval; +# ifdef AO_XCHGB_RET_WORD + /* Workaround for a bug in LLVM v2.7 GAS. */ + unsigned oldval; +# else + unsigned char oldval; +# endif /* Note: the "xchg" instruction does not need a "lock" prefix */ __asm__ __volatile__("xchgb %0, %1" : "=q"(oldval), "=m"(*addr) diff --git a/src/atomic_ops/sysdeps/gcc/x86_64.h b/src/atomic_ops/sysdeps/gcc/x86_64.h index 2274a2d..3d3eb74 100644 --- a/src/atomic_ops/sysdeps/gcc/x86_64.h +++ b/src/atomic_ops/sysdeps/gcc/x86_64.h @@ -107,7 +107,12 @@ AO_or_full (volatile AO_t *p, AO_t incr) AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { - unsigned char oldval; +# ifdef AO_XCHGB_RET_WORD + /* Workaround for a bug in LLVM v2.7 GAS. */ + unsigned oldval; +# else + unsigned char oldval; +# endif /* Note: the "xchg" instruction does not need a "lock" prefix */ __asm__ __volatile__("xchgb %0, %1" : "=q"(oldval), "=m"(*addr) -- cgit v1.2.1