Commit 6672b352 authored by Mark Andrews's avatar Mark Andrews
Browse files

1921. [port] aix: atomic locking for powerpc. [RT #15020]

parent 909ab894
1921. [port] aix: atomic locking for powerpc. [RT #15020]
1920. [bug] Update windows socket code. [RT #14965]
1919. [bug] dig's +sigchase code overhauled. [RT #14933]
......
......@@ -14,7 +14,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
# $Id: configure,v 1.379 2005/08/25 06:31:45 marka Exp $
# $Id: configure,v 1.380 2005/09/01 03:36:18 marka Exp $
#
# Portions Copyright (C) 1996-2001 Nominum, Inc.
#
......@@ -29,7 +29,7 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# From configure.in Revision: 1.390 .
# From configure.in Revision: 1.391 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
......@@ -27581,30 +27581,7 @@ fi
arch=alpha
;;
powerpc-*)
case $host in
*-ibm-aix*)
if test "X$GCC" = "Xyes"; then
if test "$use_libtool" = yes -a "$use_threads" = yes
then
have_atomic=no
arch=noatomic
else
arch=powerpc
fi
else
have_atomic=no
arch=noatomic
fi
;;
*)
if test "X$GCC" = "Xyes"; then
arch=powerpc
else
have_atomic=no
arch=noatomic
fi
;;
esac
arch=powerpc
;;
mips-*)
arch=mips
......@@ -27623,7 +27600,7 @@ if test "$have_atomic" = "yes"; then
echo $ECHO_N "checking compiler support for inline assembly code... $ECHO_C" >&6
 
compiler=generic
# Check whehter the compiler supports the assembly syntax we provide.
# Check whether the compiler supports the assembly syntax we provide.
if test "X$GCC" = "Xyes"; then
# GCC's ASM extension always works
compiler=gcc
......@@ -27685,6 +27662,9 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
;;
powerpc-ibm-aix*)
compiler=aix
;;
esac
fi
case "$compiler" in
......@@ -27694,6 +27674,8 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
osf)
ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
;;
aix)
;;
*)
# See if the generic __asm function works. If not,
# we need to disable the atomic operations.
......
......@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.390 $)
AC_REVISION($Revision: 1.391 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13)
......@@ -1888,30 +1888,7 @@ main() {
arch=alpha
;;
powerpc-*)
case $host in
*-ibm-aix*)
if test "X$GCC" = "Xyes"; then
if test "$use_libtool" = yes -a "$use_threads" = yes
then
have_atomic=no
arch=noatomic
else
arch=powerpc
fi
else
have_atomic=no
arch=noatomic
fi
;;
*)
if test "X$GCC" = "Xyes"; then
arch=powerpc
else
have_atomic=no
arch=noatomic
fi
;;
esac
arch=powerpc
;;
mips-*)
arch=mips
......@@ -1928,7 +1905,7 @@ if test "$have_atomic" = "yes"; then
AC_MSG_CHECKING([compiler support for inline assembly code])
compiler=generic
# Check whehter the compiler supports the assembly syntax we provide.
# Check whether the compiler supports the assembly syntax we provide.
if test "X$GCC" = "Xyes"; then
# GCC's ASM extension always works
compiler=gcc
......@@ -1948,6 +1925,9 @@ if test "$have_atomic" = "yes"; then
return (0);],
[compiler=osf],)
;;
powerpc-ibm-aix*)
compiler=aix
;;
esac
fi
case "$compiler" in
......@@ -1957,6 +1937,8 @@ if test "$have_atomic" = "yes"; then
osf)
ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1"
;;
aix)
;;
*)
# See if the generic __asm function works. If not,
# we need to disable the atomic operations.
......
......@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: atomic.h,v 1.2 2005/07/09 06:43:57 jinmei Exp $ */
/* $Id: atomic.h,v 1.3 2005/09/01 03:34:29 marka Exp $ */
#ifndef ISC_ATOMIC_H
#define ISC_ATOMIC_H 1
......@@ -22,11 +22,52 @@
#include <isc/platform.h>
#include <isc/types.h>
#ifdef ISC_PLATFORM_USEGCCASM
/*
/*!\file
* static inline isc_int32_t
* isc_atomic_xadd(isc_int32_t *p, isc_int32_t val);
*
* This routine atomically increments the value stored in 'p' by 'val', and
* returns the previous value.
*
* static inline void
* isc_atomic_store(void *p, isc_int32_t val);
*
* This routine atomically stores the value 'val' in 'p'.
*
* static inline isc_int32_t
* isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val);
*
* This routine atomically replaces the value in 'p' with 'val', if the
* original value is equal to 'cmpval'. The original value is returned in any
* case.
*/
#if defined(_AIX)
#include <sys/atomic_op.h>
#define isc_atomic_xadd(p, v) fetch_and_add(p, v)
#define isc_atomic_store(p, v) _clear_lock(p, v)
#ifdef __GNUC__
static inline int
#else
static int
#endif
isc_atomic_cmpxchg(atomic_p p, int old, int new) {
int orig = old;
#ifdef __GNUC__
asm("ics");
#else
__isync();
#endif
if (compare_and_swap(p, &orig, new))
return (old);
return (orig);
}
#elif ISC_PLATFORM_USEGCCASM
static inline isc_int32_t
isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
isc_int32_t orig;
......@@ -46,9 +87,6 @@ isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
return (orig);
}
/*
* This routine atomically stores the value 'val' in 'p'.
*/
static inline void
isc_atomic_store(void *p, isc_int32_t val) {
__asm__ volatile (
......@@ -63,11 +101,6 @@ isc_atomic_store(void *p, isc_int32_t val) {
);
}
/*
* This routine atomically replaces the value in 'p' with 'val', if the
* original value is equal to 'cmpval'. The original value is returned in any
* case.
*/
static inline isc_int32_t
isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
isc_int32_t orig;
......@@ -90,7 +123,7 @@ isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) {
return (orig);
}
#else /* !ISC_PLATFORM_USEGCCASM */
#else
#error "unsupported compiler. disable atomic ops by --disable-atomic"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment