# define PLAT_ppc32_aix5 1
#endif
-
#if defined(PLAT_amd64_linux) || defined(PLAT_x86_linux)
-# define INC(_lval) \
+# define INC(_lval,_lqual) \
__asm__ __volatile__ ( \
"lock ; incl (%0)" : /*out*/ : /*in*/"r"(&(_lval)) : "memory", "cc" )
-#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux)
-# define INC(_lval) \
+#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
+ || defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5)
+# define INC(_lval,_lqual) \
__asm__ __volatile__( \
- "1:\n" \
+ "L1xyzzy1" _lqual ":\n" \
" lwarx 15,0,%0\n" \
" addi 15,15,1\n" \
" stwcx. 15,0,%0\n" \
- " bne- 1b" \
+ " bne- L1xyzzy1" _lqual \
: /*out*/ : /*in*/ "b"(&(_lval)) \
: /*trash*/ "r15", "cr0", "memory" \
)
void* child_fn ( void* arg )
{
- INC(x);
+ INC(x, "childfn");
return NULL;
}
exit(1);
}
- INC(x);
+ INC(x, "main");
if (pthread_join(child, NULL)) {
perror("pthread join");
# define PLAT_ppc32_aix5 1
#endif
-
#if defined(PLAT_amd64_linux) || defined(PLAT_x86_linux)
-# define INC(_lval) \
+# define INC(_lval,_lqual) \
__asm__ __volatile__ ( \
"lock ; incl (%0)" : /*out*/ : /*in*/"r"(&(_lval)) : "memory", "cc" )
-#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux)
-# define INC(_lval) \
+#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
+ || defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5)
+# define INC(_lval,_lqual) \
__asm__ __volatile__( \
- "1:\n" \
+ "L1xyzzy1" _lqual ":\n" \
" lwarx 15,0,%0\n" \
" addi 15,15,1\n" \
" stwcx. 15,0,%0\n" \
- " bne- 1b" \
+ " bne- L1xyzzy1" _lqual \
: /*out*/ : /*in*/ "b"(&(_lval)) \
: /*trash*/ "r15", "cr0", "memory" \
)
}
for (i = 0; i < LIMIT; i++) {
- INC(x);
+ INC(x, "main");
if (i == 5) sleep(1); /* make sure child doesn't starve */
}
__asm__ __volatile__("");
if (wot == 999) return fn(info);
__asm__ __volatile__("");
-
assert(0);
+ return 0; /* keep gcc happy on AIX */
}
-
/* This program attempts to verify that all functions that are
supposed to be wrapped by tc_intercepts.c really are wrapped. The
main way it does this is to cause failures in those functions, so
otherwise "know" about some more exotic pthread stuff, in this case
PTHREAD_MUTEX_ERRORCHECK. */
#define _GNU_SOURCE 1
-
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#include <semaphore.h>
+#if !defined(_AIX)
+
#if !defined(__GLIBC_PREREQ)
# error "This program needs __GLIBC_PREREQ (in /usr/include/features.h)"
#endif
return 0;
}
+
+#else /* defined(_AIX) */
+int main ( void )
+{
+ fprintf(stderr, "This program does not work on AIX.\n");
+ return 0;
+}
+#endif