1
1

Update atomic operations for x86 64 bits architectures.

This commit was SVN r1103.
Этот коммит содержится в:
George Bosilca 2004-04-30 20:04:11 +00:00
родитель e4bbefd57b
Коммит 8502661385
3 изменённых файлов: 51 добавлений и 34 удалений

Просмотреть файл

@ -11,39 +11,43 @@
* Atomic functions
*/
#ifdef __alpha
# ifdef __GNUC__
#if defined(__alpha)
# if defined(__GNUC__)
# include "os/linux/alpha/atomic.h"
# else
# include "os/tru64/atomic.h"
# endif
#endif
# endif /* __GNUC__ */
#endif /* __alpha */
#if defined (__linux__) && defined (__i386)
#if defined(__linux__) && defined(__i386)
#include "os/linux/i686/atomic.h"
#endif
#endif /* defined(__linux__) && defined(__i386) */
#ifdef __CYGWIN__
#if defined(__CYGWIN__)
#include "os/cygwin/atomic.h"
#endif
#endif /* defined(__CYGWIN__) */
#ifdef __ia64
#if defined(__ia64)
#include "os/linux/ia64/atomic.h"
#endif
#endif /* defined(__ia64) */
#ifdef __mips
#if defined(__x86_64)
#include "os/linux/x86_64/atomic.h"
#endif /* defined(__x86_64) */
#if defined(__mips)
#include "os/irix/atomic.h"
#endif
#endif /* defined(__mpis) */
#ifdef __APPLE__
#if defined(__APPLE__)
/* check if PowerPC 970 (G5) */
#ifdef __ppc_64__
#if defined(__ppc_64__)
#include "os/darwin/ppc_64/atomic.h"
#else
#include "os/darwin/ppc_32/atomic.h"
#endif
#endif /* defined(__ppc_64__) */
#endif /* __APPLE__ */
#endif /* defined(__APPLE__) */
#ifndef mb
#define mb()

Просмотреть файл

@ -1,6 +1,8 @@
/*
* $HEADER$
*/
#ifndef ULM_OS_H_HAS_BEEN_INCLUDED
#define ULM_OS_H_HAS_BEEN_INCLUDED
/*
* ulm_os.h - This file contains LINUX OS dependent definitions.
@ -8,11 +10,11 @@
#include <unistd.h>
#ifdef __linux__
#if defined(__linux__)
#define RESTRICT_MACRO __restrict__
#ifdef __i386
#if defined(__i386)
#define PAGESIZE 4096
#define SMPPAGESIZE 4096
#define intwordaligned(a) ( ( ((long)(a)&3L) == 0L) ? 1 : 0 )
@ -22,25 +24,36 @@
#define CACHE_ALIGNMENT 128
#else
#ifdef __ia64
#if defined(__ia64)
#define PAGESIZE 16384
#define SMPPAGESIZE 16384
#define CACHE_ALIGNMENT 128
#define intwordaligned(a) ( ( ((long)(a)&3L) == 0L) ? 1 : 0 )
#else
#ifdef __alpha
#if defined(__alpha)
#define PAGESIZE 8192
#define SMPPAGESIZE 8192
#define CACHE_ALIGNMENT 128
#define intwordaligned(a) ( ( ((long long)(a)&3L) == 0L) ? 1 : 0 )
#else
#if defined(__x86_64)
#define PAGESIZE 4096
#define SMPPAGESIZE 4096
#define intwordaligned(a) ( ( ((long)(a)&3L) == 0L) ? 1 : 0 )
#define SMPFirstFragPayload 3496
#define SMPSecondFragPayload 8192
#define CACHE_ALIGNMENT 128
#else /* !__x86_64 */
#error
#endif
#endif
#endif
#endif /* __x86_64 */
#endif /* __alpha */
#endif /* __ia64 */
#endif /* __i386 */
#else
#else /* ! __linux__ */
#error
#endif
#endif /* __linux__ */
#endif /* ULM_OS_H_HAS_BEEN_INCLUDED */

Просмотреть файл

@ -51,7 +51,7 @@ extern "C"
/*
* Spin until I can get the lock
*/
inline void spinlock(lam_lock_data_t *lockData)
static inline void spinlock(lam_lock_data_t *lockData)
{
__asm__ __volatile__(
"cmp $1, %0\n"
@ -70,7 +70,7 @@ inline void spinlock(lam_lock_data_t *lockData)
/*
* This routine tries once to obtain the lock
*/
inline int spintrylock(lam_lock_data_t *lockData)
static inline int spintrylock(lam_lock_data_t *lockData)
{
int gotLock;
@ -100,7 +100,7 @@ inline int spintrylock(lam_lock_data_t *lockData)
* atomically add a constant to the input integer returning the
* previous value
*/
inline int fetchNadd(volatile int *addr, int inc)
static inline int fetchNadd(volatile int *addr, int inc)
{
int inputValue;
__asm__ __volatile__(
@ -116,7 +116,7 @@ inline int fetchNadd(volatile int *addr, int inc)
}
inline int fetchNset(volatile int *addr, int setValue)
static inline int fetchNset(volatile int *addr, int setValue)
{
int inputValue;
@ -135,13 +135,13 @@ inline int fetchNset(volatile int *addr, int setValue)
/*
* Clear the lock
*/
inline void spinunlock(lam_lock_data_t *lockData)
static inline void spinunlock(lam_lock_data_t *lockData)
{
lockData->data.lockData_m = 1;
}
inline unsigned long long fetchNaddLong(bigAtomicUnsignedInt *addr,
static inline unsigned long long fetchNaddLong(bigAtomicUnsignedInt *addr,
int inc)
{
unsigned long long returnValue;
@ -155,7 +155,7 @@ inline unsigned long long fetchNaddLong(bigAtomicUnsignedInt *addr,
}
inline unsigned long long fetchNsetLong(bigAtomicUnsignedInt *addr,
static inline unsigned long long fetchNsetLong(bigAtomicUnsignedInt *addr,
unsigned long long val)
{
unsigned long long returnValue;
@ -169,7 +169,7 @@ inline unsigned long long fetchNsetLong(bigAtomicUnsignedInt *addr,
}
inline unsigned long long fetchNaddLongNoLock(bigAtomicUnsignedInt *addr,
static inline unsigned long long fetchNaddLongNoLock(bigAtomicUnsignedInt *addr,
int inc)
{
unsigned long long returnValue;
@ -180,7 +180,7 @@ inline unsigned long long fetchNaddLongNoLock(bigAtomicUnsignedInt *addr,
return returnValue;
}
inline void setBigAtomicUnsignedInt(bigAtomicUnsignedInt *addr,
static inline void setBigAtomicUnsignedInt(bigAtomicUnsignedInt *addr,
unsigned long long value)
{
addr->data = value;