* Typo: change __volatile
to __volatile__
. Some compilers
(e.g., gcc) are indifferent about this, while others are more particular (e.g., Sun Studio 12). * Typo: `asms.s` to `asm.s` * Eliminate "foo is multiply-defined" linker errors on Solaris by making the declarations in `opal/sys/atomic.h` agree with their corresponding definitions (use `static inline` in *both* places). This commit was SVN r16807.
Этот коммит содержится в:
родитель
beaf38ef42
Коммит
b7c885247a
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -82,7 +83,7 @@ static inline int opal_atomic_cmpset_32( volatile int32_t *addr,
|
|||||||
int32_t oldval, int32_t newval)
|
int32_t oldval, int32_t newval)
|
||||||
{
|
{
|
||||||
unsigned char ret;
|
unsigned char ret;
|
||||||
__asm__ __volatile (
|
__asm__ __volatile__ (
|
||||||
SMPLOCK "cmpxchgl %1,%2 \n\t"
|
SMPLOCK "cmpxchgl %1,%2 \n\t"
|
||||||
"sete %0 \n\t"
|
"sete %0 \n\t"
|
||||||
: "=qm" (ret)
|
: "=qm" (ret)
|
||||||
@ -103,7 +104,7 @@ static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
|
|||||||
int64_t oldval, int64_t newval)
|
int64_t oldval, int64_t newval)
|
||||||
{
|
{
|
||||||
unsigned char ret;
|
unsigned char ret;
|
||||||
__asm__ __volatile (
|
__asm__ __volatile__ (
|
||||||
SMPLOCK "cmpxchgq %1,%2 \n\t"
|
SMPLOCK "cmpxchgq %1,%2 \n\t"
|
||||||
"sete %0 \n\t"
|
"sete %0 \n\t"
|
||||||
: "=qm" (ret)
|
: "=qm" (ret)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -179,7 +180,7 @@ typedef struct opal_atomic_lock_t opal_atomic_lock_t;
|
|||||||
* generally grinding the memory controller's performance. Use only
|
* generally grinding the memory controller's performance. Use only
|
||||||
* if you need *both* read and write barriers.
|
* if you need *both* read and write barriers.
|
||||||
*/
|
*/
|
||||||
void opal_atomic_mb(void);
|
static inline void opal_atomic_mb(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read memory barrier
|
* Read memory barrier
|
||||||
@ -190,7 +191,7 @@ void opal_atomic_mb(void);
|
|||||||
* next read. Nothing is said about the ordering of writes when using
|
* next read. Nothing is said about the ordering of writes when using
|
||||||
* \c opal_atomic_rmb().
|
* \c opal_atomic_rmb().
|
||||||
*/
|
*/
|
||||||
void opal_atomic_rmb(void);
|
static inline void opal_atomic_rmb(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write memory barrier.
|
* Write memory barrier.
|
||||||
@ -201,7 +202,7 @@ void opal_atomic_rmb(void);
|
|||||||
* next write. Nothing is said about the ordering of reads when using
|
* next write. Nothing is said about the ordering of reads when using
|
||||||
* \c opal_atomic_wmb().
|
* \c opal_atomic_wmb().
|
||||||
*/
|
*/
|
||||||
void opal_atomic_wmb(void);
|
static inline void opal_atomic_wmb(void);
|
||||||
|
|
||||||
#endif /* defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MEM_BARRIER */
|
#endif /* defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MEM_BARRIER */
|
||||||
|
|
||||||
@ -293,11 +294,11 @@ void opal_atomic_unlock(opal_atomic_lock_t *lock);
|
|||||||
#define OPAL_HAVE_ATOMIC_CMPSET_32 0
|
#define OPAL_HAVE_ATOMIC_CMPSET_32 0
|
||||||
#endif
|
#endif
|
||||||
#if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_CMPSET_32
|
#if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_CMPSET_32
|
||||||
int opal_atomic_cmpset_32(volatile int32_t *addr, int32_t oldval,
|
static inline int opal_atomic_cmpset_32(volatile int32_t *addr, int32_t oldval,
|
||||||
int32_t newval);
|
int32_t newval);
|
||||||
int opal_atomic_cmpset_acq_32(volatile int32_t *addr, int32_t oldval,
|
static inline int opal_atomic_cmpset_acq_32(volatile int32_t *addr, int32_t oldval,
|
||||||
int32_t newval);
|
int32_t newval);
|
||||||
int opal_atomic_cmpset_rel_32(volatile int32_t *addr, int32_t oldval,
|
static inline int opal_atomic_cmpset_rel_32(volatile int32_t *addr, int32_t oldval,
|
||||||
int32_t newval);
|
int32_t newval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -306,11 +307,11 @@ int opal_atomic_cmpset_rel_32(volatile int32_t *addr, int32_t oldval,
|
|||||||
#define OPAL_HAVE_ATOMIC_CMPSET_64 0
|
#define OPAL_HAVE_ATOMIC_CMPSET_64 0
|
||||||
#endif
|
#endif
|
||||||
#if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_CMPSET_64
|
#if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_CMPSET_64
|
||||||
int opal_atomic_cmpset_64(volatile int64_t *addr, int64_t oldval,
|
static inline int opal_atomic_cmpset_64(volatile int64_t *addr, int64_t oldval,
|
||||||
int64_t newval);
|
int64_t newval);
|
||||||
int opal_atomic_cmpset_acq_64(volatile int64_t *addr, int64_t oldval,
|
static inline int opal_atomic_cmpset_acq_64(volatile int64_t *addr, int64_t oldval,
|
||||||
int64_t newval);
|
int64_t newval);
|
||||||
int opal_atomic_cmpset_rel_64(volatile int64_t *addr, int64_t oldval,
|
static inline int opal_atomic_cmpset_rel_64(volatile int64_t *addr, int64_t oldval,
|
||||||
int64_t newval);
|
int64_t newval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -87,7 +88,7 @@ static inline int opal_atomic_cmpset_32(volatile int32_t *addr,
|
|||||||
int32_t newval)
|
int32_t newval)
|
||||||
{
|
{
|
||||||
unsigned char ret;
|
unsigned char ret;
|
||||||
__asm__ __volatile (
|
__asm__ __volatile__ (
|
||||||
SMPLOCK "cmpxchgl %1,%2 \n\t"
|
SMPLOCK "cmpxchgl %1,%2 \n\t"
|
||||||
"sete %0 \n\t"
|
"sete %0 \n\t"
|
||||||
: "=qm" (ret)
|
: "=qm" (ret)
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
# University of Stuttgart. All rights reserved.
|
# University of Stuttgart. All rights reserved.
|
||||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
# Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
||||||
# $COPYRIGHT$
|
# $COPYRIGHT$
|
||||||
#
|
#
|
||||||
# Additional copyrights may follow
|
# Additional copyrights may follow
|
||||||
@ -34,4 +35,4 @@ cat > $CFILE<<EOF
|
|||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
gcc -O1 -I. -S $CFILE -o asms.s
|
gcc -O1 -I. -S $CFILE -o asm.s
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -91,7 +92,7 @@ static inline int opal_atomic_cmpset_32( volatile int32_t *addr,
|
|||||||
|
|
||||||
int32_t ret = newval;
|
int32_t ret = newval;
|
||||||
|
|
||||||
__asm__ __volatile("casa [%1] " ASI_P ", %2, %0"
|
__asm__ __volatile__("casa [%1] " ASI_P ", %2, %0"
|
||||||
: "+r" (ret)
|
: "+r" (ret)
|
||||||
: "r" (addr), "r" (oldval));
|
: "r" (addr), "r" (oldval));
|
||||||
return (ret == oldval);
|
return (ret == oldval);
|
||||||
@ -132,7 +133,7 @@ static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
|
|||||||
*/
|
*/
|
||||||
int64_t ret = newval;
|
int64_t ret = newval;
|
||||||
|
|
||||||
__asm__ __volatile("casxa [%1] " ASI_P ", %2, %0"
|
__asm__ __volatile__("casxa [%1] " ASI_P ", %2, %0"
|
||||||
: "+r" (ret)
|
: "+r" (ret)
|
||||||
: "r" (addr), "r" (oldval));
|
: "r" (addr), "r" (oldval));
|
||||||
return (ret == oldval);
|
return (ret == oldval);
|
||||||
@ -153,7 +154,7 @@ static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
|
|||||||
*/
|
*/
|
||||||
long long ret = newval;
|
long long ret = newval;
|
||||||
|
|
||||||
__asm__ __volatile(
|
__asm__ __volatile__(
|
||||||
"ldx %0, %%g1 \n\t" /* g1 = ret */
|
"ldx %0, %%g1 \n\t" /* g1 = ret */
|
||||||
"ldx %2, %%g2 \n\t" /* g2 = oldval */
|
"ldx %2, %%g2 \n\t" /* g2 = oldval */
|
||||||
"casxa [%1] " ASI_P ", %%g2, %%g1 \n\t"
|
"casxa [%1] " ASI_P ", %%g2, %%g1 \n\t"
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user