mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-23 15:49:16 +02:00
Add native atomic operations for s390.
2005-08-03 Matthias Clasen <mclasen@redhat.com> * glib/gatomic.c: Add native atomic operations for s390. * configure.in: ... and use them on s390.
This commit is contained in:
parent
bbecb798e2
commit
4f016b4824
@ -1,3 +1,10 @@
|
|||||||
|
2005-08-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gatomic.c: Add native atomic operations
|
||||||
|
for s390.
|
||||||
|
|
||||||
|
* configure.in: ... and use them on s390.
|
||||||
|
|
||||||
2005-08-03 Ross Burton <ross@burtonini.com>
|
2005-08-03 Ross Burton <ross@burtonini.com>
|
||||||
|
|
||||||
* glib/gstdio.c:
|
* glib/gstdio.c:
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2005-08-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gatomic.c: Add native atomic operations
|
||||||
|
for s390.
|
||||||
|
|
||||||
|
* configure.in: ... and use them on s390.
|
||||||
|
|
||||||
2005-08-03 Ross Burton <ross@burtonini.com>
|
2005-08-03 Ross Burton <ross@burtonini.com>
|
||||||
|
|
||||||
* glib/gstdio.c:
|
* glib/gstdio.c:
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2005-08-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gatomic.c: Add native atomic operations
|
||||||
|
for s390.
|
||||||
|
|
||||||
|
* configure.in: ... and use them on s390.
|
||||||
|
|
||||||
2005-08-03 Ross Burton <ross@burtonini.com>
|
2005-08-03 Ross Burton <ross@burtonini.com>
|
||||||
|
|
||||||
* glib/gstdio.c:
|
* glib/gstdio.c:
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2005-08-03 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* glib/gatomic.c: Add native atomic operations
|
||||||
|
for s390.
|
||||||
|
|
||||||
|
* configure.in: ... and use them on s390.
|
||||||
|
|
||||||
2005-08-03 Ross Burton <ross@burtonini.com>
|
2005-08-03 Ross Burton <ross@burtonini.com>
|
||||||
|
|
||||||
* glib/gstdio.c:
|
* glib/gstdio.c:
|
||||||
|
@ -1967,6 +1967,12 @@ if test x"$GCC" = xyes; then
|
|||||||
[ia64 atomic implementation])
|
[ia64 atomic implementation])
|
||||||
glib_memory_barrier_needed=yes
|
glib_memory_barrier_needed=yes
|
||||||
;;
|
;;
|
||||||
|
s390|s390x)
|
||||||
|
AC_MSG_RESULT([s390])
|
||||||
|
AC_DEFINE_UNQUOTED(G_ATOMIC_S390, 1,
|
||||||
|
[s390 atomic implementation])
|
||||||
|
glib_memory_barrier_needed=no
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_RESULT([none])
|
AC_MSG_RESULT([none])
|
||||||
glib_memory_barrier_needed=yes
|
glib_memory_barrier_needed=yes
|
||||||
|
@ -442,9 +442,49 @@ g_atomic_pointer_compare_and_exchange (gpointer *atomic,
|
|||||||
}
|
}
|
||||||
|
|
||||||
# define G_ATOMIC_MEMORY_BARRIER __sync_synchronize ()
|
# define G_ATOMIC_MEMORY_BARRIER __sync_synchronize ()
|
||||||
# else /* !G_ATOMIC */
|
# elif defined (G_ATOMIC_S390)
|
||||||
|
/* Adapted from glibc's sysdeps/s390/bits/atomic.h
|
||||||
|
*/
|
||||||
|
# define ATOMIC_INT_CMP_XCHG(atomic, oldval, newval) \
|
||||||
|
({ \
|
||||||
|
gint __result = oldval; \
|
||||||
|
__asm__ __volatile__ ("cs %0, %2, %1" \
|
||||||
|
: "+d" (__result), "=Q" (*(atomic)) \
|
||||||
|
: "d" (newval), "m" (*(atomic)) : "cc" ); \
|
||||||
|
__result == oldval; \
|
||||||
|
})
|
||||||
|
|
||||||
|
# if GLIB_SIZEOF_VOID_P == 4 /* 32-bit system */
|
||||||
|
gboolean
|
||||||
|
g_atomic_pointer_compare_and_exchange (gpointer *atomic,
|
||||||
|
gpointer oldval,
|
||||||
|
gpointer newval)
|
||||||
|
{
|
||||||
|
gpointer result = oldval;
|
||||||
|
__asm__ __volatile__ ("cs %0, %2, %1"
|
||||||
|
: "+d" (result), "=Q" (*(atomic))
|
||||||
|
: "d" (newval), "m" (*(atomic)) : "cc" );
|
||||||
|
result == oldval;
|
||||||
|
}
|
||||||
|
# elif GLIB_SIZEOF_VOID_P == 8 /* 64-bit system */
|
||||||
|
gboolean
|
||||||
|
g_atomic_pointer_compare_and_exchange (gpointer *atomic,
|
||||||
|
gpointer oldval,
|
||||||
|
gpointer newval)
|
||||||
|
{
|
||||||
|
gpointer result = oldval;
|
||||||
|
gpointer *a = atomic;
|
||||||
|
__asm__ __volatile__ ("csg %0, %2, %1"
|
||||||
|
: "+d" (result), "=Q" (*a)
|
||||||
|
: "d" ((long)(newval)), "m" (*a) : "cc" );
|
||||||
|
result == oldval;
|
||||||
|
}
|
||||||
|
# else /* What's that */
|
||||||
|
# error "Your system has an unsupported pointer size"
|
||||||
|
# endif /* GLIB_SIZEOF_VOID_P */
|
||||||
|
# else /* !G_ATOMIC_IA64 */
|
||||||
# define DEFINE_WITH_MUTEXES
|
# define DEFINE_WITH_MUTEXES
|
||||||
# endif /* G_ATOMIC */
|
# endif /* G_ATOMIC_IA64 */
|
||||||
#else /* !__GNUC__ */
|
#else /* !__GNUC__ */
|
||||||
# ifdef G_PLATFORM_WIN32
|
# ifdef G_PLATFORM_WIN32
|
||||||
# define DEFINE_WITH_WIN32_INTERLOCKED
|
# define DEFINE_WITH_WIN32_INTERLOCKED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user