Delete the AIX5 port.  The last release this worked for is 3.4.1,
and then only on AIX 5.2 and 5.3.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11842 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/Makefile.all.am b/Makefile.all.am
index f6f5a42..2f89f05 100644
--- a/Makefile.all.am
+++ b/Makefile.all.am
@@ -157,16 +157,6 @@
 AM_CCASFLAGS_ARM_LINUX    = $(AM_CPPFLAGS_ARM_LINUX) @FLAG_M32@ \
 				-marm -mcpu=cortex-a8 -g
 
-AM_FLAG_M3264_PPC32_AIX5  = @FLAG_MAIX32@
-AM_CFLAGS_PPC32_AIX5      = @FLAG_MAIX32@ -mcpu=powerpc $(AM_CFLAGS_BASE)
-AM_CCASFLAGS_PPC32_AIX5   = $(AM_CPPFLAGS_PPC32_AIX5) \
-			    @FLAG_MAIX32@ -mcpu=powerpc -g
-
-AM_FLAG_M3264_PPC64_AIX5  = @FLAG_MAIX64@
-AM_CFLAGS_PPC64_AIX5      = @FLAG_MAIX64@ -mcpu=powerpc64 $(AM_CFLAGS_BASE)
-AM_CCASFLAGS_PPC64_AIX5   = $(AM_CPPFLAGS_PPC64_AIX5) \
-			    @FLAG_MAIX64@ -mcpu=powerpc64 -g
-
 AM_FLAG_M3264_X86_DARWIN = -arch i386
 AM_CFLAGS_X86_DARWIN     = $(WERROR) -arch i386 $(AM_CFLAGS_BASE) \
 				-mmacosx-version-min=10.5 \
@@ -203,7 +193,6 @@
 # Baseline link flags for making vgpreload shared objects.
 #
 PRELOAD_LDFLAGS_COMMON_LINUX  = -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst
-PRELOAD_LDFLAGS_COMMON_AIX5   = -nodefaultlibs -shared -Wl,-G -Wl,-bnogc
 PRELOAD_LDFLAGS_COMMON_DARWIN = -dynamic -dynamiclib -all_load
 
 PRELOAD_LDFLAGS_X86_LINUX    = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
@@ -211,8 +200,6 @@
 PRELOAD_LDFLAGS_PPC32_LINUX  = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
 PRELOAD_LDFLAGS_PPC64_LINUX  = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
 PRELOAD_LDFLAGS_ARM_LINUX    = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
-PRELOAD_LDFLAGS_PPC32_AIX5   = $(PRELOAD_LDFLAGS_COMMON_AIX5)  @FLAG_MAIX32@
-PRELOAD_LDFLAGS_PPC64_AIX5   = $(PRELOAD_LDFLAGS_COMMON_AIX5)  @FLAG_MAIX64@
 PRELOAD_LDFLAGS_X86_DARWIN   = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch i386
 PRELOAD_LDFLAGS_AMD64_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch x86_64
 PRELOAD_LDFLAGS_S390X_LINUX  = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
diff --git a/Makefile.am b/Makefile.am
index 67b6e20..f642e71 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,7 +46,7 @@
 SUPP_FILES = \
 	glibc-2.2.supp glibc-2.3.supp glibc-2.4.supp glibc-2.5.supp \
 	glibc-2.6.supp glibc-2.7.supp glibc-2.X.supp.in \
-	aix5libc.supp xfree-3.supp xfree-4.supp \
+	xfree-3.supp xfree-4.supp \
 	glibc-2.34567-NPTL-helgrind.supp \
 	glibc-2.2-LinuxThreads-helgrind.supp \
 	glibc-2.X-drd.supp \
diff --git a/Makefile.tool.am b/Makefile.tool.am
index 77f8214..f5297bb 100644
--- a/Makefile.tool.am
+++ b/Makefile.tool.am
@@ -32,8 +32,6 @@
 # is unusable. So we have to tell ld not to generate that, with --build-id=none.
 TOOL_LDFLAGS_COMMON_LINUX = \
 	-static -nodefaultlibs -nostartfiles -u _start @FLAG_NO_BUILD_ID@
-TOOL_LDFLAGS_COMMON_AIX5 = \
-	-static -Wl,-e_start_valgrind
 TOOL_LDFLAGS_COMMON_DARWIN = \
 	-nodefaultlibs -nostartfiles -Wl,-u,__start -Wl,-e,__start
 
@@ -55,12 +53,6 @@
 TOOL_LDFLAGS_S390X_LINUX = \
 	$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@
 
-TOOL_LDFLAGS_PPC32_AIX5 = \
-	$(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX32@
-
-TOOL_LDFLAGS_PPC64_AIX5 = \
-	$(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX64@ -Wl,-bbigtoc
-
 TOOL_LDFLAGS_X86_DARWIN = \
 	$(TOOL_LDFLAGS_COMMON_DARWIN) -arch i386
 
@@ -95,12 +87,6 @@
 LIBREPLACEMALLOC_ARM_LINUX = \
 	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-arm-linux.a
 
-LIBREPLACEMALLOC_PPC32_AIX5 = \
-	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc32-aix5.a
-
-LIBREPLACEMALLOC_PPC64_AIX5 = \
-	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc64-aix5.a
-
 LIBREPLACEMALLOC_X86_DARWIN = \
 	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-x86-darwin.a
 
@@ -136,12 +122,6 @@
 	$(LIBREPLACEMALLOC_ARM_LINUX) \
 	-Wl,--no-whole-archive
 
-LIBREPLACEMALLOC_LDFLAGS_PPC32_AIX5 = \
-	$(LIBREPLACEMALLOC_PPC32_AIX5)
-
-LIBREPLACEMALLOC_LDFLAGS_PPC64_AIX5 = \
-	$(LIBREPLACEMALLOC_PPC64_AIX5)
-
 LIBREPLACEMALLOC_LDFLAGS_X86_DARWIN = \
 	$(LIBREPLACEMALLOC_X86_DARWIN)
 
diff --git a/aix5libc.supp b/aix5libc.supp
deleted file mode 100644
index f70c1f8..0000000
--- a/aix5libc.supp
+++ /dev/null
@@ -1,833 +0,0 @@
-
-## AIX clients start off by executing a short code stub which
-## loads the preloads, and then jumps to the real client.  The
-## stub reads data belonging to V (by design) and it's easier
-## to hide the resulting errors than mess properly with permissions.
-{
-   VG_(trampoline_stuff_start) hack
-   Memcheck:Addr4
-   fun:vgPlain_trampoline_stuff_start
-}
-
-## Not really a bug in the thread library, just padding 
-## problems.
-# Syscall param thread_setmystate(arg1) points to uninitialised byte(s)
-#    at 0xD011F36C: _set_pthread+680 (in /usr/lib/libpthreads.a)
-#    by 0xD01142E4: _alloc_initial_pthread+804 (in /usr/lib/libpthreads.a)
-#    by 0xD01123AC: pthread_init+2880 (in /usr/lib/libpthreads.a)
-#    by 0x10000344: call_pthread_init+20 (in /proc/557146/object/a.out)
-#    by 0x10000258: __threads_init+64 (in /proc/557146/object/a.out)
-#    by 0xD0325278: __modinit+356 (in /usr/lib/threads/libc.a)
-#    by 0x10000198: __start+72 (in /proc/557146/object/a.out)
-{
-   AIX-thread_setmystate-padding-kludge-1
-   Memcheck:Param
-   thread_setmystate(arg1)
-   fun:_set_pthread
-   fun:_alloc_initial_pthread
-   fun:pthread_init
-}
-{
-   AIX-thread_setmystate-padding-kludge-1a
-   Memcheck:Param
-   thread_setmystate(arg1)
-   fun:_set_pthread
-   fun:_alloc_initial_pthread
-   fun:__pth_init
-}
-{
-   AIX-thread_setmystate-padding-kludge-2
-   Memcheck:Param
-   thread_setmystate(arg1)
-   fun:_set_pthread
-   fun:_fork_child
-   fun:_atfork_child
-   fun:__fork
-}
-{
-   AIX-thread_setmystate-padding-kludge-3
-   Memcheck:Param
-   thread_setmystate(arg1)
-   fun:_sigsetmask
-   fun:_p_sigaction
-}
-{
-   AIX-thread_setmystate-padding-kludge-4
-   Memcheck:Param
-   thread_setmystate(arg1)
-   fun:_sigsetmask
-   fun:sigthreadmask
-}
-{
-   AIX-thread_setmystate-padding-kludge-5
-   Memcheck:Param
-   thread_setmystate(arg1)
-   fun:_sigsetmask
-   fun:_fork_*
-}
-
-# AIX's libc contains a qsort routine which expertly does
-# memcpy(src, dst, N) for src==dst.  This is technically a
-# violation of POSIX and so Memcheck complains.
-{
-   AIX-libc-qsort-bug-1
-   Memcheck:Overlap
-   fun:memcpy
-   fun:qs2
-   fun:qsort
-}
-{
-   AIX-libc-qsort-bug-2
-   Memcheck:Overlap
-   fun:memcpy
-   fun:qs2
-   fun:qs2
-   fun:qsort
-}
-{
-   AIX-libc-qsort-bug-3
-   Memcheck:Overlap
-   fun:memcpy
-   fun:qs2
-   fun:qs2
-   fun:qs2
-}
-
-## Thread library initialisation, cause unknown.
-# Conditional jump or move depends on uninitialised value(s)
-#    at 0xD030DD30: fseeko64_unlocked (in /usr/lib/libc.a)
-#    by 0xD030DFF0: fseeko64 (in /usr/lib/libc.a)
-#    by 0xD0453F2C: nlist64 (in /usr/lib/libc.a)
-#    by 0xD01267FC: _pth_init_kgetsig (in /usr/lib/libpthread.a)
-#    by 0xD01123DC: pthread_init (in /usr/lib/libpthread.a)
-#    by 0x10000344: call_pthread_init (in /proc/645084/object/a.out)
-#    by 0x10000258: __threads_init (in /proc/645084/object/a.out)
-#    by 0xD0325278: __modinit (in /usr/lib/libc.a)
-#    by 0x10000198: (below main) (in /proc/645084/object/a.out)
-{
-   AIX-thread-library-init-1
-   Memcheck:Cond
-   fun:fseeko64_unlocked
-   fun:fseeko64
-}
-
-## More of the same (cause again unknown)
-# Conditional jump or move depends on uninitialised value(s)
-#    at 0xD030E1F0: __ftell (in /usr/lib/libc.a)
-#    by 0xD030E334: ftello64 (in /usr/lib/libc.a)
-#    by 0xD0454044: nlist64 (in /usr/lib/libc.a)
-#    by 0xD01267FC: _pth_init_kgetsig (in /usr/lib/libpthread.a)
-#    by 0xD01123DC: pthread_init (in /usr/lib/libpthread.a)
-#    by 0x10000344: call_pthread_init (in /proc/448094/object/a.out)
-#    by 0x10000258: __threads_init (in /proc/448094/object/a.out)
-#    by 0xD0325278: __modinit (in /usr/lib/libc.a)
-#    by 0x10000198: (below main) (in /proc/448094/object/a.out)
-{
-   AIX-thread-library-init-2
-   Memcheck:Cond
-   fun:__ftell
-   fun:ftello64
-   fun:nlist64
-}
-
-## Related wierdness (klseek is undocumented, so the wrapper
-## is a guess at best)
-{
-   AIX-libc-klseek-1
-   Memcheck:Param
-   klseek(offset)
-   fun:lseek64
-   fun:fseeko64_unlocked
-   fun:fseeko64
-}
-{
-   AIX-libc-klseek-2
-   Memcheck:Param
-   klseek(whence)
-   fun:lseek64
-   fun:fseeko64_unlocked
-   fun:fseeko64
-}
-
-## Buffer overrun in libc regexp stuff?
-# Invalid read of size 1
-#    at 0xD08A2F50: memcpy (mc_replace_strmem.c:437)
-#    by 0xD0328B30: match_re (in /usr/lib/libc.a)
-#    by 0xD032A464: match_re (in /usr/lib/libc.a)
-#    by 0xD032A464: match_re (in /usr/lib/libc.a)
-#    by 0xD032A464: match_re (in /usr/lib/libc.a)
-#    by 0xD0328AD4: match_re (in /usr/lib/libc.a)
-#    by 0xD032A464: match_re (in /usr/lib/libc.a)
-#    by 0xD032816C: __regexec_std (in /usr/lib/libc.a)
-#    by 0xD0330AA8: regexec (in /usr/lib/libc.a)
-{
-   AIX-regexp-dodgyness-1
-   Memcheck:Addr1
-   fun:memcpy
-   fun:match_re
-   fun:match_re
-   fun:match_re
-}
-
-## Misuse of memcpy
-# Source and destination overlap in memcpy(0x32154ECC, 0x32154EC8, 8)
-#    at 0xD13A4F30: memcpy (mc_replace_strmem.c:437)
-#    by 0xD03D34BC: __ntree_locate (in /usr/lib/libc.a)
-#    by 0xD03D3090: ntree_search (in /usr/lib/libc.a)
-#    by 0xD0406E8C: colon_search (in /usr/lib/libc.a)
-#    by 0xD03DE068: method_getpw_common (in /usr/lib/libc.a)
-#    by 0xD03DEB18: method_getpwuid (in /usr/lib/libc.a)
-#    by 0xD03C89DC: _getpwuid_shadow_r (in /usr/lib/libc.a)
-#    by 0xD03C62FC: _getpwuid_shadow (in /usr/lib/libc.a)
-{
-   AIX-overlapping-memcpy-1
-   Memcheck:Overlap
-   fun:memcpy
-   fun:__ntree_locate
-   fun:ntree_search
-   fun:colon_search
-}
-{
-   AIX-overlapping-memcpy-2
-   Memcheck:Overlap
-   fun:memcpy
-   fun:__ntree_locate
-   fun:__ntree_locate
-   fun:ntree_search
-}
-
-## No idea what this is caused by
-# Conditional jump or move depends on uninitialised value(s)
-#    at 0xD03069F8: fflush_unlocked (in /usr/lib/libc.a)
-#    by 0xD03077AC: fflush (in /usr/lib/libc.a)
-#    by 0xD03D545C: common_close (in /usr/lib/libc.a)
-#    by 0xD03D46B8: common_unlock (in /usr/lib/libc.a)
-#    by 0xD040712C: colon_search (in /usr/lib/libc.a)
-#    by 0xD03DE068: method_getpw_common (in /usr/lib/libc.a)
-#    by 0xD03DEB18: method_getpwuid (in /usr/lib/libc.a)
-{
-   AIX-fflush-unlocked-1
-   Memcheck:Cond
-   fun:fflush_unlocked
-   fun:fflush
-   fun:common_close
-   fun:common_unlock
-}
-
-## No idea what this is caused by
-# Conditional jump or move depends on uninitialised value(s)
-#    at 0xD03EBC30: __method_getentry_v2 (in /usr/lib/libc.a)
-#    by 0xD03E887C: does_user_exist (in /usr/lib/libc.a)
-#    by 0xD03E9010: getuserattrs (in /usr/lib/libc.a)
-#    by 0xD03E4E68: getuserattr (in /usr/lib/libc.a)
-#    by 0xD03C8BA4: _getpwuid_shadow_r (in /usr/lib/libc.a)
-#    by 0xD03CBE4C: getpwuid (in /usr/lib/libc.a)
-{
-   AIX-__method_getentry_v2-1
-   Memcheck:Cond
-   fun:__method_getentry_v2
-   fun:does_user_exist
-   fun:getuserattrs
-   fun:getuserattr
-}
-{
-   AIX-__method_getentry_v2-2
-   Memcheck:Cond
-   fun:__method_getentry_v2
-   fun:does_user_exist
-   fun:process_module
-   fun:getuserattrs
-}
-
-## No idea what this is caused by
-# Conditional jump or move depends on uninitialised value(s)
-#    at 0xD03F7120: seekdir64 (in /usr/lib/libc.a)
-#    by 0xD041A63C: opendir64 (in /usr/lib/libc.a)
-#    by 0xD041961C: getwd (in /usr/lib/libc.a)
-#    by 0xD04194B4: getcwd (in /usr/lib/libc.a)
-{
-   AIX-seekdir64
-   Memcheck:Cond
-   fun:seekdir64
-   fun:opendir64
-}
-
-## No idea what this is caused by
-# Conditional jump or move depends on uninitialised value(s)
-#    at 0xD036C80C: ungetwc (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0xD0369D94: ungetcc (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0xD03695EC: _doscan (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0xD037544C: sscanf (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0xD1BAD9BC: lapi_atoi (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1BA8DBC: _read_int_env (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1BAB86C: _lapi_init_env_once (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1BAB44C: _lapi_perproc_setup (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD0118E50: pthread_once (in /usr/lib/libpthreads.a(shr_xpg5.o))
-#    by 0xD1BA86B8: LAPI__Init (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD0EC7A70: lapi_init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpci_r.o))
-#    by 0xD0EC9524: mpci_connect (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpci_r.o))
-{
-   AIX-LAPI-ungetwc-1
-   Memcheck:Cond
-   fun:ungetwc
-   fun:ungetcc
-   fun:_doscan
-   fun:sscanf
-}
-{
-   AIX-LAPI-ungetwc-2
-   Memcheck:Cond
-   fun:ungetwc
-   fun:ungetcc
-   fun:number
-   fun:_doscan
-}
-
-## No idea what this is caused by
-# Conditional jump or move depends on uninitialised value(s)
-#    at 0xD030CAD0: atoi (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0xD0E48DAC: _udp_open_socket (in /usr/lib/liblapi_r.a(liblapiudp_r.o))
-#    by 0xD0E4B17C: _udp_open (in /usr/lib/liblapi_r.a(liblapiudp_r.o))
-#    by 0xD1BAC77C: _lapi_init_function (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1BAE4F0: _lapi_non_pss_init (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1BA883C: LAPI__Init (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD0EC7A70: lapi_init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpci_r.o))
-#    by 0xD0EC9524: mpci_connect (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpci_r.o))
-#    by 0xD06AA28C: _css_init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD06AB664: _mp_init_msg_passing (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD0647F54: MPI__Init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-{
-   AIX-LAPI-atoi-1
-   Memcheck:Cond
-   fun:atoi
-   fun:_udp_open_socket
-   fun:_udp_open
-   fun:_lapi_init_function
-}
-{
-   AIX-LAPI-atoi-2
-   Memcheck:Value4
-   fun:atoi
-   fun:_udp_open_socket
-   fun:_udp_open
-   fun:_lapi_init_function
-}
-{
-   AIX-LAPI-atoi-3
-   Memcheck:Value8
-   fun:atoi
-   fun:_udp_open_socket
-   fun:_udp_open
-   fun:_lapi_init_function
-}
-
-## MPI stuff.  Not sure what's going on here.  Is this a 
-## legit padding problem?  Dunno.
-# Syscall param write(buf) points to uninitialised byte(s)
-#    at 0xD0310068: write (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0xD1CD03B0: pm_SSM_write (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpipoe_r.o))
-#    by 0xD1CD5FB0: mp_main (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpipoe_r.o))
-#    by 0x100005D8: poe_remote_main (in /proc/872668/object/a.out)
-#    by 0xD0325414: mod_init1 (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0xD0325328: __modinit (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0x10000198: (below main) (in /proc/872668/object/a.out)
-#  Address 0x32131422 is 10 bytes inside a block of size 19 alloc'd
-#    at 0xD4230514: malloc (vg_replace_malloc.c:168)
-#    by 0xD1CD035C: pm_SSM_write (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpipoe_r.o))
-#    by 0xD1CD5FB0: mp_main (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpipoe_r.o))
-#    by 0x100005D8: poe_remote_main (in /proc/872668/object/a.out)
-#    by 0xD0325414: mod_init1 (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0xD0325328: __modinit (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0x10000198: (below main) (in /proc/872668/object/a.out)
-{
-   AIX-MPI-pm_SSM_write-1
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_write
-   fun:mp_main
-}
-{
-   AIX-MPI-pm_SSM_write-2
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_write
-   fun:_mp_send_child_pid
-}
-{
-   AIX-MPI-pm_SSM_write-3
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_write
-   fun:_mp_finalize_req
-}
-{
-   AIX-MPI-pm_SSM_write-4
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_write
-   fun:pm_atexit
-}
-{
-   AIX-MPI-pm_SSM_write-5
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_write
-   fun:_udp_init
-}
-{
-   AIX-MPI-pm_SSM_write-6
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_write
-   fun:_us_info
-}
-{
-   AIX-MPI-pm_SSM_read-1
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_read
-   fun:pm_atexit
-}
-{
-   AIX-MPI-pm_SSM_read-2
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_read
-   fun:poe_unlock_all
-}
-{
-   AIX-MPI-pm_SSM_read-3
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_read
-   fun:_css_init
-}
-{
-   AIX-MPI-pm_SSM_read-3
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_read
-   fun:pthread_mutex_lock
-}
-{
-   AIX-MPI-pm_SSM_read-4
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_read
-   fun:_mp_Wtime_stop
-}
-{
-   AIX-MPI-pm_SSM_read-5
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:pm_SSM_read
-   fun:pthread_mutex_unlock
-}
-
-
-## More MPI stuff
-# Invalid read of size 8
-#    at 0xD3EB34D8: read_canopus (in /usr/lib/swclock.o)
-#    by 0xD3EB31A0: swclockRead (hps_scri.c:431)
-#    by 0xD08B6AD4: HPSOclk_reset (in /usr/lpp/ppe.poe/lib/libppe_r.a(dynamic.o))
-#    by 0xD08B6CB4: HPSOclk_init (in /usr/lpp/ppe.poe/lib/libppe_r.a(dynamic.o))
-#    by 0xD16BC9F0: _mp_Wtime_init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpipoe_r.o))
-#    by 0xD1FEA3A8: _css_init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1FEB664: _mp_init_msg_passing (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1F87F54: MPI__Init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#  Address 0x40000000 is not stack'd, malloc'd or (recently) free'd
-{
-   AIX-MPI-read_canopus
-   Memcheck:Addr8
-   fun:read_canopus
-   fun:swclockRead
-   fun:HPSOclk_reset
-   fun:HPSOclk_init
-}
-
-## More MPI stuff (many variants of these)
-# Conditional jump or move depends on uninitialised value(s)
-#    at 0xD1E8297C: ipcompare (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD033CADC: qs1 (in /usr/lpp/ppe.poe/lib/threads/libc.a(shr.o))
-#    by 0xD1E82A38: _derive_up_down_instances (in /usr/lib/liblapi_r.a(liblapi\
-#_r.o))
-#    by 0xD1E83484: NAM_monitor_thread (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD0111440: _pthread_body (in /usr/lib/libpthreads.a(shr_xpg5.o))
-{
-   AIX-MPI-ipcompare-1
-   Memcheck:Cond
-   fun:ipcompare
-   fun:qs1
-   fun:_derive_up_down_instances
-   fun:NAM_monitor_thread
-}
-{
-   AIX-MPI-ipcompare-2
-   Memcheck:Cond
-   fun:ipcompare
-   fun:qs1
-   fun:qsort
-   fun:_derive_up_down_instances
-}
-{
-   AIX-MPI-ipcompare-3
-   Memcheck:Cond
-   fun:ipcompare
-   fun:qs1
-   fun:qs1
-   fun:qsort
-}
-{
-   AIX-MPI-ipcompare-4
-   Memcheck:Cond
-   fun:ipcompare
-   fun:qs1
-   fun:qs1
-   fun:qs1
-}
-{
-   AIX-MPI-ipcompare-5
-   Memcheck:Cond
-   fun:ipcompare
-   fun:bsearch_*_1
-   fun:NAM_monitor_thread
-}
-
-## More MPI stuff
-# Conditional jump or move depends on uninitialised value(s)
-#    at 0xD1CA2240: barrier_shft_b (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1CE6FAC: _mpi_barrier (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1D11720: _mpi_init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1D733D8: _css_init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1D74644: _mp_init_msg_passing (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1D10F34: MPI__Init (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD33DD5D0: PMPI_Init (libmpiwrap.c:1789)
-#    by 0xD33E48F8: before (libmpiwrap.c:186)
-#    by 0xD33DD55C: PMPI_Init (libmpiwrap.c:1788)
-{
-   AIX-MPI-barrier_shft_b-1
-   Memcheck:Cond
-   fun:barrier_shft_b
-   fun:_mpi_barrier
-   fun:_mpi_init
-   fun:_css_init
-}
-{
-   AIX-MPI-barrier_shft_b-2
-   Memcheck:Cond
-   fun:barrier_shft_b
-   fun:_mpi_barrier
-   fun:MPI__Finalize
-}
-{
-   AIX-MPI-barrier_shft_b-3
-   Memcheck:Cond
-   fun:barrier_shft_b
-   fun:_mpi_barrier
-   fun:MPI__Barrier
-}
-
-## MPI
-# Invalid read of size 1
-#    at 0xD21B8FB8: can_writepkt (in /usr/lib/libhal_r.a(hal_hps.o))
-#    by 0xD1E86D7C: _stripe_hal_writepkt_noflip (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1E33BB8: _process_one_contig_item (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1E4E3A8: _Am_xfer (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1E4EB9C: _Dgsp_xfer (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1E49EC0: LAPI__Xfer (in /usr/lib/liblapi_r.a(liblapi_r.o))
-#    by 0xD1DCF2FC: mpci_send (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpci_r.o))
-#    by 0xD1C90F6C: _mpi_start (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1C90648: _mpi_xisend (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1C89898: MPI__Isend (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD3910FD4: generic_Isend (libmpiwrap.c:1129)
-#    by 0xFFFFFFFB: ???
-#  Address 0x370A4794 is 0 bytes after a block of size 20 alloc'd
-#    at 0xD38DE514: malloc (vg_replace_malloc.c:168)
-#    by 0x100004BC: main (mpi_vg_demo2.c:56)
-{
-   AIX-MPI-can_writepkt-1
-   Memcheck:Addr1
-   fun:can_writepkt
-   fun:_stripe_hal_writepkt_noflip
-   fun:_process_one_contig_item
-   fun:_Am_xfer
-}
-{
-   AIX-MPI-can_writepkt-2
-   Memcheck:Addr1
-   obj:*
-   fun:_make_localbuf_copy
-   fun:_Am_xfer
-   fun:_Dgsp_xfer
-}
-
-## MPI
-# Invalid write of size 4
-#    at 0xD1D14B18: check_ranks (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#    by 0xD1D147C8: MPI__Group_incl (in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore_r.o))
-#  Address 0x2FF12154 is not stack'd, malloc'd or (recently) free'd
-{
-   AIX-MPI-check_ranks-1
-   Memcheck:Addr4
-   fun:check_ranks
-   fun:MPI__Group_incl
-}
-
-## X, holes in structs?
-{
-   AIX-X11-write-_X11TransSocketWrite
-   Memcheck:Param
-   write(buf)
-   fun:write
-   fun:_X11TransSocketWrite
-   fun:_X11TransWrite
-}
-
-## Who knows
-{
-   AIX-fread_unlocked-1
-   Memcheck:Cond
-   fun:*memcpy
-   fun:fread_unlocked
-   fun:fread
-}
-{
-   AIX-fread_unlocked-2
-   Memcheck:Value8
-   fun:*memcpy
-   fun:fread_unlocked
-   fun:fread
-}
-{
-   AIX-fread_unlocked-3
-   Memcheck:Value4
-   fun:*memcpy
-   fun:fread_unlocked
-   fun:fread
-}
-{
-   AIX-fread_unlocked-4
-   Memcheck:Cond
-   fun:fread_unlocked
-   fun:fread
-}
-
-## Looks like inlined strcpy etc in module with no symbols; nothing
-# to be done about it.
-{
-   AIX-uconv-1
-   Memcheck:Cond
-   obj:/*/UTF32TBL__64
-   obj:/*/UTF32TBL__64
-   obj:/*/UTF32TBL__64
-}
-{
-   AIX-uconv-2
-   Memcheck:Value8
-   obj:/*/UTF32TBL__64
-   obj:/*/UTF32TBL__64
-   obj:/*/UTF32TBL__64
-}
-{
-   AIX-uconv-3
-   Memcheck:Addr8
-   obj:/*/UTF32TBL__64
-   obj:/*/UTF32TBL__64
-   obj:/*/UTF32TBL__64
-}
-
-
-#####################################################################
-### AIX 64-bit                                                    ###
-#####################################################################
-
-{
-   AIX64-uu-sz8
-   Memcheck:Addr8
-   obj:/usr/ccs/bin/usla64
-   obj:/usr/ccs/bin/usla64
-}
-{
-   AIX64-uu-sz4
-   Memcheck:Addr4
-   obj:/usr/ccs/bin/usla64
-}
-{
-   AIX64-uu-sz2
-   Memcheck:Addr2
-   obj:/usr/ccs/bin/usla64
-   obj:/usr/ccs/bin/usla64
-}
-{
-   AIX64-uu-sz1
-   Memcheck:Addr1
-   obj:/usr/ccs/bin/usla64
-   obj:/usr/ccs/bin/usla64
-}
-
-{
-   AIX64-uc-sz8
-   Memcheck:Addr8
-   obj:/usr/ccs/bin/usla64
-   obj:*/libc.a(shr*.o)
-}
-{
-   AIX64-uc-sz4
-   Memcheck:Addr4
-   obj:/usr/ccs/bin/usla64
-   obj:*/libc.a(shr*.o)
-}
-{
-   AIX64-uc-sz2
-   Memcheck:Addr2
-   obj:/usr/ccs/bin/usla64
-   obj:*/libc.a(shr*.o)
-}
-{
-   AIX64-uc-sz1
-   Memcheck:Addr1
-   obj:/usr/ccs/bin/usla64
-   obj:*/libc.a(shr*.o)
-}
-
-{
-   AIX64-?uu-sz8
-   Memcheck:Addr8
-   fun:*
-   obj:/usr/ccs/bin/usla64
-   obj:/usr/ccs/bin/usla64
-}
-{
-   AIX64-?uu-sz4
-   Memcheck:Addr4
-   fun:*
-   obj:/usr/ccs/bin/usla64
-   obj:/usr/ccs/bin/usla64
-}
-
-{
-   AIX64-?uc-sz8
-   Memcheck:Addr8
-   fun:*
-   obj:/usr/ccs/bin/usla64
-   obj:*/libc.a(shr*.o)
-}
-{
-   AIX64-?uc-sz4
-   Memcheck:Addr4
-   fun:*
-   obj:/usr/ccs/bin/usla64
-   obj:*/libc.a(shr*.o)
-}
-{
-   AIX64-?uc-sz2
-   Memcheck:Addr2
-   fun:*
-   obj:/usr/ccs/bin/usla64
-   obj:*/libc.a(shr*.o)
-}
-{
-   AIX64-?uc-sz1
-   Memcheck:Addr1
-   fun:*
-   obj:/usr/ccs/bin/usla64
-   obj:*/libc.a(shr*.o)
-}
-
-{
-   AIX64-usla_exec_init_mods-sz8
-   Memcheck:Addr8
-   fun:usl_exec_init_mods
-}
-
-{
-   AIX64-usla_main-sz8
-   Memcheck:Addr8
-   fun:usla_main
-}
-
-{
-   AIX64-__modfini64-sz8
-   Memcheck:Addr8
-   fun:__modfini64
-}
-
-{
-   AIX64-load-lib?-sz8
-   Memcheck:Addr8
-   fun:load
-   obj:*/lib?.a(shr*.o)
-}
-
-{
-   AIX64-__loadx-libc-sz8
-   Memcheck:Addr8
-   fun:__loadx
-   obj:*/libc.a(shr*.o)
-}
-
-{
-   AIX64-loadquery-libC-sz8
-   Memcheck:Addr8
-   fun:loadquery
-   obj:*/libC.a(shr*.o)
-}
-
-{
-   AIX64-__loadx-pthread_init-sz8
-   Memcheck:Addr8
-   fun:__loadx
-   fun:*pth*_init
-}
-
-{
-   AIX64-unload-libC-sz8
-   Memcheck:Addr8
-   fun:unload
-   obj:*/libC.a(shr*.o)
-}
-
-{
-   AIX64-loadquery-__C_runtime_startup-sz8
-   Memcheck:Addr8
-   fun:loadquery
-   fun:__C_runtime_startup
-}
-
-{
-   AIX64-load-libppe-sz8
-   Memcheck:Addr8
-   fun:load
-   obj:*/libppe*.a(*.o)
-}
-
-#####
-
-{
-   AIX-libodm_tsd_destroy-free
-   Memcheck:Free
-   fun:free
-   fun:libodm_tsd_destroy
-   fun:__odm_initfini_fini
-}
-
-{
-   AIX64-usl-resolve-sz1
-   Memcheck:Addr1
-   obj:*
-   fun:usl_resolve
-   fun:uload
-   fun:load
-}
diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am
index 1563f4b..95410c2 100644
--- a/auxprogs/Makefile.am
+++ b/auxprogs/Makefile.am
@@ -9,8 +9,6 @@
 EXTRA_DIST = \
 	DotToScc.hs \
 	Merge3Way.hs \
-	aix5_VKI_info.c \
-	aix5_proc_self_sysent.c \
 	gsl16-badfree.patch \
 	gsl16-wavelet.patch \
 	posixtestsuite-1.5.1-diff.txt \
diff --git a/auxprogs/aix5_VKI_info.c b/auxprogs/aix5_VKI_info.c
deleted file mode 100644
index 94790b2..0000000
--- a/auxprogs/aix5_VKI_info.c
+++ /dev/null
@@ -1,342 +0,0 @@
-
-/* Used to generate include/vki/vki-ppc{32,64}-aix5.h. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/statfs.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include <sys/ptrace.h>
-#include <sys/uio.h>
-#include <sys/ioctl.h>
-
-#undef offsetof
-
-/* This is so useful it should be visible absolutely everywhere. */
-#if !defined(offsetof)
-#   define offsetof(type,memb) ((int)&((type*)0)->memb)
-#endif
-
-
-int main ( void )
-{
-   printf ("aix5_VKI_info: sizeof(void*) = %d\n", (int)sizeof(void*));
-
-   printf("/* ---------------- Errors ---------------- */\n");
-   printf("\n");
-   printf("#define VKI_EINVAL %d\n", EINVAL);
-   printf("#define VKI_EINTR  %d\n", EINTR);
-   printf("#define VKI_ENOSYS %d\n", ENOSYS);
-   printf("#define VKI_EAGAIN %d\n", EAGAIN);
-   printf("#define VKI_ENOMEM %d\n", ENOMEM);
-   printf("#define VKI_EACCES %d\n", EACCES);
-   printf("#define VKI_EEXIST %d\n", EEXIST);
-   printf("#define VKI_EPERM  %d\n", EPERM);
-   printf("#define VKI_ENOENT %d\n", ENOENT);
-   printf("#define VKI_ESRCH  %d\n", ESRCH);
-   printf("#define VKI_EBADF  %d\n", EBADF);
-   printf("#define VKI_EFAULT %d\n", EFAULT);
-   printf("#define VKI_EMFILE %d\n", EMFILE);
-   printf("#define VKI_ECHILD %d\n", ECHILD);
-   printf("#define VKI_EOVERFLOW %d\n", EOVERFLOW);
-   printf("\n");
-   printf("/* ---------------- File I/O ---------------- */\n");
-   printf("\n");
-   printf("#define VKI_O_WRONLY 0x%08x\n", O_WRONLY);
-   printf("#define VKI_O_RDONLY 0x%08x\n", O_RDONLY);
-   printf("#define VKI_O_APPEND 0x%08x\n", O_APPEND);
-   printf("#define VKI_O_CREAT  0x%08x\n", O_CREAT);
-   printf("#define VKI_O_RDWR   0x%08x\n", O_RDWR);
-   printf("#define VKI_O_EXCL   0x%08x\n", O_EXCL);
-   printf("#define VKI_O_TRUNC  0x%08x\n", O_TRUNC);
-   printf("\n");
-   printf("#define VKI_S_IRUSR  0x%08x\n", S_IRUSR);
-   printf("#define VKI_S_IXUSR  0x%08x\n", S_IXUSR);
-   printf("#define VKI_S_IXGRP  0x%08x\n", S_IXGRP);
-   printf("#define VKI_S_IXOTH  0x%08x\n", S_IXOTH);
-   printf("#define VKI_S_IWUSR  0x%08x\n", S_IWUSR);
-   printf("#define VKI_S_IWOTH  0x%08x\n", S_IWOTH);
-   printf("#define VKI_S_ISUID  0x%08x\n", S_ISUID);
-   printf("#define VKI_S_ISGID  0x%08x\n", S_ISGID);
-   printf("#define VKI_S_IFMT   0x%08x\n", S_IFMT);
-   printf("#define VKI_S_IFDIR  0x%08x\n", S_IFDIR);
-   printf("#define VKI_S_IFCHR  0x%08x\n", S_IFCHR);
-   printf("#define VKI_S_IFBLK  0x%08x\n", S_IFBLK);
-   printf("\n");
-   printf("#define VKI_F_DUPFD  0x%08x\n", F_DUPFD);
-   printf("#define VKI_F_SETFD  0x%08x\n", F_SETFD);
-   printf("#define VKI_FD_CLOEXEC  0x%08x\n", FD_CLOEXEC);
-   printf("\n");
-   printf("#define VKI_R_OK 0x%08x\n", R_OK);
-   printf("#define VKI_W_OK 0x%08x\n", W_OK);
-   printf("#define VKI_X_OK 0x%08x\n", X_OK);
-
-   /* info about struct stat */
-   struct stat st;
-   printf("\nsizeof(struct stat) = %d\n", (int)sizeof(struct stat));
-
-   printf("   st_size: off %2d sz %d\n", 
-              offsetof(struct stat, st_size),
-              (int)sizeof(st.st_size));
-
-   printf("   st_mode: off %2d sz %d\n", 
-              offsetof(struct stat, st_mode),
-              (int)sizeof(st.st_mode));
-
-   printf("   st_uid: off %2d sz %d\n", 
-              offsetof(struct stat, st_uid),
-              (int)sizeof(st.st_uid));
-
-   printf("   st_gid: off %2d sz %d\n", 
-              offsetof(struct stat, st_gid),
-              (int)sizeof(st.st_gid));
-
-   printf("   st_dev: off %2d sz %d\n", 
-              offsetof(struct stat, st_dev),
-              (int)sizeof(st.st_dev));
-
-   printf("   st_ino: off %2d sz %d\n", 
-              offsetof(struct stat, st_ino),
-              (int)sizeof(st.st_ino));
-
-   printf("\n");
-   printf("#define VKI_STX_NORMAL  %d\n", (int)STX_NORMAL);
-   printf("\n");
-   printf("sizeof(size_t) = %d\n", (int)sizeof(size_t) );
-   printf("\n");
-   printf("#define VKI_SEEK_SET %d\n", SEEK_SET);
-   printf("#define VKI_PATH_MAX %d\n", PATH_MAX);
-
-   /* info about struct iovec */
-   struct iovec iov;
-   printf("\nsizeof(struct iovec) = %d\n", (int)sizeof(struct iovec));
-   printf("  iov_base: off %2d sz %d\n", 
-             offsetof(struct iovec, iov_base),
-             (int)sizeof(iov.iov_base));
-   printf("  iov_len: off %2d sz %d\n", 
-             offsetof(struct iovec, iov_len),
-             (int)sizeof(iov.iov_len));
-
-   printf("\n");
-   printf("#define _VKI_IOC_NONE %d\n",  3 & (IOC_VOID >> 30));
-   printf("#define _VKI_IOC_READ %d\n",  3 & (IOC_OUT >> 30));
-   printf("#define _VKI_IOC_WRITE %d\n", 3 & (IOC_IN >> 30));
-   printf("\n");
-   printf("/* ---------------- MMappery ---------------- */\n");
-   printf("\n");
-   printf("#define VKI_PAGE_SIZE %d\n", (int)sysconf(_SC_PAGESIZE));
-   printf("\n");
-   printf("#define VKI_PROT_NONE  0x%08x\n", PROT_NONE);
-   printf("#define VKI_PROT_READ  0x%08x\n", PROT_READ);
-   printf("#define VKI_PROT_WRITE 0x%08x\n", PROT_WRITE);
-   printf("#define VKI_PROT_EXEC  0x%08x\n", PROT_EXEC);
-   printf("\n");
-   printf("#define VKI_MAP_FIXED     0x%08x\n", MAP_FIXED);
-   printf("#define VKI_MAP_PRIVATE   0x%08x\n", MAP_PRIVATE);
-   printf("#define VKI_MAP_ANONYMOUS 0x%08x\n", MAP_ANONYMOUS);
-   printf("\n");
-   printf("/* ---------------- RLimitery ---------------- */\n");
-   printf("\n");
-   printf("#define VKI_RLIMIT_DATA   0x%08x\n", RLIMIT_DATA);
-   printf("#define VKI_RLIMIT_NOFILE 0x%08x\n", RLIMIT_NOFILE);
-   printf("#define VKI_RLIMIT_STACK  0x%08x\n", RLIMIT_STACK);
-   printf("#define VKI_RLIMIT_CORE   0x%08x\n", RLIMIT_CORE);
-
-   /* info about struct rlimit */
-   struct rlimit rl;
-   printf("\nsizeof(struct rlimit) = %d\n", (int)sizeof(struct rlimit));
-   printf("  rlim_cur: off %2d sz %d\n", 
-             offsetof(struct rlimit, rlim_cur),
-             (int)sizeof(rl.rlim_cur));
-   printf("  rlim_max: off %2d sz %d\n", 
-             offsetof(struct rlimit, rlim_max),
-             (int)sizeof(rl.rlim_max));
-   printf("\n");
-   printf("/* ---------------- Time ---------------- */\n");
-   printf("\n");
-
-   /* print info about struct timeval */
-   struct timeval tv;
-   printf("sizeof(struct timeval) = %d\n", (int)sizeof(struct timeval));
-   printf("   tv_sec: off %2d sz %d\n", 
-              offsetof(struct timeval, tv_sec),
-              (int)sizeof(tv.tv_sec));
-   printf("  tv_usec: off %2d sz %d\n", 
-             offsetof(struct timeval, tv_usec),
-             (int)sizeof(tv.tv_usec));
-
-   /* print info about struct timespec */
-   struct timespec ts;
-   printf("\nsizeof(struct timespec) = %d\n", (int)sizeof(struct timespec));
-   printf("   tv_sec: off %2d sz %d\n", 
-              offsetof(struct timespec, tv_sec),
-              (int)sizeof(ts.tv_sec));
-   printf("  tv_nsec: off %2d sz %d\n", 
-             offsetof(struct timespec, tv_nsec),
-             (int)sizeof(ts.tv_nsec));
-
-   printf("\n");
-   printf("/* ---------------- Signals ---------------- */\n");
-   printf("\n");
-   printf("#define _VKI_NSIG       %ld\n", 8 * sizeof(sigset_t) );
-   printf("\n");
-   printf("#define VKI_SIGSEGV   %d\n", SIGSEGV);
-   printf("#define VKI_SIGBUS    %d\n", SIGBUS);
-   printf("#define VKI_SIGFPE    %d\n", SIGFPE);
-   printf("#define VKI_SIGHUP    %d\n", SIGHUP);
-   printf("#define VKI_SIGINT    %d\n", SIGINT);
-   printf("#define VKI_SIGQUIT   %d\n", SIGQUIT);
-   printf("#define VKI_SIGABRT   %d\n", SIGABRT);
-   printf("#define VKI_SIGUSR1   %d\n", SIGUSR1);
-   printf("#define VKI_SIGUSR2   %d\n", SIGUSR2);
-   printf("#define VKI_SIGPIPE   %d\n", SIGPIPE);
-   printf("#define VKI_SIGALRM   %d\n", SIGALRM);
-   printf("#define VKI_SIGTERM   %d\n", SIGTERM);
-   printf("/* VKI_SIGSTKFLT does not exist on AIX 5.2 */\n");
-   printf("#define VKI_SIGTTIN   %d\n", SIGTTIN);
-   printf("#define VKI_SIGTTOU   %d\n", SIGTTOU);
-   printf("#define VKI_SIGXCPU   %d\n", SIGXCPU);
-   printf("#define VKI_SIGXFSZ   %d\n", SIGXFSZ);
-   printf("#define VKI_SIGVTALRM %d\n", SIGVTALRM);
-   printf("#define VKI_SIGPROF   %d\n", SIGPROF);
-   printf("#define VKI_SIGIO     %d\n", SIGIO);
-   printf("#define VKI_SIGPWR    %d\n", SIGPWR);
-   printf("/* VKI_SIGUNUSED does not exist on AIX 5.2 */\n");
-   printf("#define VKI_SIGRTMIN  %d\n", SIGRTMIN);
-   printf("#define VKI_SIGRTMAX  %d\n", SIGRTMAX);
-   printf("#define VKI_SIGTRAP   %d\n", SIGTRAP);
-   printf("#define VKI_SIGCONT   %d\n", SIGCONT);
-   printf("#define VKI_SIGCHLD   %d\n", SIGCHLD);
-   printf("#define VKI_SIGWINCH  %d\n", SIGWINCH);
-   printf("#define VKI_SIGURG    %d\n", SIGURG);
-   printf("#define VKI_SIGILL    %d\n", SIGILL);
-   printf("#define VKI_SIGSTOP   %d\n", SIGSTOP);
-   printf("#define VKI_SIGKILL   %d\n", SIGKILL);
-   printf("#define VKI_SIGTSTP   %d\n", SIGTSTP);
-   printf("#define VKI_SIGSYS    %d\n", SIGSYS);
-
-   /* print info about struct sigaction */
-   struct sigaction sa;
-   printf("\n");
-   printf("sizeof(struct sigaction) = %d\n", (int)sizeof(struct sigaction));
-   printf("  sa_handler: off %2d sz %d\n", 
-             offsetof(struct sigaction, sa_handler),
-             (int)sizeof(sa.sa_handler));
-   printf("     sa_mask: off %2d sz %d\n", 
-                offsetof(struct sigaction, sa_mask),
-                (int)sizeof(sa.sa_mask));
-   printf("    sa_flags: off %2d sz %d\n", 
-               offsetof(struct sigaction, sa_flags),
-               (int)sizeof(sa.sa_flags));
-   printf("sa_sigaction: off %2d sz %d\n", 
-               offsetof(struct sigaction, sa_sigaction),
-               (int)sizeof(sa.sa_sigaction));
-   printf("\n");
-   printf("#define VKI_SA_ONSTACK    %d\n",SA_ONSTACK );
-   printf("#define VKI_SA_RESTART    %d\n",SA_RESTART );
-   printf("#define VKI_SA_RESETHAND  %d\n",SA_RESETHAND );
-   printf("#define VKI_SA_SIGINFO    %d\n",SA_SIGINFO);
-   printf("#define VKI_SA_NODEFER    %d\n",SA_NODEFER );
-   //  printf("#define VKI_SA_NOMASK %d\n",SA_NOMASK ) ;
-   //  printf("#define VKI_SA_ONESHOT %d\n",SA_ONESHOT );
-   printf("#define VKI_SA_NOCLDSTOP  %d\n",SA_NOCLDSTOP );
-   printf("#define VKI_SA_NOCLDWAIT  %d\n",SA_NOCLDWAIT );
-   //  printf("#define VKI_SA_RESTORER %d\n",SA_RESTORER );
-   printf("\n");
-   printf("#define VKI_SS_ONSTACK %d\n",SS_ONSTACK );
-   printf("#define VKI_SS_DISABLE %d\n",SS_DISABLE );
-   printf("\n");
-   printf("#define VKI_MINSIGSTKSZ %ld\n",MINSIGSTKSZ );
-   printf("\n");
-   printf("#define VKI_SI_USER  %d\n",SI_USER );
-   printf("\n");
-   printf("#define VKI_SIG_BLOCK    %d\n",SIG_BLOCK );
-   printf("#define VKI_SIG_SETMASK  %d\n",SIG_SETMASK );
-   printf("#define VKI_SIG_UNBLOCK  %d\n",SIG_UNBLOCK );
-   printf("#define VKI_SIG_IGN      (void*)%d\n",(int)SIG_IGN );
-   printf("#define VKI_SIG_DFL      (void*)%d\n",(int)SIG_DFL );
-   printf("\n");
-   //  printf("#define VKI_SI_TKILL %d\n",SI_TKILL );
-   printf("#define VKI_SI_USER  %d\n",SI_USER );
-   printf("\n");
-   printf("#define VKI_SEGV_ACCERR %d\n", SEGV_ACCERR);
-   printf("#define VKI_SEGV_MAPERR %d\n", SEGV_MAPERR);
-   printf("\n");
-   printf("#define VKI_TRAP_TRACE %d\n", TRAP_TRACE);
-   printf("#define VKI_TRAP_BRKPT %d\n", TRAP_BRKPT);
-   printf("#define VKI_BUS_OBJERR %d\n", BUS_OBJERR);
-   printf("#define VKI_BUS_ADRERR %d\n", BUS_ADRERR);
-   printf("#define VKI_BUS_ADRALN %d\n", BUS_ADRALN);
-   printf("#define VKI_FPE_FLTSUB %d\n", FPE_FLTSUB);
-   printf("#define VKI_FPE_FLTINV %d\n", FPE_FLTINV);
-   printf("#define VKI_FPE_FLTRES %d\n", FPE_FLTRES);
-   printf("#define VKI_FPE_FLTUND %d\n", FPE_FLTUND);
-   printf("#define VKI_FPE_FLTOVF %d\n", FPE_FLTOVF);
-   printf("#define VKI_FPE_FLTDIV %d\n", FPE_FLTDIV);
-   printf("#define VKI_FPE_INTOVF %d\n", FPE_INTOVF);
-   printf("#define VKI_FPE_INTDIV %d\n", FPE_INTDIV);
-   printf("\n");
-   printf("#define VKI_ILL_BADSTK %d\n", ILL_BADSTK);
-   printf("#define VKI_ILL_COPROC %d\n", ILL_COPROC);
-   printf("#define VKI_ILL_PRVREG %d\n", ILL_PRVREG);
-   printf("#define VKI_ILL_PRVOPC %d\n", ILL_PRVOPC);
-   printf("#define VKI_ILL_ILLTRP %d\n", ILL_ILLTRP);
-   printf("#define VKI_ILL_ILLADR %d\n", ILL_ILLADR);
-   printf("#define VKI_ILL_ILLOPN %d\n", ILL_ILLOPN);
-   printf("#define VKI_ILL_ILLOPC %d\n", ILL_ILLOPC);
-
-   /* info about siginfo_t */
-   siginfo_t si;
-   printf("\nsizeof(siginfo_t) = %d\n", (int)sizeof(siginfo_t));
-   printf("   si_signo: off %2d sz %d\n", 
-                   offsetof(siginfo_t, si_signo),
-                   (int)sizeof(si.si_signo));
-   printf("    si_code: off %2d sz %d\n", 
-                   offsetof(siginfo_t, si_code),
-                   (int)sizeof(si.si_code));
-   printf("     si_pid: off %2d sz %d\n",
-                   offsetof(siginfo_t, si_pid),
-                   (int)sizeof(si.si_pid));
-   printf("    si_addr: off %2d sz %d\n", 
-                   offsetof(siginfo_t, si_addr),
-                   (int)sizeof(si.si_addr));
-
-   /* info about sigaltstack */
-   stack_t ss;
-   printf("\nsizeof(stack_t) = %d\n", (int)sizeof(stack_t));
-   printf("    ss_sp: off %2d sz %d\n", 
-                   offsetof(stack_t, ss_sp),
-                   (int)sizeof(ss.ss_sp));
-   printf("  ss_size: off %2d sz %d\n", 
-                   offsetof(stack_t, ss_size),
-                   (int)sizeof(ss.ss_size));
-   printf(" ss_flags: off %2d sz %d\n", 
-                   offsetof(stack_t, ss_flags),
-                   (int)sizeof(ss.ss_flags));
-
-   printf("\n");
-   printf("/* ---------------- Misc ---------------- */\n");
-   printf("\n");
-   printf("#define VKI_PTRACE_TRACEME %d\n", PT_TRACE_ME);
-   printf("#define VKI_PTRACE_DETACH %d\n", PT_DETACH);
-   printf("\n");
-
-#if 0
-   printf("#define VKI_  %d\n", );
-   printf("#define VKI_  %d\n", );
-   printf("#define VKI_  %d\n", );
-   printf("#define VKI_  %d\n", );
-
-   printf("#define VKI_  0x%08x\n", );
-   printf("#define VKI_  0x%08x\n", );
-   printf("#define VKI_  0x%08x\n", );
-   printf("#define VKI_  0x%08x\n", );
-#endif
-   return 0;
-}
diff --git a/auxprogs/aix5_proc_self_sysent.c b/auxprogs/aix5_proc_self_sysent.c
deleted file mode 100644
index 380a17a..0000000
--- a/auxprogs/aix5_proc_self_sysent.c
+++ /dev/null
@@ -1,37 +0,0 @@
-
-/* A program which prints its own syscall name-to-number bindings.
-   Used to generate the basis of include/vki/vki-scnums-aix5.h and
-   coregrind/m_vkiscnums.c. */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <assert.h>
-
-#include <sys/procfs.h>
-
-#define NN 100000
-char buf[NN];
-int nbuf = 0;
-
-int main ( void )
-{
-  int i;
-  char name[50];
-  sprintf(name, "/proc/%d/sysent", getpid());
-  FILE* f = fopen(name, "r");
-  assert(f);
-  nbuf = fread(buf, 1, NN, f);
-  assert(nbuf > 0 && nbuf <= NN);
-
-  prsysent_t* header = (prsysent_t*)&buf[0];
-  if (0) printf("Found %u syscalls\n\n", header->pr_nsyscalls);
-
-  for (i = 0; i < header->pr_nsyscalls; i++) {
-    printf("%3u  %s\n", header->pr_syscall[i].pr_number,
-	   &buf[ header->pr_syscall[i].pr_nameoff ]);
-  }
-
-  fclose(f);
-  return 0;
-}
diff --git a/configure.in b/configure.in
index 16e5c7f..13d75e3 100644
--- a/configure.in
+++ b/configure.in
@@ -82,8 +82,7 @@
 AC_MSG_CHECKING([for diff -u])
 AC_SUBST(DIFF)
 
-# Comparing two identical files results in 0, unless -u isn't supported (as
-# it's not on AIX).
+# Comparing two identical files results in 0.
 tmpfile="tmp-xxx-yyy-zzz"
 touch $tmpfile;
 if diff -u $tmpfile $tmpfile ; then
@@ -139,23 +138,14 @@
         ;;
 
      powerpc64)
-        # This value can only happen on Linux, not on AIX
         AC_MSG_RESULT([ok (${host_cpu})])
         ARCH_MAX="ppc64"
         ;;
 
      powerpc)
-        # Complexity.  'powerpc' on AIX implies a 64-bit capable CPU.
-        # Whereas in Linux that means only a 32-bit capable CPU.
+        # On Linux this means only a 32-bit capable CPU.
         AC_MSG_RESULT([ok (${host_cpu})])
-	case "${host_os}" in
-	   aix5.*)
-	      ARCH_MAX="ppc64"
-              ;;
-           *)
-              ARCH_MAX="ppc32"
-              ;;
-        esac
+        ARCH_MAX="ppc32"
         ;;
 
      s390x)
@@ -243,19 +233,6 @@
 
         ;;
 
-     aix5.1.*)
-        AC_MSG_RESULT([ok (${host_os})])
-        VGCONF_OS="aix5"
-        ;;
-     aix5.2.*)
-        AC_MSG_RESULT([ok (${host_os})])
-        VGCONF_OS="aix5"
-        ;;       
-     aix5.3.*)
-        AC_MSG_RESULT([ok (${host_os})])
-        VGCONF_OS="aix5"
-        ;;       
-
      *darwin*)
         AC_MSG_RESULT([ok (${host_os})])
         VGCONF_OS="darwin"
@@ -426,29 +403,6 @@
         valt_load_address_sec_inner="0xUNSET"
         AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
 	;;
-     ppc64-aix5)
-        valt_load_address_pri_norml="0xUNSET"
-        valt_load_address_pri_inner="0xUNSET"
-        valt_load_address_sec_norml="0xUNSET"
-        valt_load_address_sec_inner="0xUNSET"
-	if test x$vg_cv_only64bit = xyes; then
-           VGCONF_ARCH_PRI="ppc64"
-           VGCONF_ARCH_SEC=""
-	   VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
-	   VGCONF_PLATFORM_SEC_CAPS=""
-	elif test x$vg_cv_only32bit = xyes; then
-	   VGCONF_ARCH_PRI="ppc32"
-           VGCONF_ARCH_SEC=""
-	   VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
-	   VGCONF_PLATFORM_SEC_CAPS=""
-	else
-	   VGCONF_ARCH_PRI="ppc64"
-           VGCONF_ARCH_SEC="ppc32"
-	   VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
-	   VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
-	fi
-        AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
-	;;
      ppc64-linux)
         valt_load_address_sec_norml="0xUNSET"
         valt_load_address_sec_inner="0xUNSET"
@@ -564,12 +518,9 @@
                  -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32, 
                test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \ 
-                 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
-                 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \ 
-                 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
+                 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64, 
-               test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
-                 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
+               test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX )
 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,   
                test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
@@ -593,12 +544,6 @@
                test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
                  -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
 
-AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5, 
-               test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \ 
-                 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
-AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5, 
-               test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
-
 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,   
                test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
                  -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
@@ -616,9 +561,6 @@
                  -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
                  -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
                  -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX)
-AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
-               test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
-                 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
                test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
                  -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
@@ -672,14 +614,6 @@
   GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
 fi
 
-AC_EGREP_CPP([AIX5_LIBC], [
-#include <standards.h>
-#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
-  AIX5_LIBC
-#endif
-],
-GLIBC_VERSION="aix5")
-
 # not really a version check
 AC_EGREP_CPP([DARWIN_LIBC], [
 #include <sys/cdefs.h>
@@ -786,11 +720,6 @@
 	DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
 	DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
 	;;
-     aix5)
-	AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
-	AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
-	DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
-	;;
      darwin)
 	AC_MSG_RESULT(Darwin)
 	AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
@@ -800,7 +729,6 @@
      *)
 	AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
 	AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.14])
-	AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
 	AC_MSG_ERROR([or Darwin libc])
 	;;
 esac
@@ -1094,27 +1022,6 @@
 AC_SUBST(FLAG_M32)
 
 
-# does this compiler support -maix32 ?
-AC_MSG_CHECKING([if gcc accepts -maix32])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-maix32"
-
-AC_TRY_COMPILE(, [
-  return 0;
-],
-[
-FLAG_MAIX32="-maix32"
-AC_MSG_RESULT([yes])
-], [
-FLAG_MAIX32=""
-AC_MSG_RESULT([no])
-])
-CFLAGS=$safe_CFLAGS
-
-AC_SUBST(FLAG_MAIX32)
-
-
 # does this compiler support -m64 ?
 AC_MSG_CHECKING([if gcc accepts -m64])
 
@@ -1136,27 +1043,6 @@
 AC_SUBST(FLAG_M64)
 
 
-# does this compiler support -maix64 ?
-AC_MSG_CHECKING([if gcc accepts -maix64])
-
-safe_CFLAGS=$CFLAGS
-CFLAGS="-maix64"
-
-AC_TRY_COMPILE(, [
-  return 0;
-],
-[
-FLAG_MAIX64="-maix64"
-AC_MSG_RESULT([yes])
-], [
-FLAG_MAIX64=""
-AC_MSG_RESULT([no])
-])
-CFLAGS=$safe_CFLAGS
-
-AC_SUBST(FLAG_MAIX64)
-
-
 # does this compiler support -mmmx ?
 AC_MSG_CHECKING([if gcc accepts -mmmx])
 
@@ -1711,36 +1597,26 @@
 #----------------------------------------------------------------------------
 # Do we have a useable MPI setup on the primary and/or secondary targets?
 # On Linux, by default, assumes mpicc and -m32/-m64
-# On AIX, by default, assumes mpxlc and -q32/-q64
 # Note: this is a kludge in that it assumes the specified mpicc 
-# understands -m32/-m64/-q32/-q64 regardless of what is specified using
+# understands -m32/-m64 regardless of what is specified using
 # --with-mpicc=.
 MPI_CC="mpicc"
-if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
-     -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
-  MPI_CC="mpxlc"
-fi
 
 mflag_primary=
 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
-     -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
+     -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
+     -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ; then
   mflag_primary=$FLAG_M32
 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
        -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
        -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
   mflag_primary=$FLAG_M64
-elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
-  mflag_primary=-q32
-elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
-  mflag_primary=-q64
 fi
 
 mflag_secondary=
 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
      -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
   mflag_secondary=$FLAG_M32
-elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
-  mflag_secondary=-q32
 fi
 
 
@@ -2023,8 +1899,6 @@
                 [chmod +x coregrind/link_tool_exe_linux])
 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
                 [chmod +x coregrind/link_tool_exe_darwin])
-AC_CONFIG_FILES([coregrind/link_tool_exe_aix5],
-                [chmod +x coregrind/link_tool_exe_aix5])
 AC_OUTPUT
 
 cat<<EOF
diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
index 160cd93..c056401 100644
--- a/coregrind/Makefile.am
+++ b/coregrind/Makefile.am
@@ -31,20 +31,13 @@
 
 bin_PROGRAMS = \
 	valgrind \
-	vgdb \
-	no_op_client_for_valgrind
+	vgdb
 
 if VGCONF_OS_IS_LINUX
 valgrind_SOURCES = \
 	launcher-linux.c \
 	m_debuglog.c
 endif
-if VGCONF_OS_IS_AIX5
-valgrind_SOURCES = \
-	launcher-aix5.c \
-	m_debuglog.c \
-	m_vkiscnums.c
-endif
 if VGCONF_OS_IS_DARWIN
 valgrind_SOURCES = \
 	launcher-darwin.c \
@@ -68,15 +61,6 @@
 vgdb_LDFLAGS   += -Wl,-read_only_relocs -Wl,suppress
 endif
 
-no_op_client_for_valgrind_SOURCES = no_op_client_for_valgrind.c
-no_op_client_for_valgrind_CPPFLAGS  = $(AM_CPPFLAGS_PRI)
-no_op_client_for_valgrind_CFLAGS    = $(AM_CFLAGS_PRI)
-no_op_client_for_valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI)
-no_op_client_for_valgrind_LDFLAGS   = $(AM_CFLAGS_PRI)
-if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
-no_op_client_for_valgrind_LDFLAGS   += -Wl,-read_only_relocs -Wl,suppress
-endif
-
 #----------------------------------------------------------------------------
 # Darwin Mach stuff
 #----------------------------------------------------------------------------
@@ -139,7 +123,6 @@
 #----------------------------------------------------------------------------
 
 noinst_HEADERS = \
-	launcher-aix5-bootblock.h \
 	pub_core_aspacehl.h	\
 	pub_core_aspacemgr.h	\
 	pub_core_basics.h	\
@@ -206,7 +189,6 @@
 	m_debuginfo/priv_readdwarf3.h	\
 	m_debuginfo/priv_readelf.h	\
 	m_debuginfo/priv_readmacho.h	\
-	m_debuginfo/priv_readxcoff.h	\
 	m_demangle/ansidecl.h	\
 	m_demangle/cp-demangle.h \
 	m_demangle/dyn-string.h	\
@@ -226,7 +208,6 @@
 	m_syswrap/priv_syswrap-generic.h \
 	m_syswrap/priv_syswrap-linux.h \
 	m_syswrap/priv_syswrap-linux-variants.h \
-	m_syswrap/priv_syswrap-aix5.h \
 	m_syswrap/priv_syswrap-darwin.h \
 	m_syswrap/priv_syswrap-main.h \
 	m_ume/priv_ume.h
@@ -283,10 +264,8 @@
 	m_aspacehl.c \
 	m_aspacemgr/aspacemgr-common.c \
 	m_aspacemgr/aspacemgr-linux.c \
-	m_aspacemgr/aspacemgr-aix5.c \
 	m_coredump/coredump-elf.c \
 	m_coredump/coredump-macho.c \
-	m_coredump/coredump-xcoff.c \
 	m_debuginfo/misc.c \
 	m_debuginfo/d3basics.c \
 	m_debuginfo/debuginfo.c \
@@ -296,7 +275,6 @@
 	m_debuginfo/readmacho.c \
 	m_debuginfo/readpdb.c \
 	m_debuginfo/readstabs.c \
-	m_debuginfo/readxcoff.c \
 	m_debuginfo/storage.c \
 	m_debuginfo/tytypes.c \
 	m_demangle/cp-demangle.c \
@@ -310,8 +288,6 @@
 	m_dispatch/dispatch-ppc64-linux.S \
 	m_dispatch/dispatch-arm-linux.S \
 	m_dispatch/dispatch-s390x-linux.S \
-	m_dispatch/dispatch-ppc32-aix5.S \
-	m_dispatch/dispatch-ppc64-aix5.S \
 	m_dispatch/dispatch-x86-darwin.S \
 	m_dispatch/dispatch-amd64-darwin.S \
 	m_gdbserver/m_gdbserver.c \
@@ -332,7 +308,6 @@
 	m_gdbserver/valgrind-low-s390x.c \
 	m_gdbserver/version.c \
 	m_initimg/initimg-linux.c \
-	m_initimg/initimg-aix5.c \
 	m_initimg/initimg-darwin.c \
 	m_initimg/initimg-pathscan.c \
 	m_mach/mach_basics.c \
@@ -348,8 +323,6 @@
 	m_sigframe/sigframe-ppc64-linux.c \
 	m_sigframe/sigframe-arm-linux.c \
 	m_sigframe/sigframe-s390x-linux.c \
-	m_sigframe/sigframe-ppc32-aix5.c \
-	m_sigframe/sigframe-ppc64-aix5.c \
 	m_sigframe/sigframe-x86-darwin.c \
 	m_sigframe/sigframe-amd64-darwin.c \
 	m_syswrap/syscall-x86-linux.S \
@@ -358,15 +331,12 @@
 	m_syswrap/syscall-ppc64-linux.S \
 	m_syswrap/syscall-arm-linux.S \
 	m_syswrap/syscall-s390x-linux.S \
-	m_syswrap/syscall-ppc32-aix5.S \
-	m_syswrap/syscall-ppc64-aix5.S \
 	m_syswrap/syscall-x86-darwin.S \
 	m_syswrap/syscall-amd64-darwin.S \
 	m_syswrap/syswrap-main.c \
 	m_syswrap/syswrap-generic.c \
 	m_syswrap/syswrap-linux.c \
 	m_syswrap/syswrap-linux-variants.c \
-	m_syswrap/syswrap-aix5.c \
 	m_syswrap/syswrap-darwin.c \
 	m_syswrap/syswrap-x86-linux.c \
 	m_syswrap/syswrap-amd64-linux.c \
@@ -374,8 +344,6 @@
 	m_syswrap/syswrap-ppc64-linux.c \
 	m_syswrap/syswrap-arm-linux.c \
 	m_syswrap/syswrap-s390x-linux.c \
-	m_syswrap/syswrap-ppc32-aix5.c \
-	m_syswrap/syswrap-ppc64-aix5.c \
 	m_syswrap/syswrap-x86-darwin.c \
 	m_syswrap/syswrap-amd64-darwin.c \
 	m_ume/elf.c \
@@ -406,9 +374,6 @@
     $(AM_CCASFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 endif
 
-libcoregrind_ppc32_aix5_a_AR = $(AR) -X32 cru
-libcoregrind_ppc64_aix5_a_AR = $(AR) -X64 cru
-
 #----------------------------------------------------------------------------
 # libreplacemalloc_toolpreload-<platform>.a
 #----------------------------------------------------------------------------
@@ -433,10 +398,6 @@
 	$(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) $(AM_CFLAGS_PIC)
 endif
 
-# Special AR for AIX.
-libreplacemalloc_toolpreload_ppc32_aix5_a_AR = $(AR) -X32 cru
-libreplacemalloc_toolpreload_ppc64_aix5_a_AR = $(AR) -X64 cru
-
 #----------------------------------------------------------------------------
 # vgpreload_core-<platform>.a
 #----------------------------------------------------------------------------
diff --git a/coregrind/launcher-aix5-bootblock.h b/coregrind/launcher-aix5-bootblock.h
deleted file mode 100644
index 74d0f68..0000000
--- a/coregrind/launcher-aix5-bootblock.h
+++ /dev/null
@@ -1,90 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Structure written into the child process by launcher-aix5.c. ---*/
-/*---                                    launcher-aix5-bootblock.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-
-/* This is the structure written into the child process by the AIX5
-   launcher.  The tool's entry point (see bottom of
-   coregrind/m_main.c) must be aware of the layout as it will have to
-   read info from it at startup.  This struct is designed to work
-   equally well in 32- and 64-bit mode.  It must be placed at an
-   8-aligned address in the child. */
-
-#define N_BOOTBLOCK_INSNS    60  /* number of insns */
-#define N_BOOTBLOCK_ERRMSG   64  /* max bytes in the error message */
-#define N_BOOTBLOCK_TOOLFILE 256 /* max bytes in the tool file name */
-
-typedef
-
-   struct {
-      /* Adler32 checksum of the uncompressed data of the compressed
-	 page (the second part of which contains this struct. */
-      /*   0 */ UInt adler32;
- 
-      /* The system call numbers for enough critical syscalls that the
-         tool can start both debug logging and also read the
-         /proc/../sysent file. */
-      /*   4 */ UInt __NR_getpid;
-      /*   8 */ UInt __NR_write;
-      /*  12 */ UInt __NR_exit;
-      /*  16 */ UInt __NR_open;
-      /*  20 */ UInt __NR_read;
-      /*  24 */ UInt __NR_close;
-      /*  28 */ UInt __off28;
-
-      /* The 37 integer registers for the client, as they should be at
-         startup.  On 32-bit targets the registers are stored in the
-         lower half of each quadword, which, since this is a bigendian
-         platform, is the higher-addressed 4 bytes. */
-      /* MUST BE 8-aligned */
-      /*  32 */ ULong iregs_pc_cr_lr_ctr_xer[37];
-
-      /* The instructions for the bootstrap loader. */
-      /* 328 */ UInt code[N_BOOTBLOCK_INSNS];
-
-      /* A zero-terminated error message to be used when the bootstrap
-         loader fails. */
-      /* 628 */ UChar errmsg[N_BOOTBLOCK_ERRMSG];
-
-      /* The name of the tool file, again zero-terminated. */
-      /* 692 */ UChar toolfile[N_BOOTBLOCK_TOOLFILE];
-
-      /* 1024 */
-   }
-   AIX5Bootblock;
-
-/*--------------------------------------------------------------------*/
-/*--- end                                launcher-aix5-bootblock.h ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/launcher-aix5.c b/coregrind/launcher-aix5.c
deleted file mode 100644
index 6a1b199..0000000
--- a/coregrind/launcher-aix5.c
+++ /dev/null
@@ -1,1712 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Launching Valgrind on AIX5.                  launcher-aix5.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-/* Cut-down version of the normal launcher, except it is completely
-   different on AIX5.  Does not handle shell scripts, only real
-   machine code XCOFF executables.
-
-   Note: this is a "normal" program and not part of Valgrind proper,
-   and so it doesn't have to conform to Valgrind's arcane rules on
-   no-glibc-usage etc.
-*/
-
-#include <stdio.h>
-#include <assert.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/ptrace.h>
-#include <sys/wait.h>
-
-/* Get both struct __ld_info32 and struct __ld_info64. */
-#define __LDINFO_PTRACE32__ 1
-#define __LDINFO_PTRACE64__ 1
-#include <sys/ldr.h>
-
-#include <sys/reg.h>     /* GPR0 .. GPR31 */
-#include <sys/procfs.h>  /* prsysent_t */
-
-#include "pub_core_debuglog.h"
-#include "pub_core_vki.h"
-#include "pub_core_vkiscnums.h"
-#include "pub_core_libcproc.h"  // For VALGRIND_LIB, VALGRIND_LAUNCHER
-
-/* Get the definition for the AIX5Bootblock structure.  This is what
-   we will generate and patch into the child's address space. */
-#include "launcher-aix5-bootblock.h"
-
-/* Simple routines for Huffman compression/decompression */
-#include "m_initimg/simple_huffman.c"
-
-
-/* -------------------------------------------------------------- */
-/* ---                                                        --- */
-/* --- A uniform interface to the ptrace facilities we need.  --- */
-/* ---                                                        --- */
-/* -------------------------------------------------------------- */
-
-typedef
-   struct {
-      pid_t pid;
-      Bool  is64;
-   } 
-   Child;
-
-
-/* Read len bytes from target's rsrc to local ldst.  Returns True if
-   error. */
-static 
-Bool ptrace_READ_BLOCK ( Child* ch, Int len, void* ldst, Addr64 rsrc )
-{
-   Int r;
-   assert(len >= 0 && len <= 1024);
-   r = ptrace64( PT_READ_BLOCK, (ULong)ch->pid, rsrc, len, ldst );
-   if (r == len)
-      return False; /* success */
-   return True; /* error */
-}
-
-
-/* Write len bytes to target's rdst from local lsrc.  Returns True if
-   error. */
-static
-Bool ptrace_WRITE_BLOCK ( Child* child, Int len, Addr64 rdst, void* lsrc )
-{
-   Int r;
-   assert(len >= 0 && len <= 1024);
-   r = ptrace64( PT_WRITE_BLOCK, (ULong)child->pid, rdst, len, lsrc );
-   if (r == len)
-      return False; /* success */
-   return True; /* error */
-}
-
-
-/* Read a GPR from the target.  Returns True if error. */
-static
-Bool ptrace_READ_GPR ( Child* child, Int reg, ULong* ldst )
-{
-   ULong w64;
-   UInt  w32;
-   errno = 0;
-   if (child->is64) {
-      (void)ptrace64( PT_READ_GPR, 
-                      (ULong)child->pid, (ULong)reg, 8, (Int*)(&w64) );
-      if (errno != 0) return True; /* error */
-   } else {
-      w32 = ptrace64( PT_READ_GPR, 
-                      (ULong)child->pid, (ULong)reg, 0, 0 );
-      if (errno != 0) return True; /* error */
-      w64 = (ULong)w32;
-   }
-   *ldst = w64;
-   return False; /* success */
-}
-
-
-/* Write a GPR to the target.  Returns True if error. */
-static
-Bool ptrace_WRITE_GPR ( Child* child, Int reg, ULong val )
-{
-   ULong w64;
-   UInt w32;
-   errno = 0;
-   if (child->is64) {
-      w64 = val;
-      (void)ptrace64( PT_WRITE_GPR,
-                      (ULong)child->pid, (ULong)reg, 8, (Int*)&w64 );
-      if (errno != 0) return True; /* error */
-   } else {
-      w32 = (UInt)val;
-      (void)ptrace64( PT_WRITE_GPR, 
-                      (ULong)child->pid, (ULong)reg, w32, 0 );
-      if (errno != 0) return True; /* error */
-   }
-   return False; /* success */
-}
-
-
-/* -------------------------------------------------------------- */
-/* ---                                                        --- */
-/* --- Helper functions                                       --- */
-/* ---                                                        --- */
-/* -------------------------------------------------------------- */
-
-/* Search the path for the client program */
-static const char* find_client ( const char* clientname )
-{
-   static char fullname[PATH_MAX];
-   const char *path = getenv("PATH");
-   const char *colon;
-
-   while (path)
-   {
-      if ((colon = strchr(path, ':')) == NULL)
-      {
-         strcpy(fullname, path);
-         path = NULL;
-      }
-      else
-      {
-         memcpy(fullname, path, colon - path);
-         fullname[colon - path] = '\0';
-         path = colon + 1;
-      }
-      strcat(fullname, "/");
-      strcat(fullname, clientname);
-
-      if (access(fullname, R_OK|X_OK) == 0)
-         return fullname;
-    }
-
-    return clientname;
-}
-
-/* Examine the given file.  If it looks like valid XCOFF32 return 32,
-   if valid XCOFF64 return 64, else return 0. */
-static Int examine_client ( const char* clientname )
-{
-   UChar buf[16];
-   Int n;
-   FILE* f = fopen( clientname, "r" );
-   if (f == NULL)
-      return 0;
-   n = fread( buf, 1, 16, f );
-   fclose(f);
-   if (n != 16)
-      return 0;
-   if (buf[0] == 0x01 && buf[1] == 0xDF)
-      return 32; /* XCOFF32 */
-   if (buf[0] == 0x01 && buf[1] == 0xF7)
-      return 64; /* XCOFF64 */
-   return 0;
-}
-
-static Bool file_exists ( char* fname )
-{
-   struct stat buf;
-   int r = stat(fname, &buf);
-   return r == 0;
-}
-
-static Addr64 ROUNDDN_PAGE ( Addr64 v )
-{
-   ULong p = (ULong)v;
-   ULong a = PAGE_SIZE;
-   p &= ~(a-1);
-   return (Addr64)p;
-}
-
-static Bool IS_PAGE_ALIGNED ( Addr64 v )
-{
-   ULong p = (ULong)v;
-   ULong a = PAGE_SIZE;
-   if (p & (a-1))
-      return False;
-   else
-      return True;
-}
-
-static Bool IS_8_ALIGNED ( Addr64 v )
-{
-   ULong p = (ULong)v;
-   ULong a = 8;
-   if (p & (a-1))
-      return False;
-   else
-      return True;
-}
-
-
-/* Read a 4096-byte page from CHILD's address space at location SRC,
-   into local address space at DST.  Returns True if error, False
-   otherwise.
-*/
-static Bool ptrace_read_page ( Child* child, UChar* ldst, Addr64 rsrc )
-{
-   Int  off;
-   Bool err;
-
-   assert(IS_PAGE_ALIGNED(rsrc));
-
-   off = 0;
-   err = ptrace_READ_BLOCK(child, 1024, ldst + off, rsrc + off);
-   if (err) return err;
-
-   off += 1024;
-   err = ptrace_READ_BLOCK(child, 1024, ldst + off, rsrc + off);
-   if (err) return err;
-
-   off += 1024;
-   err = ptrace_READ_BLOCK(child, 1024, ldst + off, rsrc + off);
-   if (err) return err;
-
-   off += 1024;
-   err = ptrace_READ_BLOCK(child, 1024, ldst + off, rsrc + off);
-   if (err) return err;
-
-   off += 1024;
-   assert(off == PAGE_SIZE);
-
-   return False;
-}
-
-
-/* Write a 4096-byte page from local address space at SRC to CHILD's
-   address space at location DST.  Returns True if error, False
-   otherwise.
-*/
-static Bool ptrace_write_page ( Child* child, Addr64 rdst, UChar* lsrc )
-{
-   Int  off;
-   Bool err;
-
-   assert(IS_PAGE_ALIGNED(rdst));
-
-   off = 0;
-   err = ptrace_WRITE_BLOCK(child, 1024, rdst + off, lsrc + off);
-   if (err) return err;
-
-   off += 1024;
-   err = ptrace_WRITE_BLOCK(child, 1024, rdst + off, lsrc + off);
-   if (err) return err;
-
-   off += 1024;
-   err = ptrace_WRITE_BLOCK(child, 1024, rdst + off, lsrc + off);
-   if (err) return err;
-
-   off += 1024;
-   err = ptrace_WRITE_BLOCK(child, 1024, rdst + off, lsrc + off);
-   if (err) return err;
-
-   off += 1024;
-   assert(off == PAGE_SIZE);
-
-   return False;
-}
-
-
-/* Get 37 integer registers (GPR0 .. GPR31, PC, CR, LR, CTR, XER) from
-   CHILD into the given array.  Returns True if there is any kind of
-   error. */
-static 
-Bool ptrace_get_iregs_pc_cr_lr_ctr_xer ( 
-        Child* child, 
-        /*OUT*/ULong* iregs_pc_cr_lr_ctr_xer 
-     )
-{
-   Int  i, j;
-   Bool err;
-
-   for (i = GPR0; i <= GPR31; i++) {
-      j = i - GPR0;
-      assert(j >= 0 && j < 32);
-      err = ptrace_READ_GPR( child, i, &iregs_pc_cr_lr_ctr_xer[j] );
-      if (err) return err;
-   }
-
-   /* PC */
-   err = ptrace_READ_GPR( child, IAR, &iregs_pc_cr_lr_ctr_xer[32+0] );
-   if (err) return err;
-
-   /* CR */
-   err = ptrace_READ_GPR( child, CR, &iregs_pc_cr_lr_ctr_xer[32+1] );
-   if (err) return err;
-
-   /* LR */
-   err = ptrace_READ_GPR( child, LR, &iregs_pc_cr_lr_ctr_xer[32+2] );
-   if (err) return err;
-
-   /* CTR */
-   err = ptrace_READ_GPR( child, CTR, &iregs_pc_cr_lr_ctr_xer[32+3] );
-   if (err) return err;
-
-   /* XER */
-   err = ptrace_READ_GPR( child, XER, &iregs_pc_cr_lr_ctr_xer[32+4] );
-   if (err) return err;
-
-   return False;
-}
-
-
-/* Set CHILD's program counter to the given value.  Returns True if
-   there is any kind of error. */
-static 
-Bool ptrace_put_pc ( Child* child, ULong newpc )
-{
-   return ptrace_WRITE_GPR( child, IAR, newpc );
-}
-
-
-/* Set CHILD's R31 to the given value.  Returns True if there is any
-   kind of error. */
-static 
-Bool ptrace_put_r31 ( Child* child, ULong newr31 )
-{
-   return ptrace_WRITE_GPR( child, GPR31, newr31 );
-}
-
-
-/* ------ Instruction generators ------ */
-
-static UInt mkFormD ( UInt opc1, UInt r1, UInt r2, UInt imm )
-{
-   UInt theInstr;
-   assert(opc1 < 0x40);
-   assert(r1   < 0x20);
-   assert(r2   < 0x20);
-   imm = imm & 0xFFFF;
-   theInstr = ((opc1<<26) | (r1<<21) | (r2<<16) | (imm));
-   return theInstr;
-}
-static UInt mkFormX ( UInt opc1, 
-                      UInt r1, UInt r2, UInt r3, UInt opc2, UInt b0 )
-{
-   UInt theInstr;
-   assert(opc1 < 0x40);
-   assert(r1   < 0x20);
-   assert(r2   < 0x20);
-   assert(r3   < 0x20);
-   assert(opc2 < 0x400);
-   assert(b0   < 0x2);
-   theInstr = ((opc1<<26) | (r1<<21) | (r2<<16) |
-               (r3<<11) | (opc2<<1) | (b0));
-   return theInstr;
-}
-static UInt mkFormXFX ( UInt r1, UInt f2, UInt opc2 )
-{
-   UInt theInstr;
-   assert(r1   < 0x20);
-   assert(f2   < 0x20);
-   assert(opc2 < 0x400);
-   switch (opc2) {
-   case 144:  // mtcrf
-      assert(f2 < 0x100);
-      f2 = f2 << 1;
-      break;
-   case 339:  // mfspr
-   case 371:  // mftb
-   case 467:  // mtspr
-      assert(f2 < 0x400);
-      // re-arrange split field
-      f2 = ((f2>>5) & 0x1F) | ((f2 & 0x1F)<<5);
-      break;
-   default: assert(0);
-   }
-   theInstr = ((31<<26) | (r1<<21) | (f2<<11) | (opc2<<1));
-   return theInstr;
-}
-static UInt mkFormMD ( UInt opc1, UInt r1, UInt r2,
-                       UInt imm1, UInt imm2, UInt opc2 )
-{
-   UInt theInstr;
-   assert(opc1 < 0x40);
-   assert(r1   < 0x20);
-   assert(r2   < 0x20);
-   assert(imm1 < 0x40);
-   assert(imm2 < 0x40);
-   assert(opc2 < 0x08);
-   imm2 = ((imm2 & 0x1F) << 1) | (imm2 >> 5);
-   theInstr = ((opc1<<26) | (r1<<21) | (r2<<16) |
-               ((imm1 & 0x1F)<<11) | (imm2<<5) |
-               (opc2<<2) | ((imm1 >> 5)<<1));
-   return theInstr;
-}
-static UInt mkFormXO ( UInt opc1, UInt r1, UInt r2,
-                       UInt r3, UInt b10, UInt opc2, UInt b0 )
-{
-   UInt theInstr;
-   assert(opc1 < 0x40);
-   assert(r1   < 0x20);
-   assert(r2   < 0x20);
-   assert(r3   < 0x20);
-   assert(b10  < 0x2);
-   assert(opc2 < 0x200);
-   assert(b0   < 0x2);
-   theInstr = ((opc1<<26) | (r1<<21) | (r2<<16) |
-               (r3<<11) | (b10 << 10) | (opc2<<1) | (b0));
-   return theInstr;
-}
-
-static UInt gen_lis_r_N ( UInt r, UInt N ) {
-   return mkFormD(15, r, 0, N & 0xFFFF); /* lis r,r,N */
-}
-static UInt gen_ori_r_r_N ( UInt r, UInt N ) {
-   return mkFormD(24, r, r, N & 0xFFFF); /* ori r,r,N */
-}
-static UInt gen_addi_rd_rs_N ( UInt rd, UInt rs, UInt N ) {
-   assert(rs != 0);
-   return mkFormD(14, rd, rs, N & 0xFFFF); /* addi rd,rs,N */
-}
-static UInt gen_addis_rd_rs_N ( UInt rd, UInt rs, UInt N ) {
-   assert(rs != 0);
-   return mkFormD(15, rd, rs, N & 0xFFFF); /* addis rd,rs,N */
-}
-static UInt gen_crorc_6_6_6 ( void ) {
-   return 0x4CC63342; /* crorc 6,6,6 */
-}
-static UInt gen_mr_rd_rs ( UInt rd, UInt rs ) {
-   return mkFormX(31, rs, rd, rs, 444, 0); /* or rd,rs,ts */
-}
-static UInt gen_bl_next ( void ) {
-   return 0x48000005; /* bl .+4 */
-}
-static UInt gen_mflr_r ( UInt r ) {
-   return mkFormXFX(r, 8, 339); /* mflr r */
-}
-static UInt gen_mtlr_r ( UInt r ) {
-   return mkFormXFX(r, 8, 467); /* mtlr r */
-}
-static UInt gen_blr ( void ) {
-   return 0x4E800020; /* blr */
-}
-__attribute__((unused))
-static UInt gen_blrl ( void ) {
-   return 0x4E800021; /* blrl */
-}
-static UInt gen_add_r_N ( UInt r, UInt N ) {
-   return mkFormD(14, r, r, N & 0xFFFF); /* addi r,r,N */
-}
-static UInt gen_cmpli_cr7_r_N ( UInt r, UInt N ) {
-   return mkFormD(10, 7<<2, r, N & 0xFFFF); /* cmpli cr7,r,N */
-}
-static UInt gen_bne_cr7_delta ( UInt delta ) {
-   return 0x409E0000 | (delta & 0x0000FFFC); /* bne- cr7,delta */
-}
-__attribute__((unused))
-static UInt gen_beq_cr7_delta ( UInt delta ) {
-   return 0x419E0000 | (delta & 0x0000FFFC); /* beq- cr7,delta */
-}
-static UInt gen_sc ( void ) {
-   return 0x44000002; /* sc */
-}
-static UInt gen_lwz_rd_off_ra ( UInt rd, UInt off, UInt ra ) {
-   return mkFormD(32, rd, ra, off); /* lwz rd, off(ra) */
-}
-static UInt gen_add_rd_rL_rR (UInt rd, UInt rsrcL, UInt rsrcR ) {
-   return mkFormXO(31, rd, rsrcL, rsrcR, 0, 266, 0);
-}
-static UInt gen_subf_rd_rL_rR (UInt rd, UInt rsrcL, UInt rsrcR ) {
-   return mkFormXO(31, rd, rsrcL, rsrcR, 0, 40, 0);
-}
-
-static Int emit_insn ( UInt* code, Int ix, UInt insn ) {
-   code[ix++] = insn;
-   return ix;
-}
-static Int emit_li32 ( UInt* code, Int ix, UInt rd, UInt imm32 ) {
-   code[ix++] = gen_lis_r_N(rd, imm32 >> 16);
-   if (imm32 & 0xFFFF)
-      code[ix++] = gen_ori_r_r_N(rd, imm32 & 0xFFFF);
-   return ix;
-}
-static Int emit_dosc ( UInt* code, Int ix ) {
-   /* Generate code to do a syscall and continue at the next insn.
-      Note: trashes r29. */
-   code[ix++] = gen_crorc_6_6_6();
-   code[ix++] = gen_bl_next();
-   code[ix++] = gen_mflr_r(29);
-   code[ix++] = gen_add_r_N(29,16);
-   code[ix++] = gen_mtlr_r(29);
-   code[ix++] = gen_sc();
-   return ix;
-}
-
-/* Generate 64-bit insns */
-static Int emit_li64 ( UInt* code, Int ix, UInt rd, ULong imm64 ) {
-   if (imm64 >= 0xFFFFFFFF80000000ULL || imm64 < 0x80000000ULL) {
-      // sign-extendable from 32 bits
-      // addis rd,r0,(imm64>>16) => lis rd, (imm64>>16)
-      code[ix++] = mkFormD(15, rd, 0, (imm64>>16) & 0xFFFF);
-      // ori rd, rd, (imm64 & 0xFFFF)
-      code[ix++] = mkFormD(24, rd, rd, imm64 & 0xFFFF);
-   } else {
-      // load high word
-      // lis rd, (imm64>>48) & 0xFFFF
-      code[ix++] = mkFormD(15, rd, 0, (imm64>>48) & 0xFFFF);
-      // ori rd, rd, (imm64>>32) & 0xFFFF
-      code[ix++] = mkFormD(24, rd, rd, (imm64>>32) & 0xFFFF);
-      // shift rd low word to high word => rldicr
-      code[ix++] = mkFormMD(30, rd, rd, 32, 31, 1);
-      // load low word
-      // oris rd, rd, (imm64>>16) & 0xFFFF
-      code[ix++] = mkFormD(25, rd, rd, (imm64>>16) & 0xFFFF);
-      // ori rd, rd, (imm64) & 0xFFFF
-      code[ix++] = mkFormD(24, rd, rd, imm64 & 0xFFFF);
-   }
-   return ix;
-}
-static UInt gen_ld_rd_off_ra ( UInt rd, UInt off, UInt ra ) {
-   assert((off & 3) == 0);
-   return mkFormD(58, rd, ra, off); /* ld rd, off(ra) */
-}
-
-static UInt compute_adler32 ( void* addr, UWord len )
-{
-   UInt   s1 = 1;
-   UInt   s2 = 0;
-   UChar* buf = (UChar*)addr;
-   while (len > 0) {
-      s1 += buf[0];
-      s2 += s1;
-      s1 %= 65521;
-      s2 %= 65521;
-      len--;
-      buf++;
-   }
-   return (s2 << 16) + s1;
-}
-
-
-/* -------------------------------------------------------------- */
-/* ---                                                        --- */
-/* --- BEGIN write bootstrap loader into child process        --- */
-/* ---                                                        --- */
-/* -------------------------------------------------------------- */
-
-/* From using truss, __loadx is used to load a module into a running
-   process in 32-bit mode, and kload in 64-bit mode.  __loadx is
-   simple: it returns a pointer to a standard function descriptor to
-   the entry point.
-
-   kload isn't: it returns a pointer which, from examination of
-   /proc/<pid>/maps, doesn't point into the loaded object image.  It
-   does appear to point to some kind of struct, words [4] and [6] of
-   which do point into the loaded object image.  From comparison with
-   /proc/<pid>/maps, they are respectively the actual VMAs of the text
-   and data sections of the loaded module.
-
-   Knowing this it is possible to find the entry point descriptor:
-   - figure out where the auxiliary header is.  We have a pointer to
-     the start of the mapped text section, so just add the size of
-     the XCOFF file header to that.
-   - figure out the data bias.  We know the avma of the data section;
-     and the svma of it is in the auxiliary header in field
-     o_data_start.  The data bias is therefore the difference between
-     them.
-   - The auxiliary header also gives the svma of the entry point
-     descriptor; (o_entry); therefore its avma is o_entry + the data
-     bias.
-
-   ULong* kr  = (result of kload)
-   // r3 is this value
-
-   AOUTHDR* aux = kr[4] (text_avma) + 24 (size of XCOFF file header);
-   // ld 9,32(3)     kr[4]
-   // addi 9,9,24    + 24
-   // 9=aux
-
-   ULong data_avma = kr[6];
-   // ld 11,48(3)    kr[6]
-   // 9=aux
-   // 11=data_avma
-
-   ULong data_svma = aux->o_data_start;
-   // ld 0,16(9)     aux->o_data_start
-   // 9=aux
-   // 11=data_avma
-   // 0=data_svma
-
-   ULong data_bias = data_avma - data_svma;
-   // subf 11,0,11
-   // 9=aux
-   // 11=data_bias
-   // 0=data_svma
-
-   ULong ent_svma = (ULong)aux->o_entry;
-   // ld 9,80(9)   aux->o_entry
-   // 9=ent_svma
-   // 11=data_bias
-   // 0=data_svma
-
-   ULong ent_avma = ent_svma + data_bias;
-   // add 10,9,11
-   // 9=ent_svma
-   // 11=data_bias
-   // 0=data_svma
-   // 10=ent_avma
-*/
-
-#define LAUNCHER_SYSENT_SIZE 100000
-static char sysent_buf[LAUNCHER_SYSENT_SIZE];
-
-/* The executable loaded must have no more than N_LDINFOs direct
-   shared-object dependencies.  Just increase this value and rebuild,
-   if you ever run out.  We have two arrays, one for each kind of
-   target process. */
-#define N_LDINFOs 1000
-static  struct __ld_info32  ld_info32_array[N_LDINFOs];
-static  struct __ld_info64  ld_info64_array[N_LDINFOs];
-
-
-static 
-UChar* bootstrap_errmsg 
-         = "\nvalgrind: bootstrap loader failed.  Cannot continue.\n\n";
-
-
-/* Write the bootstrap loader and associated data (iow, an
-   AIX5Bootblock structure) into CHILD, so that when
-   ptrace-detached, it will continue by loading TOOLNAME and
-   continuing with that.  Returns NULL on success or an error string
-   on failure. */
-
-static char* write_bootstrap_loader_into_child 
-                ( Child* child, char* toolfile )
-{
-   /* ------ STEP 1: Fill in most parts of the bootblock. ------ */
-
-   /* All parts except code[], off_zdata and len_zdata. */
-
-   AIX5Bootblock block;
-
-   VG_(debugLog)(1, "launcher", "parent: size of bootblock is %ld\n",
-                    sizeof(AIX5Bootblock));
-
-   assert(IS_8_ALIGNED( sizeof(AIX5Bootblock) ));
-
-   memset(&block, 0, sizeof(block));
-
-   /* --- OFFSETS--- */
-
-   /* off_zdata not known yet */
-   /* len_zdata not known yet */
-
-   /* --- SYSCALL NUMBERS --- */
-
-   /* Read some system call entries from the child's
-      /proc/<pid>/sysent file. */
-   char        sysent_name[50];
-   FILE*       sysent_file;
-   int         sysent_used = 0;
-   prsysent_t* sysent_hdr;
-   int         i;
-
-   VG_(debugLog)(1, "launcher", 
-                    "parent: reading child's /proc/../sysent\n");
-
-   sprintf(sysent_name, "/proc/%d/sysent", child->pid);
-   sysent_file = fopen(sysent_name, "r");
-   if (sysent_file == NULL)
-      return "Can't open child's /proc/<pid>/sysent file";
-
-   sysent_used = fread(sysent_buf, 1, LAUNCHER_SYSENT_SIZE, sysent_file);
-   if (sysent_used == 0)
-      return "Error reading child's /proc/<pid>/sysent file";
-   if (sysent_used == LAUNCHER_SYSENT_SIZE)
-      return "LAUNCHER_SYSENT_SIZE is too low; increase and recompile";
-   assert(sysent_used > 0 && sysent_used < LAUNCHER_SYSENT_SIZE);
-
-   fclose(sysent_file);
-
-   sysent_hdr = (prsysent_t*)&sysent_buf[0];
-
-   /* Find some syscall numbers for the child. */
-   Int __nr__getpid = -1;
-   Int __nr_kwrite  = -1;
-   Int __nr___loadx = -1; /* 32-bit child only */
-   Int __nr_kload   = -1; /* 64-bit child only */
-   Int __nr__exit   = -1;
-   Int __nr_open    = -1;
-   Int __nr_kread   = -1;
-   Int __nr_close   = -1;
-
-   for (i = 0; i < sysent_hdr->pr_nsyscalls; i++) {
-      char* name = &sysent_buf[ sysent_hdr->pr_syscall[i].pr_nameoff ];
-      int   nmbr = sysent_hdr->pr_syscall[i].pr_number;
-      if (0 == strcmp(name, "_getpid"))
-         __nr__getpid = nmbr;
-      if (0 == strcmp(name, "kwrite"))
-          __nr_kwrite = nmbr;
-      if (0 == strcmp(name, "__loadx"))
-          __nr___loadx = nmbr;
-      if (0 == strcmp(name, "kload"))
-          __nr_kload = nmbr;
-      if (0 == strcmp(name, "_exit"))
-          __nr__exit = nmbr;
-      if (0 == strcmp(name, "open"))
-          __nr_open = nmbr;
-      if (0 == strcmp(name, "kread"))
-          __nr_kread = nmbr;
-      if (0 == strcmp(name, "close"))
-          __nr_close = nmbr;
-   }
-
-   if (__nr__getpid == -1 
-       || __nr_kwrite == -1 
-       || ((!child->is64) && __nr___loadx == -1)
-       || ((child->is64) && __nr_kload == -1)
-       || __nr__exit == -1
-       || __nr_open == -1 
-       || __nr_kread == -1 
-       || __nr_close == -1)
-      return "can't establish syscall #s needed for bootstrap";
-
-   block.__NR_getpid = __nr__getpid;
-   block.__NR_write  = __nr_kwrite;
-   block.__NR_exit   = __nr__exit;
-   block.__NR_open   = __nr_open;
-   block.__NR_read   = __nr_kread;
-   block.__NR_close  = __nr_close;
-
-   /* --- REGS --- */
-
-   /* Continue by copying out the child's current integer register
-      state. */
-   VG_(debugLog)(1, "launcher", 
-                    "parent: reading child's int registers\n");
-
-   Bool err = ptrace_get_iregs_pc_cr_lr_ctr_xer 
-                 ( child, &block.iregs_pc_cr_lr_ctr_xer[0] );
-   if (err)
-      return "read of child's int registers failed";
-
-   /* --- CODE --- */
-
-   /* We'll leave that till last (is difficult). */
-
-   /* --- ERRMSG --- */
-
-   if (1 + strlen(bootstrap_errmsg) > N_BOOTBLOCK_ERRMSG)
-      return "bootstrap error message won't fit in bootblock";
-
-   for (i = 0; bootstrap_errmsg[i]; i++)
-      block.errmsg[i] = bootstrap_errmsg[i];
-   assert(i <= N_BOOTBLOCK_ERRMSG);
-
-   /* --- TOOLFILE --- */
-
-   if (1 + strlen(toolfile) > N_BOOTBLOCK_TOOLFILE)
-      return "tool file path is too long, won't fit in bootblock";
-
-   for (i = 0; toolfile[i]; i++)
-      block.toolfile[i] = toolfile[i];
-   assert(i <= N_BOOTBLOCK_TOOLFILE);
-
-
-   /* ------ STEP 2: Generate the bootblock code. ------ */
-
-   VG_(debugLog)(1, "launcher", 
-                    "parent: creating bootblock code ..\n");
-
-   /* This is the tricky bit.  The resulting code has to be position
-      independent since we don't yet know where it's going to be
-      placed.  The code is entered with r31 pointing at the bootblock.
-      r29-31 are callee-saved, so presumably they don't get trashed
-      across syscalls.  r30 is used as scratch, and r29 is also used
-      as scratch by 'emit_dosc'. */
-
-   /* Preliminaries: to do a syscall, we have to do 'crorc 6,6,6' and
-      put the continuation address in LR, which is a bit of a drag.
-      Hence the following macro:
-
-         SYSCALL_SEQUENCE = crorc 6,6,6
-                            bl   .+4
-                            mflr 29
-                            addi 29,29,16
-                            mtlr 29
-                            sc
-
-      Also: 'imm' is an imaginary instruction to get a 32-bit literal into
-      a register.  It's really li followed by oris.
-   */
-
-   /* So, the code.  First, prepare for and do a _loadx syscall, to
-      get the tool aboard:
-         addis 1, 1, -4
-         imm  2, __NR__loadx
-         imm  3, VKI_DL_LOAD
-         mr   4, 1
-         imm  5, 3<<16
-         addi 6, 31, offset_of_toolfile
-         mr   7, 4
-         mr   8, 4
-         mr   9, 4
-         mr   10,4
-         SYSCALL_SEQUENCE
-         addis 1, 1, 4
-
-      If the syscall failed, r4 will be nonzero.  Branch elsewhere if so.
-         cmpi 4, 0
-         bne  error
-   */
-   int ix = 0;
-
-#  if 1
-#  define TRAP \
-      do { \
-         ix=emit_insn( &block.code[0],ix, 0x7fe00008 ); } \
-      while (0)
-#  define SEGV \
-      do { \
-         if (child->is64) { \
-            ix=emit_li64( &block.code[0],ix, 28,0); \
-            ix=emit_insn( &block.code[0],ix, \
-                          gen_ld_rd_off_ra(27,0xfffc,28)); \
-         } else { \
-            ix=emit_li32( &block.code[0],ix, 28,0); \
-            ix=emit_insn( &block.code[0],ix, \
-                          gen_lwz_rd_off_ra(27,0xffff,28)); \
-	 } \
-      } while (0)
-#  define ILL \
-      do { \
-         ix=emit_insn( &block.code[0],ix, 0 ); } \
-      while (0)      
-#  endif
-
-   if (child->is64) {
-
-      /* 64-bit sequence */
-      /* Set up for 'sys_kload(toolfile, 0, 0)'
-         li64  2, __NR_kload
-         addi  3, 31, offset_toolfile
-         li64  4, 0
-         mr    5, 4
-         mr    6, 4
-         mr    7, 4
-         mr    8, 4
-         mr    9, 4
-         mr    10,4
-         SYSCALL_SEQUENCE
-
-         // if kload failed, r3 will hold zero
-         cmpdi 3,0
-         beq error
-
-         // from result of kload, figure out entry point address
-         // as described above
-         ld   9,32(3)
-         addi 9,9,24
-         ld   11,48(3)
-         ld   0,16(9)
-         subf 11,0,11
-         ld   9,80(9)
-         add  10,9,11  // r10 is entry descriptor avma
-
-         void(*fn)(void*) = (void(*)(void*))ent_avma;
-         fn();
-         ld   9,0(10)
-         mtlr 9
-         ld   2,8(10)
-         ld   11,16(10)
-         mr   3,31  // arg to pass
-         blr
-      */
-      ix = emit_li64( &block.code[0],ix, 2, __nr_kload );
-      ix = emit_insn( &block.code[0],ix, 
-                      gen_addi_rd_rs_N(3,31,offsetof(AIX5Bootblock,toolfile)));
-      ix = emit_li64( &block.code[0],ix, 4, 0 );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(5,4) );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(6,4) );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(7,4) );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(8,4) );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(9,4) );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(10,4) );
-      ix = emit_dosc( &block.code[0],ix );
-
-      ix = emit_insn( &block.code[0],ix, gen_cmpli_cr7_r_N(3,0) );
-      Int ix_beq = ix; /* Patch this later */
-      ix = emit_insn( &block.code[0],ix, 0 );
-
-      ix = emit_insn( &block.code[0],ix, gen_ld_rd_off_ra( 9, 32, 3 ) );
-      ix = emit_insn( &block.code[0],ix, gen_addi_rd_rs_N( 9, 9, 24 ) );
-      ix = emit_insn( &block.code[0],ix, gen_ld_rd_off_ra( 11, 48, 3 ) );
-      ix = emit_insn( &block.code[0],ix, gen_ld_rd_off_ra( 0, 16, 9 ) );
-      ix = emit_insn( &block.code[0],ix, gen_subf_rd_rL_rR( 11, 0, 11 ) );
-      ix = emit_insn( &block.code[0],ix, gen_ld_rd_off_ra( 9, 80, 9 ) );
-      ix = emit_insn( &block.code[0],ix, gen_add_rd_rL_rR( 10, 9, 11 ) );
-
-      ix = emit_insn( &block.code[0],ix, gen_ld_rd_off_ra( 9, 0, 10 ) );
-      ix = emit_insn( &block.code[0],ix, gen_mtlr_r( 9 ) );
-      ix = emit_insn( &block.code[0],ix, gen_ld_rd_off_ra( 2, 8, 10 ) );
-      ix = emit_insn( &block.code[0],ix, gen_ld_rd_off_ra( 11, 16, 10 ) );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(3, 31) );
-      ix = emit_insn( &block.code[0],ix, gen_blr() );
-      TRAP;
-      assert(ix <= N_BOOTBLOCK_INSNS);
-
-      /* error:
-         We get here if the kload syscall fails.  Write a terse message
-         to stderr saying so, then exit, carrying the error code of the
-         kload call.  The latter is saved in r30 across the write() call.
-            mr   30,4 (4 contains the error result from kload)
-            imm  2, __NR_write
-            imm  3,2 (2=stderr)
-            addi 4, 31, offset_of_errormsg
-            imm  5, length(errormsg)
-            SYSCALL_SEQUENCE
-            imm  2, __NR_exit
-            mr   3, 30
-            SYSCALL_SEQUENCE
-   
-         Well, we shouldn't be alive here.  But just in case we do, put
-         a zero word, which will generate SIGILL and definitely stop the
-         party.
-            .word 0
-      */
-      /* fill in the conditional jump */
-      (void)emit_insn( &block.code[0],ix_beq, 
-                                      gen_beq_cr7_delta(4*(ix-ix_beq)));
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(30,4) );
-      ix = emit_li64( &block.code[0],ix, 2, __nr_kwrite);
-      ix = emit_li64( &block.code[0],ix, 3, 2);
-      ix = emit_insn( &block.code[0],ix, 
-                      gen_addi_rd_rs_N(4,31,offsetof(AIX5Bootblock,errmsg)));
-      ix = emit_li64( &block.code[0],ix, 5, strlen(bootstrap_errmsg));
-      ix = emit_dosc( &block.code[0],ix );
-      ix = emit_li64( &block.code[0],ix, 2, __nr__exit);
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(3,30) );
-      ix = emit_dosc( &block.code[0],ix );
-      ix = emit_insn( &block.code[0],ix, 0 );
-      assert(ix <= N_BOOTBLOCK_INSNS);
-
-   } else {
-
-      /* 32-bit sequence */
-      ix = emit_insn( &block.code[0],ix,
-                      gen_addis_rd_rs_N(1,1,-4) );
-      ix = emit_li32( &block.code[0],ix, 2, __nr___loadx );
-      ix = emit_li32( &block.code[0],ix, 3, VKI_DL_LOAD );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(4,1) );
-      ix = emit_li32( &block.code[0],ix, 5, 3<<16 );
-      ix = emit_insn( &block.code[0],ix, 
-                      gen_addi_rd_rs_N(6,31,offsetof(AIX5Bootblock,toolfile)));
-      ix = emit_li32( &block.code[0],ix, 7, 0);
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(8,7) );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(9,7) );
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(10,7) );
-      ix = emit_dosc( &block.code[0],ix );
-      ix = emit_insn( &block.code[0],ix,
-		      gen_addis_rd_rs_N(1,1,4) );
-      ix = emit_insn( &block.code[0],ix, gen_cmpli_cr7_r_N(4,0) );
-      Int ix_bne = ix; /* Patch this later */
-      ix = emit_insn( &block.code[0],ix, 0 );
-      assert(ix <= N_BOOTBLOCK_INSNS);
-
-      /* Looks like we're good.  r3 now points at a standard function
-         descriptor for the entry point of the module we just loaded.
-         Load r2/r11 from the descriptor, then put the address of the
-         bootstrap area in r3, and jump to the code address.  Not a
-         call -- we don't intend to return here.  Note, must use r30
-         as scratch here since r31 is live.
-            lwz  30, 0(3)
-            mtlr 30
-            lwz  2, 4(3)
-            lwz  11, 8(3)
-            mr   3, 31
-            blr
-      */
-      ix = emit_insn( &block.code[0],ix, gen_lwz_rd_off_ra(30, 0, 3));
-      ix = emit_insn( &block.code[0],ix, gen_mtlr_r(30) );
-      ix = emit_insn( &block.code[0],ix, gen_lwz_rd_off_ra( 2, 4, 3));
-      ix = emit_insn( &block.code[0],ix, gen_lwz_rd_off_ra(11, 8, 3));
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(3,31));
-      ix = emit_insn( &block.code[0],ix, gen_blr() );
-      assert(ix <= N_BOOTBLOCK_INSNS);
-
-      /* error:
-         We get here if the _loadx syscall fails.  Write a terse message
-         to stderr saying so, then exit, carrying the error code of the
-         _loadx call.  The latter is saved in r30 across the write() call.
-            mr   30,4 (4 contains the error result from __loadx)
-            imm  2, __NR_write
-            imm  3,2 (2=stderr)
-            addi 4, 31, offset_of_errormsg
-            imm  5, length(errormsg)
-            SYSCALL_SEQUENCE
-            imm  2, __NR_exit
-            mr   3, 30
-            SYSCALL_SEQUENCE
-   
-         Well, we shouldn't be alive here.  But just in case we do, put
-         a zero word, which will generate SIGILL and definitely stop the
-         party.
-            .word 0
-      */
-      /* fill in the conditional jump */
-      (void)emit_insn( &block.code[0],ix_bne, 
-                                      gen_bne_cr7_delta(4*(ix-ix_bne)));
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(30,4) );
-      ix = emit_li32( &block.code[0],ix, 2, __nr_kwrite);
-      ix = emit_li32( &block.code[0],ix, 3, 2);
-      ix = emit_insn( &block.code[0],ix, 
-                      gen_addi_rd_rs_N(4,31,offsetof(AIX5Bootblock,errmsg)));
-      ix = emit_li32( &block.code[0],ix, 5, strlen(bootstrap_errmsg));
-      ix = emit_dosc( &block.code[0],ix );
-      ix = emit_li32( &block.code[0],ix, 2, __nr__exit);
-      ix = emit_insn( &block.code[0],ix, gen_mr_rd_rs(3,30) );
-      ix = emit_dosc( &block.code[0],ix );
-      ix = emit_insn( &block.code[0],ix, 0 );
-      assert(ix <= N_BOOTBLOCK_INSNS);
-
-   }
-
-   VG_(debugLog)(1, "launcher", 
-                    "parent: .. %d instructions emitted\n", ix);
-
-#  if 0
-   for (i = 0; i < ix; i++) {
-      if (0) printf("code[%d] = 0x%08x\n", i, block.code[i]);
-      char buff[100];
-      sprintf(buff, "echo 0x%x | ./ascii2u32", block.code[i]);
-      system(buff);
-   }
-#  endif
-
-   /* ------ STEP 3: Find out where to place stuff in the child. ------ */
-
-   /* We'll have to hijack some space in the data section of the main
-      executable.  First off, find the first and last pages of said
-      data section.  We can't use the text section, because the child
-      is unable to write to its own text section, to undo the
-      compression of the hijacked page.  We can't use the stack
-      because it appears, although stacks in AIX 5.3 appear to be
-      executable, the child gets SIGKILL'd after the ptrace detach if
-      its program counter is pointing into its stack.  The data
-      section of the main executable appears to be executable, though,
-      so use that.
-
-      This requires wading though the list of loaded modules in the
-      child, to find the main executable. */
-
-   long lr;
-   if (child->is64) {
-      lr = ptrace64(PT_LDINFO, (ULong)child->pid,
-                               (ULong)(UWord)&ld_info64_array, 
-                               sizeof(ld_info64_array), 0/*ignored*/);
-   } else {
-      lr = ptrace64(PT_LDINFO, (ULong)child->pid,
-                               (ULong)(UWord)&ld_info32_array, 
-                               sizeof(ld_info32_array), 0/*ignored*/);
-   }
-   VG_(debugLog)(1, "launcher", "parent: ptrace PT_LDINFO got %ld\n", lr);
-   if (lr == -1)
-      return "ptrace(PT_LDINFO, ...) failed";
-   else 
-      assert(lr == 0);
-
-   /* We have to iterate through the entire array to close the object
-      files that this has opened.  Duh. */
-   if (child->is64) {
-      char* p = (char*)&ld_info64_array;
-      while (1) {
-         struct __ld_info64* info = (struct __ld_info64*)p;
-      
-         VG_(debugLog)(1, 
-            "launcher", "parent: text 0x%llx-0x%llx data 0x%llx-0x%llx\n",
-            (Addr64)info->ldinfo_textorg, 
-            (Addr64)info->ldinfo_textorg + (Addr64)info->ldinfo_textsize,
-            (Addr64)info->ldinfo_dataorg, 
-            (Addr64)info->ldinfo_dataorg + (Addr64)info->ldinfo_datasize
-         );
-
-         Int ir = close(info->_file._ldinfo_fd);
-         assert(ir == 0);
-         /* The last entry in the array is marked by having a zero
-            offset-link field. */
-         if (info->ldinfo_next == 0)
-            break;
-         p += info->ldinfo_next;
-      }
-   } else {
-      char* p = (char*)&ld_info32_array;
-      while (1) {
-         struct __ld_info32* info = (struct __ld_info32*)p;
-      
-         VG_(debugLog)(1, 
-            "launcher", "parent: text 0x%llx-0x%llx data 0x%llx-0x%llx\n",
-            (Addr64)(UWord)info->ldinfo_textorg, 
-            (Addr64)(UWord)info->ldinfo_textorg + info->ldinfo_textsize,
-            (Addr64)(UWord)info->ldinfo_dataorg, 
-            (Addr64)(UWord)info->ldinfo_dataorg + info->ldinfo_datasize
-         );
-
-         Int ir = close(info->_file._ldinfo_fd);
-         assert(ir == 0);
-         /* The last entry in the array is marked by having a zero
-            offset-link field. */
-         if (info->ldinfo_next == 0)
-            break;
-         p += info->ldinfo_next;
-      }
-   }
-
-   /* The first entry in that array -- and it is guaranteed to to have
-      at least one entry -- is that of the the main executable.  We
-      need to put our bootblock in one of the pages the main
-      executable's data segment.  The abovementioned AIX 'ptrace'
-      documentation says:
-
-        To allow a debugger to generate code more easily (in order to
-        handle fast trap instructions, for example), memory from the
-        end of the main program up to the next segment boundary can be
-        modified. That memory is read-only to the process but can be
-        modified by the debugger.
-
-      which would be great if it actually worked reliably; but not so.
-      On AIX 5.2 this is true, but on 5.3 it appears to be impossible
-      to read or write (via ptrace) anything beyond the last page of
-      the executable's text section.
-   */
-   Addr64 c_cand_text_first, c_cand_text_last;
-
-   if (child->is64) {
-      c_cand_text_first
-         = (Addr64)ld_info64_array[0].ldinfo_dataorg;
-      c_cand_text_last 
-         = c_cand_text_first
-           + ld_info64_array[0].ldinfo_datasize - 1;
-   } else {
-      c_cand_text_first
-         = (Addr64)(UWord)ld_info32_array[0].ldinfo_dataorg;
-      c_cand_text_last 
-         = c_cand_text_first
-           + ld_info32_array[0].ldinfo_datasize - 1;
-   }
-
-   VG_(debugLog)(1, "launcher", 
-                    "parent: candidate first 0x%llx last 0x%llx\n",
-                    c_cand_text_first, c_cand_text_last);
-
-   /* Page align the text section limits. */
-   Addr64 c_first_page = ROUNDDN_PAGE( c_cand_text_first );
-   Addr64 c_last_page  = ROUNDDN_PAGE( c_cand_text_last );
-
-   /* It's safe to try out any page p satisfying
-         c_first_page <= p && p <= c_last_page
-   */
-
-   /* CHOOSE A PAGE.  Do a test compression of available pages until
-      we find one for which compression yields enough free space to
-      put the bootblock in. */
-   Int    zsize;
-   Addr64 c_chosen_page = 0;
-   Addr64 c_page;
-   UChar  p_page_unzbuf[PAGE_SIZE];
-   UChar  p_page_unzbuf2[PAGE_SIZE];
-   UChar  p_page_zbuf[PAGE_SIZE + 384 + 8/*paranoia*/];
-
-   for (c_page = c_first_page; c_page <= c_last_page; c_page += PAGE_SIZE) {
-      assert(IS_PAGE_ALIGNED(c_page));
-      err = ptrace_read_page( child, p_page_unzbuf, c_page );
-      if (err)
-         return "read of page from child failed(1)";
-      zsize = Huffman_Compress(p_page_unzbuf, p_page_zbuf, PAGE_SIZE);
-      assert(zsize >= 0 && zsize <= PAGE_SIZE + 384);
-
-      /* Do a test decompression, to check the compress/decompress
-         cycle works properly */
-      Huffman_Uncompress( p_page_zbuf, p_page_unzbuf2, 
-                          PAGE_SIZE + 384, PAGE_SIZE);
-      assert(0 == memcmp(p_page_unzbuf, p_page_unzbuf2, PAGE_SIZE));
-
-      VG_(debugLog)(1, "launcher", 
-                       "parent: page 0x%llx has %d usable bytes\n", 
-                       c_page, PAGE_SIZE - zsize);
-
-      if ( (Int)(PAGE_SIZE - zsize) 
-           >= (Int)sizeof(AIX5Bootblock)+8/*paranoia*/) {
-         c_chosen_page = c_page;
-         break;
-      }
-   }
-
-   if (c_chosen_page == NULL)
-      return "can't find a page with enough free space for bootblock";
-
-   /* Compress the chosen page, leaving the compressed data at the
-      start of the page, and put the bootblock at the end of the
-      page. */
-
-   VG_(debugLog)(1, "launcher", 
-                    "parent: reading page at 0x%llx\n", c_chosen_page);
-
-   err = ptrace_read_page( child, p_page_unzbuf, c_chosen_page );
-   if (err)
-      return "read of page from child failed(2)";
-
-   block.adler32 = compute_adler32( p_page_unzbuf, PAGE_SIZE );
-   VG_(debugLog)(1, "launcher", 
-                    "parent: adler32 of unz page is 0x%x\n", block.adler32);
-
-   memset(p_page_zbuf, 0, sizeof(p_page_zbuf));
-   zsize = Huffman_Compress(p_page_unzbuf, p_page_zbuf, PAGE_SIZE);
-   assert(zsize >= 0 && zsize <= PAGE_SIZE + 384);
-
-   assert(PAGE_SIZE - zsize >= sizeof(AIX5Bootblock)+8/*paranoia*/);
-
-   UChar* p_dst = p_page_zbuf   + PAGE_SIZE - sizeof(AIX5Bootblock);
-   Addr64 c_dst = c_chosen_page + PAGE_SIZE - sizeof(AIX5Bootblock);
-   assert(IS_8_ALIGNED(c_dst));
-
-   VG_(debugLog)(1, "launcher", 
-                    "parent: free space starts at 0x%llx in child\n",
-                    c_chosen_page + zsize);
-   VG_(debugLog)(1, "launcher", 
-                    "parent: bootblock will be at 0x%llx in child\n",
-                    c_dst);
-
-   *(AIX5Bootblock*)p_dst = block;
-
-   VG_(debugLog)(1, "launcher", 
-                    "parent: writing page at 0x%llx\n", c_chosen_page);
-
-   err = ptrace_write_page( child, c_chosen_page, p_page_zbuf );
-   if (err)
-      return "write of page to child failed";
-
-   /* Do a test read back to ensure ptrace didn't screw up. */
-
-   err = ptrace_read_page( child, p_page_unzbuf2, c_chosen_page );
-   if (err)
-      return "test read back of boot page failed (1)";
-   if (0 != memcmp(p_page_zbuf, p_page_unzbuf2, PAGE_SIZE))
-      return "test read back of boot page failed (2)";
-
-   /* Finally .. set the program counter so that when we detach, our
-      magic stub is run, not the original program. */
-
-   VG_(debugLog)(1, "launcher", 
-                    "parent: set child's pc to 0x%llx\n",
-                    c_dst + offsetof(AIX5Bootblock,code) );
-   err = ptrace_put_pc ( child, c_dst + offsetof(AIX5Bootblock,code) );
-   if (err)
-      return "write of new initial pc into child failed";
-
-   VG_(debugLog)(1, "launcher", 
-                    "parent: set child's r31 to 0x%llx\n", c_dst);
-   err = ptrace_put_r31 ( child, c_dst );
-   if (err)
-      return "write of new r31 into child failed";
-
-   return NULL; /* success */
-}
-
-
-/* -------------------------------------------------------------- */
-/* ---                                                        --- */
-/* --- END write bootstrap loader into child process          --- */
-/* ---                                                        --- */
-/* -------------------------------------------------------------- */
-
-static void barf ( int exitcode, char* argv0, char* msg )
-{
-   fprintf(stderr, "%s: %s\n", argv0, msg);
-   exit(exitcode);
-}
-
-int main ( int argc, char** argv, char** envp )
-{
-   Child child;
-   Int i, loglevel;
-   const char *toolname = NULL;
-         char *clientname = NULL;
-
-   /* First, look in our own /proc/<pid>/sysent file to find
-      the syscall numbers for kwrite and _getpid.  These are needed
-      to make the VG_(debugLog) usable.  We'll temporarily use
-      the sysent_buf used by write_bootstrap_loader_into_child for this
-      purpose. */
-
-   char        sysent_name[50];
-   FILE*       sysent_file;
-   int         sysent_used = 0;
-   prsysent_t* sysent_hdr;
-
-   child.pid  = 0;
-   child.is64 = False;
-
-   sprintf(sysent_name, "/proc/%d/sysent", getpid());
-   sysent_file = fopen(sysent_name, "r");
-   if (sysent_file == NULL)
-      barf(1, argv[0], "Can't open my own /proc/<pid>/sysent file");
-
-   sysent_used = fread(sysent_buf, 1, LAUNCHER_SYSENT_SIZE, sysent_file);
-   if (sysent_used == 0)
-      barf(1, argv[0], "Error reading my own /proc/<pid>/sysent file");
-   if (sysent_used == LAUNCHER_SYSENT_SIZE)
-      barf(1, argv[0], "LAUNCHER_SYSENT_SIZE is too low; increase and recompile");
-   assert(sysent_used > 0 && sysent_used < LAUNCHER_SYSENT_SIZE);
-
-   fclose(sysent_file);
-
-   sysent_hdr = (prsysent_t*)&sysent_buf[0];
-
-   /* Find some syscall numbers for the child.  Note, we copy them
-      from our own /proc/../sysent file, which isn't really right. */
-   Word __nr__getpid = -1;
-   Word __nr_kwrite  = -1;
-   for (i = 0; i < sysent_hdr->pr_nsyscalls; i++) {
-      char* name = &sysent_buf[ sysent_hdr->pr_syscall[i].pr_nameoff ];
-      int   nmbr = sysent_hdr->pr_syscall[i].pr_number;
-      if (0 == strcmp(name, "_getpid"))
-         __nr__getpid = nmbr;
-      if (0 == strcmp(name, "kwrite"))
-          __nr_kwrite = nmbr;
-   }
-   if (__nr__getpid == -1 || __nr_kwrite == -1)
-      barf(1, argv[0], "can't establish syscall #s needed for startup");
-
-   /* "Tell" m_vkiscnums about them */
-   __NR_getpid = __nr__getpid;
-   __NR_write = __nr_kwrite;
-
-   /* Right, now we're safe to start the debug logging system. */
-   /* Start the debugging-log system ASAP.  First find out how many
-      "-d"s were specified.  This is a pre-scan of the command line.
-      At the same time, look for the tool name. */
-   loglevel = 0;
-   for (i = 1; i < argc; i++) {
-      if (argv[i][0] != '-') {
-         clientname = argv[i];
-         break;
-      }
-      if (0 == strcmp(argv[i], "--")) {
-         if (i+1 < argc)
-            clientname = argv[i+1];
-         break;
-      }
-      if (0 == strcmp(argv[i], "-d"))
-         loglevel++;
-      if (0 == strncmp(argv[i], "--tool=", 7))
-         toolname = argv[i] + 7;
-   }
-
-   /* ... and start the debug logger.  Now we can safely emit logging
-      messages all through startup. */
-   VG_(debugLog_startup)(loglevel, "Stage 1");
-
-   /* Make sure we know which tool we're using */
-   if (toolname) {
-      VG_(debugLog)(1, "launcher", "tool '%s' requested\n", toolname);
-   } else {
-      VG_(debugLog)(1, "launcher",
-                       "no tool requested, defaulting to 'memcheck'\n");
-      toolname = "memcheck";
-   }
-
-   /* Do some preliminary sanity checks */
-   long pagesize = sysconf(_SC_PAGESIZE);
-   if (pagesize != 4096)
-      barf(1, argv[0], "config error: sysconf(_SC_PAGESIZE) is not 4096");
-
-   assert(PAGE_SIZE == 4096); /* stay sane */
-
-   const char* valgrind_lib = VG_LIBDIR;
-
-   /* If there is no program to run, which will be the case if the
-      user just does "valgrind --help", etc, run a dummy do-nothing
-      program so at least the tool can get started and handle the
-      --help/--version etc.  It spots the fact that this is a dummy
-      program and acts like it was started with no program, hence
-      behaving the same as the Linux ports would have. */
-   if (clientname == NULL) {
-      Int j;
-      char** new_argv;
-      const char* noop_exe_name = "no_op_client_for_valgrind";
-      const char* up_n_bindir = "/../../bin";
-      clientname = malloc(strlen(valgrind_lib) + strlen(up_n_bindir)
-                          + 2 + strlen(noop_exe_name));
-      if (clientname == NULL) {
-         fprintf(stderr,"%s: malloc of clientname failed\n", argv[0]);
-         return 1;
-      }
-      sprintf(clientname, "%s%s/%s", valgrind_lib, up_n_bindir, noop_exe_name);
-      /* now we have to add it to the end of argv, which means making
-	 that one word longer.  How tedious. */
-      for (j = 0; argv[j]; j++)
-	;
-      j += 2; 
-      new_argv = calloc(j, sizeof(char*));
-      if (new_argv == NULL) {
-         fprintf(stderr,"%s: malloc of new_argv failed\n", argv[0]);
-         return 1;
-      }
-      for (i = 0; i < j-2; i++)
-	new_argv[i] = argv[i];
-      new_argv[j-2] = clientname;
-      assert(new_argv[j-1] == NULL);
-      argv = new_argv;
-      argc++;
-   }
-
-   if (argc < 2 || toolname == NULL || clientname == NULL)
-      barf(1, argv[0], "usage: valgrind [args-for-valgrind] prog args"); 
-
-   /* Find the client, and figure out if it's a 32- or 64-bit
-      executable. */
-   VG_(debugLog)(1, "launcher", "searching for client in $PATH\n");
-   if (strchr(clientname, '/') == NULL)
-      clientname = (char*)find_client(clientname);
-   VG_(debugLog)(1, "launcher", "found %s\n", clientname);
-
-   Int client_exekind = examine_client ( clientname );
-   switch (client_exekind) {
-      case 32: 
-         child.is64 = False; 
-         break;
-      case 64: 
-         child.is64 = True; 
-         break;
-      default: 
-         fprintf(stderr, "%s: requested executable %s\n", 
-                         argv[0], clientname);
-         fprintf(stderr, "%s: not found, or is not a valid XCOFF32 "
-                         "or XCOFF64 executable.\n", argv[0]);
-         return 1;
-   }
-
-   VG_(debugLog)(1, "launcher", "client is an XCOFF%d executable\n", 
-                    client_exekind);
-
-   const char* platform = child.is64 ? "ppc64-aix5" : "ppc32-aix5";
-
-   VG_(debugLog)(1, "launcher", "looking for the tool file\n");
-
-   char* toolfile = malloc(strlen(valgrind_lib) 
-                    + strlen(toolname) + strlen(platform) + 3);
-   if (toolfile == NULL) {
-      fprintf(stderr,"%s: malloc of toolfile failed\n", argv[0]);
-      return 1;
-   }
-   sprintf(toolfile, "%s/%s-%s", valgrind_lib, toolname, platform);
-
-   if (!file_exists(toolfile)) {
-      fprintf(stderr,"%s: can't stat %s\n", argv[0], toolfile);
-      return 1;
-   }
-
-   /* Force the client to use a 1:1 threading model - this works
-      because the client inherits our environment. */
-   VG_(debugLog)(1, "launcher", "doing putenv(\"AIXTHREAD_SCOPE=S\")\n");
-   Int putenv_err = putenv("AIXTHREAD_SCOPE=S");
-   if (putenv_err) {
-      fprintf(stderr,"%s: putenv(\"AIXTHREAD_SCOPE=S\") failed\n", argv[0]);
-      return 1;
-   }
-
-   VG_(debugLog)(1, "launcher", "doing putenv(\"MP_SHARED_MEMORY=no\")\n");
-   putenv_err = putenv("MP_SHARED_MEMORY=no");
-   if (putenv_err) {
-      fprintf(stderr,"%s: putenv(\"MP_SHARED_MEMORY=no\") failed\n", argv[0]);
-      return 1;
-   }
-
-   /* Find out what the current working directory is, and stuff it into the
-      environment so that the child can find it. */
-   char wd_buf[4096];
-   memset(wd_buf, 0, sizeof(wd_buf));
-   if (getcwd(wd_buf, sizeof(wd_buf)-1) == NULL) {
-      fprintf(stderr,"%s: getcwd(..) failed\n", argv[0]);
-      return 1;
-   }
-   assert(wd_buf[ sizeof(wd_buf)-1 ] == 0);
-   char* set_cwd = calloc(1, 100+sizeof(wd_buf));   
-   if (set_cwd == NULL) {
-      fprintf(stderr,"%s: calloc of set_cwd failed\n", argv[0]);
-      return 1;
-   }
-   sprintf(set_cwd, "VALGRIND_STARTUP_PWD_%d_XYZZY=%s", getpid(), wd_buf);
-   VG_(debugLog)(1, "launcher", "doing putenv(\"%s\")\n", set_cwd);
-   putenv_err = putenv(set_cwd);
-   if (putenv_err) {
-      fprintf(stderr,"%s: putenv(\"VALGRIND_STARTUP_PWD_...\") failed\n", 
-                     argv[0]);
-      return 1;
-   }
-
-   /* Also, cook up the fully qualified name of this executable.  The
-      following is a kludge, but I don't see how to really get the
-      fully qualified name on AIX. */
-   char* up_n_down = "/../../bin/valgrind";
-   char* launcher = malloc(strlen(valgrind_lib)
-                           + strlen(up_n_down) + 2);
-   if (launcher == NULL) {
-      fprintf(stderr,"%s: malloc of launcher failed\n", argv[0]);
-      return 1;
-   }
-   sprintf(launcher, "%s%s", valgrind_lib, up_n_down);
-
-   if (!file_exists(launcher)) {
-      fprintf(stderr,"%s: can't stat %s\n", argv[0], launcher);
-      return 1;
-   }
-
-   /* First, fork.  
-
-      In the child, ask for a ptrace, then exec argv[2 ..].  This
-      causes the kernel to complete the exec, hence loading the
-      child, but does not start it; instead the child remains frozen
-      so that the parent can mess with it via ptrace().
-   */
-   VG_(debugLog)(1, "launcher", "doing fork()\n");
-   child.pid = fork();
-   if (child.pid == -1) {
-      fprintf(stderr,"%s: fork() failed\n", argv[0]);
-      return 1;
-   }
-
-   if (child.pid == 0) {
-      /* --- CHILD --- */
-      VG_(debugLog)(1, "launcher", "child: before ptrace\n");
-      long rl = ptrace64(PT_TRACE_ME, 0,0,0,0);
-      if (rl != 0) {
-         fprintf(stderr,"%s: child: ptrace(PT_TRACE_ME, ...) failed\n", argv[0]);
-         fprintf(stderr,"%s: ", argv[0]);
-         perror(NULL);
-         fflush(stderr);
-         _exit(1);
-      }
-      VG_(debugLog)(1, "launcher", "child: before execve\n");
-
-      /* make VALGRIND_LAUNCHER point at something plausible. */
-      VG_(debugLog)(1, "launcher", "child: launcher = %s\n", launcher);
-      int r = setenv("VALGRIND_LAUNCHER", launcher, 1/*overwrite*/);
-      if (r) {
-         /* setenv failed. */
-         fprintf(stderr,"%s: child: setenv failed\n", argv[0]);
-         fprintf(stderr,"%s: ", argv[0]);
-         perror(NULL);
-         fflush(stderr);
-         _exit(1);
-         /* NOTREACHED */
-      }
-
-      /* This is kind-of strange.  We're execvp-ing the client but
-         argv[0] is the toolname, which is irrelevant - m_main ignores
-         it.  However, setting it like this at least makes m_main's
-         view of the world (as far as the argv goes) look the same as
-         it does in Linux-land: 
-            tool-exe-name [args for V] client-name [args for client]
-      */
-      argv[0] = toolfile;
-      int ri = execvp(clientname, &argv[0]);
-      /* WE ONLY GET HERE IF execve FAILED */
-      assert(ri == -1);
-      fprintf(stderr,"%s: exec failed: %s: ", argv[0], clientname);
-      perror("");
-      return 1;
-      /* NOTREACHED */
-   }
-
-   /* --- PARENT --- */
-   VG_(debugLog)(1, "launcher", "parent: waitpid-ing for child\n");
-   int status;
-   /* Wait to hear back from the child. */
-   pid_t p2 = waitpid(child.pid, &status, 0);
-   /* We could hear back for two reasons.  (1) the exec was
-      successful, and because the child is being ptraced, it is now
-      waiting for the parent.  (2) the exec failed, and so the child
-      did _exit(). */
-   VG_(debugLog)(1, "launcher", "parent: waitpid got pid %d\n", (int)p2);
-   VG_(debugLog)(1, "launcher", "parent: waitpid got status 0x%x\n", status);
-   assert(p2 == child.pid); /* Huh?! We only have one child. */
-
-   if (WIFEXITED(status)) {
-      /* Case (2) - exec failed. */
-      fprintf(stderr, "parent: child's exec failed.\n");
-      return 0;
-   }
-
-   /* else case (1) must apply */
-   assert(WIFSTOPPED(status));
-
-   /* ------ BEGIN write bootstrap pages into child ------ */
-
-   /* In this section, if for any reason we can't continue to the
-      child-detach and so have to give up, we have to kill the child,
-      else it'll become a zombie.  That's what the code at
-      latched_error: does. */
-   char* badness 
-            = write_bootstrap_loader_into_child ( &child, toolfile );
-   /* Returns NULL if no error, else points to a string of at least
-      some descriptiveness. */
-   if (badness)
-      goto latched_error;
-
-   /* ------ END write bootstrap pages into child ------ */
-
-   VG_(debugLog)(1, "launcher", "parent: detaching child\n");
-   long lr = ptrace64(PT_DETACH, (ULong)child.pid, 0, SIGCONT, 0);
-   VG_(debugLog)(1, "launcher", "parent: detach got %ld\n", lr);
-   assert(lr == 0);
-   VG_(debugLog)(1, "launcher", "parent: waiting for child to finish\n");
-
-   p2 = waitpid(child.pid, &status, 0);
-   assert(p2 == child.pid);
-   if (0)
-      fprintf(stderr,"parent: child finished, status 0x%x 0x%x\n", 
-                     status, WEXITSTATUS(status));
-
-   if (WIFEXITED(status)) {
-      VG_(debugLog)(1, "launcher", 
-                       "parent: child finished normally, exit code %d\n",
-                       WEXITSTATUS(status));
-      return WEXITSTATUS(status);
-   } 
-   else if (WIFSIGNALED(status)) {
-      VG_(debugLog)(1, "launcher",
-                       "parent: child exited on signal %d\n",
-                       (int)WTERMSIG(status));
-      /* Since the child exited with a signal, we'd better
-         whack ourselves on the head with the same signal. */
-      kill( getpid(), (int)WTERMSIG(status) );
-      /* presumably NOTREACHED? */
-      return 0; /* This is completely bogus */
-   } 
-   else {
-      /* erm.  Can we ever get here? */
-      assert(0);
-      return 0;
-   }
-
-  latched_error:
-   /* We get here if there was some kind of problem messing with the
-      child whilst we still had it latched by ptrace.  In this case we
-      need to kill it before exiting, since otherwise it will become a
-      zombie. */
-   assert(badness);
-   fprintf(stderr, "%s: error while doing ptracery on '%s'\n",
-                   argv[0], clientname);
-   fprintf(stderr, "%s: error is: %s\n",
-                   argv[0], badness);
-   return 0; /*BOGUS*/
-}
-
-/*--------------------------------------------------------------------*/
-/*--- end                                          launcher-aix5.c ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/link_tool_exe_aix5.in b/coregrind/link_tool_exe_aix5.in
deleted file mode 100644
index b909db1..0000000
--- a/coregrind/link_tool_exe_aix5.in
+++ /dev/null
@@ -1,6 +0,0 @@
-#! @PERL@
-
-use warnings;
-use strict;
-
-die "link_tool_exe_@VGCONF_OS@ requires implementation";
diff --git a/coregrind/m_aspacemgr/aspacemgr-aix5.c b/coregrind/m_aspacemgr/aspacemgr-aix5.c
deleted file mode 100644
index aa37709..0000000
--- a/coregrind/m_aspacemgr/aspacemgr-aix5.c
+++ /dev/null
@@ -1,2644 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- The address space manager: segment initialisation and        ---*/
-/*--- tracking, stack operations                                   ---*/
-/*---                                                              ---*/
-/*--- Implementation for AIX5                   m_aspacemgr-aix5.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#if defined(VGO_aix5)
-
-/* *************************************************************
-   DO NOT INCLUDE ANY OTHER FILES HERE.
-   ADD NEW INCLUDES ONLY TO priv_aspacemgr.h
-   AND THEN ONLY AFTER READING DIRE WARNINGS THERE TOO.
-   ************************************************************* */
-
-#include "priv_aspacemgr.h"
-
-
-/* Note: many of the exported functions implemented below are
-   described more fully in comments in pub_core_aspacemgr.h.
-*/
-
-/* This provides a minimal address space management facility for AIX5.
-   It is not as comprehensive, robust or efficient as its Linux
-   counterpart.
-
-   It does implement the advise/notify concept described in
-   aspacemgr-linux.c, but minimally.  It only keeps track of the
-   mappings belonging to Valgrind; the client can do what it likes so
-   long as it doesn't trash Valgrind's mappings.
-
-   This is unfortunate, but the root problem is that it is impossible
-   to find out on AIX what the complete set of mappings for a process
-   is.  Sure, AIX does have /proc/pid/map, but it's weak compared to
-   Linux's: it just shows some small subset of the mappings, not all
-   of them.  So it is not very useful: it can't be used to discover
-   the true initial process mapping state, and it can't be used to
-   cross-check Valgrind's internal mapping table, as is done at
-   --sanity-level=3 and above on Linux.
-*/
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- The Address Space Manager's state.                        ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* Describes AIX5-specific segment kinds */
-typedef
-   enum {
-      ASkFree=1,  // free space
-      ASkMText,   // module text (code) mapping
-      ASkMData,   // module data (& bss) mapping
-      ASkFileV,   // file mapping belonging to valgrind
-      ASkAnonC,   // anonymous mapping belonging to the client
-      ASkAnonV,   // anonymous mapping belonging to valgrind
-      ASkShmemC,  // shm mapping belonging to the client
-      ASkPreAlloc // area preallocated from sbrk
-   }
-   AixSegKind;
-
-/* Segment table entries, in summary:
-
-   ASkFree   start end
-   ASkMText  start end r w x sibling ismainexe fname mname
-   ASkMData  start end r w x sibling
-   FileV     start end r w x fname offset
-   AnonC     start end r w x fromP isCH
-   AnonV     start end r w x fromP
-   ShmemC    start end r w x
-   PreAlloc  start end
-
-   Entries are non-overlapping and cover the entire address space
-   exactly (as in the Linux aspacem).  Unlike Linux there are no
-   alignment constraints, since we're just recording what's going on,
-   rather than controlling it.
-
-   MText/MData are XCOFF mapped modules, as determined by looking at
-   /proc/../map.  MText is the primary entry and contains the text
-   range.  MData contains the data range, if the module has a data
-   mapping (usually but not always).  MText also holds the avma of the
-   corresponding data segment start, if any, (sibling field) so it can
-   be found and the two added/removed together.  Similarly MData
-   contains the address of the corresponding MText (also sibling).
-
-   fname/mname only apply to MText.  To find the fname/mname for MData
-   you have to look at the corresponding MText entry, which is
-   guaranteed to exist.  MText may exist without a corresponding MData
-   but not vice versa.  Kludge: in fact fname/mname have to be
-   allowed in MData, else read_procselfmap doesn't work.
-
-   MText may have a zero sibling pointer, indicating that there is no
-   corresponding MData.  But MData must have a nonzero sibling pointer
-   since MData without MText is not allowed.  Implication is that
-   neither MText nor MData may be mapped at zero as this would mess up
-   the representation, but I don't think that will ever happen since
-   AIX uses page zero as a readonly const-zero area.
-
-   For MData entries, the data section size acquired from /proc/../map
-   appears to also include the bss, so there is no need for any
-   further handling of that.
-
-   isCH indicates whether an AnonC area is part of the client heap
-   or not.  May not be set for any other kind of area.
-
-   File and member names are entries into the string table.
-
-   fromP, for AnonC/AnonV, if True, indicates that the segment was
-   allocated from a PreAlloc area, and so should be returned to that
-   state upon deallocation.  If False, indicates that the segment
-   should be unmapped on deallocation.
-*/
-typedef
-   struct {
-      AixSegKind kind;
-
-      /* ALL: extent */
-      /* Note: zero-length segments are not allowed.  That guarantees
-         that start <= end. */
-      Addr start;  // lowest addr in range (ALL)
-      Addr end;    // highest addr in range (ALL)
-
-      /* ALL except Free */
-      Bool hasR;
-      Bool hasW;
-      Bool hasX;
-
-      /* misc */
-      Addr   sibling;   // MText, MData only: addr of MData/MText
-      Bool   isMainExe; // MText only: is this the main executable?
-      Bool   isCH;      // AnonC only: is this part of the client's heap?
-      Bool   fromP;     // AnonC, AnonV only: originated from PreAlloc?
-      UChar* fname;     // MText, FileV only: filename
-      UChar* mname;     // MText only: member name if present
-      Off64T offset;    // FileV only: file offset
-   }
-   AixSegment;
-
-
-#define VG_N_ASEGMENTS 5000
-
-typedef
-   struct {
-      AixSegment seg[VG_N_ASEGMENTS];
-      Int        used;
-   }
-   AixSegments;
-
-
-/* ------ start of STATE for the address-space manager ------ */
-
-/* A table of zero-terminated strings (file names etc).  This
-   is only ever added to. */
-
-#define VG_N_ASTRTAB 200000
-static Int strtab_used = 0;
-static UChar strtab[VG_N_ASTRTAB];
-
-#define Addr_MIN ((Addr)0)
-#define Addr_MAX ((Addr)(-1ULL))
-
-/* The main array of AixSegments, in order as required. */
-
-static AixSegments asegs_pri;
-
-/* and two auxiliary arrays. */
-
-static AixSegments asegs_tnew;
-static AixSegments asegs_told;
-
-/* The assumed size of the main thread's stack, so that we can add a
-   segment for it at startup. */
-
-#define N_FAKE_STACK_PAGES_MIN 4096  /* 16M fake stack */ /* default size */
-#define N_FAKE_STACK_PAGES_MAX 32768 /* 128M fake stack */ /* max size? */
-
-
-/* Hacks which are probably for AIX 'millicode'.  Note: ensure
-   these stay page aligned. */
-
-#define MAGIC_PAGES_1_BASE  0x3000
-#define MAGIC_PAGES_1_SIZE  (2*0x1000)
-
-#define MAGIC_PAGES_2_BASE  0xC000
-#define MAGIC_PAGES_2_SIZE  (4*0x1000)
-
-
-#define AM_SANITY_CHECK(_who)                                  \
-   do {                                                        \
-      if (VG_(clo_sanity_level >= 3)) {                        \
-         Bool ok = sane_AixSegments(&asegs_pri);               \
-         if (!ok)                                              \
-            VG_(debugLog)(0,"aspace", "sanity check failed, "  \
-                                      "who = %s\n", _who);     \
-            aspacem_assert(ok);                                \
-      }                                                        \
-   } while (0)
-
-/* When preallocating a block from sbrk-world, how much extra
-   should we pre-emptively acquire? */
-
-//#define AM_PREALLOC_EXTRA (512 * 1024)
-//#define AM_PREALLOC_EXTRA 0x0800000  /* 8 M */
-#define AM_PREALLOC_EXTRA 0x4000000  /* 64 M */
-
-/* The AIX5 aspacem implementation needs to be told when it is and
-   isn't allowed to use sbrk to allocate memory.  Hence: */
-Bool VG_(am_aix5_sbrk_allowed) = True;
-
-/* ------ end of STATE for the address-space manager ------ */
-
-/* ------ Forwards decls ------ */
-static void parse_procselfmap ( /*OUT*/ AixSegments* );
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Stuff for 4K (small-page-size) rounding.                  ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-#define AM_4K_PAGESZ 4096
-
-static Bool AM_IS_4K_ALIGNED ( UWord w )
-{
-   UWord m = AM_4K_PAGESZ-1;
-   return toBool( (w & m) == 0 );
-}
-
-static UWord AM_4K_ROUNDUP ( UWord w )
-{
-   UWord m = AM_4K_PAGESZ-1;
-   return (w+m) & (~m);
-}
-
-static UWord AM_64K_ROUNDUP ( UWord w )
-{
-   UWord m = 0x10000-1;
-   return (w+m) & (~m);
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- String table management.                                  ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* Add the given string into the string table (or find an existing
-   copy of it) and return a pointer to the in-table version.  The
-   pointer will be valid for the entire rest of the run. */
-
-static UChar* add_to_strtab ( UChar* str )
-{
-   Int off, len;
-   /* First, look for the string. */
-   off = 0;
-   while (off < strtab_used) {
-      if (0 == VG_(strcmp)(str, &strtab[off]))
-         return &strtab[off];
-      off += VG_(strlen)(&strtab[off]) + 1;
-   }
-   /* not present?  we'll have to copy it then. */
-   len = VG_(strlen)(str);
-   if (len + 1 + strtab_used > VG_N_ASTRTAB)
-      ML_(am_barf_toolow)("VG_N_ASTRTAB");
-   off = strtab_used;
-   for (; *str; str++)
-      strtab[strtab_used++] = *str;
-   strtab[strtab_used++] = 0;
-   aspacem_assert(strtab_used <= VG_N_ASTRTAB);
-   return &strtab[off];
-}
-
-
-static Bool is_in_strtab ( UChar* str )
-{
-   if (str < &strtab[0]) 
-      return False;
-   if (str >= &strtab[strtab_used])
-      return False;
-   if (str > &strtab[0] && str[-1] != 0)
-      return False;
-   return True;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Low level AixSegment stuff.                               ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-static void init_AixSegment ( AixSegment* s )
-{
-   s->kind      = 0; /* invalid */
-   s->start     = 0;
-   s->end       = 0;
-   s->hasR      = False;
-   s->hasW      = False;
-   s->hasX      = False;
-   s->sibling   = 0;
-   s->isMainExe = False;
-   s->isCH      = False;
-   s->fromP     = False;
-   s->fname     = NULL;
-   s->mname     = NULL;
-   s->offset    = 0;
-}
-
-
-static HChar* name_of_AixSegKind ( AixSegKind sk )
-{
-   switch (sk) {
-      case ASkFree:     return "Free ";
-      case ASkMText:    return "MText";
-      case ASkMData:    return "MData";
-      case ASkAnonV:    return "AnonV";
-      case ASkAnonC:    return "AnonC";
-      case ASkFileV:    return "FileV";
-      case ASkShmemC:   return "ShmC ";
-      case ASkPreAlloc: return "PreAl";
-      default:        ML_(am_barf)("name_of_AixSegKind");
-                      /*NOTREACHED*/
-                      return NULL;
-   }
-}
-
-
-static 
-void show_AixSegment ( Int logLevel, Int segNo, AixSegment* seg )
-{
-   HChar* segName = name_of_AixSegKind( seg->kind );
-   switch (seg->kind) {
-      case ASkFree:
-         VG_(debugLog)(logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx\n",
-            segNo, /*segName*/"     ",
-            (ULong)seg->start, (ULong)seg->end
-         );
-         break;
-      case ASkMText:
-         VG_(debugLog)(logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx %c%c%c-- (d %010llx) %s%s%s%s\n",
-            segNo, seg->isMainExe ? "MTEXT" : "MText",
-            (ULong)seg->start, (ULong)seg->end,
-            seg->hasR ? 'r' : '-',
-            seg->hasW ? 'w' : '-',
-            seg->hasX ? 'x' : '-',
-            (ULong)seg->sibling,
-            seg->fname,
-            seg->mname ? "(" : "",
-            seg->mname ? (HChar*)seg->mname : "",
-            seg->mname ? ")" : ""
-         );
-         break;
-      case ASkMData:
-         VG_(debugLog)(logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx %c%c%c-- (t %010llx)\n",
-            segNo, "MData",
-            (ULong)seg->start, (ULong)seg->end,
-            seg->hasR ? 'r' : '-',
-            seg->hasW ? 'w' : '-',
-            seg->hasX ? 'x' : '-',
-            (ULong)seg->sibling
-         );
-         break;
-      case ASkFileV: 
-         VG_(debugLog)(logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx %c%c%c-- %6lld %s\n",
-            segNo, segName,
-            (ULong)seg->start, (ULong)seg->end,
-            seg->hasR ? 'r' : '-',
-            seg->hasW ? 'w' : '-',
-            seg->hasX ? 'x' : '-',
-            seg->offset,
-            seg->fname
-         );
-         break;
-      case ASkAnonV: 
-      case ASkAnonC:
-      case ASkShmemC:
-         VG_(debugLog)(logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx %c%c%c%c%c\n",
-            segNo, segName,
-            (ULong)seg->start, (ULong)seg->end,
-            seg->hasR ? 'r' : '-',
-            seg->hasW ? 'w' : '-',
-            seg->hasX ? 'x' : '-',
-            seg->kind==ASkAnonC && seg->isCH ? 'H' : '-',
-            seg->fromP ? 'P' : '-'
-         );
-         break;
-      case ASkPreAlloc:
-         VG_(debugLog)(logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx %c%c%c-- (size %llu)\n",
-            segNo, segName,
-            (ULong)seg->start, (ULong)seg->end,
-            seg->hasR ? 'r' : '-',
-            seg->hasW ? 'w' : '-',
-            seg->hasX ? 'x' : '-',
-            (ULong)seg->end - (ULong)seg->start + 1
-         );
-         break;
-      default:
-         VG_(debugLog)(logLevel, "aspacem",
-                       "%3d: show_AixSegment: unknown segment\n", 
-                       segNo);
-         break;
-   }
-}
-
-
-static void init_AixSegments ( AixSegments* segs )
-{
-   segs->used = 1;
-   init_AixSegment( &segs->seg[0] );
-   segs->seg[0].kind  = ASkFree;
-   segs->seg[0].start = Addr_MIN;
-   segs->seg[0].end   = Addr_MAX;
-}
-
-
-static 
-void show_AixSegments ( Int logLevel, HChar* who, AixSegments* segs )
-{
-   Int i;
-   VG_(debugLog)(logLevel, "aspacem", "<<< %s\n", who);
-   for (i = 0; i < segs->used; i++)
-      show_AixSegment( logLevel, i, &segs->seg[i] );
-   VG_(debugLog)(logLevel, "aspacem", ">>>\n");
-}
-
-
-static Bool sane_AixSegment ( AixSegment* seg )
-{
-   /* disallow zero and negative length segments */
-   if (seg->end < seg->start)
-      return False;
-
-   switch (seg->kind) {
-      case ASkFree:
-         if (seg->hasR || seg->hasW || seg->hasX)
-            return False;
-         if (seg->isMainExe || seg->sibling != 0 || seg->offset != 0)
-            return False;
-         if (seg->fname || seg->mname)
-            return False;
-         if (seg->isCH || seg->fromP)
-            return False;
-         break;
-      case ASkMText:
-         if (!is_in_strtab(seg->fname))
-            return False;
-         if (seg->mname && !is_in_strtab(seg->mname))
-            return False;
-         if (seg->offset != 0)
-            return False;
-         if (seg->isCH || seg->fromP)
-            return False;
-         break;
-      case ASkMData:
-         if (seg->isMainExe || seg->sibling == 0 || seg->offset != 0)
-            return False;
-         /* fname/mname have to be allowed in MData, else
-            read_procselfmap doesn't work.  Unfortunately. */
-         /*
-         if (seg->fname || seg->mname)
-            return False;
-         */
-         if (seg->isCH || seg->fromP)
-            return False;
-         break;
-      case ASkFileV:
-         if (!is_in_strtab(seg->fname))
-            return False;
-         if (seg->mname != NULL)
-            return False;
-         if (seg->isMainExe || seg->sibling != 0)
-            return False;
-         if (seg->isCH || seg->fromP)
-            return False;
-         break;
-      case ASkShmemC:
-      case ASkAnonV:
-      case ASkAnonC:
-         if (seg->fname || seg->mname)
-            return False;
-         if (seg->isMainExe || seg->sibling != 0)
-            return False;
-         if (seg->offset != 0)
-            return False;
-         if (seg->kind != ASkAnonC && seg->isCH)
-            return False;
-         if ( (!(seg->kind == ASkAnonV || seg->kind == ASkAnonC))
-              && seg->fromP)
-            return False;
-         break;
-      case ASkPreAlloc:
-         if (seg->fname || seg->mname)
-            return False;
-         if (seg->isMainExe || seg->sibling != 0)
-            return False;
-         if (seg->offset != 0)
-            return False;
-         if (seg->kind != ASkAnonC && seg->isCH)
-            return False;
-         if (seg->fromP)
-            return False;
-         if (!AM_IS_4K_ALIGNED(seg->start))
-            return False;
-         if (!AM_IS_4K_ALIGNED(seg->end + 1))
-            return False;
-         if (!(seg->hasR && seg->hasW && seg->hasX))
-            return False;
-         break;
-      default:
-         return False;
-   }
-   return True;
-}
-
-
-/* Binary search the interval array for a given address.  Since the
-   array covers the entire address space the search cannot fail. */
-static Int find_asegment_idx ( AixSegments* segs, Addr a )
-{
-   Addr a_mid_lo, a_mid_hi;
-   Int  mid,
-        lo = 0,
-        hi = segs->used-1;
-   aspacem_assert(lo <= hi);
-   while (True) {
-      /* current unsearched space is from lo to hi, inclusive. */
-      if (lo > hi) {
-         /* Not found.  This can't happen. */
-         ML_(am_barf)("find_nsegment_idx: not found");
-      }
-      mid      = (lo + hi) / 2;
-      a_mid_lo = segs->seg[mid].start;
-      a_mid_hi = segs->seg[mid].end;
-
-      if (a < a_mid_lo) { hi = mid-1; continue; }
-      if (a > a_mid_hi) { lo = mid+1; continue; }
-      aspacem_assert(a >= a_mid_lo && a <= a_mid_hi);
-      aspacem_assert(0 <= mid && mid < segs->used);
-      return mid;
-   }
-}
-
-
-static Bool sane_AixSegments ( AixSegments* segs )
-{
-   Int i;
-
-   /* Check endpoints */
-   if (segs->used < 1 || segs->used > VG_N_ASEGMENTS) {
-      VG_(debugLog)(0, "aspacem", "sane_AixSegments: bad ->used");
-      return False;
-   }
-   if (segs->seg[0].start != Addr_MIN
-       || segs->seg[segs->used-1].end != Addr_MAX) {
-      VG_(debugLog)(0, "aspacem", "sane_AixSegments: bad endpoints");
-      return False;
-   }
-
-   /* Check each segment, and check entire range is covered. */
-   for (i = 0; i < segs->used; i++) {
-      if (!sane_AixSegment( &segs->seg[i] )) {
-         VG_(debugLog)(0, "aspacem", 
-                          "sane_AixSegments: bad segment %d\n", i);
-         return False;
-      }
-   }
-   for (i = 1; i < segs->used; i++) {
-      if (segs->seg[i-1].end + 1 != segs->seg[i].start) {
-         VG_(debugLog)(0, "aspacem", 
-                          "sane_AixSegments: bad transition at %d/%d\n", i-1,i);
-         return False;
-      }
-   }
-
-   /* Now we know 'seg' is safe for use in find_asegment_idx().
-      Check the sibling pointers for MText/MData.
-
-      Also check that the segment starting at address zero is neither
-      MText nor MData (since this would mess up the sibling pointer
-      representation; see comments above.)  Failure of this is not per
-      se a logic failure, but it does indicate that the kernel
-      unexpectedly placed MText or MData at zero, and our
-      representation is therefore inadequate.
-   */
-   if (segs->seg[0].kind == ASkMText || segs->seg[0].kind == ASkMData) {
-      VG_(debugLog)(0, "aspacem", 
-                       "sane_AixSegments: ASkMText/ASkMData at address zero\n");
-      return False;
-   }
-
-   for (i = 0; i < segs->used-1; i++) {
-
-      AixSegment *s1, *s2;
-
-      s1 = &segs->seg[i];
-
-      if (s1->kind == ASkMData) {
-         s2 = &segs->seg[ find_asegment_idx(segs, s1->sibling) ];
-         if (s2->kind != ASkMText
-             || find_asegment_idx(segs, s2->sibling) != i) {
-            VG_(debugLog)(0, "aspacem", "sane_AixSegments: bad sibling "
-                                        "link(s) for ASkData\n");
-            return False;
-         }
-      }
-
-      if (s1->kind == ASkMText && s1->sibling != 0) {
-         s2 = &segs->seg[ find_asegment_idx(segs, s1->sibling) ];
-         if (s2->kind != ASkMData
-             || find_asegment_idx(segs, s2->sibling) != i) {
-            VG_(debugLog)(0, "aspacem", "sane_AixSegments: bad sibling "
-                                        "link(s) for ASkText\n");
-            return False;
-         }
-      }
-
-   }
-
-   return True;
-}
-
-
-/* Try merging s2 into s1, if possible.  If successful, s1 is
-   modified, and True is returned.  Otherwise s1 is unchanged and
-   False is returned. */
-
-static Bool maybe_merge_asegments ( AixSegment* s1, AixSegment* s2 )
-{
-   if (s1->kind != s2->kind) 
-      return False;
-
-   if (s1->end+1 != s2->start)
-      return False;
-
-   switch (s1->kind) {
-
-      case ASkFree:
-         s1->end = s2->end;
-         return True;
-
-      case ASkAnonC:
-      case ASkAnonV:
-         if (s1->hasR == s2->hasR && s1->hasW == s2->hasW 
-             && s1->hasX == s2->hasX && s1->isCH == s2->isCH
-             && s1->fromP == s2->fromP) {
-            s1->end = s2->end;
-            return True;
-         }
-         break;
-
-      /* not really necessary, but .. */
-      case SkFileV:
-         if (s1->hasR == s2->hasR
-             && s1->hasW == s2->hasW && s1->hasX == s2->hasX
-             && s1->fname == s2->fname
-             && s2->offset == s1->offset
-                + ((ULong)s2->start) - ((ULong)s1->start) ) {
-            s1->end = s2->end;
-            return True;
-         }
-         break;
-
-      /* it's important to merge PreAlloc's back together to avoid
-         fragmenting PreAlloc'd space unnecessarily */
-      case ASkPreAlloc:
-         s1->end = s2->end;
-         return True;
-
-      default:
-         break;
-   }
-
-   return False;
-}
-
-
-/* Merge mergable segments in SEGS. */
-
-static void preen_asegments ( AixSegments* segs )
-{
-   Int r, w;
-
-   aspacem_assert(segs->used >= 1);
-   if (segs->used == 1)
-      return;
-
-   w = 0;
-   for (r = 1; r < segs->used; r++) {
-      if (maybe_merge_asegments(&segs->seg[w], &segs->seg[r])) {
-         /* nothing */
-      } else {
-         w++;
-         if (w != r) 
-            segs->seg[w] = segs->seg[r];
-      }
-   }
-   w++;
-   aspacem_assert(w > 0 && w <= segs->used);
-   segs->used = w;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Modifying a segment array, and constructing segments.     ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* Split the segment containing 'a' into two, so that 'a' is
-   guaranteed to be the start of a new segment.  If 'a' is already the
-   start of a segment, do nothing. */
-
-static void split_asegment_at ( AixSegments* segs, Addr a )
-{
-   Int i, j;
-
-   aspacem_assert(a > 0);
-   aspacem_assert(segs->used >= 1);
- 
-   i = find_asegment_idx(segs, a);
-   aspacem_assert(i >= 0 && i < segs->used);
-
-   if (segs->seg[i].start == a)
-      /* 'a' is already the start point of a segment, so nothing to be
-         done. */
-      return;
-
-   /* else we have to slide the segments upwards to make a hole */
-   if (segs->used >= VG_N_ASEGMENTS)
-      ML_(am_barf_toolow)("VG_N_ASEGMENTS");
-   for (j = segs->used-1; j > i; j--)
-      segs->seg[j+1] = segs->seg[j];
-   segs->used++;
-
-   segs->seg[i+1]       = segs->seg[i];
-   segs->seg[i+1].start = a;
-   segs->seg[i].end     = a-1;
-
-   if (segs->seg[i].kind == ASkFileV /* || segs->seg[i].kind == ASkFileC*/)
-      segs->seg[i+1].offset 
-         += ((ULong)segs->seg[i+1].start) - ((ULong)segs->seg[i].start);
-
-   aspacem_assert(sane_AixSegment(&segs->seg[i]));
-   aspacem_assert(sane_AixSegment(&segs->seg[i+1]));
-}
-
-
-/* Do the minimum amount of segment splitting necessary to ensure that
-   sLo is the first address denoted by some segment and sHi is the
-   highest address denoted by some other segment.  Returns the indices
-   of the lowest and highest segments in the range. */
-
-static 
-void split_asegments_lo_and_hi ( AixSegments* segs,
-                                 Addr sLo, Addr sHi,
-                                 /*OUT*/Int* iLo,
-                                 /*OUT*/Int* iHi )
-{
-   aspacem_assert(sLo < sHi);
-
-   if (sLo > 0)
-      split_asegment_at(segs, sLo);
-   if (sHi < Addr_MAX)
-      split_asegment_at(segs, sHi+1);
-
-   *iLo = find_asegment_idx(segs,sLo);
-   *iHi = find_asegment_idx(segs,sHi);
-   aspacem_assert(0 <= *iLo && *iLo < segs->used);
-   aspacem_assert(0 <= *iHi && *iHi < segs->used);
-   aspacem_assert(*iLo <= *iHi);
-   aspacem_assert(segs->seg[*iLo].start == sLo);
-   aspacem_assert(segs->seg[*iHi].end == sHi);
-   /* Not that I'm overly paranoid or anything, definitely not :-) */
-}
-
-
-/* Add SEG to the collection, deleting/truncating any it overlaps.
-   This deals with all the tricky cases of splitting up segments as
-   needed.  Contents of SEG are copied. */
-
-static void add_asegment ( AixSegments* segs, AixSegment* seg )
-{
-   Int  i, iLo, iHi, delta;
-   Bool segment_is_sane;
-
-   Addr sStart = seg->start;
-   Addr sEnd   = seg->end;
-
-   aspacem_assert(sStart <= sEnd);
-
-   segment_is_sane = sane_AixSegment(seg);
-   if (!segment_is_sane) show_AixSegment(0,0,seg);
-   aspacem_assert(segment_is_sane);
-
-   split_asegments_lo_and_hi( segs, sStart, sEnd, &iLo, &iHi );
-
-   /* Now iLo .. iHi inclusive is the range of segment indices which
-      seg will replace.  If we're replacing more than one segment,
-      slide those above the range down to fill the hole. */
-   delta = iHi - iLo;
-   aspacem_assert(delta >= 0);
-   if (delta > 0) {
-      for (i = iLo; i < segs->used-delta; i++)
-         segs->seg[i] = segs->seg[i+delta];
-      segs->used -= delta;
-   }
-   aspacem_assert(segs->used >= 1);
-
-   segs->seg[iLo] = *seg;
-
-   preen_asegments(segs);
-   if (0) VG_(am_show_nsegments)(0,"AFTER preen (add_segment)");
-}
-
-
-/* Convert everything in SEG except MData and MText into Free,
-   then preen, so as to retain normalised form. */
-
-static void knockout_non_module_segs ( AixSegments* segs )
-{
-   Int i;
-   Addr s, e;
-   for (i = 0; i < segs->used; i++) {
-      if (segs->seg[i].kind == ASkFree
-          || segs->seg[i].kind == ASkMText
-          || segs->seg[i].kind == ASkMData)
-         continue;
-      s = segs->seg[i].start;
-      e = segs->seg[i].end;
-      init_AixSegment( &segs->seg[i] );
-      segs->seg[i].start = s;
-      segs->seg[i].end = e;
-      segs->seg[i].kind = ASkFree;
-   }
-   preen_asegments(segs);
-   aspacem_assert( sane_AixSegments(segs) );
-}
-
-
-/* Copy a segment array. */
-
-static void copy_asegments_d_s ( AixSegments* dst, AixSegments* src )
-{
-   Int i;
-   aspacem_assert(src->used >= 1 && src->used < VG_N_ASEGMENTS);
-   dst->used = src->used;
-   for (i = 0; i < src->used; i++)
-      dst->seg[i] = src->seg[i];
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Re-reading /proc/../map and updating MText/MData segments ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* Find out the size of the AixCodeSegChange that must be
-   presented to VG_(am_aix5_reread_procmap). */
-
-Int VG_(am_aix5_reread_procmap_howmany_directives)(void)
-{
-   /* In the worst imaginable case, all the tracked modules could have
-      disappeared and been replaced with different ones.  Hence: */
-   return 2 * VG_N_ASEGMENTS;
-}
-
-
-static 
-void add_pri_text_and_data_segs ( AixSegment* tnew, AixSegment* dnew )
-{
-   Bool dExists = (dnew->end - dnew->start + 1) != 0;
-   aspacem_assert(tnew->kind == ASkMText);
-   aspacem_assert(dnew->kind == ASkMData);
-   if (dExists) {
-      aspacem_assert(tnew->sibling == dnew->start);
-      aspacem_assert(dnew->sibling == tnew->start);
-      add_asegment(&asegs_pri, tnew);
-      add_asegment(&asegs_pri, dnew);
-   } else {
-      aspacem_assert(tnew->sibling == 0);
-      add_asegment(&asegs_pri, tnew);
-   }
-}
-
-static 
-void del_pri_text_and_data_segs ( AixSegment* told, AixSegment* dold )
-{
-   AixSegment fre;
-   Bool       dExists = (dold->end - dold->start + 1) != 0;
-   aspacem_assert(told->kind == ASkMText);
-   aspacem_assert(dold->kind == ASkMData);
-   init_AixSegment( &fre );
-   fre.kind = ASkFree;
-   if (dExists) {
-      aspacem_assert(told->sibling == dold->start);
-      aspacem_assert(dold->sibling == told->start);
-      fre.start = told->start;
-      fre.end   = told->end;
-      add_asegment(&asegs_pri, &fre);
-      fre.start = dold->start;
-      fre.end   = dold->end;
-      add_asegment(&asegs_pri, &fre);
-   } else {
-      aspacem_assert(told->sibling == 0);
-      fre.start = told->start;
-      fre.end   = told->end;
-      add_asegment(&asegs_pri, &fre);
-   }
-}
-
-
-/* Tell aspacem that /proc/<pid>/map may have changed (eg following
-   __loadx) and so it should be re-read, and the code/data segment
-   list updated accordingly.  The resulting array of AixCodeChangeSeg
-   directives are written to 'directives', and the number of entries
-   to *ndirectives. */
-
-void VG_(am_aix5_reread_procmap)
-     ( /*OUT*/AixCodeSegChange* directives, /*OUT*/Int* ndirectives )
-{
-   Int        ixold, ixnew;
-   Bool       done_old, done_new;
-   AixSegment *olds, *news;
-
-   /* First, read /proc/../map into asegs_tnew.  Copy asegs_pri into
-      asegs_told, and remove everything except MData and MText, so as
-      to generate something we can sanely compare with asegs_tnew.
-      Walk asegs_told and asegs_tnew together, writing the differences
-      to 'directives', and modifying asegs_pri accordingly. */
-   parse_procselfmap( &asegs_tnew );
-   copy_asegments_d_s( &asegs_told, &asegs_pri );
-   knockout_non_module_segs( &asegs_told );
-
-   *ndirectives = 0;
-
-#  define MODIFY_PRI(_dir, _asegs, _ixt, _acquire) \
-      do { \
-         Int        _ixd; \
-         AixSegment *_segt, *_segd; \
-         AixSegment _segd_dummy; \
-         aspacem_assert(_ixt >= 0 && _ixt < _asegs.used); \
-         _segt = &_asegs.seg[_ixt]; \
-         aspacem_assert(_segt->kind == ASkMText); \
-         if (_segt->sibling) { \
-            _ixd = find_asegment_idx( &_asegs, _segt->sibling ); \
-            _segd = &_asegs.seg[_ixd]; \
-            aspacem_assert(_segd->kind == ASkMData); \
-            aspacem_assert(_segt->sibling == _segd->start); \
-         } else { \
-            init_AixSegment( &_segd_dummy ); \
-            _segd_dummy.kind = ASkMData; \
-            _segd_dummy.start = 1; \
-            _segd_dummy.end   = 0; \
-            _segd = &_segd_dummy; \
-         } \
-         if (_segd != &_segd_dummy) \
-            aspacem_assert(_segd->sibling == _segt->start); \
-         \
-         (_dir).code_start = (_segt)->start; \
-         (_dir).code_len   = (_segt)->end - (_segt)->start + 1; \
-         (_dir).data_start = (_segd)->start; \
-         (_dir).data_len   = (_segd)->end - (_segd)->start + 1; \
-         (_dir).file_name  = (_segt)->fname; \
-         (_dir).mem_name   = (_segt)->mname; \
-         (_dir).is_mainexe = (_acquire) ? (_segt)->isMainExe : False; \
-         (_dir).acquire    = (_acquire); \
-         \
-         if (_acquire) { \
-            add_pri_text_and_data_segs( _segt, _segd ); \
-         } else { \
-            del_pri_text_and_data_segs( _segt, _segd ); \
-         } \
-      } while (0)
-
-   ixold = 0; /* indexes asegs_told */
-   ixnew = 0; /* indexes asegs_tnew */
-
-   while (True) {
-
-      aspacem_assert(ixold >= 0 && ixold < asegs_told.used);
-      aspacem_assert(ixnew >= 0 && ixnew < asegs_tnew.used);
-
-      /* Advance ixold and ixnew to the next MText in their
-         respective arrays. */
-      while (ixold < asegs_told.used 
-             && asegs_told.seg[ixold].kind != ASkMText) {
-         aspacem_assert(asegs_told.seg[ixold].kind == ASkFree
-                        || asegs_told.seg[ixold].kind == ASkMData);
-         ixold++;
-      }
-      while (ixnew < asegs_tnew.used 
-             && asegs_tnew.seg[ixnew].kind != ASkMText) {
-         aspacem_assert(asegs_tnew.seg[ixnew].kind == ASkFree
-                        || asegs_tnew.seg[ixnew].kind == ASkMData);
-         ixnew++;
-      }
-
-      aspacem_assert(ixold >= 0 && ixold <= asegs_told.used);
-      aspacem_assert(ixnew >= 0 && ixnew <= asegs_tnew.used);
-
-      done_old = ixold == asegs_told.used;
-      done_new = ixnew == asegs_tnew.used;
-
-      if (done_old && done_new)
-         goto both_done;
-      if (done_old && !done_new)
-         goto finishup_new;
-      if (done_new && !done_old)
-         goto finishup_old;
-
-      olds = &asegs_told.seg[ixold];
-      news = &asegs_tnew.seg[ixnew];
-
-      aspacem_assert(olds->kind == ASkMText);
-      aspacem_assert(news->kind == ASkMText);
-
-      if (0) {
-         show_AixSegment(0,ixold,&asegs_told.seg[ixold]); 
-         show_AixSegment(0,ixnew,&asegs_tnew.seg[ixnew]); 
-         VG_(debugLog)(0, "aspacem", "\n");
-      }
-
-      /* Here, if olds->start < news->start, then the old sequence has
-         an entry which the new one doesn't, so a module has been
-         unloaded.  If news->start < olds->start then the new sequence
-         has a module the old one doesn't, so a module has been
-         loaded.  If news->start ==olds->start then the module is
-         unchanged.  Except, we should check a bit more carefully in
-         the zero case. */
-      if (olds->start == news->start) {
-         if (olds->start == news->start
-             && olds->end == news->end
-             && olds->fname == news->fname
-             && olds->mname == news->mname
-             && olds->sibling == news->sibling
-             && olds->isMainExe == news->isMainExe) {
-            /* really identical, do nothing */
-         } else {
-            /* Dubious; mark it as an unload of old and load of
-               new. */
-            MODIFY_PRI(directives[*ndirectives], asegs_told, ixold, False);
-            (*ndirectives)++;
-            aspacem_assert(*ndirectives <= 2 * VG_N_ASEGMENTS);
-            MODIFY_PRI(directives[*ndirectives], asegs_tnew, ixnew, True);
-            (*ndirectives)++;
-            aspacem_assert(*ndirectives <= 2 * VG_N_ASEGMENTS);
-         }
-         ixold++;
-         ixnew++;
-         continue;
-      }
-
-      if (olds->start < news->start) {
-         /* discard olds */
-         MODIFY_PRI(directives[*ndirectives], asegs_told, ixold, False);
-         (*ndirectives)++;
-         aspacem_assert(*ndirectives <= 2 * VG_N_ASEGMENTS);
-         ixold++;
-         continue;
-      }
-
-      if (news->start < olds->start) {
-         /* acquire news */
-         MODIFY_PRI(directives[*ndirectives], asegs_tnew, ixnew, True);
-         (*ndirectives)++;
-         aspacem_assert(*ndirectives <= 2 * VG_N_ASEGMENTS);
-         ixnew++;
-         continue;
-      }
-      /* NOTREACHED */
-      aspacem_assert(0);
-   }
-
-  finishup_new:
-   olds = NULL;
-   aspacem_assert(ixold == asegs_told.used);
-   aspacem_assert(ixnew < asegs_tnew.used);
-   while (ixnew < asegs_tnew.used) {
-      news = &asegs_tnew.seg[ixnew];
-      aspacem_assert(news->kind == ASkMText || news->kind == ASkMData
-                     || news->kind == ASkFree);
-      if (news->kind == ASkMText) {
-         MODIFY_PRI(directives[*ndirectives], asegs_tnew, ixnew, True);
-         (*ndirectives)++;
-         aspacem_assert(*ndirectives <= 2 * VG_N_ASEGMENTS);
-      }
-      ixnew++;
-   }
-   goto both_done;
-
-  finishup_old:
-   news = NULL;
-   aspacem_assert(ixnew == asegs_tnew.used);
-   aspacem_assert(ixold < asegs_told.used);
-   while (ixold < asegs_told.used) {
-      olds = &asegs_told.seg[ixold];
-      aspacem_assert(olds->kind == ASkMText || olds->kind == ASkMData
-                     || olds->kind == ASkFree);
-      if (olds->kind == ASkMText) {
-         MODIFY_PRI(directives[*ndirectives], asegs_told, ixold, False);
-         (*ndirectives)++;
-         aspacem_assert(*ndirectives <= 2 * VG_N_ASEGMENTS);
-      }
-      ixold++;
-   }
-   goto both_done;
-
-  both_done:
-   aspacem_assert(ixold == asegs_told.used);
-   aspacem_assert(ixnew == asegs_tnew.used);
-
-   asegs_tnew.used = 0;
-   asegs_told.used = 0;
-
-   aspacem_assert( sane_AixSegments(&asegs_pri) );
-
-#  undef MODIFY_PRI
-}
-
-
-/* Set the initial stack segment.  Contains kludgery.  Also take the
-   opportunity to create fake segs for the millicode areas. */
-
-void VG_(am_aix5_set_initial_client_sp)( Addr sp )
-{
-   static Bool done = False;
-   AixSegment  seg;
-   Word n_fake_stack_pages;
-   Word m1 = 1048576;
-
-   aspacem_assert(!done);
-   done = True;
-
-   /* We are given the initial client SP (that of the root thread).
-      Already on the stack are argv and env.  How far up does it
-      extend?  We assume to the next 64k boundary.  How far down does
-      it extend?  We assume N_FAKE_STACK_PAGES small pages - by
-      default 16M.  Establish those limits and add an AnonC rwx
-      segment. */
-
-   /* The 64k boundary is "justified" as follows.  On 32-bit AIX 5.3,
-      a typical initial SP is 0x2FF22xxx, but the accessible (rw) area
-      beyond that extends up to 0x2FF2FFFF - the next 64k boundary.
-      In 64-bit mode, a typical initial SP might be
-      0xFFF'FFFF'FFFF'E920, and the accessible area extends to
-      0xFFF'FFFF'FFFF'FFFF.  So in both cases, (64k roundup of sp) - 1
-      gives the end of the accessible area. */
-   VG_(debugLog)(1,"aspacem", "aix5_set_initial_client_sp( %p )\n",
-                   (void*)sp);
-
-   init_AixSegment( &seg );
-   seg.kind  = ASkAnonC;
-   seg.hasR  = seg.hasW = seg.hasX = True;
-
-   if (sizeof(void*) == 4
-       && ((sp & 0xFFFF0000) == 0x2FF20000
-           || (sp & 0xFFFF0000) == 0x2FF10000)) {
-      /* Gaaah.  Special-case 32-bit mode. */
-      seg.end = 0x2FF2FFFF;
-   } else {
-      seg.end = AM_64K_ROUNDUP(sp) - 1;
-   }
-
-   n_fake_stack_pages = N_FAKE_STACK_PAGES_MIN;
-   if (VG_(clo_main_stacksize) > 0 
-       && ((m1+VG_(clo_main_stacksize)) / VKI_PAGE_SIZE) > n_fake_stack_pages) {
-      n_fake_stack_pages = (m1+VG_(clo_main_stacksize)) / VKI_PAGE_SIZE;
-   }
-   if (n_fake_stack_pages > N_FAKE_STACK_PAGES_MAX) {
-      /* Allocation of the stack failed.  We have to stop. */
-      VG_(debugLog)(
-         0, "aspacem",
-            "valgrind: "
-            "I failed to allocate space for the application's stack.\n");
-      VG_(debugLog)(
-         0, "aspacem",
-            "valgrind: "
-            "This may be the result of a very large --max-stackframe=\n");
-      VG_(debugLog)(
-         0, "aspacem",
-            "valgrind: "
-            "setting.  Cannot continue.  Sorry.\n\n");
-      ML_(am_exit)(0);
-   }
-
-   seg.start = seg.end+1 - n_fake_stack_pages * VKI_PAGE_SIZE;
-
-   VG_(debugLog)(1,"aspacem", "aix5_set_initial_client_sp: stack seg:\n");
-   show_AixSegment(1,0, &seg);
-   add_asegment( &asegs_pri, &seg );
-
-   init_AixSegment( &seg );
-   seg.kind  = ASkAnonC;
-   seg.hasR  = seg.hasX = True;
-   seg.start = MAGIC_PAGES_1_BASE;
-   seg.end   = MAGIC_PAGES_1_BASE + MAGIC_PAGES_1_SIZE - 1;
-   VG_(debugLog)(1,"aspacem", "am_aix5_set_initial_client_sp: FAKE1 seg:\n");
-   show_AixSegment(1,0, &seg);
-   add_asegment( &asegs_pri, &seg );
-
-   init_AixSegment( &seg );
-   seg.kind  = ASkAnonC;
-   seg.hasR  = seg.hasX = True;
-   seg.start = MAGIC_PAGES_2_BASE;
-   seg.end   = MAGIC_PAGES_2_BASE + MAGIC_PAGES_2_SIZE - 1;
-   VG_(debugLog)(1,"aspacem", "am_aix5_set_initial_client_sp: FAKE2 seg:\n");
-   show_AixSegment(1,0, &seg);
-   add_asegment( &asegs_pri, &seg );
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Getting segment-starts.                                   ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* Print out the segment array (debugging only!). */
-void VG_(am_show_nsegments) ( Int logLevel, HChar* who )
-{
-   show_AixSegments( logLevel, who, &asegs_pri );
-}
-
-/* Get the filename corresponding to this segment, if known and if it
-   has one.  The returned name's storage cannot be assumed to be
-   persistent, so the caller should immediately copy the name
-   elsewhere.  On AIX5, we don't know what this is (in general)
-   so just return NULL. */
-HChar* VG_(am_get_filename)( NSegment const* seg )
-{
-   return NULL;
-}
-
-/* Collect up the start addresses of all non-free, non-resvn segments.
-   The interface is a bit strange in order to avoid potential
-   segment-creation races caused by dynamic allocation of the result
-   buffer *starts.
-
-   The function first computes how many entries in the result
-   buffer *starts will be needed.  If this number <= nStarts,
-   they are placed in starts[0..], and the number is returned.
-   If nStarts is not large enough, nothing is written to
-   starts[0..], and the negation of the size is returned.
-
-   Correct use of this function may mean calling it multiple times in
-   order to establish a suitably-sized buffer. */
-
-Int VG_(am_get_segment_starts)( Addr* starts, Int nStarts )
-{
-   Int i, j, nSegs;
-
-   /* don't pass dumbass arguments */
-   aspacem_assert(nStarts >= 0);
-
-   nSegs = 0;
-   for (i = 0; i < asegs_pri.used; i++) {
-      if (asegs_pri.seg[i].kind == ASkFree
-          || asegs_pri.seg[i].kind == ASkPreAlloc)
-         continue;
-      nSegs++;
-   }
-
-   if (nSegs > nStarts) {
-      /* The buffer isn't big enough.  Tell the caller how big it needs
-         to be. */
-      return -nSegs;
-   }
-
-   /* There's enough space.  So write into the result buffer. */
-   aspacem_assert(nSegs <= nStarts);
-
-   j = 0;
-   for (i = 0; i < asegs_pri.used; i++) {
-      if (asegs_pri.seg[i].kind == ASkFree
-          || asegs_pri.seg[i].kind == ASkPreAlloc)
-         continue;
-      starts[j++] = asegs_pri.seg[i].start;
-   }
-
-   aspacem_assert(j == nSegs); /* this should not fail */
-   return nSegs;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Sanity checking and preening of the segment array.        ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-Bool VG_(am_do_sync_check) ( const HChar* fn, 
-                             const HChar* file, Int line )
-{
-   /* There's nothing we can do here; just return a dummy value. */
-   return False; /* placate gcc */
-}
-
-/* Hook to allow sanity checks to be done from aspacemgr-common.c. */
-void ML_(am_do_sanity_check)( void )
-{
-   Bool ok = sane_AixSegments( &asegs_pri );
-   aspacem_assert(ok);
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Finding segments.                                         ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* Finds the segment containing 'a'.  Only returns file/anon/resvn
-   segments.  On AIX5 this is pretty bogus; we fake up an entry as
-   best we can by snooping round for useful information in
-   asegs_pri. */
-
-NSegment const* VG_(am_find_nsegment) ( Addr a )
-{
-   Int             i;
-   AixSegment*     aseg;
-   static NSegment bogus;
-
-   /* Fill in default info. */
-   bogus.kind   = SkAnonC;
-   bogus.start  = 0;
-   bogus.end    = 0;
-   bogus.smode  = SmFixed;
-   bogus.dev    = 0;
-   bogus.ino    = 0;
-   bogus.mode   = 0;
-   bogus.offset = 0;
-   bogus.fnIdx  = -1;
-   bogus.hasR   = bogus.hasW = bogus.hasX = False;
-   bogus.hasT   = False;
-   bogus.isCH   = False;
-   bogus.mark   = False;
-
-   /* Go look for it in the segment table. */
-   i = find_asegment_idx( &asegs_pri, a );
-   aspacem_assert(i >= 0 && i <= asegs_pri.used);
-
-   aseg = &asegs_pri.seg[i];
-   if (aseg->kind == ASkFree || aseg->kind == ASkPreAlloc)
-      return NULL;
-
-   bogus.start  = aseg->start;
-   bogus.end    = aseg->end;
-
-   /* Refine */
-   switch (aseg->kind) {
-      case ASkMText:
-         bogus.kind = SkAnonC; /* hmm, pretty darn bogus */
-         bogus.hasR = bogus.hasX = True;
-         break;
-      case ASkMData:
-         bogus.kind = SkAnonC; /* hmm, pretty darn bogus */
-         bogus.hasR = bogus.hasW = True;
-         break;
-      case ASkShmemC:
-         bogus.kind = SkShmC;
-         bogus.hasR = aseg->hasR;
-         bogus.hasW = aseg->hasW;
-         bogus.hasX = aseg->hasX;
-         break;
-      case ASkAnonC:
-         bogus.kind = SkAnonC;
-         bogus.hasR = aseg->hasR;
-         bogus.hasW = aseg->hasW;
-         bogus.hasX = aseg->hasX;
-         bogus.isCH = aseg->isCH;
-         break;
-      case ASkAnonV:
-         bogus.kind = SkAnonV;
-         bogus.hasR = aseg->hasR;
-         bogus.hasW = aseg->hasW;
-         bogus.hasX = aseg->hasX;
-         break;
-      case ASkFileV:
-         bogus.kind = SkFileV;
-         bogus.hasR = aseg->hasR;
-         bogus.hasW = aseg->hasW;
-         bogus.hasX = aseg->hasX;
-         bogus.offset = aseg->offset;
-         break;
-      default:
-         aspacem_assert(0);
-   }
-
-   return &bogus;
-}
-
-
-/* Find the next segment along from 'here', if it is a file/anon/resvn
-   segment. */
-NSegment const* VG_(am_next_nsegment) ( NSegment* here, Bool fwds )
-{
-   ML_(am_barf)("unimplemented: VG_(am_next_nsegment)");
-   return NULL; /* placate gcc */
-}
-
-
-/* Trivial fn: return the total amount of space in anonymous mappings,
-   both for V and the client.  Is used for printing stats in
-   out-of-memory messages. */
-ULong VG_(am_get_anonsize_total)( void )
-{
-   Int   i;
-   ULong total = 0;
-   for (i = 0; i < asegs_pri.used; i++) {
-      if (asegs_pri.seg[i].kind == ASkAnonC 
-          || asegs_pri.seg[i].kind == ASkAnonV) {
-         total += (ULong)asegs_pri.seg[i].end
-                  - (ULong)asegs_pri.seg[i].start + 1ULL;
-      }
-   }
-   return total;
-}
-
-
-/* Test if a piece of memory is addressable by the client with at
-   least the "prot" protection permissions by examining the underlying
-   segments. */
-Bool VG_(am_is_valid_for_client)( Addr start, SizeT len, 
-                                  UInt prot )
-{
-   NSegment const * const fake = VG_(am_find_nsegment)(start);
-   if (!fake)
-      return False;
-   aspacem_assert(fake->start <= start);
-   aspacem_assert(start + len - 1 <= fake->end);
-   if (fake->kind == SkAnonV || fake->kind == SkFileV)
-      return False;
-   if ((prot & VKI_PROT_READ) && !fake->hasR)
-      return False;
-   if ((prot & VKI_PROT_WRITE) && !fake->hasW)
-      return False;
-   if ((prot & VKI_PROT_EXEC) && !fake->hasX)
-      return False;
-   return True;
-}
-
-/* Variant of VG_(am_is_valid_for_client) which allows free areas to
-   be considered part of the client's addressable space.  It also
-   considers reservations to be allowable, since from the client's
-   point of view they don't exist. */
-Bool VG_(am_is_valid_for_client_or_free_or_resvn)
-   ( Addr start, SizeT len, UInt prot )
-{
-   ML_(am_barf)("unimplemented: "
-                "VG_(am_is_valid_for_client_or_free_or_resvn)");
-   /*NOTREACHED*/
-   return False;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Startup, including reading /proc/self/maps.               ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* Initialise the address space manager, setting up the initial
-   segment list, and reading /proc/self/maps into it.  This must
-   be called before any other function.
-
-   Takes a pointer to the SP at the time V gained control.  This is
-   taken to be the highest usable address (more or less).  Based on
-   that (and general consultation of tea leaves, etc) return a
-   suggested end address for the client's stack. */
-
-Addr VG_(am_startup) ( Addr sp_at_startup )
-{
-   aspacem_assert(sizeof(Word)   == sizeof(void*));
-   aspacem_assert(sizeof(Addr)   == sizeof(void*));
-   aspacem_assert(sizeof(SizeT)  == sizeof(void*));
-   aspacem_assert(sizeof(SSizeT) == sizeof(void*));
-
-   asegs_tnew.used = 0;
-   asegs_told.used = 0;
-
-   asegs_pri.used  = 1;
-   init_AixSegments( &asegs_pri );
-   aspacem_assert( sane_AixSegments(&asegs_pri) );
-
-   if (0)
-      VG_(am_show_nsegments)(0,"AFTER VG_(am_startup)");
-
-   /* We do not make an initial read of /proc/../map since doing so
-      would leave us without a way to communicate the results to a
-      caller.  Hence we expect that the caller (m_main) will call
-      VG_(am_aix5_reread_procmap) soon after this call so as to get
-      the initial code/data segments recorded. */
-
-   /* Return value is irrelevant since we don't lay out the
-      client's stack; it is already done. */
-   return 0; 
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Preallocation (acquiring space from sbrk).                ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-static
-SysRes local_do_sbrk_NO_NOTIFY( Word delta )
-{
-   SysRes res;
-   aspacem_assert(__NR_AIX5_sbrk != __NR_AIX5_UNKNOWN);
-   res = VG_(do_syscall1)(__NR_AIX5_sbrk, (UWord)delta);
-   /* kernel produces (-1, VKI_ENOMEM) on failure.  I think that's
-      ok. */
-   return res;
-}
-
-
-/* Find the ix of a prealloc section containing at least req_sz bytes,
-   or -1 if not found.  Uses best-fit. */
-
-static Int find_prealloc_idx ( SizeT req_sz )
-{
-   SizeT best_sz, this_sz;
-   Int   best_ix, i;
-   aspacem_assert(sizeof(SizeT) == sizeof(Addr));
-   aspacem_assert(req_sz > 0);
-   aspacem_assert(AM_IS_4K_ALIGNED(req_sz));
-
-   best_sz = Addr_MAX;
-   best_ix = -1;
-
-   for (i = 0; i < asegs_pri.used; i++) {
-      AixSegment* s = &asegs_pri.seg[i];
-      if (s->kind != ASkPreAlloc)
-         continue;
-      this_sz
-        = s->end + 1 - s->start;
-      aspacem_assert(this_sz > 0);
-      aspacem_assert(AM_IS_4K_ALIGNED(this_sz));
-      if (this_sz >= req_sz && this_sz < best_sz) {
-         best_sz = this_sz;
-         best_ix = i;
-      }
-   }
-
-   return best_ix;
-}
-
-
-/* Create a new prealloc section containing req_sz bytes.  Returns
-   False if failed, True on success. */
-
-static Bool new_prealloc ( SizeT req_sz )
-{
-   SysRes     sres;
-   AixSegment seg;
-   Addr       start;
-   SSizeT     delta;
-   HChar*     why = NULL;
-
-   aspacem_assert(req_sz > 0);
-   aspacem_assert(AM_IS_4K_ALIGNED(req_sz));
-
-   /* m_syswrap may have decided that it's not currently safe to allow
-      allocations from sbrk-world.  If so, we have to fail. */
-   if (0 && !VG_(am_aix5_sbrk_allowed)) {
-      why = "sbrk disallowed";
-      goto fail;
-   }
-
-   /* Get the current limit. */
-   sres = local_do_sbrk_NO_NOTIFY(0);
-   if (sres.isError) {
-      why = "initial sbrk failed";
-      goto fail;
-   }
-
-   /* Get it page aligned */
-   delta = AM_4K_ROUNDUP(sres.res) - sres.res;
-   aspacem_assert(delta >= 0 && delta < AM_4K_PAGESZ);
-   if (delta > 0) {
-      sres = local_do_sbrk_NO_NOTIFY(delta);
-      if (sres.isError) {
-         why = "aligning sbrk failed";
-         goto fail;
-      }
-   }
-
-   /* Now the brk is aligned.  Try to acquire the block. */
-   sres = local_do_sbrk_NO_NOTIFY(0);
-   if (sres.isError)
-      return False;
-   start = sres.res;
-   aspacem_assert( AM_IS_4K_ALIGNED( start ));
-
-   sres = local_do_sbrk_NO_NOTIFY( req_sz );
-   if (sres.isError) {
-      why = "main sbrk failed";
-      goto fail;
-   }
-
-   /* If this fails, the kernel is acting strange. */
-   aspacem_assert( sres.res == start );
-
-   init_AixSegment( &seg );
-   seg.start = start;
-   seg.end   = start + req_sz - 1;
-   seg.kind  = ASkPreAlloc;
-   seg.hasR  = seg.hasW = seg.hasX = True; /* presumably */
-   add_asegment( &asegs_pri, &seg );
-
-   VG_(debugLog)(
-      1, "aspacem", "new_prealloc: SUCCESS at 0x%llx size %lld\n", 
-         (ULong)start, (ULong)req_sz
-   );
-   return True;
-
-  fail:
-   VG_(debugLog)(1, "aspacem", "new_prealloc: FAILED: %s\n", why);
-   return False;
-}
-
-
-/* Find the ix of a prealloc section capable of holding a block of
-   size req_sz.  If none exists, try to create one first.  Returns -1
-   on failure. */
-
-static Int find_or_create_prealloc_idx ( SizeT req_sz )
-{
-   Int   ix;
-   SizeT req_szX;
-   Bool  alloc_ok;
-
-   if (0)
-      VG_(debugLog)(0, "zz", " find_or_create_prealloc_idx ( %lu )\n", 
-                       req_sz);
-
-   aspacem_assert(sizeof(SizeT) == sizeof(Addr));
-   aspacem_assert(req_sz > 0);
-   aspacem_assert(AM_IS_4K_ALIGNED(req_sz));
-
-   ix = find_prealloc_idx ( req_sz );
-   if (ix >= 0 && ix < asegs_pri.used)
-      return ix;
-
-   /* Not found.  We'll have to allocate one.  Allocate some extra at
-      the same time, so as to give a reservoir from which to satisfy
-      future requests. */
-   aspacem_assert(ix == -1);
-
-   req_szX = req_sz + AM_PREALLOC_EXTRA;
-   aspacem_assert(req_szX > 0);
-   aspacem_assert(AM_IS_4K_ALIGNED(req_szX));
-
-   alloc_ok = new_prealloc( req_szX );
-   if (!alloc_ok)
-      return -1; /* failed */
-
-   /* We should now be able to find it in the segment table. */
-   ix = find_prealloc_idx( req_sz );
-   aspacem_assert(ix >= 0 && ix < asegs_pri.used);
-   return ix;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- The core query-notify mechanism.                          ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* Query aspacem to ask where a mapping should go. */
-
-Addr VG_(am_get_advisory) ( MapRequest*  req, 
-                            Bool         forClient, 
-                            /*OUT*/Bool* ok )
-{
-   ML_(am_barf)("unimplemented: VG_(am_get_advisory)");
-   /*NOTREACHED*/
-   return 0; /* placate gcc -Wall */
-}
-
-
-/* Convenience wrapper for VG_(am_get_advisory) for client floating or
-   fixed requests.  If start is zero, a floating request is issued; if
-   nonzero, a fixed request at that address is issued.  Same comments
-   about return values apply. */
-
-Addr VG_(am_get_advisory_client_simple) ( Addr start, SizeT len, 
-                                          /*OUT*/Bool* ok )
-{
-   ML_(am_barf)("unimplemented: VG_(am_get_advisory_client_simple)");
-   /*NOTREACHED*/
-   return 0; /* placate gcc -Wall */
-}
-
-
-/* Notifies aspacem that the client completed an mmap successfully.
-   The segment array is updated accordingly.  If the returned Bool is
-   True, the caller should immediately discard translations from the
-   specified address range. */
-
-Bool
-VG_(am_notify_client_mmap)( Addr a, SizeT len, UInt prot, UInt flags,
-                            Int fd, Off64T offset )
-{
-   AixSegment seg;
-   Bool       needDiscard;
-
-   if (len == 0)
-      return False;
-
-   /* Discard is needed if any of the just-trashed range had T. */
-   needDiscard = True; /* conservative but safe */
-
-   init_AixSegment( &seg );
-   seg.kind   = ASkAnonC; /* XXX bogus: could be a file */
-   seg.start  = a;
-   seg.end    = a + len - 1;
-   seg.hasR   = toBool(prot & VKI_PROT_READ);
-   seg.hasW   = toBool(prot & VKI_PROT_WRITE);
-   seg.hasX   = toBool(prot & VKI_PROT_EXEC);
-
-   if (0)
-   VG_(debugLog)(0,"aspacem","notify mmap ( %p, %ld, %ld, %ld )\n", 
-                             (void*)a, len, (UWord)prot, (UWord)flags);
-
-   add_asegment( &asegs_pri, &seg );
-   AM_SANITY_CHECK("am_notify_client_mmap");
-   return needDiscard;
-}
-
-
-/* Notifies aspacem that the client completed a shmat successfully.
-   The segment array is updated accordingly.  If the returned Bool is
-   True, the caller should immediately discard translations from the
-   specified address range. */
-
-Bool
-VG_(am_notify_client_shmat)( Addr a, SizeT len, UInt prot )
-{
-   AixSegment seg;
-   init_AixSegment( &seg );
-   seg.kind  = ASkShmemC;
-   seg.start = a;
-   seg.end   = seg.start + len - 1;
-   seg.hasR  = (prot & VKI_PROT_READ)  ? True : False;
-   seg.hasW  = (prot & VKI_PROT_WRITE) ? True : False;
-   seg.hasX  = (prot & VKI_PROT_EXEC)  ? True : False;
-   add_asegment( &asegs_pri, &seg );
-   AM_SANITY_CHECK("am_notify_client_shmat");
-   if (0) VG_(am_show_nsegments)(0, "after shmat");
-   return True; /* be paranoid */
-}
-
-
-/* Notifies aspacem that an mprotect was completed successfully.  The
-   segment array is updated accordingly.  Note, as with
-   VG_(am_notify_munmap), it is not the job of this function to reject
-   stupid mprotects, for example the client doing mprotect of
-   non-client areas.  Such requests should be intercepted earlier, by
-   the syscall wrapper for mprotect.  This function merely records
-   whatever it is told.  If the returned Bool is True, the caller
-   should immediately discard translations from the specified address
-   range. */
-
-Bool VG_(am_notify_mprotect)( Addr start, SizeT len, UInt prot )
-{
-   Int  i, iLo, iHi;
-   Bool newR, newW, newX, needDiscard;
-
-   if (len == 0)
-      return False;
-
-   newR = toBool(prot & VKI_PROT_READ);
-   newW = toBool(prot & VKI_PROT_WRITE);
-   newX = toBool(prot & VKI_PROT_EXEC);
-
-   /* Discard is needed if we're dumping X permission */
-   needDiscard = True; /* conservative but correct */
-
-   split_asegments_lo_and_hi( &asegs_pri, start, start+len-1, &iLo, &iHi );
-
-   iLo = find_asegment_idx(&asegs_pri, start);
-   iHi = find_asegment_idx(&asegs_pri, start + len - 1);
-
-   for (i = iLo; i <= iHi; i++) {
-      aspacem_assert(i >= 0 && i < asegs_pri.used);
-      /* Apply the permissions to all relevant segments. */
-      if (asegs_pri.seg[i].kind != ASkFree) {
-         asegs_pri.seg[i].hasR = newR;
-         asegs_pri.seg[i].hasW = newW;
-         asegs_pri.seg[i].hasX = newX;
-         aspacem_assert(sane_AixSegment(&asegs_pri.seg[i]));
-      }
-   }
-   if (0)
-   VG_(debugLog)(0,"aspacem","notify mprotect ( %p, %ld, %ld )\n", 
-                             (void*)start, len, (UWord)prot);
-   /* Changing permissions could have made previously un-mergable
-      segments mergeable.  Therefore have to re-preen them. */
-   preen_asegments(&asegs_pri);
-   AM_SANITY_CHECK("am_notify_mprotect");
-   return needDiscard;
-}
-
-
-/* Notifies aspacem that an munmap completed successfully.  The
-   segment array is updated accordingly.  As with
-   VG_(am_notify_munmap), we merely record the given info, and don't
-   check it for sensibleness.  If the returned Bool is True, the
-   caller should immediately discard translations from the specified
-   address range. */
-
-Bool VG_(am_notify_munmap)( Addr start, SizeT len )
-{
-   Bool       needDiscard = True; /* conservative but safe */
-   AixSegment seg;
-
-   if (len == 0)
-      return False;
-
-   init_AixSegment( &seg );
-   seg.kind  = ASkFree;
-   seg.start = start;
-   seg.end   = start + len - 1;
-   add_asegment( &asegs_pri, &seg );
-   AM_SANITY_CHECK("am_notify_munmap");
-
-   return needDiscard;
-}
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- Handling mappings which do not arise directly from the    ---*/
-/*--- simulation of the client.                                 ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* --- --- --- map, unmap, protect  --- --- --- */
-
-/* Map a file at a fixed address for the client, and update the
-   segment array accordingly. */
-
-SysRes VG_(am_mmap_file_fixed_client)
-     ( Addr start, SizeT length, UInt prot, Int fd, Off64T offset )
-{
-   SysRes r = {0,0};
-   ML_(am_barf)("unimplemented: VG_(am_mmap_file_fixed_client)");
-   /*NOTREACHED*/
-   return r;
-}
-
-
-/* Map anonymously at a fixed address for the client, and update
-   the segment array accordingly. */
-
-SysRes VG_(am_mmap_anon_fixed_client) ( Addr start, SizeT length, UInt prot )
-{
-   SysRes r = {0,0};
-   ML_(am_barf)("unimplemented: VG_(am_mmap_anon_fixed_client)");
-   /*NOTREACHED*/
-   return r;
-}
-
-
-/* Map anonymously at an unconstrained address for the client, and
-   update the segment array accordingly.  */
-
-SysRes VG_(am_mmap_anon_float_client) ( SizeT length, Int prot )
-{
-   SysRes     sres;
-   AixSegment seg;
-
-   /* Not allowable. */
-   if (length == 0)
-      return VG_(mk_SysRes_Error)( VKI_EINVAL );
-
-   /* AIX seems to demand fd == -1 in anonymous mappings. hence: */
-   sres = VG_(am_do_mmap_NO_NOTIFY)(
-             0, length,
-             prot,
-             VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,
-             -1, 0
-          );
-
-   if (!sres.isError) {
-      init_AixSegment( &seg );
-      seg.kind  = ASkAnonC;
-      seg.start = sres.res;
-      seg.end   = seg.start + length - 1;
-      seg.hasR  = toBool((prot & VKI_PROT_READ) > 0);
-      seg.hasW  = toBool((prot & VKI_PROT_WRITE) > 0);
-      seg.hasX  = toBool((prot & VKI_PROT_EXEC) > 0);
-      seg.fromP = False;
-      add_asegment( &asegs_pri, &seg );
-      VG_(debugLog)(2, "aspacem", "new AnonC from mmap, size %lu\n", 
-                       length );
-   }
-
-   return sres;
-}
-
-
-/* Similarly, acquire new address space for the client but with
-   considerable restrictions on what can be done with it: (1) the
-   actual protections may exceed those stated in 'prot', (2) the
-   area's protections cannot be later changed using any form of
-   mprotect, and (3) the area cannot be freed using any form of
-   munmap.  On Linux this behaves the same as
-   VG_(am_mmap_anon_float_client).  On AIX5 this *may* allocate memory
-   by using sbrk, so as to make use of large pages on AIX. */
-
-SysRes VG_(am_sbrk_anon_float_client) ( SizeT length, Int prot )
-{
-   Int        ix;
-   SysRes     sres;
-   AixSegment seg;
-   SizeT      lenX = AM_4K_ROUNDUP(length);
-
-   /* Not allowable. */
-   if (length == 0)
-      return VG_(mk_SysRes_Error)( VKI_EINVAL );
-
-   /* First see if we can get space from sbrk-world. */
-   ix = find_or_create_prealloc_idx ( lenX );
-   if (ix >= 0 && ix < asegs_pri.used) {
-      init_AixSegment( &seg );
-      seg.kind  = ASkAnonC;
-      seg.start = asegs_pri.seg[ix].start;
-      seg.end   = seg.start + lenX - 1;
-      seg.hasR  = toBool((prot & VKI_PROT_READ) > 0);
-      seg.hasW  = toBool((prot & VKI_PROT_WRITE) > 0);
-      seg.hasX  = toBool((prot & VKI_PROT_EXEC) > 0);
-      seg.fromP = True;
-      add_asegment( &asegs_pri, &seg );
-      sres = VG_(mk_SysRes_Success)( seg.start );
-      VG_(debugLog)(2, "aspacem", "new AnonC from prealloc, size %lu\n", 
-                       length );
-      return sres;
-   }
-
-   /* That didn't work out.  Try mmap-world instead. */
-   aspacem_assert(ix == -1);
-   return VG_(am_mmap_anon_float_client)( length, prot );
-}
-
-
-/* Map anonymously at an unconstrained address for V, and update the
-   segment array accordingly.  This is fundamentally how V allocates
-   itself more address space when needed. */
-
-SysRes VG_(am_mmap_anon_float_valgrind)( SizeT length )
-{
-   SysRes     sres;
-   AixSegment seg;
-
-   /* Not allowable. */
-   if (length == 0)
-      return VG_(mk_SysRes_Error)( VKI_EINVAL );
-
-   /* AIX seems to demand fd == -1 in anonymous mappings. hence: */
-   sres = VG_(am_do_mmap_NO_NOTIFY)(
-             0, length,
-             VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC,
-             VKI_MAP_PRIVATE|VKI_MAP_ANONYMOUS,
-             -1, 0
-          );
-
-   if (!sres.isError) {
-      init_AixSegment( &seg );
-      seg.kind  = ASkAnonV;
-      seg.start = sres.res;
-      seg.end   = seg.start + length - 1;
-      seg.hasR  = seg.hasW = seg.hasX = True;
-      seg.fromP = False;
-      add_asegment( &asegs_pri, &seg );
-      VG_(debugLog)(2, "aspacem", "new AnonV from mmap, size %lu\n", 
-                       length );
-   }
-
-   return sres;
-}
-
-
-/* Same comments apply as per VG_(am_sbrk_anon_float_client).  On
-   Linux this behaves the same as VG_(am_mmap_anon_float_valgrind). */
-SysRes VG_(am_sbrk_anon_float_valgrind)( SizeT length )
-{
-   Int        ix;
-   SysRes     sres;
-   AixSegment seg;
-   SizeT      lenX = AM_4K_ROUNDUP(length);
-
-   /* Not allowable. */
-   if (length == 0)
-      return VG_(mk_SysRes_Error)( VKI_EINVAL );
-
-   /* First see if we can get space from sbrk-world. */
-   ix = find_or_create_prealloc_idx ( lenX );
-   if (ix >= 0 && ix < asegs_pri.used) {
-      init_AixSegment( &seg );
-      seg.kind  = ASkAnonV;
-      seg.start = asegs_pri.seg[ix].start;
-      seg.end   = seg.start + lenX - 1;
-      seg.hasR  = True;
-      seg.hasW  = True;
-      seg.hasX  = True;
-      seg.fromP = True;
-      add_asegment( &asegs_pri, &seg );
-      sres = VG_(mk_SysRes_Success)( seg.start );
-      VG_(debugLog)(2, "aspacem", "new AnonV from prealloc, size %lu\n", 
-                       length );
-      return sres;
-   }
-
-   /* That didn't work out.  Try mmap-world instead. */
-   aspacem_assert(ix == -1);
-   return VG_(am_mmap_anon_float_valgrind)( length );
-}
-
-
-/* Really just a wrapper around VG_(am_sbrk_anon_float_valgrind). */
-
-void* VG_(am_shadow_alloc)(SizeT size)
-{
-   SysRes sres = VG_(am_sbrk_anon_float_valgrind)( size );
-   return sres.isError ? NULL : (void*)sres.res;
-}
-
-
-/* Map a file at an unconstrained address for V, and update the
-   segment array accordingly.  This is used by V for transiently
-   mapping in object files to read their debug info. */
-
-SysRes VG_(am_mmap_file_float_valgrind) ( SizeT length, UInt prot, 
-                                          Int fd, Off64T offset )
-{
-   SysRes sres;
-
-   /* Not allowable. */
-   if (length == 0 || !VG_IS_PAGE_ALIGNED(offset))
-      return VG_(mk_SysRes_Error)( VKI_EINVAL );
-
-   sres = VG_(am_do_mmap_NO_NOTIFY)(
-             0, length,
-             prot, VKI_MAP_PRIVATE,
-             fd, offset
-          );
-   if (!sres.isError) {
-      AixSegment seg;
-      init_AixSegment( &seg );
-      seg.kind = SkFileV;
-      seg.start = sres.res;
-      seg.end = seg.start + length - 1;
-      seg.hasR   = toBool(prot & VKI_PROT_READ);
-      seg.hasW   = toBool(prot & VKI_PROT_WRITE);
-      seg.hasX   = toBool(prot & VKI_PROT_EXEC);
-      seg.fname  = add_to_strtab("(FileV-float, unknown name)");
-      add_asegment( &asegs_pri, &seg );
-      aspacem_assert( sane_AixSegments( &asegs_pri ));
-   }
-   return sres;
-}
-
-
-/* Unmap the given address range and update the segment array
-   accordingly.  This fails if the range isn't valid for the client.
-   If *need_discard is True after a successful return, the caller
-   should immediately discard translations from the specified address
-   range. */
-
-SysRes VG_(am_munmap_client)( /*OUT*/Bool* need_discard,
-                              Addr start, SizeT len )
-{
-   SysRes r = {0,0}; 
-   ML_(am_barf)("unimplemented: VG_(am_munmap_client)");
-   /*NOTREACHED*/
-   return r;
-}
-
-
-/* Unmap the given address range and update the segment array
-   accordingly.  This fails if the range isn't valid for valgrind. */
-/* Also, if the specified range doesn't fall within a single segment,
-   it barfs.  This simplifies the implementation; we shouldn't need to
-   deal with anything but the simplest cases. */
-
-SysRes VG_(am_munmap_valgrind)( Addr start, SizeT len )
-{
-   AixSegment* seg;
-   AixSegment  seg2;
-   Addr        end;
-   SysRes      sres;
-   Int         ixS, ixE;
-   Bool        debug = False;
-
-   if (debug)
-      VG_(debugLog)(0,"aspacem", 
-                      "am_munmap_valgrind(%p, %lu)\n", (void*)start, len);
-
-   if (len == 0)
-      return VG_(mk_SysRes_Success)(0);
-
-   /* We have to be a bit careful here.  If the area being unmapped is
-      AnonV which originated from a preallocated area (hence from
-      sbrk-land) then we will have to return it to the preallocated
-      state, rather than unmapping it.  */
-   end = start + len - 1;
-   aspacem_assert(start <= end); // else have wraparound?!
-
-   ixS = find_asegment_idx( &asegs_pri, start );
-   ixE = find_asegment_idx( &asegs_pri, end );
-
-   aspacem_assert(ixS >= 0 && ixS < asegs_pri.used);
-   aspacem_assert(ixE >= 0 && ixE < asegs_pri.used);
-
-   /* Preconditions: See comment at start of fn */
-   aspacem_assert(ixS == ixE);
-
-   /* For the segment S denoted by ixS:
-
-      - if S is AnonV from prealloc and S entirely within start .. end,
-        return it to prealloc
-
-      - if S is AnonV not from prealloc and S entirely within start .. end,
-        munmap it
-
-      - if S is FileV and S entirely within start .. end, munmap it
-
-      Otherwise, leave it alone (too complex to handle).  In theory
-      this could cause a leak; in practice I don't think it will.
-   */
-   seg = &asegs_pri.seg[ixS];
-
-   if (debug)
-      show_AixSegment( 0, ixS, seg );
-
-   /* Invariants */
-   aspacem_assert(seg->start <= start);
-   aspacem_assert(end <= seg->end);
-
-   if (seg->kind == ASkFileV
-       || (seg->kind == ASkAnonV && (!seg->fromP))) {
-      if (debug)
-         VG_(debugLog)(0,"aspacem", "am_munmap_valgrind: !fromP: %p-%p\n",
-                         (void*)start, (void*)end);
-      sres = ML_(am_do_munmap_NO_NOTIFY)( start, len );
-      if (sres.isError)
-         goto bad;
-      init_AixSegment( &seg2 );
-      seg2.start = start;
-      seg2.end   = end;
-      seg2.kind  = ASkFree;
-      add_asegment( &asegs_pri, &seg2 );
-   }
-   else
-   if (seg->kind == ASkAnonV && seg->fromP) {
-      if (debug)
-         VG_(debugLog)(0,"aspacem", "am_munmap_valgrind:  fromP: %p-%p\n",
-                         (void*)start, (void*)end);
-      init_AixSegment( &seg2 );
-      seg2.start = start;
-      seg2.end   = end;
-      seg2.kind  = ASkPreAlloc;
-      seg2.hasR  = seg2.hasW = seg2.hasX = True;
-      add_asegment( &asegs_pri, &seg2 );
-   }
-   else {
-      /* shouldn't be asked to handle any other cases */
-      aspacem_assert(0);
-   }
-
-   aspacem_assert( sane_AixSegments( &asegs_pri ));
-   return VG_(mk_SysRes_Success)(0);
-
-  bad:
-   aspacem_assert( sane_AixSegments( &asegs_pri ));
-   return VG_(mk_SysRes_Error)(VKI_EINVAL);
-}
-
-
-/* Let (start,len) denote an area within a single Valgrind-owned
-  segment (anon or file).  Change the ownership of [start, start+len)
-  to the client instead.  Fails if (start,len) does not denote a
-  suitable segment. */
-
-Bool VG_(am_change_ownership_v_to_c)( Addr start, SizeT len )
-{
-   return True;
-}
-
-
-/* 'seg' must be NULL or have been obtained from
-   VG_(am_find_nsegment), and still valid.  If non-NULL, and if it
-   denotes a SkAnonC (anonymous client mapping) area, set the .isCH
-   (is-client-heap) flag for that area.  Otherwise do nothing.
-   (Bizarre interface so that the same code works for both Linux and
-   AIX and does not impose inefficiencies on the Linux version.) */
-/* AIX: presumably this is a faked-up segment our VG_(am_find_segment)
-   came up with.  So we have to find the corresponding AixSegment. */
-
-void VG_(am_set_segment_isCH_if_SkAnonC)( NSegment* seg )
-{
-   Int i;
-   if (seg == NULL)
-      return;
-   i = find_asegment_idx( &asegs_pri, seg->start );
-   aspacem_assert(i >= 0 && i < asegs_pri.used );
-   if (asegs_pri.seg[i].kind == ASkAnonC) {
-      asegs_pri.seg[i].isCH = True;
-      if (0)
-         VG_(debugLog)(0,"aspacem","set isCH for %p\n", (void*)seg->start );
-   } else {
-      aspacem_assert(asegs_pri.seg[i].isCH == False);
-   }
-}
-
-
-/* Same idea as VG_(am_set_segment_isCH_if_SkAnonC), except set the
-   segment's hasT bit (has-cached-code) if this is SkFileC or SkAnonC
-   segment. */
-/* AIX: we ignore these complexities by conservatively assuming that
-   all segments had translations taken from them.  Hence we can safely
-   ignore this. */
-void VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC)( NSegment* seg )
-{
-}
-
-
-/* --- --- --- reservations --- --- --- */
-
-/* Create a reservation from START .. START+LENGTH-1, with the given
-   ShrinkMode.  When checking whether the reservation can be created,
-   also ensure that at least abs(EXTRA) extra free bytes will remain
-   above (> 0) or below (< 0) the reservation.
-
-   The reservation will only be created if it, plus the extra-zone,
-   falls entirely within a single free segment.  The returned Bool
-   indicates whether the creation succeeded. */
-
-Bool VG_(am_create_reservation) ( Addr start, SizeT length, 
-                                  ShrinkMode smode, SSizeT extra )
-{
-   ML_(am_barf)("unimplemented: VG_(am_create_reservation)");
-   /*NOTREACHED*/
-   return False;
-}
-
-
-/* Let SEG be an anonymous client mapping.  This fn extends the
-   mapping by DELTA bytes, taking the space from a reservation section
-   which must be adjacent.  If DELTA is positive, the segment is
-   extended forwards in the address space, and the reservation must be
-   the next one along.  If DELTA is negative, the segment is extended
-   backwards in the address space and the reservation must be the
-   previous one.  DELTA must be page aligned.  abs(DELTA) must not
-   exceed the size of the reservation segment minus one page, that is,
-   the reservation segment after the operation must be at least one
-   page long. */
-
-Bool VG_(am_extend_into_adjacent_reservation_client) ( NSegment* seg, 
-                                                       SSizeT    delta )
-{
-   ML_(am_barf)("unimplemented: "
-                "VG_(am_extend_into_adjacent_reservation_client)");
-   /*NOTREACHED*/
-   return False;
-}
-
-
-/* --- --- --- resizing/move a mapping --- --- --- */
-
-/* Let SEG be a client mapping (anonymous or file).  This fn extends
-   the mapping forwards only by DELTA bytes, and trashes whatever was
-   in the new area.  Fails if SEG is not a single client mapping or if
-   the new area is not accessible to the client.  Fails if DELTA is
-   not page aligned.  *seg is invalid after a successful return.  If
-   *need_discard is True after a successful return, the caller should
-   immediately discard translations from the new area. */
-
-Bool VG_(am_extend_map_client)( /*OUT*/Bool* need_discard,
-                                NSegment* seg, SizeT delta )
-{
-   ML_(am_barf)("unimplemented: VG_(am_extend_map_client)");
-   /*NOTREACHED*/
-   return False;
-}
-
-
-/* Remap the old address range to the new address range.  Fails if any
-   parameter is not page aligned, if the either size is zero, if any
-   wraparound is implied, if the old address range does not fall
-   entirely within a single segment, if the new address range overlaps
-   with the old one, or if the old address range is not a valid client
-   mapping.  If *need_discard is True after a successful return, the
-   caller should immediately discard translations from both specified
-   address ranges.  */
-
-Bool VG_(am_relocate_nooverlap_client)( /*OUT*/Bool* need_discard,
-                                        Addr old_addr, SizeT old_len,
-                                        Addr new_addr, SizeT new_len )
-{
-   ML_(am_barf)("unimplemented: VG_(am_relocate_nooverlap_client)");
-   /*NOTREACHED*/
-   return False;
-}
-
-
-
-/*-----------------------------------------------------------------*/
-/*---                                                           ---*/
-/*--- A simple parser for /proc/<pid>/map on AIX5.              ---*/
-/*--- Almost completely independent of the stuff above.  The    ---*/
-/*--- only function it 'exports' to the code above this comment ---*/
-/*--- is parse_procselfmaps.                                    ---*/
-/*---                                                           ---*/
-/*-----------------------------------------------------------------*/
-
-/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#include <sys/procfs.h>
-/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-
-
-/* Size of a smallish table used to read /proc/<pid>/map entries. */
-#define M_APROCMAP_BUF 100000
-
-/* static ... to keep it out of the stack frame. */
-static HChar procmap_buf[M_APROCMAP_BUF];
-
-/* Records length of /proc/<pid>/map read into procmap_buf. */
-static Int buf_n_tot;
-
-/* Helper fns. */
-
-/* Get the contents of /proc/<pid>/map into a static buffer.  If
-   there's a syntax error, it won't fit, or other failure, just
-   abort. */
-
-static void read_procselfmap_into_buf ( void )
-{
-   Char   fname[50];
-   Int    n_chunk;
-   SysRes fd;
-
-   ML_(am_sprintf)( fname, "/proc/%d/map", ML_(am_getpid)() );
-
-   /* Read the initial memory mapping from the /proc filesystem. */
-   fd = ML_(am_open)( fname, VKI_O_RDONLY, 0 );
-   if (fd.isError)
-      ML_(am_barf)("can't open /proc/<pid>/map");
-
-   buf_n_tot = 0;
-   do {
-      n_chunk = ML_(am_read)( fd.res, &procmap_buf[buf_n_tot],
-                              M_APROCMAP_BUF - buf_n_tot );
-      buf_n_tot += n_chunk;
-   } while ( n_chunk > 0 && buf_n_tot < M_APROCMAP_BUF );
-
-   ML_(am_close)(fd.res);
-
-   if (buf_n_tot >= M_APROCMAP_BUF-5)
-      ML_(am_barf_toolow)("M_APROCMAP_BUF");
-   if (buf_n_tot == 0)
-      ML_(am_barf)("I/O error on /proc/<pid>/map");
-
-   procmap_buf[buf_n_tot] = 0;
-}
-
-
-/* /proc/<pid>/map appears to give out a non-absolute path name for
-   the main executable.  Fortunately we can reliably identify the main
-   executable via the MA_MAINEXEC bit, and if we find the path is
-   non-absolute, replace it with /proc/<pid>/object/a.out instead.
-   AIX guarantees the latter is another name for the main
-   executable. */
-
-static HChar* kludge_exe_file_name ( HChar* file_name, prmap_t* map )
-{
-   static Int   my_pid = -1;
-   static HChar a_out_name[64];
-   if (file_name == NULL)
-      return NULL;
-   if (file_name[0] != '/' && (map->pr_mflags & MA_MAINEXEC)) {
-      if (my_pid == -1)
-         my_pid = ML_(am_getpid)();
-      ML_(am_sprintf)(a_out_name, "/proc/%d/object/a.out", my_pid);
-      file_name = a_out_name;
-   }
-   return file_name;
-}
-
-
-
-/* Parse /proc/<pid>/map, copying the entries in it into an
-   AixSegments structure.  Returns a properly formed AixSegments, with
-   ASkMText/ASkMData entries, with sibling pointers set up, and
-   ASkFree everywhere else.
-*/
-static void parse_procselfmap ( /*OUT*/AixSegments* segs )
-{
-   UChar      rr, ww, xx, mm, ss;
-   prmap_t*   map;
-   UChar*     file_name;
-   UChar*     member_name;
-   Bool       show_map;
-   Int        off, i, j;
-   AixSegment s;
-
-   const UInt valid_pr_mflags
-      = MA_MAINEXEC | MA_KERNTEXT | MA_READ | MA_WRITE 
-        | MA_EXEC | MA_SHARED | MA_BREAK | MA_STACK;
-
-   segs->used = 1;
-   init_AixSegments(segs);
-   aspacem_assert( sane_AixSegments(segs) );
-
-   read_procselfmap_into_buf();
-
-   if (0)
-      VG_(debugLog)(0, "procselfmaps", "got %d bytes\n", buf_n_tot);
-
-   off = 0;
-   while (True) {
-
-      /* stay sane .. */
-      if (off + sizeof(prmap_t) > buf_n_tot)
-         break;
- 
-      map = (prmap_t*)&procmap_buf[off];
-      off += sizeof(prmap_t);
-
-      /* When should we stop reading the array?
-         /usr/include/sys/procfs.h says that "Array entries continue
-         until an entry with a pr_size field of 0 and invalid
-         pr_mflags occurs."  It unhelpfully fails to define what
-         "invalid" means here.  However, the following test _seems_ to
-         work. */
-      if (map->pr_size == 0 
-          && (map->pr_mflags & valid_pr_mflags) == 0)
-         break;
-
-      /* Ok, keep going, but ignore any zero-sized mappings: */
-      if (map->pr_size == 0)
-         continue;
-
-      mm = (map->pr_mflags & MA_MAINEXEC) > 0;
-      rr = (map->pr_mflags & MA_READ) > 0;
-      ww = (map->pr_mflags & MA_WRITE) > 0;
-      xx = (map->pr_mflags & MA_EXEC) > 0;
-      ss = (map->pr_mflags & MA_SHARED) > 0;
-
-      if (map->pr_pathoff > 0) {
-         file_name   = &procmap_buf[map->pr_pathoff];
-         member_name = file_name + VG_(strlen)(file_name) + 1;
-         if (*member_name == 0)
-            member_name = NULL;
-      } else {
-         file_name = member_name = NULL;
-      }
-      file_name = kludge_exe_file_name( file_name, map );
-
-      /* Now file_name and member_name are NULL or ordinary strings.
-         Convert them to string-table resident strings. */
-      if (file_name)
-         file_name = add_to_strtab(file_name);
-      if (member_name)
-         member_name = add_to_strtab(member_name);
-
-      /* Create a suitable kind of segment.  Initially we will start
-         with bogus sibling pointers, and allow ASkMData entries to
-         have file names, since we cannot assume anything about the
-         ordering of entries in the procmap file.  In a second pass,
-         we will set up the sibling pointers based on those file
-         names, then remove the MData file names. */
-      init_AixSegment(&s);
-      show_map = False;
-      if (rr && (!ww) && xx) {
-         if (map->pr_size > 0) {
-            /* r-x segment; add bounds for a text area. */
-            s.kind    = ASkMText;
-            s.start   = (Addr)map->pr_vaddr;
-            s.end     = (Addr)map->pr_vaddr + (Addr)map->pr_size - 1;
-            s.isMainExe = mm;
-            s.sibling = 0;
-            s.fname   = file_name;
-            s.mname   = member_name;
-            s.hasR = rr;
-            s.hasW = ww;
-            s.hasX = xx;
-            add_asegment(segs, &s);
-         }
-      }
-      else
-      if (rr && ww && (!xx)) {
-         if (map->pr_size > 0) {
-            /* rw- segment; add bounds for a data area. */
-            s.kind    = ASkMData;
-            s.start   = (Addr)map->pr_vaddr;
-            s.end     = (Addr)map->pr_vaddr + (Addr)map->pr_size - 1;
-            /* Set a bogus non-zero sibling pointer, since sanity
-               checking will reject zero sibling pointers on MData.
-               It doesn't matter since the loops following this one
-               below fix up the sibling pointers. */
-            s.sibling = 1;
-            s.fname   = file_name;
-            s.mname   = member_name;
-            s.hasR = rr;
-            s.hasW = ww;
-            s.hasX = xx;
-            add_asegment(segs, &s);
-         }
-      }
-      else {
-         /* unclassifiable; we better complain. */
-         show_map = True;
-         VG_(debugLog)(0, "aspacem", "parse_procselfmap: unclassifiable:\n");
-      }
-
-      if (show_map)
-         VG_(debugLog)(1,"aspacem",
-                       "  %010llx-%010llx %c%c%c%c%c %s%s%s%s\n",
-                       (ULong)map->pr_vaddr,
-                       (ULong)map->pr_vaddr + (ULong)map->pr_size,
-                       mm ? 'M' : '-',
-                       rr ? 'r' : '-',
-                       ww ? 'w' : '-',
-                       xx ? 'x' : '-',
-                       ss ? 'S' : '-',
-                       file_name ? file_name : (UChar*)"(none)",
-                       member_name ? "(" : "",
-                       member_name ? member_name : (UChar*)"",
-                       member_name ? ")" : ""
-         );
-
-   }
-
-   /* Set up sibling pointers.  For each MData, find an MText with the
-      same file/member names, or complain.  This is really ugly in
-      that it makes the process quadratic in the number of modules
-      mapped in, but I can't think of a (simple) better way.  */
-
-   for (i = 0; i < segs->used; i++) {
-      if (segs->seg[i].kind != ASkMData)
-         continue;
-      for (j = 0; j < segs->used; j++) {
-         if (segs->seg[j].kind == ASkMText 
-             && segs->seg[j].fname == segs->seg[i].fname
-             && segs->seg[j].mname == segs->seg[i].mname)
-            break;
-      }
-      if (j == segs->used) {
-         VG_(debugLog)(0, "aspacem", "parse_procselfmap: "
-            "data segment with no associated text segment:\n");
-         VG_(debugLog)(0, "aspacem", "module = %s(%s)\n",
-                          segs->seg[i].fname,
-                          segs->seg[i].mname ? segs->seg[i].mname 
-                                             : (UChar*)"(none)");
-         aspacem_assert(0);
-      }
-      aspacem_assert(j >= 0 && j < segs->used && j != i);
-      segs->seg[i].sibling = segs->seg[j].start;
-   }
-
-   /* (Almost) dually, for each MText, find an MData with same
-      file/member names, but don't complain if not present. */
-
-   for (i = 0; i < segs->used; i++) {
-      if (segs->seg[i].kind != ASkMText)
-         continue;
-      for (j = 0; j < segs->used; j++) {
-         if (segs->seg[j].kind == ASkMData 
-             && segs->seg[j].fname == segs->seg[i].fname
-             && segs->seg[j].mname == segs->seg[i].mname)
-            break;
-      }
-      if (j == segs->used) {
-         /* no corresponding MData found; harmless. */
-      } else {
-         aspacem_assert(j >= 0 && j < segs->used && j != i);
-         segs->seg[i].sibling = segs->seg[j].start;
-      }
-   }
-
-   /* Finally, get rid of fname/mname pointers on MDatas, so as to
-      adhere to the necessary representational invariants. */
-   for (i = 0; i < segs->used; i++) {
-      if (segs->seg[i].kind == ASkMData){
-         segs->seg[i].fname = segs->seg[i].mname = NULL;
-      }
-   }
-
-   aspacem_assert( sane_AixSegments(segs) );
-   if (0)
-      show_AixSegments(0, "as read from procmap", segs);
-}
-
-#endif // defined(VGO_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c
index 1d917df..d2e0ba5 100644
--- a/coregrind/m_aspacemgr/aspacemgr-common.c
+++ b/coregrind/m_aspacemgr/aspacemgr-common.c
@@ -140,8 +140,8 @@
 
 //--------------------------------------------------------------
 // Direct access to a handful of syscalls.  This avoids dependence on
-// m_libc*.  THESE DO NOT UPDATE THE ANY aspacem-internal DATA
-// STRUCTURES (SEGMENT LISTS).  DO NOT USE THEM UNLESS YOU KNOW WHAT
+// m_libc*.  THESE DO NOT UPDATE THE aspacem-internal DATA
+// STRUCTURES (SEGMENT ARRAY).  DO NOT USE THEM UNLESS YOU KNOW WHAT
 // YOU ARE DOING.
 
 /* --- Pertaining to mappings --- */
@@ -159,7 +159,6 @@
    res = VG_(do_syscall6)(__NR_mmap2, (UWord)start, length,
                           prot, flags, fd, offset / 4096);
 #  elif defined(VGP_amd64_linux) || defined(VGP_ppc64_linux) \
-        || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) \
         || defined(VGP_s390x_linux)
    res = VG_(do_syscall6)(__NR_mmap, (UWord)start, length, 
                          prot, flags, fd, offset);
@@ -211,10 +210,6 @@
              0/*flags, meaning: must be at old_addr, else FAIL */,
              0/*new_addr, is ignored*/
           );
-#  elif defined(VGO_aix5)
-   ML_(am_barf)("ML_(am_do_extend_mapping_NO_NOTIFY) on AIX5");
-   /* NOTREACHED, but gcc doesn't understand that */
-   return VG_(mk_SysRes_Error)(0);
 #  else
 #    error Unknown OS
 #  endif
@@ -236,10 +231,6 @@
              VKI_MREMAP_MAYMOVE|VKI_MREMAP_FIXED/*move-or-fail*/,
              new_addr
           );
-#  elif defined(VGO_aix5)
-   ML_(am_barf)("ML_(am_do_relocate_nooverlap_mapping_NO_NOTIFY) on AIX5");
-   /* NOTREACHED, but gcc doesn't understand that */
-   return VG_(mk_SysRes_Error)(0);
 #  else
 #    error Unknown OS
 #  endif
@@ -275,7 +266,7 @@
 
 Int ML_(am_fcntl) ( Int fd, Int cmd, Addr arg )
 {
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    SysRes res = VG_(do_syscall3)(__NR_fcntl, fd, cmd, arg);
 #  elif defined(VGO_darwin)
    SysRes res = VG_(do_syscall3)(__NR_fcntl_nocancel, fd, cmd, arg);
@@ -328,10 +319,6 @@
    else
       return False;
 
-#elif defined(VGO_aix5)
-   I_die_here; /* maybe just return False? */
-   return False;
-
 #elif defined(VGO_darwin)
    HChar tmp[VKI_MAXPATHLEN+1];
    if (0 == ML_(am_fcntl)(fd, VKI_F_GETPATH, (UWord)tmp)) {
diff --git a/coregrind/m_aspacemgr/priv_aspacemgr.h b/coregrind/m_aspacemgr/priv_aspacemgr.h
index a6d993a..874d321 100644
--- a/coregrind/m_aspacemgr/priv_aspacemgr.h
+++ b/coregrind/m_aspacemgr/priv_aspacemgr.h
@@ -121,7 +121,7 @@
 extern
 Bool ML_(am_resolve_filename) ( Int fd, /*OUT*/HChar* buf, Int nbuf );
 
-/* ------ Implemented seperately in aspacemgr-{linux,aix5}.c ------ */
+/* ------ Implemented separately in aspacemgr-linux.c ------ */
 
 /* Do a sanity check (/proc/self/maps sync check) */
 extern void ML_(am_do_sanity_check)( void );
diff --git a/coregrind/m_coredump/coredump-xcoff.c b/coregrind/m_coredump/coredump-xcoff.c
deleted file mode 100644
index 889e61a..0000000
--- a/coregrind/m_coredump/coredump-xcoff.c
+++ /dev/null
@@ -1,52 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Dumping core.                               coredump-xcoff.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#if defined(VGO_aix5)
-
-#include "pub_core_basics.h"
-#include "pub_core_vki.h"
-#include "pub_core_libcassert.h"
-#include "pub_core_coredump.h"        /* self */
-
-void VG_(make_coredump)(ThreadId tid, const vki_siginfo_t *si, UInt max_size)
-{
-   /* not implemented */
-}
-
-#endif // defined(VGO_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_debugger.c b/coregrind/m_debugger.c
index fe2c7f2..75de646 100644
--- a/coregrind/m_debugger.c
+++ b/coregrind/m_debugger.c
@@ -231,12 +231,6 @@
    uregs.ARM_cpsr = LibVEX_GuestARM_get_cpsr(vex);
    return VG_(ptrace)(VKI_PTRACE_SETREGS, pid, NULL, &uregs);
 
-#elif defined(VGP_ppc32_aix5)
-   I_die_here;
-
-#elif defined(VGP_ppc64_aix5)
-   I_die_here;
-
 #elif defined(VGP_x86_darwin)
    I_die_here;
 
diff --git a/coregrind/m_debuginfo/d3basics.c b/coregrind/m_debuginfo/d3basics.c
index 956fc2f..e41eb8b 100644
--- a/coregrind/m_debuginfo/d3basics.c
+++ b/coregrind/m_debuginfo/d3basics.c
@@ -407,8 +407,6 @@
 #  elif defined(VGP_arm_linux)
    if (regno == 13) { *a = regs->sp; return True; }
    if (regno == 11) { *a = regs->fp; return True; } 
-#  elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   vg_assert(0); /* this function should never be called */
 #  elif defined(VGP_s390x_linux)
    if (regno == 15) { *a = regs->sp; return True; }
    if (regno == 11) { *a = regs->fp; return True; }
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
index 4b38ca4..e000468 100644
--- a/coregrind/m_debuginfo/debuginfo.c
+++ b/coregrind/m_debuginfo/debuginfo.c
@@ -60,11 +60,6 @@
 # include "priv_readelf.h"
 # include "priv_readdwarf3.h"
 # include "priv_readpdb.h"
-#elif defined(VGO_aix5)
-# include "pub_core_debuglog.h"
-# include "pub_core_libcproc.h"
-# include "pub_core_libcfile.h"
-# include "priv_readxcoff.h"
 #elif defined(VGO_darwin)
 # include "priv_readmacho.h"
 # include "priv_readpdb.h"
@@ -291,13 +286,7 @@
 */
 static void discard_DebugInfo ( DebugInfo* di )
 {
-#  if defined(VGP_ppc32_aix5)
-   HChar* reason = "__unload";
-#  elif defined(VGP_ppc64_aix5)
-   HChar* reason = "kunload64";
-#  else
    HChar* reason = "munmap";
-#  endif
 
    DebugInfo** prev_next_ptr = &debugInfo_list;
    DebugInfo*  curr          =  debugInfo_list;
@@ -445,9 +434,6 @@
 /* Discard any elements of debugInfo_list which overlap with diRef.
    Clearly diRef must have its rx_ and rw_ mapping information set to
    something sane. */
-#if defined(VGO_aix5)
-__attribute__((unused))
-#endif
 static void discard_DebugInfos_which_overlap_with ( DebugInfo* diRef )
 {
    DebugInfo* di;
@@ -769,16 +755,15 @@
    vg_assert(nread > 0 && nread <= sizeof(buf1k) );
 
    /* We're only interested in mappings of object files. */
-   // Nb: AIX5 doesn't use this file and so isn't represented here.
-#if defined(VGO_linux)
+#  if defined(VGO_linux)
    if (!ML_(is_elf_object_file)( buf1k, (SizeT)nread ))
       return 0;
-#elif defined(VGO_darwin)
+#  elif defined(VGO_darwin)
    if (!ML_(is_macho_object_file)( buf1k, (SizeT)nread ))
       return 0;
-#else
-#  error "unknown OS"
-#endif
+#  else
+#    error "unknown OS"
+#  endif
 
    /* See if we have a DebugInfo for this filename.  If not,
       create one. */
@@ -830,14 +815,13 @@
    discard_DebugInfos_which_overlap_with( di );
 
    /* .. and acquire new info. */
-   // Nb: AIX5 doesn't use this file and so isn't represented here.
-#if defined(VGO_linux)
+#  if defined(VGO_linux)
    ok = ML_(read_elf_debug_info)( di );
-#elif defined(VGO_darwin)
+#  elif defined(VGO_darwin)
    ok = ML_(read_macho_debug_info)( di );
-#else
-#  error "unknown OS"
-#endif
+#  else
+#    error "unknown OS"
+#  endif
 
    if (ok) {
 
@@ -1141,107 +1125,6 @@
 #endif /* defined(VGO_linux) || defined(VGO_darwin) */
 
 
-/*-------------------------------------------------------------*/
-/*---                                                       ---*/
-/*--- TOP LEVEL: NOTIFICATION (ACQUIRE/DISCARD INFO) (AIX5) ---*/
-/*---                                                       ---*/
-/*-------------------------------------------------------------*/
-
-#if defined(VGO_aix5)
-
-/* The supplied parameters describe a code segment and its associated
-   data segment, that have recently been mapped in -- so we need to
-   read debug info for it -- or conversely, have recently been dumped,
-   in which case the relevant debug info has to be unloaded. */
-
-ULong VG_(di_aix5_notify_segchange)( 
-               Addr   code_start,
-               Word   code_len,
-               Addr   data_start,
-               Word   data_len,
-               UChar* file_name,
-               UChar* mem_name,
-               Bool   is_mainexe,
-               Bool   acquire )
-{
-   ULong hdl = 0;
-
-   /* play safe; always invalidate the CFI cache.  Not
-      that it should be used on AIX, but still .. */
-   cfsi_cache__invalidate();
-
-   if (acquire) {
-
-      Bool       ok;
-      DebugInfo* di;
-      di = find_or_create_DebugInfo_for( file_name, mem_name );
-      vg_assert(di);
-
-      if (code_len > 0) {
-         di->text_present = True;
-         di->text_svma = 0; /* don't know yet */
-         di->text_bias = 0; /* don't know yet */
-         di->text_avma = code_start;
-         di->text_size = code_len;
-      }
-      if (data_len > 0) {
-         di->data_present = True;
-         di->data_svma = 0; /* don't know yet */
-         di->data_bias = 0; /* don't know yet */
-         di->data_avma = data_start;
-         di->data_size = data_len;
-      }
-
-      /* These need to be filled in in order to keep various
-         assertions in storage.c happy.  In particular see
-         "Comment_Regarding_Text_Range_Checks" in that file. */
-      di->have_rx_map = True;
-      di->rx_map_avma = code_start;
-      di->rx_map_size = code_len;
-      di->have_rw_map = True;
-      di->rw_map_avma = data_start;
-      di->rw_map_size = data_len;
-
-      ok = ML_(read_xcoff_debug_info) ( di, is_mainexe );
-
-      if (ok) {
-         /* prepare read data for use */
-         ML_(canonicaliseTables)( di );
-         /* notify m_redir about it */
-         VG_(redir_notify_new_DebugInfo)( di );
-         /* Note that we succeeded */
-         di->have_dinfo = True;
-         hdl = di->handle;
-         vg_assert(hdl > 0);
-         /* Check invariants listed in
-            Comment_on_IMPORTANT_REPRESENTATIONAL_INVARIANTS in
-            priv_storage.h. */
-         check_CFSI_related_invariants(di);
-      } else {
-         /*  Something went wrong (eg. bad XCOFF file). */
-         discard_DebugInfo( di );
-         di = NULL;
-      }
-
-   } else {
-
-      /* Dump all the debugInfos whose text segments intersect
-         code_start/code_len. */
-      /* CFI cache is always invalidated at start of this routine.
-         Hence it's safe to ignore the return value of
-         discard_syms_in_range. */
-      if (code_len > 0)
-         (void)discard_syms_in_range( code_start, code_len );
-
-   }
-
-   return hdl;
-}
-        
-
-#endif /* defined(VGO_aix5) */
-
-
 /*------------------------------------------------------------*/
 /*---                                                      ---*/
 /*--- TOP LEVEL: QUERYING EXISTING DEBUG INFO              ---*/
@@ -1512,8 +1395,6 @@
 #      if defined(VGO_linux)
        VG_STREQ("__libc_start_main",  name) ||  // glibc glibness
        VG_STREQ("generic_start_main", name) ||  // Yellow Dog doggedness
-#      elif defined(VGO_aix5)
-       VG_STREQ("__start", name)            ||  // AIX aches
 #      elif defined(VGO_darwin)
        // See readmacho.c for an explanation of this.
        VG_STREQ("start_according_to_valgrind", name) ||  // Darwin, darling
diff --git a/coregrind/m_debuginfo/priv_readxcoff.h b/coregrind/m_debuginfo/priv_readxcoff.h
deleted file mode 100644
index d8e42b5..0000000
--- a/coregrind/m_debuginfo/priv_readxcoff.h
+++ /dev/null
@@ -1,49 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Read XCOFF format debug info.               priv_readxcoff.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#ifndef __PRIV_READXCOFF_H
-#define __PRIV_READXCOFF_H
-
-
-/* Read whatever info we can from an XCOFF object file. */
-extern
-Bool ML_(read_xcoff_debug_info) ( struct _DebugInfo* di,
-                                  Bool   is_mainexe );
-
-#endif /* ndef __PRIV_READXCOFF_H */
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_debuginfo/priv_storage.h b/coregrind/m_debuginfo/priv_storage.h
index b857c72..949ae74 100644
--- a/coregrind/m_debuginfo/priv_storage.h
+++ b/coregrind/m_debuginfo/priv_storage.h
@@ -45,7 +45,7 @@
 
 /* --------------------- SYMBOLS --------------------- */
 
-/* A structure to hold an ELF/XCOFF symbol (very crudely). */
+/* A structure to hold an ELF/MachO symbol (very crudely). */
 typedef 
    struct { 
       Addr  addr;    /* lowest address of entity */
diff --git a/coregrind/m_debuginfo/readxcoff.c b/coregrind/m_debuginfo/readxcoff.c
deleted file mode 100644
index d0e67f4..0000000
--- a/coregrind/m_debuginfo/readxcoff.c
+++ /dev/null
@@ -1,2491 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Read XCOFF debug info.                           readxcoff.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#if defined(VGO_aix5)
-
-/* This file reads XCOFF symbol tables and debug info.
-   Known limitations:
-
-   * only one text section per object file is handled
-
-   * C_BINCL/C_EINCL handling is wrong, so functions defined in files
-     included from other files will end up with the wrong file name
-     and possibly line numbers.  Fixable.
-
-   * The line number reader leans heavily on the fact that the generic
-     line number canonicaliser in storage.c truncates overlapping
-     ranges.
-*/
-
-#include "pub_core_basics.h"
-#include "pub_core_vki.h"          /* struct vki_stat et al */
-#include "pub_core_libcbase.h"
-#include "pub_core_libcassert.h"
-#include "pub_core_libcprint.h"
-#include "pub_core_libcfile.h"     /* stat, open, close */
-#include "pub_core_aspacemgr.h"    /* for mmaping debuginfo files */
-#include "pub_core_options.h"      /* VG_(clo_trace_symtab) */
-#include "pub_core_xarray.h"
-#include "priv_misc.h"
-#include "priv_tytypes.h"
-#include "pub_tool_debuginfo.h"
-#include "priv_d3basics.h"
-#include "priv_storage.h"
-#include "priv_readxcoff.h"        /* self */
-
-/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#if defined(VGP_ppc32_aix5)
-# define __XCOFF32__ 1
-# undef  __XCOFF64__
-#elif defined(VGP_ppc64_aix5)
-# define __XCOFF64__ 1
-# undef  __XCOFF32__
-#else
-# error "This file should only be compiled on AIX"
-#endif
-#include <xcoff.h>
-
-#undef __AR_SMALL__
-#define __AR_BIG__ 1
-#include <ar.h>
-/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-
-/* Debug stuff */
-#define SHOW_LD_STRTAB 1   /* loader string tables */
-#define SHOW_LD_SYMTAB 1   /* loader symbol table */
-#define SHOW_LD_RELTAB 1   /* loader reloc table */
-#define SHOW_STRTAB 1      /* main string table */
-#define SHOW_SYMS_P1 1     /* P1: find text sym starts */
-#define SHOW_SYMS_P2 1     /* P2: find text sym ends */
-#define SHOW_SYMS_P3 1     /* P3: src filenames & fn start/end line #s */
-#define SHOW_SYMS_P4 1     /* P4: line numbers */
-#define SHOW_SYMS_P5 1     /* P5: find TOC pointers */
-#define SHOW_SYMS_P6 1     /* P6: finalise symbol info */
-
-#define SHOW_AR_DETAILS 0  /* show details of .a file internals */
-
-#define SHOW  di->trace_symtab
-
-/* A small stack of filenames is maintained for dealing
-   with BINCL/EINCL symbol table entries. */
-
-#define N_FILENAME_STACK 16
-
-/* Phase 5 (find TOC pointers) has two implementations, the official
-   version, which involves reading the data segment symbols, and the
-   kludgey version, which basically scans the (actual loaded) data
-   segment to find structs which look like function descriptors. */
-
-#if 1
-# undef OFFICIAL_PHASE5
-#else
-# define OFFICIAL_PHASE5 1
-#endif
-
-/*------------------------------------------------------------*/
-/*--- Read XCOFF format debug info.                        ---*/
-/*------------------------------------------------------------*/
-
-
-/* COFF uses a strange way to represent symbol names.  A symbol is an
-   eight-byte field.
-
-   In 32-bit mode: if the first four bytes are zero, then the second
-   four bytes give the offset into the string table where the string
-   really is.  Otherwise, the whole 8-byte thing is itself the name.
-
-   In 64-bit mode: a four-byte field at offset 8 is always interpreted
-   as an offset into the string table.
-
-   For a symbol of length 8, in 32-bit mode, there is no obvious way
-   to zero-terminate it.  One solution is to copy the name into
-   dynamically allocated memory, but that complicates storage
-   management.
-
-   An alternative solution, used here, is to represent a name as a
-   (data, length) pair instead of the traditional zero-terminated
-   string.  Such a pair can be constructed for any XCOFF symbol name,
-   and has the advantages that (1) no dynamic memory is required, and
-   (2) the name is guaranteed to be accessible as long as the object
-   image is mapped in.
-
-   What the .vec points at must not be modified; if you want to do
-   that, copy it elsewhere first.
-*/
-
-typedef
-   struct {
-      UChar* vec; /* the text of the name */
-      UInt   len; /* length of the text */
-   }
-   Name;
-
-static Name maybeDerefStrTab( SYMENT* sym,
-                              UChar* oi_strtab, UWord oi_n_strtab)
-{
-   Name res;
-   static UChar* bogus 
-      = (UChar*)"**_Error_Dereferencing_COFF_String_Table_**";
-   UChar* bytes = (UChar*)sym;
-
-#  if defined(VGP_ppc32_aix5)
-   if (bytes[0]==0 && bytes[1]==0 && bytes[2]==0 && bytes[3]==0) {
-      UInt off = *(UInt*)&bytes[4];
-      if (oi_strtab && oi_n_strtab > 0 && off < oi_n_strtab) {
-         res.vec = &oi_strtab[off];
-         res.len = VG_(strlen)(res.vec);
-         return res;
-      } else
-         goto bad;
-   } else {
-      Int i;
-      res.vec = bytes;
-      res.len = 8;
-      for (i = 0; i < 8; i++)
-         if (bytes[i] == 0)
-            res.len--;
-      return res;
-   }
-
-#  elif defined(VGP_ppc64_aix5)
-   ULong off = (ULong)( *(UInt*)&bytes[8] );
-   if (oi_strtab && oi_n_strtab > 0 && off < oi_n_strtab) {
-      res.vec = &oi_strtab[off];
-      res.len = VG_(strlen)(res.vec);
-      return res;
-   } else
-      goto bad;
-
-#  else
-#    error "Unknown platform"
-#  endif
-
-  bad:
-   res.vec = bogus;
-   res.len = VG_(strlen)(bogus);
-   return res;
-}
-
-
-/* Similar scheme for extracting names from C_FILE auxiliary entries,
-   except that the 32-bit scheme appears to be always used, even for
-   XCOFF64. */
-
-static Name maybeDerefStrTab_fname ( UChar* bytes,
-                                     UChar* oi_strtab, UWord oi_n_strtab)
-{
-   Name res;
-   static UChar* bogus 
-      = (UChar*)"**_Error_Dereferencing_COFF_String_Table_**";
-
-   if (bytes[0]==0 && bytes[1]==0 && bytes[2]==0 && bytes[3]==0) {
-      UInt off = *(UInt*)&bytes[4];
-      if (oi_strtab && oi_n_strtab > 0 && off < oi_n_strtab) {
-         res.vec = &oi_strtab[off];
-         res.len = VG_(strlen)(res.vec);
-         return res;
-      } else
-         goto bad;
-   } else {
-      Int i;
-      res.vec = bytes;
-      res.len = 8;
-      for (i = 0; i < 8; i++)
-         if (bytes[i] == 0)
-            res.len--;
-      return res;
-   }
-
-  bad:
-   res.vec = bogus;
-   res.len = VG_(strlen)(bogus);
-   return res;
-}
-
-
-static Name mk_const_Name ( HChar* str )
-{
-   Name res;
-   res.vec = str;
-   res.len = VG_(strlen)(res.vec);
-   return res;
-}
-
-static Name mk_empty_Name ( void )
-{
-   Name res;
-   res.vec = "";
-   res.len = 0;
-   return res;
-}
-
-static Bool is_empty_Name ( Name name )
-{
-   return name.len == 0;
-}
-
-static Bool eq_string_Name ( Name name, UChar* str )
-{
-   UInt i;
-   for (i = 0; i < name.len; i++) {
-      if (str[i] == 0)
-         return False;
-      if (str[i] != name.vec[i])
-         return False;
-   }
-   if (str[name.len] == 0)
-      return True;
-   else
-      return False;
-}
-
-static Int cmp_Names ( Name n1, Name n2 )
-{
-   UInt i = 0;
-   while (1) {
-      vg_assert(i >= 0 && i <= n1.len);
-      vg_assert(i >= 0 && i <= n2.len);
-      if (i == n1.len && i == n2.len)
-         return 0;
-      if (i == n1.len && i < n2.len)
-         return -1;
-      if (i < n1.len && i == n2.len)
-         return 1;
-      if (n1.vec[i] < n2.vec[i])
-         return -1;
-      if (n1.vec[i] > n2.vec[i])
-         return 1;
-      i++;
-   }
-}
-
-static void print_Name ( Name name )
-{
-   UInt i;
-   for (i = 0; i < name.len; i++)
-      VG_(printf)("%c", name.vec[i]);
-}
-
-
-static UChar sanitiseChar ( UChar c )
-{
-   if (c < 32 || c > 127)
-      c = '?';
-   return c;
-}
-
-static HChar* name_of_filhdr_f_magic ( Int magic )
-{
-   switch (magic) {
-      case 0x01DF: return "xcoff32";
-      case 0x01EF: return "xcoff64-upto-aix43";
-      case 0x01F7: return "xcoff64-from-aix51";
-      default:     return "unknown-xcoff-header-magic";
-   }
-}
-
-static HChar* name_of_scnhdr_s_flags ( Int flags )
-{
-   switch (flags & 0xFFFF) {
-      case STYP_REG:    return "\"regular\"";
-      case STYP_PAD:    return "\"padding\"";
-      case STYP_TEXT:   return "text only";
-      case STYP_DATA:   return "data only";
-      case STYP_BSS:    return "bss only";
-      case STYP_EXCEPT: return "Exception";
-      case STYP_INFO:   return "Comment";
-      case STYP_LOADER: return "Loader";
-      case STYP_DEBUG:  return "Debug";
-      case STYP_TYPCHK: return "Typecheck";
-      case STYP_OVRFLO: return "Overflow";
-      default: return "unknown-section-header-name";
-   }
-}
-
-static HChar* name_of_syment_n_sclass ( Int sclass )
-{
-   static HChar buf[10];
-   switch (sclass) {
-      /* dbx ones (>= 0x80) */
-      case C_GSYM:    return "gsym";
-      case C_LSYM:    return "lsym";
-      case C_PSYM:    return "psym";
-      case C_RSYM:    return "rsym";
-      case C_RPSYM:   return "rpsym";
-      case C_STSYM:   return "stsym";
-      case C_DECL:    return "decl";
-      case C_FUN:     return "fun";
-      case C_BSTAT:   return "bstat";
-      case C_ESTAT:   return "estat";
-      /* non-dbx ones (< 0x80) */
-      case C_STAT:    return "STAT";
-      case C_FILE:    return "FILE";
-      case C_HIDEXT:  return "HIDEXT";
-      case C_EXT:     return "EXT";
-      case C_FCN:     return "FCN";
-      case C_BINCL:   return "BINCL";
-      case C_EINCL:   return "EINCL";
-      case C_BLOCK:   return "BLOCK";
-      case C_WEAKEXT: return "WEAKEXT";
-      default:
-         VG_(sprintf)(buf, "??%d??", sclass);
-         return buf;
-   }
-}
-
-typedef 
-   struct {
-      Name   name;    /* symbol's name */
-      Addr   first;   /* first address; always known */
-      Addr   last;    /* last address; may be an overestimate */
-
-      Name   fname;   /* source file name, if known */
-      Int    slnno;   /* starting line #, or 0 if unknown */
-      Int    elnno;   /* ending line #, or 0 if unknown */
-
-      UWord  r2value; /* what r2 should be for this fn (tocptr) */
-      Bool   r2known; /* do we have a r2 value? */
-   } 
-   XCoffSym;
-
-static void init_XCoffSym( XCoffSym* sym )
-{
-   sym->name    = mk_empty_Name();
-   sym->first   = 0;
-   sym->last    = 0;
-   sym->fname   = mk_empty_Name();
-   sym->slnno   = 0;
-   sym->elnno   = 0;
-   sym->r2known = False;
-   sym->r2value = False;
-}
-
-/* Compare XCoffSyms by their start address. */
-static Int cmp_XCoffSym_by_start ( void* v1, void* v2 )
-{
-   XCoffSym* s1 = (XCoffSym*)v1;
-   XCoffSym* s2 = (XCoffSym*)v2;
-   if (s1->first < s2->first) return -1;
-   if (s1->first > s2->first) return 1;
-   return 0;
-}
-
-/* Compare XCoffSyms by a slightly weaker ordering, returning zero
-   (equivalence) for any overlap, and -1 or 1 otherwise. */
-static Int cmp_XCoffSym_by_overlap ( void* v1, void* v2 )
-{
-   XCoffSym* s1 = (XCoffSym*)v1;
-   XCoffSym* s2 = (XCoffSym*)v2;
-   if (s1->last < s2->first) return -1;
-   if (s2->last < s1->first) return 1;
-   return 0;
-}
-
-/* Compare XCoffSyms by their start address, and for equal addresses,
-   use the name as a secondary sort key. */
-static Int cmp_XCoffSym_by_start_then_name ( void* v1, void* v2 )
-{
-   XCoffSym* s1 = (XCoffSym*)v1;
-   XCoffSym* s2 = (XCoffSym*)v2;
-   if (s1->first < s2->first) return -1;
-   if (s1->first > s2->first) return 1;
-   return cmp_Names(s1->name, s2->name);
-}
-
-
-/* csect_idx is an index in the symbol table (start, n_entries) to a
-   symbol defining a csect.  If possible, find the bounds of the csect
-   and assign them to *first and *last, and return True; else return
-   False.  sntext_1based_if_known is the 1-based number of the text
-   section.  Note: computes stated VMAs, not actual VMAs. */
-
-#if defined(VGP_ppc32_aix5)
-# define SMTYP_SMTYP(x)  ((x) & 0x7)     /* symbol type */
-# define CSECT(PP)       (((AUXENT*)(PP))->x_csect)
-# define CSECT_LEN(PP)   (CSECT(PP).x_scnlen)
-# define CSECT_ALIGN(PP) (SMTYP_ALIGN(CSECT(PP).x_smtyp))
-# define CSECT_SMTYP(PP) (SMTYP_SMTYP(CSECT(PP).x_smtyp))
-# define CSECT_SCLAS(PP) (CSECT(PP).x_smclas)
-
-#elif defined(VGP_ppc64_aix5)
-# define SMTYP_SMTYP(x)  ((x) & 0x7)     /* symbol type */
-# define CSECT(PP)       (((AUXENT*)(PP))->x_csect)
-# define CSECT_LEN(PP)   ((((ULong)(CSECT(PP).x_scnlen_hi)) << 32) \
-                          | ((ULong)(CSECT(PP).x_scnlen_lo)))
-# define CSECT_ALIGN(PP) (SMTYP_ALIGN(CSECT(PP).x_smtyp))
-# define CSECT_SMTYP(PP) (SMTYP_SMTYP(CSECT(PP).x_smtyp))
-# define CSECT_SCLAS(PP) (CSECT(PP).x_smclas)
-
-#else
-# error "Unknown platform"
-
-#endif
-
-
-#define SYM_IX(_tab,_n) ((SYMENT*)(((UChar*)(_tab)) + SYMESZ * (_n)))
-
-static 
-Bool get_csect_bounds ( UChar* start, UWord n_entries,
-                        UWord csect_idx, 
-                        Int sntext_1based_if_known,
-                        /*OUT*/UChar** first, /*OUT*/UChar** last )
-{
-   Bool    is_text;
-   SYMENT* cssym;
-   AUXENT* csaux;
-
-   vg_assert(SYMESZ == 18); /* both for XCOFF32 and XCOFF64 */
-
-   if (n_entries < 2)
-      return False;
-   if (csect_idx+1 >= n_entries)
-      return False;
-   cssym = (SYMENT*)SYM_IX(start, csect_idx);
-   csaux = (AUXENT*)SYM_IX(start, csect_idx+1);
-   is_text = sntext_1based_if_known != -1
-             && (Int)cssym->n_scnum == sntext_1based_if_known;
-
-   if (!is_text)
-      return False;
-
-   if (cssym->n_sclass == C_EXT || cssym->n_sclass == C_HIDEXT) {
-      if (cssym->n_numaux == 1) {
-         if (CSECT_SMTYP(csaux) == XTY_SD) {
-            if (0) VG_(printf)("GCB: SD: len is %lld\n", (Long)CSECT_LEN(csaux));
-            *first = (UChar*)(cssym->n_value);
-            *last = *first + CSECT_LEN(csaux)-1;
-           return True;
-         }
-      } else {
-         /* Possibly complain or take evasive action here.  In fact
-            I've yet to see a case where a csect definition symbol has
-            n_numaux != 1. */
-      }
-   }
-   return False;
-}
-
-/* Read symbol and line number info for the given text section.  (This
-   is the central routine for XCOFF reading.)  Returns NULL on
-   success, or the text of an error message otherwise. */
-static 
-HChar* read_symbol_table ( 
-          /*MOD*/struct _DebugInfo* di,
-
-          /* location of symbol table */
-          UChar* oi_symtab, UWord oi_nent_symtab,
-
-          /* location of string table */
-          UChar* oi_strtab, UWord oi_n_strtab,
-
-          /* location of debug section (stabs strings, if any) */
-          UChar* oi_debug, UWord oi_n_debug,
-
-          /* location of line number info, if any */
-          UChar* oi_lnos, UWord oi_nent_lnos,
-
-          /* section indices */
-          Int sntext_1based_if_known,
-          Int sndata_1based_if_known,
-
-          /* where the mapped data section is */
-          /* Now in di->data_avma:   Addr data_avma, */
-          /* Now in di->data_size:   UWord data_alen, */
-          UWord data_alen_from_auxhdr,
-
-	  /* where the mapped toc is (in the data section,
-	     presumably), if known */
-          Addr toc_avma,
-
-          /* stated-to-actual VMA offsets */ 
-          Word text_bias,
-          Word data_bias 
-       )
-{
-   SYMENT* sym;
-   SYMENT* aux;
-   UInt    i, j, nsyms, k, m;
-   Name    name;
-   Bool    is_text, is_data;
-   XArray* syms = NULL; /* XArray of XCoffSyms */
-
-   /* If the TOC avma is obviously bogus, get rid of it */
-   { 
-     UWord data_maxlen = di->data_size;
-     if (data_maxlen < data_alen_from_auxhdr)
-        data_maxlen = data_alen_from_auxhdr;
-
-     //VG_(printf)(" toc_avma %p\n", toc_avma);
-     //VG_(printf)("data_avma %p\n", data_avma);
-     //VG_(printf)("dxxx_avma %p\n", data_avma + data_maxlen);
-
-     if (toc_avma != 0
-         && (toc_avma < di->data_avma 
-             || toc_avma >= di->data_avma + data_maxlen))
-        toc_avma = 0;
-     //VG_(printf)("2toc_avma %p\n", toc_avma);
-   }
-
-   /* We can't just treat this as an array of SYMENTs, because C
-      thinks they have size 20 whereas the spec says they have size 18
-      (alignment padding) so doing the obvious thing screws up.  Hence
-      we have to calculate the offset of each entry manually. */
-
-   if (0) VG_(printf)("size of SYMENT = %ld\n", sizeof(SYMENT));
-
-   /* ----------------------------------------------------------
-      Phase 1: first make a pass through the symbols, looking for
-      stuff in the text segment.  Calculate their actual VMAs,
-      dump any outside the text segment actual VMA bounds, and 
-      add the rest to 'syms'.
-      ---------------------------------------------------------- */
-
-   syms = VG_(newXA)( ML_(dinfo_zalloc), "di.readxcoff.rst.1", 
-                      ML_(dinfo_free), sizeof(XCoffSym) );
-
-   if (SHOW && SHOW_SYMS_P1) {
-      VG_(printf)("--- BEGIN Phase1 (find text symbol starts) ---\n");
-      VG_(printf)("--- note: shown addresses are STATED VMAs ---\n");
-   }
-
-   i = 0;
-   while (1) {
-
-      if (i >= oi_nent_symtab)
-         break;
-
-      sym = SYM_IX(oi_symtab, i);
-      is_text = sntext_1based_if_known != -1
-                && (Int)sym->n_scnum == sntext_1based_if_known;
-      is_data = sndata_1based_if_known != -1
-                && (Int)sym->n_scnum == sndata_1based_if_known;
-
-      if (SHOW && SHOW_SYMS_P1)
-         VG_(printf)("Phase1: %5d+%d  ", i, (Int)sym->n_numaux);
-
-      name = mk_const_Name("(unknown)");
-      if (sym->n_scnum == N_DEBUG && sym->n_sclass == C_FUN)
-         name = maybeDerefStrTab( sym, oi_debug, oi_n_debug );
-      else 
-      if (sym->n_sclass & DBXMASK)
-         name = mk_const_Name("(dbxstr)");
-      else
-         name = maybeDerefStrTab( sym, oi_strtab, oi_n_strtab);
-
-      if (SHOW && SHOW_SYMS_P1) {
-         VG_(printf)("%5s(%2d)  %6s  0x%016llx ", 
-                     is_text ? "text" : is_data ? "data" : "other",
-                     (Int)sym->n_scnum, 
-                     name_of_syment_n_sclass(sym->n_sclass), 
-                     (ULong)sym->n_value);
-         print_Name(name);
-         VG_(printf)("\n");
-      }
-
-      i++;
-      i += sym->n_numaux;
-
-      if (!is_text)
-         continue;
-
-      /* --- BEGIN regular(ish) symbol --- */
-      if ((sym->n_sclass == C_EXT || sym->n_sclass == C_HIDEXT)
-          && (sym->n_numaux == 1 || sym->n_numaux == 2)) {
-         /* Dealing with a symbol with a csect entry.  By convention
-            (according to IBM docs) the csect entry is the last
-            auxiliary for this symbol, if there is more than one
-            auxiliary present; hence "SYM_IX(oi_symtab, i-1)" below. */
-
-         aux = SYM_IX(oi_symtab, i-1);
-         if (0) VG_(printf)("symtype is %d\n", CSECT_SMTYP(aux));
-
-         if (CSECT_SMTYP(aux) == XTY_SD) {
-            /* Aux is a csect definition.  This is relatively rare,
-               but at least it is simple: the CSECT_LEN(aux) field
-               contains it's length, so we just heave that into the
-               pot for phase 2. */
-            XCoffSym cand;
-            if (0) VG_(printf)("SD: len is %d\n", (Int)CSECT_LEN(aux));
-            if (0) VG_(printf)("SD: proposed %#llx\n", (ULong)sym->n_value);
-            init_XCoffSym(&cand);
-            cand.first = sym->n_value;
-            cand.last = cand.first + (UWord)CSECT_LEN(aux) - 1;
-
-            cand.first += text_bias;
-            cand.last += text_bias;
-            cand.name = name;
-
-            if (cand.last < di->text_avma 
-                || cand.first >= di->text_avma + di->text_size)
-               continue;
-            if (cand.last < cand.first)
-               continue;
-            if (is_empty_Name(name))
-               continue;
-            (void)VG_(addToXA)(syms, &cand);
-         }
-
-         if (CSECT_SMTYP(aux) == XTY_LD) {
-            /* Aux is a label definition.  This is the common case. */
-            XCoffSym cand;
-            Bool ok;
-            UChar *csect_first, *csect_last;
-            /* x_scnlen contains the symbol table entry of the
-               containing csect.  Use the symbol's stated vma and csect
-               end as the initial approximation of this symbol's start
-               and length.  The length will get revised downwards in
-               Phase 2. */
-            init_XCoffSym(&cand);
-            ok = get_csect_bounds( oi_symtab, oi_nent_symtab, 
-                                   CSECT_LEN(aux), 
-                                   sntext_1based_if_known,
-                                   &csect_first, &csect_last );
-            if (0 && ok)
-               VG_(printf)("new csect svma %p %p\n", csect_first, csect_last);
-            if (ok && ((UWord)csect_first) <= ((UWord)sym->n_value)
-                   && ((UWord)sym->n_value) <= ((UWord)csect_last)) {
-               if (0) {
-                  VG_(printf)("LD: in a csect %p %p\n", 
-                              csect_first, csect_last);
-                  VG_(printf)("CAND: %p .. %p  %s\n", 
-                              (void*)sym->n_value, (void*)csect_last, 
-                              "fixme-Name-printing(1)" /*name*/);
-               }
-               cand.first = sym->n_value;
-               cand.last = (Addr)csect_last;
-            } else {
-               if (0) {
-                  VG_(printf)("LD: can't compute csect bounds?!\n");
-                  VG_(printf)("CAND: %p .. %p  %s\n", 
-                              (HChar*)sym->n_value,
-                              (HChar*)sym->n_value+1,
-                               "fixme-Name-printing(2)" /*name*/);
-               }
-               cand.first = sym->n_value;
-               cand.last = cand.first + 1;
-            }
-
-            /* cand.first is a stated VMA; turn it into an actual VMA
-               and ignore it if not in the actual text segment. */
-
-            cand.first += text_bias;
-            cand.last += text_bias;
-            cand.name = name;
-
-            if (cand.last < di->text_avma 
-                || cand.first >= di->text_avma + di->text_size)
-               continue;
-            if (cand.last < cand.first)
-               continue;
-            if (is_empty_Name(name))
-               continue;
-
-            (void)VG_(addToXA)(syms, &cand);
-         }
-      }
-      /* --- END regular(ish) symbol --- */
-
-   }
-
-   /* ----------------------------------------------------------
-      Phase 2: suitable text symbols have been put into 'syms'.  Their
-      start addresses are correct, but end addresses are those of the
-      containing csect, which is in general way too long.  This phase
-      clips the ends so that the ranges no longer overlap, and thereby
-      constrains each symbol's range to something which, for the most
-      part, is correct.
-      ---------------------------------------------------------- */
-
-   nsyms = VG_(sizeXA)(syms);
-
-   if (SHOW && SHOW_SYMS_P1)
-      VG_(printf)("Phase1 acquired %d text symbols\n", nsyms);
-
-   if (SHOW && SHOW_SYMS_P2) {
-      VG_(printf)("--- BEGIN Phase2 (find text symbol ends) ---\n");
-      VG_(printf)("--- note: shown addresses are ACTUAL VMAs ---\n");
-   }
-
-   VG_(setCmpFnXA)(syms, cmp_XCoffSym_by_start_then_name);
-   VG_(sortXA)(syms);
-
-   /* We only know for sure the start addresses (actual VMAs) of
-      symbols, and an overestimation of their end addresses.  So sort
-      by start address, then clip each symbol so that its end address
-      does not overlap with the next one along.
-
-      There is a small refinement: if a group of symbols have the same
-      address, treat them as a group: find the next symbol along that
-      has a higher start address, and clip all of the group
-      accordingly.  This clips the group as a whole so as not to
-      overlap following symbols.  This leaves prefersym() in
-      storage.c, which is not XCOFF-specific, to later decide which of
-      the symbols in the group to keep. 
-
-      Another refinement is that we need to get rid of symbols which,
-      after clipping, have identical starts, ends, and names.  So the
-      sorting uses the name as a secondary key.
-   */
-
-   for (i = 0; i < nsyms; i++) {
-      for (k = i+1; 
-           k < nsyms 
-             && ((XCoffSym*)VG_(indexXA)(syms,i))->first 
-                 == ((XCoffSym*)VG_(indexXA)(syms,k))->first; 
-           k++)
-         ;
-      /* So now [i .. k-1] is a group all with the same start address.
-         Clip their ending addresses so they don't overlap [k].  In
-         the normal case (no overlaps), k == i+1. */
-      if (k < nsyms) {
-         XCoffSym* next = (XCoffSym*)VG_(indexXA)(syms,k);
-         for (m = i; m < k; m++) {
-            XCoffSym* here = (XCoffSym*)VG_(indexXA)(syms,m);
-            vg_assert(here->first < next->first);
-            if (here->last >= next->first)
-               here->last = next->first-1;
-         }
-      }
-      i = k-1;
-      vg_assert(i <= nsyms);
-   }
-
-   j = 0;
-   if (nsyms > 0) {
-      j = 1;
-      for (i = 1; i < nsyms; i++) {
-         vg_assert(j <= i);
-         XCoffSym* s_j1 = (XCoffSym*)VG_(indexXA)(syms, j-1);
-         XCoffSym* s_j  = (XCoffSym*)VG_(indexXA)(syms, j);
-         XCoffSym* s_i  = (XCoffSym*)VG_(indexXA)(syms, i);
-         if (s_i->first != s_j1->first
-             || s_i->last != s_j1->last
-	     || 0 != cmp_Names(s_i->name, s_j1->name)) {
-            *s_j = *s_i;
-	    j++;
-	 } else {
-            if (SHOW && SHOW_SYMS_P2) {
-               VG_(printf)("Phase2: dump duplicate "); 
-               print_Name(s_i->name);
-               VG_(printf)("\n");
-	    }
-	 }
-      }
-   }
-   vg_assert(j >= 0 && j <= nsyms);
-   VG_(dropTailXA)(syms, nsyms - j);
-   nsyms = j;
-
-   if (1) {
-      for (i = 0; i < nsyms; i++) {
-         XCoffSym* s = (XCoffSym*)VG_(indexXA)(syms, i);
-         if (SHOW && SHOW_SYMS_P2) {
-            VG_(printf)("Phase2: %d 0x%lx 0x%lx ", 
-                        i, s->first, s->last);
-            print_Name(s->name);
-            VG_(printf)("\n");
-         }
-      }
-   }
-
-   /* ----------------------------------------------------------
-      Phase 3: rescan the symbol table, looking for info on function
-      start/end line numbers and source file names.  Generally
-      this will be absent for sources compiled without -g.
-      ---------------------------------------------------------- */
-
-   if (SHOW && SHOW_SYMS_P3) {
-      VG_(printf)("--- BEGIN Phase3 (find src filenames "
-                  "& fn start/end line #s) ---\n");
-      VG_(printf)("--- note: shown addresses are STATED VMAs ---\n");
-   }
-
-   /* The lookupXAs in the C_FUN(.bf) part have to operate by
-      inclusion.  Hence: */
-   VG_(setCmpFnXA)(syms, cmp_XCoffSym_by_overlap);
-   VG_(sortXA)(syms);
-
-   /* In this loop, p3currsym is maintained as a pointer to the most
-      recent XCoffSym identified as FCN(.bf) (function start).
-      Subsequent FCN(.ef) (function end) indications are compared
-      against said symbol.  This assumes that function start/end
-      indications are not nested. */
-
-   XCoffSym* p3currsym = NULL;
-
-   /* Maintain a stack of filenames.  We allow the stack pointer to go
-      beyond the end, but obviously nothing is stored in this
-      imaginary part of the stack. */
-   Name filenames[N_FILENAME_STACK];
-   Int  filenames_used = 1;
-
-   Name name_unknown  = mk_empty_Name();
-   Name name_overflow = mk_const_Name("(filename_stack_overflow)");
-
-   for (i = 0; i < N_FILENAME_STACK; i++)
-      filenames[i] = name_unknown;
-
-#  define FNAME_PUSH(_fname) \
-      do { \
-         vg_assert(filenames_used >= 1);\
-         if (filenames_used < N_FILENAME_STACK)\
-            filenames[filenames_used] = (_fname);\
-         filenames_used++;\
-      } while (0)
-
-#  define FNAME_POP \
-      do {\
-         vg_assert(filenames_used >= 1);\
-         if (filenames_used > 1 && filenames_used <= N_FILENAME_STACK) \
-            filenames[filenames_used-1] = name_unknown; \
-         if (filenames_used > 1)\
-            filenames_used--;\
-      } while (0)
-
-#  define FNAME_GET_TOP \
-      (filenames_used > N_FILENAME_STACK  \
-         ? name_overflow \
-         : filenames[filenames_used-1])
-
-#  define FNAME_SET_TOP(_fname) \
-      do {\
-         vg_assert(filenames_used >= 1);\
-         filenames[filenames_used-1] = (_fname);\
-      } while (0)
-
-
-   i = 0;
-   while (1) {
-
-      if (i >= oi_nent_symtab)
-         break;
-
-      sym = SYM_IX(oi_symtab, i);
-      is_text = sntext_1based_if_known != -1
-                && (Int)sym->n_scnum == sntext_1based_if_known;
-      is_data = sndata_1based_if_known != -1
-                && (Int)sym->n_scnum == sndata_1based_if_known;
-
-      if (0 && SHOW && SHOW_SYMS_P3)
-         VG_(printf)("Phase3: %5d+%d  ", i, (Int)sym->n_numaux);
-
-      name = mk_const_Name("(unknown)");
-      if (sym->n_scnum == N_DEBUG && sym->n_sclass == C_FUN)
-         name = maybeDerefStrTab( sym, oi_debug, oi_n_debug );
-      else 
-      if (sym->n_sclass & DBXMASK)
-         name = mk_const_Name("(dbxstr)");
-      else
-         name = maybeDerefStrTab( sym, oi_strtab, oi_n_strtab);
-
-      if (0 && SHOW && SHOW_SYMS_P3) {
-         VG_(printf)("%5s(%2d)  %6s  0x%016llx ", 
-                     is_text ? "text" : is_data ? "data" : "other",
-                     (Int)sym->n_scnum, 
-                     name_of_syment_n_sclass(sym->n_sclass), 
-                     (ULong)sym->n_value);
-         print_Name(name);
-         VG_(printf)("\n");
-      }
-
-      i++;
-      i += sym->n_numaux;
-
-      /* --- BEGIN C_FILE [source file] --- */
-      /* There are two variants of C_FILE: a simple one with n_numaux
-         == 0, where the primary name is what we're after, and another
-         variant with n_numaux == 3, in which we have to hunt around
-         in the auxiliary entries to find the file name.  gcc produces
-         exclusively the first kind, and xlc a mixture of both. */
-      if (sym->n_sclass == C_FILE && sym->n_numaux == 0) {
-         if (!is_empty_Name(name))
-            FNAME_SET_TOP(name);
-         if (SHOW && SHOW_SYMS_P3) {
-            VG_(printf)("Phase3: %5d+%d  FILE      ",
-                        i-1-sym->n_numaux, (Int)sym->n_numaux );
-            print_Name(name);
-            VG_(printf)("\n");
-         }
-         continue;
-      }
-      if (sym->n_sclass == C_FILE && sym->n_numaux > 1 
-                                  && sym->n_numaux <= 5 /*stay sane*/) {
-         for (k = 0; k < sym->n_numaux; k++) {
-            aux = SYM_IX(oi_symtab, i - sym->n_numaux + k);
-            Name fname
-               = maybeDerefStrTab_fname( 
-                    (UChar*)&((AUXENT*)aux)->x_file.x_fname,
-                    oi_strtab, oi_n_strtab);
-            if (((AUXENT*)aux)->x_file._x.x_ftype == XFT_FN) {
-               if (!is_empty_Name(fname))
-                  FNAME_SET_TOP(fname);
-               if (SHOW && SHOW_SYMS_P3) {
-                  VG_(printf)("Phase3: %5d+%d  FILE      ",
-                              i-1-sym->n_numaux, (Int)sym->n_numaux );
-                  print_Name(fname);
-                  VG_(printf)("\n");
-               }
-               break;
-            }
-         }
-         continue;
-      }
-      /* --- END C_FILE [source file] --- */
-
-      /* --- BEGIN C_BINCL [beginning of include] --- */
-      if (sym->n_sclass == C_BINCL && sym->n_numaux == 0) {
-         FNAME_PUSH(name);
-         if (SHOW && SHOW_SYMS_P3)
-            VG_(printf)("Phase3: %5d+%d  BINCL     %s\n",
-                         i-1-sym->n_numaux, (Int)sym->n_numaux, 
-                         "fixme-Name-printing(3)" /*name*/ );
-         continue;
-      }
-      /* --- END C_BINCL [beginning of include] --- */
-
-      /* --- BEGIN C_EINCL [end of include] --- */
-      if (sym->n_sclass == C_EINCL && sym->n_numaux == 0) {
-         FNAME_POP;
-         if (SHOW && SHOW_SYMS_P3)
-            VG_(printf)("Phase3: %5d+%d  EINCL     %s\n",
-                         i-1-sym->n_numaux, (Int)sym->n_numaux, 
-                         "fixme-Name-printing(4)" /*name*/ );
-         continue;
-      }
-      /* --- END C_EINCL [end of include] --- */
-
-      /* everything else that is interesting is in the text
-         section. */
-      if (!is_text)
-         continue;
- 
-      /* --- BEGIN C_FCN(.bf) [function begin mark] --- */
-      if (sym->n_sclass == C_FCN 
-          && sym->n_numaux == 1 
-          && eq_string_Name(name, ".bf")) {
-         /* aux is BLOCK */
-         aux = SYM_IX(oi_symtab, i-1);
-         Addr fn_start_avma = ((Addr)sym->n_value) + text_bias;
-         Int  fn_start_lnno = ((AUXENT*)aux)->x_sym.x_misc.x_lnsz.x_lnno;
-         /* Look in 'syms' to see if we have anything for address
-            fn_avma. */
-         XCoffSym key;
-         VG_(memset)(&key, 0, sizeof(key));
-         key.first = fn_start_avma;
-         key.last  = fn_start_avma;
-         Word ix_lo, ix_hi;
-
-	 /* Search for all symbols intersecting fn_start_avma. */
-         Bool found = VG_(lookupXA)(syms, &key, &ix_lo, &ix_hi);
-         if (found) {
-            /* All the 'syms' entries from ix_lo to ix_hi match. */
-
-            for (k = ix_lo; k <= ix_hi; k++) {
-               XCoffSym* tsym = (XCoffSym*)VG_(indexXA)(syms,k);
-
-               /* note the start line number */
-               if (tsym->slnno == 0 && fn_start_lnno > 0)
-                  tsym->slnno = fn_start_lnno;
-
-               /* also the current filename, if we know it */
-               if (is_empty_Name(tsym->fname) 
-                   && !is_empty_Name(FNAME_GET_TOP)) 
-                  tsym->fname = FNAME_GET_TOP;
-
-               /* remember the first in the range as the new current
-                  (I've never seen a range with > 1) */
-               if (k == ix_lo)
-                  p3currsym = tsym;
-               if (SHOW && SHOW_SYMS_P3) {
-                   VG_(printf)("Phase3: %5d+%d  FCN(.bf)  0x%016llx  "
-                               "lnno=%-4d  ", 
-                               i-1-sym->n_numaux, (Int)sym->n_numaux, 
-                               (ULong)sym->n_value,
-                               fn_start_lnno );
-                   print_Name(tsym->name);
-                   VG_(printf)("\n");
-                   if (!is_empty_Name(tsym->fname)) {
-                      VG_(printf)("Phase3:                    ");
-                      print_Name(tsym->fname);
-                      VG_(printf)("\n");
-                   }
-               }
-            }
-         }
-         continue;
-      }
-      /* --- END C_FCN(.bf) [function begin mark] --- */
-
-      /* --- BEGIN C_FCN(.ef) [function end mark] --- */
-      if (sym->n_sclass == C_FCN 
-          && sym->n_numaux == 1 
-          && eq_string_Name(name, ".ef")) {
-         /* aux is BLOCK */
-         aux = SYM_IX(oi_symtab, i-1);
-         /* In this case the n_value field appears to give the address
-            of the first insn following the end of the function.
-            Hence the - 1. */
-         Addr fn_end_avma = ((Addr)sym->n_value) + text_bias - 1;
-         Int  fn_end_lnno = ((AUXENT*)aux)->x_sym.x_misc.x_lnsz.x_lnno;
-
-         if (p3currsym
-             && fn_end_avma >= p3currsym->first
-             && fn_end_avma <= p3currsym->last) {
-            if (p3currsym->elnno == 0 && fn_end_lnno > 0)
-               p3currsym->elnno = fn_end_lnno;
-            if (SHOW && SHOW_SYMS_P3) {
-                VG_(printf)("Phase3: %5d+%d  FCN(.ef)  0x%016llx  "
-                            "lnno=%-4d  ", 
-                            i-1-sym->n_numaux, (Int)sym->n_numaux, 
-                            (ULong)sym->n_value,
-                            fn_end_lnno );
-                print_Name(p3currsym->name);
-                VG_(printf)("\n");
-            }
-            if (fn_end_avma < p3currsym->last) {
-               /* also take the opportunity to trim the symbol's
-                  length to something less than established by the
-                  initial estimation done by Phases 1 and 2. */
-               if (0) VG_(printf)("trim end from %#lx to %#lx\n", 
-                                  p3currsym->last, fn_end_avma);
-               p3currsym->last = fn_end_avma;
-            }
-         }
-         continue;
-      }
-      /* --- END C_FCN(.ef) [function end mark] --- */
-
-   }
-
-   /* ----------------------------------------------------------
-      Phase 4: read and enumerate the line number entries, if 
-      there are any.  This depends on knowing the function start/end
-      line numbers established in Phase 3.
-      ---------------------------------------------------------- */
-
-   if (SHOW && SHOW_SYMS_P4) {
-      VG_(printf)("--- BEGIN Phase4 (read line number info) ---\n");
-      VG_(printf)("--- note: shown addresses are ACTUAL VMAs ---\n");
-   }
-
-   /* Re-sort 'syms' using the compare-start-addresses ordering, so we
-      can use that in subsequent searches. */
-   VG_(setCmpFnXA)(syms, cmp_XCoffSym_by_start);
-   VG_(sortXA)(syms);
-
-   if (oi_lnos && oi_nent_lnos > 0) {
-
-#     if defined(VGP_ppc32_aix5)
-      vg_assert(LINESZ == 6); /* XCOFF32 */
-#     elif defined(VGP_ppc64_aix5)
-      vg_assert(LINESZ == 12); /* XCOFF64 */
-#     else
-#     error "Unknown plat"
-#     endif
-
-#     define LNO_IX(_tab,_n) \
-         ((LINENO*)(((UChar*)(_tab)) + LINESZ * (_n)))
-
-      /* Current fn that we are processing line numbers for */
-      XCoffSym* p4currsym = NULL;
-
-      /* SegInfo's string table pointer for p4currsym's file name.
-         Allocated on demand, so as not to waste space in the
-         SegInfo's string table. */
-      UChar* si_fname_str = NULL;
-
-      /* Ditto the directory name, if we can manage it. */
-      UChar* si_dname_str = NULL;
-
-      for (i = 0; i < oi_nent_lnos; i++) {
-         LINENO* lno = LNO_IX(oi_lnos,i);
-
-         if (lno->l_lnno == 0) {
-            /* New fn.  We get given the index in the symbol table of
-               the relevant function.  It should be a C_EXT, C_WEAKEXT
-               or C_HIDEXT flavour, according to the IBM docs. */
-            Int sym_ix = (Int)lno->l_addr.l_symndx;
-            sym = SYM_IX(oi_symtab, sym_ix);
-            if (!(sym->n_sclass == C_EXT 
-                  || sym->n_sclass == C_WEAKEXT 
-                  || sym->n_sclass == C_HIDEXT))
-               return "readxcoff.c: invalid symbol reference"
-                      " in line number info";
-            /* For these 3 symbol kinds, the n_value field is the
-               symbol's stated VMA.  Convert this to an actual VMA and
-               use that to find the associated XCoffSym. */
-            Addr sym_avma = ((Addr)sym->n_value) + text_bias;
-
-            XCoffSym key;
-            VG_(memset)(&key, 0, sizeof(key));
-            key.first = sym_avma;
-            Word ix_lo, ix_hi;
-
-            Bool found = VG_(lookupXA)(syms, &key, &ix_lo, &ix_hi);
-            if (found) {
-               /* All the 'syms' entries from ix_lo to ix_hi match.
-                  Just use the lowest (sigh ..) */
-               p4currsym = (XCoffSym*)VG_(indexXA)(syms, ix_lo);
-            } else {
-               /* We can't find the relevant sym, but we still have to
-                  wade through the line number info for this function
-                  until we get to the starting record for the next
-                  one. */
-               p4currsym = NULL;
-            }
-
-            /* If we decide to add any line info for this fn to the
-               SegInfo, we'll allocate this.  Otherwise don't
-               bother. */
-            si_fname_str = NULL;
-            si_dname_str = NULL;
-
-            if (SHOW && SHOW_SYMS_P4) {
-               VG_(printf)("Phase4: new fn (%d found), avma 0x%016llx  ", 
-                           (Int)(ix_hi-ix_lo+1),
-                           (ULong)sym_avma );
-               if (p4currsym)
-                  print_Name(p4currsym->name);
-               else
-                  VG_(printf)("UNKNOWN");
-               VG_(printf)("\n");
-            }
-
-         } else {
-            /* Line number entry for the current fn. */
-            if (!p4currsym)
-               continue;
-            Int line_no = (Int)(UInt)lno->l_lnno;
-            line_no += (p4currsym->slnno - 1);
-            Addr line_first_avma = ((Addr)lno->l_addr.l_paddr) + text_bias;
-            if (line_first_avma < p4currsym->first
-                || line_first_avma > p4currsym->last)
-               continue;
-            Addr line_last_avma = p4currsym->last;
-            /* Try to refine the last_avma by looking at the next
-               line's entry. */
-
-            /* XXX: TODO.  What we have currently works only because
-               the generic line number canonicaliser truncates
-               overlapping address ranges in the way which we happen
-               to need anyway. */
-            if (SHOW && SHOW_SYMS_P4)
-               VG_(printf)("Phase4:  line %d 0x%016llx - 0x%016llx\n", 
-                           line_no, (ULong)line_first_avma, 
-                                    (ULong)line_last_avma);
-
-            /* This now has to be allocated.  Try and figure out the
-               dir name at the same time.  This is a bit ugly in that
-               it involves messing with the string after it's been
-               copied into the SegInfo's string table, but seems
-               harmless enough. */
-            if ((!si_fname_str) && !is_empty_Name(p4currsym->fname)) {
-               si_dname_str = NULL;
-               si_fname_str = ML_(addStr)(di, p4currsym->fname.vec,
-                                              p4currsym->fname.len);
-               UChar* lastslash = VG_(strrchr)(si_fname_str, '/');
-               if (lastslash)
-                  vg_assert(lastslash[0] == '/');
-               if (lastslash[1] != 0) {
-                  si_dname_str = si_fname_str;
-                  lastslash[0] = 0; /* replace the / with a NUL
-                                       terminator */
-                  si_fname_str = lastslash+1;
-                  if (0) VG_(printf)("XXX %s %s\n", si_dname_str, 
-                                                    si_fname_str);
-               }
-            }
-            /* finally .. */
-	    if (line_no >= 0)
-               ML_(addLineInfo)(di, si_fname_str, si_dname_str,
-                                line_first_avma, line_last_avma+1,
-                                line_no, i/*debugging only*/);
-         }
-      }
-
-#     undef LNO_IX
-   }
-
-#if defined(OFFICIAL_PHASE5)
-   /* ----------------------------------------------------------
-      Phase 5: Do another trawl of the XCOFF symbol table, looking
-      for TOC entries for the entries we've already placed in 'syms'.
-      ---------------------------------------------------------- */
-
-   if (SHOW && SHOW_SYMS_P5)
-      VG_(printf)("--- BEGIN official Phase5 (find TOC pointers) ---\n");
-
-   Bool is_cfun;
-
-   i = 0;
-   while (1) {
-
-      if (i >= oi_nent_symtab)
-         break;
-
-      sym = SYM_IX(oi_symtab, i);
-      is_text = sntext_1based_if_known != -1
-                && (Int)sym->n_scnum == sntext_1based_if_known;
-      is_data = sndata_1based_if_known != -1
-                && (Int)sym->n_scnum == sndata_1based_if_known;
-      is_cfun = sym->n_scnum == N_DEBUG 
-                && sym->n_sclass == C_FUN;
-
-      i++;
-      i += sym->n_numaux;
-
-      if (!is_cfun && !is_data)
-         continue;
-
-      if (SHOW && SHOW_SYMS_P5)
-         VG_(printf)("Phase5o: %5d+%d  ", i-1-sym->n_numaux, 
-                                          (Int)sym->n_numaux);
-
-      name = mk_const_Name("(unknown)");
-      if (is_cfun)
-         name = maybeDerefStrTab( sym, oi_debug, oi_n_debug );
-      else 
-      if (sym->n_sclass & DBXMASK)
-         name = mk_const_Name("(dbxstr)");
-      else
-         name = maybeDerefStrTab( sym, oi_strtab, oi_n_strtab);
-
-      if (SHOW && SHOW_SYMS_P5) {
-         VG_(printf)("%5s(%2d)  %6s  svma 0x%016llx ", 
-                     is_text ? "text" : is_data ? "data" : "other",
-                     (Int)sym->n_scnum, 
-                     name_of_syment_n_sclass(sym->n_sclass), 
-                     (ULong)sym->n_value);
-         print_Name(name);
-         VG_(printf)("\n");
-      }
-
-      Addr avma = (Addr)sym->n_value + data_bias;
-      if (0) VG_(printf)("data sym: avma %p, limits %p-%p\n", 
-                         avma,  data_avma,data_avma + data_alen);
-
-      /* Does avma point to 3 valid words inside the actual data
-         segment?  iow, can it possibly be a valid function
-         descriptor?  If not, move on. */
-      if (! (avma >= data_avma 
-             && avma + 3 * sizeof(Word) <= data_avma + data_alen) )
-         continue;
-
-      UWord* fndescr = (UWord*)avma;
-
-      if (SHOW && SHOW_SYMS_P5) 
-          VG_(printf)("                  fndescr = {0x%lx,0x%lx}\n", 
-                      fndescr[0], fndescr[1]);
-
-      /* Another check: fndescr[0], the entry point, must point inside
-         the actual text segment.  Discard any that don't. */
-
-      Addr fndescr_0 = (Addr)fndescr[0];
-      if (fndescr_0 < si->text_avma 
-          || fndescr_0 >= si->text_avma+si->text_size)
-         continue;
-
-      /* Let's suppose that fndescr is the descriptor for a
-         function with name NAME.  If that's so, then 'syms'
-         acquired by stage 2 should have an entry of name '.NAME'
-         whose address is fndescr[0].  If so, then fndescr[1] must
-         be the relevant r2 value for it. */
-      /* Look in 'syms' to see if we have anything for address
-         fndescr[0]. */
-      XCoffSym key;
-      VG_(memset)(&key, 0, sizeof(key));
-      key.first = fndescr_0;
-      Word ix_lo, ix_hi;
-      Bool found = VG_(lookupXA)(syms, &key, &ix_lo, &ix_hi);
-      if (found) {
-         /* So all the 'syms' entries from ix_lo to ix_hi have an
-            address which matches the entry point address stated in
-            this descriptor.  For each one, as a final sanity
-            check, see if the 'syms' entry has a name .NAME where
-            NAME is that of the data symbol currently under
-            consideration.  If so, it's a pretty good bet that this
-            descriptor matches the text symbol we already have, and
-            so we have a valid tocptr value from fndescr[1]. */
-         for (k = ix_lo; k <= ix_hi; k++) {
-            XCoffSym* tsym = (XCoffSym*)VG_(indexXA)(syms,k);
-            vg_assert(!is_empty_Name(tsym->name));
-            /* VG_(printf)("cmp %s %s\n", name, tsym->name); */
-            /* VG_(printf)("found matching %d %s\n", k, tsym->name); */
-            if (tsym->name.len == 1 + name.len
-                && tsym->name.vec[0] == '.'
-                && 0 == VG_(memcmp)(&tsym->name.vec[1],
-                                    &name.vec[0], name.len)) {
-               Addr r2val = fndescr[1];
-               if (tsym->r2known) {
-                  if (tsym->r2value != r2val)
-                     /* COMPLAIN - conflicting r2 values*/ ;
-               } else {
-                  tsym->r2known = True;
-                  tsym->r2value = r2val;
-               }
-            }
-         }
-      }
-
-   }
-
-#else /* !defined(OFFICIAL_PHASE5) */
-   /* ----------------------------------------------------------
-      Alternative kludgey Phase 5: find TOC entries for 'syms' by the
-      blunt-instrument approach of scanning the actual data section
-      and noting anything that looks like a function descriptor.
-      This is dangerous in the sense that if there are any 3 word
-      structs which are not real function descriptors but just happen
-      to look like them, then those will be included too.  
-      Seems unlikely though.
-      ---------------------------------------------------------- */
-
-   if (SHOW && SHOW_SYMS_P5)
-      VG_(printf)("--- BEGIN kludged Phase5 (find TOC pointers) ---\n");
-
-   if (SHOW)
-      VG_(printf)("Phase5: actual data segment: %#lx %#lx\n",
-                  di->data_avma, di->data_avma + di->data_size);
-
-   /* Skip obviously-missing data sections. */
-   if (di->data_avma != 0 && di->data_size >= sizeof(UWord)) {
-
-      /* set up for inspecting all the aligned words in the actual
-         data section. */
-
-      Addr tmp = di->data_avma;
-      while (tmp & (sizeof(UWord)-1))
-         tmp++;
-
-      UWord* first_data_word = (UWord*)tmp;
-      tmp = di->data_avma + di->data_size - sizeof(UWord);
-      while (tmp & (sizeof(UWord)-1))
-         tmp--;
-      UWord* last_data_word = (UWord*)tmp;
-
-      if (SHOW) 
-         VG_(printf)("Phase5: data segment conservatively aligned %p %p\n", 
-                     first_data_word, last_data_word);
-
-      UWord* wP = first_data_word;
-      UWord  w;
-
-      while (True) {
-
-         XCoffSym key;
-         Word     ix_lo, ix_hi;
-         Bool     found;
-
-         if (& wP[2] > last_data_word)
-            break; /* no space left for a 3-word descriptor */
-
-         w = wP[0];
-         if (!(w >= di->text_avma 
-               && w < di->text_avma + di->text_size)) {
-            wP++;
-            continue; /* entry pointer is not to text segment */
-         }
-
-         w = wP[1];
-         if (!(w >= di->data_avma && w < di->data_avma + di->data_size)) {
-            wP++;
-            if (SHOW && SHOW_SYMS_P5) {
-               VG_(memset)(&key, 0, sizeof(key));
-               key.first = wP[0];
-               found = VG_(lookupXA)(syms, &key, &ix_lo, &ix_hi);
-               if (found) {
-                  vg_assert(ix_lo <= ix_hi);
-                  XCoffSym* tsym = (XCoffSym*)VG_(indexXA)(syms,ix_lo);
-                  VG_(printf)("Phase5: bad tocptc at 0x%016llx={",
-                              (ULong)(UWord)(wP-1));
-                  print_Name(tsym->name);
-                  VG_(printf)(",%p}\n", (void*)w);
-               }
-            }
-            continue; /* r2 value does not point to data segment */
-         }
-
-         /* ok, so wP might be a valid fn descr.  But does it point to
-            a text symbol we know about?  Look in 'syms' to see if we
-            have anything for wP[0]. */
-         VG_(memset)(&key, 0, sizeof(key));
-         key.first = wP[0];
-         found = VG_(lookupXA)(syms, &key, &ix_lo, &ix_hi);
-         if (found) {
-            for (k = ix_lo; k <= ix_hi; k++) {
-               XCoffSym* tsym = (XCoffSym*)VG_(indexXA)(syms,k);
-               Addr r2val = wP[1];
-               if (tsym->r2known) {
-                  if (tsym->r2value != r2val)
-                     /* COMPLAIN - conflicting r2 values*/ ;
-               } else {
-                  tsym->r2known = True;
-                  tsym->r2value = r2val;
-                  if (SHOW && SHOW_SYMS_P5) {
-                     VG_(printf)("Phase5: found tocptr 0x%016llx for ", 
-                                 (ULong)r2val);
-                     print_Name(tsym->name);
-                     VG_(printf)("\n");
-                  }
-               }
-            }
-         }
-
-         wP++;
-      }
-   }
-
-#endif /* defined(OFFICIAL_PHASE5) */
-
-   /* ----------------------------------------------------------
-      Phase 6: trivial: copy the syms out of 'syms' into the 
-      generic debuginfo tables, and free up 'syms'.
-      ---------------------------------------------------------- */
-
-   if (SHOW && SHOW_SYMS_P6) {
-      VG_(printf)("--- BEGIN Phase6 (finalise symbol info) ---\n");
-      VG_(printf)("--- note: shown addresses are ACTUAL VMAs ---\n");
-   }
-
-   for (i = 0; i < nsyms; i++) {
-      DiSym     dis;
-      XCoffSym* s = (XCoffSym*)VG_(indexXA)(syms, i);
-      Addr  addr = s->first;
-      UWord size = s->last + 1 - s->first;
-      Bool  guessed_toc = False;
-
-      /* If everything worked right, the symbol should fall within the
-         mapped text segment.  Hence .. */
-      Bool sane = addr >= di->text_avma 
-                  && addr+size <= di->text_avma + di->text_size;
-
-      if (SHOW && SHOW_SYMS_P6) {
-         VG_(printf)("Phase6: %s %3d  0x%08lx-0x%08lx  0x%08lx  ", 
-                     sane ? "   " : "BAD",
-                     i, 
-                     addr,
-                     addr + size - 1,
-                     s->r2known ? s->r2value : 0 );
-         print_Name(s->name);
-         VG_(printf)("\n");
-      }
-
-#     if defined(VGP_ppc64_aix5)
-      /* 64-bit kludge: if we can't find a plausible toc ptr just use
-         the one specified in the XCOFF auxiliary header. */
-      if ((!s->r2known)
-          && toc_avma != 0
-          && s->name.len > 8
-          && 0==VG_(strncmp)(&s->name.vec[0], "._vgwZU_", 8)) {
-         s->r2known = True;
-         s->r2value = toc_avma;
-         guessed_toc = True;
-         if (SHOW && SHOW_SYMS_P6)
-            VG_(printf)("Phase6: assuming toc 0x%08lx for above sym\n", 
-                        s->r2value);
-      }
-#     endif
-
-      /* Actually add the symbol (finallyatlast) */
-      if (sane) {
-         UInt nlen;
-         dis.addr    = addr;
-         dis.size    = size;
-         dis.tocptr  = s->r2known ? s->r2value : 0;
-         dis.isText  = True;
-         dis.isIFunc = False;
-         vg_assert(!is_empty_Name(s->name));
-         nlen = s->name.len;
-         vg_assert(nlen > 0);
-         if (s->name.vec[0] == '.')
-            dis.name = ML_(addStr)(di, &s->name.vec[1], nlen-1 );
-         else
-            dis.name = ML_(addStr)(di, &s->name.vec[0], nlen-0 );
-         ML_(addSym)( di, &dis );
-         if (0 && s->r2known)
-            VG_(printf)("r2 known for %s\n",
-                        "fixme-Name-printing(5)" /*s->name*/ );
-
-	 if (guessed_toc)
-            VG_(message)(Vg_DebugMsg, "WARNING: assuming toc 0x%lx for %s\n", 
-                                      s->r2value, dis.name);
-      }
-   }
-
-   /* Free up the XA */
-   VG_(deleteXA)(syms);
-
-#  undef SYM_IX
-
-   return NULL; /*success*/
-}
-
-
-static void show_loader_section ( struct _DebugInfo* di,
-                                  UChar* oi_start, UWord size )
-{
-   Int i, j;
-   LDHDR* hdr = (LDHDR*)oi_start;
-   UChar* strtab_import = NULL;
-   UChar* strtab_other  = NULL;
-   if (SHOW) {
-      VG_(printf)("   l_version           %llu\n", (ULong)hdr->l_version);
-      VG_(printf)("   l_nsyms             %lld\n", (Long)hdr->l_nsyms);
-      VG_(printf)("   l_nreloc            %lld\n", (Long)hdr->l_nreloc);
-      VG_(printf)("   l_istlen (i st len) %lld\n", (Long)hdr->l_istlen);
-      VG_(printf)("   l_impoff (i st off) %llu\n", (ULong)hdr->l_impoff);
-      VG_(printf)("   l_nimpid (# imps)   %llu\n", (ULong)hdr->l_nimpid);
-      VG_(printf)("   l_stlen  (st len)   %llu\n", (ULong)hdr->l_stlen);
-      VG_(printf)("   l_stoff  (st off)   %llu\n", (ULong)hdr->l_stoff);
-   }
-
-   if (hdr->l_istlen > 0)
-      strtab_import = oi_start + hdr->l_impoff;
-   if (hdr->l_stlen > 0)
-      strtab_other = oi_start + hdr->l_stoff;
-
-   if (strtab_import) {
-      if (SHOW)
-         VG_(printf)("   Loader Import String Table: %llu bytes\n", 
-                     (ULong)hdr->l_istlen);
-      i = 0;
-      j = 0;
-      while (1) {
-         if (i >= hdr->l_istlen)
-            break;
-         if (SHOW && SHOW_LD_STRTAB)
-            VG_(printf)("     %3d%s ", i, (j%3)==0 ? "::" : "  ");
-         j++;
-         while (i < hdr->l_istlen && strtab_import[i]) {
-            if (SHOW && SHOW_LD_STRTAB)
-               VG_(printf)("%c", sanitiseChar(strtab_import[i]));
-            i++;
-         }
-         i++;
-         if (SHOW && SHOW_LD_STRTAB)
-            VG_(printf)("\n");
-      }
-   }
-
-   if (strtab_other) {
-      if (SHOW)
-         VG_(printf)("   Loader Other String Table: %llu bytes\n", 
-                     (ULong)hdr->l_stlen);
-      i = 0;
-      while (1) {
-         int len = 0;
-         if (i+1 >= hdr->l_stlen)
-            break;
-         len = (unsigned char)strtab_other[i];
-         len <<= 8;
-         len |= (unsigned char)strtab_other[i+1];
-         i += 2;
-         if (i >= hdr->l_stlen)
-            break;
-         if (SHOW && SHOW_LD_STRTAB)
-            VG_(printf)("      %2d len %2d  ", i, len);
-         while (len >= 0 && i < hdr->l_stlen && strtab_other[i]) {
-            if (SHOW && SHOW_LD_STRTAB)
-               VG_(printf)("%c", sanitiseChar(strtab_other[i]));
-            i++;
-            len--;
-         }
-         i++;
-         if (SHOW && SHOW_LD_STRTAB)
-            VG_(printf)("\n");
-      }
-   }
-
-   if (SHOW)
-      VG_(printf)("   Loader Symbol Table: %lld entries\n", (Long)hdr->l_nsyms);
-   LDSYM* sym = (LDSYM*)(oi_start + sizeof(LDHDR));
-   for (i = 0; i < hdr->l_nsyms; i++) {
-      Name name = maybeDerefStrTab( (SYMENT*)&sym[i],
-                                    strtab_other, hdr->l_stlen );
-      if (SHOW && SHOW_LD_SYMTAB) {
-         VG_(printf)("      %2d:  %016llx  sec %d  ty 0x%02x  "
-                     "scla 0x%02x  itab %d  ", 
-                     i, (ULong)sym[i].l_value, (Int)sym[i].l_scnum, 
-                     (Int)sym[i].l_smtype, (Int)sym[i].l_smclas,
-                     (Int)sym[i].l_ifile);
-         print_Name(name);
-         VG_(printf)("\n");
-      }
-   }
-
-#  if defined(VGP_ppc32_aix5)
-   vg_assert(sizeof(LDREL) == 12);
-#  elif defined(VGP_ppc64_aix5)
-   vg_assert(sizeof(LDREL) == 16);
-#  else
-#    error Unknown platform
-#  endif
-
-   LDREL* rel = (LDREL*)(&sym[hdr->l_nsyms]);
-   if (SHOW)
-      VG_(printf)("   Loader Relocation Table: %lld entries\n", 
-                  (Long)hdr->l_nreloc);
-   for (i = 0; i < hdr->l_nreloc; i++) {
-      if (SHOW && SHOW_LD_RELTAB)
-         VG_(printf)("      %3d:  va %016llx  sym %2lld  rty 0x%4x  sec %2d\n",
-                     i, (ULong)rel[i].l_vaddr, (Long)rel[i].l_symndx, 
-                        (Int)rel[i].l_rtype, (Int)rel[i].l_rsecnm);
-   }
-
-   if (SHOW)
-      VG_(printf)("\n");
-}
-
-
-/* Returns True on success, False on any kind of error. 
-
-   The object file from which to read symbols is mapped temporarily at
-   [oimage .. oimage + n_oimage).
-
-   The VMA of where the relevant text section really got loaded (the
-   "actual VMA", _avma) is [si->text_avma .. si->text_avma
-   + si->text_size).
-
-   The VMA of the associated data section really got loaded
-   (the "actual VMA", _avma) is [data_avma .. data_avma + data_alen).
-
-   We will need to peer at the loaded data section in order to make
-   sense of TOC entries, hence we need to be assured it is mapped and
-   readable.  m_aspacemgr should have given us that assurance, in the
-   sense that data_avma/data_alen will be save to read in by the time
-   we get here.
-*/
-static 
-Bool read_xcoff_mapped_object ( struct _DebugInfo* di,
-                                UChar* oimage, UWord n_oimage )
-{
-#define BAD(_msg)  do { ML_(symerr)(di, True/*serious*/,_msg); \
-                        return False; } while (0)
-
-   Int i, j;
-
-   /* The first byte after the oimage - we can't go here */
-   UChar* oimage_after = oimage + n_oimage;
-
-   UChar* cursor = oimage;
-
-   /* ------------ File Header ------------ */
-#  if defined(VGP_ppc32_aix5)
-   if (sizeof(FILHDR) != 20)
-      BAD("readxcoff.c: invalid FILHDR size (32-bit)");
-#  elif defined(VGP_ppc64_aix5)
-   if (sizeof(FILHDR) != 24)
-      BAD("readxcoff.c: invalid FILHDR size (64-bit)");
-#  else
-#  error "Invalid platform"
-#  endif
-
-   if (n_oimage < sizeof(FILHDR))
-      BAD("readxcoff.c: XCOFF object file header is implausibly small (2)");
-
-   FILHDR* t_filehdr = (FILHDR*)cursor;
-   cursor += sizeof(FILHDR);
-
-   if (SHOW) {
-      VG_(printf)("\nFile Header:\n");
-      VG_(printf)("   magic             0x%04x (%s)\n", 
-                  (UInt)t_filehdr->f_magic,
-                  name_of_filhdr_f_magic(t_filehdr->f_magic));
-   }
-
-#  if defined(VGP_ppc32_aix5)
-   if (t_filehdr->f_magic != 0x01DF /* XCOFF32 */)
-      BAD("readxcoff.c: XCOFF32 object file header has invalid magic");
-#  elif defined(VGP_ppc64_aix5)
-   if (t_filehdr->f_magic != 0x01F7 /* XCOFF64 */)
-      BAD("readxcoff.c: XCOFF64 object file header has invalid magic");
-#  else
-#  error "Invalid platform"
-#  endif
-
-   if (SHOW) {
-      VG_(printf)("   # of sections     %u\n",       (UInt)t_filehdr->f_nscns);
-      VG_(printf)("   time/date         0x%08llx\n", (ULong)t_filehdr->f_timdat);
-      VG_(printf)("   symtab foffset    %llu\n",     (ULong)t_filehdr->f_symptr);
-      VG_(printf)("   # symtab entries  %llu\n",     (ULong)t_filehdr->f_nsyms);
-      VG_(printf)("   size of aux hdr   %llu\n",     (ULong)t_filehdr->f_opthdr);
-      VG_(printf)("   flags             0x%04x\n",   (UInt)t_filehdr->f_flags);
-      if (t_filehdr->f_flags) {
-         VG_(printf)("                     ");
-         if (t_filehdr->f_flags & F_RELFLG)    VG_(printf)("NoRelocInfo ");
-         if (t_filehdr->f_flags & F_EXEC)      VG_(printf)("IsExec ");
-         if (t_filehdr->f_flags & F_LNNO)      VG_(printf)("NoLineInfo ");
-         if (t_filehdr->f_flags & F_LSYMS)     VG_(printf)("LSYMS ");
-         if (t_filehdr->f_flags & F_FDPR_PROF) VG_(printf)("FDPR_PROF ");
-         if (t_filehdr->f_flags & F_FDPR_OPTI) VG_(printf)("FDPR_OPTI ");
-         if (t_filehdr->f_flags & F_DSA)       VG_(printf)("LargeProc ");
-#        if defined(F_DEP_1)
-         if (t_filehdr->f_flags & F_DEP_1)     VG_(printf)("DEP_1 ");
-#        endif
-#        if defined(F_VARPG)
-         if (t_filehdr->f_flags & F_VARPG)     VG_(printf)("VARPG ");
-#        endif
-         if (t_filehdr->f_flags & F_LPTEXT)    VG_(printf)("LPTEXT ");
-         if (t_filehdr->f_flags & F_LPDATA)    VG_(printf)("LPDATA ");
-         if (t_filehdr->f_flags & F_DYNLOAD)   VG_(printf)("Dynamic ");
-         if (t_filehdr->f_flags & F_SHROBJ)    VG_(printf)("SharedObj ");
-         if (t_filehdr->f_flags & F_LOADONLY)  VG_(printf)("LOADONLY ");
-#        if defined(F_DEP_2)
-         if (t_filehdr->f_flags & F_DEP_2)     VG_(printf)("DEP_2 ");
-#        endif
-         VG_(printf)("\n");
-      }
-   }
-
-   /* ------------ Auxiliary Header ------------ */
-#  if defined(VGP_ppc32_aix5)
-   if (sizeof(AOUTHDR) != 72)
-      BAD("readxcoff.c: invalid AOUTHDR size (32-bit)");
-#  elif defined(VGP_ppc64_aix5)
-   if (sizeof(AOUTHDR) != 120)
-      BAD("readxcoff.c: invalid AOUTHDR size (64-bit)");
-#  else
-#  error "Invalid platform"
-#  endif
-
-   Int sntext_1based_if_known = -1;
-   Int sndata_1based_if_known = -1;
-
-   Addr  data_svma = 0; /* stated VMA of data section, if known */
-   Bool  data_svma_known = False;
-   Word  data_bias = 0;
-   UWord data_alen_from_auxhdr = 0;
-
-   Addr  text_svma = 0; /* stated VMA of text section, if known */
-   Bool  text_svma_known = False;
-   Word  text_bias = 0;
-
-   Addr  toc_avma = 0; /* actual VMA of toc, if known */
-   Addr  toc_svma = 0; /* stated VMA of toc, if known */
-   Addr  toc_svma_known = False;
-
-   AOUTHDR* t_auxhdr = NULL;
-   if (t_filehdr->f_opthdr > 0) {
-      t_auxhdr = (AOUTHDR*)cursor;
-      cursor += sizeof(AOUTHDR);
-      sntext_1based_if_known = (Int)t_auxhdr->o_sntext;
-      sndata_1based_if_known = (Int)t_auxhdr->o_sndata;
-
-      if (SHOW) {
-         VG_(printf)("\nAuxiliary Header\n");
-         VG_(printf)("   magic        0x%04x (should be 0x010b)\n", 
-                     (UInt)t_auxhdr->magic);
-         VG_(printf)("   vstamp       0x%04x\n", (UInt)t_auxhdr->vstamp);
-         VG_(printf)("   tsize        %lld\n", (Long)t_auxhdr->tsize);
-         VG_(printf)("   dsize        %lld\n", (Long)t_auxhdr->dsize);
-         VG_(printf)("   bsize        %lld\n", (Long)t_auxhdr->bsize);
-         VG_(printf)("   entry        0x%llx\n", (ULong)t_auxhdr->entry);
-         VG_(printf)("   text_start   0x%llx (stated)\n",
-                     (ULong)t_auxhdr->text_start);
-         VG_(printf)("   data_start   0x%llx (stated)\n",
-                     (ULong)t_auxhdr->data_start);
-         VG_(printf)("   o_toc        0x%llx\n", (ULong)t_auxhdr->o_toc);
-         VG_(printf)("   o_snentry    %d\n", (Int)t_auxhdr->o_snentry);
-         VG_(printf)("   o_sntext     %d\n", (Int)t_auxhdr->o_sntext);
-         VG_(printf)("   o_sndata     %d\n", (Int)t_auxhdr->o_sndata);
-         VG_(printf)("   o_sntoc      %d\n", (Int)t_auxhdr->o_sntoc);
-         VG_(printf)("   o_snloader   %d\n", (Int)t_auxhdr->o_snloader);
-         VG_(printf)("   o_snbss      %d\n", (Int)t_auxhdr->o_snbss);
-         VG_(printf)("   o_algntext   %d\n", (Int)t_auxhdr->o_algntext);
-         VG_(printf)("   o_algndata   %d\n", (Int)t_auxhdr->o_algndata);
-         VG_(printf)("   o_modtype    \"%c%c\"\n", 
-                     (UChar)t_auxhdr->o_modtype[0],
-                     (UChar)t_auxhdr->o_modtype[1] );
-         VG_(printf)("   o_cpuflag    0x%02x\n", (UInt)t_auxhdr->o_cpuflag);
-         VG_(printf)("   o_cputype    0x%02x\n", (UInt)t_auxhdr->o_cputype);
-         VG_(printf)("   o_maxstack   %llu\n", (ULong)t_auxhdr->o_maxstack);
-         VG_(printf)("   o_maxdata    %llu\n", (ULong)t_auxhdr->o_maxdata);
-         VG_(printf)("   o_debugger   %u\n", t_auxhdr->o_debugger);
-         /* printf("   o_textpsize  %u\n", (UInt)t_auxhdr->o_textpsize); */
-         /* printf("   o_stackpsize %u\n", (UInt)t_auxhdr->o_stackpsize); */
-      }
-
-      text_svma       = t_auxhdr->text_start;
-      text_svma_known = True;
-
-      data_svma       = t_auxhdr->data_start;
-      data_svma_known = True;
-
-      /* The auxhdr may claim the data section is longer than
-	 data_alen, so note the auxhdr-claimed size too. */
-      data_alen_from_auxhdr = (UWord)t_auxhdr->dsize;
-
-      if (t_auxhdr->o_sntoc == t_auxhdr->o_sndata) {
-	 toc_svma       = (Addr)t_auxhdr->o_toc;
-         toc_svma_known = True;
-      }
-   }
-
-   /* ------------ Section Headers ------------ */
-#  if defined(VGP_ppc32_aix5)
-   if (sizeof(SCNHDR) != 40)
-      BAD("readxcoff.c: invalid SCNHDR size (32-bit)");
-#  elif defined(VGP_ppc64_aix5)
-   if (sizeof(SCNHDR) != 72)
-      BAD("readxcoff.c: invalid SCNHDR size (64-bit)");
-#  else
-#  error "Invalid platform"
-#  endif
-
-   SCNHDR* t_scnhdr = (SCNHDR*)cursor;
-
-   if (SHOW)
-      VG_(printf)("\nSection Headers: %d entries\n", t_filehdr->f_nscns);
-
-   /* Where the stabs strings are in the oimage */
-   UChar* oi_debug   = NULL;
-   UWord  oi_n_debug = 0;
-
-   /* Where the line number entries for the text section are
-      in the oimage */
-   UChar* oi_lnos      = NULL;
-   UWord  oi_nent_lnos = 0; /* number of records */
-
-   for (i = 0; i < t_filehdr->f_nscns; i++) {
-      UChar sname_safe[9];
-      for (j = 0; j < 8; j++) 
-         sname_safe[j] = t_scnhdr[i].s_name[j];
-      sname_safe[8] = 0;
-      if (SHOW) {
-         VG_(printf)("   --- #%d ---\n", i);
-         VG_(printf)("   s_name    %s\n", sname_safe);
-         VG_(printf)("   s_paddr   0x%llx\n", (ULong)t_scnhdr[i].s_paddr);
-         VG_(printf)("   s_vaddr   0x%llx\n", (ULong)t_scnhdr[i].s_vaddr);
-         VG_(printf)("   s_size    %lld\n",   (Long)t_scnhdr[i].s_size);
-         VG_(printf)("   s_scnptr  %lld\n",   (Long)t_scnhdr[i].s_scnptr);
-         VG_(printf)("   s_relptr  %lld\n",   (Long)t_scnhdr[i].s_relptr);
-         VG_(printf)("   s_lnnoptr %lld\n",   (Long)t_scnhdr[i].s_lnnoptr);
-         VG_(printf)("   s_nreloc  %llu\n",   (ULong)t_scnhdr[i].s_nreloc);
-         VG_(printf)("   s_nlnno   %llu\n",   (ULong)t_scnhdr[i].s_nlnno);
-         VG_(printf)("   s_flags   0x%llx (%s)\n", 
-                     (ULong)t_scnhdr[i].s_flags,
-                     name_of_scnhdr_s_flags(t_scnhdr[i].s_flags));
-      }
-      /* find the stabs strings */
-      if (t_scnhdr[i].s_flags == STYP_DEBUG) {
-         oi_debug = oimage;
-         oi_debug += (UWord)t_scnhdr[i].s_scnptr;
-         oi_n_debug = (UWord)t_scnhdr[i].s_size;
-      }
-      /* find the line number entries for the text section */
-      if (t_scnhdr[i].s_flags == STYP_TEXT && t_scnhdr[i].s_lnnoptr > 0) {
-         oi_lnos = oimage;
-         oi_lnos += (UWord)t_scnhdr[i].s_lnnoptr;
-         oi_nent_lnos = (UWord)t_scnhdr[i].s_nlnno;
-         /* XCOFF is clearly the result of years of kludgery, and
-            here's one place it shows.  .s_nlnno is a 16-bit field, so
-            if there are 65535 or more entries, they can't be
-            represented here.  In that case, the real number is stored
-            in a 32-bit field of a an "overflow section header" - a
-            dummy section header which has no purpose other than to
-            hold the correct count.  And then this kludge applies to
-            XCOFF32, not XCOFF64. */
-         if (t_scnhdr[i].s_nlnno == 0xFFFF 
-             || t_scnhdr[i].s_nreloc == 0xFFFF) {
-            /* have to test both fields, according to the docs */
-            /* find the relevant overflow header */
-            for (j = 0; j < t_filehdr->f_nscns; j++)
-               if (t_scnhdr[j].s_flags == STYP_OVRFLO 
-                   && t_scnhdr[j].s_nlnno == i+1 /* ref to correct scn? */
-                   && t_scnhdr[j].s_nreloc == i+1 /* also must check this */)
-                  break;
-            vg_assert(j >= 0 && j <= t_filehdr->f_nscns);
-            if (j == t_filehdr->f_nscns)
-               /* Hmm.  We're hosed.  Give up. */
-               BAD("readxcoff.c: can't find a required "
-                   "overflow section header");
-            /* finally, we have the real count. */
-            oi_nent_lnos = (UWord)t_scnhdr[j].s_vaddr;
-         }
-      }
-      cursor += sizeof(SCNHDR);
-   }
-   if (SHOW) {
-      VG_(printf)("\n   debug image (stabs strings) at %p size %ld bytes\n", 
-                  oi_debug, oi_n_debug);
-      VG_(printf)("   line number info at %p with %ld entries\n",
-                  oi_lnos, oi_nent_lnos);
-   }
-
-   /* ------------ establish Text/data biases ------------ */
-
-   /* Calculate, into text_bias, the offset that has to be added to
-      symbol table values (stated VMAs) so as to convert them to correct 
-      addresses in the running image (actual VMAs).  I can't find any 
-      documentation for this, so the following is determined empirically.
-
-      There appear to be two classes of loaded object:
-
-      .o files.  These have a stated text VMA of zero, and so their
-         symbols start from zero and work upwards.  In that case the
-         bias is precisely the offset where the text section is 
-         loaded (si->text_avma), that is, the actual text VMA.
-
-         Except -- cryptically -- /usr/include/sys/ldr.h says that the
-         ld_info.ldinfo_textorg field is "start of loaded program
-         image (includes the XCOFF headers)".  And so to get the
-         correct text bias it is necessary (determined empirically) to
-         add on the file offset for the text section.  I guess this
-         means that (1) it is assumed the text section is always the
-         first in the file, and (2) in this case the stated text VMA
-         is where the start of the file is mapped, not the start of
-         the text section.
-
-         Last verified 24 May 06.
-
-      .so files, and executables.  These have a non-zero stated text 
-         VMA, for example 0x10000150.  They appear to get loaded at some
-         arbitrary address (actual VMA) which is always a whole number 
-         of pages, eg 0x20002000, and in such a way that the offset is 
-         a whole number of pages.  So in this example the offset (bias) 
-         would be 0x20002000 - round_to_page_base(0x10000150).
-   */
-   if (text_svma_known) {
-#if 0
-      if (text_svma == 0) {
-         text_bias = di->text_avma;
-         if (sntext_1based_if_known >= 1 
-             && sntext_1based_if_known <= t_filehdr->f_nscns)
-            text_bias += t_scnhdr[sntext_1based_if_known - 1].s_scnptr;
-      } else {
-         text_bias = di->text_avma - VG_PGROUNDDN(text_svma);
-      }
-#else
-      text_bias = di->text_avma - text_svma;
-      if (sntext_1based_if_known >= 1 
-          && sntext_1based_if_known <= t_filehdr->f_nscns)
-         text_bias += t_scnhdr[sntext_1based_if_known - 1].s_scnptr;
-
-#endif
-      if (SHOW)
-         VG_(printf)("   text section: stated vma 0x%lx, "
-                     "actual vma 0x%lx, bias 0x%lx\n", 
-                     text_svma, di->text_avma, text_bias);
-   } else {
-      text_bias = 0;
-      if (SHOW)
-         VG_(printf)("   text section: svma UNKNOWN, bias UNKNOWN\n");
-   }
-
-   if (data_svma_known) {
-      data_bias = di->data_avma - data_svma;
-      if (SHOW)
-         VG_(printf)("   data section: stated vma 0x%lx, "
-                     "actual vma 0x%lx, bias 0x%lx\n", 
-                     data_svma, di->data_avma, data_bias);
-   } else {
-      data_bias = 0;
-      if (SHOW)
-         VG_(printf)("   data section: svma UNKNOWN, bias UNKNOWN\n");
-   }
-
-   if (toc_svma_known) {
-      toc_avma = toc_svma + data_bias;
-      if (SHOW)
-         VG_(printf)("            toc: stated vma 0x%lx, actual vma 0x%lx\n",
-                     toc_svma, toc_avma);
-   } else {
-      if (SHOW)
-         VG_(printf)("            toc: svma UNKNOWN\n");
-     toc_avma = 0;
-   }
-
-   /* ------------ Section Data ------------ */
-   for (i = 0; i < t_filehdr->f_nscns; i++) {
-      if (SHOW)
-         VG_(printf)("\nSection Data (sec %d, \"%s\")\n", 
-                     i, name_of_scnhdr_s_flags(t_scnhdr[i].s_flags) );
-      switch (t_scnhdr[i].s_flags & 0xFFFF) {
-         case STYP_LOADER:
-            show_loader_section( di, oimage + t_scnhdr[i].s_scnptr, 
-                                 t_scnhdr[i].s_size );
-            break;
-         default:
-            if (SHOW)
-               VG_(printf)("   Not handled yet\n");
-            break;
-      }
-   }
-
-   /* ------------ establish String Table ------------ */
-   /* This is after the symbol table, if it exists at all. */
-   /* This is a bit of a hack.  The easy way to find the string table
-      is assume it immediately follows the symbol table.  That doesn't
-      work if there is no symbol table; but on the other hand if there
-      is no symbol table then there isn't much point in carrying on.
-      Hence, if there is no symbol table we just give up here and
-      claim to have successfully loaded zero symbols. */
-   if (t_filehdr->f_nsyms == 0) {
-      if (SHOW)
-         VG_(printf)("Object contains no symbols.  Stopping here.\n");
-      return True;
-   }
-
-   cursor = oimage;
-   cursor += t_filehdr->f_symptr; /* symtab start */
-   cursor += SYMESZ * t_filehdr->f_nsyms; /* strtab start */
-   /* Does this fall inside the file image?  The first 4 bytes is the
-      string table size, so we need to be able to see at least
-      them. */
-   UChar* oi_strtab   = NULL;
-   UWord  oi_n_strtab = 0;
-   if (cursor + 4 <= oimage_after) {
-      oi_strtab = cursor;
-      oi_n_strtab = (UWord)( *(UInt*)oi_strtab );
-      if (0) {
-         VG_(printf)("oimage       %p\n", oimage);
-         VG_(printf)("oimage_after %p\n", oimage_after);
-         VG_(printf)("cursor       %p\n", cursor);
-      }
-      if (oi_strtab + oi_n_strtab > oimage_after)
-         BAD("readxcoff.c: string table exceeds image end");
-   }
-
-   /* ------------ Symbol Table ------------ */
-   if (SHOW)
-      VG_(printf)("\nSymbol Table: %llu entries\n", (ULong)t_filehdr->f_nsyms);
-   cursor = oimage;
-   cursor += t_filehdr->f_symptr;
-   HChar* badness = read_symbol_table( 
-                       di,
-                       cursor, t_filehdr->f_nsyms, 
-                       oi_strtab, oi_n_strtab,
-                       oi_debug, oi_n_debug,
-                       oi_lnos,  oi_nent_lnos,
-                       sntext_1based_if_known, sndata_1based_if_known,
-                       data_alen_from_auxhdr,
-                       toc_avma,
-                       text_bias, data_bias 
-                    );
-   if (badness)
-      BAD(badness);
-   /* cursor not used after this point */
-
-   /* ------------ String Table ------------ */
-   if (oi_strtab) {
-      if (SHOW)
-         VG_(printf)("\nString Table: %lu bytes\n", oi_n_strtab);
-      i = 4;
-      while (1) {
-         if (i >= oi_n_strtab)
-            break;
-         if (SHOW && SHOW_STRTAB)
-            VG_(printf)("  %5d  ", i);
-         while (i < oi_n_strtab && oi_strtab[i]) {
-            if (SHOW && SHOW_STRTAB)
-               VG_(printf)("%c", sanitiseChar(oi_strtab[i]));
-            i++;
-         }
-         i++;
-         if (SHOW && SHOW_STRTAB)
-            VG_(printf)("\n");
-      }
-   }
-
-   if (SHOW)
-      VG_(printf)("\n");
-   return True;
-
-#undef BAD
-}
-
-
-static ULong ascii_to_ULong ( void* vbuf, Int nbuf )
-{
-   Int    i;
-   UChar  c;
-   UChar* buf = (UChar*)vbuf;
-   ULong  n = 0;
-   for (i = 0; i < nbuf; i++) {
-      c = buf[i];
-      if (c >= '0' && c <= '9')
-         n = 10ULL * n + (ULong)(c - '0');
-   }
-   return n;
-}
-
-
-/* Returns True on success, False if any kind of problem. */
-static
-Bool read_xcoff_o_or_a ( /*MOD*/struct _DebugInfo* di,
-                         HChar* a_name, HChar* o_name )
-{
-   UChar* image   = NULL;
-   Word   n_image = 0;
-   Bool   ok;
-   Int    i;
-   SysRes sr, fd;
-
-   struct vg_stat stat_buf;
-
-   vg_assert(o_name);
-
-   if (a_name == NULL) {
-      /* This is just a plain XCOFF object file. */
-
-      sr = VG_(stat)( o_name, &stat_buf );
-      if (sr.isError) {
-         ML_(symerr)(di, True, "can't stat XCOFF object file");
-         return False;
-      }
-
-      n_image = stat_buf.st_size;
-      if (SHOW && SHOW_AR_DETAILS)
-         VG_(printf)("XCOFF object file size %ld\n", n_image);
-      if (n_image <= 0) {
-         ML_(symerr)(di, True, "implausible XCOFF object file size");
-         return False;
-      }
-
-      fd = VG_(open)( o_name, VKI_O_RDONLY, 0 );
-      if (fd.isError) {
-         ML_(symerr)(di, True, "can't open XCOFF object file");
-         return False;
-      }
-
-      sr = VG_(am_mmap_file_float_valgrind)(n_image, VKI_PROT_READ, 
-                                                     fd.res, 0);
-      VG_(close)(fd.res);
-
-      if (sr.isError) {
-         ML_(symerr)(di, True, "can't mmap XCOFF object file");
-         return False;
-      }
-
-      image = (UChar*)sr.res;
-      ok = read_xcoff_mapped_object( di, image, n_image );
-      VG_(am_munmap_valgrind)( (Addr)image, n_image);
-
-      /* assert OK */
-      return ok;
-
-   } else {
-
-      /* It's an XCOFF .a file ("ar file format, large").  Map the
-         whole thing in, find the member specified by O_NAME, and read
-         symbols from that. */
-
-      sr = VG_(stat)( a_name, &stat_buf );
-      if (sr.isError) {
-         ML_(symerr)(di, True, "can't stat XCOFF archive file");
-         return False;
-      }
-
-      n_image = stat_buf.st_size;
-      if (SHOW && SHOW_AR_DETAILS)
-         VG_(printf)("XCOFF archive file size %ld\n", n_image);
-      if (n_image <= 0) {
-         ML_(symerr)(di, True, "implausible XCOFF archive file size");
-         return False;
-      }
-
-      fd = VG_(open)( a_name, VKI_O_RDONLY, 0 );
-      if (fd.isError) {
-         ML_(symerr)(di, True, "can't open XCOFF archive file");
-         return False;
-      }
-
-      sr = VG_(am_mmap_file_float_valgrind)(n_image, VKI_PROT_READ,
-                                                     fd.res, 0);
-      VG_(close)(fd.res);
-
-      if (sr.isError) {
-         ML_(symerr)(di, True, "can't mmap XCOFF archive file");
-         return False;
-      }
-
-      image = (UChar*)sr.res;
-      ok = False;
-
-      /* Right.  Let's go looking for the requested object.  First, 
-         peer at the archive's fixed header. */
-
-      if (n_image < sizeof(FL_HDR)) {
-         ML_(symerr)(di, True, "XCOFF archive too small for fixed header");
-         goto done;
-      }
-
-      FL_HDR* fl_hdr = (FL_HDR*)image;
-      if (SHOW && SHOW_AR_DETAILS) {
-         VG_(printf)("magic:  %s\n", fl_hdr->fl_magic);
-         VG_(printf)("memoff: %s\n", fl_hdr->fl_memoff);
-         VG_(printf)("gstoff: %s\n", fl_hdr->fl_gstoff);
-         VG_(printf)("gst64off: %s\n", fl_hdr->fl_gst64off);
-      }
-
-      { UChar* s = (UChar*)&fl_hdr->fl_magic;
-        if (s[0] == '<' && s[1] == 'b' && s[2] == 'i' 
-            && s[3] == 'g' && s[4] == 'a' && s[5] == 'f' 
-            && s[6] == '>' && s[7] == '\n') {
-           /* ok */
-        } else {
-           ML_(symerr)(di, True, 
-                       "Is not XCOFF 'big'-variant .a format archive");
-           goto done;
-        }
-      }
-
-      /* Get a pointer to the member table entry. */
-      UChar* mtabC = image + ascii_to_ULong(&fl_hdr->fl_memoff, 
-                                            sizeof(fl_hdr->fl_memoff));
-      AR_HDR* mt_hdr = (AR_HDR*)mtabC;
-
-      if (mtabC < image || mtabC + sizeof(AR_HDR) > image + n_image) {
-         ML_(symerr)(di, True, 
-                     "XCOFF archive member table header exceeds image");
-         goto done;
-      }
-
-      /* should be: backquote newline */
-      if (mt_hdr->_ar_name.ar_name[0] != 0x60 /* backquote */
-          || mt_hdr->_ar_name.ar_name[1] != 0x0A /* \n */) {
-         ML_(symerr)(di, True, 
-                     "XCOFF archive member table header is invalid");
-         goto done;
-      }
-
-      if (SHOW) {
-         VG_(printf)("member table ar_size = %lld\n", 
-                     ascii_to_ULong(&mt_hdr->ar_size,20));
-         VG_(printf)("member table ar_namlen = %lld\n", 
-                     ascii_to_ULong(&mt_hdr->ar_namlen,4));
-      }
-
-      if (mtabC < image 
-          || mtabC + sizeof(AR_HDR) 
-                   + ascii_to_ULong(&mt_hdr->ar_size, 20) 
-             > image + n_image) {
-         ML_(symerr)(di, True, "XCOFF archive member table exceeds image");
-         goto done;
-      }
-
-      UChar* data = mtabC + sizeof(AR_HDR) 
-                          + ascii_to_ULong(&mt_hdr->ar_namlen,4);
-      /* ALIGN */
-      if ( ((UWord)data) & 1 ) data++;
-      if (SHOW)
-         VG_(printf)("member table data = %p\n", data);
-
-      UInt nmembers = ascii_to_ULong(data, 20);
-      if (SHOW)
-          VG_(printf)("member table contains %d entries\n", nmembers);
-      for (i = 0; i < nmembers; i++) {
-         if (SHOW && SHOW_AR_DETAILS)
-            VG_(printf)("   %d has off %d\n", 
-                        i, (Int)ascii_to_ULong(data + 20 + 20*i, 20));
-      }
-
-      UChar* p = data + 20 + 20*nmembers;
-
-      for (i = 0; i < nmembers; i++) {
-
-         if (0 != VG_(strcmp)(p, o_name))
-            goto move_on;
-
-         UInt objoff = ascii_to_ULong(data + 20 + 20*i, 20);
-
-         if (SHOW && SHOW_AR_DETAILS)
-            VG_(printf)("got offset = %u\n", objoff);
-
-         vg_assert(ok == False);
-
-         /* Sanity check the selected member */
-         UChar* o_hdrC = image + objoff;
-         if (o_hdrC + sizeof(AR_HDR) >= image + n_image) {
-            ML_(symerr)(di, True, 
-                        "XCOFF archive member header exceeds image");
-            goto done;
-         }
-         AR_HDR* o_hdr  = (AR_HDR*)o_hdrC;
-         UWord   o_size = (UWord)ascii_to_ULong(&o_hdr->ar_size, 20);
-         UChar*  o_data = o_hdrC + sizeof(AR_HDR)
-                                 + (UWord)ascii_to_ULong(&o_hdr->ar_namlen,4);
-
-         /* ALIGN */
-         if ( ((UWord)o_data) & 1 ) o_data++;
-
-         if (SHOW)
-            VG_(printf)("member data = %p, size = %ld\n", o_data, o_size);
-
-         if (!(o_data >= image && o_data + o_size <= image + n_image)) {
-            ML_(symerr)(di, True, 
-                        "XCOFF archive member exceeds image");
-            goto done;
-         }
-
-         if (o_size < sizeof(FILHDR)) {
-            ML_(symerr)(di, True, 
-                        "XCOFF object file header is implausibly small (1)");
-	    goto done;
-	 }
-
-         /* It's the right name, but need to also check the magic
-            number, since some archives contain both a 32-bit and
-            64-bit version of the same object. */
-         FILHDR* t_filhdr = (FILHDR*)o_data;
-#        if defined(VGP_ppc32_aix5)
-         if (t_filhdr->f_magic == 0x01F7 /* XCOFF64 */) {
-            if (0)
-               VG_(printf)("Skipping 64-bit archive on 32-bit platform\n");
-            goto move_on;
-         }
-#        elif defined(VGP_ppc64_aix5)
-         if (t_filhdr->f_magic == 0x01DF /* XCOFF32 */) {
-            if (0)
-               VG_(printf)("Skipping 32-bit archive on 64-bit platform\n");
-            goto move_on;
-         }
-#        endif
-
-         if (SHOW && SHOW_AR_DETAILS)
-            VG_(printf)("\nimage: %p-%p   object: %p-%p\n\n", 
-                        image, image+n_image-1, o_data, o_data+o_size-1);
-         ok = read_xcoff_mapped_object( di, o_data, o_size );
-         goto done;
-
-         vg_assert(0);
-	 /* NOTREACHED */
-
-        move_on:
-         while (*p) {
-            if (SHOW && SHOW_AR_DETAILS)
-               VG_(printf)("%c", *p);
-            p++;
-         }
-         if (SHOW && SHOW_AR_DETAILS)
-            VG_(printf)("\n");
-         p++;
-      }
-
-      vg_assert(i == nmembers);
-      ML_(symerr)(di, True, "can't find object in XCOFF archive file");
-
-     done:
-      if (image) {
-         VG_(am_munmap_valgrind)( (Addr)image, n_image );
-         /* assert munmap succeeded */
-      }
-      return ok;
-
-   }
-}
-
-
-/* Main entry point for XCOFF reading.  The following di fields must
-   be filled in by the caller:
-
-     filename
-     memname (optional)
-     text_avma, text_size
-     data_avma, data_size
-
-   and all other fields should be zeroed.
-*/
-Bool ML_(read_xcoff_debug_info) ( struct _DebugInfo* di,
-                                  Bool is_mainexe )
-{
-   Bool ok;
-
-   if (VG_(clo_verbosity) > 1 || VG_(clo_trace_redir)) {
-      if (di->memname) {
-         VG_(message)(Vg_DebugMsg, "Reading syms from %s(%s) (%#lx)\n",
-                      di->filename, di->memname, di->text_avma);
-      } else {
-         VG_(message)(Vg_DebugMsg, "Reading syms from %s (%#lx)\n",
-                      di->filename, di->text_avma);
-      }
-   }
-
-   if (SHOW) {
-      VG_(printf)("------------------- BEGIN read xcoff ------------------\n");
-      VG_(printf)("---         file: %s\n",  di->filename);
-      VG_(printf)("---          mem: %s\n",  di->memname ? di->memname  
-                                                         : (UChar*)"(none)" );
-      VG_(printf)("--- t actual vma: %#lx\n", di->text_avma);
-      VG_(printf)("--- t actual len: %ld\n",  di->text_size);
-      VG_(printf)("--- d actual vma: %#lx\n", di->data_avma);
-      VG_(printf)("--- d actual len: %ld\n",  di->data_size);
-   }
-
-   if (di->memname) {
-      /* XCOFF .a file.  di->filename is its name, di->memname is the
-         name of the required .o within it. */
-      ok = read_xcoff_o_or_a( di, di->filename, di->memname );
-   } else {
-      /* no archive member name, so di->filename is an XCOFF object */
-      ok = read_xcoff_o_or_a( di, NULL, di->filename );
-   }
-
-   di->soname = NULL;
-   if (ok) {
-      if (is_mainexe) {
-         di->soname = "NONE";
-      } else {
-         UChar* p = VG_(strrchr)(di->filename, '/');
-         p = p  ? p+1  : di->filename;
-         /* p points at the main filename */
-         if (di->memname) {
-            /* set the soname to "archive.a(member.o)" */
-            Int nbytes = VG_(strlen)(p) + 1 + VG_(strlen)(di->memname) + 1 + 1;
-            UChar* so = ML_(dinfo_zalloc)("di.readxcoff.rxdi.1", nbytes);
-            vg_assert(so);
-            VG_(sprintf)(so, "%s(%s)", p, di->memname);
-            vg_assert(VG_(strlen)(so) == nbytes-1);
-            di->soname = so;
-         } else {
-            /* no member name, hence soname = "archive.a" */
-            di->soname = ML_(dinfo_strdup)("di.readxcoff.rxdi.2", p);
-         }
-      }
-      if (SHOW)
-         VG_(printf)("Setting soname to %s\n", di->soname);
-   }
-
-   if (SHOW)
-      VG_(printf)("------------------- END read xcoff ------------------\n\n");
-
-   return ok;
-}
-
-#endif // defined(VGO_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c
index eda421b..6dcd9e0 100644
--- a/coregrind/m_debuginfo/storage.c
+++ b/coregrind/m_debuginfo/storage.c
@@ -1134,7 +1134,7 @@
    vlena = VG_(strlen)(a->name);
    vlenb = VG_(strlen)(b->name);
 
-#if defined(VGO_linux) || defined(VGO_aix5)
+#if defined(VGO_linux)
 #  define VERSION_CHAR '@'
 #elif defined(VGO_darwin)
 #  define VERSION_CHAR '$'
diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c
index 06322cb..ccd2ad9 100644
--- a/coregrind/m_debuglog.c
+++ b/coregrind/m_debuglog.c
@@ -268,172 +268,6 @@
    return __res;
 }
 
-#elif defined(VGP_ppc32_aix5)
-
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
-{
-   /* For some reason gcc-3.3.2 doesn't preserve r31 across the asm
-      even though we state it to be trashed.  So use r27 instead. */
-   volatile UInt block[3];
-   block[0] = (UInt)buf;
-   block[1] = n;
-   block[2] = __NR_write;
-   __asm__ __volatile__ (
-      "mr    28,%0\n\t"      /* establish base ptr */
-      "mr    27,2\n\t"       /* save r2 in r27 */
-      "mflr  30\n\t"         /* save lr in r30 */
-
-      "lwz 2,8(28)\n\t"      /* set %r2 = __NR_write */
-      "li  3,2\n\t"          /* set %r3 = stderr */
-      "lwz 4,0(28)\n\t"      /* set %r4 = buf */
-      "lwz 5,4(28)\n\t"      /* set %r5 = n */
-
-      "crorc 6,6,6\n\t"
-      ".long 0x48000005\n\t" /* bl .+4 */
-      "mflr  29\n\t"
-      "addi  29,29,16\n\t"
-      "mtlr  29\n\t"
-      "sc\n\t"               /* write() */
-
-      "stw 3,0(28)\n\t"      /* result */
-      "stw 4,4(28)\n\t"      /* error? */
-
-      "mr   2,27\n\t"        /* restore r2 */
-      "mtlr 30"              /* restore lr */
-
-      : /*out*/
-      : /*in*/  "b" (&block[0])
-      : /*trash*/
-           /*temps*/    "r31","r30","r29","r28","r27",
-           /*args*/     "r3","r4","r5","r6","r7","r8","r9","r10",
-           /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
-                        "xer","ctr","cr0","cr1","cr2","cr3",
-                        "cr4","cr5","cr6","cr7"
-   );
-   if (block[1] != 0)
-      return -1;
-   else
-      return block[0];
-}
-
-static UInt local_sys_getpid ( void )
-{
-   /* For some reason gcc-3.3.2 doesn't preserve r31 across the asm
-      even though we state it to be trashed.  So use r27 instead. */
-   volatile UInt block[1];
-   block[0] = __NR_getpid;
-   __asm__ __volatile__ (
-      "mr    28,%0\n\t"      /* establish base ptr */
-      "mr    27,2\n\t"       /* save r2 in r27 */
-      "mflr  30\n\t"         /* save lr in r30 */
-
-      "lwz   2,0(28)\n\t"    /* set %r2 = __NR_getpid */
-
-      "crorc 6,6,6\n\t"
-      ".long 0x48000005\n\t" /* bl .+4 */
-      "mflr  29\n\t"
-      "addi  29,29,16\n\t"
-      "mtlr  29\n\t"
-      "sc\n\t"               /* getpid() */
-
-      "stw   3,0(28)\n\t"    /* result -> block[0] */
-
-      "mr   2,27\n\t"        /* restore r2 */
-      "mtlr 30"              /* restore lr */
-
-      : /*out*/
-      : /*in*/  "b" (&block[0])
-      : /*trash*/
-           /*temps*/    "r31","r30","r29","r28","r27",
-           /*args*/     "r3","r4","r5","r6","r7","r8","r9","r10",
-           /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
-                        "xer","ctr","cr0","cr1","cr2","cr3",
-                        "cr4","cr5","cr6","cr7"
-   );
-   return block[0];
-}
-
-#elif defined(VGP_ppc64_aix5)
-
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
-{
-   volatile ULong block[3];
-   block[0] = (ULong)buf;
-   block[1] = n;
-   block[2] = (ULong)__NR_write;
-   __asm__ __volatile__ (
-      "mr    28,%0\n\t"      /* establish base ptr */
-      "mr    27,2\n\t"       /* save r2 in r27 */
-      "mflr  30\n\t"         /* save lr in r30 */
-
-      "ld  2,16(28)\n\t"     /* set %r2 = __NR_write */
-      "li  3,2\n\t"          /* set %r3 = stderr */
-      "ld  4,0(28)\n\t"      /* set %r4 = buf */
-      "ld  5,8(28)\n\t"      /* set %r5 = n */
-
-      "crorc 6,6,6\n\t"
-      ".long 0x48000005\n\t" /* bl .+4 */
-      "mflr  29\n\t"
-      "addi  29,29,16\n\t"
-      "mtlr  29\n\t"
-      "sc\n\t"               /* write() */
-
-      "std 3,0(28)\n\t"      /* result */
-      "std 4,8(28)\n\t"      /* error? */
-
-      "mr   2,27\n\t"        /* restore r2 */
-      "mtlr 30"              /* restore lr */
-
-      : /*out*/
-      : /*in*/  "b" (&block[0])
-      : /*trash*/
-           /*temps*/    "r31","r30","r29","r28","r27",
-           /*args*/     "r3","r4","r5","r6","r7","r8","r9","r10",
-           /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
-                        "xer","ctr","cr0","cr1","cr2","cr3",
-                        "cr4","cr5","cr6","cr7"
-   );
-   if (block[1] != 0)
-      return (UInt)-1;
-   else
-      return (UInt)block[0];
-}
-
-static UInt local_sys_getpid ( void )
-{
-   volatile ULong block[1];
-   block[0] = __NR_getpid;
-   __asm__ __volatile__ (
-      "mr    28,%0\n\t"      /* establish base ptr */
-      "mr    27,2\n\t"       /* save r2 in r27 */
-      "mflr  30\n\t"         /* save lr in r30 */
-
-      "ld    2,0(28)\n\t"    /* set %r2 = __NR_getpid */
-
-      "crorc 6,6,6\n\t"
-      ".long 0x48000005\n\t" /* bl .+4 */
-      "mflr  29\n\t"
-      "addi  29,29,16\n\t"
-      "mtlr  29\n\t"
-      "sc\n\t"               /* getpid() */
-
-      "std  3,0(28)\n\t"     /* result -> block[0] */
-
-      "mr   2,27\n\t"        /* restore r2 */
-      "mtlr 30"              /* restore lr */
-
-      : /*out*/
-      : /*in*/  "b" (&block[0])
-      : /*trash*/
-           /*temps*/    "r31","r30","r29","r28","r27",
-           /*args*/     "r3","r4","r5","r6","r7","r8","r9","r10",
-           /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
-                        "xer","ctr","cr0","cr1","cr2","cr3",
-                        "cr4","cr5","cr6","cr7"
-   );
-   return (UInt)block[0];
-}
-
 #elif defined(VGP_x86_darwin)
 
 /* We would use VG_DARWIN_SYSNO_TO_KERNEL instead of VG_DARWIN_SYSNO_INDEX
diff --git a/coregrind/m_dispatch/dispatch-ppc32-aix5.S b/coregrind/m_dispatch/dispatch-ppc32-aix5.S
deleted file mode 100644
index fbe6690..0000000
--- a/coregrind/m_dispatch/dispatch-ppc32-aix5.S
+++ /dev/null
@@ -1,681 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- The core dispatch loop, for jumping to a code address.       ---*/
-/*---                                        dispatch-ppc32-aix5.S ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-  This file is part of Valgrind, a dynamic binary instrumentation
-  framework.
-
-  Copyright (C) 2006-2010 OpenWorks LLP
-     info@open-works.co.uk
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU General Public License as
-  published by the Free Software Foundation; either version 2 of the
-  License, or (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-  02111-1307, USA.
-
-  The GNU General Public License is contained in the file COPYING.
-
-  Neither the names of the U.S. Department of Energy nor the
-  University of California nor the names of its contributors may be
-  used to endorse or promote products derived from this software
-  without prior written permission.
-*/
-
-#if defined(VGP_ppc32_aix5)
-
-#include "pub_core_basics_asm.h"
-#include "pub_core_dispatch_asm.h"
-#include "pub_core_transtab_asm.h"
-#include "libvex_guest_offsets.h"	/* for OFFSET_ppc32_CIA */
-
-
-/*------------------------------------------------------------*/
-/*---                                                      ---*/
-/*--- The dispatch loop.  VG_(run_innerloop) is used to    ---*/
-/*--- run all translations except no-redir ones.           ---*/
-/*---                                                      ---*/
-/*------------------------------------------------------------*/
-
-/*----------------------------------------------------*/
-/*--- Incomprehensible TOC mumbo-jumbo nonsense.   ---*/
-/*----------------------------------------------------*/
-
-/* No, I don't have a clue either.  I just compiled a bit of
-   C with gcc and copied the assembly code it produced. */
-
-/* Basically "lwz rd, tocent__foo(2)" gets &foo into rd. */
-
-    .file       "dispatch-ppc32-aix5.S"
-    .machine	"any"
-    .toc
-    .csect .text[PR]
-    .toc
-tocent__vgPlain_dispatch_ctr:
-    .tc vgPlain_dispatch_ctr[TC],vgPlain_dispatch_ctr[RW]
-tocent__vgPlain_machine_ppc32_has_VMX:
-    .tc vgPlain_machine_ppc32_has_VMX[TC],vgPlain_machine_ppc32_has_VMX[RW]
-tocent__vgPlain_machine_ppc32_has_FP:
-    .tc vgPlain_machine_ppc32_has_FP[TC],vgPlain_machine_ppc32_has_FP[RW]
-tocent__vgPlain_tt_fast:
-    .tc vgPlain_tt_fast[TC],vgPlain_tt_fast[RW]
-tocent__vgPlain_tt_fastN:
-    .tc vgPlain_tt_fast[TC],vgPlain_tt_fastN[RW]
-    .csect .text[PR]
-    .align 2
-    .globl vgPlain_run_innerloop
-    .globl .vgPlain_run_innerloop
-    .csect vgPlain_run_innerloop[DS]
-vgPlain_run_innerloop:
-    .long .vgPlain_run_innerloop, TOC[tc0], 0
-    .csect .text[PR]
-
-/*----------------------------------------------------*/
-/*--- Preamble (set everything up)                 ---*/
-/*----------------------------------------------------*/
-
-/* signature:
-UWord VG_(run_innerloop) ( void* guest_state, UWord do_profiling );
-*/
-.vgPlain_run_innerloop:
-	/* r3 holds guest_state */
-	/* r4 holds do_profiling */
-	/* Rather than attempt to make sense of the AIX ABI, just
-           drop r1 by 256 (to get away from the caller's frame), then
-	   512 (to give ourselves a 512-byte save area), and then
-	   another 256 (to clear our save area).  In all, drop r1 by 1024
-	   and dump stuff on the stack at 256(1)..768(1).  */
-
-        /* ----- entry point to VG_(run_innerloop) ----- */
-        /* For AIX/ppc32 we do:	 LR-> +8(parent_sp), CR-> +4(parent_sp) */
-
-        /* Save lr and cr*/
-        mflr    0
-        stw     0,8(1)
-	mfcr	0
-	stw	0,4(1)
-
-        /* New stack frame */
-        stwu    1,-1024(1)  /* sp should maintain 16-byte alignment */
-
-        /* Save callee-saved registers... */
-	/* r3, r4 are live here, so use r5 */
-        lwz     5,tocent__vgPlain_machine_ppc32_has_FP(2)
-        lwz     5,0(5)
-        cmplwi  5,0
-        beq     LafterFP1
-
-        /* Floating-point reg save area : 144 bytes at r1[256..399] */
-        stfd    31,392(1)
-        stfd    30,384(1)
-        stfd    29,376(1)
-        stfd    28,368(1)
-        stfd    27,360(1)
-        stfd    26,352(1)
-        stfd    25,344(1)
-        stfd    24,336(1)
-        stfd    23,328(1)
-        stfd    22,320(1)
-        stfd    21,312(1)
-        stfd    20,304(1)
-        stfd    19,296(1)
-        stfd    18,288(1)
-        stfd    17,280(1)
-        stfd    16,272(1)
-        stfd    15,264(1)
-        stfd    14,256(1)
-LafterFP1:
-
-        /* General reg save area : 76 bytes at r1[400 .. 475] */
-        stw     31,472(1)
-        stw     30,468(1)
-        stw     29,464(1)
-        stw     28,460(1)
-        stw     27,456(1)
-        stw     26,452(1)
-        stw     25,448(1)
-        stw     24,444(1)
-        stw     23,440(1)
-        stw     22,436(1)
-        stw     21,432(1)
-        stw     20,428(1)
-        stw     19,424(1)
-        stw     18,420(1)
-        stw     17,416(1)
-        stw     16,412(1)
-        stw     15,408(1)
-        stw     14,404(1)
-        /* Probably not necessary to save r13 (thread-specific ptr),
-           as VEX stays clear of it... but what the hell. */
-        stw     13,400(1)
-
-        /* It's necessary to save/restore VRSAVE in the AIX / Darwin ABI.
-           The Linux kernel might not actually use VRSAVE for its intended
-           purpose, but it should be harmless to preserve anyway. */
-	/* r3, r4 are live here, so use r5 */
-        lwz     5,tocent__vgPlain_machine_ppc32_has_VMX(2)
-        lwz     5,0(5)
-        cmplwi  5,0
-        beq     LafterVMX1
-
-//	Sigh.  AIX 5.2 has no idea that Altivec exists.
-//        /* VRSAVE save word : 4 bytes at r1[476 .. 479] */
-//        mfspr   5,256        /* vrsave reg is spr number 256 */
-//        stw     5,476(1)
-//
-//        /* Vector reg save area (quadword aligned): 
-//	   192 bytes at r1[480 .. 671] */
-//        li      5,656
-//        stvx    31,5,1
-//        li      5,640
-//        stvx    30,5,1
-//        li      5,624
-//        stvx    29,5,1
-//        li      5,608
-//        stvx    28,5,1
-//        li      5,592
-//        stvx    27,5,1
-//        li      5,576
-//        stvx    26,5,1
-//        li      5,560
-//        stvx    25,5,1
-//        li      5,544
-//        stvx    25,5,1
-//        li      5,528
-//        stvx    23,5,1
-//        li      5,512
-//        stvx    22,5,1
-//        li      5,496
-//        stvx    21,5,1
-//        li      5,480
-//        stvx    20,5,1
-LafterVMX1:
-
-        /* Local variable space... */
-	/* Put the original guest state pointer at r1[128].  We
-           will need to refer to it each time round the dispatch loop.
-	   Apart from that, we can use r1[0 .. 128] and r1[132 .. 255]
-	   as scratch space. */
-
-        /* r3 holds guest_state */
-        /* r4 holds do_profiling */
-        mr      31,3      /* r31 (generated code gsp) = r3 */
-        stw     3,128(1)  /* stash orig guest_state ptr */
-
-        /* hold dispatch_ctr in r29 */
-        lwz     5,tocent__vgPlain_dispatch_ctr(2)
-        lwz     29,0(5)
-
-        /* set host FPU control word to the default mode expected 
-           by VEX-generated code.  See comments in libvex.h for
-           more info. */
-        lwz     5,tocent__vgPlain_machine_ppc32_has_FP(2)
-        lwz     5,0(5)
-        cmplwi  5,0
-        beq     LafterFP2
-
-        /* get zero into f3 (tedious) */
-        /* note: fsub 3,3,3 is not a reliable way to do this, 
-           since if f3 holds a NaN or similar then we don't necessarily
-           wind up with zero. */
-        li      5,0
-        stw     5,64(1)	/* r1[64] is scratch */
-        lfs     3,64(1)
-        mtfsf   0xFF,3   /* fpscr = f3 */
-LafterFP2:
-
-        /* set host AltiVec control word to the default mode expected 
-           by VEX-generated code. */
-        lwz     5,tocent__vgPlain_machine_ppc32_has_VMX(2)
-        lwz     5,0(5)
-        cmplwi  5,0
-        beq     LafterVMX2
-
-//	Sigh.  AIX 5.2 has no idea that Altivec exists.
-//        vspltisw 3,0x0  /* generate zero */
-//        mtvscr  3
-LafterVMX2:
-
-        /* fetch %CIA into r3 */
-        lwz     3,OFFSET_ppc32_CIA(31)
-
-        /* fall into main loop (the right one) */
-	/* r4 = do_profiling.  It's probably trashed after here,
-           but that's OK: we don't need it after here. */
-	cmplwi	4,0
-	beq	VG_(run_innerloop__dispatch_unprofiled)
-	b	VG_(run_innerloop__dispatch_profiled)
-	/*NOTREACHED*/
-
-/*----------------------------------------------------*/
-/*--- NO-PROFILING (standard) dispatcher           ---*/
-/*----------------------------------------------------*/
-
-.globl VG_(run_innerloop__dispatch_unprofiled)
-VG_(run_innerloop__dispatch_unprofiled):
-	/* At entry: Live regs:
-		r1  (=sp)
-		r3  (=CIA = next guest address)
-		r29 (=dispatch_ctr)
-		r31 (=guest_state)
-	   Stack state:
-		128(r1) (=orig guest_state)
-	*/
-
-	/* Has the guest state pointer been messed with?  If yes, exit.
-	   Also set up & VG_(tt_fast) early in an attempt at better
-           scheduling. */
-        lwz     5,128(1)         /* original guest_state ptr */
-        cmpw    5,31
-	lwz	5,tocent__vgPlain_tt_fast(2)	/* r5 = &tt_fast */
-        bne	gsp_changed
-
-        /* save the jump address in the guest state */
-        stw     3,OFFSET_ppc32_CIA(31)
-
-        /* Are we out of timeslice?  If yes, defer to scheduler. */
-	addi	29,29,-1
-	cmplwi	29,0
-        beq	counter_is_zero
-
-        /* try a fast lookup in the translation cache */
-        /* r4 = VG_TT_FAST_HASH(addr)           * sizeof(FastCacheEntry)
-              = ((r3 >>u 2) & VG_TT_FAST_MASK)  << 3 */
-        rlwinm  4,3,1, 29-VG_TT_FAST_BITS, 28   /* entry# * 8 */
-	add     5,5,4	 /* & VG_(tt_fast)[entry#] */
-	lwz     6,0(5)   /* .guest */
-	lwz     7,4(5)   /* .host */
-        cmpw    3,6
-        bne     fast_lookup_failed
-
-        /* Found a match.  Call .host. */
-        mtctr   7
-        bctrl
-
-        /* On return from guest code:
-	   r3  holds destination (original) address.
-           r31 may be unchanged (guest_state), or may indicate further
-           details of the control transfer requested to *r3.
-        */
-	/* start over */
-	b	VG_(run_innerloop__dispatch_unprofiled)
-	/*NOTREACHED*/
-
-/*----------------------------------------------------*/
-/*--- PROFILING dispatcher (can be much slower)    ---*/
-/*----------------------------------------------------*/
-
-.globl VG_(run_innerloop__dispatch_profiled)
-VG_(run_innerloop__dispatch_profiled):
-	/* At entry: Live regs:
-		r1  (=sp)
-		r3  (=CIA = next guest address)
-		r29 (=dispatch_ctr)
-		r31 (=guest_state)
-	   Stack state:
-		128(r1) (=orig guest_state)
-	*/
-	/* Has the guest state pointer been messed with?  If yes, exit.
-	   Also set up & VG_(tt_fast) early in an attempt at better
-           scheduling. */
-        lwz     5,128(1)         /* original guest_state ptr */
-        cmpw    5,31
-	lwz	5,tocent__vgPlain_tt_fast(2)	/* r5 = &tt_fast */
-        bne	gsp_changed
-
-        /* save the jump address in the guest state */
-        stw     3,OFFSET_ppc32_CIA(31)
-
-        /* Are we out of timeslice?  If yes, defer to scheduler. */
-	addi	29,29,-1
-	cmplwi	29,0
-        beq	counter_is_zero
-
-        /* try a fast lookup in the translation cache */
-        /* r4 = VG_TT_FAST_HASH(addr)           * sizeof(FastCacheEntry)
-              = ((r3 >>u 2) & VG_TT_FAST_MASK)  << 3 */
-        rlwinm  4,3,1, 29-VG_TT_FAST_BITS, 28   /* entry# * 8 */
-	add     5,5,4	 /* & VG_(tt_fast)[entry#] */
-	lwz     6,0(5)   /* .guest */
-	lwz     7,4(5)   /* .host */
-        cmpw    3,6
-        bne     fast_lookup_failed
-
-        /* increment bb profile counter */
-	srwi	4,4,1   /* entry# * sizeof(UInt*) */
-	lwz	9,tocent__vgPlain_tt_fastN(2)   /* r9 = &tt_fastN */
-        lwzx    8,9,4   /* r7 = tt_fastN[r4] */
-        lwz     10,0(8)
-        addi    10,10,1
-        stw     10,0(8)
-	
-        /* Found a match.  Call .host. */
-        mtctr   7
-        bctrl
-
-        /* On return from guest code:
-	   r3  holds destination (original) address.
-           r31 may be unchanged (guest_state), or may indicate further
-           details of the control transfer requested to *r3.
-        */
-	/* start over */
-	b	VG_(run_innerloop__dispatch_unprofiled)
-	/*NOTREACHED*/
-
-
-/*----------------------------------------------------*/
-/*--- exit points                                  ---*/
-/*----------------------------------------------------*/
-
-gsp_changed:
-	/* Someone messed with the gsp (in r31).  Have to
-           defer to scheduler to resolve this.  dispatch ctr
-	   is not yet decremented, so no need to increment. */
-	/* %CIA is NOT up to date here.  First, need to write
-	   %r3 back to %CIA, but without trashing %r31 since
-	   that holds the value we want to return to the scheduler.
-	   Hence use %r5 transiently for the guest state pointer. */
-        lwz     5,128(1)        /* original guest_state ptr */
-        stw     3,OFFSET_ppc32_CIA(5)
-	mr	3,31		/* r3 = new gsp value */
-	b	run_innerloop_exit
-	/*NOTREACHED*/
-
-counter_is_zero:
-	/* %CIA is up to date */
-	/* back out decrement of the dispatch counter */
-        addi    29,29,1
-        li      3,VG_TRC_INNER_COUNTERZERO
-        b       run_innerloop_exit
-
-fast_lookup_failed:
-	/* %CIA is up to date */
-	/* back out decrement of the dispatch counter */
-        addi    29,29,1
-        li      3,VG_TRC_INNER_FASTMISS
-	b       run_innerloop_exit
-
-
-
-/* All exits from the dispatcher go through here.
-   r3 holds the return value. 
-*/
-run_innerloop_exit: 
-        /* We're leaving.  Check that nobody messed with
-           VSCR or FPSCR. */
-
-        /* Using r10 - value used again further on, so don't trash! */
-        lwz     10,tocent__vgPlain_machine_ppc32_has_FP(2)
-        lwz     10,0(10)
-        cmplwi  10,0
-        beq     LafterFP8
-
-	/* Set fpscr back to a known state, since vex-generated code
-	   may have messed with fpscr[rm]. */
-        li      5,0
-        stw     5,64(1)	 /* r1[64] is scratch */
-        lfs     3,64(1)
-        mtfsf   0xFF,3   /* fpscr = f3 */
-LafterFP8:
-
-	/* Using r11 - value used again further on, so don't trash! */
-        lwz     11,tocent__vgPlain_machine_ppc32_has_VMX(2)
-        lwz     11,0(11)
-        cmplwi  11,0
-        beq     LafterVMX8
-
-//	Sigh.  AIX 5.2 has no idea that Altivec exists.
-//        /* Check VSCR[NJ] == 1 */
-//        /* first generate 4x 0x00010000 */
-//        vspltisw  4,0x1                   /* 4x 0x00000001 */
-//        vspltisw  5,0x0                   /* zero */
-//        vsldoi    6,4,5,0x2               /* <<2*8 => 4x 0x00010000 */
-//        /* retrieve VSCR and mask wanted bits */
-//        mfvscr    7
-//        vand      7,7,6                   /* gives NJ flag */
-//        vspltw    7,7,0x3                 /* flags-word to all lanes */
-//        vcmpequw. 8,6,7                   /* CR[24] = 1 if v6 == v7 */
-//        bt        24,invariant_violation  /* branch if all_equal */
-LafterVMX8:
-
-	/* otherwise we're OK */
-        b       run_innerloop_exit_REALLY
-
-
-invariant_violation:
-        li      3,VG_TRC_INVARIANT_FAILED
-        b       run_innerloop_exit_REALLY
-
-run_innerloop_exit_REALLY:
-        /* r3 holds VG_TRC_* value to return */
-
-        /* Write ctr to VG(dispatch_ctr) */
-        lwz     5,tocent__vgPlain_dispatch_ctr(2)
-        stw     29,0(5)
-
-        /* Restore callee-saved registers... */
-
-        /* r10 already holds VG_(machine_ppc32_has_FP) value */
-        cmplwi  10,0
-        beq     LafterFP9
-
-        /* Floating-point regs */
-        lfd     31,392(1)
-        lfd     30,384(1)
-        lfd     29,376(1)
-        lfd     28,368(1)
-        lfd     27,360(1)
-        lfd     26,352(1)
-        lfd     25,344(1)
-        lfd     24,336(1)
-        lfd     23,328(1)
-        lfd     22,320(1)
-        lfd     21,312(1)
-        lfd     20,304(1)
-        lfd     19,296(1)
-        lfd     18,288(1)
-        lfd     17,280(1)
-        lfd     16,272(1)
-        lfd     15,264(1)
-        lfd     14,256(1)
-LafterFP9:
-
-        /* General regs */
-        lwz     31,472(1)
-        lwz     30,468(1)
-        lwz     29,464(1)
-        lwz     28,460(1)
-        lwz     27,456(1)
-        lwz     26,452(1)
-        lwz     25,448(1)
-        lwz     24,444(1)
-        lwz     23,440(1)
-        lwz     22,436(1)
-        lwz     21,432(1)
-        lwz     20,428(1)
-        lwz     19,424(1)
-        lwz     18,420(1)
-        lwz     17,416(1)
-        lwz     16,412(1)
-        lwz     15,408(1)
-        lwz     14,404(1)
-        lwz     13,400(1)
-
-        /* r11 already holds VG_(machine_ppc32_has_VMX) value */
-        cmplwi  11,0
-        beq     LafterVMX9
-
-//       Sigh.  AIX 5.2 has no idea that Altivec exists.
-//        /* VRSAVE */
-//        lwz     4,476(1)
-//        mtspr   4,256         /* VRSAVE reg is spr number 256 */
-//
-//        /* Vector regs */
-//        li      4,656
-//        lvx     31,4,1
-//        li      4,640
-//        lvx     30,4,1
-//        li      4,624
-//        lvx     29,4,1
-//        li      4,608
-//        lvx     28,4,1
-//        li      4,592
-//        lvx     27,4,1
-//        li      4,576
-//        lvx     26,4,1
-//        li      4,560
-//        lvx     25,4,1
-//        li      4,544
-//        lvx     24,4,1
-//        li      4,528
-//        lvx     23,4,1
-//        li      4,512
-//        lvx     22,4,1
-//        li      4,496
-//        lvx     21,4,1
-//        li      4,480
-//        lvx     20,4,1
-LafterVMX9:
-
-	/* r3 is live here; don't trash it */
-        /* restore lr,cr,sp */
-	addi	4,1,1024  /* r4 = old SP */
-	lwz	0,8(4)
-	mtlr	0
-	lwz	0,4(4)
-	mtcr	0
-	mr	1,4
-	blr
-
-LT..vgPlain_run_innerloop:
-    .long 0
-    .byte 0,0,32,64,0,0,2,0
-    .long 0
-    .long LT..vgPlain_run_innerloop-.vgPlain_run_innerloop
-    .short 13
-    .byte "vgPlain_run_innerloop"
-    .align 2
-_section_.text:
-    .csect .data[RW],3
-    .long _section_.text
-
-/*------------------------------------------------------------*/
-/*---                                                      ---*/
-/*--- A special dispatcher, for running no-redir           ---*/
-/*--- translations.  Just runs the given translation once. ---*/
-/*---                                                      ---*/
-/*------------------------------------------------------------*/
-	
-/* signature:
-void VG_(run_a_noredir_translation) ( UWord* argblock );
-*/
-
-/* Run a no-redir translation.  argblock points to 4 UWords, 2 to carry args
-   and 2 to carry results:
-      0: input:  ptr to translation
-      1: input:  ptr to guest state
-      2: output: next guest PC
-      3: output: guest state pointer afterwards (== thread return code)
-*/
-.csect .text[PR]
-.align 2
-.globl  .VG_(run_a_noredir_translation)
-.VG_(run_a_noredir_translation):
-
-	/* Rather than attempt to make sense of the AIX ABI, just
-           drop r1 by 256 (to get away from the caller's frame), then
-	   512 (to give ourselves a 512-byte save area), and then
-	   another 256 (to clear our save area).  In all, drop r1 by 1024
-	   and dump stuff on the stack at 256(1)..768(1).  */
-	/* At entry, r3 points to argblock */
-
-        /* ----- entry point to VG_(run_innerloop) ----- */
-        /* For AIX/ppc32 we do:	 LR-> +8(parent_sp), CR-> +4(parent_sp) */
-
-        /* Save lr and cr*/
-        mflr    0
-        stw     0,8(1)
-	mfcr	0
-	stw	0,4(1)
-
-        /* New stack frame */
-        stwu    1,-1024(1)  /* sp should maintain 16-byte alignment */
-
-        /* General reg save area : 76 bytes at r1[400 .. 475] */
-        stw     31,472(1)
-        stw     30,468(1)
-        stw     29,464(1)
-        stw     28,460(1)
-        stw     27,456(1)
-        stw     26,452(1)
-        stw     25,448(1)
-        stw     24,444(1)
-        stw     23,440(1)
-        stw     22,436(1)
-        stw     21,432(1)
-        stw     20,428(1)
-        stw     19,424(1)
-        stw     18,420(1)
-        stw     17,416(1)
-        stw     16,412(1)
-        stw     15,408(1)
-        stw     14,404(1)
-        stw     13,400(1)
-	stw	3,396(1)	/* will need it later */
-	
-        lwz     31,4(3)		/* rd argblock[1] */
-        lwz     30,0(3)		/* rd argblock[0] */
-        mtlr    30		/* run translation */
-        blrl
-
-        lwz     4,396(1)	/* &argblock */
-        stw     3,  8(4)	/* wr argblock[2] */
-        stw     31,12(4)	/* wr argblock[3] */
-			
-        /* General regs */
-        lwz     31,472(1)
-        lwz     30,468(1)
-        lwz     29,464(1)
-        lwz     28,460(1)
-        lwz     27,456(1)
-        lwz     26,452(1)
-        lwz     25,448(1)
-        lwz     24,444(1)
-        lwz     23,440(1)
-        lwz     22,436(1)
-        lwz     21,432(1)
-        lwz     20,428(1)
-        lwz     19,424(1)
-        lwz     18,420(1)
-        lwz     17,416(1)
-        lwz     16,412(1)
-        lwz     15,408(1)
-        lwz     14,404(1)
-        lwz     13,400(1)
-
-        /* restore lr,cr,sp */
-	addi	4,1,1024  /* r4 = old SP */
-	lwz	0,8(4)
-	mtlr	0
-	lwz	0,4(4)
-	mtcr	0
-	mr	1,4
-	blr
-
-#endif // defined(VGP_ppc32_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_dispatch/dispatch-ppc64-aix5.S b/coregrind/m_dispatch/dispatch-ppc64-aix5.S
deleted file mode 100644
index 7938a16..0000000
--- a/coregrind/m_dispatch/dispatch-ppc64-aix5.S
+++ /dev/null
@@ -1,654 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- The core dispatch loop, for jumping to a code address.       ---*/
-/*---                                        dispatch-ppc64-aix5.S ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-  This file is part of Valgrind, a dynamic binary instrumentation
-  framework.
-
-  Copyright (C) 2006-2010 OpenWorks LLP
-     info@open-works.co.uk
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU General Public License as
-  published by the Free Software Foundation; either version 2 of the
-  License, or (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-  02111-1307, USA.
-
-  The GNU General Public License is contained in the file COPYING.
-
-  Neither the names of the U.S. Department of Energy nor the
-  University of California nor the names of its contributors may be
-  used to endorse or promote products derived from this software
-  without prior written permission.
-*/
-
-#if defined(VGP_ppc64_aix5)
-
-#include "pub_core_basics_asm.h"
-#include "pub_core_dispatch_asm.h"
-#include "pub_core_transtab_asm.h"
-#include "libvex_guest_offsets.h"	/* for OFFSET_ppc64_CIA */
-
-
-/*------------------------------------------------------------*/
-/*---                                                      ---*/
-/*--- The dispatch loop.  VG_(run_innerloop) is used to    ---*/
-/*--- run all translations except no-redir ones.           ---*/
-/*---                                                      ---*/
-/*------------------------------------------------------------*/
-
-/*----------------------------------------------------*/
-/*--- Incomprehensible TOC mumbo-jumbo nonsense.   ---*/
-/*----------------------------------------------------*/
-
-/* No, I don't have a clue either.  I just compiled a bit of
-   C with gcc and copied the assembly code it produced. */
-
-/* Basically "ld rd, tocent__foo(2)" gets &foo into rd. */
-
-    .file       "dispatch-ppc64-aix5.S"
-    .machine	"ppc64"
-    .toc
-    .csect .text[PR]
-    .toc
-tocent__vgPlain_dispatch_ctr:
-    .tc vgPlain_dispatch_ctr[TC],vgPlain_dispatch_ctr[RW]
-tocent__vgPlain_machine_ppc64_has_VMX:
-    .tc vgPlain_machine_ppc64_has_VMX[TC],vgPlain_machine_ppc64_has_VMX[RW]
-tocent__vgPlain_tt_fast:
-    .tc vgPlain_tt_fast[TC],vgPlain_tt_fast[RW]
-tocent__vgPlain_tt_fastN:
-    .tc vgPlain_tt_fast[TC],vgPlain_tt_fastN[RW]
-    .csect .text[PR]
-    .align 2
-    .globl vgPlain_run_innerloop
-    .globl .vgPlain_run_innerloop
-    .csect vgPlain_run_innerloop[DS]
-vgPlain_run_innerloop:
-    .llong .vgPlain_run_innerloop, TOC[tc0], 0
-    .csect .text[PR]
-
-/*----------------------------------------------------*/
-/*--- Preamble (set everything up)                 ---*/
-/*----------------------------------------------------*/
-
-/* signature:
-UWord VG_(run_innerloop) ( void* guest_state, UWord do_profiling );
-*/
-.vgPlain_run_innerloop:
-
-	/* r3 holds guest_state */
-	/* r4 holds do_profiling */
-	/* Rather than attempt to make sense of the AIX ABI, just
-           drop r1 by 512 (to get away from the caller's frame), then
-	   1024 (to give ourselves a 1024-byte save area), and then
-	   another 512 (to clear our save area).  In all, drop r1 by 2048
-	   and dump stuff on the stack at 512(1)..1536(1).  */
-
-        /* ----- entry point to VG_(run_innerloop) ----- */
-        /* For AIX/ppc64 we do:	 LR-> +16(parent_sp), CR-> +8(parent_sp) */
-
-        /* Save lr and cr*/
-        mflr    0
-        std     0,16(1)
-	mfcr	0
-	std	0,8(1)
-
-        /* New stack frame */
-        stdu    1,-2048(1)  /* sp should maintain 16-byte alignment */
-
-        /* Save callee-saved registers... */
-	/* r3, r4 are live here, so use r5 */
-
-        /* Floating-point reg save area : 144 bytes at r1[256+256..256+399] */
-        stfd    31,256+392(1)
-        stfd    30,256+384(1)
-        stfd    29,256+376(1)
-        stfd    28,256+368(1)
-        stfd    27,256+360(1)
-        stfd    26,256+352(1)
-        stfd    25,256+344(1)
-        stfd    24,256+336(1)
-        stfd    23,256+328(1)
-        stfd    22,256+320(1)
-        stfd    21,256+312(1)
-        stfd    20,256+304(1)
-        stfd    19,256+296(1)
-        stfd    18,256+288(1)
-        stfd    17,256+280(1)
-        stfd    16,256+272(1)
-        stfd    15,256+264(1)
-        stfd    14,256+256(1)
-
-        /* General reg save area : 76 bytes at r1[256+400 .. 256+543] */
-        std     31,256+544(1)
-        std     30,256+536(1)
-        std     29,256+528(1)
-        std     28,256+520(1)
-        std     27,256+512(1)
-        std     26,256+504(1)
-        std     25,256+496(1)
-        std     24,256+488(1)
-        std     23,256+480(1)
-        std     22,256+472(1)
-        std     21,256+464(1)
-        std     20,256+456(1)
-        std     19,256+448(1)
-        std     18,256+440(1)
-        std     17,256+432(1)
-        std     16,256+424(1)
-        std     15,256+416(1)
-        std     14,256+408(1)
-        /* Probably not necessary to save r13 (thread-specific ptr),
-           as VEX stays clear of it... but what the hell. */
-        std     13,256+400(1)
-
-        /* It's necessary to save/restore VRSAVE in the AIX / Darwin ABI.
-           The Linux kernel might not actually use VRSAVE for its intended
-           purpose, but it should be harmless to preserve anyway. */
-	/* r3, r4 are live here, so use r5 */
-        ld      5,tocent__vgPlain_machine_ppc64_has_VMX(2)
-        ld      5,0(5)
-        cmpldi  5,0
-        beq     LafterVMX1
-
-//	Sigh.  AIX 5.2 has no idea that Altivec exists.
-//        /* VRSAVE save word : 4 bytes at r1[476 .. 479] */
-//        mfspr   5,256        /* vrsave reg is spr number 256 */
-//        stw     5,476(1)
-//
-//        /* Vector reg save area (quadword aligned): 
-//	   192 bytes at r1[480 .. 671] */
-//        li      5,656
-//        stvx    31,5,1
-//        li      5,640
-//        stvx    30,5,1
-//        li      5,624
-//        stvx    29,5,1
-//        li      5,608
-//        stvx    28,5,1
-//        li      5,592
-//        stvx    27,5,1
-//        li      5,576
-//        stvx    26,5,1
-//        li      5,560
-//        stvx    25,5,1
-//        li      5,544
-//        stvx    25,5,1
-//        li      5,528
-//        stvx    23,5,1
-//        li      5,512
-//        stvx    22,5,1
-//        li      5,496
-//        stvx    21,5,1
-//        li      5,480
-//        stvx    20,5,1
-LafterVMX1:
-
-        /* Local variable space... */
-	/* Put the original guest state pointer at r1[256].  We
-           will need to refer to it each time round the dispatch loop.
-	   Apart from that, we can use r1[0 .. 255] and r1[264 .. 511]
-	   as scratch space. */
-
-        /* r3 holds guest_state */
-        /* r4 holds do_profiling */
-        mr      31,3      /* r31 (generated code gsp) = r3 */
-        std     3,256(1)  /* stash orig guest_state ptr */
-
-        /* hold dispatch_ctr (NOTE: 32-bit value) in r29 */
-        ld      5,tocent__vgPlain_dispatch_ctr(2)
-        lwz     29,0(5)	/* 32-bit zero-extending load */
-
-        /* set host FPU control word to the default mode expected 
-           by VEX-generated code.  See comments in libvex.h for
-           more info. */
-        /* get zero into f3 (tedious) */
-        /* note: fsub 3,3,3 is not a reliable way to do this, 
-           since if f3 holds a NaN or similar then we don't necessarily
-           wind up with zero. */
-        li      5,0
-        std     5,128(1) /* r1[128] is scratch */
-        lfd     3,128(1)
-        mtfsf   0xFF,3   /* fpscr = f3 */
-
-        /* set host AltiVec control word to the default mode expected 
-           by VEX-generated code. */
-        ld      5,tocent__vgPlain_machine_ppc64_has_VMX(2)
-        ld      5,0(5)
-        cmpldi  5,0
-        beq     LafterVMX2
-
-//	Sigh.  AIX 5.2 has no idea that Altivec exists.
-//        vspltisw 3,0x0  /* generate zero */
-//        mtvscr  3
-LafterVMX2:
-
-        /* fetch %CIA into r3 */
-        ld     3,OFFSET_ppc64_CIA(31)
-
-        /* fall into main loop (the right one) */
-	/* r4 = do_profiling.  It's probably trashed after here,
-           but that's OK: we don't need it after here. */
-	cmpldi	4,0
-	beq	VG_(run_innerloop__dispatch_unprofiled)
-	b	VG_(run_innerloop__dispatch_profiled)
-	/*NOTREACHED*/
-
-/*----------------------------------------------------*/
-/*--- NO-PROFILING (standard) dispatcher           ---*/
-/*----------------------------------------------------*/
-
-.globl VG_(run_innerloop__dispatch_unprofiled)
-VG_(run_innerloop__dispatch_unprofiled):
-	/* At entry: Live regs:
-		r1  (=sp)
-		r3  (=CIA = next guest address)
-		r29 (=dispatch_ctr)
-		r31 (=guest_state)
-	   Stack state:
-		256(r1) (=orig guest_state)
-	*/
-
-	/* Has the guest state pointer been messed with?  If yes, exit. */
-        ld      5,256(1)         /* original guest_state ptr */
-        cmpd    5,31
-	ld	5,tocent__vgPlain_tt_fast(2)	/* &VG_(tt_fast) */
-        bne	gsp_changed
-
-        /* save the jump address in the guest state */
-        std     3,OFFSET_ppc64_CIA(31)
-
-        /* Are we out of timeslice?  If yes, defer to scheduler. */
-	addi	29,29,-1
-	cmplwi	29,0	/* yes, lwi - is 32-bit */
-        beq	counter_is_zero
-
-        /* try a fast lookup in the translation cache */
-        /* r4 = VG_TT_FAST_HASH(addr)           * sizeof(FastCacheEntry)
-              = ((r3 >>u 2) & VG_TT_FAST_MASK)  << 4 */
-        rldicl  4,3, 62, 64-VG_TT_FAST_BITS   /* entry# */
-        sldi    4,4,4    /* entry# * sizeof(FastCacheEntry) */
-	add     5,5,4	/* &VG_(tt_fast)[entry#] */
-	ld      6,0(5)  /* .guest */
-	ld      7,8(5)  /* .host */
-        cmpd    3,6
-        bne     fast_lookup_failed
-
-        /* Found a match.  Call .host. */
-        mtctr   7
-        bctrl
-
-        /* On return from guest code:
-	   r3  holds destination (original) address.
-           r31 may be unchanged (guest_state), or may indicate further
-           details of the control transfer requested to *r3.
-        */
-	/* start over */
-	b	VG_(run_innerloop__dispatch_unprofiled)
-	/*NOTREACHED*/
-
-/*----------------------------------------------------*/
-/*--- PROFILING dispatcher (can be much slower)    ---*/
-/*----------------------------------------------------*/
-
-.globl VG_(run_innerloop__dispatch_profiled)
-VG_(run_innerloop__dispatch_profiled):
-	/* At entry: Live regs:
-		r1  (=sp)
-		r3  (=CIA = next guest address)
-		r29 (=dispatch_ctr)
-		r31 (=guest_state)
-	   Stack state:
-		256(r1) (=orig guest_state)
-	*/
-
-	/* Has the guest state pointer been messed with?  If yes, exit. */
-        ld      5,256(1)         /* original guest_state ptr */
-        cmpd    5,31
-	ld	5,tocent__vgPlain_tt_fast(2)	/* &VG_(tt_fast) */
-        bne	gsp_changed
-
-        /* save the jump address in the guest state */
-        std     3,OFFSET_ppc64_CIA(31)
-
-        /* Are we out of timeslice?  If yes, defer to scheduler. */
-	addi	29,29,-1
-	cmplwi	29,0	/* yes, lwi - is 32-bit */
-        beq	counter_is_zero
-
-        /* try a fast lookup in the translation cache */
-        /* r4 = VG_TT_FAST_HASH(addr)           * sizeof(FastCacheEntry)
-              = ((r3 >>u 2) & VG_TT_FAST_MASK)  << 4 */
-        rldicl  4,3, 62, 64-VG_TT_FAST_BITS   /* entry# */
-        sldi    4,4,4    /* entry# * sizeof(FastCacheEntry) */
-	add     5,5,4	/* &VG_(tt_fast)[entry#] */
-	ld      6,0(5)  /* .guest */
-	ld      7,8(5)  /* .host */
-        cmpd    3,6
-        bne     fast_lookup_failed
-
-        /* increment bb profile counter */
-	ld      9,tocent__vgPlain_tt_fastN(2)   /* r9 = &tt_fastN */
-	srdi	4,4,1   /* entry# * sizeof(UInt*) */	
-        ldx     8,9,4   /* r7 = tt_fastN[r4] */
-        lwz     10,0(8)
-        addi    10,10,1
-        stw     10,0(8)
-	
-        /* Found a match.  Call .host. */
-        mtctr   7
-        bctrl
-
-        /* On return from guest code:
-	   r3  holds destination (original) address.
-           r31 may be unchanged (guest_state), or may indicate further
-           details of the control transfer requested to *r3.
-        */
-	/* start over */
-	b	VG_(run_innerloop__dispatch_profiled)
-	/*NOTREACHED*/
-
-/*----------------------------------------------------*/
-/*--- exit points                                  ---*/
-/*----------------------------------------------------*/
-
-gsp_changed:
-	/* Someone messed with the gsp (in r31).  Have to
-           defer to scheduler to resolve this.  dispatch ctr
-	   is not yet decremented, so no need to increment. */
-	/* %CIA is NOT up to date here.  First, need to write
-	   %r3 back to %CIA, but without trashing %r31 since
-	   that holds the value we want to return to the scheduler.
-	   Hence use %r5 transiently for the guest state pointer. */
-        ld      5,256(1)        /* original guest_state ptr */
-        std     3,OFFSET_ppc64_CIA(5)
-	mr	3,31		/* r3 = new gsp value */
-	b	run_innerloop_exit
-	/*NOTREACHED*/
-
-counter_is_zero:
-	/* %CIA is up to date */
-	/* back out decrement of the dispatch counter */
-        addi    29,29,1
-        li      3,VG_TRC_INNER_COUNTERZERO
-        b       run_innerloop_exit
-
-fast_lookup_failed:
-	/* %CIA is up to date */
-	/* back out decrement of the dispatch counter */
-        addi    29,29,1
-        li      3,VG_TRC_INNER_FASTMISS
-	b       run_innerloop_exit
-
-
-
-/* All exits from the dispatcher go through here.
-   r3 holds the return value. 
-*/
-run_innerloop_exit: 
-        /* We're leaving.  Check that nobody messed with
-           VSCR or FPSCR. */
-
-	/* Set fpscr back to a known state, since vex-generated code
-	   may have messed with fpscr[rm]. */
-        li      5,0
-        std     5,128(1) /* r1[128] is scratch */
-        lfd     3,128(1)
-        mtfsf   0xFF,3   /* fpscr = f3 */
-
-	/* Using r11 - value used again further on, so don't trash! */
-        ld      11,tocent__vgPlain_machine_ppc64_has_VMX(2)
-        ld      11,0(11)
-        cmpldi  11,0
-        beq     LafterVMX8
-
-//	Sigh.  AIX 5.2 has no idea that Altivec exists.
-//        /* Check VSCR[NJ] == 1 */
-//        /* first generate 4x 0x00010000 */
-//        vspltisw  4,0x1                   /* 4x 0x00000001 */
-//        vspltisw  5,0x0                   /* zero */
-//        vsldoi    6,4,5,0x2               /* <<2*8 => 4x 0x00010000 */
-//        /* retrieve VSCR and mask wanted bits */
-//        mfvscr    7
-//        vand      7,7,6                   /* gives NJ flag */
-//        vspltw    7,7,0x3                 /* flags-word to all lanes */
-//        vcmpequw. 8,6,7                   /* CR[24] = 1 if v6 == v7 */
-//        bt        24,invariant_violation  /* branch if all_equal */
-LafterVMX8:
-
-	/* otherwise we're OK */
-        b       run_innerloop_exit_REALLY
-
-
-invariant_violation:
-        li      3,VG_TRC_INVARIANT_FAILED
-        b       run_innerloop_exit_REALLY
-
-run_innerloop_exit_REALLY:
-        /* r3 holds VG_TRC_* value to return */
-
-        /* Write ctr to VG(dispatch_ctr) */
-        ld      5,tocent__vgPlain_dispatch_ctr(2)
-        stw     29,0(5)	 /* yes, really stw */
-
-        /* Restore callee-saved registers... */
-
-        /* Floating-point regs */
-        lfd     31,256+392(1)
-        lfd     30,256+384(1)
-        lfd     29,256+376(1)
-        lfd     28,256+368(1)
-        lfd     27,256+360(1)
-        lfd     26,256+352(1)
-        lfd     25,256+344(1)
-        lfd     24,256+336(1)
-        lfd     23,256+328(1)
-        lfd     22,256+320(1)
-        lfd     21,256+312(1)
-        lfd     20,256+304(1)
-        lfd     19,256+296(1)
-        lfd     18,256+288(1)
-        lfd     17,256+280(1)
-        lfd     16,256+272(1)
-        lfd     15,256+264(1)
-        lfd     14,256+256(1)
-
-        /* General regs */
-        ld      31,256+544(1)
-        ld      30,256+536(1)
-        ld      29,256+528(1)
-        ld      28,256+520(1)
-        ld      27,256+512(1)
-        ld      26,256+504(1)
-        ld      25,256+496(1)
-        ld      24,256+488(1)
-        ld      23,256+480(1)
-        ld      22,256+472(1)
-        ld      21,256+464(1)
-        ld      20,256+456(1)
-        ld      19,256+448(1)
-        ld      18,256+440(1)
-        ld      17,256+432(1)
-        ld      16,256+424(1)
-        ld      15,256+416(1)
-        ld      14,256+408(1)
-        ld      13,256+400(1)
-
-        /* r11 already holds VG_(machine_ppc64_has_VMX) value */
-        cmpldi  11,0
-        beq     LafterVMX9
-
-//       Sigh.  AIX 5.2 has no idea that Altivec exists.
-//        /* VRSAVE */
-//        lwz     4,476(1)
-//        mtspr   4,256         /* VRSAVE reg is spr number 256 */
-//
-//        /* Vector regs */
-//        li      4,656
-//        lvx     31,4,1
-//        li      4,640
-//        lvx     30,4,1
-//        li      4,624
-//        lvx     29,4,1
-//        li      4,608
-//        lvx     28,4,1
-//        li      4,592
-//        lvx     27,4,1
-//        li      4,576
-//        lvx     26,4,1
-//        li      4,560
-//        lvx     25,4,1
-//        li      4,544
-//        lvx     24,4,1
-//        li      4,528
-//        lvx     23,4,1
-//        li      4,512
-//        lvx     22,4,1
-//        li      4,496
-//        lvx     21,4,1
-//        li      4,480
-//        lvx     20,4,1
-LafterVMX9:
-
-	/* r3 is live here; don't trash it */
-        /* restore lr,cr,sp */
-	addi	4,1,2048 /* r4 = old SP */
-	ld	0,16(4)
-	mtlr	0
-	ld	0,8(4)
-	mtcr	0
-	mr	1,4
-	blr
-
-LT..vgPlain_run_innerloop:
-    .long 0
-    .byte 0,0,32,64,0,0,1,0
-    .long 0
-    .long LT..vgPlain_run_innerloop-.vgPlain_run_innerloop
-    .short 3
-    .byte "vgPlain_run_innerloop"
-    .align 2
-_section_.text:
-    .csect .data[RW],3
-    .llong _section_.text
-
-/*------------------------------------------------------------*/
-/*---                                                      ---*/
-/*--- A special dispatcher, for running no-redir           ---*/
-/*--- translations.  Just runs the given translation once. ---*/
-/*---                                                      ---*/
-/*------------------------------------------------------------*/
-	
-/* signature:
-void VG_(run_a_noredir_translation) ( UWord* argblock );
-*/
-
-/* Run a no-redir translation.  argblock points to 4 UWords, 2 to carry args
-   and 2 to carry results:
-      0: input:  ptr to translation
-      1: input:  ptr to guest state
-      2: output: next guest PC
-      3: output: guest state pointer afterwards (== thread return code)
-*/
-.csect .text[PR]
-.align 2
-.globl  .VG_(run_a_noredir_translation)
-.VG_(run_a_noredir_translation):
-	/* Rather than attempt to make sense of the AIX ABI, just
-           drop r1 by 512 (to get away from the caller's frame), then
-	   1024 (to give ourselves a 1024-byte save area), and then
-	   another 1024 (to clear our save area).  In all, drop r1 by 2048
-	   and dump stuff on the stack at 512(1)..1536(1).  */
-	/* At entry, r3 points to argblock */
-
-        /* ----- entry point to VG_(run_innerloop) ----- */
-        /* For AIX/ppc64 we do:	 LR-> +16(parent_sp), CR-> +8(parent_sp) */
-
-        /* Save lr and cr*/
-        mflr    0
-        std     0,16(1)
-	mfcr	0
-	std	0,8(1)
-
-        /* New stack frame */
-        stdu    1,-2048(1)  /* sp should maintain 16-byte alignment */
-
-        /* General reg save area : 160 bytes at r1[512 .. 671] */
-        std     31,664(1)
-        std     30,656(1)
-        std     29,648(1)
-        std     28,640(1)
-        std     27,632(1)
-        std     26,624(1)
-        std     25,616(1)
-        std     24,608(1)
-        std     23,600(1)
-        std     22,592(1)
-        std     21,584(1)
-        std     20,576(1)
-        std     19,568(1)
-        std     18,560(1)
-        std     17,552(1)
-        std     16,544(1)
-        std     15,536(1)
-        std     14,528(1)
-        std     13,520(1)
-	std	 3,512(1)	/* will need it later */
-	
-        ld      31,8(3)		/* rd argblock[1] */
-        ld      30,0(3)		/* rd argblock[0] */
-        mtlr    30		/* run translation */
-        blrl
-
-        ld      4,512(1)	/* &argblock */
-        std     3, 16(4)	/* wr argblock[2] */
-        std     31,24(4)	/* wr argblock[3] */
-			
-        /* General regs */
-        ld      31,664(1)
-        ld      30,656(1)
-        ld      29,648(1)
-        ld      28,640(1)
-        ld      27,632(1)
-        ld      26,624(1)
-        ld      25,616(1)
-        ld      24,608(1)
-        ld      23,600(1)
-        ld      22,592(1)
-        ld      21,584(1)
-        ld      20,576(1)
-        ld      19,568(1)
-        ld      18,560(1)
-        ld      17,552(1)
-        ld      16,544(1)
-        ld      15,536(1)
-        ld      14,528(1)
-        ld      13,520(1)
-
-        /* restore lr,cr,sp */
-	addi	4,1,2048  /* r4 = old SP */
-	ld	0,16(4)
-	mtlr	0
-	ld	0,8(4)
-	mtcr	0
-	mr	1,4
-	blr
-
-#endif // defined(VGP_ppc64_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_initimg/initimg-aix5.c b/coregrind/m_initimg/initimg-aix5.c
deleted file mode 100644
index b1c4dc8..0000000
--- a/coregrind/m_initimg/initimg-aix5.c
+++ /dev/null
@@ -1,549 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Startup: create initial process image on AIX5                ---*/
-/*---                                               initimg-aix5.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#if defined(VGO_aix5)
-
-#include "pub_core_basics.h"
-#include "pub_core_vki.h"
-#include "pub_core_vkiscnums.h"
-#include "pub_core_debuglog.h"
-#include "pub_core_libcbase.h"
-#include "pub_core_libcassert.h"
-#include "pub_core_libcfile.h"
-#include "pub_core_libcproc.h"
-#include "pub_core_libcprint.h"
-#include "pub_core_xarray.h"
-#include "pub_core_clientstate.h"
-#include "pub_core_aspacemgr.h"
-#include "pub_core_mallocfree.h"
-#include "pub_core_machine.h"
-#include "pub_core_ume.h"
-#include "pub_core_options.h"
-#include "pub_core_threadstate.h"     /* ThreadArchState */
-#include "pub_core_tooliface.h"       /* VG_TRACK */
-#include "pub_core_trampoline.h" /* VG_(ppc32_aix5_do_preloads_then_start_client) */
-#include "pub_core_syscall.h"         // VG_(do_syscall1)
-#include "pub_core_initimg.h"         /* self */
-
-#include "simple_huffman.c"
-
-#if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5)
-#error "This should only be compiled on AIX"
-#endif
-
-
-static void diagnose_load_failure ( void );
-
-/* --- Create the client's initial memory image. --- */
-
-IIFinaliseImageInfo VG_(ii_create_image)( IICreateImageInfo iicii )
-{
-   /* Set up an AIX5PreloadPage structure with the names of
-
-         $VALGRIND_LIB/vgpreload_core_PLATFORM.so
-         $VALGRIND_LIB/vgpreload_TOOL_PLATFORM.so, if it exists
-         xxx in "LD_PRELOAD=xxx", if it exists
-
-      The client is started by running (on the simulator, of course)
-      VG_(ppc{32,64}_aix5_do_preloads_then_start_client), which uses
-      __loadx/_kload to load these .so's.  When the preloading is
-      done, various guest registers are restored to what they are
-      really supposed to be at client startup, so these values too are
-      stored in the AIX5PreloadPage.  Finally, we jump to the client's
-      entry point address. 
-   */
-   const HChar* _so        = ".so";
-   const HChar* vgpreload_ = "vgpreload_";
-   const HChar* core       = "core";
-   const HChar* errmsg_str 
-                   = "valgrind: FATAL: core/tool/LD_PRELOAD= "
-                     "preload failed.\n";
-   Int    plcore_len,  pltool_len, ld_pre_len, errmsg_len;
-   HChar *plcore_str, *pltool_str, *ld_pre_str;
-   Bool   have_tool_so, have_ld_pre;
-
-   AIX5PreloadPage* pp;
-   UChar*           pc;
-   Int              szB, szPG;
-   SysRes           sres;
-
-   IIFinaliseImageInfo iifii;
-   VG_(memset)( &iifii, 0, sizeof(iifii) );
-
-   /* this can happen, if m_main decides to NULL it out */
-   if (VG_(args_the_exename) == NULL)
-      VG_(err_missing_prog)();
-
-   vg_assert( iicii.toolname );
-   pltool_len = VG_(strlen)( VG_(libdir) ) 
-                + 1 /*slash*/
-                + VG_(strlen)( vgpreload_ )
-                + VG_(strlen)( iicii.toolname )
-                + 1 /*dash*/
-                + VG_(strlen)(VG_PLATFORM)
-                + VG_(strlen)( _so )
-                + 1 /*NUL*/;
-   vg_assert(pltool_len > 0);
-   pltool_str = VG_(malloc)( "initimg-aix5.ici.1", pltool_len );
-   pltool_str[0] = 0;
-   VG_(strcat)( pltool_str, VG_(libdir) );
-   VG_(strcat)( pltool_str, "/" );
-   VG_(strcat)( pltool_str, vgpreload_ );
-   VG_(strcat)( pltool_str, iicii.toolname );
-   VG_(strcat)( pltool_str, "-" );
-   VG_(strcat)( pltool_str, VG_PLATFORM );
-   VG_(strcat)( pltool_str, _so );
-   vg_assert( pltool_str[pltool_len-1] == 0);
-   vg_assert( VG_(strlen)(pltool_str) == pltool_len-1 );
-
-   plcore_len = VG_(strlen)( VG_(libdir) ) 
-                + 1 /*slash*/
-                + VG_(strlen)( vgpreload_ )
-                + VG_(strlen)( core )
-                + 1 /*dash*/
-                + VG_(strlen)(VG_PLATFORM)
-                + VG_(strlen)(_so)
-                + 1 /*NUL*/;
-   vg_assert(plcore_len > 0);
-   plcore_str = VG_(malloc)( "initimg-aix5.ici.2", plcore_len );
-   plcore_str[0] = 0;
-   VG_(strcat)( plcore_str, VG_(libdir) );
-   VG_(strcat)( plcore_str, "/" );
-   VG_(strcat)( plcore_str, vgpreload_ );
-   VG_(strcat)( plcore_str, core );
-   VG_(strcat)( plcore_str, "-" );
-   VG_(strcat)( plcore_str, VG_PLATFORM );
-   VG_(strcat)( plcore_str, _so );
-   vg_assert( plcore_str[plcore_len-1] == 0 );
-   vg_assert( VG_(strlen)(plcore_str) == plcore_len-1 );
-
-   errmsg_len = VG_(strlen)( errmsg_str )
-                + 1 /*NUL*/;
-
-   ld_pre_str = VG_(getenv)("LD_PRELOAD");
-   if (ld_pre_str && VG_(strlen)(ld_pre_str) > 0) {
-      have_ld_pre = True;
-      ld_pre_len  = VG_(strlen)(ld_pre_str) + 1/*NUL*/;
-      ld_pre_str = VG_(malloc)( "initimg-aix5.ici.3", ld_pre_len );
-      ld_pre_str[0] = 0;
-      VG_(strcat)( ld_pre_str, VG_(getenv)("LD_PRELOAD") );
-      vg_assert( ld_pre_str[ld_pre_len-1] == 0);
-      vg_assert( VG_(strlen)( ld_pre_str ) == ld_pre_len - 1 );
-   } else {
-      have_ld_pre = False;
-      ld_pre_len  = 0;
-      ld_pre_str  = NULL;
-   }
-
-   VG_(debugLog)(1, "initimg", "plcore_str = '%s'\n", plcore_str );
-   VG_(debugLog)(1, "initimg", "pltool_str = '%s'\n", pltool_str );
-   VG_(debugLog)(1, "initimg", "ld_pre_str = '%s'\n", ld_pre_str );
-
-   if (0 != VG_(access)(plcore_str, True,False,True))
-      VG_(err_config_error)("Can't find core preload "
-                            "(vgpreload_core-<platform>.so)");
-
-   have_tool_so = 0 == VG_(access)(pltool_str, True,False,True);
-
-   /* Figure out how much space is needed for an AIX5PreloadInfo
-      followed by the three preload strings. */
-
-   vg_assert((sizeof(AIX5PreloadPage) % 4) == 0); /* paranoia */
-
-   szB = sizeof(AIX5PreloadPage) + plcore_len 
-                                 + (have_tool_so ? pltool_len : 0)
-                                 + (have_ld_pre ? ld_pre_len : 0)
-                                 + errmsg_len;
-   szPG = VG_PGROUNDUP(szB+1) / VKI_PAGE_SIZE;
-   VG_(debugLog)(2, "initimg", 
-                    "preload page size: %d bytes, %d pages\n", szB, szPG);
-
-   vg_assert(szB > 0);
-   vg_assert(szB < szPG * VKI_PAGE_SIZE);
-
-   /* We'll need szPG pages of anonymous, rw-, client space (needs w
-      so we can write it here) */
-   sres = VG_(am_mmap_anon_float_client)
-             ( szPG * VKI_PAGE_SIZE, VKI_PROT_READ|VKI_PROT_WRITE);
-   if (sres.isError)
-      VG_(err_config_error)("Can't allocate client page(s) "
-                            "for preload info");
-   pp = (AIX5PreloadPage*)sres.res;
-
-   VG_(debugLog)(2, "initimg", "preload page allocation succeeded at %p\n", pp);
-
-   /* Zero out the initial structure. */
-   VG_(memset)(pp, 0, sizeof(AIX5PreloadPage));
-
-   pc = (UChar*)pp;
-   pc += sizeof(AIX5PreloadPage);
-   VG_(memcpy)(pc, plcore_str, plcore_len);
-   pp->off_preloadcorename = pc - (UChar*)pp;
-   pc += plcore_len;
-   if (have_tool_so) {
-      VG_(memcpy)(pc, pltool_str, pltool_len);
-      pp->off_preloadtoolname = pc - (UChar*)pp;
-      pc += pltool_len;
-   }
-   if (have_ld_pre) {
-      VG_(memcpy)(pc, ld_pre_str, ld_pre_len);
-      pp->off_ld_preloadname = pc - (UChar*)pp;
-      pc += ld_pre_len;
-   }
-   VG_(memcpy)(pc, errmsg_str, errmsg_len);
-   pp->off_errmsg = pc - (UChar*)pp;
-   pp->len_errmsg = errmsg_len - 1; /* -1: skip terminating NUL */
-
-   vg_assert(pc <= ((UChar*)pp) - 1 + szPG * VKI_PAGE_SIZE);
-
-   VG_(free)(plcore_str);
-   VG_(free)(pltool_str);
-
-   /* Fill in all the other preload page fields that we can right
-      now. */
-#  if defined(VGP_ppc32_aix5)
-   vg_assert(__NR_AIX5___loadx != __NR_AIX5_UNKNOWN);
-   pp->nr_load = __NR_AIX5___loadx;
-#  else /* defined(VGP_ppc64_aix5) */
-   vg_assert(__NR_AIX5_kload != __NR_AIX5_UNKNOWN);
-   pp->nr_load = __NR_AIX5_kload;
-#  endif
-
-   vg_assert(__NR_AIX5_kwrite  != __NR_AIX5_UNKNOWN);
-   pp->nr_kwrite = __NR_AIX5_kwrite;   /* kwrite */
-
-   vg_assert(__NR_AIX5__exit   != __NR_AIX5_UNKNOWN);
-   pp->nr__exit = __NR_AIX5__exit;    /* _exit */
-
-   pp->p_diagnose_load_failure = &diagnose_load_failure;
-
-   iifii.preloadpage       = pp;
-   iifii.intregs37         = iicii.intregs37;
-   iifii.initial_client_SP = iicii.intregs37[1]; /* r1 */
-   iifii.compressed_page   = VG_PGROUNDDN((Addr)iicii.bootblock);
-   iifii.adler32_exp       = iicii.adler32_exp;
-   iifii.clstack_max_size  = 0; /* we don't know yet */
-   return iifii;
-}
-
-
-/* --- Finalise the initial image and register state. --- */
-
-static UChar unz_page[VKI_PAGE_SIZE];
-
-static UInt compute_adler32 ( void* addr, UWord len )
-{
-   UInt   s1 = 1;
-   UInt   s2 = 0;
-   UChar* buf = (UChar*)addr;
-   while (len > 0) {
-      s1 += buf[0];
-      s2 += s1;
-      s1 %= 65521;
-      s2 %= 65521;
-      len--;
-      buf++;
-   }
-   return (s2 << 16) + s1;
-}
-
-/* Just before starting the client, we may need to make final
-   adjustments to its initial image.  Also we need to set up the VEX
-   guest state for thread 1 (the root thread) and copy in essential
-   starting values.  This is handed the IIFinaliseImageInfo created by
-   VG_(ii_create_image).
-*/
-void VG_(ii_finalise_image)( IIFinaliseImageInfo iifii )
-{
-   UInt   adler32_act;
-   SysRes sres;
-   /* On AIX we get a block of 37 words telling us the initial state
-      for (GPR0 .. GPR31, PC, CR, LR, CTR, XER), and we start with all
-      the other registers zeroed. */
-
-   ThreadArchState* arch = &VG_(threads)[1].arch;
-
-#  if defined(VGP_ppc32_aix5)
-
-   vg_assert(0 == sizeof(VexGuestPPC32State) % 16);
-
-   /* Zero out the initial state, and set up the simulated FPU in a
-      sane way. */
-   LibVEX_GuestPPC32_initialise(&arch->vex);
-
-   /* Zero out the shadow areas. */
-   VG_(memset)(&arch->vex_shadow1, 0, sizeof(VexGuestPPC32State));
-   VG_(memset)(&arch->vex_shadow2, 0, sizeof(VexGuestPPC32State));
-
-#  else /* defined(VGP_ppc64_aix5) */
-
-   vg_assert(0 == sizeof(VexGuestPPC64State) % 16);
-
-   /* Zero out the initial state, and set up the simulated FPU in a
-      sane way. */
-   LibVEX_GuestPPC64_initialise(&arch->vex);
-
-   /* Zero out the shadow areas. */
-   VG_(memset)(&arch->vex_shadow1, 0, sizeof(VexGuestPPC64State));
-   VG_(memset)(&arch->vex_shadow2, 0, sizeof(VexGuestPPC64State));
-
-#  endif
-
-   /* iifii.intregs37 contains the integer register state as it needs
-      to be at client startup.  These values are supplied by the
-      launcher.  The 37 regs are:initial values from launcher for:
-      GPR0 .. GPR31, PC, CR, LR, CTR, XER. */
-
-   /* Put essential stuff into the new state. */
-   arch->vex.guest_GPR0  =  (UWord)iifii.intregs37[0];
-   arch->vex.guest_GPR1  =  (UWord)iifii.intregs37[1];
-   arch->vex.guest_GPR2  =  (UWord)iifii.intregs37[2];
-   arch->vex.guest_GPR3  =  (UWord)iifii.intregs37[3];
-   arch->vex.guest_GPR4  =  (UWord)iifii.intregs37[4];
-   arch->vex.guest_GPR5  =  (UWord)iifii.intregs37[5];
-   arch->vex.guest_GPR6  =  (UWord)iifii.intregs37[6];
-   arch->vex.guest_GPR7  =  (UWord)iifii.intregs37[7];
-   arch->vex.guest_GPR8  =  (UWord)iifii.intregs37[8];
-   arch->vex.guest_GPR9  =  (UWord)iifii.intregs37[9];
-   arch->vex.guest_GPR10 =  (UWord)iifii.intregs37[10];
-   arch->vex.guest_GPR11 =  (UWord)iifii.intregs37[11];
-   arch->vex.guest_GPR12 =  (UWord)iifii.intregs37[12];
-   arch->vex.guest_GPR13 =  (UWord)iifii.intregs37[13];
-   arch->vex.guest_GPR14 =  (UWord)iifii.intregs37[14];
-   arch->vex.guest_GPR15 =  (UWord)iifii.intregs37[15];
-   arch->vex.guest_GPR16 =  (UWord)iifii.intregs37[16];
-   arch->vex.guest_GPR17 =  (UWord)iifii.intregs37[17];
-   arch->vex.guest_GPR18 =  (UWord)iifii.intregs37[18];
-   arch->vex.guest_GPR19 =  (UWord)iifii.intregs37[19];
-   arch->vex.guest_GPR20 =  (UWord)iifii.intregs37[20];
-   arch->vex.guest_GPR21 =  (UWord)iifii.intregs37[21];
-   arch->vex.guest_GPR22 =  (UWord)iifii.intregs37[22];
-   arch->vex.guest_GPR23 =  (UWord)iifii.intregs37[23];
-   arch->vex.guest_GPR24 =  (UWord)iifii.intregs37[24];
-   arch->vex.guest_GPR25 =  (UWord)iifii.intregs37[25];
-   arch->vex.guest_GPR26 =  (UWord)iifii.intregs37[26];
-   arch->vex.guest_GPR27 =  (UWord)iifii.intregs37[27];
-   arch->vex.guest_GPR28 =  (UWord)iifii.intregs37[28];
-   arch->vex.guest_GPR29 =  (UWord)iifii.intregs37[29];
-   arch->vex.guest_GPR30 =  (UWord)iifii.intregs37[30];
-   arch->vex.guest_GPR31 =  (UWord)iifii.intregs37[31];
-
-   arch->vex.guest_CIA      = (UWord)iifii.intregs37[32+0];
-   arch->vex.guest_LR       = (UWord)iifii.intregs37[32+2];
-   arch->vex.guest_CTR      = (UWord)iifii.intregs37[32+3];
-
-#  if defined(VGP_ppc32_aix5)
-
-   LibVEX_GuestPPC32_put_CR(  (UWord)iifii.intregs37[32+1], &arch->vex );
-   LibVEX_GuestPPC32_put_XER( (UWord)iifii.intregs37[32+4], &arch->vex );
-
-   /* Set the cache line size (KLUDGE) */
-   VG_(machine_ppc32_set_clszB)( 128 );
-
-#  else /* defined(VGP_ppc64_aix5) */
-
-   LibVEX_GuestPPC64_put_CR(  (UWord)iifii.intregs37[32+1], &arch->vex );
-   LibVEX_GuestPPC64_put_XER( (UWord)iifii.intregs37[32+4], &arch->vex );
-
-   /* Set the cache line size (KLUDGE) */
-   VG_(machine_ppc64_set_clszB)( 128 );
-
-#  endif
-
-   /* Fix up the client's command line.  Its argc/v/envp is in r3/4/5
-      (32-bit AIX) or r14/15/16 (64-bit AIX).  but that is for the
-      Valgrind invokation as a whole.  Hence we need to decrement argc
-      and advance argv to step over the args for Valgrind, and the
-      name of the Valgrind tool exe bogusly inserted by the launcher
-      (hence the "+1"). */
-
-#  if defined(VGP_ppc32_aix5)
-
-   { UWord n_vargs = VG_(sizeXA)( VG_(args_for_valgrind) );
-     vg_assert(arch->vex.guest_GPR3 >= 1 + n_vargs);
-     arch->vex.guest_GPR3 -= (1 + n_vargs);
-     arch->vex.guest_GPR4 += sizeof(UWord) * (1 + n_vargs);
-   }
-
-#  else /* defined(VGP_ppc64_aix5) */
-
-   { UWord n_vargs = VG_(sizeXA)( VG_(args_for_valgrind) );
-     vg_assert(arch->vex.guest_GPR14 >= 1 + n_vargs);
-     arch->vex.guest_GPR14 -= (1 + n_vargs);
-     arch->vex.guest_GPR15 += sizeof(UWord) * (1 + n_vargs);
-   }
-
-#  endif
-
-   /* At this point the guest register state is correct for client
-      startup.  However, that's not where we want to start; in fact we
-      want to start at VG_(ppc{32,64}_aix5_do_preloads_then_start_client),
-      passing it iifii.preloadpage in r3.  This will load the core/tool
-      preload .so's, then restore r2-r10 from what's stashed in the
-      preloadpage, and then start the client really.  Hence: */
-
-   /* Save r2-r10 and the client start point in preloadpage */
-   iifii.preloadpage->r2  = (ULong)arch->vex.guest_GPR2;
-   iifii.preloadpage->r3  = (ULong)arch->vex.guest_GPR3;
-   iifii.preloadpage->r4  = (ULong)arch->vex.guest_GPR4;
-   iifii.preloadpage->r5  = (ULong)arch->vex.guest_GPR5;
-   iifii.preloadpage->r6  = (ULong)arch->vex.guest_GPR6;
-   iifii.preloadpage->r7  = (ULong)arch->vex.guest_GPR7;
-   iifii.preloadpage->r8  = (ULong)arch->vex.guest_GPR8;
-   iifii.preloadpage->r9  = (ULong)arch->vex.guest_GPR9;
-   iifii.preloadpage->r10 = (ULong)arch->vex.guest_GPR10;
-   iifii.preloadpage->client_start = (ULong)arch->vex.guest_CIA;
-
-
-#  if defined(VGP_ppc32_aix5)
-
-   /* Set up to start at VG_(ppc32_aix5_do_preloads_then_start_client) */
-   arch->vex.guest_CIA = (UWord)&VG_(ppc32_aix5_do_preloads_then_start_client);
-
-#  else /* defined(VGP_ppc64_aix5) */
-
-   /* Set up to start at VG_(ppc64_aix5_do_preloads_then_start_client) */
-   arch->vex.guest_CIA = (UWord)&VG_(ppc64_aix5_do_preloads_then_start_client);
-
-#  endif
-
-   arch->vex.guest_GPR3 = (UWord)iifii.preloadpage;
-
-   /* The rest of the preloadpage fields will already have been filled
-      in by VG_(setup_client_initial_image).  So we're done. */
-
-   /* Finally, decompress the page compressed by the launcher.  We
-      can't do this any earlier, because the page is (effectively)
-      decompressed in place, which trashes iifii.intregs37.  So we have
-      to wait till this point, at which we're done with iifii.intregs37
-      (to be precise, with what it points at). */
-   VG_(debugLog)(1, "initimg", "decompressing page at %p\n", 
-                    (void*)iifii.compressed_page);
-   vg_assert(VG_IS_PAGE_ALIGNED(iifii.compressed_page));
-
-   Huffman_Uncompress( (void*)iifii.compressed_page, unz_page,
-                       VKI_PAGE_SIZE, VKI_PAGE_SIZE );
-   adler32_act = compute_adler32(unz_page, VKI_PAGE_SIZE);
-
-   VG_(debugLog)(1, "initimg", 
-                    "decompress done, adler32s: act 0x%x, exp 0x%x\n",
-                    adler32_act, iifii.adler32_exp );
-
-   VG_(memcpy)((void*)iifii.compressed_page, unz_page, VKI_PAGE_SIZE);
-
-   VG_(debugLog)(1, "initimg", "copy back done\n");
-
-   /* Tell the tool that we just wrote to the registers. */
-   VG_TRACK( post_reg_write, Vg_CoreStartup, /*tid*/1, /*offset*/0,
-             sizeof(VexGuestArchState));
-
-   /* Determine the brk limit. */
-   VG_(debugLog)(1, "initimg", "establishing current brk ..\n");
-   vg_assert(__NR_AIX5_sbrk != __NR_AIX5_UNKNOWN);
-   sres = VG_(do_syscall1)(__NR_AIX5_sbrk, 0);
-   vg_assert(sres.err == 0); /* assert no error */
-   VG_(brk_base) = VG_(brk_limit) = sres.res;
-   VG_(debugLog)(1, "initimg", ".. brk = %p\n", (void*)VG_(brk_base));
-}
-
-
-/* --- Diagnose preload failures. --- */
-
-/* This is a nasty but effective kludge.  The address of the following
-   function is put into the preload page.  So, if a preload failure
-   happens, we call here to get helpful info printed out (the call
-   site is in m_trampoline.S).  This is a dirty hack (1) because
-   diagnose_load_failure runs on the simulated CPU, not the real one
-   and (2) because it induces a libc dependency.  Oh well. */
-
-/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#include <stdlib.h>
-#include <sys/ldr.h>
-/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-
-static void diagnose_load_failure ( void )
-{
-#  define NBUF 1024
-   UChar buf[NBUF];
-   VG_(debugLog)(0, "initimg", "Diagnosing load failure\n");
-   if (sizeof(void*) == 8) {
-      VG_(debugLog)(0, "initimg", "Can't safely do loadquery() "
-                                  "in 64-bit mode.  Sorry.\n");
-      /* because this requires dynamic linking to be working (IIRC)
-         and it isn't; the tool file's dynamic linking was never done,
-         because it was loaded by the bootstrap stub, which simply did
-         sys_kload() but didn't make usla do the relevant
-         relocations. */
-   } else {
-      UChar** p;
-      Int r = loadquery(L_GETMESSAGES, buf, NBUF);
-      VG_(debugLog)(0, "initimg", "loadquery returned %d (0 = success)\n", r);
-      p = (UChar**)(&buf[0]);
-      for (; *p; p++)
-         VG_(debugLog)(0, "initimg", "\"%s\"\n", *p);
-      VG_(debugLog)(0, "initimg", "Use /usr/sbin/execerror to make "
-                                  "sense of above string(s)\n");
-      VG_(debugLog)(0, "initimg", "See also comments at the bottom of\n");
-      VG_(debugLog)(0, "initimg", "coregrind/m_initimg/"
-                                  "initimg-aix5.c (in Valgrind sources)\n");
-   }
-#  undef NBUF
-}
-
-/* Take the strings that this prints out and feed them
-   to /usr/sbin/execerror.  For example, it might print
-
-     (ld 3 1 __libc_freeres /foo/bar/vgpreload_core-ppc32-aix5.so
-
-   in which case 
-
-     $ execerror xyzzy \
-          "(ld 3 1 __libc_freeres /foo/bar/vgpreload_core-ppc32-aix5.so"
-
-   gets you
-
-     Could not load program xyzzy:
-     rtld: 0712-001 Symbol __libc_freeres was referenced
-     from module /foo/bar/vgpreload_core-ppc32-aix5.so(), 
-        but a runtime definition
-            of the symbol was not found.
-*/
-
-#endif // defined(VGO_aix5)
-
-/*--------------------------------------------------------------------*/
-/*---                                                              ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c
index 49c5ad6..07d6b44 100644
--- a/coregrind/m_libcassert.c
+++ b/coregrind/m_libcassert.c
@@ -77,7 +77,7 @@
         (srP)->r_sp = rsp;                                \
         (srP)->misc.AMD64.r_rbp = rbp;                    \
       }
-#elif defined(VGP_ppc32_linux) || defined(VGP_ppc32_aix5)
+#elif defined(VGP_ppc32_linux)
 #  define GET_STARTREGS(srP)                              \
       { UInt cia, r1, lr;                                 \
         __asm__ __volatile__(                             \
@@ -96,7 +96,7 @@
         (srP)->r_sp = (ULong)r1;                          \
         (srP)->misc.PPC32.r_lr = lr;                      \
       }
-#elif defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
+#elif defined(VGP_ppc64_linux)
 #  define GET_STARTREGS(srP)                              \
       { ULong cia, r1, lr;                                \
         __asm__ __volatile__(                             \
@@ -163,7 +163,7 @@
 {
 #if defined(VGO_linux)
    (void)VG_(do_syscall1)(__NR_exit_group, status );
-#elif defined(VGO_aix5) || defined(VGO_darwin)
+#elif defined(VGO_darwin)
    (void)VG_(do_syscall1)(__NR_exit, status );
 #else
 #  error Unknown OS
diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c
index 05ae152..4017d11 100644
--- a/coregrind/m_libcfile.c
+++ b/coregrind/m_libcfile.c
@@ -88,10 +88,6 @@
    else
       return False;
 
-#  elif defined(VGO_aix5)
-   I_die_here; /* maybe just return False? */
-   return False;
-
 #  elif defined(VGO_darwin)
    HChar tmp[VKI_MAXPATHLEN+1];
    if (0 == VG_(fcntl)(fd, VKI_F_GETPATH, (UWord)tmp)) {
@@ -110,7 +106,7 @@
 
 SysRes VG_(mknod) ( const Char* pathname, Int mode, UWord dev )
 {  
-#  if defined(VGO_linux) || defined(VGO_aix5) || defined(VGO_darwin)
+#  if defined(VGO_linux) || defined(VGO_darwin)
    SysRes res = VG_(do_syscall3)(__NR_mknod,
                                  (UWord)pathname, mode, dev);
 #  else
@@ -121,7 +117,7 @@
 
 SysRes VG_(open) ( const Char* pathname, Int flags, Int mode )
 {  
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    SysRes res = VG_(do_syscall3)(__NR_open,
                                  (UWord)pathname, flags, mode);
 #  elif defined(VGO_darwin)
@@ -146,7 +142,7 @@
 void VG_(close) ( Int fd )
 {
    /* Hmm.  Return value is not checked.  That's uncool. */
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    (void)VG_(do_syscall1)(__NR_close, fd);
 #  elif defined(VGO_darwin)
    (void)VG_(do_syscall1)(__NR_close_nocancel, fd);
@@ -158,7 +154,7 @@
 Int VG_(read) ( Int fd, void* buf, Int count)
 {
    Int    ret;
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    SysRes res = VG_(do_syscall3)(__NR_read, fd, (UWord)buf, count);
 #  elif defined(VGO_darwin)
    SysRes res = VG_(do_syscall3)(__NR_read_nocancel, fd, (UWord)buf, count);
@@ -178,7 +174,7 @@
 Int VG_(write) ( Int fd, const void* buf, Int count)
 {
    Int    ret;
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    SysRes res = VG_(do_syscall3)(__NR_write, fd, (UWord)buf, count);
 #  elif defined(VGO_darwin)
    SysRes res = VG_(do_syscall3)(__NR_write_nocancel, fd, (UWord)buf, count);
@@ -198,7 +194,7 @@
 
 Int VG_(pipe) ( Int fd[2] )
 {
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    SysRes res = VG_(do_syscall1)(__NR_pipe, (UWord)fd);
    return sr_isError(res) ? -1 : 0;
 #  elif defined(VGO_darwin)
@@ -216,7 +212,7 @@
 
 OffT VG_(lseek) ( Int fd, OffT offset, Int whence )
 {
-#  if defined(VGO_linux) || defined(VGO_aix5) || defined(VGP_amd64_darwin)
+#  if defined(VGO_linux) || defined(VGP_amd64_darwin)
    SysRes res = VG_(do_syscall3)(__NR_lseek, fd, offset, whence);
    vg_assert(sizeof(OffT) == sizeof(Word));
 #  elif defined(VGP_x86_darwin)
@@ -281,25 +277,6 @@
      return res;
    }
 
-#  elif defined(VGO_aix5)
-   { struct vki_stat buf;
-     res = VG_(do_syscall4)(__NR_AIX5_statx,
-                            (UWord)file_name,
-                            (UWord)&buf,
-                            sizeof(struct vki_stat),
-                            VKI_STX_NORMAL);
-     if (!sr_isError(res)) {
-        VG_(memset)(vgbuf, 0, sizeof(*vgbuf));
-        vgbuf->dev  = (ULong)buf.st_dev;
-        vgbuf->ino  = (ULong)buf.st_ino;
-        vgbuf->mode = (UInt)buf.st_mode;
-        vgbuf->uid  = (UInt)buf.st_uid;
-        vgbuf->gid  = (UInt)buf.st_gid;
-        vgbuf->size = (Long)buf.st_size;
-     }
-     return res;
-   }
-
 #  else
 #    error Unknown OS
 #  endif
@@ -331,9 +308,6 @@
      return sr_isError(res) ? (-1) : 0;
    }
 
-#  elif defined(VGO_aix5)
-   I_die_here;
-
 #  else
 #    error Unknown OS
 #  endif
@@ -364,10 +338,8 @@
 
 SysRes VG_(dup2) ( Int oldfd, Int newfd )
 {
-#  if defined(VGO_linux)  ||  defined(VGO_darwin)
+#  if defined(VGO_linux) || defined(VGO_darwin)
    return VG_(do_syscall2)(__NR_dup2, oldfd, newfd);
-#  elif defined(VGO_aix5)
-   I_die_here;
 #  else
 #    error Unknown OS
 #  endif
@@ -376,7 +348,7 @@
 /* Returns -1 on error. */
 Int VG_(fcntl) ( Int fd, Int cmd, Addr arg )
 {
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    SysRes res = VG_(do_syscall3)(__NR_fcntl, fd, cmd, arg);
 #  elif defined(VGO_darwin)
    SysRes res = VG_(do_syscall3)(__NR_fcntl_nocancel, fd, cmd, arg);
@@ -430,7 +402,7 @@
         return True;
      }
    }
-#  elif defined(VGO_aix5) || defined(VGO_darwin)
+#  elif defined(VGO_darwin)
    /* We can't ask the kernel, so instead rely on launcher-*.c to
       tell us the startup path.  Note the env var is keyed to the
       parent's PID, not ours, since our parent is the launcher
@@ -483,7 +455,7 @@
 
 Int VG_(getdents) (Int fd, struct vki_dirent *dirp, UInt count)
 {
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    SysRes res;
    /* res = getdents( fd, dirp, count ); */
    res = VG_(do_syscall3)(__NR_getdents, fd, (UWord)dirp, count);
@@ -594,15 +566,14 @@
    return 0;
 }
 
-/* DDD: Note this moves (or at least, is believed to move) the file pointer
-   on Linux and AIX5 but doesn't on Darwin.  This inconsistency should
-   be fixed.  (In other words, why isn't the Linux/AIX5 version implemented in
-   terms of pread()?) */
+/* DDD: Note this moves (or at least, is believed to move) the file
+   pointer on Linux but doesn't on Darwin.  This inconsistency should
+   be fixed.  (In other words, why isn't the Linux version implemented
+   in terms of pread()?) */
 SysRes VG_(pread) ( Int fd, void* buf, Int count, OffT offset )
 {
    SysRes res;
-#  if defined(VGO_linux) || defined(VGO_aix5)
-   /* Linux, AIX5 */
+#  if defined(VGO_linux)
    OffT off = VG_(lseek)( fd, offset, VKI_SEEK_SET);
    if (off < 0)
       return VG_(mk_SysRes_Error)( VKI_EINVAL );
@@ -667,10 +638,6 @@
    Socket-related stuff.
    ------------------------------------------------------------------ */
 
-#if defined(VGO_aix5)
-struct vki_sockaddr_in;
-#endif
-
 static
 Int parse_inet_addr_and_port ( UChar* str, UInt* ip_addr, UShort* port );
 
@@ -767,9 +734,6 @@
 
    return sd;
 
-#  elif defined(VGO_aix5)
-   I_die_here;
-
 #  else
 #    error "Unknown OS"
 #  endif
@@ -838,9 +802,6 @@
    res = VG_(do_syscall3)(__NR_socket, domain, type, protocol );
    return sr_isError(res) ? -1 : sr_Res(res);
 
-#  elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   I_die_here;
-
 #  elif defined(VGO_darwin)
    SysRes res;
    res = VG_(do_syscall3)(__NR_socket, domain, type, protocol);
@@ -879,9 +840,6 @@
    res = VG_(do_syscall3)(__NR_connect, sockfd, (UWord)serv_addr, addrlen);
    return sr_isError(res) ? -1 : sr_Res(res);
 
-#  elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   I_die_here;
-
 #  elif defined(VGO_darwin)
    SysRes res;
    res = VG_(do_syscall3)(__NR_connect_nocancel,
@@ -921,9 +879,6 @@
                                        count, VKI_MSG_NOSIGNAL, 0,0);
    return sr_isError(res) ? -1 : sr_Res(res);
 
-#  elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   I_die_here;
-
 #  elif defined(VGP_x86_darwin) || defined(VGP_amd64_darwin)
    SysRes res;
    res = VG_(do_syscall3)(__NR_write_nocancel, sd, (UWord)msg, count);
@@ -952,9 +907,6 @@
                            (UWord)sd, (UWord)name, (UWord)namelen );
    return sr_isError(res) ? -1 : sr_Res(res);
 
-#  elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   I_die_here;
-
 #  elif defined(VGO_darwin)
    SysRes res;
    res = VG_(do_syscall3)( __NR_getsockname,
@@ -984,9 +936,6 @@
                            (UWord)sd, (UWord)name, (UWord)namelen );
    return sr_isError(res) ? -1 : sr_Res(res);
 
-#  elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   I_die_here;
-
 #  elif defined(VGO_darwin)
    SysRes res;
    res = VG_(do_syscall3)( __NR_getpeername,
@@ -1020,9 +969,6 @@
                            (UWord)optval, (UWord)optlen );
    return sr_isError(res) ? -1 : sr_Res(res);
 
-#  elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   I_die_here;
-
 #  elif defined(VGO_darwin)
    SysRes res;
    res = VG_(do_syscall5)( __NR_getsockopt,
diff --git a/coregrind/m_libcproc.c b/coregrind/m_libcproc.c
index 96a233d..b24ce25 100644
--- a/coregrind/m_libcproc.c
+++ b/coregrind/m_libcproc.c
@@ -65,7 +65,7 @@
 const Char *VG_(libdir) = VG_LIBDIR;
 
 const Char *VG_(LD_PRELOAD_var_name) =
-#if defined(VGO_linux) || defined(VGO_aix5)
+#if defined(VGO_linux)
    "LD_PRELOAD";
 #elif defined(VGO_darwin)
    "DYLD_INSERT_LIBRARIES";
@@ -283,14 +283,6 @@
    SysRes res = VG_(do_syscall4)(__NR_wait4_nocancel,
                                  pid, (UWord)status, options, 0);
    return sr_isError(res) ? -1 : sr_Res(res);
-#  elif defined(VGO_aix5)
-   /* magic number 4 obtained by truss-ing a C program doing
-      'waitpid'.  Note status and pid args opposite way round from
-      POSIX. */
-   SysRes res = VG_(do_syscall5)(__NR_AIX5_kwaitpid, 
-                                 (UWord)status, pid, 4 | options,0,0);
-   if (0) VG_(printf)("waitpid: got 0x%lx 0x%lx\n", sr_Res(res), res.err);
-   return sr_isError(res) ? -1 : sr_Res(res);
 #  else
 #    error Unknown OS
 #  endif
@@ -474,14 +466,6 @@
 
    return sr_Res(res);
 
-#  elif defined(VGO_aix5)
-   SysRes res;
-   Int    r;
-   vg_assert(__NR_AIX5__thread_self != __NR_AIX5_UNKNOWN);
-   res = VG_(do_syscall0)(__NR_AIX5__thread_self);
-   r = sr_Res(res);
-   return r;
-
 #  elif defined(VGO_darwin)
    // Darwin's gettid syscall is something else.
    // Use Mach thread ports for lwpid instead.
@@ -514,9 +498,7 @@
 Int VG_(geteuid) ( void )
 {
    /* ASSUMES SYSCALL ALWAYS SUCCEEDS */
-#  if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   return sr_Res( VG_(do_syscall1)(__NR_AIX5_getuidx, 1) );
-#  elif defined(__NR_geteuid32)
+#  if defined(__NR_geteuid32)
    // We use the 32-bit version if it's supported.  Otherwise, IDs greater
    // than 65536 cause problems, as bug #151209 showed.
    return sr_Res( VG_(do_syscall0)(__NR_geteuid32) );
@@ -528,9 +510,7 @@
 Int VG_(getegid) ( void )
 {
    /* ASSUMES SYSCALL ALWAYS SUCCEEDS */
-#  if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   return sr_Res( VG_(do_syscall1)(__NR_AIX5_getgidx, 1) );
-#  elif defined(__NR_getegid32)
+#  if defined(__NR_getegid32)
    // We use the 32-bit version if it's supported.  Otherwise, IDs greater
    // than 65536 cause problems, as bug #151209 showed.
    return sr_Res( VG_(do_syscall0)(__NR_getegid32) );
@@ -562,7 +542,6 @@
 
 #  elif defined(VGP_amd64_linux) || defined(VGP_ppc64_linux)  \
         || defined(VGP_arm_linux)                             \
-        || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) \
         || defined(VGO_darwin) || defined(VGP_s390x_linux)
    SysRes sres;
    sres = VG_(do_syscall2)(__NR_getgroups, size, (Addr)list);
@@ -594,7 +573,7 @@
 
 Int VG_(fork) ( void )
 {
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    SysRes res;
    res = VG_(do_syscall0)(__NR_fork);
    if (sr_isError(res))
@@ -642,25 +621,6 @@
      }
    }
 
-#  elif defined(VGO_aix5)
-   /* AIX requires a totally different implementation since
-      sys_gettimeofday doesn't exist.  We use the POWER real-time
-      register facility.  This will SIGILL on PowerPC 970 on AIX,
-      since PowerPC doesn't support these instructions. */
-   UWord nsec, sec1, sec2;
-   while (1) {
-      __asm__ __volatile__ ("\n"
-         "\tmfspr %0,4\n" /* 4==RTCU */
-         "\tmfspr %1,5\n" /* 5==RTCL */
-         "\tmfspr %2,4\n" /* 4==RTCU */
-         : "=b" (sec1), "=b" (nsec), "=b" (sec2)
-      );
-      if (sec1 == sec2) break;
-   }
-   vg_assert(nsec < 1000*1000*1000);
-   now  = ((ULong)sec1) * 1000000ULL;
-   now += (ULong)(nsec / 1000);
-
 #  elif defined(VGO_darwin)
    // Weird: it seems that gettimeofday() doesn't fill in the timeval, but
    // rather returns the tv_sec as the low 32 bits of the result and the
diff --git a/coregrind/m_libcsignal.c b/coregrind/m_libcsignal.c
index 9d881da..dad69c7 100644
--- a/coregrind/m_libcsignal.c
+++ b/coregrind/m_libcsignal.c
@@ -44,8 +44,6 @@
 
 /* sigemptyset, sigfullset, sigaddset and sigdelset return 0 on
    success and -1 on error.  */
-/* I believe the indexing scheme in ->sig[] is also correct for
-   32- and 64-bit AIX (verified 27 July 06). */
 /* In the sigset routines below, be aware that _VKI_NSIG_BPW can be
    either 32 or 64, and hence the sig[] words can either be 32- or
    64-bits.  And which they are it doesn't necessarily follow from the
@@ -176,7 +174,7 @@
 */
 Int VG_(sigprocmask)( Int how, const vki_sigset_t* set, vki_sigset_t* oldset)
 {
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
 #  if defined(__NR_rt_sigprocmask)
    SysRes res = VG_(do_syscall4)(__NR_rt_sigprocmask, 
                                  how, (UWord)set, (UWord)oldset, 
@@ -221,7 +219,7 @@
                      const vki_sigaction_toK_t* act,  
                      vki_sigaction_fromK_t* oldact)
 {
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    /* Normal case: vki_sigaction_toK_t and vki_sigaction_fromK_t are
       identical types. */
    SysRes res = VG_(do_syscall4)(__NR_rt_sigaction,
@@ -285,7 +283,7 @@
 VG_(convert_sigaction_fromK_to_toK)( vki_sigaction_fromK_t* fromK,
                                      /*OUT*/vki_sigaction_toK_t* toK )
 {
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    *toK = *fromK;
 #  elif defined(VGO_darwin)
    toK->ksa_handler = fromK->ksa_handler;
@@ -300,7 +298,7 @@
 
 Int VG_(kill)( Int pid, Int signo )
 {
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    SysRes res = VG_(do_syscall2)(__NR_kill, pid, signo);
 #  elif defined(VGO_darwin)
    SysRes res = VG_(do_syscall3)(__NR_kill,
@@ -345,7 +343,7 @@
 
    The Linux implementation is trivial: do the corresponding syscall.
 
-   The AIX implementation is horrible and probably broken in a dozen
+   The Darwin implementation is horrible and probably broken in a dozen
    obscure ways.  I suspect it's only thread-safe because V forces
    single-threadedness. */
 
@@ -361,97 +359,6 @@
    return sr_isError(res) ? -1 : sr_Res(res);
 }
 
-/* ---------- sigtimedwait_zero: AIX5 ----------- */
-
-#elif defined(VGO_aix5)
-/* The general idea is:
-   - use sigpending to find out which signals are pending
-   - choose one
-   - temporarily set its handler to sigtimedwait_zero_handler
-   - use sigsuspend atomically unblock it and wait for the signal.
-     Upon return, sigsuspend restores the signal mask to what it
-     was to start with.
-   - Restore the handler for the signal to whatever it was before.
-*/
-
-/* A signal handler which does nothing (it doesn't need to).  It does
-   however check that it's not handing a sync signal for which
-   returning is meaningless. */
-static void sigtimedwait_zero_handler ( Int sig ) 
-{ 
-   vg_assert(sig != VKI_SIGILL);
-   vg_assert(sig != VKI_SIGSEGV);
-   vg_assert(sig != VKI_SIGBUS);
-   vg_assert(sig != VKI_SIGTRAP);
-   /* do nothing */ 
-}
-
-Int VG_(sigtimedwait_zero)( const vki_sigset_t *set, 
-                            vki_siginfo_t *info )
-{
-  Int    i, ir;
-  SysRes sr;
-  vki_sigset_t pending, blocked, allbutone;
-  struct vki_sigaction sa, saved_sa;
-
-  /* Find out what's pending: AIX _sigpending */
-  sr = VG_(do_syscall1)(__NR__sigpending, (UWord)&pending);
-  vg_assert(!sr.isError);
-
-  /* don't try for signals not in 'set' */
-  /* pending = pending `intersect` set */
-  VG_(sigintersectset)(&pending, set);
-
-  /* don't try for signals not blocked at the moment */
-  ir = VG_(sigprocmask)(VKI_SIG_SETMASK, NULL, &blocked);
-  vg_assert(ir == 0);
-
-  /* pending = pending `intersect` blocked */
-  VG_(sigintersectset)(&pending, blocked);
-
-  /* decide which signal we're going to snarf */
-  for (i = 1; i < _VKI_NSIG; i++)
-     if (VG_(sigismember)(&pending,i))
-        break;
-
-  if (i == _VKI_NSIG)
-     return 0;
-
-  /* fetch signal i.
-     pre: i is blocked and pending
-     pre: we are the only thread running 
-  */
-  /* Set up alternative signal handler */
-  VG_(sigfillset)(&allbutone);
-  VG_(sigdelset)(&allbutone, i);
-  sa.sa_mask     = allbutone;
-  sa.ksa_handler = &sigtimedwait_zero_handler;
-  sa.sa_flags    = 0;
-  ir = VG_(sigaction)(i, &sa, &saved_sa);
-  vg_assert(ir == 0);
-
-  /* Switch signal masks and wait for the signal.  This should happen
-     immediately, since we've already established it is pending and
-     blocked. */
-  sr = VG_(do_syscall1)(__NR__sigsuspend, (UWord)&allbutone);
-  vg_assert(sr.isError);
-  if (0)
-     VG_(debugLog)(0, "libcsignal",
-                      "sigtimedwait_zero: sigsuspend got res %ld err %ld\n", 
-                      sr.res, sr.err);
-  vg_assert(sr.res == (UWord)-1);
-
-  /* Restore signal's handler to whatever it was before */
-  ir = VG_(sigaction)(i, &saved_sa, NULL);
-  vg_assert(ir == 0);
-
-  /* This is bogus - we could get more info from the sighandler. */
-  VG_(memset)( info, 0, sizeof(*info) );
-  info->si_signo = i;
-
-  return i;
-}
-
 /* ---------- sigtimedwait_zero: Darwin ----------- */
 
 #elif defined(VGO_darwin)
@@ -466,6 +373,19 @@
 //   VG_(printf)("}\n");
 //}
 
+/* The general idea is:
+   - use sigpending to find out which signals are pending
+   - choose one
+   - temporarily set its handler to sigtimedwait_zero_handler
+   - use sigsuspend atomically unblock it and wait for the signal.
+     Upon return, sigsuspend restores the signal mask to what it
+     was to start with.
+   - Restore the handler for the signal to whatever it was before.
+*/
+
+/* A signal handler which does nothing (it doesn't need to).  It does
+   however check that it's not handing a sync signal for which
+   returning is meaningless. */
 static void sigtimedwait_zero_handler ( Int sig ) 
 {
    /* XXX this is wrong -- get rid of these.  We could
diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c
index 8c38168..3f2b14c 100644
--- a/coregrind/m_machine.c
+++ b/coregrind/m_machine.c
@@ -127,11 +127,6 @@
 #  elif defined(VGP_arm_linux)
    VG_(threads)[tid].arch.vex_shadow1.guest_R0 = s1res;
    VG_(threads)[tid].arch.vex_shadow2.guest_R0 = s2res;
-#  elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   VG_(threads)[tid].arch.vex_shadow1.guest_GPR3 = s1res;
-   VG_(threads)[tid].arch.vex_shadow2.guest_GPR3 = s2res;
-   VG_(threads)[tid].arch.vex_shadow1.guest_GPR4 = s1err;
-   VG_(threads)[tid].arch.vex_shadow2.guest_GPR4 = s2err;
 #  elif defined(VGO_darwin)
    // GrP fixme darwin syscalls may return more values (2 registers plus error)
 #  elif defined(VGP_s390x_linux)
@@ -1280,21 +1275,20 @@
 // produce a pointer to the actual entry point for the function.
 void* VG_(fnptr_to_fnentry)( void* f )
 {
-#if defined(VGP_x86_linux) || defined(VGP_amd64_linux)  \
-    || defined(VGP_arm_linux)                           \
-    || defined(VGP_ppc32_linux) || defined(VGO_darwin)  \
-    || defined(VGP_s390x_linux)
+#  if defined(VGP_x86_linux) || defined(VGP_amd64_linux)  \
+      || defined(VGP_arm_linux)                           \
+      || defined(VGP_ppc32_linux) || defined(VGO_darwin)  \
+      || defined(VGP_s390x_linux)
    return f;
-#elif defined(VGP_ppc64_linux) || defined(VGP_ppc32_aix5) \
-                               || defined(VGP_ppc64_aix5)
-   /* All other ppc variants use the AIX scheme, in which f is a
-      pointer to a 3-word function descriptor, of which the first word
-      is the entry address. */
+#  elif defined(VGP_ppc64_linux)
+   /* ppc64-linux uses the AIX scheme, in which f is a pointer to a
+      3-word function descriptor, of which the first word is the entry
+      address. */
    UWord* descr = (UWord*)f;
    return (void*)(descr[0]);
-#else
-#  error "Unknown platform"
-#endif
+#  else
+#    error "Unknown platform"
+#  endif
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index a3e7910..a3d21be 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -66,15 +66,6 @@
 #include "pub_core_trampoline.h"
 #include "pub_core_transtab.h"
 
-/* Stuff for reading AIX5 /proc/<pid>/sysent files */
-#if defined(VGO_aix5)
-   /* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#  include <sys/procfs.h>  /* prsysent_t */
-   /* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-#  define VG_AIX5_SYSENT_SIZE 100000
-   static UChar aix5_sysent_buf[VG_AIX5_SYSENT_SIZE];
-#endif
-
 
 /*====================================================================*/
 /*=== Counters, for profiling purposes only                        ===*/
@@ -1258,16 +1249,6 @@
       VG_(printf)("fd limits: host, before: cur %lu max %lu\n", 
                   (UWord)rl.rlim_cur, (UWord)rl.rlim_max);
 
-#  if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   /* I don't know why this kludge is needed; however if rl.rlim_cur
-      is RLIM_INFINITY, then VG_(safe_fd)'s attempts using VG_(fcntl)
-      to lift V's file descriptors above the threshold RLIM_INFINITY -
-      N_RESERVED_FDS fail.  So just use a relatively conservative
-      value in this case. */
-   if (rl.rlim_cur > 1024)
-      rl.rlim_cur = 1024;
-#  endif
-
    /* Work out where to move the soft limit to. */
    if (rl.rlim_cur + N_RESERVED_FDS <= rl.rlim_max) {
       rl.rlim_cur = rl.rlim_cur + N_RESERVED_FDS;
@@ -1482,60 +1463,6 @@
                             VERSION " debug logging\n");
 
    //--------------------------------------------------------------
-   // AIX5 only: register the system call numbers
-   //   p: logging
-   //   p: that the initial few syscall numbers stated in the
-   //      bootblock have been installed (else we can't 
-   //      open/read/close).
-   //--------------------------------------------------------------
-#  if defined(VGO_aix5)
-   VG_(debugLog)(1, "main", "aix5: registering syscalls ..\n");
-   { UChar  sysent_name[50];
-     SysRes fd;
-     Bool   ok;
-     Int    n_unregd, sysent_used = 0;
-     prsysent_t* sysent_hdr;
-
-     VG_(sprintf)(sysent_name, "/proc/%d/sysent", VG_(getpid)());
-     fd = VG_(open)(sysent_name, VKI_O_RDONLY, 0);
-     if (fd.isError)
-        VG_(err_config_error)("aix5: can't open /proc/<pid>/sysent");
-
-     sysent_used = VG_(read)(fd.res, aix5_sysent_buf, VG_AIX5_SYSENT_SIZE);
-     if (sysent_used < 0)
-        VG_(err_config_error)("aix5: error reading /proc/<pid>/sysent");
-     if (sysent_used >= VG_AIX5_SYSENT_SIZE)
-        VG_(err_config_error)("aix5: VG_AIX5_SYSENT_SIZE is too low; "
-                              "increase and recompile");
-     VG_(close)(fd.res);
-
-     vg_assert(sysent_used > 0 && sysent_used < VG_AIX5_SYSENT_SIZE);
-
-     sysent_hdr = (prsysent_t*)&aix5_sysent_buf[0];
-
-     n_unregd = 0;
-     for (i = 0; i < sysent_hdr->pr_nsyscalls; i++) {
-        UChar* name = &aix5_sysent_buf[ sysent_hdr
-                                        ->pr_syscall[i].pr_nameoff ];
-        UInt   nmbr = sysent_hdr->pr_syscall[i].pr_number;
-        VG_(debugLog)(3, "main", "aix5: bind syscall %d to \"%s\"\n", 
-                                 nmbr, name);
-        ok = VG_(aix5_register_syscall)(nmbr, name);
-        if (!ok)
-           n_unregd++;
-	if (!ok)
-           VG_(debugLog)(3, "main", 
-                            "aix5: bind FAILED: %d to \"%s\"\n", 
-                            nmbr, name);
-     }
-     VG_(debugLog)(1, "main", "aix5: .. %d syscalls known, %d unknown\n",
-                      sysent_hdr->pr_nsyscalls - n_unregd, n_unregd );
-     VG_(debugLog)(1, "main", "aix5: __NR_AIX5_FAKE_SIGRETURN = %d\n",
-                      __NR_AIX5_FAKE_SIGRETURN );
-   }
-#  endif
-
-   //--------------------------------------------------------------
    // Ensure we're on a plausible stack.
    //   p: logging
    //--------------------------------------------------------------
@@ -1667,7 +1594,7 @@
 
    //--------------------------------------------------------------
    // Record the working directory at startup
-   //   p: none (Linux), getenv and sys_getpid work (AIX)
+   //   p: none
    VG_(debugLog)(1, "main", "Getting the working directory at startup\n");
    { Bool ok = VG_(record_startup_wd)();
      if (!ok) 
@@ -1712,18 +1639,6 @@
          );
    }
 
-#  if defined(VGO_aix5)
-   /* Tolerate ptraced-based launchers.  They can't run 'no program'
-      if the user types "valgrind --help", so they run a do-nothing
-      program $prefix/bin/no_op_client_for_valgrind, and we catch that
-      here and turn it the exe name back into NULL.  Then --help,
-      --version etc work as they should. */
-   if (VG_(args_the_exename) 
-       && VG_(strstr)( VG_(args_the_exename), "/no_op_client_for_valgrind" )) {
-      VG_(args_the_exename) = NULL;
-   }
-#  endif
-
    //--------------------------------------------------------------
    // Extract tool name and whether help has been requested.
    // Note we can't print the help message yet, even if requested,
@@ -1766,37 +1681,12 @@
       the_iicii.argv              = argv;
       the_iicii.envp              = envp;
       the_iicii.toolname          = toolname;
-#     elif defined(VGO_aix5)
-      /* the_iicii.intregs37      already set up */
-      /* the_iicii.bootblock      already set up */
-      /* the_iicii.adler32_exp    already set up */
-      /* the_iicii.sp_at_startup  is irrelevant */
-      /* the_iicii.clstack_top    is irrelevant */
-      the_iicii.toolname          = toolname;
 #     else
 #       error "Unknown platform"
 #     endif
 
       /* NOTE: this call reads VG_(clo_main_stacksize). */
       the_iifii = VG_(ii_create_image)( the_iicii );
-
-#     if defined(VGO_aix5)
-      /* Tell aspacem where the initial client stack is, so that it
-         can later produce a faked-up NSegment in response to
-         VG_(am_find_nsegment) for that address range, if asked. */
-      /* NOTE: this call reads VG_(clo_main_stacksize). */
-      VG_(am_aix5_set_initial_client_sp)( the_iifii.initial_client_SP );
-      /* Now have a look at said fake segment, so we can find out
-         the size of it. */
-      { SizeT sz;
-        NSegment const* seg 
-           = VG_(am_find_nsegment)( the_iifii.initial_client_SP );
-        vg_assert(seg);
-        sz = seg->end - seg->start + 1;
-        vg_assert(sz >= 0 && sz <= (256+1)*1024*1024); /* stay sane */
-        the_iifii.clstack_max_size = sz;
-      }
-#     endif
    }
 
    //==============================================================
@@ -1966,8 +1856,6 @@
       iters = 1;
 #     elif defined(VGP_s390x_linux)
       iters = 10;
-#     elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-      iters = 4;
 #     elif defined(VGO_darwin)
       iters = 3;
 #     else
@@ -1996,7 +1884,7 @@
    //   p: initialise m_debuginfo
    //
    // While doing this, make a note of the debuginfo-handles that
-   // come back from VG_(di_notify_mmap)/VG_(di_aix5_notify_segchange).
+   // come back from VG_(di_notify_mmap).
    // Later, in "Tell the tool about the initial client memory permissions"
    // (just below) we can then hand these handles off to the tool in
    // calls to VG_TRACK(new_mem_startup, ...).  This gives the tool the
@@ -2036,42 +1924,6 @@
 
      VG_(free)( seg_starts );
    }
-#  elif defined(VGO_aix5)
-   { AixCodeSegChange* changes;
-     Int changes_size, changes_used;
-     Addr_n_ULong anu;
-
-     /* Find out how many AixCodeSegChange records we will need,
-	and acquire them. */
-     changes_size = VG_(am_aix5_reread_procmap_howmany_directives)(); 
-     changes = VG_(malloc)("main.vm.3", changes_size * sizeof(AixCodeSegChange));
-     vg_assert(changes);
-
-     /* Now re-read /proc/<pid>/map and acquire a change set */
-     VG_(am_aix5_reread_procmap)( changes, &changes_used );
-     vg_assert(changes_used >= 0 && changes_used <= changes_size);
-
-     /* And notify m_debuginfo of the changes. */
-     for (i = 0; i < changes_used; i++) {
-        anu.ull = VG_(di_aix5_notify_segchange)(
-                     changes[i].code_start,
-                     changes[i].code_len,
-                     changes[i].data_start,
-                     changes[i].data_len,
-                     changes[i].file_name,
-                     changes[i].mem_name,
-                     changes[i].is_mainexe,
-                     changes[i].acquire
-                  );
-        if (anu.ull > 0) {
-           tl_assert(changes[i].acquire);
-           anu.a = changes[i].code_start; /* is this correct? */
-           VG_(addToXA)( addr2dihandle, &anu );
-        }
-     }
-
-     VG_(free)(changes);
-   }
 #  elif defined(VGO_darwin)
    { Addr* seg_starts;
      Int   n_seg_starts;
@@ -2214,10 +2066,6 @@
        vg_assert(seg->kind == SkAnonC);
        vg_assert(the_iifii.initial_client_SP >= seg->start);
        vg_assert(the_iifii.initial_client_SP <= seg->end);
-#      if defined(VGO_aix5)
-       VG_(clstk_base) = seg->start;
-       VG_(clstk_end) = seg->end;
-#      endif
 
        /* Stuff below the initial SP is unaddressable.  Take into
 	  account any ABI-mandated space below the stack pointer that
@@ -2349,7 +2197,7 @@
 }
 
 /* Do everything which needs doing when the last thread exits or when
-   a thread exits requesting a complete process exit (exit on AIX).
+   a thread exits requesting a complete process exit.
 
    We enter here holding The Lock.  For the case VgSrc_ExitProcess we
    must never release it, because to do so would allow other threads
@@ -2500,7 +2348,7 @@
 
    switch (tids_schedretcode) {
    case VgSrc_ExitThread:  /* the normal way out (Linux) */
-   case VgSrc_ExitProcess: /* the normal way out (AIX) */
+   case VgSrc_ExitProcess: /* the normal way out (AIX) -- still needed? */
       /* Change the application return code to user's return code,
          if an error was found */
       if (VG_(clo_error_exitcode) > 0 
@@ -2555,9 +2403,6 @@
         !VG_(clo_run_libc_freeres) ||
         0 == __libc_freeres_wrapper )
       return;			/* can't/won't do it */
-#  if defined(VGO_aix5)
-   return; /* inapplicable on non-Linux platforms */
-#  endif
 
 #  if defined(VGP_ppc64_linux)
    r2 = VG_(get_tocptr)( __libc_freeres_wrapper );
@@ -2925,121 +2770,6 @@
 
 
 /*====================================================================*/
-/*=== Getting to main() alive: AIX5                                ===*/
-/*====================================================================*/
-
-#elif defined(VGO_aix5)
-
-/* This is somewhat simpler than the Linux case.  _start_valgrind
-   receives control from the magic piece of code created in this
-   process' address space by the launcher, via use of ptrace().  At
-   the point of entry:
-
-   - the initial client process image is in memory and ready to roll,
-     except that we've partially trashed its integer register state
-     in order to get this far.   So ..
-
-   - intregs37 holds the client's initial integer register state, so
-     we can restore it before starting the client on the VCPU.
-
-   - we're on the client's stack.  This is not good; therefore the
-     first order of business is to switch to our temporary stack.  
-
-   - the client's initial argc/v/envp is in r3/r4/r5 (32 bit mode) or
-     r14/r15/r16 (64 bit mode).  They are pulled out of the stashed
-     integer register state and passed to our main().
-
-   The launcher will have played some games with argv.  If the launcher
-   ($prefix/bin/valgrind) was started like this
-
-      valgrind [args-for-V] app [args-for-app]
-
-   then the launcher will have started the client as
-
-      app [args-for-V] app [args-for-app]
-
-   m_initimg will have to mess with the client's initial r4/r5
-   (32-bit) or r15/r16 (64-bit) so that it believes it was execd as
-   "app [args-for-app]".  Well, that's no big deal.
-*/
-
-#include "launcher-aix5-bootblock.h"
-
-void _start_in_C_aix5 ( AIX5Bootblock* bootblock );
-void _start_in_C_aix5 ( AIX5Bootblock* bootblock )
-{
-   Int     r;
-   ULong* intregs37;
-   UWord   argc, argv, envp;
-   __NR_getpid = bootblock->__NR_getpid;
-   __NR_write  = bootblock->__NR_write;
-   __NR_exit   = bootblock->__NR_exit;
-   __NR_open   = bootblock->__NR_open;
-   __NR_read   = bootblock->__NR_read;
-   __NR_close  = bootblock->__NR_close;
-
-   VG_(memset)( &the_iicii, 0, sizeof(the_iicii) );
-   VG_(memset)( &the_iifii, 0, sizeof(the_iifii) );
-
-   intregs37 = &bootblock->iregs_pc_cr_lr_ctr_xer[0];
-   the_iicii.intregs37   = intregs37;
-   the_iicii.bootblock   = (void*)bootblock;
-   the_iicii.adler32_exp = bootblock->adler32;
-
-   /* Not important on AIX. */
-   the_iicii.sp_at_startup = (Addr)0x31415927ULL;
-
-#  if defined(VGP_ppc32_aix5)
-   argc = (UWord)intregs37[3];  /* client's r3 == argc */
-   argv = (UWord)intregs37[4];
-   envp = (UWord)intregs37[5];
-#  else /* defined(VGP_ppc64_aix5) */
-   argc = (UWord)intregs37[14];  /* client's r14 == argc */
-   argv = (UWord)intregs37[15];
-   envp = (UWord)intregs37[16];
-#  endif
-
-   r = valgrind_main( (Int)argc, (HChar**)argv, (HChar**)envp );
-
-   /* NOTREACHED */
-   VG_(exit)(r);
-}
-
-/* THE ENTRY POINT */
-void _start_valgrind ( AIX5Bootblock* bootblock );
-void _start_valgrind ( AIX5Bootblock* bootblock )
-{
-   /* Switch immediately to our temporary stack, and continue.  This
-      is pretty dodgy in that it assumes that gcc does not place on
-      the stack, anything needed to form the _start_in_C_aix5 call,
-      since it will be on the old stack. */
-   register UWord new_r1;
-   new_r1  = (UWord)&VG_(interim_stack);
-   new_r1 += VG_STACK_GUARD_SZB;  /* step over lower guard page */
-   new_r1 += VG_STACK_ACTIVE_SZB; /* step to top of active area */
-   new_r1 -= 512; /* paranoia */
-   __asm__ __volatile__("mr 1,%0" :/*wr*/ 
-                                  :/*rd*/ "b"(new_r1) 
-                                  :/*trash*/"r1","memory");
-   _start_in_C_aix5(bootblock);
-   /*NOTREACHED*/
-   VG_(exit)(0);
-}
-
-/* At some point in Oct 2008, static linking appeared to stop working
-   on AIX 5.3.  This breaks the build since we link statically.  The
-   linking fails citing absence of the following five symbols as the
-   reason.  In the absence of a better solution, here are stand-ins
-   for them.  Kludge appears to work; presumably said functions,
-   assuming they are indeed functions, are never called. */
-void encrypted_pw_passlen ( void ) { vg_assert(0); }
-void crypt_r              ( void ) { vg_assert(0); }
-void max_history_size     ( void ) { vg_assert(0); }
-void getpass_auto         ( void ) { vg_assert(0); }
-void max_pw_passlen       ( void ) { vg_assert(0); }
-
-
-/*====================================================================*/
 /*=== Getting to main() alive: darwin                              ===*/
 /*====================================================================*/
 
diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c
index 6199f16..765da4a 100644
--- a/coregrind/m_mallocfree.c
+++ b/coregrind/m_mallocfree.c
@@ -578,18 +578,10 @@
             VG_(exit)(1);
          }
       }
-      // Initialise the client arena.  On AIX it's important to have
-      // relatively large client blocks so as not to cause excessively
-      // fine-grained interleaving of V and C address space.  On Linux
-      // this is irrelevant since aspacem can keep the two spaces
-      // well apart, but not so on AIX.  On all platforms though, 
+      // Initialise the client arena.  On all platforms,
       // increasing the superblock size reduces the number of superblocks
       // in the client arena, which makes findSb cheaper.
-#     if defined(VGO_aix5)
-      ar_client_sbszB = 16777216;
-#     else
       ar_client_sbszB = 4194304;
-#     endif
       arena_init ( VG_AR_CLIENT,    "client",   client_rz_szB, ar_client_sbszB );
       client_inited = True;
 
diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
index 7618690..ef38977 100644
--- a/coregrind/m_redir.c
+++ b/coregrind/m_redir.c
@@ -291,7 +291,6 @@
 static void   dinfo_free(void*);
 static HChar* dinfo_strdup(HChar* ec, HChar*);
 static Bool   is_plausible_guest_addr(Addr);
-static Bool   is_aix5_glink_idiom(Addr);
 
 static void   show_redir_state ( HChar* who );
 static void   show_active ( HChar* left, Active* act );
@@ -555,16 +554,6 @@
       if (!isText)
          continue;
 
-      /* On AIX, we cannot redirect calls to a so-called glink
-         function for reasons which are not obvious - something to do
-         with saving r2 across the call.  Not a problem, as we don't
-         want to anyway; presumably it is the target of the glink we
-         need to redirect.  Hence just spot them and ignore them.
-         They are always of a very specific (more or less
-         ABI-mandated) form. */
-      if (is_aix5_glink_idiom(sym_addr))
-         continue;
-
       for (sp = specs; sp; sp = sp->next) {
          if (!sp->mark)
             continue; /* soname doesn't match */
@@ -1040,12 +1029,6 @@
    }
    /* nothing so far */
 
-#  elif defined(VGP_ppc32_aix5)
-   /* nothing so far */
-
-#  elif defined(VGP_ppc64_aix5)
-   /* nothing so far */
-
 #  elif defined(VGP_x86_darwin)
    /* If we're using memcheck, use these intercepts right from
       the start, otherwise dyld makes a lot of noise. */
@@ -1126,43 +1109,6 @@
           && (seg->hasX || seg->hasR); /* crude x86-specific hack */
 }
 
-/* A function which spots AIX 'glink' functions.  A 'glink' function
-   is a stub function which has something to do with AIX-style dynamic
-   linking, and jumps to the real target (with which it typically
-   shares the same name).  See also comment where this function is
-   used (above). */
-static Bool is_aix5_glink_idiom ( Addr sym_addr )
-{
-#  if defined(VGP_ppc32_aix5)
-   UInt* w = (UInt*)sym_addr;
-   if (VG_IS_4_ALIGNED(w)
-       && is_plausible_guest_addr((Addr)(w+0))
-       && is_plausible_guest_addr((Addr)(w+6))
-       && (w[0] & 0xFFFF0000) == 0x81820000 /* lwz r12,func@toc(r2) */
-       && w[1] == 0x90410014                /* stw r2,20(r1) */
-       && w[2] == 0x800c0000                /* lwz r0,0(r12) */
-       && w[3] == 0x804c0004                /* lwz r2,4(r12) */
-       && w[4] == 0x7c0903a6                /* mtctr r0 */
-       && w[5] == 0x4e800420                /* bctr */
-       && w[6] == 0x00000000                /* illegal */)
-      return True;
-#  elif defined(VGP_ppc64_aix5)
-   UInt* w = (UInt*)sym_addr;
-   if (VG_IS_4_ALIGNED(w)
-       && is_plausible_guest_addr((Addr)(w+0))
-       && is_plausible_guest_addr((Addr)(w+6))
-       && (w[0] & 0xFFFF0000) == 0xE9820000 /* ld  r12,func@toc(r2) */
-       && w[1] == 0xF8410028                /* std r2,40(r1) */
-       && w[2] == 0xE80C0000                /* ld  r0,0(r12) */
-       && w[3] == 0xE84C0008                /* ld  r2,8(r12) */
-       && w[4] == 0x7c0903a6                /* mtctr r0 */
-       && w[5] == 0x4e800420                /* bctr */
-       && w[6] == 0x00000000                /* illegal */)
-      return True;
-#  endif
-   return False;
-}
-
 
 /*------------------------------------------------------------*/
 /*--- NOTIFY-ON-LOAD FUNCTIONS                             ---*/
diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c
index 612bf41..26a4d01 100644
--- a/coregrind/m_replacemalloc/vg_replace_malloc.c
+++ b/coregrind/m_replacemalloc/vg_replace_malloc.c
@@ -86,30 +86,6 @@
 __attribute__ ((__noreturn__))
 extern void _exit(int);
 
-/* Apparently it is necessary to make ourselves free of any dependency
-   on memcpy() on ppc32-aix5; else programs linked with -brtl fail.
-   memcpy() is used by gcc for a struct assignment in mallinfo()
-   below.  Add the following conservative implementation (memmove,
-   really). */
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-__attribute__((weak))
-void *memcpy(void *destV, const void *srcV, unsigned long n)
-{
-   unsigned char* src = (unsigned char*)srcV;
-   unsigned char* dest = (unsigned char*)destV;
-   unsigned long  i;
-   if (dest < src) {
-      for (i = 0; i < n; i++)
-         dest[i] = src[i];
-   }
-   if (dest > src) {
-      for (i = n; i > 0; i--)
-         dest[i-1] = src[i-1];
-   }
-   return dest;
-}
-#endif
-
 
 /* Compute the high word of the double-length unsigned product of U
    and V.  This is for calloc argument overflow checking; see comments
@@ -234,9 +210,7 @@
 // malloc
 ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, malloc,      malloc);
 ALLOC_or_NULL(VG_Z_LIBC_SONAME,      malloc,      malloc);
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-ALLOC_or_NULL(VG_Z_LIBC_SONAME,      malloc_common, malloc);
-#elif defined(VGO_darwin)
+#if defined(VGO_darwin)
 ZONEALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc_zone_malloc, malloc);
 #endif
 
@@ -257,16 +231,11 @@
 #endif
 
 // operator new(unsigned long), GNU mangling
-#if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGO_darwin)
+#if VG_WORDSIZE == 8 || defined(VGO_darwin)
  ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znwm,          __builtin_new);
  ALLOC_or_BOMB(VG_Z_LIBC_SONAME,      _Znwm,          __builtin_new);
 #endif
 
-// operator new(unsigned long), ARM/cfront mangling
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_BOMB(VG_Z_LIBC_DOT_A,       __nw__FUl,      __builtin_new);
-#endif
-
 
 /*---------------------- new nothrow ----------------------*/
 
@@ -277,16 +246,11 @@
 #endif
 
 // operator new(unsigned long, std::nothrow_t const&), GNU mangling
-#if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) || defined(VGO_darwin)
+#if VG_WORDSIZE == 8 || defined(VGO_darwin)
  ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnwmRKSt9nothrow_t,  __builtin_new);
  ALLOC_or_NULL(VG_Z_LIBC_SONAME,      _ZnwmRKSt9nothrow_t,  __builtin_new);
 #endif
 
-// operator new(unsigned long, std::nothrow_t const&), ARM/cfront mangling
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_NULL(VG_Z_LIBC_DOT_A,    __nw__FUlRCQ2_3std9nothrow_t, __builtin_new);
-#endif
-
 
 /*---------------------- new [] ----------------------*/
 
@@ -301,16 +265,11 @@
 #endif
 
 // operator new[](unsigned long), GNU mangling
-#if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) || defined(VGO_darwin)
+#if VG_WORDSIZE == 8 || defined(VGO_darwin)
  ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znam,             __builtin_vec_new );
  ALLOC_or_BOMB(VG_Z_LIBC_SONAME,      _Znam,             __builtin_vec_new );
 #endif
 
-// operator new[](unsigned long), ARM/cfront mangling
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_BOMB(VG_Z_LIBC_DOT_A,       __vn__FUl,         __builtin_vec_new);
-#endif
-
 
 /*---------------------- new [] nothrow ----------------------*/
 
@@ -321,16 +280,11 @@
 #endif
 
 // operator new[](unsigned long, std::nothrow_t const&), GNU mangling
-#if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) || defined(VGO_darwin)
+#if VG_WORDSIZE == 8 || defined(VGO_darwin)
  ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnamRKSt9nothrow_t, __builtin_vec_new );
  ALLOC_or_NULL(VG_Z_LIBC_SONAME,      _ZnamRKSt9nothrow_t, __builtin_vec_new );
 #endif
 
-// operator new [](unsigned long, std::nothrow_t const&), ARM/cfront mangling
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
- ALLOC_or_BOMB(VG_Z_LIBC_DOT_A,   __vn__FUlRCQ2_3std9nothrow_t, __builtin_vec_new );
-#endif
-
 
 /*---------------------- free ----------------------*/
 
@@ -364,9 +318,7 @@
 // free
 FREE(VG_Z_LIBSTDCXX_SONAME,  free,                 free );
 FREE(VG_Z_LIBC_SONAME,       free,                 free );
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-FREE(VG_Z_LIBC_SONAME,       free_common,          free );
-#elif defined(VGO_darwin)
+#if defined(VGO_darwin)
 ZONEFREE(VG_Z_LIBC_SONAME,   malloc_zone_free,     free );
 #endif
 
@@ -387,11 +339,6 @@
 FREE(VG_Z_LIBSTDCXX_SONAME,  _ZdlPv,               __builtin_delete );
 FREE(VG_Z_LIBC_SONAME,       _ZdlPv,               __builtin_delete );
 
-// operator delete(void*), ARM/cfront mangling
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-FREE(VG_Z_LIBC_DOT_A,        __dl__FPv,            __builtin_delete );
-#endif
-
 
 /*---------------------- delete nothrow ----------------------*/
 
@@ -409,11 +356,6 @@
 FREE(VG_Z_LIBSTDCXX_SONAME,  _ZdaPv,               __builtin_vec_delete );
 FREE(VG_Z_LIBC_SONAME,       _ZdaPv,               __builtin_vec_delete );
 
-// operator delete[](void*), ARM/cfront mangling
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-FREE(VG_Z_LIBC_DOT_A,        __vd__FPv,            __builtin_vec_delete );
-#endif
-
 
 /*---------------------- delete [] nothrow ----------------------*/
 
@@ -465,9 +407,7 @@
    }
 
 CALLOC(VG_Z_LIBC_SONAME, calloc);
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-CALLOC(VG_Z_LIBC_SONAME, calloc_common);
-#elif defined(VGO_darwin)
+#if defined(VGO_darwin)
 ZONECALLOC(VG_Z_LIBC_SONAME, malloc_zone_calloc);
 #endif
 
@@ -523,9 +463,7 @@
    }
 
 REALLOC(VG_Z_LIBC_SONAME, realloc);
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-REALLOC(VG_Z_LIBC_SONAME, realloc_common);
-#elif defined(VGO_darwin)
+#if defined(VGO_darwin)
 ZONEREALLOC(VG_Z_LIBC_SONAME, malloc_zone_realloc);
 #endif
 
@@ -587,12 +525,8 @@
 /*---------------------- valloc ----------------------*/
 
 static int local__getpagesize ( void ) {
-#  if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   return 4096; /* kludge - toc problems prevent calling getpagesize() */
-#  else
    extern int getpagesize (void);
    return getpagesize();
-#  endif
 }
 
 #define VALLOC(soname, fnname) \
@@ -707,12 +641,6 @@
    }
 
 POSIX_MEMALIGN(VG_Z_LIBC_SONAME, posix_memalign);
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-/* 27 Nov 07: it appears that xlc links into executables, a
-   posix_memalign, which calls onwards to memalign_common, with the
-   same args. */
-POSIX_MEMALIGN(VG_Z_LIBC_SONAME, memalign_common);
-#endif
 
 
 /*---------------------- malloc_usable_size ----------------------*/
diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
index 3104fdc..df6c418 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -428,10 +428,6 @@
    tst->os_state.threadgroup = 0;
 #  if defined(VGO_linux)
    /* no other fields to clear */
-#  elif defined(VGO_aix5)
-   tst->os_state.cancel_async    = False;
-   tst->os_state.cancel_disabled = False;
-   tst->os_state.cancel_progress = Canc_NoRequest;
 #  elif defined(VGO_darwin)
    tst->os_state.post_mach_trap_fn = NULL;
    tst->os_state.pthread           = 0;
@@ -744,22 +740,6 @@
    trc = 0;
    dispatch_ctr_SAVED = VG_(dispatch_ctr);
 
-#  if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   /* On AIX, we need to get a plausible value for SPRG3 for this
-      thread, since it's used I think as a thread-state pointer.  It
-      is presumably set by the kernel for each dispatched thread and
-      cannot be changed by user space.  It therefore seems safe enough
-      to copy the host's value of it into the guest state at the point
-      the thread is dispatched.
-      (Later): Hmm, looks like SPRG3 is only used in 32-bit mode.
-      Oh well. */
-   { UWord host_sprg3;
-     __asm__ __volatile__( "mfspr %0,259\n" : "=b"(host_sprg3) );
-    VG_(threads)[tid].arch.vex.guest_SPRG3_RO = host_sprg3;
-    vg_assert(sizeof(VG_(threads)[tid].arch.vex.guest_SPRG3_RO) == sizeof(void*));
-   }
-#  endif
-
    /* there should be no undealt-with signals */
    //vg_assert(VG_(threads)[tid].siginfo.si_signo == 0);
 
@@ -1069,17 +1049,9 @@
 
       if (VG_(dispatch_ctr) == 1) {
 
-#        if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-         /* Note: count runnable threads before dropping The Lock. */
-         Int rt = VG_(count_runnable_threads)();
-#        endif
-
 	 /* Our slice is done, so yield the CPU to another thread.  On
             Linux, this doesn't sleep between sleeping and running,
-            since that would take too much time.  On AIX, we have to
-            prod the scheduler to get it consider other threads; not
-            doing so appears to cause very long delays before other
-            runnable threads get rescheduled. */
+            since that would take too much time. */
 
 	 /* 4 July 06: it seems that a zero-length nsleep is needed to
             cause async thread cancellation (canceller.c) to terminate
@@ -1098,20 +1070,6 @@
                                    "VG_(scheduler):timeslice");
 	 /* ------------ now we don't have The Lock ------------ */
 
-#        if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-         { static Int ctr=0;
-           vg_assert(__NR_AIX5__nsleep != __NR_AIX5_UNKNOWN);
-           vg_assert(__NR_AIX5_yield   != __NR_AIX5_UNKNOWN);
-           if (1 && rt > 0 && ((++ctr % 3) == 0)) { 
-              //struct vki_timespec ts;
-              //ts.tv_sec = 0;
-              //ts.tv_nsec = 0*1000*1000;
-              //VG_(do_syscall2)(__NR_AIX5__nsleep, (UWord)&ts, (UWord)NULL);
-	      VG_(do_syscall0)(__NR_AIX5_yield);
-           }
-         }
-#        endif
-
 	 VG_(acquire_BigLock)(tid, "VG_(scheduler):timeslice");
 	 /* ------------ now we do have The Lock ------------ */
 
diff --git a/coregrind/m_sigframe/sigframe-ppc32-aix5.c b/coregrind/m_sigframe/sigframe-ppc32-aix5.c
deleted file mode 100644
index 999fe20..0000000
--- a/coregrind/m_sigframe/sigframe-ppc32-aix5.c
+++ /dev/null
@@ -1,239 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Create/destroy signal delivery frames.                       ---*/
-/*---                                        sigframe-ppc32-aix5.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#if defined(VGP_ppc32_aix5)
-
-#include "pub_core_basics.h"
-#include "pub_core_vki.h"
-#include "pub_core_vkiscnums.h"
-#include "pub_core_threadstate.h"
-#include "pub_core_aspacemgr.h"
-#include "pub_core_libcbase.h"
-#include "pub_core_libcassert.h"
-#include "pub_core_libcprint.h"
-#include "pub_core_machine.h"
-#include "pub_core_options.h"
-#include "pub_core_signals.h"
-#include "pub_core_tooliface.h"
-#include "pub_core_trampoline.h"
-#include "pub_core_transtab.h"      // VG_(discard_translations)
-#include "pub_core_sigframe.h"      /* self */
-
-
-/* This module creates and removes signal frames for signal deliveries
-   on ppc32-aix5.  Kludgey; the machine state ought to be saved in a
-   ucontext and retrieved from it later, so the handler can modify it
-   and return.  However .. for now .. just stick the vex guest state
-   in the frame and snarf it again later.
-
-   Also, don't bother with creating siginfo and ucontext in the
-   handler, although do point them somewhere non-faulting.
-*/
-struct hacky_sigframe {
-   UChar              lower_guardzone[512];  // put nothing here
-   VexGuestPPC32State gst;
-   VexGuestPPC32State gshadow1;
-   VexGuestPPC32State gshadow2;
-   UInt               magicPI;
-   UInt               sigNo_private;
-   UInt               tramp[2];
-   UChar              upper_guardzone[512]; // put nothing here
-};
-
-
-/* Extend the stack segment downwards if needed so as to ensure the
-   new signal frames are mapped to something.  Return a Bool
-   indicating whether or not the operation was successful.
-*/
-static Bool extend ( ThreadState *tst, Addr addr, SizeT size )
-{
-   ThreadId tid = tst->tid;
-   /* For tracking memory events, indicate the entire frame has been
-      allocated.  Except, don't mess with the area which
-      overlaps the previous frame's redzone. */
-   /* XXX is the following call really right?  compared with the
-      amd64-linux version, this doesn't appear to handle the redzone
-      in the same way. */
-   VG_TRACK( new_mem_stack_signal,
-             addr, size - VG_STACK_REDZONE_SZB, tid );
-   return True;
-}
-
-#define SET_SIGNAL_LR(zztst, zzval)                          \
-   do { tst->arch.vex.guest_LR = (zzval);                    \
-      VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,     \
-                offsetof(VexGuestPPC32State,guest_LR),       \
-                sizeof(UWord) );                             \
-   } while (0)
-
-#define SET_SIGNAL_GPR(zztst, zzn, zzval)                    \
-   do { tst->arch.vex.guest_GPR##zzn = (zzval);              \
-      VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,     \
-                offsetof(VexGuestPPC32State,guest_GPR##zzn), \
-                sizeof(UWord) );                             \
-   } while (0)
-
-
-/* Create a signal frame for thread 'tid'. */
-void VG_(sigframe_create) ( ThreadId tid,
-                            Addr sp_top_of_frame,
-                            const vki_siginfo_t *siginfo,
-                            const struct vki_ucontext *siguc,
-                            void *handler,
-                            UInt flags,
-                            const vki_sigset_t *mask,
-                            void *restorer )
-{
-   ThreadState* tst;
-   Addr sp;
-   struct hacky_sigframe* frame;
-   Int sigNo = siginfo->si_signo;
-   Int __NR_FAKE_SIGRETURN = __NR_AIX5_FAKE_SIGRETURN;
-
-   vg_assert(VG_IS_16_ALIGNED(sizeof(struct hacky_sigframe)));
-
-   sp_top_of_frame &= ~0xf;
-   sp = sp_top_of_frame - sizeof(struct hacky_sigframe);
-
-   tst = VG_(get_ThreadState)(tid);
-   if (!extend(tst, sp, sp_top_of_frame - sp))
-     return;
-
-   vg_assert(VG_IS_16_ALIGNED(sp));
-
-   frame = (struct hacky_sigframe *) sp;
-
-   /* clear it (very conservatively) */
-   VG_(memset)(&frame->lower_guardzone, 0, 512);
-   VG_(memset)(&frame->gst,      0, sizeof(VexGuestPPC32State));
-   VG_(memset)(&frame->gshadow1, 0, sizeof(VexGuestPPC32State));
-   VG_(memset)(&frame->gshadow2, 0, sizeof(VexGuestPPC32State));
-
-   /* save stuff in frame */
-   frame->gst           = tst->arch.vex;
-   frame->gshadow1      = tst->arch.vex_shadow1;
-   frame->gshadow2      = tst->arch.vex_shadow2;
-   frame->sigNo_private = sigNo;
-   frame->magicPI       = 0x31415927;
-
-   /* Set up stack frame pointer */
-   sp += 256;
-   vg_assert(sp == (Addr)&frame->lower_guardzone[256]);
-   VG_TRACK( pre_mem_write, Vg_CoreSignal, tid, "signal handler frame",
-             sp, sizeof(UWord) );
-   *(Addr*)sp = tst->arch.vex.guest_GPR1;
-   VG_TRACK( post_mem_write, Vg_CoreSignal, tid,
-             sp, sizeof(UWord) );
-
-   /* Set regs for the handler */
-   SET_SIGNAL_GPR(tid, 1, sp);
-   SET_SIGNAL_GPR(tid, 2, ((UWord*)handler)[1]);
-   SET_SIGNAL_GPR(tid, 3, sigNo);
-   SET_SIGNAL_GPR(tid, 4, 0); /* XXX: the siginfo* */
-   SET_SIGNAL_GPR(tid, 5, 0); /* XXX: the ucontext* */
-   tst->arch.vex.guest_CIA = ((UWord*)handler)[0];
-
-   /* set up return trampoline */
-   vg_assert(__NR_FAKE_SIGRETURN >= 10000);
-   vg_assert(__NR_FAKE_SIGRETURN <= 32767);
-   frame->tramp[0] = 0x38400000U 
-                     + __NR_FAKE_SIGRETURN; /* li 2,__NR_FAKE_SIGRETURN */
-   frame->tramp[1] = 0x44000002U;           /* sc */
-
-   /* invalidate any translation of this area */
-   VG_(discard_translations)( (Addr64)(Addr)&frame->tramp[0], 
-                              sizeof(frame->tramp), "sigframe tramp" );   
-   /* set the signal handler to return to the trampoline */
-   SET_SIGNAL_LR(tst, (Addr) &frame->tramp[0]);
-
-   VG_TRACK(post_mem_write, Vg_CoreSignal, tst->tid,
-            (Addr)&frame->tramp, sizeof(frame->tramp));
-
-   if (0) {
-      VG_(printf)("pushed signal frame for sig %d; R1 now = %#lx, "
-                  "next %%CIA = %#x, status=%d\n", 
-                  sigNo,
-	          sp, tst->arch.vex.guest_CIA, tst->status);
-      VG_(printf)("trampoline is at %p\n",  &frame->tramp[0]);
-   }
-}
-
-
-/* Remove a signal frame from thread 'tid's stack, and restore the CPU
-   state from it.  Note, isRT is irrelevant here. */
-void VG_(sigframe_destroy)( ThreadId tid, Bool isRT )
-{
-   ThreadState *tst;
-   Addr sp;
-   Int sigNo;
-   struct hacky_sigframe* frame;
- 
-   vg_assert(VG_(is_valid_tid)(tid));
-   tst = VG_(get_ThreadState)(tid);
-
-   /* Check that the stack frame looks valid */
-   sp = tst->arch.vex.guest_GPR1;
-   vg_assert(VG_IS_16_ALIGNED(sp));
-
-   frame = (struct hacky_sigframe*)(sp - 256);
-   vg_assert(frame->magicPI == 0x31415927);
-
-   /* restore the entire guest state, and shadows, from the
-      frame.  Note, as per comments above, this is a kludge - should
-      restore it from saved ucontext.  Oh well. */
-   tst->arch.vex = frame->gst;
-   tst->arch.vex_shadow1 = frame->gshadow1;
-   tst->arch.vex_shadow2 = frame->gshadow2;
-   sigNo = frame->sigNo_private;
-
-   if (VG_(clo_trace_signals))
-      VG_(message)(Vg_DebugMsg,
-                   "vg_pop_signal_frame (thread %d): valid magic; CIA=%#x\n",
-                   tid, tst->arch.vex.guest_CIA);
-
-   VG_TRACK( die_mem_stack_signal, 
-             (Addr)frame, 
-             sizeof(struct hacky_sigframe) - VG_STACK_REDZONE_SZB );
-
-   /* tell the tools */
-   VG_TRACK( post_deliver_signal, tid, sigNo );
-}
-
-#endif // defined(VGP_ppc32_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_sigframe/sigframe-ppc64-aix5.c b/coregrind/m_sigframe/sigframe-ppc64-aix5.c
deleted file mode 100644
index 474b933..0000000
--- a/coregrind/m_sigframe/sigframe-ppc64-aix5.c
+++ /dev/null
@@ -1,273 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Create/destroy signal delivery frames.                       ---*/
-/*---                                        sigframe-ppc64-aix5.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#if defined(VGP_ppc64_aix5)
-
-#include "pub_core_basics.h"
-#include "pub_core_vki.h"
-#include "pub_core_vkiscnums.h"
-#include "pub_core_threadstate.h"
-#include "pub_core_aspacemgr.h"
-#include "pub_core_libcbase.h"
-#include "pub_core_libcassert.h"
-#include "pub_core_libcprint.h"
-#include "pub_core_machine.h"
-#include "pub_core_options.h"
-#include "pub_core_signals.h"
-#include "pub_core_tooliface.h"
-#include "pub_core_trampoline.h"
-#include "pub_core_transtab.h"      // VG_(discard_translations)
-#include "pub_core_sigframe.h"      /* self */
-
-
-/* This module creates and removes signal frames for signal deliveries
-   on ppc64-aix5.  Kludgey; the machine state ought to be saved in a
-   ucontext and retrieved from it later, so the handler can modify it
-   and return.  However .. for now .. just stick the vex guest state
-   in the frame and snarf it again later.
-
-   Also, don't bother with creating siginfo and ucontext in the
-   handler, although do point them somewhere non-faulting.
-*/
-struct hacky_sigframe {
-   UChar              lower_guardzone[1024];  // put nothing here
-   VexGuestPPC64State gst;
-   VexGuestPPC64State gshadow1;
-   VexGuestPPC64State gshadow2;
-   UInt               magicPI;
-   UInt               sigNo_private;
-   UInt               tramp[2];
-   UChar              upper_guardzone[1024]; // put nothing here
-};
-
-
-/* Extend the stack segment downwards if needed so as to ensure the
-   new signal frames are mapped to something.  Return a Bool
-   indicating whether or not the operation was successful.
-*/
-static Bool extend ( ThreadState *tst, Addr addr, SizeT size )
-{
-   ThreadId tid = tst->tid;
-   /* For tracking memory events, indicate the entire frame has been
-      allocated.  Except, don't mess with the area which
-      overlaps the previous frame's redzone. */
-   /* XXX is the following call really right?  compared with the
-      amd64-linux version, this doesn't appear to handle the redzone
-      in the same way. */
-   VG_TRACK( new_mem_stack_signal,
-             addr, size - VG_STACK_REDZONE_SZB, tid );
-   return True;
-}
-
-#define SET_SIGNAL_LR(zztst, zzval)                          \
-   do { tst->arch.vex.guest_LR = (zzval);                    \
-      VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,     \
-                offsetof(VexGuestPPC64State,guest_LR),       \
-                sizeof(UWord) );                             \
-   } while (0)
-
-#define SET_SIGNAL_GPR(zztst, zzn, zzval)                    \
-   do { tst->arch.vex.guest_GPR##zzn = (zzval);              \
-      VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,     \
-                offsetof(VexGuestPPC64State,guest_GPR##zzn), \
-                sizeof(UWord) );                             \
-   } while (0)
-
-
-/* Create a signal frame for thread 'tid'. */
-void VG_(sigframe_create) ( ThreadId tid,
-                            Addr sp_top_of_frame,
-                            const vki_siginfo_t *siginfo,
-                            const struct vki_ucontext *siguc,
-                            void *handler,
-                            UInt flags,
-                            const vki_sigset_t *mask,
-                            void *restorer )
-{
-   ThreadState* tst;
-   Addr sp;
-   struct hacky_sigframe* frame;
-   Int sigNo = siginfo->si_signo;
-   Int __NR_FAKE_SIGRETURN = __NR_AIX5_FAKE_SIGRETURN;
-
-   vg_assert(VG_IS_16_ALIGNED(sizeof(struct hacky_sigframe)));
-
-   sp_top_of_frame &= ~0xf;
-   sp = sp_top_of_frame - sizeof(struct hacky_sigframe);
-
-   tst = VG_(get_ThreadState)(tid);
-   if (!extend(tst, sp, sp_top_of_frame - sp))
-     return;
-
-   vg_assert(VG_IS_16_ALIGNED(sp));
-
-   frame = (struct hacky_sigframe *) sp;
-
-   /* clear it (very conservatively) */
-   VG_(memset)(&frame->lower_guardzone, 0, 1024);
-   VG_(memset)(&frame->gst,      0, sizeof(VexGuestPPC64State));
-   VG_(memset)(&frame->gshadow1, 0, sizeof(VexGuestPPC64State));
-   VG_(memset)(&frame->gshadow2, 0, sizeof(VexGuestPPC64State));
-
-   /* save stuff in frame */
-   frame->gst           = tst->arch.vex;
-   frame->gshadow1      = tst->arch.vex_shadow1;
-   frame->gshadow2      = tst->arch.vex_shadow2;
-   frame->sigNo_private = sigNo;
-   frame->magicPI       = 0x31415927;
-
-   /* Set up stack frame pointer */
-   sp += 512;
-   vg_assert(sp == (Addr)&frame->lower_guardzone[512]);
-   VG_TRACK( pre_mem_write, Vg_CoreSignal, tid, "signal handler frame",
-             sp, sizeof(UWord) );
-   *(Addr*)sp = tst->arch.vex.guest_GPR1;
-   VG_TRACK( post_mem_write, Vg_CoreSignal, tid,
-             sp, sizeof(UWord) );
-
-   /* Set regs for the handler */
-   SET_SIGNAL_GPR(tid, 1, sp);
-   SET_SIGNAL_GPR(tid, 2, ((UWord*)handler)[1]);
-   SET_SIGNAL_GPR(tid, 3, sigNo);
-   SET_SIGNAL_GPR(tid, 4, 0); /* XXX: the siginfo* */
-   SET_SIGNAL_GPR(tid, 5, 0); /* XXX: the ucontext* */
-   tst->arch.vex.guest_CIA = ((UWord*)handler)[0];
-
-   /* set up return trampoline */
-   vg_assert(__NR_FAKE_SIGRETURN >= 10000);
-   vg_assert(__NR_FAKE_SIGRETURN <= 32767);
-   frame->tramp[0] = 0x38400000U 
-                     + __NR_FAKE_SIGRETURN; /* li 2,__NR_FAKE_SIGRETURN */
-   frame->tramp[1] = 0x44000002U;           /* sc */
-
-   /* invalidate any translation of this area */
-   VG_(discard_translations)( (Addr64)(Addr)&frame->tramp[0], 
-                              sizeof(frame->tramp), "sigframe tramp" );   
-   /* set the signal handler to return to the trampoline */
-   SET_SIGNAL_LR(tst, (Addr) &frame->tramp[0]);
-
-   VG_TRACK(post_mem_write, Vg_CoreSignal, tst->tid,
-            (Addr)&frame->tramp, sizeof(frame->tramp));
-
-   if (0) {
-      VG_(printf)("pushed signal frame for sig %d; R1 now = %#lx, "
-                  "next %%CIA = %#llx, status=%d\n", 
-                  sigNo,
-	          sp, tst->arch.vex.guest_CIA, tst->status);
-      VG_(printf)("trampoline is at %p\n",  &frame->tramp[0]);
-   }
-}
-
-
-/* Remove a signal frame from thread 'tid's stack, and restore the CPU
-   state from it.  Note, isRT is irrelevant here. */
-void VG_(sigframe_destroy)( ThreadId tid, Bool isRT )
-{
-   ThreadState *tst;
-   Addr sp, sp_max;
-   const UWord one_meg = 1048576;
-   UWord scannable_bytes;
-
-   Int sigNo, i;
-   struct hacky_sigframe* frame;
- 
-   vg_assert(VG_(is_valid_tid)(tid));
-   tst = VG_(get_ThreadState)(tid);
-
-   /* Check that the stack frame looks valid */
-   sp = tst->arch.vex.guest_GPR1;
-   vg_assert(VG_IS_16_ALIGNED(sp));
-
-   /* If the frame is being cleared by some mechanism other than our
-      fake sigreturn, sp may not be as it was after the frame was
-      constructed.  If so, scan back up the stack looking for the most
-      recently pushed frame and assume that's the right one to use.
-      Urk. */
-   sp_max = tst->client_stack_highest_word;
-   scannable_bytes = 0;
-   if (sp_max > sp)
-      scannable_bytes = sp_max - sp;
-   if (scannable_bytes > one_meg)
-      scannable_bytes = one_meg;
-   if (scannable_bytes < (sizeof(struct hacky_sigframe)-512)) 
-      scannable_bytes = 0;
-   else
-      scannable_bytes -= (sizeof(struct hacky_sigframe)-512);
-
-   vg_assert(scannable_bytes <= one_meg);
-
-   frame = (struct hacky_sigframe*)(sp - 512);
-   if (frame->magicPI != 0x31415927) {
-      if (!VG_(clo_xml))
-         VG_(message)(Vg_DebugMsg, 
-            "WARNING: dubious signal return: searching %ld bytes for frame\n", 
-            scannable_bytes);
-      for (i = 0; i < scannable_bytes/4; i++) {
-         if (frame->magicPI == 0x31415927)
-            break;
-         frame = (struct hacky_sigframe*)(((Addr)frame)+4);
-      }
-   }
-
-   /* If we haven't found the frame by now, we're hosed. */
-   vg_assert(frame->magicPI == 0x31415927);
-
-   /* restore the entire guest state, and shadow, from the
-      frame.  Note, as per comments above, this is a kludge - should
-      restore it from saved ucontext.  Oh well. */
-   tst->arch.vex = frame->gst;
-   tst->arch.vex_shadow1 = frame->gshadow1;
-   tst->arch.vex_shadow2 = frame->gshadow2;
-   sigNo = frame->sigNo_private;
-
-   if (VG_(clo_trace_signals))
-      VG_(message)(Vg_DebugMsg,
-                   "vg_pop_signal_frame (thread %d): valid magic; CIA=%#llx\n",
-                   tid, tst->arch.vex.guest_CIA);
-
-   VG_TRACK( die_mem_stack_signal, 
-             (Addr)frame, 
-             sizeof(struct hacky_sigframe) - VG_STACK_REDZONE_SZB );
-
-   /* tell the tools */
-   VG_TRACK( post_deliver_signal, tid, sigNo );
-}
-
-#endif // defined(VGP_ppc64_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c
index 8f4bbda..fcb3d0f 100644
--- a/coregrind/m_signals.c
+++ b/coregrind/m_signals.c
@@ -388,72 +388,6 @@
         (srP)->misc.ARM.r7  = (uc)->uc_mcontext.arm_r7; \
       }
 
-#elif defined(VGP_ppc32_aix5)
-
-   /* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#  include <ucontext.h>
-   /* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-   static inline Addr VG_UCONTEXT_INSTR_PTR( void* ucV ) {
-      ucontext_t* uc = (ucontext_t*)ucV;
-      struct __jmpbuf* mc = &(uc->uc_mcontext);
-      struct mstsave* jc = &mc->jmp_context;
-      return jc->iar;
-   }
-   static inline Addr VG_UCONTEXT_STACK_PTR( void* ucV ) {
-      ucontext_t* uc = (ucontext_t*)ucV;
-      struct __jmpbuf* mc = &(uc->uc_mcontext);
-      struct mstsave* jc = &mc->jmp_context;
-      return jc->gpr[1];
-   }
-   static inline SysRes VG_UCONTEXT_SYSCALL_SYSRES( void* ucV ) {
-      ucontext_t* uc = (ucontext_t*)ucV;
-      struct __jmpbuf* mc = &(uc->uc_mcontext);
-      struct mstsave* jc = &mc->jmp_context;
-      return VG_(mk_SysRes_ppc32_aix5)( jc->gpr[3], jc->gpr[4] );
-   }
-   static inline Addr VG_UCONTEXT_LINK_REG( void* ucV ) {
-      ucontext_t* uc = (ucontext_t*)ucV;
-      struct __jmpbuf* mc = &(uc->uc_mcontext);
-      struct mstsave* jc = &mc->jmp_context;
-      return jc->lr;
-   }
-   static inline Addr VG_UCONTEXT_FRAME_PTR( void* ucV ) {
-      return VG_UCONTEXT_STACK_PTR(ucV);
-   }
-
-#elif defined(VGP_ppc64_aix5)
-
-   /* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#  include <ucontext.h>
-   /* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-   static inline Addr VG_UCONTEXT_INSTR_PTR( void* ucV ) {
-      ucontext_t* uc = (ucontext_t*)ucV;
-      struct __jmpbuf* mc = &(uc->uc_mcontext);
-      struct __context64* jc = &mc->jmp_context;
-      return jc->iar;
-   }
-   static inline Addr VG_UCONTEXT_STACK_PTR( void* ucV ) {
-      ucontext_t* uc = (ucontext_t*)ucV;
-      struct __jmpbuf* mc = &(uc->uc_mcontext);
-      struct __context64* jc = &mc->jmp_context;
-      return jc->gpr[1];
-   }
-   static inline SysRes VG_UCONTEXT_SYSCALL_SYSRES( void* ucV ) {
-      ucontext_t* uc = (ucontext_t*)ucV;
-      struct __jmpbuf* mc = &(uc->uc_mcontext);
-      struct __context64* jc = &mc->jmp_context;
-      return VG_(mk_SysRes_ppc32_aix5)( jc->gpr[3], jc->gpr[4] );
-   }
-   static inline Addr VG_UCONTEXT_LINK_REG( void* ucV ) {
-      ucontext_t* uc = (ucontext_t*)ucV;
-      struct __jmpbuf* mc = &(uc->uc_mcontext);
-      struct __context64* jc = &mc->jmp_context;
-      return jc->lr;
-   }
-   static inline Addr VG_UCONTEXT_FRAME_PTR( void* ucV ) {
-      return VG_UCONTEXT_STACK_PTR(ucV);
-   }
-
 #elif defined(VGP_x86_darwin)
 
    static inline Addr VG_UCONTEXT_INSTR_PTR( void* ucV ) {
@@ -559,9 +493,6 @@
 #if defined(VGO_linux)
 #  define VKI_SIGINFO_si_addr  _sifields._sigfault._addr
 #  define VKI_SIGINFO_si_pid   _sifields._kill._pid
-#elif defined(VGO_aix5)
-#  define VKI_SIGINFO_si_addr  si_addr
-#  define VKI_SIGINFO_si_pid   si_pid
 #elif defined(VGO_darwin)
 #  define VKI_SIGINFO_si_addr  si_addr
 #  define VKI_SIGINFO_si_pid   si_pid
@@ -854,17 +785,6 @@
    "    svc  0x00000000\n" \
    ".previous\n"
 
-#elif defined(VGP_ppc32_aix5)
-#  define _MY_SIGRETURN(name) \
-   ".globl my_sigreturn\n" \
-   "my_sigreturn:\n" \
-   ".long 0\n"
-#elif defined(VGP_ppc64_aix5)
-#  define _MY_SIGRETURN(name) \
-   ".globl my_sigreturn\n" \
-   "my_sigreturn:\n" \
-   ".long 0\n"
-
 #elif defined(VGP_x86_darwin)
 #  define _MY_SIGRETURN(name) \
    ".text\n" \
@@ -928,7 +848,6 @@
       ksa.ksa_handler = skss.skss_per_sig[sig].skss_handler;
       ksa.sa_flags    = skss.skss_per_sig[sig].skss_flags;
 #     if !defined(VGP_ppc32_linux) && \
-         !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5) && \
          !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
       ksa.sa_restorer = my_sigreturn;
 #     endif
@@ -962,7 +881,6 @@
          vg_assert(ksa_old.sa_flags 
                    == skss_old.skss_per_sig[sig].skss_flags);
 #        if !defined(VGP_ppc32_linux) && \
-            !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5) && \
             !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
          vg_assert(ksa_old.sa_restorer 
                    == my_sigreturn);
@@ -1084,8 +1002,7 @@
       old_act->ksa_handler = scss.scss_per_sig[signo].scss_handler;
       old_act->sa_flags    = scss.scss_per_sig[signo].scss_flags;
       old_act->sa_mask     = scss.scss_per_sig[signo].scss_mask;
-#     if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5) && \
-         !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
+#     if !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
       old_act->sa_restorer = scss.scss_per_sig[signo].scss_restorer;
 #     endif
    }
@@ -1097,8 +1014,7 @@
       scss.scss_per_sig[signo].scss_mask     = new_act->sa_mask;
 
       scss.scss_per_sig[signo].scss_restorer = NULL;
-#     if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5) && \
-         !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
+#     if !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
       scss.scss_per_sig[signo].scss_restorer = new_act->sa_restorer;
 #     endif
 
@@ -1411,8 +1327,7 @@
 
    sa.ksa_handler = VKI_SIG_DFL;
    sa.sa_flags = 0;
-#  if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5) && \
-      !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
+#  if !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
    sa.sa_restorer = 0;
 #  endif
    VG_(sigemptyset)(&sa.sa_mask);
@@ -1442,13 +1357,14 @@
 // pass in some other details that can help when si_code is unreliable.
 static Bool is_signal_from_kernel(ThreadId tid, int signum, int si_code)
 {
-#if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    // On Linux, SI_USER is zero, negative values are from the user, positive
    // values are from the kernel.  There are SI_FROMUSER and SI_FROMKERNEL
    // macros but we don't use them here because other platforms don't have
    // them.
    return ( si_code > VKI_SI_USER ? True : False );
-#elif defined(VGO_darwin)
+
+#  elif defined(VGO_darwin)
    // On Darwin 9.6.0, the si_code is completely unreliable.  It should be the
    // case that 0 means "user", and >0 means "kernel".  But:
    // - For SIGSEGV, it seems quite reliable.
@@ -1477,9 +1393,9 @@
    } else {
       return True;
    }
-#else
-#  error Unknown OS
-#endif
+#  else
+#    error Unknown OS
+#  endif
 }
 
 // This is an arbitrary si_code that we only use internally.  It corresponds
@@ -2017,7 +1933,7 @@
       mask them off) sign extends them when exporting to user space so
       we do the same thing here. */
    return (Short)si_code;
-#elif defined(VGO_aix5) || defined(VGO_darwin)
+#elif defined(VGO_darwin)
    return si_code;
 #else
 #  error Unknown OS
@@ -2508,8 +2424,7 @@
    VG_(printf)("pp_ksigaction: handler %p, flags 0x%x, restorer %p\n", 
                sa->ksa_handler, 
                (UInt)sa->sa_flags, 
-#              if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5) && \
-                  !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
+#              if !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
                   sa->sa_restorer
 #              else
                   (void*)0
@@ -2531,8 +2446,7 @@
 
    sa.ksa_handler = VKI_SIG_DFL;
    sa.sa_flags = 0;
-#  if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5) && \
-      !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
+#  if !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
    sa.sa_restorer = 0;
 #  endif
    VG_(sigemptyset)(&sa.sa_mask);
@@ -2634,8 +2548,7 @@
 
 	 tsa.ksa_handler = (void *)sync_signalhandler;
 	 tsa.sa_flags = VKI_SA_SIGINFO;
-#        if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5) && \
-            !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
+#        if !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
 	 tsa.sa_restorer = 0;
 #        endif
 	 VG_(sigfillset)(&tsa.sa_mask);
@@ -2662,8 +2575,7 @@
       scss.scss_per_sig[i].scss_mask     = sa.sa_mask;
 
       scss.scss_per_sig[i].scss_restorer = NULL;
-#     if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5) && \
-         !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
+#     if !defined(VGP_x86_darwin) && !defined(VGP_amd64_darwin)
       scss.scss_per_sig[i].scss_restorer = sa.sa_restorer;
 #     endif
 
diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c
index 7984de3..522661e 100644
--- a/coregrind/m_stacktrace.c
+++ b/coregrind/m_stacktrace.c
@@ -386,8 +386,7 @@
 
 /* -----------------------ppc32/64 ---------------------- */
 
-#if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux) \
-    || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
+#if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
 
 UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
                                /*OUT*/Addr* ips, UInt max_n_ips,
@@ -412,9 +411,9 @@
    Addr ip = (Addr)startRegs->r_pc;
    Addr sp = (Addr)startRegs->r_sp;
    Addr fp = sp;
-#  if defined(VGP_ppc32_linux) || defined(VGP_ppc32_aix5)
+#  if defined(VGP_ppc32_linux)
    Addr lr = startRegs->misc.PPC32.r_lr;
-#  elif defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
+#  elif defined(VGP_ppc64_linux)
    Addr lr = startRegs->misc.PPC64.r_lr;
 #  endif
    Addr fp_min = sp;
@@ -450,12 +449,9 @@
    /* fp is %r1.  ip is %cia.  Note, ppc uses r1 as both the stack and
       frame pointers. */
 
-#  if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
+#  if defined(VGP_ppc64_linux)
    redir_stack_size = VEX_GUEST_PPC64_REDIR_STACK_SIZE;
    redirs_used      = 0;
-#  elif defined(VGP_ppc32_aix5)
-   redir_stack_size = VEX_GUEST_PPC32_REDIR_STACK_SIZE;
-   redirs_used      = 0;
 #  endif
 
 #  if defined(VG_PLAT_USES_PPCTOC)
@@ -506,7 +502,7 @@
 
       while (True) {
 
-        /* On ppc64-linux (ppc64-elf, really), and on AIX, the lr save
+        /* On ppc64-linux (ppc64-elf, really), the lr save
            slot is 2 words back from sp, whereas on ppc32-elf(?) it's
            only one word back. */
 #        if defined(VG_PLAT_USES_PPCTOC)
@@ -530,15 +526,15 @@
 
 #           if defined(VG_PLAT_USES_PPCTOC)
             /* Nasty hack to do with function replacement/wrapping on
-               ppc64-linux/ppc64-aix/ppc32-aix.  If LR points to our
-               magic return stub, then we are in a wrapped or
-               intercepted function, in which LR has been messed with.
-               The original LR will have been pushed onto the thread's
-               hidden REDIR stack one down from the top (top element
-               is the saved R2) and so we should restore the value
-               from there instead.  Since nested redirections can and
-               do happen, we keep track of the number of nested LRs
-               used by the unwinding so far with 'redirs_used'. */
+               ppc64-linux.  If LR points to our magic return stub,
+               then we are in a wrapped or intercepted function, in
+               which LR has been messed with.  The original LR will
+               have been pushed onto the thread's hidden REDIR stack
+               one down from the top (top element is the saved R2) and
+               so we should restore the value from there instead.
+               Since nested redirections can and do happen, we keep
+               track of the number of nested LRs used by the unwinding
+               so far with 'redirs_used'. */
             if (ip == (Addr)&VG_(ppctoc_magic_redirect_return_stub)
                 && VG_(is_valid_tid)(tid_if_known)) {
                Word hsp = VG_(threads)[tid_if_known]
diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c
index 296a74d..1047d5d 100644
--- a/coregrind/m_syscall.c
+++ b/coregrind/m_syscall.c
@@ -138,46 +138,6 @@
 }
 
 
-#elif defined(VGO_aix5)
-
-/* AIX scheme: we have to record both 'res' (r3) and 'err' (r4).  If
-   'err' is nonzero then the call has failed, but it could still be
-   that AIX userspace will ignore 'err' and instead consult 'res' to
-   determine if the call failed.  So we have to record both. */
-SysRes VG_(mk_SysRes_ppc32_aix5) ( UInt res, UInt err ) {
-   SysRes r;
-   r.res     = res;
-   r.err     = err;
-   r.isError = r.err != 0;
-   return r;
-}
-
-SysRes VG_(mk_SysRes_ppc64_aix5) ( ULong res, ULong err ) {
-   SysRes r;
-   r.res     = res;
-   r.err     = err;
-   r.isError = r.err != 0;
-   return r;
-}
-
-/* Generic constructors. */
-SysRes VG_(mk_SysRes_Error) ( UWord err ) {
-   SysRes r;
-   r._res     = 0;
-   r._err     = err;
-   r._isError = True;
-   return r;
-}
-
-SysRes VG_(mk_SysRes_Success) ( UWord res ) {
-   SysRes r;
-   r._res     = res;
-   r._err     = 0;
-   r._isError = False;
-   return r;
-}
-
-
 #elif defined(VGO_darwin)
 
 /* Darwin: Some syscalls return a double-word result. */
@@ -447,157 +407,6 @@
 ".previous\n"
 );
 
-#elif defined(VGP_ppc32_aix5)
-static void do_syscall_WRK ( UWord* res_r3, UWord* res_r4,
-                             UWord sysno, 
-                             UWord a1, UWord a2, UWord a3,
-                             UWord a4, UWord a5, UWord a6,
-                             UWord a7, UWord a8 )
-{
-   /* Syscalls on AIX are very similar to function calls:
-      - up to 8 args in r3-r10
-      - syscall number in r2
-      - kernel resumes at 'lr', so must set it appropriately beforehand
-      - r3 holds the result and r4 any applicable error code
-      See http://www.cs.utexas.edu/users/cart/publications/tr00-04.ps
-      and also 'man truss'.
-   */
-   /* For some reason gcc-3.3.2 doesn't preserve r31 across the asm
-      even though we state it to be trashed.  So use r27 instead. */
-   UWord args[9];
-   args[0] = sysno;
-   args[1] = a1; args[2] = a2;
-   args[3] = a3; args[4] = a4;
-   args[5] = a5; args[6] = a6;
-   args[7] = a7; args[8] = a8;
-
-   __asm__ __volatile__(
-
-      // establish base ptr
-      "mr   28,%0\n\t"
-
-      // save r2, lr
-      "mr   27,2\n\t" // save r2 in r27
-      "mflr 30\n\t"   // save lr in r30
-
-      // set syscall number and args
-      "lwz   2,  0(28)\n\t"
-      "lwz   3,  4(28)\n\t"
-      "lwz   4,  8(28)\n\t"
-      "lwz   5, 12(28)\n\t"
-      "lwz   6, 16(28)\n\t"
-      "lwz   7, 20(28)\n\t"
-      "lwz   8, 24(28)\n\t"
-      "lwz   9, 28(28)\n\t"
-      "lwz  10, 32(28)\n\t"
-
-      // set bit 3 of CR1 otherwise AIX 5.1 returns to the
-      // wrong address after the sc instruction
-      "crorc 6,6,6\n\t"
-
-      // set up LR to point just after the sc insn
-      ".long 0x48000005\n\t" // "bl here+4" -- lr := & next insn
-      "mflr 29\n\t"
-      "addi 29,29,16\n\t"
-      "mtlr 29\n\t"
-
-      // do it!
-      "sc\n\t"
-
-      // result is now in r3; save it in args[0]
-      "stw  3,0(28)\n\t"
-      // error code in r4; save it in args[1]
-      "stw  4,4(28)\n\t"
-
-      // restore
-      "mr   2,27\n\t"
-      "mtlr 30\n\t"
-
-      : /*out*/
-      : /*in*/  "b" (&args[0])
-      : /*trash*/
-           /*temps*/    "r31","r30","r29","r28","r27",
-           /*args*/     "r3","r4","r5","r6","r7","r8","r9","r10",
-           /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
-                        "xer","ctr","cr0","cr1","cr2","cr3",
-                        "cr4","cr5","cr6","cr7"
-   );
-
-   *res_r3 = args[0];
-   *res_r4 = args[1];
-}
-
-#elif defined(VGP_ppc64_aix5)
-static void do_syscall_WRK ( UWord* res_r3, UWord* res_r4,
-                             UWord sysno, 
-                             UWord a1, UWord a2, UWord a3,
-                             UWord a4, UWord a5, UWord a6,
-                             UWord a7, UWord a8 )
-{
-   /* Same scheme as ppc32-aix5. */
-   UWord args[9];
-   args[0] = sysno;
-   args[1] = a1; args[2] = a2;
-   args[3] = a3; args[4] = a4;
-   args[5] = a5; args[6] = a6;
-   args[7] = a7; args[8] = a8;
-
-   __asm__ __volatile__(
-
-      // establish base ptr
-      "mr   28,%0\n\t"
-
-      // save r2, lr
-      "mr   27,2\n\t" // save r2 in r27
-      "mflr 30\n\t"   // save lr in r30
-
-      // set syscall number and args
-      "ld    2,  0(28)\n\t"
-      "ld    3,  8(28)\n\t"
-      "ld    4, 16(28)\n\t"
-      "ld    5, 24(28)\n\t"
-      "ld    6, 32(28)\n\t"
-      "ld    7, 40(28)\n\t"
-      "ld    8, 48(28)\n\t"
-      "ld    9, 56(28)\n\t"
-      "ld   10, 64(28)\n\t"
-
-      // set bit 3 of CR1 otherwise AIX 5.1 returns to the
-      // wrong address after the sc instruction
-      "crorc 6,6,6\n\t"
-
-      // set up LR to point just after the sc insn
-      ".long 0x48000005\n\t" // "bl here+4" -- lr := & next insn
-      "mflr 29\n\t"
-      "addi 29,29,16\n\t"
-      "mtlr 29\n\t"
-
-      // do it!
-      "sc\n\t"
-
-      // result is now in r3; save it in args[0]
-      "std  3,0(28)\n\t"
-      // error code in r4; save it in args[1]
-      "std  4,8(28)\n\t"
-
-      // restore
-      "mr   2,27\n\t"
-      "mtlr 30\n\t"
-
-      : /*out*/
-      : /*in*/  "b" (&args[0])
-      : /*trash*/
-           /*temps*/    "r31","r30","r29","r28","r27",
-           /*args*/     "r3","r4","r5","r6","r7","r8","r9","r10",
-           /*paranoia*/ "memory","cc","r0","r1","r11","r12","r13",
-                        "xer","ctr","cr0","cr1","cr2","cr3",
-                        "cr4","cr5","cr6","cr7"
-   );
-
-   *res_r3 = args[0];
-   *res_r4 = args[1];
-}
-
 #elif defined(VGP_x86_darwin)
 
 /* Incoming args (syscall number + up to 8 args) come in on the stack
@@ -804,44 +613,6 @@
    UWord val = do_syscall_WRK(a1,a2,a3,a4,a5,a6,sysno);
    return VG_(mk_SysRes_arm_linux)( val );
 
-#  elif defined(VGP_ppc32_aix5)
-   UWord res;
-   UWord err;
-   do_syscall_WRK( &res, &err, 
-		   sysno, a1, a2, a3, a4, a5, a6, a7, a8);
-   /* Try to set the error number to zero if the syscall hasn't
-      really failed. */
-   if (sysno == __NR_AIX5_kread
-       || sysno == __NR_AIX5_kwrite) {
-      if (res != (UWord)-1L)
-         err = 0;
-   }
-   else if (sysno == __NR_AIX5_sigprocmask
-            || sysno == __NR_AIX5__sigpending) {
-      if (res == 0)
-         err = 0;
-   }
-   return VG_(mk_SysRes_ppc32_aix5)( res, err );
-
-#  elif defined(VGP_ppc64_aix5)
-   UWord res;
-   UWord err;
-   do_syscall_WRK( &res, &err, 
-		   sysno, a1, a2, a3, a4, a5, a6, a7, a8);
-   /* Try to set the error number to zero if the syscall hasn't
-      really failed. */
-   if (sysno == __NR_AIX5_kread
-       || sysno == __NR_AIX5_kwrite) {
-      if (res != (UWord)-1L)
-         err = 0;
-   }
-   else if (sysno == __NR_AIX5_sigprocmask
-            || sysno == __NR_AIX5__sigpending) {
-      if (res == 0)
-         err = 0;
-   }
-   return VG_(mk_SysRes_ppc64_aix5)( res, err );
-
 #  elif defined(VGP_x86_darwin)
    UInt  wLO = 0, wHI = 0, err = 0;
    ULong u64;
diff --git a/coregrind/m_syswrap/priv_syswrap-aix5.h b/coregrind/m_syswrap/priv_syswrap-aix5.h
deleted file mode 100644
index 037b8fa..0000000
--- a/coregrind/m_syswrap/priv_syswrap-aix5.h
+++ /dev/null
@@ -1,209 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- AIX5-specific syscalls stuff.            priv_syswrap-aix5.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#ifndef __PRIV_SYSWRAP_AIX5_H
-#define __PRIV_SYSWRAP_AIX5_H
-
-/* requires #include "priv_types_n_macros.h" */
-
-
-/* Allocate a stack for this thread, if it doesn't already have one.
-   They're allocated lazily, and never freed.  Returns the initial stack
-   pointer value to use, or 0 if allocation failed. */
-extern Addr ML_(allocstack)(ThreadId tid);
-
-/* Re-read /proc/../map and update everything that depends on it. */
-extern void ML_(aix5_rescan_procmap_after_load_or_unload) ( void );
-
-/* Mess with the given thread's pc/toc so that it is entering
-   pthread_exit() with argument PTHREAD_CANCELED.  Returns True if ok,
-   False if it failed to do so, due to not being able to find
-   pthread_exit() by searching symbol tables. */
-extern Bool ML_(aix5_force_thread_into_pthread_exit)( ThreadId );
-
-/* For various reasons, on AIX we may have to just give up if
-   continuing is too difficult (eg, risk of future deadlock).  This
-   sets up the process state to exit straight away, but does not
-   actually itself exit. */
-extern
-void ML_(aix5_set_threadstate_for_emergency_exit)(ThreadId tid, HChar* why);
-
-/* Debugging stuff, for making sense of AIX5 threading syscalls. */
-extern void   ML_(aix5debugstuff_show_tstate) ( Addr, HChar* who );
-extern void   ML_(aix5debugstuff_show_tstate_flags) ( UWord w );
-extern HChar* ML_(aix5debugstuff_pc_to_fnname) ( Addr pc );
-
-
-// Syscalls which can be handled by a common wrapper for
-// both ppc32-aix5 and ppc64-aix5
-
-DECL_TEMPLATE(aix5, sys___libc_sbrk);
-DECL_TEMPLATE(aix5, sys___msleep);
-DECL_TEMPLATE(aix5, sys__clock_settime);
-DECL_TEMPLATE(aix5, sys__exit);
-DECL_TEMPLATE(aix5, sys__fp_fpscrx_sc);
-DECL_TEMPLATE(aix5, sys__getpgrp);
-DECL_TEMPLATE(aix5, sys__getpid);
-DECL_TEMPLATE(aix5, sys__getppid);
-DECL_TEMPLATE(aix5, sys__getpriority);
-DECL_TEMPLATE(aix5, sys__nsleep);
-DECL_TEMPLATE(aix5, sys__pause);
-DECL_TEMPLATE(aix5, sys__poll);
-DECL_TEMPLATE(aix5, sys__select);
-DECL_TEMPLATE(aix5, sys__sem_wait);
-DECL_TEMPLATE(aix5, sys__setpgid);
-DECL_TEMPLATE(aix5, sys__setsid);
-DECL_TEMPLATE(aix5, sys__sigaction);
-DECL_TEMPLATE(aix5, sys__thread_self);
-DECL_TEMPLATE(aix5, sys__thread_setsched);
-DECL_TEMPLATE(aix5, sys_access);
-DECL_TEMPLATE(aix5, sys_accessx);
-DECL_TEMPLATE(aix5, sys_appgetrlimit);
-DECL_TEMPLATE(aix5, sys_appgetrusage);
-DECL_TEMPLATE(aix5, sys_apprestimer);
-DECL_TEMPLATE(aix5, sys_appsetrlimit);
-DECL_TEMPLATE(aix5, sys_appulimit);
-DECL_TEMPLATE(aix5, sys_bind);
-DECL_TEMPLATE(aix5, sys_chdir);
-DECL_TEMPLATE(aix5, sys_chmod);
-DECL_TEMPLATE(aix5, sys_chown);
-DECL_TEMPLATE(aix5, sys_close);
-DECL_TEMPLATE(aix5, sys_connext);
-DECL_TEMPLATE(aix5, sys_execve);
-DECL_TEMPLATE(aix5, sys_finfo);
-DECL_TEMPLATE(aix5, sys_fstatfs);
-DECL_TEMPLATE(aix5, sys_fstatx);
-DECL_TEMPLATE(aix5, sys_fsync);
-DECL_TEMPLATE(aix5, sys_getdirent);
-DECL_TEMPLATE(aix5, sys_getdirent64);
-DECL_TEMPLATE(aix5, sys_getdomainname);
-DECL_TEMPLATE(aix5, sys_getgidx);
-DECL_TEMPLATE(aix5, sys_getgroups);
-DECL_TEMPLATE(aix5, sys_gethostname);
-DECL_TEMPLATE(aix5, sys_getpriv);
-DECL_TEMPLATE(aix5, sys_getprocs);
-DECL_TEMPLATE(aix5, sys_getrpid);
-DECL_TEMPLATE(aix5, sys_getsockopt);
-DECL_TEMPLATE(aix5, sys_gettimerid);
-DECL_TEMPLATE(aix5, sys_getuidx);
-DECL_TEMPLATE(aix5, sys_incinterval);
-DECL_TEMPLATE(aix5, sys_kfcntl);
-DECL_TEMPLATE(aix5, sys_kfork);
-DECL_TEMPLATE(aix5, sys_kftruncate);
-DECL_TEMPLATE(aix5, sys_kgetsidx);
-DECL_TEMPLATE(aix5, sys_kill);
-DECL_TEMPLATE(aix5, sys_kioctl);
-DECL_TEMPLATE(aix5, sys_klseek);
-DECL_TEMPLATE(aix5, sys_knlist);
-DECL_TEMPLATE(aix5, sys_kpread);
-DECL_TEMPLATE(aix5, sys_kread);
-DECL_TEMPLATE(aix5, sys_kreadv);
-DECL_TEMPLATE(aix5, sys_kthread_ctl);
-DECL_TEMPLATE(aix5, sys_ktruncate);
-DECL_TEMPLATE(aix5, sys_kwaitpid);
-DECL_TEMPLATE(aix5, sys_kwrite);
-DECL_TEMPLATE(aix5, sys_kwritev);
-DECL_TEMPLATE(aix5, sys_listen);
-DECL_TEMPLATE(aix5, sys_loadbind);
-DECL_TEMPLATE(aix5, sys_loadquery);
-DECL_TEMPLATE(aix5, sys_lseek);
-DECL_TEMPLATE(aix5, sys_mkdir);
-DECL_TEMPLATE(aix5, sys_mmap);
-DECL_TEMPLATE(aix5, sys_mprotect);
-DECL_TEMPLATE(aix5, sys_mntctl);
-DECL_TEMPLATE(aix5, sys_munmap);
-DECL_TEMPLATE(aix5, sys_naccept);
-DECL_TEMPLATE(aix5, sys_ngetpeername);
-DECL_TEMPLATE(aix5, sys_ngetsockname);
-DECL_TEMPLATE(aix5, sys_nrecvfrom);
-DECL_TEMPLATE(aix5, sys_nrecvmsg);
-DECL_TEMPLATE(aix5, sys_nsendmsg);
-DECL_TEMPLATE(aix5, sys_open);
-DECL_TEMPLATE(aix5, sys_pipe);
-DECL_TEMPLATE(aix5, sys_privcheck);
-DECL_TEMPLATE(aix5, sys_readlink);
-DECL_TEMPLATE(aix5, sys_recv);
-DECL_TEMPLATE(aix5, sys_rename);
-DECL_TEMPLATE(aix5, sys_sbrk);
-DECL_TEMPLATE(aix5, sys_sched_get_priority_max);
-DECL_TEMPLATE(aix5, sys_sem_destroy);
-DECL_TEMPLATE(aix5, sys_sem_init);
-DECL_TEMPLATE(aix5, sys_sem_post);
-DECL_TEMPLATE(aix5, sys_send);
-DECL_TEMPLATE(aix5, sys_setgid);
-DECL_TEMPLATE(aix5, sys_setsockopt);
-DECL_TEMPLATE(aix5, sys_setuid);
-DECL_TEMPLATE(aix5, sys_shmat);
-DECL_TEMPLATE(aix5, sys_shmctl);
-DECL_TEMPLATE(aix5, sys_shmdt);
-DECL_TEMPLATE(aix5, sys_shmget);
-DECL_TEMPLATE(aix5, sys_shutdown);
-DECL_TEMPLATE(aix5, sys_sigcleanup);
-DECL_TEMPLATE(aix5, sys_sigprocmask);
-DECL_TEMPLATE(aix5, sys_socket);
-DECL_TEMPLATE(aix5, sys_statfs);
-DECL_TEMPLATE(aix5, sys_statx);
-DECL_TEMPLATE(aix5, sys_symlink);
-DECL_TEMPLATE(aix5, sys_sys_parm);
-DECL_TEMPLATE(aix5, sys_sysconfig);
-DECL_TEMPLATE(aix5, sys_thread_create);
-DECL_TEMPLATE(aix5, sys_thread_init);
-DECL_TEMPLATE(aix5, sys_thread_kill);
-/* thread_setmymask_fast is platform specific */
-DECL_TEMPLATE(aix5, sys_thread_setmystate);
-DECL_TEMPLATE(aix5, sys_thread_setmystate_fast);
-/* thread_setstate is platform specific */
-DECL_TEMPLATE(aix5, sys_thread_terminate_unlock);
-DECL_TEMPLATE(aix5, sys_thread_tsleep);
-DECL_TEMPLATE(aix5, sys_thread_tsleep_event);
-DECL_TEMPLATE(aix5, sys_thread_twakeup);
-DECL_TEMPLATE(aix5, sys_thread_twakeup_event);
-DECL_TEMPLATE(aix5, sys_thread_unlock);
-DECL_TEMPLATE(aix5, sys_thread_waitlock);
-DECL_TEMPLATE(aix5, sys_thread_waitlock_);
-DECL_TEMPLATE(aix5, sys_times);
-DECL_TEMPLATE(aix5, sys_umask);
-DECL_TEMPLATE(aix5, sys_uname);
-DECL_TEMPLATE(aix5, sys_unlink);
-DECL_TEMPLATE(aix5, sys_utimes);
-DECL_TEMPLATE(aix5, sys_vmgetinfo);
-DECL_TEMPLATE(aix5, sys_yield);
-
-
-#endif   // __PRIV_SYSWRAP_AIX5_H
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_syswrap/priv_types_n_macros.h b/coregrind/m_syswrap/priv_types_n_macros.h
index 0887b9c..b15d19b 100644
--- a/coregrind/m_syswrap/priv_types_n_macros.h
+++ b/coregrind/m_syswrap/priv_types_n_macros.h
@@ -98,15 +98,6 @@
       Int o_arg6;
       Int uu_arg7;
       Int uu_arg8;
-#     elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-      Int o_arg1;
-      Int o_arg2;
-      Int o_arg3;
-      Int o_arg4;
-      Int o_arg5;
-      Int o_arg6;
-      Int o_arg7;
-      Int o_arg8;
 #     elif defined(VGP_x86_darwin)
       Int s_arg1;
       Int s_arg2;
@@ -180,17 +171,6 @@
 extern
 SyscallTableEntry* ML_(get_linux_syscall_entry)( UInt sysno );
 
-#elif defined(VGP_ppc32_aix5)
-/* Same scheme on AIX5.  This is more complex than the simple fixed
-   table lookup typical for Linux, since the syscalls don't have fixed
-   numbers. */
-extern
-SyscallTableEntry* ML_(get_ppc32_aix5_syscall_entry) ( UInt sysno );
-
-#elif defined(VGP_ppc64_aix5)
-extern
-SyscallTableEntry* ML_(get_ppc64_aix5_syscall_entry) ( UInt sysno );
-
 #elif defined(VGO_darwin)
 /* XXX: Darwin still uses the old scheme of exposing the table
    array(s) and size(s) directly to syswrap-main.c.  This should be
@@ -277,7 +257,7 @@
     vgSysWrap_##auxstr##_##name##_after
 
 /* Add a generic wrapper to a syscall table. */
-#if defined(VGO_linux) || defined(VGO_aix5)
+#if defined(VGO_linux)
 #  define GENX_(sysno, name)  WRAPPER_ENTRY_X_(generic, sysno, name)
 #  define GENXY(sysno, name)  WRAPPER_ENTRY_XY(generic, sysno, name)
 #elif defined(VGO_darwin)
@@ -292,18 +272,6 @@
 #define LINX_(sysno, name)    WRAPPER_ENTRY_X_(linux, sysno, name) 
 #define LINXY(sysno, name)    WRAPPER_ENTRY_XY(linux, sysno, name)
 
-/* Add an AIX5-specific, arch-independent wrapper to a syscall
-   table. */
-#define AIXXY(sysno, name)                     \
-   { & sysno,                                  \
-     { & WRAPPER_PRE_NAME(aix5, name),         \
-       & WRAPPER_POST_NAME(aix5, name) }} 
-
-#define AIXX_(sysno, name)                     \
-   { & sysno,                                  \
-     { & WRAPPER_PRE_NAME(aix5, name),         \
-       NULL }} 
-
 
 /* ---------------------------------------------------------------------
    Macros useful for writing wrappers concisely.  These refer to the
@@ -397,9 +365,6 @@
 #  define PRA5(s,t,a) PRRAn(5,s,t,a)
 #  define PRA6(s,t,a) PRRAn(6,s,t,a)
 
-#elif defined(VGO_aix5)
-#  error Need to fill this in for AIX5
-
 #elif defined(VGP_x86_darwin)
    /* Up to 8 parameters, all on the stack. */
 #  define PRA1(s,t,a) PSRAn(1,s,t,a)
diff --git a/coregrind/m_syswrap/syscall-ppc32-aix5.S b/coregrind/m_syswrap/syscall-ppc32-aix5.S
deleted file mode 100644
index 65f7dc3..0000000
--- a/coregrind/m_syswrap/syscall-ppc32-aix5.S
+++ /dev/null
@@ -1,225 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Support for doing system calls.         syscall-ppc32-aix5.S ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-  This file is part of Valgrind, a dynamic binary instrumentation
-  framework.
-
-  Copyright (C) 2006-2010 OpenWorks LLP
-     info@open-works.co.uk
-
-  Derived from Paul Mackerras' implementation of same for ppc32-linux
-  in syscall-ppc32-linux.S.
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU General Public License as
-  published by the Free Software Foundation; either version 2 of the
-  License, or (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-  02111-1307, USA.
-
-  The GNU General Public License is contained in the file COPYING.
-*/
-
-#if defined(VGP_ppc32_aix5)
-
-#include "pub_core_basics_asm.h"
-#include "libvex_guest_offsets.h"
-
-/* kludge: from include/vki/vki-ppc32-aix5.h */
-#define VKI_SIG_SETMASK    2
-
-
-/*----------------------------------------------------------------*/
-/*
-        Perform a syscall for the client.  This will run a syscall
-        with the client's specific per-thread signal mask.
-
-        The structure of this function is such that, if the syscall is
-        interrupted by a signal, we can determine exactly what
-        execution state we were in with respect to the execution of
-        the syscall by examining the value of NIP in the signal
-        handler.  This means that we can always do the appropriate
-        thing to precisely emulate the kernel's signal/syscall
-        interactions.
-
-        The syscall number is taken from the argument, even though it
-        should also be in R2 in guest_state.  The syscall result is written
-        back to R3 and R4 in the guest state on completion.
-
-        Returns 0 if the syscall was successfully called (even if the
-        syscall itself failed), or a nonzero error code in the lowest
-	8 bits if one of the sigprocmasks failed (there's no way to
-	determine which one failed).  And there's no obvious way to
-	recover from that either, but nevertheless we want to know.
-
-        VG_(fixup_guest_state_after_syscall_interrupted) does the
-	thread state fixup in the case where we were interrupted by a
-	signal.
-
-        Prototype:
-
-	UWord ML_(do_syscall_for_client_WRK)(
-				  Int syscallno,		// r3
-				  void* guest_state,		// r4
-				  const vki_sigset_t *sysmask,	// r5
-				  const vki_sigset_t *postmask,	// r6
-				  Int sigsetSzB,		// r7
-				  Int __nr_sigprocmask)		// r8
-*/
-	.file	"syscall-ppc32-aix6.S"
-
-	.toc
-	.csect .text[PR]
-	.align 2
-	.globl ML_(do_syscall_for_client_WRK)
-	.globl .ML_(do_syscall_for_client_WRK)
-	.csect ML_(do_syscall_for_client_WRK)[DS]
-ML_(do_syscall_for_client_WRK):
-	.long .ML_(do_syscall_for_client_WRK), TOC[tc0], 0
-	.csect .text[PR]
-.ML_(do_syscall_for_client_WRK):
-        /* make a stack frame */
-        stwu    1,-512(1)
-        stw     31,256(1)
-        stw     30,260(1)
-        stw     29,264(1)
-        stw     28,268(1)
-	stw	27,272(1)
-	stw	26,276(1)
-	mflr	26
-	stw	26,280(1)
-	stw	2,284(1)
-        mr      31,3            /* syscall number */
-        mr      30,4            /* guest_state */
-        mr      29,6            /* postmask */
-        mr      28,7            /* sigsetSzB */
-	mr	27,8		/* __nr_sigprocmask */
-
-Lvg1:   /* Even though we can't take a signal until the sigprocmask 
-	completes, start the range early.  If PC is in the range [1,2),
-	the syscall hasn't been started yet */
-
-        /* set the signal mask for doing the system call */
-        /* set up for sigprocmask(SIG_SETMASK, sysmask, postmask) */
-	mr      2,8
-        li      3,VKI_SIG_SETMASK
-        mr      4,5
-        mr      5,6
-	mr	6,7	/* sigsetSzB -- needed on AIX ? */
-
-	/* actually do the sigprocmask */
-	crorc	6,6,6
-	.long 0x48000005 /* bl here+4 */
-	mflr	26
-	addi	26,26,16
-	mtlr	26
-	sc
-
-	/* did it fail? (assuming r3 == 0 for success) */
-	cmpwi	0,3,0
-	bne	0,Lvg7
-
-        /* load up syscall args from the threadstate */
-        lwz     3,OFFSET_ppc32_GPR3(30)
-        lwz     4,OFFSET_ppc32_GPR4(30)
-        lwz     5,OFFSET_ppc32_GPR5(30)
-        lwz     6,OFFSET_ppc32_GPR6(30)
-        lwz     7,OFFSET_ppc32_GPR7(30)
-        lwz     8,OFFSET_ppc32_GPR8(30)
-        lwz     9,OFFSET_ppc32_GPR9(30)
-        lwz     10,OFFSET_ppc32_GPR10(30)
-        mr      2,31            /* syscall number */
-
-	crorc	6,6,6
-	.long 0x48000005 /* bl here+4 */
-	mflr	26
-	addi	26,26,16
-	mtlr	26
-
-        /* If PC is in the range [2,2], then the syscall was either
-	just about to start, or was interrupted and the kernel was 
-	restarting it. */
-Lvg2:   sc                      /* do the syscall */
-
-	/* In the range [3, 4), the syscall result is in r3/r4, but 
-	hasn't been committed to R3/R4. */
-        /* put the result back in the threadstate  */
-
-Lvg3:	stw     3,OFFSET_ppc32_GPR3(30)     /* gst->GPR3 = res */
-	stw     4,OFFSET_ppc32_GPR4(30)     /* gst->GPR4 = err */
-
-        /* Block signals again.  If PC is in [4,5), then the syscall 
-	is complete and we needn't worry about it. */
-	/* set up for sigprocmask(SIG_SETMASK, postmask, NULL) */
-Lvg4:   mr	2,27
-        li      3,VKI_SIG_SETMASK
-        mr      4,29
-        li      5,0
-        mr      6,28	/* sigsetSzB -- needed on AIX ? */
-
-	/* actually do the sigprocmask */
-	crorc	6,6,6
-	.long 0x48000005 /* bl here+4 */
-	mflr	26
-	addi	26,26,16
-	mtlr	26
-	sc
-
-	/* did it fail? (assuming r3 == 0 for success) */
-	cmpwi	0,3,0
-	bne	0,Lvg7
-
-        /* now safe from signals */
-	li	3,0		/* SUCCESS */
-
-        /* pop off stack frame */
-Lvg5:   lwz	2,284(1)
-	lwz	26,280(1)
-	mtlr	26
-	lwz     26,276(1)
-	lwz	27,272(1)
-	lwz	28,268(1)
-        lwz     29,264(1)
-        lwz     30,260(1)
-        lwz     31,256(1)
-        addi    1,1,512
-        blr
-
-	/* failure: return 0x8000 | error code */
-Lvg7:   mr	3,4
-	ori	3,3,0x8000	/* FAILURE -- ensure return value is nonzero */
-        b       Lvg5
-
-/* export the ranges so that
-   VG_(fixup_guest_state_after_syscall_interrupted) can do the
-   right thing */
-
-	.csect .data[RW],3
-        .align 2
-.globl ML_(blksys_setup)
-.globl ML_(blksys_restart)
-.globl ML_(blksys_complete)
-.globl ML_(blksys_committed)
-.globl ML_(blksys_finished)
-ML_(blksys_setup):     .long Lvg1
-ML_(blksys_restart):   .long Lvg2
-ML_(blksys_complete):  .long Lvg3
-ML_(blksys_committed): .long Lvg4
-ML_(blksys_finished):  .long Lvg5
-
-#endif // defined(VGP_ppc32_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_syswrap/syscall-ppc64-aix5.S b/coregrind/m_syswrap/syscall-ppc64-aix5.S
deleted file mode 100644
index 0e6cdc5..0000000
--- a/coregrind/m_syswrap/syscall-ppc64-aix5.S
+++ /dev/null
@@ -1,225 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Support for doing system calls.         syscall-ppc64-aix5.S ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-  This file is part of Valgrind, a dynamic binary instrumentation
-  framework.
-
-  Copyright (C) 2006-2010 OpenWorks LLP
-     info@open-works.co.uk
-
-  Derived from Paul Mackerras' implementation of same for ppc32-linux
-  in syscall-ppc32-linux.S.
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU General Public License as
-  published by the Free Software Foundation; either version 2 of the
-  License, or (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-  02111-1307, USA.
-
-  The GNU General Public License is contained in the file COPYING.
-*/
-
-#if defined(VGP_ppc64_aix5)
-
-#include "pub_core_basics_asm.h"
-#include "libvex_guest_offsets.h"
-
-/* kludge: from include/vki/vki-ppc64-aix5.h */
-#define VKI_SIG_SETMASK    2
-
-
-/*----------------------------------------------------------------*/
-/*
-        Perform a syscall for the client.  This will run a syscall
-        with the client's specific per-thread signal mask.
-
-        The structure of this function is such that, if the syscall is
-        interrupted by a signal, we can determine exactly what
-        execution state we were in with respect to the execution of
-        the syscall by examining the value of NIP in the signal
-        handler.  This means that we can always do the appropriate
-        thing to precisely emulate the kernel's signal/syscall
-        interactions.
-
-        The syscall number is taken from the argument, even though it
-        should also be in R2 in guest_state.  The syscall result is written
-        back to R3 and R4 in the guest state on completion.
-
-        Returns 0 if the syscall was successfully called (even if the
-        syscall itself failed), or a nonzero error code in the lowest
-	8 bits if one of the sigprocmasks failed (there's no way to
-	determine which one failed).  And there's no obvious way to
-	recover from that either, but nevertheless we want to know.
-
-        VG_(fixup_guest_state_after_syscall_interrupted) does the
-	thread state fixup in the case where we were interrupted by a
-	signal.
-
-        Prototype:
-
-	UWord ML_(do_syscall_for_client_WRK)(
-				  Int syscallno,		// r3
-				  void* guest_state,		// r4
-				  const vki_sigset_t *sysmask,	// r5
-				  const vki_sigset_t *postmask,	// r6
-				  Int sigsetSzB,		// r7
-				  Int __nr_sigprocmask)		// r8
-*/
-	.file	"syscall-ppc64-aix6.S"
-
-	.toc
-	.csect .text[PR]
-	.align 2
-	.globl ML_(do_syscall_for_client_WRK)
-	.globl .ML_(do_syscall_for_client_WRK)
-	.csect ML_(do_syscall_for_client_WRK)[DS]
-ML_(do_syscall_for_client_WRK):
-	.llong .ML_(do_syscall_for_client_WRK), TOC[tc0], 0
-	.csect .text[PR]
-.ML_(do_syscall_for_client_WRK):
-        /* make a stack frame */
-        stdu    1,-1024(1)
-        std     31,512(1)
-        std     30,520(1)
-        std     29,528(1)
-        std     28,536(1)
-	std	27,544(1)
-	std	26,552(1)
-	mflr	26
-	std	26,560(1)
-	std	2,568(1)
-        mr      31,3            /* syscall number */
-        mr      30,4            /* guest_state */
-        mr      29,6            /* postmask */
-        mr      28,7            /* sigsetSzB */
-	mr	27,8		/* __nr_sigprocmask */
-
-Lvg1:   /* Even though we can't take a signal until the sigprocmask 
-	completes, start the range early.  If PC is in the range [1,2),
-	the syscall hasn't been started yet */
-
-        /* set the signal mask for doing the system call */
-        /* set up for sigprocmask(SIG_SETMASK, sysmask, postmask) */
-	mr      2,8
-        li      3,VKI_SIG_SETMASK
-        mr      4,5
-        mr      5,6
-	mr	6,7	/* sigsetSzB -- needed on AIX ? */
-
-	/* actually do the sigprocmask */
-	crorc	6,6,6
-	.long 0x48000005 /* bl here+4 */
-	mflr	26
-	addi	26,26,16
-	mtlr	26
-	sc
-
-	/* did it fail? (assuming r3 == 0 for success) */
-	cmpdi	0,3,0
-	bne	0,Lvg7
-
-        /* load up syscall args from the threadstate */
-        ld      3,OFFSET_ppc64_GPR3(30)
-        ld      4,OFFSET_ppc64_GPR4(30)
-        ld      5,OFFSET_ppc64_GPR5(30)
-        ld      6,OFFSET_ppc64_GPR6(30)
-        ld      7,OFFSET_ppc64_GPR7(30)
-        ld      8,OFFSET_ppc64_GPR8(30)
-        ld      9,OFFSET_ppc64_GPR9(30)
-        ld      10,OFFSET_ppc64_GPR10(30)
-        mr      2,31            /* syscall number */
-
-	crorc	6,6,6
-	.long 0x48000005 /* bl here+4 */
-	mflr	26
-	addi	26,26,16
-	mtlr	26
-
-        /* If PC is in the range [2,2], then the syscall was either
-	just about to start, or was interrupted and the kernel was 
-	restarting it. */
-Lvg2:   sc                      /* do the syscall */
-
-	/* In the range [3, 4), the syscall result is in r3/r4, but 
-	hasn't been committed to R3/R4. */
-        /* put the result back in the threadstate  */
-
-Lvg3:	std     3,OFFSET_ppc64_GPR3(30)     /* gst->GPR3 = res */
-	std     4,OFFSET_ppc64_GPR4(30)     /* gst->GPR4 = err */
-
-        /* Block signals again.  If PC is in [4,5), then the syscall 
-	is complete and we needn't worry about it. */
-	/* set up for sigprocmask(SIG_SETMASK, postmask, NULL) */
-Lvg4:   mr	2,27
-        li      3,VKI_SIG_SETMASK
-        mr      4,29
-        li      5,0
-        mr      6,28	/* sigsetSzB -- needed on AIX ? */
-
-	/* actually do the sigprocmask */
-	crorc	6,6,6
-	.long 0x48000005 /* bl here+4 */
-	mflr	26
-	addi	26,26,16
-	mtlr	26
-	sc
-
-	/* did it fail? (assuming r3 == 0 for success) */
-	cmpdi	0,3,0
-	bne	0,Lvg7
-
-        /* now safe from signals */
-	li	3,0		/* SUCCESS */
-
-        /* pop off stack frame */
-Lvg5:   ld      2,568(1)
-	ld      26,560(1)
-	mtlr	26
-	ld      26,552(1)
-	ld	27,544(1)
-	ld	28,536(1)
-        ld      29,528(1)
-        ld      30,520(1)
-        ld      31,512(1)
-        addi    1,1,1024
-        blr
-
-	/* failure: return 0x8000 | error code */
-Lvg7:   mr	3,4
-	ori	3,3,0x8000	/* FAILURE -- ensure return value is nonzero */
-        b       Lvg5
-
-/* export the ranges so that
-   VG_(fixup_guest_state_after_syscall_interrupted) can do the
-   right thing */
-
-	.csect .data[RW],3
-        .align 2
-.globl ML_(blksys_setup)
-.globl ML_(blksys_restart)
-.globl ML_(blksys_complete)
-.globl ML_(blksys_committed)
-.globl ML_(blksys_finished)
-ML_(blksys_setup):     .llong Lvg1
-ML_(blksys_restart):   .llong Lvg2
-ML_(blksys_complete):  .llong Lvg3
-ML_(blksys_committed): .llong Lvg4
-ML_(blksys_finished):  .llong Lvg5
-
-#endif // defined(VGP_ppc64_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_syswrap/syswrap-aix5.c b/coregrind/m_syswrap/syswrap-aix5.c
deleted file mode 100644
index c765a3b..0000000
--- a/coregrind/m_syswrap/syswrap-aix5.c
+++ /dev/null
@@ -1,2601 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- AIX5-specific syscalls.                       syswrap-aix5.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#if defined(VGO_aix5)
-
-#include "pub_core_basics.h"
-#include "pub_core_vki.h"
-#include "pub_core_vkiscnums.h"
-#include "pub_core_threadstate.h"
-#include "pub_core_aspacemgr.h"
-#include "pub_core_debuginfo.h"    // VG_(di_notify_*)
-#include "pub_core_transtab.h"     // VG_(discard_translations)
-#include "pub_core_xarray.h"
-#include "pub_core_clientstate.h"
-#include "pub_core_debuglog.h"
-#include "pub_tool_gdbserver.h"     // VG_(gdbserver)
-#include "pub_core_libcbase.h"
-#include "pub_core_libcassert.h"
-#include "pub_core_libcfile.h"
-#include "pub_core_libcprint.h"
-#include "pub_core_libcproc.h"
-#include "pub_core_libcsignal.h"
-#include "pub_core_mallocfree.h"
-#include "pub_core_tooliface.h"
-#include "pub_core_options.h"
-#include "pub_core_scheduler.h"
-#include "pub_core_signals.h"
-#include "pub_core_syscall.h"
-#include "pub_core_sigframe.h"     // VG_(sigframe_destroy)
-#include "pub_core_syswrap.h"
-#include "pub_core_stacktrace.h"
-
-#include "priv_types_n_macros.h"
-#include "priv_syswrap-aix5.h"
-
-
-
-/* ---------------------------------------------------------------------
-   Misc helpers
-   ------------------------------------------------------------------ */
-
-/* Allocate a stack for this thread, if it doesn't already have one.
-   They're allocated lazily, and never freed.  Returns the initial stack
-   pointer value to use, or 0 if allocation failed. */
-Addr ML_(allocstack)(ThreadId tid)
-{
-   ThreadState* tst = VG_(get_ThreadState)(tid);
-   VgStack*     stack;
-   Addr         initial_SP;
-
-   /* Either the stack_base and stack_init_SP are both zero (in which
-      case a stack hasn't been allocated) or they are both non-zero,
-      in which case it has. */
-
-   if (tst->os_state.valgrind_stack_base == 0)
-      vg_assert(tst->os_state.valgrind_stack_init_SP == 0);
-
-   if (tst->os_state.valgrind_stack_base != 0)
-      vg_assert(tst->os_state.valgrind_stack_init_SP != 0);
-
-   /* If no stack is present, allocate one. */
-   if (tst->os_state.valgrind_stack_base == 0) {
-      stack = VG_(am_alloc_VgStack)( &initial_SP );
-      if (stack) {
-         /* Leave some space above SP because AIX's ABI stores
-            stuff there. */
-         initial_SP -= 256;
-         vg_assert(initial_SP > (Addr)stack);
-         tst->os_state.valgrind_stack_base    = (Addr)stack;
-         tst->os_state.valgrind_stack_init_SP = initial_SP;
-      } else {
-         return 0; /* allocation of stack failed */
-      }
-   }
-
-   if (0)
-      VG_(printf)( "stack for tid %d at %p; init_SP=%p\n",
-                   tid,
-                   (void*)tst->os_state.valgrind_stack_base,
-                   (void*)tst->os_state.valgrind_stack_init_SP );
-
-   return tst->os_state.valgrind_stack_init_SP;
-}
-
-
-/* If we know or believe a module load/unload event has happened, get
-   aspacem to re-read /proc/../map to update its picture of what text
-   and data segments are present.  This also notifies all the usual
-   parties that need to know about address space changes. */
-
-void ML_(aix5_rescan_procmap_after_load_or_unload) ( void )
-{
-   AixCodeSegChange* changes;
-   Int changes_size, changes_used, i;
-
-   /* Find out how many AixCodeSegChange records we will need, and
-      acquire them. */
-   changes_size = VG_(am_aix5_reread_procmap_howmany_directives)(); 
-   changes = VG_(arena_malloc)(VG_AR_CORE, "syswrap-aix5.arpalou.1",
-                               changes_size * sizeof(AixCodeSegChange));
-   vg_assert(changes);
-
-   /* Now re-read /proc/<pid>/map and acquire a change set */
-   VG_(am_aix5_reread_procmap)( changes, &changes_used );
-   vg_assert(changes_used >= 0 && changes_used <= changes_size);
-
-   /* And notify all parties of the changes. */
-   for (i = 0; i < changes_used; i++) {
-      ULong di_handle = VG_(di_aix5_notify_segchange)(
-                           changes[i].code_start,
-                           changes[i].code_len,
-                           changes[i].data_start,
-                           changes[i].data_len,
-                           changes[i].file_name,
-                           changes[i].mem_name,
-                           changes[i].is_mainexe,
-                           changes[i].acquire
-                        );
-
-      if (changes[i].acquire) {
-         VG_TRACK( new_mem_mmap, 
-                   changes[i].code_start, changes[i].code_len, 
-                   /*r*/True, /*w*/False, /*x*/True, di_handle );
-         VG_TRACK( new_mem_mmap, 
-                   changes[i].data_start, changes[i].data_len, 
-                   /*r*/True, /*w*/True, /*x*/False, 0/*or di_handle?*/ );
-      } else {
-         VG_TRACK( die_mem_munmap, 
-                   changes[i].code_start, changes[i].code_len );
-         VG_TRACK( die_mem_munmap, 
-                   changes[i].data_start, changes[i].data_len );
-         VG_(discard_translations)(
-                   changes[i].code_start, changes[i].code_len,
-                   "POST(sys___loadx/sys__kload)(code)" );
-         VG_(discard_translations)(
-                    changes[i].data_start, changes[i].data_len,
-                   "POST(sys___loadx/sys__kload)(data)" );
-      }
-   }
-
-   VG_(arena_free)(VG_AR_CORE, changes);
-}
-
-
-/* Mess with the given thread's pc/toc so that it is entering
-   pthread_exit() with argument PTHREAD_CANCELED.  Returns True if ok,
-   False if it failed to do so, due to not being able to find
-   pthread_exit() by searching symbol tables. */
-Bool ML_(aix5_force_thread_into_pthread_exit)( ThreadId tid )
-{
-   Addr ent = 0, toc = 0;
-   Bool found;
-   ThreadState* tst = VG_(get_ThreadState)(tid);
-   found = VG_(lookup_symbol_SLOW)("libpthread*.a(*.o)", "pthread_exit", 
-                                   &ent, &toc);
-   if (found) {
-      if (0) 
-         VG_(printf)("THREAD CANCELED, new cia,toc = %#lx,%#lx\n", ent, toc);
-      tst->arch.vex.guest_CIA  = ent;
-      tst->arch.vex.guest_GPR2 = toc;
-      tst->arch.vex.guest_GPR3 = (Word)(-1); /* == PTHREAD_CANCELED */
-      /* If the thread is blocked in a syscall, we better bop it on
-         the head with SIGVGKILL in order to get it out of said
-         syscall. */
-      if (tst->status == VgTs_WaitSys) {
-         if (VG_(clo_trace_syscalls))
-            VG_(printf)("(sending SIGVGKILL to tid %d)", (Int)tid);
-         VG_(get_thread_out_of_syscall)( tid  );
-      }
-      return True; /* ok */
-   } else {
-      // urk.  Now we're hosed.  Let the caller figure out what to do.
-      return False; /* failed */
-   }
-}
-
-
-/* For various reasons, on AIX we may have to just give up if
-   continuing is too difficult (eg, risk of future deadlock).  This
-   sets up the process state to exit straight away, but does not
-   actually itself exit. */
-void ML_(aix5_set_threadstate_for_emergency_exit)(ThreadId tid, HChar* why)
-{
-   ThreadState* tst = VG_(get_ThreadState)(tid);
-   /* Set the thread's status to be exiting and taking out the
-      entire process, then claim that the syscall succeeded. */
-   tst->exitreason = VgSrc_ExitProcess;
-   tst->os_state.exitcode = 1;
-   if (!VG_(clo_xml)) {
-      VG_(message)(Vg_UserMsg, 
-         "WARNING: AIX: %s\n", why);
-      VG_(message)(Vg_UserMsg, 
-         "WARNING: (too difficult to continue past this point).\n");
-      VG_(get_and_pp_StackTrace)(tid, 10);
-   }
-}
-
-
-/* Update aspacem etc on conclusion of a successful sbrk/__libc_sbrk
-   call.  2006-08-24: this was not completed because I don't 
-   understand what sbrk/__libc_sbrk are doing. */
-
-static void handle_sbrk ( Word delta )
-{
-   return;
-   /*NOTREACHED*/
-   if (delta > 0) {
-      /* Map in VG_(brk_limit) for delta */
-      /* using notify_mmap ? */
-      VG_(brk_limit) += delta;
-   }
-   if (delta < 0) {
-     Addr tmp = VG_(brk_limit);
-     VG_(brk_limit) += delta;
-     /* Can't move below original starting point */
-     if (VG_(brk_limit) < VG_(brk_base))
-        VG_(brk_limit) = VG_(brk_base);
-     if (VG_(brk_limit) < tmp)
-        /* Unmap VG_(brk_limit) for tmp - VG_(brk_limit) */
-        /* using notify_munmap ? */
-        ;
-   }
-   if (VG_(clo_trace_syscalls))
-      VG_(printf)("new brk: 0x%010llx-0x%010llx (size %lld)\n",
-                  (ULong)VG_(brk_base),
-                  (ULong)VG_(brk_limit),
-                  (ULong)VG_(brk_limit) - (ULong)VG_(brk_base));
-}
-
-
-/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#include <sys/thread.h>
-#include <sys/poll.h>
-#include <sys/times.h>
-#include <sys/shm.h>
-#include <semaphore.h>
-#include <sys/statfs.h>
-#include <sys/utsname.h>
-/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-
-HChar* ML_(aix5debugstuff_pc_to_fnname) ( Addr pc )
-{
-   Bool ok;
-   static HChar name[100];
-   ok = VG_(get_fnname_w_offset)(pc, name, 100);
-   if (!ok) VG_(strcpy)(name, "???");
-   return &name[0];
-}
-
-static void aix5debugstuff_show_sigset ( vki_sigset_t* set )
-{
-  Int i;
-  UChar* p = (UChar*)set;
-  for (i = 0; i < sizeof(vki_sigset_t); i++)
-     VG_(printf)("%02x", (Int)p[i]);
-}
-
-static HChar* aix5debugstuff_name_of_tstate_flag ( UWord flag )
-{
-   Int i, nset;
-   nset = 0;
-   for (i = 0; i < 8*sizeof(UWord); i++)
-      if (flag & (1U << i))
-         nset++;
-   vg_assert(nset == 1);
-   switch (flag) {
-      case TSTATE_LOCAL:           return "LOCAL";
-      case TSTATE_CANCEL_DEFER:    return "CANCEL_DEFER";
-      case TSTATE_CANCEL_DISABLE:  return "CANCEL_DISABLE";
-      case TSTATE_CANCEL_PENDING:  return "CANCEL_PENDING";
-      case TSTATE_CANCEL_CHKPT:    return "CANCEL_CHKPT";
-      case TSTATE_INTR:            return "INTR";
-      case TSTATE_EXEMPT:          return "EXEMPT";
-#ifdef TSTATE_PROFILING_OFF
-      case TSTATE_PROFILING_OFF:   return "PROFILING_OFF";
-#endif
-      case TSTATE_SUSPEND:         return "SUSPEND";
-      case TSTATE_CONT:            return "CONT";
-#ifdef TSTATE_CREDS
-      case TSTATE_CREDS:           return "CREDS";
-#endif
-#ifdef TSTATE_PROCHANDLERS
-      case TSTATE_PROCHANDLERS:    return "PROCHANDLERS";
-#endif
-      case TSTATE_ADVH:            return "ADVH";
-      case TSTATE_SYNCH:           return "SYNCH";
-      case TSTATE_USCHED:          return "USCHED";
-      case TSTATE_DEFAULT_SCHED:   return "DEFAULT_SCHED";
-#ifdef TSTATE_INHERIT_SCHED
-      case TSTATE_INHERIT_SCHED:   return "INHERIT_SCHED";
-#endif
-#ifdef TSTATE_LOCAL_INIT
-      case TSTATE_LOCAL_INIT:      return "LOCAL_INIT";
-#endif
-#ifdef TSTATE_LOCAL_TERM
-      case TSTATE_LOCAL_TERM:      return "LOCAL_TERM";
-#endif
-#ifdef TSTATE_LOCAL_MCHANGE
-      case TSTATE_LOCAL_MCHANGE:   return "LOCAL_MCHANGE";
-#endif
-      case TSTATE_CHANGE_ALL:      return "CHANGE_ALL";
-#ifdef TSTATE_CHANGE_PTID
-      case TSTATE_CHANGE_PTID:     return "CHANGE_PTID";
-#endif
-#ifdef TSTATE_CHANGE_PROFILE
-      case TSTATE_CHANGE_PROFILE:  return "CHANGE_PROFILE";
-#endif
-#ifdef TSTATE_CHANGE_SSTACK
-      case TSTATE_CHANGE_SSTACK:   return "CHANGE_SSTACK";
-#endif
-      case TSTATE_CHANGE_ERRNOP:   return "CHANGE_ERRNOP";
-      case TSTATE_CHANGE_SIGMASK:  return "CHANGE_SIGMASK";
-      case TSTATE_CHANGE_PSIG:     return "CHANGE_PSIG";
-      case TSTATE_CHANGE_SCHED:    return "CHANGE_SCHED";
-      case TSTATE_CHANGE_FLAGS:    return "CHANGE_FLAGS";
-      case TSTATE_CHANGE_USERDATA: return "CHANGE_USERDATA";
-      default: return "???";
-   }
-}
-
-void ML_(aix5debugstuff_show_tstate_flags) ( UWord w )
-{
-   const Int step = 5;
-   Int i, j;
-   UWord m;
-   j = 0;
-   for (i = 0; i < 8*sizeof(UWord); i++) {
-      m = 1U << i;
-      if ((w & m) == 0)
-         continue;
-      if ((j % step) == 0)
-         VG_(printf)("  ");
-      VG_(printf)("%s ", aix5debugstuff_name_of_tstate_flag(w & m));
-      if ((j % step) == step-1 && j > 0)
-         VG_(printf)("\n");
-      j++;
-   }
-   if (((j-1) % step) != step-1 && j > 0)
-      VG_(printf)("\n");
-}
-
-void ML_(aix5debugstuff_show_tstate) ( Addr tsA, HChar* who )
-{
-   Int i;
-   const Int step = sizeof(void*)==8  ? 3 : 5;
-   struct tstate* ts = (struct tstate*)tsA;
-   VG_(printf)("\n{ ========= %s =========\n", who);
-   for (i = 0; i < _NGPRS; i++) {
-      if ((i % step) == 0) 
-         VG_(printf)("  [%2d]  ", i);
-      if (sizeof(void*)==8)
-         VG_(printf)("%016llx  ", (ULong)ts->mst.gpr[i]);
-      else
-         VG_(printf)("%08llx  ", (ULong)ts->mst.gpr[i]);
-      if ((i == _NGPRS-1) || ((i % step) == step-1 && i > 0)) 
-         VG_(printf)("\n");
-   }
-   VG_(printf)("  [iar] %#llx %s\n", (ULong)ts->mst.iar, 
-               ML_(aix5debugstuff_pc_to_fnname)(ts->mst.iar));
-
-   VG_(printf)("  errnop_addr      %p\n", ts->errnop_addr);
-
-   VG_(printf)("  sigmask          ");
-   aix5debugstuff_show_sigset( (vki_sigset_t*)&ts->sigmask );
-   VG_(printf)("\n");
-
-   VG_(printf)("  psig             ");
-   aix5debugstuff_show_sigset( (vki_sigset_t*)&ts->psig );
-   VG_(printf)("\n");
-
-   VG_(printf)("  policy           %d\n", ts->policy);
-   VG_(printf)("  priority         %d\n", ts->priority);
-   VG_(printf)("  flags            0x%x\n", ts->flags);
-   ML_(aix5debugstuff_show_tstate_flags)( (UWord)ts->flags );
-   VG_(printf)("  flagmask         0x%x\n", ts->flagmask);
-   VG_(printf)("  userdata         %p\n", (void*)ts->userdata);
-   VG_(printf)("  fpinfo           %d\n", ts->fpinfo);
-   VG_(printf)("  fpscrx           %d\n", ts->fpscrx);
-   VG_(printf)("  sigaltstack      ??\n");
-   VG_(printf)("  thread_control_p 0x%llx\n", (ULong)ts->thread_control_p);
-//   AIX 5.1 does not seem to have these members
-//   VG_(printf)("  prbase           %p\n", (void*)ts->prbase);
-//   VG_(printf)("  credp            %p\n", (void*)ts->credp);
-//   VG_(printf)("  ptid             %d\n", (int)ts->ptid);
-//   VG_(printf)("  tct_clock        %d\n", (int)ts->tct_clock);
-   UInt* p = (UInt*)tsA;
-   for (i = 0; i < sizeof(struct tstate)/sizeof(UInt); i++) {
-      HChar* s = ML_(aix5debugstuff_pc_to_fnname)( (Addr)p[i] );
-      if (0==VG_(strcmp)(s,"???"))
-         continue;
-      VG_(printf)("  [%d] %x %s\n", i, p[i], s);
-   }
-   VG_(printf)("}\n");
-}
-
-/* ---------------------------------------------------------------------
-   PRE/POST wrappers for arch-generic, AIX5-specific syscalls.  Note:
-   in fact AIX5 doesn't share any wrappers with Linux since it's
-   difficult to get syswrap-generic.c to compile on AIX.  Hence in
-   fact this file also serves the role of syswrap-generic.c for AIX.
-   This could probably be improved at the cost of some extra effort.
-   ------------------------------------------------------------------ */
-
-// Nb: See the comment above the generic PRE/POST wrappers in
-// m_syswrap/syswrap-generic.c for notes about how they work.
-
-#define PRE(name)       DEFN_PRE_TEMPLATE(aix5, name)
-#define POST(name)      DEFN_POST_TEMPLATE(aix5, name)
-
-
-// How to make __libc_sbrk appear to fail, from libc's point of view:
-//  SysRes r;
-//  r.res = -1; /* significant to libc */
-//  r.err = VKI_ENOMEM; /* not significant to libc */
-//  SET_STATUS_from_SysRes( r );
-//  return;
-
-PRE(sys___libc_sbrk)
-{
-   PRINT("__libc_sbrk (BOGUS HANDLER)( %#lx )",ARG1);
-   PRE_REG_READ1(long, "__libc_sbrk", long, arg1);
-   /* After a zero sbrk, disallow aspacem from doing sbrk, since libc
-      might rely on the value returned by this syscall. */
-   /* 1 Oct 06: not currently used (aspacemgr-aix5.c ignores it) */
-   VG_(am_aix5_sbrk_allowed) = toBool(ARG1 != 0);
-   /* Disallow libc from moving the brk backwards as that might trash
-      SkPreAlloc sections acquired by aspacem from previous uses of
-      sbrk. */
-   if (ARG1 < 0)
-      ARG1 = 0;
-   /* Do this as a sync syscall, so the sbrk_allowed flag gets turned
-      back on ASAP.  Typically libc does sbrk(0) and then sbrk(x > 0)
-      in quick succession.  Although surely it should hold some kind
-      of lock at that point, else it cannot safely use the result from
-      the first sbrk call to influence the second one? */
-   *flags &= ~SfMayBlock;
-}
-POST(sys___libc_sbrk)
-{
-   vg_assert(SUCCESS);
-   handle_sbrk(ARG1);
-}
-
-/* __loadx is handled in the platform-specific files. */
-
-PRE(sys___msleep)
-{
-   PRINT("__msleep (BOGUS HANDLER) ( %#lx )", ARG1);
-   PRE_REG_READ1(long, "msleep", void*, arg1);
-}
-
-/* __unload is handled in the platform-specific files. */
-
-PRE(sys__clock_settime)
-{
-   PRINT("_clock_settime (UNDOCUMENTED) ( %ld, %#lx )", ARG1, ARG2);
-   PRE_REG_READ2(int, "_clock_settime", int, arg1, int, arg2);
-}
-
-PRE(sys__exit)
-{
-   ThreadState* tst;
-   /* simple; just make this thread exit */
-   PRINT("_exit( %ld )", ARG1);
-   PRE_REG_READ1(void, "exit", int, exitcode);
-
-   tst = VG_(get_ThreadState)(tid);
-   /* Set the thread's status to be exiting and taking out the entire
-      process, then claim that the syscall succeeded. */
-   tst->exitreason = VgSrc_ExitProcess;
-   tst->os_state.exitcode = ARG1;
-   SET_STATUS_Success(0);
-}
-
-PRE(sys__fp_fpscrx_sc)
-{
-   PRINT("_fp_fpscrx_sc (BOGUS HANDLER)");
-}
-
-PRE(sys__getpgrp)
-{
-   PRINT("_getpgrp (BOGUS HANDLER)");
-}
-
-PRE(sys__getpid)
-{
-   PRINT("_getpid ( )");
-}
-
-PRE(sys__getppid)
-{
-   PRINT("_getppid ( )");
-}
-
-PRE(sys__getpriority)
-{
-   PRINT("_getpriority (BOGUS HANDLER)");
-}
-
-PRE(sys__nsleep)
-{
-   *flags |= SfMayBlock;
-   PRINT("_nsleep( %#lx, %#lx )", ARG1, ARG2);
-   PRE_REG_READ2(void, "_nsleep", struct timestruc_t*, arg1,
-                                  struct timestruc_t*, arg2);
-   /* In 64-bit mode, struct ends in 4 padding bytes.  Hence: */
-   if (ARG1)
-      PRE_MEM_READ("_nsleep(arg1)", 
-                   ARG1, 
-                   sizeof(void*)==4 ? sizeof(struct timestruc_t)
-                                    : sizeof(struct timestruc_t)-4 );
-   if (ARG2)
-      PRE_MEM_WRITE("_nsleep(arg2)", ARG2, sizeof(struct timestruc_t));
-}
-POST(sys__nsleep)
-{
-   if (ARG2)
-      POST_MEM_WRITE(ARG2, sizeof(struct timestruc_t));
-}
-
-PRE(sys__pause)
-{
-  *flags |= SfMayBlock;
-  PRINT("_pause ( )");
-  PRE_REG_READ0(long, "pause");
-}
-
-PRE(sys__poll)
-{
-   UInt i;
-   struct pollfd* ufds = (struct pollfd *)ARG1;
-   *flags |= SfMayBlock;
-   PRINT("_poll ( %#lx, %ld, %ld )\n", ARG1,ARG2,ARG3);
-   PRE_REG_READ3(long, "_poll",
-                 struct pollfd *, ufds, unsigned int, nfds, long, timeout);
-
-   for (i = 0; i < ARG2; i++) {
-      PRE_MEM_READ( "poll(ufds.fd)",
-                    (Addr)(&ufds[i].fd), sizeof(ufds[i].fd) );
-      PRE_MEM_READ( "poll(ufds.events)",
-                    (Addr)(&ufds[i].events), sizeof(ufds[i].events) );
-      PRE_MEM_WRITE( "poll(ufds.reventss)",
-                      (Addr)(&ufds[i].revents), sizeof(ufds[i].revents) );
-   }
-}
-POST(sys__poll)
-{
-   if (RES > 0) {
-      UInt i;
-      struct pollfd* ufds = (struct pollfd *)ARG1;
-      for (i = 0; i < ARG2; i++)
-         POST_MEM_WRITE( (Addr)(&ufds[i].revents), sizeof(ufds[i].revents) );
-   }
-}
-
-PRE(sys__select)
-{
-   UInt nfds, nmqids;
-   *flags |= SfMayBlock;
-   /* XXX: copy of generic; I don't know if this is right or not. */
-   PRINT("_select ( %ld, %#lx, %#lx, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4,ARG5);
-   PRE_REG_READ5(long, "_select",
-                 int, n, struct sellist *, readfds, 
-                         struct sellist *, writefds,
-                         struct sellist *, exceptfds, 
-                         struct timeval *, timeout);
-   nfds   = ((UInt)ARG1) & 0xFFFF;
-   nmqids = (((UInt)ARG1) >> 16) & 0xFFFF;
-
-   // XXX: this possibly understates how much memory is read.
-   if (ARG2 != 0)
-     PRE_MEM_READ( "select(readfds)",   
-		   ARG2, nfds/8 /* __FD_SETSIZE/8 */ );
-   if (ARG3 != 0)
-     PRE_MEM_READ( "select(writefds)",  
-		   ARG3, nfds/8 /* __FD_SETSIZE/8 */ );
-   if (ARG4 != 0)
-     PRE_MEM_READ( "select(exceptfds)", 
-		   ARG4, nfds/8 /* __FD_SETSIZE/8 */ );
-   if (ARG5 != 0)
-     PRE_MEM_READ( "select(timeout)", ARG5, 
-                   /* in 64-bit mode, struct timeval has 4 bytes of
-                      padding at the end, which tend to not be
-                      initialised. */
-                   sizeof(void*)==4  ? sizeof(struct timeval)
-                                     : sizeof(struct timeval)-4
-     );
-}
-
-PRE(sys__sem_wait)
-{
-   *flags |= SfMayBlock;
-   PRINT("_sem_wait (BOGUS HANDLER) ( %#lx, %#lx, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(long, "_sem_wait", void*, arg1, void*, arg2, long, arg3 );
-   /* Not sure what the two pointer args are.  Hence no proper handler.*/
-}
-
-PRE(sys__setpgid)
-{
-   PRINT("setpgid ( %ld, %ld )", ARG1, ARG2);
-   PRE_REG_READ2(int, "setpgid", int, pid, int, pgid);
-}
-
-PRE(sys__setsid)
-{
-   PRINT("setsid ( )");
-}
-
-PRE(sys__sigaction) /* COL, more or less */
-{
-   PRINT("_sigaction ( %ld, %#lx, %#lx )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(long, "_sigaction",
-                 int, signum, const struct sigaction *, act,
-                 struct sigaction *, oldact);
-
-   if (ARG2 != 0) {
-      struct vki_sigaction *sa = (struct vki_sigaction *)ARG2;
-      PRE_MEM_READ( "_sigaction(act->sa_handler)", 
-                    (Addr)&sa->ksa_handler, sizeof(sa->ksa_handler));
-      PRE_MEM_READ( "_sigaction(act->sa_mask)", 
-                    (Addr)&sa->sa_mask, sizeof(sa->sa_mask));
-      PRE_MEM_READ( "rt_sigaction(act->sa_flags)", 
-                    (Addr)&sa->sa_flags, sizeof(sa->sa_flags));
-   }
-   if (ARG3 != 0)
-      PRE_MEM_WRITE( "rt_sigaction(oldact)", ARG3, sizeof(struct vki_sigaction));
-
-   SET_STATUS_from_SysRes(
-      VG_(do_sys_sigaction)(ARG1, (const struct vki_sigaction *)ARG2,
-                                  (struct vki_sigaction *)ARG3)
-   );
-}
-POST(sys__sigaction)
-{
-   vg_assert(SUCCESS);
-   if (RES == 0 && ARG3 != 0)
-      POST_MEM_WRITE( ARG3, sizeof(struct vki_sigaction));
-}
-
-PRE(sys__thread_self)
-{
-   PRINT("_thread_self ( )");
-}
-
-PRE(sys__thread_setsched)
-{
-   PRINT("_thread_setsched ( %ld, %ld, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(long, "_thread_setsched", long, arg1, long, arg2, long, arg3);
-}
-
-PRE(sys_access)
-{
-   PRINT("access ( %#lx(%s), %ld )", ARG1,(Char*)ARG1, ARG2);
-   PRE_REG_READ2(int, "access", char*, pathname, int, mode);
-   PRE_MEM_RASCIIZ( "access(pathname)", ARG1 );
-}
-
-PRE(sys_accessx)
-{
-   PRINT("accessx ( %#lx(%s), %ld, %ld )", ARG1,(Char*)ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "accessx", char*, pathname, int, mode, int, who);
-   PRE_MEM_RASCIIZ( "accessx(pathname)", ARG1 );
-}
-
-PRE(sys_appgetrlimit)
-{
-   /* Note: assumes kernel struct == libc struct */
-   PRINT("appgetrlimit ( %ld, %#lx )", ARG1, ARG2);
-   PRE_REG_READ2(int, "appgetrlimit", int, arg1, struct rlimit*, arg2);
-   PRE_MEM_WRITE( "appgetrlimit(buf)", ARG2, sizeof(struct rlimit) );
-}
-POST(sys_appgetrlimit)
-{
-   POST_MEM_WRITE( ARG2, sizeof(struct rlimit) );
-}
-
-PRE(sys_appgetrusage)
-{
-   /* Note: assumes kernel struct == libc struct */
-   PRINT("appgetrusage ( %ld, %#lx )", ARG1, ARG2);
-   PRE_REG_READ2(int, "appgetrusage", int, arg1, struct rusage*, arg2);
-   PRE_MEM_WRITE( "appgetrusage(buf)", ARG2, sizeof(struct rusage) );
-}
-POST(sys_appgetrusage)
-{
-   POST_MEM_WRITE( ARG2, sizeof(struct rusage) );
-}
-
-PRE(sys_apprestimer)
-{
-   PRINT("apprestimer (BOGUS HANDLER)");
-}
-
-PRE(sys_appsetrlimit)
-{
-   PRINT("appsetrlimit (BOGUS HANDLER)");
-}
-
-PRE(sys_appulimit)
-{
-   PRINT("appulimit ( %ld, %ld )", ARG1, ARG2);
-   PRE_REG_READ2(long, "appulimit", long, arg1, long, arg2);
-}
-
-PRE(sys_bind)
-{
-   PRINT("bind ( %ld, %#lx, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "bind", int, socket, 
-                              void*, address, int, addresslen);
-   /* Hmm.  This isn't really right - see pre_mem_read_sockaddr. */
-   PRE_MEM_READ( "bind(address)", ARG2, ARG3 );
-}
-
-PRE(sys_chdir)
-{
-  PRINT("chdir ( %#lx(%s) )", ARG1,(Char*)ARG1);
-  PRE_REG_READ1(long, "chdir", const char *, path);
-  PRE_MEM_RASCIIZ( "chdir(path)", ARG1 );
-}
-
-PRE(sys_chmod)
-{
-   PRINT("chmod ( %#lx(%s), 0x%lx )", ARG1,(Char*)ARG1, ARG2 );
-   PRE_REG_READ2(int, "chmod", char*, path, int, mode);
-   PRE_MEM_RASCIIZ( "chmod(path)", ARG1 );
-}
-
-PRE(sys_chown)
-{
-   PRINT("chown ( %#lx(%s), %ld, %ld )", ARG1,(Char*)ARG1, ARG2, ARG3 );
-   PRE_REG_READ3(int, "chown", char*, path, int, owner, int, group);
-   PRE_MEM_RASCIIZ( "chown(path)", ARG1 );
-}
-
-PRE(sys_close)
-{
-   PRINT("close ( %ld )", ARG1);
-   PRE_REG_READ1(void, "close", UInt, fd);
-   /* If doing -d style logging (which is to fd=2), don't allow that
-      to be closed. */
-   if (ARG1 == 2/*stderr*/ && VG_(debugLog_getLevel)() > 0)
-      SET_STATUS_Failure( VKI_EBADF );
-}
-
-PRE(sys_connext)
-{
-   /* apparently undocumented.  I don't know what it does. */
-   /* Although /usr/include/net/proto_uipc.h does mention it.
-      Args are apparently (int, caddr_t, int).  I suspect the
-      first arg is a fd and the third a flags value. */
-   PRINT("connext (UNDOCUMENTED)( %ld, %#lx, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "connext", int, arg1, caddr_t*, arg2, int, arg3);
-}
-
-//--- PRE(sys_execve) ---//
-// Pre_read a char** argument.
-static void pre_argv_envp(Addr a, ThreadId tid, Char* s1, Char* s2)
-{
-   while (True) {
-      Addr a_deref;
-      Addr* a_p = (Addr*)a;
-      PRE_MEM_READ( s1, (Addr)a_p, sizeof(Addr) );
-      a_deref = *a_p;
-      if (0 == a_deref)
-         break;
-      PRE_MEM_RASCIIZ( s2, a_deref );
-      a += sizeof(char*);
-   }
-}
-static SysRes simple_pre_exec_check ( const HChar* exe_name,
-                                      Bool trace_this_child )
-{
-   Int fd, ret;
-   SysRes res;
-   Bool setuid_allowed;
-
-   // Check it's readable
-   res = VG_(open)(exe_name, VKI_O_RDONLY, 0);
-   if (res.isError) {
-      return res;
-   }
-   fd = res.res;
-   VG_(close)(fd);
-
-   // Check we have execute permissions.  We allow setuid executables
-   // to be run only in the case when we are not simulating them, that
-   // is, they to be run natively.
-   setuid_allowed = trace_this_child  ? False  : True;
-   ret = VG_(check_executable)(NULL/*&is_setuid*/,
-                               (HChar*)exe_name, setuid_allowed);
-   if (0 != ret) {
-      return VG_(mk_SysRes_Error)(ret);
-   }
-   return VG_(mk_SysRes_Success)(0);
-}
-PRE(sys_execve)
-{
-   Char*        path = NULL;       /* path to executable */
-   Char**       envp = NULL;
-   Char**       argv = NULL;
-   Char**       arg2copy;
-   Char*        launcher_basename = NULL;
-   ThreadState* tst;
-   Int          i, j, tot_args;
-   SysRes       res;
-   Bool         trace_this_child;
-
-   PRINT("sys_execve ( %#lx(%s), %#lx, %#lx )", ARG1, (Char*)ARG1, ARG2, ARG3);
-   PRE_REG_READ3(vki_off_t, "execve",
-                 char *, filename, char **, argv, char **, envp);
-   PRE_MEM_RASCIIZ( "execve(filename)", ARG1 );
-   if (ARG2 != 0)
-      pre_argv_envp( ARG2, tid, "execve(argv)", "execve(argv[i])" );
-   if (ARG3 != 0)
-      pre_argv_envp( ARG3, tid, "execve(envp)", "execve(envp[i])" );
-
-   vg_assert(VG_(is_valid_tid)(tid));
-   tst = VG_(get_ThreadState)(tid);
-
-   /* Erk.  If the exec fails, then the following will have made a
-      mess of things which makes it hard for us to continue.  The
-      right thing to do is piece everything together again in
-      POST(execve), but that's close to impossible.  Instead, we make
-      an effort to check that the execve will work before actually
-      doing it. */
-
-   /* Check that the name at least begins in client-accessible storage. */
-   /* XXX: causes execve to fail for non-memcheck tools, presumably
-      because ARG1 is thought to not to being in client-accessible
-      storage due to inadequate address space tracking.  May or may
-      not be due to non-tracking of brk. */
-   //if (!VG_(am_is_valid_for_client)( ARG1, 1, VKI_PROT_READ )) {
-   //   SET_STATUS_Failure( VKI_EFAULT );
-   //   return;
-   //}
-   if (ARG1 == 0 /* obviously bogus */) {
-      SET_STATUS_Failure( VKI_EFAULT );
-   }
-
-   // Decide whether or not we want to follow along
-   trace_this_child = VG_(should_we_trace_this_child)( (HChar*)ARG1 );
-
-   // Do the important checks:  it is a file, is executable, permissions are
-   // ok, etc.
-   res = simple_pre_exec_check( (const HChar*)ARG1, trace_this_child );
-   if (res.isError) {
-      SET_STATUS_Failure( res.err );
-      return;
-   }
-
-   /* If we're tracing the child, and the launcher name looks bogus
-      (possibly because launcher.c couldn't figure it out, see
-      comments therein) then we have no option but to fail. */
-   if (trace_this_child 
-       && (VG_(name_of_launcher) == NULL
-           || VG_(name_of_launcher)[0] != '/')) {
-      SET_STATUS_Failure( VKI_ECHILD ); /* "No child processes" */
-      return;
-   }
-
-   /* After this point, we can't recover if the execve fails. */
-   VG_(debugLog)(1, "syswrap", "Exec of %s\n", (Char*)ARG1);
-
-   // Terminate gdbserver if it is active.
-   if (VG_(clo_vgdb)  != Vg_VgdbNo) {
-      // If the child will not be traced, we need to terminate gdbserver
-      // to cleanup the gdbserver resources (e.g. the FIFO files).
-      // If child will be traced, we also terminate gdbserver: the new 
-      // Valgrind will start a fresh gdbserver after exec.
-      VG_(gdbserver) (0);
-   }
-
-   /* Resistance is futile.  Nuke all other threads.  POSIX mandates
-      this. (Really, nuke them all, since the new process will make
-      its own new thread.) */
-   VG_(nuke_all_threads_except)( tid, VgSrc_ExitThread );
-   VG_(reap_threads)(tid);
-
-   // Set up the child's exe path.
-   //
-   if (trace_this_child) {
-
-      // We want to exec the launcher.  Get its pre-remembered path.
-      path = VG_(name_of_launcher);
-      // VG_(name_of_launcher) should have been acquired by m_main at
-      // startup.
-      vg_assert(path);
-
-      launcher_basename = VG_(strrchr)(path, '/');
-      if (launcher_basename == NULL || launcher_basename[1] == 0) {
-         launcher_basename = path;  // hmm, tres dubious
-      } else {
-         launcher_basename++;
-      }
-
-   } else {
-      path = (Char*)ARG1;
-   }
-
-   // Set up the child's environment.
-   //
-   // Remove the valgrind-specific stuff from the environment so the
-   // child doesn't get vgpreload_core.so, vgpreload_<tool>.so, etc.  
-   // This is done unconditionally, since if we are tracing the child,
-   // the child valgrind will set up the appropriate client environment.
-   // Nb: we make a copy of the environment before trying to mangle it
-   // as it might be in read-only memory (this was bug #101881).
-   //
-   // Then, if tracing the child, set VALGRIND_LIB for it.
-   //
-   if (ARG3 == 0) {
-      envp = NULL;
-   } else {
-      envp = VG_(env_clone)( (Char**)ARG3 );
-      if (envp == NULL) goto hosed;
-      VG_(env_remove_valgrind_env_stuff)( envp );
-   }
-
-   if (trace_this_child) {
-      // Set VALGRIND_LIB in ARG3 (the environment)
-      VG_(env_setenv)( &envp, VALGRIND_LIB, VG_(libdir));
-   }
-
-   // Set up the child's args.  If not tracing it, they are
-   // simply ARG2.  Otherwise, they are
-   //
-   // [launcher_basename] ++ VG_(args_for_valgrind) ++ [ARG1] ++ ARG2[1..]
-   //
-   // except that the first VG_(args_for_valgrind_noexecpass) args
-   // are omitted.
-   //
-   if (!trace_this_child) {
-      argv = (Char**)ARG2;
-   } else {
-      vg_assert( VG_(args_for_valgrind_noexecpass) >= 0 );
-      vg_assert( VG_(args_for_valgrind_noexecpass) 
-                   <= VG_(sizeXA)( VG_(args_for_valgrind) ) );
-      /* how many args in total will there be? */
-      // launcher basename
-      tot_args = 1;
-      // V's args
-      tot_args += VG_(sizeXA)( VG_(args_for_valgrind) );
-      tot_args -= VG_(args_for_valgrind_noexecpass);
-      // name of client exe
-      tot_args++;
-      // args for client exe, skipping [0]
-      arg2copy = (Char**)ARG2;
-      if (arg2copy && arg2copy[0]) {
-         for (i = 1; arg2copy[i]; i++)
-            tot_args++;
-      }
-      // allocate
-      argv = VG_(malloc)( "syswrap-aix5.pre_sys_execve.1",
-                          (tot_args+1) * sizeof(HChar*) );
-      if (argv == 0) goto hosed;
-      // copy
-      j = 0;
-      argv[j++] = launcher_basename;
-      for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
-         if (i < VG_(args_for_valgrind_noexecpass))
-            continue;
-         argv[j++] = * (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i );
-      }
-      argv[j++] = (Char*)ARG1;
-      if (arg2copy && arg2copy[0])
-         for (i = 1; arg2copy[i]; i++)
-            argv[j++] = arg2copy[i];
-      argv[j++] = NULL;
-      // check
-      vg_assert(j == tot_args+1);
-   }
-
-   /* restore the DATA rlimit for the child */
-   VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
-
-   /*
-      Set the signal state up for exec.
-
-      We need to set the real signal state to make sure the exec'd
-      process gets SIG_IGN properly.
-
-      Also set our real sigmask to match the client's sigmask so that
-      the exec'd child will get the right mask.  First we need to
-      clear out any pending signals so they they don't get delivered,
-      which would confuse things.
-
-      XXX This is a bug - the signals should remain pending, and be
-      delivered to the new process after exec.  There's also a
-      race-condition, since if someone delivers us a signal between
-      the sigprocmask and the execve, we'll still get the signal. Oh
-      well.
-   */
-   {
-      vki_sigset_t allsigs;
-      vki_siginfo_t info;
-
-      for (i = 1; i < VG_(max_signal); i++) {
-         struct vki_sigaction sa;
-         VG_(do_sys_sigaction)(i, NULL, &sa);
-         if (sa.ksa_handler == VKI_SIG_IGN)
-            VG_(sigaction)(i, &sa, NULL);
-         else {
-            sa.ksa_handler = VKI_SIG_DFL;
-            VG_(sigaction)(i, &sa, NULL);
-         }
-      }
-
-      VG_(sigfillset)(&allsigs);
-      while(VG_(sigtimedwait_zero)(&allsigs, &info) > 0)
-         ;
-
-      VG_(sigprocmask)(VKI_SIG_SETMASK, &tst->sig_mask, NULL);
-   }
-
-   if (0) {
-      Char **cpp;
-      VG_(printf)("exec: %s\n", path);
-      for (cpp = argv; cpp && *cpp; cpp++)
-         VG_(printf)("argv: %s\n", *cpp);
-      if (0)
-         for (cpp = envp; cpp && *cpp; cpp++)
-            VG_(printf)("env: %s\n", *cpp);
-   }
-
-   SET_STATUS_from_SysRes( 
-      VG_(do_syscall3)(__NR_execve, (UWord)path, (UWord)argv, (UWord)envp) 
-   );
-
-   /* If we got here, then the execve failed.  We've already made way
-      too much of a mess to continue, so we have to abort. */
-  hosed:
-   vg_assert(FAILURE);
-   VG_(message)(Vg_UserMsg, "execve(%#lx(%s), %#lx, %#lx) failed, errno %ld\n",
-                ARG1, (Char*)ARG1, ARG2, ARG3, ERR);
-   VG_(message)(Vg_UserMsg, "EXEC FAILED: I can't recover from "
-                            "execve() failing, so I'm dying.\n");
-   VG_(message)(Vg_UserMsg, "Add more stringent tests in PRE(sys_execve), "
-                            "or work out how to recover.\n");
-   VG_(exit)(101);
-}
-
-PRE(sys_finfo)
-{
-   PRINT("finfo ( %#lx(%s), %ld, %#lx, %ld )",
-          ARG1,(Char*)ARG1, ARG2, ARG3, ARG4);
-   PRE_REG_READ4(int, "finfo", 
-                      char*, Path1, int, cmd, void*, buffer, int, length);
-   PRE_MEM_RASCIIZ( "finfo(Path1)", ARG1 );
-   PRE_MEM_WRITE( "finfo(buffer)", ARG3, ARG4 );
-}
-POST(sys_finfo)
-{
-   POST_MEM_WRITE( ARG3, ARG4 );
-}
-
-PRE(sys_fstatfs)
-{
-   PRINT("sys_fstatfs ( %ld, %#lx )", ARG1, ARG2);
-   PRE_REG_READ2(UWord, "fstatfs", UWord, fd, struct statfs *, buf);
-   PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct statfs) );
-}
-POST(sys_fstatfs)
-{
-   POST_MEM_WRITE( ARG2, sizeof(struct statfs) );
-}
-
-PRE(sys_fstatx)
-{
-   PRINT("fstatx ( %ld, %#lx, %ld, %ld )", ARG1, ARG2, ARG3, ARG4 );
-   PRE_REG_READ4(Word, "fstatx", UWord, fd, void*, buf,
-                                 UWord, len, UWord, cmd);
-   PRE_MEM_WRITE( "fstatx(buf)", ARG2, ARG3 );
-}
-POST(sys_fstatx)
-{
-   POST_MEM_WRITE( ARG2, ARG3 );
-}
-
-PRE(sys_fsync)
-{
-   PRINT("fsync ( %ld )", ARG1);
-   PRE_REG_READ1(int, "fsync", int, fd);
-}
-
-PRE(sys_getdirent)
-{
-   *flags |= SfMayBlock;
-   /* this is pretty much like 'read':
-      getdirent(fd, buffer, nbytes) -> # actually read */
-   PRINT("getdirent ( %ld, %#lx, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(Word, "getdirent", UWord, fd, UChar*, buf, UWord, count);
-   PRE_MEM_WRITE( "getdirent(buf)", ARG2, ARG3 );
-}
-POST(sys_getdirent)
-{
-   vg_assert(SUCCESS);
-   POST_MEM_WRITE( ARG2, RES );
-}
-
-PRE(sys_getdirent64)
-{
-   /* same as getdirent, from our point of view? */
-   *flags |= SfMayBlock;
-   /* this is pretty much like 'read':
-      getdirent(fd, buffer, nbytes) -> # actually read */
-   PRINT("getdirent64 ( %ld, %#lx, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(Word, "getdirent64", UWord, fd, UChar*, buf, UWord, count);
-   PRE_MEM_WRITE( "getdirent64(buf)", ARG2, ARG3 );
-}
-POST(sys_getdirent64)
-{
-   vg_assert(SUCCESS);
-   POST_MEM_WRITE( ARG2, RES );
-}
-
-PRE(sys_getdomainname)
-{
-   PRINT("getdomainname ( %#lx, %ld )", ARG1, ARG2 );
-   PRE_MEM_WRITE( "getdomainname(buf)", ARG1, ARG2 );
-}
-POST(sys_getdomainname)
-{
-   POST_MEM_WRITE( ARG1, ARG2 );
-}
-
-PRE(sys_getgidx)
-{
-   PRINT("getgidx ( %ld )", ARG1);
-   PRE_REG_READ1(UInt, "getgidx", long, arg1);
-}
-
-PRE(sys_getgroups)
-{
-   PRINT("getgroups ( %ld, %#lx )", ARG1, ARG2);
-   PRE_REG_READ2(long, "getgroups", int, size, gid_t *, list);
-   if (ARG1 > 0)
-      PRE_MEM_WRITE( "getgroups(list)", ARG2, ARG1 * sizeof(gid_t) );
-}
-POST(sys_getgroups)
-{
-   vg_assert(SUCCESS);
-   if (ARG1 > 0 && RES > 0)
-      POST_MEM_WRITE( ARG2, RES * sizeof(gid_t) );
-}
-
-PRE(sys_gethostname)
-{
-   PRINT("gethostname ( %#lx, %ld )", ARG1, ARG2);
-   PRE_MEM_WRITE( "gethostname(buf)", ARG1, ARG2 );
-}
-POST(sys_gethostname)
-{
-   POST_MEM_WRITE( ARG1, ARG2 );
-}
-
-PRE(sys_getpriv)
-{
-   PRINT("getpriv (UNDOCUMENTED)(%ld, %#lx, %ld)", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "getpriv", int, arg1, void*, arg2, int, arg3);
-   PRE_MEM_WRITE( "getpriv(arg2)", ARG2, 8 );
-}
-POST(sys_getpriv)
-{
-   if (ARG2)
-      POST_MEM_WRITE(ARG2, 8);
-}
-
-/* Note that this is used for both sys_getprocs and sys_getprocs64.  I
-   think that's correct - from the man page, the calling conventions
-   look identical. */
-PRE(sys_getprocs)
-{
-   PRINT("getprocs ( %#lx, %ld, %#lx, %ld, %#lx, %ld )",
-         ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 );
-   PRE_REG_READ6(int, "getprocs", 
-                 void*, processbuffer, long, processize, 
-                 void*, filebuffer, long, filesize,
-                 void*, indexpointer, long, count);
-
-   /* (processbuffer, processsize, filebuffer, filesize,
-      indexpointer, count) */
-   PRE_MEM_READ( "getprocs(IndexPointer)", ARG5, sizeof(UInt) );
-   if (ARG1)
-      PRE_MEM_WRITE( "getprocs(ProcessBuffer)", ARG1, ARG2 * ARG6 );
-   if (ARG3)
-      PRE_MEM_WRITE( "getprocs(FileBuffer)", ARG3, ARG4 * ARG6 );
-}
-POST(sys_getprocs)
-{
-   vg_assert(SUCCESS);
-   if (ARG1)
-      POST_MEM_WRITE( ARG1, ARG2 * ARG6 );
-   if (ARG3)
-      POST_MEM_WRITE( ARG3, ARG4 * ARG6 );
-}
-
-PRE(sys_getrpid)
-{
-   PRINT("getrpid ( %ld, %ld, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(long, "getrpid", long, arg1, long, arg2, long, arg3);
-}
-
-PRE(sys_getsockopt)
-{
-   PRINT("getsockopt ( %ld, %ld, %ld, %#lx, %#lx )", 
-         ARG1, ARG2, ARG3, ARG4, ARG5);
-   PRE_REG_READ5(int, "getsockopt", int, socket, int, level, 
-                                    int, optionname, 
-                                    void*, optionval, int*, optionlen);
-   if (ARG5) {
-      PRE_MEM_READ( "getsockopt(optionlen)", ARG5, sizeof(UInt) );
-      PRE_MEM_WRITE( "getsockopt(optionval)", ARG4, *(UInt*)ARG5 );
-   }
-}
-POST(sys_getsockopt)
-{
-   if (ARG5) {
-      POST_MEM_WRITE( ARG5, sizeof(UInt) );
-      POST_MEM_WRITE( ARG4, *(UInt*)ARG5 );
-   }
-}
-
-PRE(sys_gettimerid)
-{
-   PRINT("gettimerid ( %ld, %ld )", ARG1, ARG2);
-   PRE_REG_READ2(int, "gettimerid", int, timertype, int, notifytype);
-}
-
-PRE(sys_getuidx)
-{
-   PRINT("getuidx ( %ld )", ARG1);
-   PRE_REG_READ1(UInt, "getuidx", UInt, arg1);
-}
-
-PRE(sys_incinterval)
-{
-   PRINT("incinterval ( %ld, %#lx, %#lx )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "incinterval", int, timerid, 
-                      struct itimerstruc_t*, value,
-                      struct itimerstruc_t*, ovalue);
-   if (ARG2)
-      PRE_MEM_READ( "incinterval(value)", 
-                    ARG2, sizeof(struct itimerstruc_t));
-   if (ARG3)
-      PRE_MEM_WRITE( "incinterval(value)", 
-                     ARG3, sizeof(struct itimerstruc_t));
-}
-POST(sys_incinterval)
-{
-   if (ARG3)
-      POST_MEM_WRITE( ARG3, sizeof(struct itimerstruc_t));
-}
-
-PRE(sys_kfcntl)
-{
-   *flags |= SfMayBlock;
-   switch (ARG2) {
-      // These ones ignore ARG3.
-      case F_GETFD:
-      case F_GETFL:
-      case F_GETOWN:
-         PRINT("kfcntl ( %ld, %ld )", ARG1,ARG2);
-         PRE_REG_READ2(long, "fcntl", unsigned int, fd, unsigned int, cmd);
-         break;
-
-      // These ones use ARG3 as "arg".
-      case F_DUPFD:
-      case F_SETFD:
-      case F_SETFL:
-      case F_SETOWN:
-         PRINT("kfcntl[ARG3=='arg'] ( %ld, %ld, %ld )", ARG1,ARG2,ARG3);
-         PRE_REG_READ3(long, "fcntl",
-                       unsigned int, fd, unsigned int, cmd, unsigned long, arg);
-         break;
-
-      // These ones use ARG3 as "lock".
-#     if !defined(VGP_ppc64_aix5)
-      case F_GETLK:
-      case F_SETLK:
-      case F_SETLKW:
-#     endif
-      case F_GETLK64:
-      case F_SETLK64:
-      case F_SETLKW64:
-         PRINT("kfcntl[ARG3=='lock'] ( %ld, %ld, %#lx )", ARG1,ARG2,ARG3);
-         PRE_REG_READ3(long, "fcntl",
-                       unsigned int, fd, unsigned int, cmd,
-                       struct flock64 *, lock);
-         if (ARG3 && (ARG2 == F_GETLK || ARG2 == F_GETLK64))
-            PRE_MEM_READ( "kfcntl(F_GETLK)", ARG3, sizeof(struct flock64) );
-         break;
-   }
-}
-POST(sys_kfcntl)
-{
-  //  if (ARG2 == VKI_F_DUPFD) {
-  //   if (!ML_(fd_allowed)(RES, "fcntl(DUPFD)", tid, True)) {
-  //    VG_(close)(RES);
-  //    SET_STATUS_Failure( VKI_EMFILE );
-  //  } else {
-  //    if (VG_(clo_track_fds))
-  //	record_fd_open_named(tid, RES);
-  //  }
-  // }
-   if (ARG3 && (ARG2 == F_GETLK || ARG2 == F_GETLK64))
-      POST_MEM_WRITE( ARG3, sizeof(struct flock64) );
-}
-
-/* COG; can this be moved inside the pre-handler? */
-static vki_sigset_t fork_saved_mask; 
-PRE(sys_kfork) /* COPY OF GENERIC */
-{
-   vki_sigset_t mask;
-
-   PRINT("kfork ( )");
-   PRE_REG_READ0(long, "fork");
-
-   /* Block all signals during fork, so that we can fix things up in
-      the child without being interrupted. */
-   VG_(sigfillset)(&mask);
-   VG_(sigprocmask)(VKI_SIG_SETMASK, &mask, &fork_saved_mask);
-
-   VG_(do_atfork_pre)(tid);
-
-   SET_STATUS_from_SysRes( VG_(do_syscall0)(__NR_fork) );
-
-   if (SUCCESS && RES == 0) {
-      /* child */
-      VG_(do_atfork_child)(tid);
-
-      /* restore signal mask */
-      VG_(sigprocmask)(VKI_SIG_SETMASK, &fork_saved_mask, NULL);
-
-      /* If --child-silent-after-fork=yes was specified, set the
-         logging file descriptor to an 'impossible' value.  This is
-         noticed by send_bytes_to_logging_sink in m_libcprint.c, which
-         duly stops writing any further logging output. */
-      if (!VG_(logging_to_socket) && VG_(clo_child_silent_after_fork))
-         VG_(clo_log_fd) = -1;
-   } 
-   else 
-   if (SUCCESS && RES > 0) {
-      /* parent */
-      VG_(do_atfork_parent)(tid);
-
-      PRINT("   fork: process %d created child %lu\n", VG_(getpid)(), RES);
-
-      /* restore signal mask */
-      VG_(sigprocmask)(VKI_SIG_SETMASK, &fork_saved_mask, NULL);
-   }
-}
-
-PRE(sys_kftruncate)
-{
-   PRINT("kftruncate (BOGUS HANDLER)");
-}
-
-PRE(sys_kgetsidx)
-{
-   PRINT("kgetsidx ( %ld )", ARG1);
-   PRE_REG_READ1(Word, "kgetsidx", Word, arg1);
-}
-
-PRE(sys_kill)
-{
-   PRINT("kill ( %ld, %ld )", ARG1, ARG2);
-   PRE_REG_READ2(int, "kill", int, pid, int, signal);
-}
-
-PRE(sys_kioctl)
-{
-   *flags |= SfMayBlock;
-   PRINT("kioctl ( %ld, %#lx, %#lx, %#lx )", ARG1, ARG2, ARG3, ARG4);
-   PRE_REG_READ4(Word, "ioctl", Word, fd, 
-                                Word, command, Word, arg, Word, ext);
-   switch (ARG2 /* request */) {
-      case 0x5800/*TXISATTY*/:
-      case 0x5801/*TXTTYNAME*/:
-         break;
-      case 0x412:/*no idea what any of these are*/
-      case 0x430:
-      case 0x431:
-      case 0x432:
-      case 0x441:
-      case 0x442:
-      case 0x462:
-      case 0x480:
-      case 0x482:
-      case 0x738:
-      case 0x736:
-      case 0x73B:
-      case 0x73C:
-      case 0x73D:
-      case 0x73E:
-      case 0x5401:
-      case 0x5403:
-      case 0xFF01/*no_idea_at_all_what_this_is*/:
-          break;
-      /* We don't have any specific information on it, so
-         try to do something reasonable based on direction and
-         size bits.
-
-         According to Simon Hausmann, _IOC_READ means the kernel
-         writes a value to the ioctl value passed from the user
-         space and the other way around with _IOC_WRITE. */
-      default: {
-         UInt dir  = _VKI_IOC_DIR(ARG2);
-         UInt size = _VKI_IOC_SIZE(ARG2);
-         if (VG_(strstr)(VG_(clo_sim_hints), "lax-ioctls") != NULL) {
-            /* 
-             * Be very lax about ioctl handling; the only
-             * assumption is that the size is correct. Doesn't
-             * require the full buffer to be initialized when
-             * writing.  Without this, using some device
-             * drivers with a large number of strange ioctl
-             * commands becomes very tiresome.
-             */
-         } else if (/* size == 0 || */ dir == _VKI_IOC_NONE) {
-            static Int moans = 5;
-            if (moans > 0 && !VG_(clo_xml)) {
-               moans--;
-               VG_(message)(Vg_UserMsg, 
-                            "Warning: noted but unhandled ioctl 0x%lx"
-                            " with no size/direction hints\n",
-                            ARG2); 
-               VG_(message)(Vg_UserMsg, 
-                            "   This could cause spurious value errors"
-                            " to appear.\n");
-               VG_(message)(Vg_UserMsg, 
-                            "   See README_MISSING_SYSCALL_OR_IOCTL for "
-                            "guidance on writing a proper wrapper.\n" );
-            }
-         } else {
-            if ((dir & _VKI_IOC_WRITE) && size > 0)
-               PRE_MEM_READ( "ioctl(generic)", ARG3, size);
-            if ((dir & _VKI_IOC_READ) && size > 0)
-               PRE_MEM_WRITE( "ioctl(generic)", ARG3, size);
-         }
-         break;
-      }
-   } /* switch */ 
-}
-POST(sys_kioctl)
-{
-   switch (ARG2 /*request*/) {
-      case 0xFF01:
-         /* 100% kludge.  I have no idea what this ioctl is.  IOCINFO
-            ?  But at a guess I'd say it returns some kind of info
-            from the kernel. */
-         if (ARG3) POST_MEM_WRITE(ARG3, 16);
-         break;
-      case 0x738: /* Shows up in MPI applications. */
-         if (ARG3) POST_MEM_WRITE(ARG3, 4*sizeof(Word));
-         break;
-      case 0x736: /* Shows up in MPI applications. */
-      case 0x73B: /* Shows up in MPI applications. */
-      case 0x73C: /* Shows up in MPI applications. */
-         if (ARG3) POST_MEM_WRITE(ARG3, 16);
-         /* in fact only 4 needed, but being conservative */
-         break;
-
-      case 0x5401:
-	/* some kind of tty thing */
-	if (ARG3) POST_MEM_WRITE(ARG3, 32);
-	break;
-
-      case 0x5801/*TXTTYNAME*/:
-	/* who knows if this is right.  Presumably an ascii string is
-	   written into the buffer specified by ARG3, but how long is
-	   that buffer? */
-	if (ARG3) POST_MEM_WRITE(ARG3, 16);
-        break;
-
-      case 0x412:
-      case 0x430:
-      case 0x431:
-      case 0x432:
-      case 0x441:
-      case 0x442:
-      case 0x462:
-      case 0x480:
-      case 0x482:
-      case 0x73D:
-      case 0x73E:
-      case 0x5800/*TXISATTY*/:
-      case 0x5403:
-         break;
-      /* We don't have any specific information on it, so
-         try to do something reasonable based on direction and
-         size bits.
-
-         According to Simon Hausmann, _IOC_READ means the kernel
-         writes a value to the ioctl value passed from the user
-         space and the other way around with _IOC_WRITE. */
-      default: {
-         UInt dir  = _VKI_IOC_DIR(ARG2);
-         UInt size = _VKI_IOC_SIZE(ARG2);
-         if (size > 0 && (dir & _VKI_IOC_READ)
-             && RES == 0 
-             && ARG3 != (Addr)NULL)
-            POST_MEM_WRITE(ARG3, size);
-         break;
-      }
-   }
-}
-
-PRE(sys_klseek)
-{
-   PRINT("klseek ( %ld, %ld, %ld, %#lx )", ARG1, ARG2, ARG3, ARG4);
-   PRE_REG_READ4(long, "klseek", 
-                 long, fd, long, offset, long, whence, void*, arg4);
-   /* XXX: looks like 4th arg is a pointer to something.  Is it
-      read or written by the kernel? */
-}
-
-PRE(sys_knlist)
-{
-   PRINT("knlist (BOGUS HANDLER)");
-}
-
-PRE(sys_kpread)
-{
-   *flags |= SfMayBlock;
-   PRINT("sys_kpread ( %ld, %#lx, %llu, %lld )",
-         ARG1, ARG2, (ULong)ARG3, (ULong)ARG4);
-   PRE_REG_READ4(ssize_t, "kpread",
-                 unsigned int, fd, char *, buf,
-                 vki_size_t, count, long, offset);
-   PRE_MEM_WRITE( "kpread(buf)", ARG2, ARG3 );
-}
-POST(sys_kpread)
-{
-   vg_assert(SUCCESS);
-   if (RES > 0) {
-      POST_MEM_WRITE( ARG2, RES );
-   }
-}
-
-PRE(sys_kread)
-{
-   *flags |= SfMayBlock;
-   PRINT("sys_read ( %ld, %#lx, %llu )", ARG1, ARG2, (ULong)ARG3);
-   PRE_REG_READ3(ssize_t, "read",
-                 unsigned int, fd, char *, buf, vki_size_t, count);
-   //zz   if (!ML_(fd_allowed)(ARG1, "read", tid, False))
-   //zz      SET_STATUS_Failure( VKI_EBADF );
-   //zz   else
-      PRE_MEM_WRITE( "read(buf)", ARG2, ARG3 );
-}
-POST(sys_kread)
-{
-  vg_assert(SUCCESS);
-  POST_MEM_WRITE( ARG2, RES );
-}
-
-PRE(sys_kreadv)
-{
-   Int i;
-   struct vki_iovec * vec;
-   *flags |= SfMayBlock;
-   /* ssize_t readvx ( int fd, struct iovec*, int iovCount, int extension ) */
-   PRINT("kreadv ( %ld, %#lx, %ld, %#lx )", ARG1, ARG2, ARG3, ARG4);
-   PRE_REG_READ4(ssize_t, "kreadv",
-                 unsigned long, fd, const struct iovec *, vector,
-                 unsigned long, iovCount, unsigned long, extension);
-   //zz   if (!ML_(fd_allowed)(ARG1, "readv", tid, False)) {
-   //zz      SET_STATUS_Failure( VKI_EBADF );
-   //zz   } else {
-      PRE_MEM_READ( "kreadv(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) );
-      if (ARG2 != 0) {
-         /* ToDo: don't do any of the following if the vector is invalid */
-         vec = (struct vki_iovec *)ARG2;
-         for (i = 0; i < (Int)ARG3; i++)
-            PRE_MEM_WRITE( "kreadv(vector[...])",
-                           (Addr)vec[i].iov_base, vec[i].iov_len );
-      }
-   //zz }
-}
-POST(sys_kreadv)
-{
-   vg_assert(SUCCESS);
-   if (RES > 0) {
-      Int i;
-      struct vki_iovec * vec = (struct vki_iovec *)ARG2;
-      Int remains = RES;
-
-      /* RES holds the number of bytes read. */
-      for (i = 0; i < (Int)ARG3; i++) {
-         Int nReadThisBuf = vec[i].iov_len;
-         if (nReadThisBuf > remains) nReadThisBuf = remains;
-         POST_MEM_WRITE( (Addr)vec[i].iov_base, nReadThisBuf );
-         remains -= nReadThisBuf;
-         if (remains < 0) VG_(core_panic)("readv: remains < 0");
-      }
-   }
-}
-
-PRE(sys_kthread_ctl)
-{
-   *flags |= SfMayBlock;
-   PRINT("kthread_ctl (BOGUS HANDLER)");
-}
-
-PRE(sys_ktruncate)
-{
-   PRINT("ktruncate( %#lx(%s), %lx, %lx )", ARG1,(Char*)ARG1, ARG2, ARG3 );
-   PRE_REG_READ3(int, "ktruncate", char*, path, long, arg2, long, arg3 );
-   PRE_MEM_RASCIIZ( "ktruncate(path)", ARG1 );
-}
-
-PRE(sys_kwaitpid)
-{
-   /* Note: args 1 and 2 (status, pid) opposite way round
-      from generic handler */
-   *flags |= SfMayBlock;
-   PRINT("kwaitpid ( %#lx, %ld, %ld, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4,ARG5);
-   PRE_REG_READ3(long, "waitpid", 
-                 unsigned int *, status, int, pid, int, options);
-
-   if (ARG1 != (Addr)NULL)
-      PRE_MEM_WRITE( "kwaitpid(status)", ARG1, sizeof(int) );
-}
-POST(sys_kwaitpid)
-{
-   if (ARG1 != (Addr)NULL)
-      POST_MEM_WRITE( ARG1, sizeof(int) );
-}
-
-PRE(sys_kwrite)
-{
-   //zz   Bool ok;
-   *flags |= SfMayBlock;
-   PRINT("sys_kwrite ( %ld, %#lx, %llu )", ARG1, ARG2, (ULong)ARG3);
-   PRE_REG_READ3(ssize_t, "kwrite",
-                 unsigned int, fd, const char *, buf, vki_size_t, count);
-   /* check to see if it is allowed.  If not, try for an exemption from
-      --sim-hints=enable-outer (used for self hosting). */
-   //zz   ok = ML_(fd_allowed)(ARG1, "write", tid, False);
-   //zz   if (!ok && ARG1 == 2/*stderr*/ 
-   //zz           && VG_(strstr)(VG_(clo_sim_hints),"enable-outer"))
-   //zz      ok = True;
-   //zz   if (!ok)
-   //zz      SET_STATUS_Failure( VKI_EBADF );
-   //zz   else
-      PRE_MEM_READ( "write(buf)", ARG2, ARG3 );
-}
-
-PRE(sys_kwritev)
-{
-   PRINT("kwritev (BOGUS HANDLER)");
-}
-
-PRE(sys_listen)
-{
-   PRINT("listen (BOGUS HANDLER)");
-}
-
-PRE(sys_loadbind)
-{
-   PRINT("loadbind( %ld, %#lx, %#lx )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "loadbind", int, flag,
-                      void*, ExportPointer, void*, ImportPointer);
-}
-
-PRE(sys_loadquery)
-{
-   /* loadquery ( int flags, void* buffer, unsigned int bufferlength ) */
-   PRINT("loadquery ( %#lx, %#lx, %ld )", ARG1, ARG2, ARG3);
-   PRE_MEM_WRITE( "loadquery(buf)", ARG2, ARG3 );
-}
-POST(sys_loadquery)
-{
-   vg_assert(SUCCESS);
-   POST_MEM_WRITE( ARG2, ARG3 );
-}
-
-PRE(sys_lseek)
-{
-   PRINT("lseek (%ld, %ld, %ld)", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(long, "lseek", long, fd, long, offset, long, whence);
-}
-
-PRE(sys_mkdir)
-{
-   PRINT("mkdir (%#lx(%s), %#lx)", ARG1,(Char*)ARG1, ARG2);
-   PRE_REG_READ2(int, "mkdir", char*, path, int, mode);
-   PRE_MEM_RASCIIZ( "mkdir(path)", ARG1 );
-}
-
-PRE(sys_mmap)
-{
-   PRINT("mmap ( %#lx, %ld, %#lx, %#lx, %ld, %ld )",
-         ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
-   PRE_REG_READ6(void*, "mmap", void*, addr, int, len, 
-                        int, prot, int, flags, int, fd, int, off);
-}
-POST(sys_mmap)
-{
-   vg_assert(SUCCESS);
-   Addr  addr  = (Addr)RES;
-   UWord len   = (UWord)ARG2;
-   UWord prot  = (UWord)ARG3;
-   UWord flags = (UWord)ARG4;
-   Bool r = (prot & VKI_PROT_READ) > 0;
-   Bool w = (prot & VKI_PROT_WRITE) > 0;
-   Bool x = (prot & VKI_PROT_EXEC) > 0;
-   VG_TRACK( new_mem_mmap, addr, len, r,w,x, 0/*di_handle*/ );
-   Bool d = VG_(am_notify_client_mmap)( addr, len, prot, flags, 
-                                        0/*fake fd*/, 0/*fake offset*/);
-   if (d) 
-      VG_(discard_translations)( addr, len, "POST(sys_mmap)" );
-}
-
-PRE(sys_mntctl)
-{
-   PRINT("mntctl ( %ld, %ld, %#lx )", ARG1, ARG2, ARG3 );
-   PRE_REG_READ3(long, "mntctl", long, command, long, size, char*, buffer);
-   PRE_MEM_WRITE( "mntctl(buffer)", ARG3, ARG2 );
-}
-POST(sys_mntctl)
-{
-   vg_assert(SUCCESS);
-   if (RES == 0) {
-      /* Buffer too small.  First word is the real required size. */
-      POST_MEM_WRITE( ARG3, sizeof(Word) );
-   } else {
-      /* RES is the number of struct vmount's written to the buf.  But
-         these are variable length and to find the end would require
-         inspecting each in turn.  So be simple and just mark the
-         entire buffer as defined. */
-      POST_MEM_WRITE( ARG3, ARG2 );
-   }
-}
-
-PRE(sys_mprotect)
-{
-   PRINT("mprotect (BOGUS HANDLER)( %#lx, %ld, %#lx )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "mprotect", void*, addr, long, len, long, prot);
-}
-POST(sys_mprotect)
-{
-   Bool d;
-   vg_assert(SUCCESS);
-   Addr  addr = ARG1;
-   UWord len  = ARG2;
-   UWord prot = ARG3;
-   d = VG_(am_notify_mprotect)( addr, len, prot );
-   if (d)
-      VG_(discard_translations)( addr, len, "POST(sys_mprotect)" );
-}
-
-PRE(sys_munmap)
-{
-   PRINT("munmap ( %#lx, %ld )", ARG1, ARG2);
-   PRE_REG_READ2(int, "munmap", void*, addr, long, len);
-}
-POST(sys_munmap)
-{
-   Bool d;
-   vg_assert(SUCCESS);
-   Addr  addr = ARG1;
-   UWord len  = ARG2;
-   VG_TRACK( die_mem_munmap, addr, len );
-   d = VG_(am_notify_munmap)( addr, len );
-   if (d)
-      VG_(discard_translations)( addr, len, "POST(sys_munmap)" );
-}
-
-PRE(sys_naccept)
-{
-   PRINT("naccept (%ld, %#lx, %#lx)", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "naccept", int, socket, char*, addr, int*, addrlen);
-   PRE_MEM_READ( "naccept(addrlen)", ARG3, sizeof(UInt) );
-   PRE_MEM_WRITE( "naccept(addr)", ARG2, *(UInt*)ARG3 );
-}
-POST(sys_naccept)
-{
-   POST_MEM_WRITE( ARG3, sizeof(UInt) );
-   POST_MEM_WRITE( ARG2, *(UInt*)ARG3 );
-}
-
-PRE(sys_ngetpeername)
-{
-   PRINT("ngetpeername ( %ld, %#lx, %#lx )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "ngetpeername", int, fd, char*, name, int*, namelen);
-   PRE_MEM_READ( "ngetpeername(namelen)", ARG3, sizeof(UInt) );
-   PRE_MEM_WRITE( "ngetpeername(name)", ARG2, *(UInt*)ARG3 );
-}
-POST(sys_ngetpeername)
-{
-   POST_MEM_WRITE( ARG3, sizeof(UInt) );
-   POST_MEM_WRITE( ARG2, *(UInt*)ARG3 );
-}
-
-PRE(sys_ngetsockname)
-{
-   PRINT("ngetsockname ( %ld, %#lx, %#lx )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "ngetsockname", int, fd, char*, name, int*, namelen);
-   PRE_MEM_READ( "ngetsockname(namelen)", ARG3, sizeof(UInt) );
-   PRE_MEM_WRITE( "ngetsockname(name)", ARG2, *(UInt*)ARG3 );
-}
-POST(sys_ngetsockname)
-{
-   POST_MEM_WRITE( ARG3, sizeof(UInt) );
-   POST_MEM_WRITE( ARG2, *(UInt*)ARG3 );
-}
-
-PRE(sys_nrecvfrom)
-{
-   *flags |= SfMayBlock;
-   PRINT("nrecvfrom ( %ld, %#lx, %ld, %ld, %#lx, %#lx )",
-         ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 );
-   PRE_REG_READ6(ssize_t, "nrecvfrom",
-                 int, s, void*, buf, size_t, len, int, flags,
-                 void*, from, UInt*, fromlen);
-   PRE_MEM_WRITE( "nrecvfrom(buf)", ARG2, ARG3 );
-   if (ARG5) {
-      PRE_MEM_READ( "nrecvfrom(fromlen)", ARG6, sizeof(UInt) );
-      PRE_MEM_WRITE( "nrecvfrom(from)", ARG5, *(UInt*)ARG6 );
-   }
-}
-POST(sys_nrecvfrom)
-{
-   POST_MEM_WRITE( ARG2, RES );
-   if (ARG5) {
-      POST_MEM_WRITE(ARG6, sizeof(UInt));
-      POST_MEM_WRITE(ARG5, *(UInt*)ARG6);
-   }
-}
-
-PRE(sys_nrecvmsg)
-{
-   *flags |= SfMayBlock;
-   PRINT("nrecvmsg(BOGUS HANDLER)( %ld, %#lx, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(long, "nrecvmsg", long, arg1, void*, arg2, long, arg3);
-}
-
-PRE(sys_nsendmsg)
-{
-   *flags |= SfMayBlock;
-   PRINT("nsendmsg(BOGUS HANDLER)( %ld, %#lx, %ld )", ARG1, ARG2, ARG3);
-}
-
-PRE(sys_open) /* XXX CoG */
-{
-   //zz   HChar  name[30];
-   //zz   SysRes sres;
-
-   if (ARG2 & VKI_O_CREAT) {
-      // 3-arg version
-      PRINT("sys_open ( %#lx(%s), %#lx, %ld )",ARG1,(Char*)ARG1,ARG2,ARG3);
-      PRE_REG_READ3(long, "open",
-                    const char *, filename, int, flags, int, mode);
-   } else {
-      // 2-arg version
-      PRINT("sys_open ( %#lx(%s), %#lx )",ARG1,(Char*)ARG1,ARG2);
-      PRE_REG_READ2(long, "open",
-                    const char *, filename, int, flags);
-   }
-   PRE_MEM_RASCIIZ( "open(filename)", ARG1 );
-
-   //zz   /* Handle the case where the open is of /proc/self/cmdline or
-   //zz      /proc/<pid>/cmdline, and just give it a copy of the fd for the
-   //zz      fake file we cooked up at startup (in m_main).  Also, seek the
-   //zz      cloned fd back to the start. */
-   //zz
-   //zz   VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)());
-   //zz   if (ML_(safe_to_deref)( (void*)ARG1, 1 )
-   //zz       && (VG_(strcmp)((Char *)ARG1, name) == 0 
-   //zz           || VG_(strcmp)((Char *)ARG1, "/proc/self/cmdline") == 0)) {
-   //zz      sres = VG_(dup)( VG_(cl_cmdline_fd) );
-   //zz      SET_STATUS_from_SysRes( sres );
-   //zz      if (!sres.isError) {
-   //zz         OffT off = VG_(lseek)( sres.res, 0, VKI_SEEK_SET );
-   //zz         if (off < 0)
-   //zz            SET_STATUS_Failure( VKI_EMFILE );
-   //zz      }
-   //zz      return;
-   //zz   }
-
-   /* Otherwise handle normally */
-   *flags |= SfMayBlock;
-}
-POST(sys_open)
-{
-   vg_assert(SUCCESS);
-   //zz   if (!ML_(fd_allowed)(RES, "open", tid, True)) {
-   //zz      VG_(close)(RES);
-   //zz      SET_STATUS_Failure( VKI_EMFILE );
-   //zz   } else {
-   //zz      if (VG_(clo_track_fds))
-   //zz         ML_(record_fd_open_with_given_name)(tid, RES, (Char*)ARG1);
-   //zz   }
-}
-
-PRE(sys_pipe)
-{
-   PRINT("sys_pipe ( %#lx )", ARG1);
-   PRE_REG_READ1(int, "pipe", int *, filedes);
-   PRE_MEM_WRITE( "pipe(filedes)", ARG1, 2*sizeof(int) );
-}
-POST(sys_pipe)
-{
-  //zz   Int *p = (Int *)ARG1;
-
-  //zz  if (!ML_(fd_allowed)(p[0], "pipe", tid, True) ||
-  //zz      !ML_(fd_allowed)(p[1], "pipe", tid, True)) {
-  //zz    VG_(close)(p[0]);
-  //zz    VG_(close)(p[1]);
-  //zz    SET_STATUS_Failure( VKI_EMFILE );
-  //zz  } else {
-    POST_MEM_WRITE( ARG1, 2*sizeof(int) );
-    //zz    if (VG_(clo_track_fds)) {
-    //zz      ML_(record_fd_open_nameless)(tid, p[0]);
-    //zz      ML_(record_fd_open_nameless)(tid, p[1]);
-    //zz    }
-    //zz  }
-}
-
-PRE(sys_privcheck)
-{
-   PRINT("privcheck ( %ld )", ARG1);
-   PRE_REG_READ1(int, "privcheck", int, arg1);
-}
-
-PRE(sys_readlink)
-{
-   PRINT("readlink ( 0x%lx(%s),0x%lx,%ld )", ARG1,(Char*)ARG1, ARG2, ARG3);
-   PRE_REG_READ3(long, "readlink",
-                 const char *, path, char *, buf, int, bufsiz);
-   PRE_MEM_RASCIIZ( "readlink(path)", ARG1 );
-   PRE_MEM_WRITE( "readlink(buf)", ARG2,ARG3 );
-}
-POST(sys_readlink)
-{
-   POST_MEM_WRITE( ARG2, RES + 1 );
-}
-
-PRE(sys_recv)
-{
-   *flags |= SfMayBlock;
-   PRINT("recv ( %ld, %#lx, %ld, %ld )",
-         ARG1, ARG2, ARG3, ARG4);
-   PRE_REG_READ4(int, "recv", int, fd, void*, buf, int, len, int, flags);
-   PRE_MEM_WRITE( "recv(buf)", ARG2, ARG3);
-}
-POST(sys_recv)
-{
-   if (RES > 0)
-      POST_MEM_WRITE(ARG2, RES);
-}
-
-PRE(sys_rename)
-{
-   *flags |= SfMayBlock;
-   PRINT( "rename ( %#lx(%s), %#lx(%s) )", ARG1,(Char*)ARG1, ARG2,(Char*)ARG2 );
-   PRE_REG_READ2(int, "rename", char*, frompath, char*, topath);
-   PRE_MEM_RASCIIZ( "rename(frompath)", ARG1 );
-   PRE_MEM_RASCIIZ( "rename(topath)", ARG2 );
-}
-
-PRE(sys_sbrk)
-{
-   PRINT("sbrk (BOGUS HANDLER)( %#lx )", ARG1);
-   PRE_REG_READ1(long, "sbrk", long, arg1);
-   /* After a zero sbrk, disallow aspacem from doing sbrk, since libc
-      might rely on the value returned by this syscall. */
-   /* 1 Oct 06: not currently used (aspacemgr-aix5.c ignores it) */
-   VG_(am_aix5_sbrk_allowed) = toBool(ARG1 != 0);
-   /* Disallow libc from moving the brk backwards as that might trash
-      SkPreAlloc sections acquired by aspacem from previous uses of
-      sbrk. */
-   if (ARG1 < 0)
-      ARG1 = 0;
-   /* Do this as a sync syscall, so the sbrk_allowed flag gets turned
-      back on ASAP.  Typically libc does sbrk(0) and then sbrk(x > 0)
-      in quick succession.  Although surely it should hold some kind
-      of lock at that point, else it cannot safely use the result from
-      the first sbrk call to influence the second one? */
-   *flags &= ~SfMayBlock;
-}
-POST(sys_sbrk)
-{
-   vg_assert(SUCCESS);
-   handle_sbrk(ARG1);
-}
-
-PRE(sys_sched_get_priority_max)
-{
-   PRINT("sched_get_priority_max ( %ld )", ARG1);
-   PRE_REG_READ1(int, "sched_get_priority_max", int, arg1);
-}
-
-PRE(sys_sem_destroy)
-{
-   PRINT("sem_destroy ( %#lx )", ARG1);
-   PRE_REG_READ1(int, "sem_destroy", sem_t*, sem);
-   PRE_MEM_READ( "sem_destroy(sem)", ARG1, sizeof(sem_t) );
-}
-
-PRE(sys_sem_init)
-{
-   PRINT("sem_init ( %#lx, %ld, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "sem_init", sem_t*, sem, int, pshared, int, value);
-   PRE_MEM_WRITE( "sem_init(sem)", ARG1, sizeof(sem_t) );
-}
-POST(sys_sem_init)
-{
-   POST_MEM_WRITE( ARG1, sizeof(sem_t) );
-}
-
-PRE(sys_sem_post)
-{
-   PRINT("sem_post ( %#lx )", ARG1);
-   PRE_REG_READ1(int, "sem_post", sem_t*, sem);
-   PRE_MEM_READ("sem_post(sem)", ARG1, sizeof(sem_t));
-}
-POST(sys_sem_post)
-{
-   POST_MEM_WRITE(ARG1, sizeof(sem_t));
-}
-
-PRE(sys_send)
-{
-   *flags |= SfMayBlock;
-   PRINT("send (BOGUS HANDLER)( %ld, %#lx, %ld, %ld )", 
-         ARG1, ARG2, ARG3, ARG4);
-}
-
-PRE(sys_setgid)
-{
-   PRINT("setgid ( %ld )", ARG1);
-   PRE_REG_READ1(void, "setgid", int, uid);
-}
-
-PRE(sys_setsockopt)
-{
-   PRINT("setsockopt ( %ld, %ld, %ld, %#lx, %ld )", 
-         ARG1,ARG2,ARG3,ARG4,ARG5 );
-   PRE_REG_READ5(long, "setsockopt", 
-                 long, socket, long, level, long, optionname, 
-                 void*, optionvalue, long, optlen);
-   if (ARG4)
-      PRE_MEM_READ( "setsockopt(optionvalue)", ARG4, ARG5 );
-}
-
-PRE(sys_setuid)
-{
-   PRINT("setuid ( %ld )", ARG1);
-   PRE_REG_READ1(void, "setuid", int, uid);
-}
-
-static UWord get_shm_size ( Word shmid )
-{
-   SysRes res;
-   struct shmid_ds buf;
-   vg_assert(__NR_AIX5_shmctl != __NR_AIX5_UNKNOWN);
-   res = VG_(do_syscall3)(__NR_AIX5_shmctl, shmid, IPC_STAT, (UWord)&buf);
-   if (0) 
-      VG_(printf)("XXX: shm_size(%ld) = %ld %ld\n", shmid, res.res, res.err);
-   if (res.isError) {
-      if (0)
-         VG_(printf)("XXX: shm_size(shmid = %ld): FAILED\n", shmid);
-      return 0* 4096;
-   } else {
-      return buf.shm_segsz;
-   }
-   /* fails with 22 and 13 (22 = EINVAL, Invalid argument,
-      13 = EACCES, Permission denied) */
-   /* shmat (4, 0x0, 0x1800) --> Success(0x40000000)
-      XXX: shm_size(4) = -1 22
-      shmat: seg size = 0
-      XXX: shm_size(4) = -1 22
-
-      shmat (5, 0x0, 0x1800) --> Success(0x50000000)
-      XXX: shm_size(5) = -1 13
-      shmat: seg size = 0
-      XXX: shm_size(5) = -1 13
-
-      shmat (4, 0x0, 0x1800) --> Success(0x40000000)
-      XXX: shm_size(4) = -1 22
-      shmat: seg size = 0
-      XXX: shm_size(4) = -1 22
-   */
-}
-PRE(sys_shmat)
-{
-   UWord segmentSize;
-   /* void* shmat ( int shmid, const void* shmaddr, int flags ) */
-   PRINT("shmat (%ld, %#lx, %#lx)", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(void*, "shmat", int, shmid, void*, shmaddr, int, flags);
-   segmentSize = get_shm_size( ARG1 );
-   if (0) VG_(printf)("shmat: seg size = %lu\n", segmentSize);
-}
-POST(sys_shmat)
-{
-   UInt segmentSize;
-   vg_assert(SUCCESS);
-   vg_assert(RES != -1L);
-   segmentSize = get_shm_size ( ARG1 );
-   if ( segmentSize > 0 ) {
-      UInt prot = VKI_PROT_READ|VKI_PROT_WRITE;
-      Bool d;
-
-      if (ARG2 & SHM_RDONLY)
-         prot &= ~VKI_PROT_WRITE;
-
-      d = VG_(am_notify_client_shmat)( RES, VG_PGROUNDUP(segmentSize), prot );
-
-      /* we don't distinguish whether it's read-only or
-       * read-write -- it doesn't matter really. */
-      VG_TRACK( new_mem_mmap, RES, segmentSize, True, True, False, 0/*di_handle*/ );
-      if (d)
-         VG_(discard_translations)( (Addr64)RES, 
-                                    (ULong)VG_PGROUNDUP(segmentSize),
-                                    "ML_(generic_POST_sys_shmat)" );
-   }
-}
-
-PRE(sys_shmctl)
-{
-   PRINT("shmctl ( %ld, %ld, %#lx )", ARG1, ARG2, ARG3 );
-   PRE_REG_READ3(int, "shmctl", int, shmid, int, command, void*, buffer);
-   if (ARG3)
-      PRE_MEM_WRITE( "shmctl(buffer)", ARG3, sizeof(struct shmid_ds) );
-}
-POST(sys_shmctl)
-{
-   if ((ARG3) && ARG2 == IPC_STAT)
-      POST_MEM_WRITE( ARG3, sizeof(struct shmid_ds) );
-}
-
-PRE(sys_shmdt)
-{
-   PRINT("shmdt ( %#lx )", ARG1);
-   PRE_REG_READ1(long, "shmdt", void*, address);
-}
-POST(sys_shmdt)
-{
-   NSegment const*const s = VG_(am_find_nsegment)(ARG1);
-
-   if (s != NULL) {
-      Addr  s_start = s->start;
-      SizeT s_len   = s->end+1 - s->start;
-      Bool  d;
-
-      vg_assert(s->kind == SkShmC && s->start == ARG1);
-
-      d = VG_(am_notify_munmap)(s_start, s_len);
-      /* s is now invalid; do not use after here */
-      VG_TRACK( die_mem_munmap, s_start, s_len );
-      if (d)
-         VG_(discard_translations)( (Addr64)s_start,
-                                    (ULong)s_len,
-                                    "ML_(generic_POST_sys_shmdt)" );
-   }
-}
-
-PRE(sys_shmget)
-{
-   PRINT("shmget ( %ld, %ld, %ld )", ARG1, ARG2, ARG3 );
-   PRE_REG_READ3(int, "shmget", key_t, key, size_t, size, int, shmFlag);
-}
-
-PRE(sys_shutdown)
-{
-   PRINT("shutdown (BOGUS HANDLER)");
-}
-
-PRE(sys_sigcleanup)
-{
-   PRINT("sigcleanup (UNDOCUMENTED)");
-}
-
-PRE(sys_sigprocmask)
-{
-   PRINT("sigprocmask ( %ld, %#lx, %#lx )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(long, "sigprocmask", 
-                 int, how, vki_sigset_t *, set, vki_sigset_t *, oldset);
-   if (ARG2 != 0)
-      PRE_MEM_READ( "sigprocmask(set)", ARG2, sizeof(vki_sigset_t));
-   if (ARG3 != 0)
-      PRE_MEM_WRITE( "sigprocmask(oldset)", ARG3, sizeof(vki_sigset_t));
-
-   SET_STATUS_from_SysRes(
-      VG_(do_sys_sigprocmask) ( tid, ARG1, (vki_sigset_t*)ARG2, 
-                                           (vki_sigset_t*)ARG3 )
-   );
-
-   if (SUCCESS)
-     *flags |= SfPollAfter;
-}
-POST(sys_sigprocmask)
-{
-   vg_assert(SUCCESS);
-   if (RES == 0 && ARG3 != 0)
-      POST_MEM_WRITE( ARG3, sizeof(vki_sigset_t));
-}
-
-PRE(sys_socket)
-{
-   PRINT("socket ( %ld, %ld, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "socket", int, domain, int, type, int, protocol);
-}
-
-PRE(sys_statfs)
-{
-   PRINT("sys_statfs ( %#lx(%s), %#lx )",ARG1,(Char*)ARG1,ARG2);
-   PRE_REG_READ2(long, "statfs", const char *, path, struct statfs *, buf);
-   PRE_MEM_RASCIIZ( "statfs(path)", ARG1 );
-   PRE_MEM_WRITE( "statfs(buf)", ARG2, sizeof(struct statfs) );
-}
-POST(sys_statfs)
-{
-   POST_MEM_WRITE( ARG2, sizeof(struct statfs) );
-}
-
-PRE(sys_statx)
-{
-   PRINT("statx ( %#lx(%s), %#lx, %ld, %ld )", ARG1,(Char*)ARG1,ARG2,ARG3,ARG4);
-   PRE_MEM_RASCIIZ( "statx(file_name)", ARG1 );
-   PRE_REG_READ4(Word, "statx", UWord, fd, void*, buf,
-                                UWord, len, UWord, cmd);
-   PRE_MEM_WRITE( "statx(buf)", ARG2, ARG3 );
-}
-POST(sys_statx)
-{
-   POST_MEM_WRITE( ARG2, ARG3 );
-}
-
-PRE(sys_symlink)
-{
-   PRINT("symlink (BOGUS HANDLER)");
-}
-
-PRE(sys_sys_parm)
-{
-   PRINT("sys_parm (%ld, %ld, %#lx)", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "sys_parm", int, cmd, int, cmdflag, 
-                      struct vario*, parmp);
-   /* this is a bit of a kludge, but if parmp has uninitialised areas
-      and we're doing SYSP_SET, lots of errors will be tiresomely
-      reported.  Hence just ignore the definedness of the area and
-      only check addressability. */
-   PRE_MEM_WRITE( "sys_parm(parmp)", ARG3, sizeof(struct vario));
-}
-POST(sys_sys_parm)
-{
-   if (ARG1 == SYSP_GET)
-      POST_MEM_WRITE( ARG3, sizeof(struct vario) );
-}
-
-PRE(sys_sysconfig)
-{
-   PRINT("sysconfig ( %ld, %#lx, %ld )", ARG1, ARG2, ARG3);
-   PRE_REG_READ3(int, "sysconfig", int, cmd, void*, parmp, int, parmlen);
-   /* It may be that the area is read sometimes as well as written,
-      but for the same reasons as sys_parm, just check addressibility,
-      not definedness. */
-   PRE_MEM_WRITE( "sysconfig(parmp)", ARG2, ARG3 );
-}
-POST(sys_sysconfig)
-{
-   POST_MEM_WRITE( ARG2, ARG3 );
-}
-
-PRE(sys_thread_create)
-{
-   *flags |= SfMayBlock;
-   PRINT("thread_create ( )");
-}
-POST(sys_thread_create)
-{
-   vg_assert(SUCCESS);
-   if (0) VG_(printf)("new lwpid is %ld\n", RES);
-
-   /* Allocate a new thread slot (which sets it to VgTs_Init), and
-      record the lwpid in it, so can later find it again when handling
-      sys_thread_setstate for that lwpid. */
-
-   ThreadId     ctid = VG_(alloc_ThreadState)();
-   ThreadState* ctst = VG_(get_ThreadState)(ctid);
-
-   vg_assert(ctst->status == VgTs_Init);
-
-   { /* Clear all os_state fields except for the vg stack ones, so any
-        existing stack gets reused. */
-     Addr v_s_b    = ctst->os_state.valgrind_stack_base;
-     Addr v_s_i_SP = ctst->os_state.valgrind_stack_init_SP;
-     VG_(memset)(&ctst->os_state, 0, sizeof(ThreadOSstate));
-     ctst->os_state.valgrind_stack_base    = v_s_b;
-     ctst->os_state.valgrind_stack_init_SP = v_s_i_SP;
-   }
-   ctst->os_state.lwpid = RES;
-}
-
-PRE(sys_thread_init)
-{
-   *flags |= SfMayBlock;
-   PRE_REG_READ2(long, "thread_init", long, arg1, long, arg2);
-   PRINT("thread_init (BOGUS HANDLER) ( %#lx, %#lx )", ARG1, ARG2);
-}
-
-PRE(sys_thread_kill)
-{
-   Int target_lwpid, my_lwpid;
-   PRINT("thread_kill ( %ld, %ld )", ARG1, ARG2);
-
-   if ( ((Word)ARG1) == (Word)(-1)
-        && ARG2 == VKI_SIGSEGV ) {
-      /* too difficult to continue; give up. */
-      ML_(aix5_set_threadstate_for_emergency_exit)
-         (tid, "exiting due to thread_kill(..,SIGSEGV) to process");
-      SET_STATUS_Success(0);
-      return;
-   }
-
-   /* Check to see if this kill gave us a pending signal */
-   *flags |= SfPollAfter;
-
-   target_lwpid = (Int)ARG1;
-   my_lwpid     = VG_(gettid)();
-   /* we still hold the lock.  Do deadlock-avoidance stuff. */
-   if (target_lwpid == my_lwpid) {
-      /* sending a signal to myself, which may be fatal.  Therefore
-         drop the lock so that if the signal kills me, some other
-         thread can pick it up. */
-      *flags |= SfMayBlock;
-   } else {
-      /* sending a signal to some other thread, which may kill it;
-         therefore I'd better hold on to the lock to ensure that the
-         target doesn't get killed whilst holding it. */
-   }
-}
-
-/* thread_setmymask_fast is handled on a per platform basis */
-
-PRE(sys_thread_setmystate)
-{
-   *flags |= SfMayBlock;
-   /* args: struct tstate *, struct tstate * 
-      I assume: first is new state, if not NULL.  
-      Second is place to write the previous state, if not NULL.
-      (in the style of sigaction) */
-   PRINT("thread_setmystate (BOGUS HANDLER) ( %#lx, %#lx )",
-         ARG1, ARG2 );
-   PRE_REG_READ2(long, "thread_setmystate", 
-                       struct tstate *, newstate, 
-                       struct tstate *, oldstate );
-   if (ARG1)
-      PRE_MEM_READ( "thread_setmystate(arg1)", ARG1, sizeof(struct tstate) );
-   if (ARG2)
-      PRE_MEM_WRITE( "thread_setmystate(arg2)", ARG2, sizeof(struct tstate) );
-   if (1 && VG_(clo_trace_syscalls) && ARG1)
-      ML_(aix5debugstuff_show_tstate)(ARG1, "thread_setmystate (NEW)");
-
-   struct tstate* newts  = (struct tstate*)ARG1;
-   struct tstate* oldts  = (struct tstate*)ARG2;
-
-   /* Are we just messing with the signal mask?  If so intercept it
-      and do it ourselves.  Same idea as handling for
-      thread_setmymask_fast in 32-bit mode. */
-   if (newts && newts->flags == TSTATE_CHANGE_SIGMASK) {
-      vki_sigset_t* newset = newts ? (vki_sigset_t*)&newts->sigmask : NULL;
-      vki_sigset_t* oldset = oldts ? (vki_sigset_t*)&oldts->sigmask : NULL;
-      SET_STATUS_from_SysRes(
-         VG_(do_sys_sigprocmask) ( tid, VKI_SIG_SETMASK, newset, oldset )
-      );
-      *flags &= ~SfMayBlock;
-      return;
-   }
-}
-POST(sys_thread_setmystate)
-{
-   if (ARG2)
-      POST_MEM_WRITE( ARG2, sizeof(struct tstate) );
-   if (0 && VG_(clo_trace_syscalls) && ARG2)
-      ML_(aix5debugstuff_show_tstate)(ARG2, "thread_setmystate (OLD)");
-}
-
-PRE(sys_thread_setmystate_fast)
-{
-   UWord how = ARG1;
-   /* args: ?? */
-   PRINT("thread_setmystate_fast (BOGUS HANDLER)"
-         "(%#lx,%#lx(%s),%#lx(%s))", 
-         ARG1,
-         ARG2, ML_(aix5debugstuff_pc_to_fnname)(ARG2),
-         ARG3, ML_(aix5debugstuff_pc_to_fnname)(ARG3)
-        );
-   PRE_REG_READ3(long, "thread_setmystate_fast", 
-                       long, arg1, long, arg2, long, arg3);
-   if (1 && VG_(clo_trace_syscalls))
-      ML_(aix5debugstuff_show_tstate_flags)( how );
-
-   if (how & TSTATE_CHANGE_FLAGS) {
-      /* Messing with cancellation type/state.  Pay attention. */
-      Bool async    = (how & TSTATE_CANCEL_DEFER) == 0;
-      Bool disabled = (how & TSTATE_CANCEL_DISABLE) > 0;
-      ThreadState* tst = VG_(get_ThreadState)(tid);
-      if (VG_(clo_trace_syscalls))
-         VG_(printf)("(cancellation state -> %s %s)",
-                     async ? "ASYNC" : "DEFER",
-                     disabled ? "DISABLED" : " ENABLED");
-      tst->os_state.cancel_async    = async;
-      tst->os_state.cancel_disabled = disabled;
-      /* If cancellation has been enabled for this thread and there is
-         a request outstanding, honour it now. */
-      if ((!disabled)
-          && tst->os_state.cancel_progress == Canc_Requested) {
-         if (VG_(clo_trace_syscalls))
-            VG_(printf)("(honouring previous cancellation request)");
-         tst->os_state.cancel_progress = Canc_Actioned;
-         Bool ok = ML_(aix5_force_thread_into_pthread_exit)(tid);
-         if (!ok) {
-            /* now at serious risk of deadlock/livelock.  Give up
-               rather than continue. */
-            ML_(aix5_set_threadstate_for_emergency_exit)
-               (tid, "pthread_cancel(case1): "
-                     "cannot find pthread_exit; aborting");
-            SET_STATUS_Success(0);
-            return;
-         }
-      }
-      SET_STATUS_Success(0);
-      return;
-   }
-
-   /* In all other cases, hand to kernel. */
-   *flags |= SfMayBlock;
-}
-
-/* thread_setstate is handled in syswrap-ppc{32,64}-aix5.c. */
-
-PRE(sys_thread_terminate_unlock)
-{
-   ThreadState* tst;
-   /* simple; just make this thread exit */
-   PRINT("thread_terminate_unlock( %#lx )", ARG1);
-   PRE_REG_READ1(void, "thread_terminate_unlock", void*, exitcode);
-   tst = VG_(get_ThreadState)(tid);
-   /* Drop the lock we were holding, since we're not really going to
-      exit the host thread with thread_terminate_unlock. */
-   if (0) VG_(printf)("XXXXX dropping lock\n");
-   if (1) VG_(do_syscall1)(__NR_AIX5_thread_unlock, ARG1);
-   /* Set the thread's status to be exiting, then claim that the
-      syscall succeeded. */
-   tst->exitreason = VgSrc_ExitThread;
-   tst->os_state.exitcode = 0;
-   SET_STATUS_Success(0);
-}
-
-PRE(sys_thread_tsleep)
-{
-   *flags |= SfMayBlock;
-   PRINT("thread_tsleep (BOGUS HANDLER)( %ld, %#lx, %#lx, %#lx )", 
-         ARG1, ARG2, ARG3, ARG4 );
-}
-
-PRE(sys_thread_tsleep_event)
-{
-   *flags |= SfMayBlock;
-   PRINT("thread_tsleep_event (UNDOCUMENTED)( %#lx, %#lx, %ld, %#lx )", 
-         ARG1, ARG2, ARG3, ARG4 );
-}
-
-PRE(sys_thread_twakeup)
-{
-   *flags |= SfMayBlock;
-   PRINT("thread_twakeup (BOGUS HANDLER)( tid=%ld, val=%#lx )", ARG1, ARG2 );
-}
-
-PRE(sys_thread_twakeup_event)
-{
-   *flags |= SfMayBlock;
-   PRINT("thread_twakeup_event (BOGUS HANDLER)( %#lx, %ld, %ld )", 
-         ARG1, ARG2, ARG3 );
-}
-
-PRE(sys_thread_unlock)
-{
-   *flags |= SfMayBlock;
-   PRINT("thread_unlock (BOGUS HANDLER)" );
-}
-
-PRE(sys_thread_waitlock)
-{
-   *flags |= SfMayBlock;
-   PRINT("thread_waitlock (BOGUS HANDLER)" );
-}
-
-PRE(sys_thread_waitlock_)
-{
-   *flags |= SfMayBlock;
-   PRINT("thread_waitlock_ (BOGUS HANDLER)" );
-}
-
-PRE(sys_times)
-{
-   PRINT("times ( %#lx )", ARG1);
-   PRE_REG_READ1(long, "times", struct tms *, buffer);
-   PRE_MEM_WRITE("times(buf)", ARG1, sizeof(struct tms) );
-}
-POST(sys_times)
-{
-   POST_MEM_WRITE( ARG1, sizeof(struct tms) );
-}
-
-PRE(sys_umask)
-{
-   PRINT("umask (BOGUS HANDLER)");
-}
-
-PRE(sys_uname)
-{
-   PRINT("uname ( %#lx )", ARG1);
-   PRE_MEM_WRITE( "uname(Name)", ARG1, sizeof(struct utsname));
-}
-POST(sys_uname)
-{
-   vg_assert(SUCCESS);
-   POST_MEM_WRITE( ARG1, sizeof(struct utsname));
-}
-
-PRE(sys_unlink)
-{
-   PRINT("unlink ( %#lx(%s) )", ARG1, (Char*)ARG1 );
-   PRE_REG_READ1(int, "unlink", char*, path);
-   PRE_MEM_RASCIIZ( "unlink(path)", ARG1 );
-}
-
-PRE(sys_utimes)
-{
-   PRINT("utimes ( %#lx(%s), %#lx )", ARG1,(Char*)ARG1, ARG2);
-   PRE_REG_READ2(int, "utimes", char*, path, struct timeval*, times);
-   PRE_MEM_RASCIIZ( "utimes(path)", ARG1 );
-   PRE_MEM_READ( "utimes(times)", ARG2, 2 * sizeof(struct vki_timeval) );
-}
-
-PRE(sys_vmgetinfo)
-{
-   PRINT("vmgetinfo ( %#lx, %ld, %ld )", ARG1, ARG2, ARG3 );
-   PRE_REG_READ3(int, "vmgetinfo", void*, out, int, command, int, arg);
-   /* It looks like libc's vmgetinfo just hands stuff through to the
-      syscall.  The man page says that the interpretation of ARG3(arg)
-      depends on ARG2(cmd); nevertheless in all cases basically this
-      writes the buffer (ARG1, ARG3). */
-   PRE_MEM_WRITE("vmgetinfo(buf)", ARG1, ARG3);
-}
-POST(sys_vmgetinfo)
-{
-   vg_assert(SUCCESS);
-   POST_MEM_WRITE(ARG1, ARG3);
-}
-
-PRE(sys_yield)
-{
-   *flags |= SfMayBlock;
-   PRINT("yield ( )");
-}
-
-#undef PRE
-#undef POST
-
-#endif // defined(VGO_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
index fd6927f..a1c55b6 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -1,6 +1,6 @@
 
 /*--------------------------------------------------------------------*/
-/*--- Wrappers for generic (non-AIX5!) Unix system calls           ---*/
+/*--- Wrappers for generic Unix system calls                       ---*/
 /*---                                            syswrap-generic.c ---*/
 /*--------------------------------------------------------------------*/
 
@@ -771,7 +771,6 @@
 
 void VG_(init_preopened_fds)(void)
 {
-// Nb: AIX5 is handled in syswrap-aix5.c.
 // DDD: should probably use HAVE_PROC here or similar, instead.
 #if defined(VGO_linux)
    Int ret;
@@ -2981,7 +2980,7 @@
 
    if (!SUCCESS) return;
 
-#if defined(VGO_linux) || defined(VGO_aix5)
+#if defined(VGO_linux)
    // RES is 0 for child, non-0 (the child's PID) for parent.
    is_child = ( RES == 0 ? True : False );
    child_pid = ( is_child ? -1 : RES );
diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c
index f50a57b..0daa6dd 100644
--- a/coregrind/m_syswrap/syswrap-main.c
+++ b/coregrind/m_syswrap/syswrap-main.c
@@ -68,6 +68,7 @@
    ppc32  r0    r3   r4   r5   r6   r7   r8   n/a  n/a  r3+CR0.SO (== ARG1)
    ppc64  r0    r3   r4   r5   r6   r7   r8   n/a  n/a  r3+CR0.SO (== ARG1)
    arm    r7    r0   r1   r2   r3   r4   r5   n/a  n/a  r0        (== ARG1)
+
    On s390x the svc instruction is used for system calls. The system call
    number is encoded in the instruction (8 bit immediate field). Since Linux
    2.6 it is also allowed to use svc 0 with the system call number in r1.
@@ -75,9 +76,6 @@
    also possible to see the svc 0 together with an EXecute instruction, that
    fills in the immediate field.
    s390x r1/SVC r2   r3   r4   r5   r6   r7   n/a  n/a  r2        (== ARG1)
-   AIX:
-   ppc32  r2  r3   r4   r5   r6   r7   r8   r9   r10  r3(res),r4(err)
-   ppc64  r2  r3   r4   r5   r6   r7   r8   r9   r10  r3(res),r4(err)
 
    DARWIN:
    x86    eax +4   +8   +12  +16  +20  +24  +28  +32  edx:eax, eflags.c
@@ -276,14 +274,6 @@
                                       const vki_sigset_t *syscall_mask,
                                       const vki_sigset_t *restore_mask,
                                       Word sigsetSzB );
-#elif defined(VGO_aix5)
-extern
-UWord ML_(do_syscall_for_client_WRK)( Word syscallno, 
-                                      void* guest_state,
-                                      const vki_sigset_t *syscall_mask,
-                                      const vki_sigset_t *restore_mask,
-                                      Word sigsetSzB, /* unused */
-                                      Word __nr_sigprocmask );
 #elif defined(VGO_darwin)
 extern
 UWord ML_(do_syscall_for_client_unix_WRK)( Word syscallno, 
@@ -320,12 +310,6 @@
             syscallno, &tst->arch.vex, 
             syscall_mask, &saved, sizeof(vki_sigset_t)
          );
-#  elif defined(VGO_aix5)
-   err = ML_(do_syscall_for_client_WRK)(
-            syscallno, &tst->arch.vex, 
-            syscall_mask, &saved, 0/*unused:sigsetSzB*/,
-            __NR_rt_sigprocmask
-         );
 #  elif defined(VGO_darwin)
    switch (VG_DARWIN_SYSNO_CLASS(syscallno)) {
       case VG_DARWIN_SYSCALL_CLASS_UNIX:
@@ -478,30 +462,6 @@
    canonical->arg7  = 0;
    canonical->arg8  = 0;
 
-#elif defined(VGP_ppc32_aix5)
-   VexGuestPPC32State* gst = (VexGuestPPC32State*)gst_vanilla;
-   canonical->sysno = gst->guest_GPR2;
-   canonical->arg1  = gst->guest_GPR3;
-   canonical->arg2  = gst->guest_GPR4;
-   canonical->arg3  = gst->guest_GPR5;
-   canonical->arg4  = gst->guest_GPR6;
-   canonical->arg5  = gst->guest_GPR7;
-   canonical->arg6  = gst->guest_GPR8;
-   canonical->arg7  = gst->guest_GPR9;
-   canonical->arg8  = gst->guest_GPR10;
-
-#elif defined(VGP_ppc64_aix5)
-   VexGuestPPC64State* gst = (VexGuestPPC64State*)gst_vanilla;
-   canonical->sysno = gst->guest_GPR2;
-   canonical->arg1  = gst->guest_GPR3;
-   canonical->arg2  = gst->guest_GPR4;
-   canonical->arg3  = gst->guest_GPR5;
-   canonical->arg4  = gst->guest_GPR6;
-   canonical->arg5  = gst->guest_GPR7;
-   canonical->arg6  = gst->guest_GPR8;
-   canonical->arg7  = gst->guest_GPR9;
-   canonical->arg8  = gst->guest_GPR10;
-
 #elif defined(VGP_x86_darwin)
    VexGuestX86State* gst = (VexGuestX86State*)gst_vanilla;
    UWord *stack = (UWord *)gst->guest_ESP;
@@ -691,30 +651,6 @@
    gst->guest_R4 = canonical->arg5;
    gst->guest_R5 = canonical->arg6;
 
-#elif defined(VGP_ppc32_aix5)
-   VexGuestPPC32State* gst = (VexGuestPPC32State*)gst_vanilla;
-   gst->guest_GPR2  = canonical->sysno;
-   gst->guest_GPR3  = canonical->arg1;
-   gst->guest_GPR4  = canonical->arg2;
-   gst->guest_GPR5  = canonical->arg3;
-   gst->guest_GPR6  = canonical->arg4;
-   gst->guest_GPR7  = canonical->arg5;
-   gst->guest_GPR8  = canonical->arg6;
-   gst->guest_GPR9  = canonical->arg7;
-   gst->guest_GPR10 = canonical->arg8;
-
-#elif defined(VGP_ppc64_aix5)
-   VexGuestPPC64State* gst = (VexGuestPPC64State*)gst_vanilla;
-   gst->guest_GPR2  = canonical->sysno;
-   gst->guest_GPR3  = canonical->arg1;
-   gst->guest_GPR4  = canonical->arg2;
-   gst->guest_GPR5  = canonical->arg3;
-   gst->guest_GPR6  = canonical->arg4;
-   gst->guest_GPR7  = canonical->arg5;
-   gst->guest_GPR8  = canonical->arg6;
-   gst->guest_GPR9  = canonical->arg7;
-   gst->guest_GPR10 = canonical->arg8;
-
 #elif defined(VGP_x86_darwin)
    VexGuestX86State* gst = (VexGuestX86State*)gst_vanilla;
    UWord *stack = (UWord *)gst->guest_ESP;
@@ -797,18 +733,6 @@
    canonical->sres = VG_(mk_SysRes_arm_linux)( gst->guest_R0 );
    canonical->what = SsComplete;
 
-#  elif defined(VGP_ppc32_aix5)
-   VexGuestPPC32State* gst = (VexGuestPPC32State*)gst_vanilla;
-   canonical->sres = VG_(mk_SysRes_ppc32_aix5)( gst->guest_GPR3, 
-                                                gst->guest_GPR4 );
-   canonical->what = SsComplete;
-
-#  elif defined(VGP_ppc64_aix5)
-   VexGuestPPC64State* gst = (VexGuestPPC64State*)gst_vanilla;
-   canonical->sres = VG_(mk_SysRes_ppc64_aix5)( gst->guest_GPR3, 
-                                                gst->guest_GPR4 );
-   canonical->what = SsComplete;
-
 #  elif defined(VGP_x86_darwin)
    /* duplicates logic in m_signals.VG_UCONTEXT_SYSCALL_SYSRES */
    VexGuestX86State* gst = (VexGuestX86State*)gst_vanilla;
@@ -966,26 +890,6 @@
    VG_TRACK( post_reg_write, Vg_CoreSysCall, tid, 
              OFFSET_arm_R0, sizeof(UWord) );
 
-#  elif defined(VGP_ppc32_aix5)
-   VexGuestPPC32State* gst = (VexGuestPPC32State*)gst_vanilla;
-   vg_assert(canonical->what == SsComplete);
-   gst->guest_GPR3 = canonical->sres.res;
-   gst->guest_GPR4 = canonical->sres.err;
-   VG_TRACK( post_reg_write, Vg_CoreSysCall, tid, 
-             OFFSET_ppc32_GPR3, sizeof(UWord) );
-   VG_TRACK( post_reg_write, Vg_CoreSysCall, tid, 
-             OFFSET_ppc32_GPR4, sizeof(UWord) );
-
-#  elif defined(VGP_ppc64_aix5)
-   VexGuestPPC64State* gst = (VexGuestPPC64State*)gst_vanilla;
-   vg_assert(canonical->what == SsComplete);
-   gst->guest_GPR3 = canonical->sres.res;
-   gst->guest_GPR4 = canonical->sres.err;
-   VG_TRACK( post_reg_write, Vg_CoreSysCall, tid, 
-             OFFSET_ppc64_GPR3, sizeof(UWord) );
-   VG_TRACK( post_reg_write, Vg_CoreSysCall, tid, 
-             OFFSET_ppc64_GPR4, sizeof(UWord) );
-
 #elif defined(VGP_x86_darwin)
    VexGuestX86State* gst = (VexGuestX86State*)gst_vanilla;
    SysRes sres = canonical->sres;
@@ -1129,28 +1033,6 @@
    layout->uu_arg7  = -1; /* impossible value */
    layout->uu_arg8  = -1; /* impossible value */
 
-#elif defined(VGP_ppc32_aix5)
-   layout->o_sysno  = OFFSET_ppc32_GPR2;
-   layout->o_arg1   = OFFSET_ppc32_GPR3;
-   layout->o_arg2   = OFFSET_ppc32_GPR4;
-   layout->o_arg3   = OFFSET_ppc32_GPR5;
-   layout->o_arg4   = OFFSET_ppc32_GPR6;
-   layout->o_arg5   = OFFSET_ppc32_GPR7;
-   layout->o_arg6   = OFFSET_ppc32_GPR8;
-   layout->o_arg7   = OFFSET_ppc32_GPR9;
-   layout->o_arg8   = OFFSET_ppc32_GPR10;
-
-#elif defined(VGP_ppc64_aix5)
-   layout->o_sysno  = OFFSET_ppc64_GPR2;
-   layout->o_arg1   = OFFSET_ppc64_GPR3;
-   layout->o_arg2   = OFFSET_ppc64_GPR4;
-   layout->o_arg3   = OFFSET_ppc64_GPR5;
-   layout->o_arg4   = OFFSET_ppc64_GPR6;
-   layout->o_arg5   = OFFSET_ppc64_GPR7;
-   layout->o_arg6   = OFFSET_ppc64_GPR8;
-   layout->o_arg7   = OFFSET_ppc64_GPR9;
-   layout->o_arg8   = OFFSET_ppc64_GPR10;
-
 #elif defined(VGP_x86_darwin)
    layout->o_sysno  = OFFSET_x86_EAX;
    // syscall parameters are on stack in C convention
@@ -1227,12 +1109,6 @@
 #  if defined(VGO_linux)
    sys = ML_(get_linux_syscall_entry)( syscallno );
 
-#  elif defined(VGP_ppc32_aix5)
-   sys = ML_(get_ppc32_aix5_syscall_entry) ( syscallno );
-
-#  elif defined(VGP_ppc64_aix5)
-   sys = ML_(get_ppc64_aix5_syscall_entry) ( syscallno );
-
 #  elif defined(VGO_darwin)
    Int idx = VG_DARWIN_SYSNO_INDEX(syscallno);
 
@@ -1442,10 +1318,10 @@
       be m_signals.async_signalhandler) we will need to build a SysRes
       reflecting the syscall return result.  In order to do that we
       need to know the syscall class.  Hence stash it in the guest
-      state of this thread.  This madness is not needed on Linux or
-      AIX5, because those OSs only have a single syscall return
-      convention and so there is no ambiguity involved in converting
-      the post-signal machine state into a SysRes. */
+      state of this thread.  This madness is not needed on Linux
+      because it only has a single syscall return convention and so
+      there is no ambiguity involved in converting the post-signal
+      machine state into a SysRes. */
    tst->arch.vex.guest_SC_CLASS = VG_DARWIN_SYSNO_CLASS(sysno);
 #  endif
 
@@ -1837,7 +1713,7 @@
 /* These are addresses within ML_(do_syscall_for_client_WRK).  See
    syscall-$PLAT.S for details. 
 */
-#if defined(VGO_linux) || defined(VGO_aix5)
+#if defined(VGO_linux)
   extern const Addr ML_(blksys_setup);
   extern const Addr ML_(blksys_restart);
   extern const Addr ML_(blksys_complete);
@@ -1965,32 +1841,6 @@
       vg_assert(valid);
    }
 
-#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   /* Hmm.  This is problematic, because on AIX the kernel resumes
-      after a syscall at LR, not at the insn following SC.  Hence
-      there is no obvious way to figure out where the SC is.  Current
-      solution is to have a pseudo-register in the guest state,
-      CIA_AT_SC, which holds the address of the most recent SC
-      executed.  Backing up to that syscall then simply involves
-      copying that value back into CIA (the program counter). */
-   arch->vex.guest_CIA = arch->vex.guest_CIA_AT_SC;
-
-   /* Make sure our caller is actually sane, and we're really backing
-      back over a syscall.
-
-      sc == 44 00 00 02
-   */
-   {
-      UChar *p = (UChar *)arch->vex.guest_CIA;
-
-      if (p[0] != 0x44 || p[1] != 0x0 || p[2] != 0x0 || p[3] != 0x02)
-         VG_(message)(Vg_DebugMsg,
-                      "?! restarting over syscall at %#lx %02x %02x %02x %02x\n",
-                      (UWord)arch->vex.guest_CIA, p[0], p[1], p[2], p[3]);
-
-      vg_assert(p[0] == 0x44 && p[1] == 0x0 && p[2] == 0x0 && p[3] == 0x2);
-   }
-
 #elif defined(VGP_x86_darwin)
    arch->vex.guest_EIP = arch->vex.guest_IP_AT_SYSCALL; 
 
@@ -2100,7 +1950,7 @@
         in_complete_to_committed, // [3,4) in the .S files
         in_committed_to_finished; // [4,5) in the .S files
 
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    outside_range
       = ip < ML_(blksys_setup) || ip >= ML_(blksys_finished);
    in_setup_to_restart
diff --git a/coregrind/m_syswrap/syswrap-ppc32-aix5.c b/coregrind/m_syswrap/syswrap-ppc32-aix5.c
deleted file mode 100644
index 01c70a1..0000000
--- a/coregrind/m_syswrap/syswrap-ppc32-aix5.c
+++ /dev/null
@@ -1,917 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Platform-specific syscalls stuff.       syswrap-ppc32-aix5.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#if defined(VGP_ppc32_aix5)
-
-#include "pub_core_basics.h"
-#include "pub_core_vki.h"
-#include "pub_core_vkiscnums.h"
-#include "pub_core_threadstate.h"
-#include "pub_core_debuglog.h"
-#include "pub_core_libcassert.h"
-#include "pub_core_libcprint.h"
-#include "pub_core_libcproc.h"
-#include "pub_core_options.h"
-#include "pub_core_scheduler.h"
-#include "pub_core_sigframe.h"      // For VG_(sigframe_destroy)()
-#include "pub_core_signals.h"
-#include "pub_core_syscall.h"
-#include "pub_core_syswrap.h"
-#include "pub_core_tooliface.h"
-
-#include "priv_types_n_macros.h"
-#include "priv_syswrap-aix5.h"      /* for decls of aix5-common wrappers */
-#include "priv_syswrap-main.h"
-
-
-/* --------- HACKS --------- */
-/* XXXXXXXXXXXX these HACKS are copies of stuff in syswrap-linux.c;
-   check for duplication. */
-/* HACK: is in syswrap-generic.c, but that doesn't get built on AIX. */
-/* Dump out a summary, and a more detailed list, of open file descriptors. */
-void VG_(show_open_fds) ( void )
-{
-  I_die_here;
-}
-static Bool i_am_the_only_thread ( void )
-{
-   Int c = VG_(count_living_threads)();
-   vg_assert(c >= 1); /* stay sane */
-   return c == 1;
-}
-void VG_(reap_threads)(ThreadId self)
-{
-   while (!i_am_the_only_thread()) {
-      /* Let other thread(s) run */
-      VG_(vg_yield)();
-      VG_(poll_signals)(self);
-   }
-   vg_assert(i_am_the_only_thread());
-}
-void VG_(init_preopened_fds) ( void )
-{
-   I_die_here;
-}
-
-
-// Run a thread from beginning to end and return the thread's
-// scheduler-return-code.
-static VgSchedReturnCode thread_wrapper(Word /*ThreadId*/ tidW)
-{
-   VgSchedReturnCode ret;
-   ThreadId     tid = (ThreadId)tidW;
-   ThreadState* tst = VG_(get_ThreadState)(tid);
-
-   VG_(debugLog)(1, "syswrap-aix32",
-                    "thread_wrapper(tid=%lld): entry\n",
-                    (ULong)tidW);
-
-   vg_assert(tst->status == VgTs_Init);
-
-   /* make sure we get the CPU lock before doing anything significant */
-   VG_(acquire_BigLock)(tid, "thread_wrapper(starting new thread)");
-
-   if (0)
-      VG_(printf)("thread tid %d started: stack = %p\n",
-                  tid, &tid);
-
-   VG_TRACK( pre_thread_first_insn, tid );
-
-   tst->os_state.lwpid = VG_(gettid)();
-   tst->os_state.threadgroup = VG_(getpid)();
-
-   /* Thread created with all signals blocked; scheduler will set the
-      appropriate mask */
-   ret = VG_(scheduler)(tid);
-
-   vg_assert(VG_(is_exiting)(tid));
-
-   vg_assert(tst->status == VgTs_Runnable);
-   vg_assert(VG_(is_running_thread)(tid));
-
-   VG_(debugLog)(1, "syswrap-aix32",
-                    "thread_wrapper(tid=%lld): exit\n",
-                    (ULong)tidW);
-
-   /* Return to caller, still holding the lock. */
-   return ret;
-}
-
-
-/* Run a thread all the way to the end, then do appropriate exit actions
-   (this is the last-one-out-turn-off-the-lights bit).  */
-static void run_a_thread_NORETURN ( Word tidW )
-{
-   ThreadId          tid = (ThreadId)tidW;
-   VgSchedReturnCode src;
-   Int               c;
-
-   VG_(debugLog)(1, "syswrap-aix32",
-                    "run_a_thread_NORETURN(tid=%lld): pre-thread_wrapper\n",
-                    (ULong)tidW);
-
-   /* Run the thread all the way through. */
-   src = thread_wrapper(tid);
-
-   VG_(debugLog)(1, "syswrap-aix32",
-                    "run_a_thread_NORETURN(tid=%lld): post-thread_wrapper\n",
-                    (ULong)tidW);
-
-   c = VG_(count_living_threads)();
-   vg_assert(c >= 1); /* stay sane */
-
-   vg_assert(src == VgSrc_ExitThread 
-             || src == VgSrc_ExitProcess
-             || src == VgSrc_FatalSig);
-
-   if (c == 1 || src == VgSrc_ExitProcess) {
-
-      VG_(debugLog)(1, "syswrap-aix32",
-                       "run_a_thread_NORETURN(tid=%lld): "
-                          "exit process (%d threads remaining)\n",
-                          (ULong)tidW, c);
-
-      /* We are the last one standing.  Keep hold of the lock and
-         carry on to show final tool results, then exit the entire system.
-         Use the continuation pointer set at startup in m_main. */
-      ( * VG_(address_of_m_main_shutdown_actions_NORETURN) ) (tid, src);
-
-   } else {
-
-      ThreadState *tst;
-
-      VG_(debugLog)(1, "syswrap-aix32",
-                       "run_a_thread_NORETURN(tid=%lld): "
-                          "not last one standing\n",
-                          (ULong)tidW);
-
-      /* OK, thread is dead, but others still exist.  Just exit. */
-      vg_assert(c >= 2);
-      tst = VG_(get_ThreadState)(tid);
-
-      /* This releases the run lock */
-      VG_(exit_thread)(tid);
-      vg_assert(tst->status == VgTs_Zombie);
-
-      /* We have to use this sequence to terminate the thread to
-         prevent a subtle race.  If VG_(exit_thread)() had left the
-         ThreadState as Empty, then it could have been reallocated,
-         reusing the stack while we're doing these last cleanups.
-         Instead, VG_(exit_thread) leaves it as Zombie to prevent
-         reallocation.  We need to make sure we don't touch the stack
-         between marking it Empty and exiting.  Hence the
-         assembler. */
-      { UInt block[4];
-        vg_assert(sizeof(tst->status == 4));
-        vg_assert(__NR_AIX5_thread_terminate
-                  != __NR_AIX5_UNKNOWN);
-        block[0] = (UInt)VgTs_Empty;
-        block[1] = (UInt) & (tst->status);
-        block[2] = (UInt) tst->os_state.exitcode;
-        block[3] = __NR_AIX5_thread_terminate;
-        asm volatile (
-          "mr 29,%0\n\t"           /* r29 = &block[0] */
-          "lwz 20, 0(29)\n\t"      /* r20 = VgTs_Empty */
-          "lwz 21, 4(29)\n\t"      /* r21 = & (tst->status) */
-          "lwz 22, 8(29)\n\t"      /* r22 = tst->os_state.exitcode */
-          "lwz 23, 12(29)\n\t"     /* r23 = __NR_exit */
-          /* after this point we can't safely use the stack. */
-          "stw 20, 0(21)\n\t"      /* tst->status = VgTs_Empty */
-          "mr 2,23\n\t"            /* r2 = __NR_exit */
-          "mr 3,22\n\t"            /* set r3 = tst->os_state.exitcode */
-          /* set up for syscall */
-          "crorc 6,6,6\n\t"
-          ".long 0x48000005\n\t"   /* "bl here+4" */
-          "mflr 29\n\t"
-          "addi 29,29,16\n\t"
-          "mtlr 29\n\t"
-          "sc\n\t"                 /* exit(tst->os_state.exitcode) */
-          :
-          : "b" (&block[0])
-          : "lr", "memory", "r2", "r3", "r20", "r21", "r22", "r23", "r29"
-        );
-      }
-
-      VG_(core_panic)("Thread exit failed?\n");
-   }
-
-   /*NOTREACHED*/
-   vg_assert(0);
-}
-
-
-static Word start_thread_NORETURN ( void* arg )
-{
-   ThreadState* tst = (ThreadState*)arg;
-   ThreadId     tid = tst->tid;
-
-   run_a_thread_NORETURN ( (Word)tid );
-   /*NOTREACHED*/
-   vg_assert(0);
-}
-
-
-/* Call f(arg1), but first switch stacks, using 'stack' as the new
-   stack.  f itself needs to never return. */
-__attribute__((noreturn))
-static 
-void call_on_new_stack_0_1_NORETURN ( Addr stack,
-                                      void (*f_NORETURN)(Word),
-                                      Word arg1 )
-{
-   UWord* fdescr = (UWord*)f_NORETURN;
-   volatile UWord block[5];
-   block[0] = fdescr[0];  /* nia */
-   block[1] = stack;      /* r1 */
-   block[2] = fdescr[1];  /* r2 */
-   block[3] = arg1;       /* r3 */
-   block[4] = fdescr[2];  /* r11 */
-   __asm__ __volatile__(
-      "mr  4,%0\n\t" /* r4 = block */
-      "lwz 1,4(4)\n\t"
-      "lwz 2,8(4)\n\t"
-      "lwz 3,12(4)\n\t"
-      "lwz 11,16(4)\n\t"
-      "lwz 4,0(4)\n\t"
-      "mtctr 4\n\t"
-      "bctr\n"
-      : /*out*/ : /*in*/ "b"(&block[0]) 
-   );
-   /*NOTREACHED*/
-   __asm__ __volatile__("trap");
-   while (1) {} /* convince gcc that this really doesn't return */
-}
-
-
-/* Allocate a stack for the main thread, and run it all the way to the
-   end.  Although we already have a working VgStack
-   (VG_(interim_stack)) it's better to allocate a new one, so that
-   overflow detection works uniformly for all threads.
-*/
-void VG_(main_thread_wrapper_NORETURN)(ThreadId tid)
-{
-   Addr sp;
-   VG_(debugLog)(1, "syswrap-aix32",
-                    "entering VG_(main_thread_wrapper_NORETURN)\n");
-
-   sp = ML_(allocstack)(tid);
-
-   /* make a stack frame */
-   sp -= 16;
-   sp &= ~0xF;
-   *(UWord *)sp = 0;
-
-   /* If we can't even allocate the first thread's stack, we're hosed.
-      Give up. */
-   vg_assert2(sp != 0, "Cannot allocate main thread's stack.");
-
-   /* shouldn't be any other threads around yet */
-   vg_assert( VG_(count_living_threads)() == 1 );
-
-   call_on_new_stack_0_1_NORETURN(
-      (Addr)sp,               /* stack */
-      run_a_thread_NORETURN,  /* fn to call */
-      (Word)tid               /* arg to give it */
-   );
-
-   /*NOTREACHED*/
-   vg_assert(0);
-}
-
-/* --------- end HACKS --------- */
-
-
-/* ---------------------------------------------------------------------
-   More thread stuff
-   ------------------------------------------------------------------ */
-
-void VG_(cleanup_thread) ( ThreadArchState* arch )
-{
-}
-
-
-/* ---------------------------------------------------------------------
-   PRE/POST wrappers for ppc32/AIX5-specific syscalls
-   ------------------------------------------------------------------ */
-
-/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#include <sys/thread.h>
-/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-
-
-/* Add prototypes for the wrappers declared here, so that gcc doesn't
-   harass us for not having prototypes.  Really this is a kludge --
-   the right thing to do is to make these wrappers 'static' since they
-   aren't visible outside this file, but that requires even more macro
-   magic. */
-
-#define PRE(name)       DEFN_PRE_TEMPLATE(ppc32_aix5, name)
-#define POST(name)      DEFN_POST_TEMPLATE(ppc32_aix5, name)
-
-DECL_TEMPLATE(ppc32_aix5, sys___loadx);
-DECL_TEMPLATE(ppc32_aix5, sys___unload);
-DECL_TEMPLATE(ppc32_aix5, sys__clock_gettime);
-DECL_TEMPLATE(ppc32_aix5, sys_thread_setmymask_fast);
-DECL_TEMPLATE(ppc32_aix5, sys_thread_setstate);
-DECL_TEMPLATE(ppc32_aix5, sys_FAKE_SIGRETURN);
-
-
-PRE(sys___loadx)
-{
-   *flags |= SfMayBlock;
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_LOAD) {
-      PRINT("__loadx(0x%lx(DL_LOAD),0x%lx,%ld,0x%lx(%s),0x%lx(%s))",
-            ARG1,ARG2,ARG3,
-            ARG4,(HChar*)ARG4,
-            ARG5, (ARG5 ? (HChar*)ARG5 : "nil") );
-      /* It would appear that (ARG2, ARG3) describe a buffer
-         which is written into by the kernel on success. */
-      PRE_MEM_WRITE("__loadx(DL_LOAD)(ARG2,ARG3)", ARG2, ARG3);
-   }
-   else
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_POSTLOADQ) {
-      PRINT("__loadx(0x%lx(DL_POSTLOADQ),0x%lx,%ld,0x%lx)",
-            ARG1,ARG2,ARG3,ARG4);
-    /* It would appear that (ARG2, ARG3) describe a buffer                      
-        which is written into by the kernel on success. */
-     PRE_MEM_WRITE("__loadx(DL_POSTLOADQ)(ARG2,ARG3)", ARG2, ARG3);
-   }
-   else
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_GLOBALSYM) {
-      PRINT("__loadx(0x%lx(DL_GLOBALSYM),0x%lx(%s),0x%lx,0x%lx,0x%lx)",
-            ARG1, ARG2,(Char*)ARG2,
-            ARG3, ARG4, ARG5);
-   }
-   else
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_EXITQ) {
-      PRINT("__loadx(0x%lx(DL_EXITQ),0x%lx,%ld)", ARG1, ARG2, ARG3);
-      PRE_MEM_WRITE("__loadx(DL_EXITQ)(ARG2,ARG3)", ARG2, ARG3);
-   }
-   else
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_EXECQ) {
-      PRINT("__loadx(0x%lx(DL_EXECQ),0x%lx,%ld)", ARG1, ARG2, ARG3);
-      PRE_MEM_WRITE("__loadx(DL_EXECQ)(ARG2,ARG3)", ARG2, ARG3);
-   }
-   else
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_GETSYM) {
-      PRINT("__loadx(0x%lx(DL_GETSYM),0x%lx(%s),%ld,0x%lx)", 
-            ARG1, ARG2,(Char*)ARG2, ARG3, ARG4);
-   }
-   else
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_PREUNLOADQ) {
-      PRINT("__loadx(0x%lx(DL_PREUNLOADQ),0x%lx,%ld,0x%lx)", 
-            ARG1,ARG2,ARG3,ARG4);
-      PRE_MEM_WRITE("__loadx(DL_PREUNLOADQ)(ARG2,ARG3)", ARG2, ARG3);
-   }
-   else
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == 0x0D000000) {
-      PRINT("__loadx(0x%lx(UNDOCUMENTED),0x%lx,0x%lx,0x%lx)", 
-            ARG1,ARG2,ARG3,ARG4);
-      /* This doesn't appear to have any args, from the examples I've
-         seen. */
-   }
-   else {
-      PRINT("__loadx (BOGUS HANDLER) (0x%lx, ..)", ARG1);
-   }
-}
-POST(sys___loadx)
-{
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_PREUNLOADQ
-       && SUCCESS) {
-      POST_MEM_WRITE(ARG2, ARG3);
-   }
-   else
-
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_POSTLOADQ
-       && SUCCESS) {
-      POST_MEM_WRITE(ARG2, ARG3);
-   }
-   else
-
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_EXITQ
-       && SUCCESS) {
-      POST_MEM_WRITE(ARG2, ARG3);
-   }
-   else
-
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_EXECQ
-       && SUCCESS) {
-      POST_MEM_WRITE(ARG2, ARG3);
-   }
-   else
-
-   if ((ARG1 & VKI_DL_FUNCTION_MASK) == VKI_DL_LOAD
-       && SUCCESS) {
-
-      /* See comment in pre-handler */
-      POST_MEM_WRITE(ARG2, ARG3);
-
-      /* A module load succeeded.  Tell m_debuginfo, m_transtab, and
-         the tool. */
-      ML_(aix5_rescan_procmap_after_load_or_unload)();
-   }
-}
-
-PRE(sys___unload)
-{
-   PRINT("__unload (UNDOCUMENTED) ( %#lx )", ARG1);
-}
-POST(sys___unload)
-{
-   /* A module unload succeeded.  Tell m_debuginfo, m_transtab, and the
-      tool. */
-   ML_(aix5_rescan_procmap_after_load_or_unload)();
-}
-
-PRE(sys__clock_gettime)
-{
-   /* Seems like ARG3 points at a destination buffer? */
-   /* _clock_gettime (UNDOCUMENTED) ( 0, 0xA, 0x2FF21808 ) */
-   PRINT("_clock_gettime (UNDOCUMENTED) ( %ld, %#lx, %#lx )", ARG1, ARG2, ARG3 );
-   PRE_REG_READ3(int, "_clock_gettime", int, arg1, int, arg2, void*, arg3);
-   PRE_MEM_WRITE( "_clock_gettime(dst)", ARG3, sizeof(struct timespec) );
-}
-POST(sys__clock_gettime)
-{
-   vg_assert(SUCCESS);
-   POST_MEM_WRITE( ARG3, sizeof(struct timespec) );
-}
-
-PRE(sys_thread_setmymask_fast)
-{
-   /* args: a 64-bit signal mask in ARG1/2.*/
-   /* On the assumption that this simply sets the thread's signal
-      mask, we act like sigprocmask(SIG_SETMASK, set, NULL) and don't
-      hand this to the kernel.  Layout verified 30 July 06. */
-   vki_sigset_t set;
-   PRINT("thread_setmymask_fast (BOGUS HANDLER)( %08lx %08lx )", ARG1,ARG2 );
-   vg_assert(sizeof(vki_sigset_t) == 8);
-   set.sig[0] = ARG1; /* sigs 1-32 */
-   set.sig[1] = ARG2; /* sigs 32-64 */
-   SET_STATUS_from_SysRes(
-      VG_(do_sys_sigprocmask) ( tid, VKI_SIG_SETMASK, &set, NULL )
-   );
-}
-
-PRE(sys_thread_setstate)
-{
-   UWord          dst_lwpid = (UWord)ARG1;
-   struct tstate* ats_new   = (struct tstate*)ARG2;
-   struct tstate* ats_old   = (struct tstate*)ARG3;
-   ThreadId       dst_tid   = VG_INVALID_THREADID;
-   ThreadState*   dst_ts    = NULL;
-   Int i;
-
-   /* Arrgh.  We MUST retain the lock during this syscall.  Reason is
-      that this is sometimes used for asynchronous thread cancellation
-      (nuking other threads).  If we don't have the lock during the
-      syscall, then it's possible that the thread we're nuking might
-      get the lock before it gets killed off, and so we can never
-      re-acquire the lock after this syscall, and the system
-      deadlocks. */
-
-   /* 10 July 06: above comment is a misdiagnosis.  It appears that
-      for thread cancellation (that is, with ->flags == TSTATE_INTR)
-      the target thread is has its PC changed by the the kernel to
-      something else, possibly to pthread_exit(), so that it can run
-      its cancellation handlers and exit.  Currently is unknown how
-      the kernel knows what to set the target thread's PC to.  I did
-      establish that all the other data passed in the struct is not
-      relevant: when ->flags == TSTATE_INTR, all the other words can
-      be set to 0x0 or 0xFFFFFFFF and the syscall still works.  So the
-      address is not passed like that.  Also I looked at args to
-      thread_setmystate_fast, which is used when a thread sets its
-      cancellation state, but none of those are code addresses.
-
-      Also, it's ok for the kernel to simply change the target
-      thread's PC to something else for async thread cancellation, but
-      for deferred cancellation something else is needed, and I can't
-      see how that would work either.
-
-      Anyway, net result is, target thread ends up not running on the
-      simulator (not dead), which is why it's necessary to hold onto
-      the lock at this point. */
-
-   /* 30 July 06: added kludge to intercept attempts to cancel another
-      thread and instead just force that thread to run
-      pthread_exit(PTHREAD_CANCELED).  This allows V to keep
-      control. */
-
-   PRINT("thread_setstate (BOGUS HANDLER) "
-         "( %ld, %p,%p )", dst_lwpid, ats_new, ats_old);
-   if (1 && VG_(clo_trace_syscalls) && ats_new)
-      ML_(aix5debugstuff_show_tstate)((Addr)ats_new, 
-                                      "thread_setstate (NEW)");
-
-   /* Intercept and handle ourselves any attempts to cancel 
-      another thread (including this one). */
-
-   if (ats_new && (!ats_old) && ats_new->flags == TSTATE_INTR) {
-      dst_ts = NULL;
-      if (VG_(clo_trace_syscalls))
-         VG_(printf)("(INTR for lwpid %ld)", dst_lwpid);
-      dst_tid = VG_INVALID_THREADID;
-      for (i = 0; i < VG_N_THREADS; i++) {
-         dst_ts = VG_(get_ThreadState)(i);
-         if ((dst_ts->status == VgTs_Runnable 
-              || dst_ts->status == VgTs_Yielding
-              || dst_ts->status == VgTs_WaitSys)
-             && dst_ts->os_state.lwpid == dst_lwpid) {
-            dst_tid = i;
-            break;
-         }
-      }
-      if (VG_(clo_trace_syscalls)) {
-         if (dst_tid == VG_INVALID_THREADID)
-            VG_(printf)("(== unknown tid)");
-         else 
-            VG_(printf)("(== tid %d)", (Int)dst_tid);
-      }
-      if (dst_tid != VG_INVALID_THREADID) {
-         /* A cancel has been requested for ctid.  If the target
-            thread has cancellation enabled, honour it right now.  If
-            not, mark the thread as having a cancellation request, so
-            that if it later enables cancellation then the
-            cancellation will take effect. */
-         vg_assert(dst_ts);
-         if (dst_ts->os_state.cancel_progress == Canc_NoRequest) {
-            if (dst_ts->os_state.cancel_disabled) {
-               if (VG_(clo_trace_syscalls))
-                  VG_(printf)("(target has cancel disabled"
-                              "; request lodged)");
-               dst_ts->os_state.cancel_progress = Canc_Requested;
-            } else {
-               if (VG_(clo_trace_syscalls))
-                  VG_(printf)("(forcing target into pthread_exit)");
-               dst_ts->os_state.cancel_progress = Canc_Actioned;
-               Bool ok = ML_(aix5_force_thread_into_pthread_exit)(dst_tid);
-               if (!ok) {
-                  /* now at serious risk of deadlock/livelock.  Give up
-                     rather than continue. */
-                  ML_(aix5_set_threadstate_for_emergency_exit)
-                     (tid, "pthread_cancel(case2-32): "
-                           "cannot find pthread_exit; aborting");
-                  SET_STATUS_Success(0);
-                  return;
-               }
-            }
-         }
-         SET_STATUS_Success(0);
-         return;
-      }
-   }
-
-   /* Well, it's not a cancellation request.  Maybe it is the
-      initialisation of a previously created thread? */
-
-   if (ats_new && !ats_old) {
-      dst_tid = VG_INVALID_THREADID;
-      for (i = 0; i < VG_N_THREADS; i++) {
-         dst_ts = VG_(get_ThreadState)(i);
-         if (dst_ts->status == VgTs_Init 
-             && dst_ts->os_state.lwpid == dst_lwpid) {
-            dst_tid = i;
-            break;
-         }
-      }
-      if (dst_tid != VG_INVALID_THREADID) {
-         /* Found the associated child */
-         if (VG_(clo_trace_syscalls)) 
-            VG_(printf)("(initialised child tid %d)", (Int)dst_tid);
-         dst_ts = VG_(get_ThreadState)(dst_tid);
-         UWord* stack = (UWord*)ML_(allocstack)(dst_tid);
-         /* XXX TODO: check allocstack failure */
-
-         /* copy the specified child register state into the guest
-            slot (we need that context to run on the simulated CPU,
-            not the real one) and put pointers to our own
-            run-the-simulator function into what we'll hand off to the
-            kernel instead. */
-
-         /* The guest thread is to start running whatever context
-            this syscall showed up with. */
-         dst_ts->arch.vex.guest_GPR0  = ats_new->mst.gpr[0];
-         dst_ts->arch.vex.guest_GPR1  = ats_new->mst.gpr[1]; /* sp */
-         dst_ts->arch.vex.guest_GPR2  = ats_new->mst.gpr[2]; /* toc */
-         dst_ts->arch.vex.guest_GPR3  = ats_new->mst.gpr[3]; /* initarg */
-         dst_ts->arch.vex.guest_GPR4  = ats_new->mst.gpr[4];
-         dst_ts->arch.vex.guest_GPR5  = ats_new->mst.gpr[5];
-         dst_ts->arch.vex.guest_GPR6  = ats_new->mst.gpr[6];
-         dst_ts->arch.vex.guest_GPR7  = ats_new->mst.gpr[7];
-         dst_ts->arch.vex.guest_GPR8  = ats_new->mst.gpr[8];
-         dst_ts->arch.vex.guest_GPR9  = ats_new->mst.gpr[9];
-         dst_ts->arch.vex.guest_GPR10 = ats_new->mst.gpr[10];
-         dst_ts->arch.vex.guest_GPR11 = ats_new->mst.gpr[11]; /* ?? */
-         dst_ts->arch.vex.guest_GPR12 = ats_new->mst.gpr[12];
-         dst_ts->arch.vex.guest_GPR13 = ats_new->mst.gpr[13];
-         dst_ts->arch.vex.guest_GPR14 = ats_new->mst.gpr[14];
-         dst_ts->arch.vex.guest_GPR15 = ats_new->mst.gpr[15];
-         dst_ts->arch.vex.guest_GPR16 = ats_new->mst.gpr[16];
-         dst_ts->arch.vex.guest_GPR17 = ats_new->mst.gpr[17];
-         dst_ts->arch.vex.guest_GPR18 = ats_new->mst.gpr[18];
-         dst_ts->arch.vex.guest_GPR19 = ats_new->mst.gpr[19];
-         dst_ts->arch.vex.guest_GPR20 = ats_new->mst.gpr[20];
-         dst_ts->arch.vex.guest_GPR21 = ats_new->mst.gpr[21];
-         dst_ts->arch.vex.guest_GPR22 = ats_new->mst.gpr[22];
-         dst_ts->arch.vex.guest_GPR23 = ats_new->mst.gpr[23];
-         dst_ts->arch.vex.guest_GPR24 = ats_new->mst.gpr[24];
-         dst_ts->arch.vex.guest_GPR25 = ats_new->mst.gpr[25];
-         dst_ts->arch.vex.guest_GPR26 = ats_new->mst.gpr[26];
-         dst_ts->arch.vex.guest_GPR27 = ats_new->mst.gpr[27];
-         dst_ts->arch.vex.guest_GPR28 = ats_new->mst.gpr[28];
-         dst_ts->arch.vex.guest_GPR29 = ats_new->mst.gpr[29];
-         dst_ts->arch.vex.guest_GPR30 = ats_new->mst.gpr[30];
-         dst_ts->arch.vex.guest_GPR31 = ats_new->mst.gpr[31];
-         dst_ts->arch.vex.guest_CIA   = ats_new->mst.iar; /* pc */
-         dst_ts->arch.vex.guest_LR    = ats_new->mst.lr;
-         dst_ts->arch.vex.guest_CTR   = ats_new->mst.ctr;
-         LibVEX_GuestPPC32_put_CR( ats_new->mst.cr, &dst_ts->arch.vex );
-         LibVEX_GuestPPC32_put_XER( ats_new->mst.xer, &dst_ts->arch.vex );
-
-         /* Record what seems like the highest legitimate stack
-            address for this thread, so that the stack unwinder works
-            properly.  It seems reasonable to use the R1 value
-            supplied here. */
-         dst_ts->client_stack_highest_word = dst_ts->arch.vex.guest_GPR1;
-
-         /* The host thread is to start running
-            start_thread_NORETURN */
-         UWord* wrapper_fdescr = (UWord*) & start_thread_NORETURN;
-         ats_new->mst.gpr[1] = (UWord)stack;
-         ats_new->mst.gpr[2] = wrapper_fdescr[1];
-         ats_new->mst.iar    = wrapper_fdescr[0];
-         ats_new->mst.gpr[3] = (UWord)dst_ts;
-
-         /* Set initial cancellation status for the thread. */
-         dst_ts->os_state.cancel_async    = False;
-         dst_ts->os_state.cancel_disabled = False;
-         dst_ts->os_state.cancel_progress = Canc_NoRequest;
-      }
-   }
-}
-POST(sys_thread_setstate)
-{
-   if (ARG3)
-      POST_MEM_WRITE( ARG3, sizeof(struct tstate) );
-   if (0 && VG_(clo_trace_syscalls) && ARG3)
-      ML_(aix5debugstuff_show_tstate)(ARG3, "thread_setstate (OLD)");
-}
-
-PRE(sys_FAKE_SIGRETURN)
-{
-   /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for
-      an explanation of what follows. */
-   /* This handles the fake signal-return system call created by
-      sigframe-ppc32-aix5.c. */
-
-   PRINT("FAKE_SIGRETURN ( )");
-
-   vg_assert(VG_(is_valid_tid)(tid));
-   vg_assert(tid >= 1 && tid < VG_N_THREADS);
-   vg_assert(VG_(is_running_thread)(tid));
-
-   /* Remove the signal frame from this thread's (guest) stack,
-      in the process restoring the pre-signal guest state. */
-   VG_(sigframe_destroy)(tid, True);
-
-   /* Tell the driver not to update the guest state with the "result",
-      and set a bogus result to keep it happy. */
-   *flags |= SfNoWriteResult;
-   SET_STATUS_Success(0);
-
-   /* Check to see if any signals arose as a result of this. */
-   *flags |= SfPollAfter;
-}
-
-
-/* ---------------------------------------------------------------------
-   The ppc32/AIX5 syscall table
-   ------------------------------------------------------------------ */
-
-typedef
-   struct {
-      UInt* pSysNo;
-      SyscallTableEntry wrappers;
-   }
-   AIX5SCTabEntry;
-
-#undef PLAXY
-#undef PLAX_
-
-#define PLAXY(sysno, name)                     \
-   { & sysno,                                  \
-     { & WRAPPER_PRE_NAME(ppc32_aix5, name),   \
-       & WRAPPER_POST_NAME(ppc32_aix5, name) }} 
-
-#define PLAX_(sysno, name)                     \
-   { & sysno,                                  \
-     { & WRAPPER_PRE_NAME(ppc32_aix5, name),   \
-       NULL }} 
-
-static /* but not const */
-AIX5SCTabEntry aix5_ppc32_syscall_table[]
-= {
-    AIXXY(__NR_AIX5___libc_sbrk,        sys___libc_sbrk),
-    PLAXY(__NR_AIX5___loadx,            sys___loadx),
-    AIXX_(__NR_AIX5___msleep,           sys___msleep),
-    PLAXY(__NR_AIX5___unload,           sys___unload),
-    PLAXY(__NR_AIX5__clock_gettime,     sys__clock_gettime),
-    AIXX_(__NR_AIX5__clock_settime,     sys__clock_settime),
-    AIXX_(__NR_AIX5__exit,              sys__exit),
-    AIXX_(__NR_AIX5__fp_fpscrx_sc,      sys__fp_fpscrx_sc),
-    AIXX_(__NR_AIX5__getpgrp,           sys__getpgrp),
-    AIXX_(__NR_AIX5__getpid,            sys__getpid),
-    AIXX_(__NR_AIX5__getppid,           sys__getppid),
-    AIXX_(__NR_AIX5__getpriority,       sys__getpriority),
-    AIXXY(__NR_AIX5__nsleep,            sys__nsleep),
-    AIXX_(__NR_AIX5__pause,             sys__pause),
-    AIXXY(__NR_AIX5__poll,              sys__poll),
-    AIXX_(__NR_AIX5__select,            sys__select),
-    AIXX_(__NR_AIX5__sem_wait,          sys__sem_wait),
-    AIXX_(__NR_AIX5__setpgid,           sys__setpgid),
-    AIXX_(__NR_AIX5__setsid,            sys__setsid),
-    AIXXY(__NR_AIX5__sigaction,         sys__sigaction),
-    AIXX_(__NR_AIX5__thread_self,       sys__thread_self),
-    AIXX_(__NR_AIX5__thread_setsched,   sys__thread_setsched),
-    AIXX_(__NR_AIX5_access,             sys_access),
-    AIXX_(__NR_AIX5_accessx,            sys_accessx),
-    AIXXY(__NR_AIX5_appgetrlimit,       sys_appgetrlimit),
-    AIXXY(__NR_AIX5_appgetrusage,       sys_appgetrusage),
-    AIXX_(__NR_AIX5_apprestimer,        sys_apprestimer),
-    AIXX_(__NR_AIX5_appsetrlimit,       sys_appsetrlimit),
-    AIXX_(__NR_AIX5_appulimit,          sys_appulimit),
-    AIXX_(__NR_AIX5_bind,               sys_bind),
-    AIXX_(__NR_AIX5_chdir,              sys_chdir),
-    AIXX_(__NR_AIX5_chmod,              sys_chmod),
-    AIXX_(__NR_AIX5_chown,              sys_chown),
-    AIXX_(__NR_AIX5_close,              sys_close),
-    AIXX_(__NR_AIX5_connext,            sys_connext),
-    AIXX_(__NR_AIX5_execve,             sys_execve),
-    AIXXY(__NR_AIX5_finfo,              sys_finfo),
-    AIXXY(__NR_AIX5_fstatfs,            sys_fstatfs),
-    AIXXY(__NR_AIX5_fstatx,             sys_fstatx),
-    AIXX_(__NR_AIX5_fsync,              sys_fsync),
-    AIXXY(__NR_AIX5_getdirent,          sys_getdirent),
-    AIXXY(__NR_AIX5_getdirent64,        sys_getdirent64),
-    AIXXY(__NR_AIX5_getdomainname,      sys_getdomainname),
-    AIXX_(__NR_AIX5_getgidx,            sys_getgidx),
-    AIXXY(__NR_AIX5_getgroups,          sys_getgroups),
-    AIXXY(__NR_AIX5_gethostname,        sys_gethostname),
-    AIXXY(__NR_AIX5_getpriv,            sys_getpriv),
-    AIXXY(__NR_AIX5_getprocs,           sys_getprocs),
-    AIXXY(__NR_AIX5_getprocs64,         sys_getprocs), /* XXX: correct? */
-    AIXX_(__NR_AIX5_getrpid,            sys_getrpid),
-    AIXXY(__NR_AIX5_getsockopt,         sys_getsockopt),
-    AIXX_(__NR_AIX5_gettimerid,         sys_gettimerid),
-    AIXX_(__NR_AIX5_getuidx,            sys_getuidx),
-    AIXXY(__NR_AIX5_incinterval,        sys_incinterval),
-    AIXXY(__NR_AIX5_kfcntl,             sys_kfcntl),
-    AIXX_(__NR_AIX5_kfork,              sys_kfork),
-    AIXX_(__NR_AIX5_kftruncate,         sys_kftruncate),
-    AIXX_(__NR_AIX5_kgetsidx,           sys_kgetsidx),
-    AIXX_(__NR_AIX5_kill,               sys_kill),
-    AIXXY(__NR_AIX5_kioctl,             sys_kioctl),
-    AIXX_(__NR_AIX5_klseek,             sys_klseek),
-    AIXX_(__NR_AIX5_knlist,             sys_knlist),
-    AIXXY(__NR_AIX5_kpread,             sys_kpread),
-    AIXXY(__NR_AIX5_kread,              sys_kread),
-    AIXXY(__NR_AIX5_kreadv,             sys_kreadv),
-    AIXX_(__NR_AIX5_kthread_ctl,        sys_kthread_ctl),
-    AIXX_(__NR_AIX5_ktruncate,          sys_ktruncate),
-    AIXXY(__NR_AIX5_kwaitpid,           sys_kwaitpid),
-    AIXX_(__NR_AIX5_kwrite,             sys_kwrite),
-    AIXX_(__NR_AIX5_kwritev,            sys_kwritev),
-    AIXX_(__NR_AIX5_listen,             sys_listen),
-    AIXX_(__NR_AIX5_loadbind,           sys_loadbind),
-    AIXXY(__NR_AIX5_loadquery,          sys_loadquery),
-    AIXX_(__NR_AIX5_lseek,              sys_lseek),
-    AIXX_(__NR_AIX5_mkdir,              sys_mkdir),
-    AIXXY(__NR_AIX5_mmap,               sys_mmap),
-    AIXXY(__NR_AIX5_mntctl,             sys_mntctl),
-    AIXXY(__NR_AIX5_mprotect,           sys_mprotect),
-    AIXXY(__NR_AIX5_munmap,             sys_munmap),
-    AIXXY(__NR_AIX5_naccept,            sys_naccept),
-    AIXXY(__NR_AIX5_ngetpeername,       sys_ngetpeername),
-    AIXXY(__NR_AIX5_ngetsockname,       sys_ngetsockname),
-    AIXXY(__NR_AIX5_nrecvfrom,          sys_nrecvfrom),
-    AIXX_(__NR_AIX5_nrecvmsg,           sys_nrecvmsg),
-    AIXX_(__NR_AIX5_nsendmsg,           sys_nsendmsg),
-    AIXX_(__NR_AIX5_open,               sys_open),
-    AIXXY(__NR_AIX5_pipe,               sys_pipe),
-    AIXX_(__NR_AIX5_privcheck,          sys_privcheck),
-    AIXXY(__NR_AIX5_readlink,           sys_readlink),
-    AIXXY(__NR_AIX5_recv,               sys_recv),
-    AIXX_(__NR_AIX5_rename,             sys_rename),
-    AIXXY(__NR_AIX5_sbrk,               sys_sbrk),
-    AIXX_(__NR_AIX5_sched_get_priority_max, sys_sched_get_priority_max),
-    AIXX_(__NR_AIX5_sem_destroy,        sys_sem_destroy),
-    AIXXY(__NR_AIX5_sem_init,           sys_sem_init),
-    AIXXY(__NR_AIX5_sem_post,           sys_sem_post),
-    AIXX_(__NR_AIX5_send,               sys_send),
-    AIXX_(__NR_AIX5_setgid,             sys_setgid),
-    AIXX_(__NR_AIX5_setsockopt,         sys_setsockopt),
-    AIXX_(__NR_AIX5_setuid,             sys_setuid),
-    AIXXY(__NR_AIX5_shmat,              sys_shmat),
-    AIXXY(__NR_AIX5_shmctl,             sys_shmctl),
-    AIXXY(__NR_AIX5_shmdt,              sys_shmdt),
-    AIXX_(__NR_AIX5_shmget,             sys_shmget),
-    AIXX_(__NR_AIX5_shutdown,           sys_shutdown),
-    AIXX_(__NR_AIX5_sigcleanup,         sys_sigcleanup),
-    AIXXY(__NR_AIX5_sigprocmask,        sys_sigprocmask),
-    AIXX_(__NR_AIX5_socket,             sys_socket),
-    AIXXY(__NR_AIX5_statx,              sys_statx),
-    AIXXY(__NR_AIX5_statfs,             sys_statfs),
-    AIXX_(__NR_AIX5_symlink,            sys_symlink),
-    AIXXY(__NR_AIX5_sys_parm,           sys_sys_parm),
-    AIXXY(__NR_AIX5_sysconfig,          sys_sysconfig),
-    AIXXY(__NR_AIX5_thread_create,      sys_thread_create),
-    AIXX_(__NR_AIX5_thread_init,        sys_thread_init),
-    AIXX_(__NR_AIX5_thread_kill,        sys_thread_kill),
-    PLAX_(__NR_AIX5_thread_setmymask_fast, sys_thread_setmymask_fast),
-    AIXXY(__NR_AIX5_thread_setmystate,  sys_thread_setmystate),
-    AIXX_(__NR_AIX5_thread_setmystate_fast, sys_thread_setmystate_fast),
-    PLAXY(__NR_AIX5_thread_setstate,    sys_thread_setstate),
-    AIXX_(__NR_AIX5_thread_terminate_unlock, sys_thread_terminate_unlock),
-    AIXX_(__NR_AIX5_thread_tsleep,      sys_thread_tsleep),
-    AIXX_(__NR_AIX5_thread_tsleep_event, sys_thread_tsleep_event),
-    AIXX_(__NR_AIX5_thread_twakeup,     sys_thread_twakeup),
-    AIXX_(__NR_AIX5_thread_twakeup_event, sys_thread_twakeup_event),
-    AIXX_(__NR_AIX5_thread_unlock,      sys_thread_unlock),
-    AIXX_(__NR_AIX5_thread_waitlock,    sys_thread_waitlock),
-    AIXX_(__NR_AIX5_thread_waitlock_,   sys_thread_waitlock_),
-    AIXXY(__NR_AIX5_times,              sys_times),
-    AIXX_(__NR_AIX5_umask,              sys_umask),
-    AIXXY(__NR_AIX5_uname,              sys_uname),
-    AIXX_(__NR_AIX5_unlink,             sys_unlink),
-    AIXX_(__NR_AIX5_utimes,             sys_utimes),
-    AIXXY(__NR_AIX5_vmgetinfo,          sys_vmgetinfo),
-    AIXX_(__NR_AIX5_yield,              sys_yield),
-    PLAX_(__NR_AIX5_FAKE_SIGRETURN,     sys_FAKE_SIGRETURN)
-  };
-
-SyscallTableEntry* ML_(get_ppc32_aix5_syscall_entry) ( UInt sysno )
-{
-   Int            i;
-   AIX5SCTabEntry tmp;
-
-   const Int tab_size = sizeof(aix5_ppc32_syscall_table) 
-                        / sizeof(aix5_ppc32_syscall_table[0]);
-
-   for (i = 0; i < tab_size; i++)
-      if (sysno == *(aix5_ppc32_syscall_table[i].pSysNo))
-         break;
-
-   vg_assert(i >= 0 && i <= tab_size);
-   if (i == tab_size)
-      return NULL; /* can't find a wrapper */
-
-   /* Move found one a bit closer to the front, so as to
-      make future searches cheaper. */
-   if (i > 0) {
-      tmp = aix5_ppc32_syscall_table[i-1];
-      aix5_ppc32_syscall_table[i-1] = aix5_ppc32_syscall_table[i];
-      aix5_ppc32_syscall_table[i] = tmp;
-      i--;
-   }
-
-   vg_assert(i >= 0 && i < tab_size);
-   return &aix5_ppc32_syscall_table[i].wrappers;
-}
-
-#endif // defined(VGP_ppc32_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_syswrap/syswrap-ppc64-aix5.c b/coregrind/m_syswrap/syswrap-ppc64-aix5.c
deleted file mode 100644
index 494576b..0000000
--- a/coregrind/m_syswrap/syswrap-ppc64-aix5.c
+++ /dev/null
@@ -1,797 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Platform-specific syscalls stuff.       syswrap-ppc64-aix5.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#if defined(VGP_ppc64_aix5)
-
-#include "pub_core_basics.h"
-#include "pub_core_vki.h"
-#include "pub_core_vkiscnums.h"
-#include "pub_core_threadstate.h"
-#include "pub_core_debuglog.h"
-#include "pub_core_libcassert.h"
-#include "pub_core_libcprint.h"
-#include "pub_core_libcproc.h"
-#include "pub_core_options.h"
-#include "pub_core_scheduler.h"
-#include "pub_core_sigframe.h"      // For VG_(sigframe_destroy)()
-#include "pub_core_signals.h"
-#include "pub_core_syscall.h"
-#include "pub_core_syswrap.h"
-#include "pub_core_tooliface.h"
-
-#include "priv_types_n_macros.h"
-#include "priv_syswrap-aix5.h"      /* for decls of aix5-common wrappers */
-#include "priv_syswrap-main.h"
-
-
-/* --------- HACKS --------- */
-/* XXXXXXXXXXXX these HACKS are copies of stuff in syswrap-linux.c;
-   check for duplication. */
-/* HACK: is in syswrap-generic.c, but that doesn't get build on AIX. */
-/* Dump out a summary, and a more detailed list, of open file descriptors. */
-void VG_(show_open_fds) ( void )
-{
-  I_die_here;
-}
-static Bool i_am_the_only_thread ( void )
-{
-   Int c = VG_(count_living_threads)();
-   vg_assert(c >= 1); /* stay sane */
-   return c == 1;
-}
-void VG_(reap_threads)(ThreadId self)
-{
-   while (!i_am_the_only_thread()) {
-      /* Let other thread(s) run */
-      VG_(vg_yield)();
-      VG_(poll_signals)(self);
-   }
-   vg_assert(i_am_the_only_thread());
-}
-void VG_(init_preopened_fds) ( void )
-{
-   I_die_here;
-}
-
-
-// Run a thread from beginning to end and return the thread's
-// scheduler-return-code.
-static VgSchedReturnCode thread_wrapper(Word /*ThreadId*/ tidW)
-{
-   VgSchedReturnCode ret;
-   ThreadId     tid = (ThreadId)tidW;
-   ThreadState* tst = VG_(get_ThreadState)(tid);
-
-   VG_(debugLog)(1, "syswrap-aix64",
-                    "thread_wrapper(tid=%lld): entry\n",
-                    (ULong)tidW);
-
-   vg_assert(tst->status == VgTs_Init);
-
-   /* make sure we get the CPU lock before doing anything significant */
-   VG_(acquire_BigLock)(tid, "thread_wrapper(starting new thread)");
-
-   if (0)
-      VG_(printf)("thread tid %d started: stack = %p\n",
-                  tid, &tid);
-
-   VG_TRACK( pre_thread_first_insn, tid );
-
-   tst->os_state.lwpid = VG_(gettid)();
-   tst->os_state.threadgroup = VG_(getpid)();
-
-   /* Thread created with all signals blocked; scheduler will set the
-      appropriate mask */
-   ret = VG_(scheduler)(tid);
-
-   vg_assert(VG_(is_exiting)(tid));
-
-   vg_assert(tst->status == VgTs_Runnable);
-   vg_assert(VG_(is_running_thread)(tid));
-
-   VG_(debugLog)(1, "syswrap-aix64",
-                    "thread_wrapper(tid=%lld): exit\n",
-                    (ULong)tidW);
-
-   /* Return to caller, still holding the lock. */
-   return ret;
-}
-
-
-/* Run a thread all the way to the end, then do appropriate exit actions
-   (this is the last-one-out-turn-off-the-lights bit).  */
-static void run_a_thread_NORETURN ( Word tidW )
-{
-   ThreadId          tid = (ThreadId)tidW;
-   VgSchedReturnCode src;
-   Int               c;
-
-   VG_(debugLog)(1, "syswrap-aix64",
-                    "run_a_thread_NORETURN(tid=%lld): pre-thread_wrapper\n",
-                    (ULong)tidW);
-
-   /* Run the thread all the way through. */
-   src = thread_wrapper(tid);
-
-   VG_(debugLog)(1, "syswrap-aix64",
-                    "run_a_thread_NORETURN(tid=%lld): post-thread_wrapper\n",
-                    (ULong)tidW);
-
-   c = VG_(count_living_threads)();
-   vg_assert(c >= 1); /* stay sane */
-
-   vg_assert(src == VgSrc_ExitThread 
-             || src == VgSrc_ExitProcess
-             || src == VgSrc_FatalSig);
-
-   if (c == 1 || src == VgSrc_ExitProcess) {
-
-      VG_(debugLog)(1, "syswrap-aix64",
-                       "run_a_thread_NORETURN(tid=%lld): "
-                          "exit process (%d threads remaining)\n",
-                          (ULong)tidW, c);
-
-      /* We are the last one standing.  Keep hold of the lock and
-         carry on to show final tool results, then exit the entire system.
-         Use the continuation pointer set at startup in m_main. */
-      ( * VG_(address_of_m_main_shutdown_actions_NORETURN) ) (tid, src);
-
-   } else {
-
-      ThreadState *tst;
-
-      VG_(debugLog)(1, "syswrap-aix64",
-                       "run_a_thread_NORETURN(tid=%lld): "
-                          "not last one standing\n",
-                          (ULong)tidW);
-
-      /* OK, thread is dead, but others still exist.  Just exit. */
-      vg_assert(c >= 2);
-      tst = VG_(get_ThreadState)(tid);
-
-      /* This releases the run lock */
-      VG_(exit_thread)(tid);
-      vg_assert(tst->status == VgTs_Zombie);
-
-      /* We have to use this sequence to terminate the thread to
-         prevent a subtle race.  If VG_(exit_thread)() had left the
-         ThreadState as Empty, then it could have been reallocated,
-         reusing the stack while we're doing these last cleanups.
-         Instead, VG_(exit_thread) leaves it as Zombie to prevent
-         reallocation.  We need to make sure we don't touch the stack
-         between marking it Empty and exiting.  Hence the
-         assembler. */
-      { ULong block[4];
-        vg_assert(sizeof(tst->status == 8));
-        vg_assert(__NR_AIX5_thread_terminate
-                  != __NR_AIX5_UNKNOWN);
-        block[0] = (ULong)VgTs_Empty;
-        block[1] = (ULong) & (tst->status);
-        block[2] = (ULong) tst->os_state.exitcode;
-        block[3] = __NR_AIX5_thread_terminate;
-        asm volatile (
-          "mr 29,%0\n\t"           /* r29 = &block[0] */
-          "ld 20, 0(29)\n\t"       /* r20 = VgTs_Empty */
-          "ld 21, 8(29)\n\t"       /* r21 = & (tst->status) */
-          "ld 22, 16(29)\n\t"      /* r22 = tst->os_state.exitcode */
-          "ld 23, 24(29)\n\t"      /* r23 = __NR_exit */
-          /* after this point we can't safely use the stack. */
-          "std 20, 0(21)\n\t"      /* tst->status = VgTs_Empty */
-          "mr 2,23\n\t"            /* r2 = __NR_exit */
-          "mr 3,22\n\t"            /* set r3 = tst->os_state.exitcode */
-          /* set up for syscall */
-          "crorc 6,6,6\n\t"
-          ".long 0x48000005\n\t"   /* "bl here+4" */
-          "mflr 29\n\t"
-          "addi 29,29,16\n\t"
-          "mtlr 29\n\t"
-          "sc\n\t"                 /* exit(tst->os_state.exitcode) */
-          :
-          : "b" (&block[0])
-          : "lr", "memory", "r2", "r3", "r20", "r21", "r22", "r23", "r29"
-        );
-      }
-
-      VG_(core_panic)("Thread exit failed?\n");
-   }
-
-   /*NOTREACHED*/
-   vg_assert(0);
-}
-
-
-static Word start_thread_NORETURN ( void* arg )
-{
-   ThreadState* tst = (ThreadState*)arg;
-   ThreadId     tid = tst->tid;
-
-   run_a_thread_NORETURN ( (Word)tid );
-   /*NOTREACHED*/
-   vg_assert(0);
-}
-
-
-/* Call f(arg1), but first switch stacks, using 'stack' as the new
-   stack.  f itself needs to never return. */
-__attribute__((noreturn))
-static
-void call_on_new_stack_0_1_NORETURN ( Addr stack,
-                                      void (*f_NORETURN)(Word),
-                                      Word arg1 )
-{
-   UWord* fdescr = (UWord*)f_NORETURN;
-   volatile UWord block[5];
-   block[0] = fdescr[0];  /* nia */
-   block[1] = stack;      /* r1 */
-   block[2] = fdescr[1];  /* r2 */
-   block[3] = arg1;       /* r3 */
-   block[4] = fdescr[2];  /* r11 */
-   __asm__ __volatile__(
-      "mr  4,%0\n\t" /* r4 = block */
-      "ld 1, 8(4)\n\t"
-      "ld 2, 16(4)\n\t"
-      "ld 3, 24(4)\n\t"
-      "ld 11,32(4)\n\t"
-      "ld 4, 0(4)\n\t"
-      "mtctr 4\n\t"
-      "bctr\n"
-      : /*out*/ : /*in*/ "b"(&block[0]) 
-   );
-   /*NOTREACHED*/
-   __asm__ __volatile__("trap");
-   while (1) {} /* convince gcc that this really doesn't return */
-}
-
-
-/* Allocate a stack for the main thread, and run it all the way to the
-   end.  Although we already have a working VgStack
-   (VG_(interim_stack)) it's better to allocate a new one, so that
-   overflow detection works uniformly for all threads.
-*/
-void VG_(main_thread_wrapper_NORETURN)(ThreadId tid)
-{
-   Addr sp;
-   VG_(debugLog)(1, "syswrap-aix64",
-                    "entering VG_(main_thread_wrapper_NORETURN)\n");
-
-   sp = ML_(allocstack)(tid);
-
-   /* If we can't even allocate the first thread's stack, we're hosed.
-      Give up. */
-   vg_assert2(sp != 0, "Cannot allocate main thread's stack.");
-
-   /* shouldn't be any other threads around yet */
-   vg_assert( VG_(count_living_threads)() == 1 );
-
-   /* make a stack frame */
-   sp -= 16;
-   sp &= ~0xF;
-   *(UWord *)sp = 0;
-
-   call_on_new_stack_0_1_NORETURN(
-      (Addr)sp,               /* stack */
-      run_a_thread_NORETURN,  /* fn to call */
-      (Word)tid               /* arg to give it */
-   );
-
-   /*NOTREACHED*/
-   vg_assert(0);
-}
-
-/* --------- end HACKS --------- */
-
-
-/* ---------------------------------------------------------------------
-   More thread stuff
-   ------------------------------------------------------------------ */
-
-void VG_(cleanup_thread) ( ThreadArchState* arch )
-{
-}  
-
-
-/* ---------------------------------------------------------------------
-   PRE/POST wrappers for ppc64/AIX5-specific syscalls
-   ------------------------------------------------------------------ */
-
-/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
-#include <sys/thread.h>
-/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */
-
-
-/* Add prototypes for the wrappers declared here, so that gcc doesn't
-   harass us for not having prototypes.  Really this is a kludge --
-   the right thing to do is to make these wrappers 'static' since they
-   aren't visible outside this file, but that requires even more macro
-   magic. */
-
-#define PRE(name)       DEFN_PRE_TEMPLATE(ppc64_aix5, name)
-#define POST(name)      DEFN_POST_TEMPLATE(ppc64_aix5, name)
-
-DECL_TEMPLATE(ppc64_aix5, sys__clock_gettime);
-DECL_TEMPLATE(ppc64_aix5, sys__fp_fpscrx64_);
-DECL_TEMPLATE(ppc64_aix5, sys_kload);
-DECL_TEMPLATE(ppc64_aix5, sys_kunload64);
-DECL_TEMPLATE(ppc64_aix5, sys_thread_setstate);
-DECL_TEMPLATE(ppc64_aix5, sys_FAKE_SIGRETURN);
-
-
-PRE(sys__clock_gettime)
-{
-   /* Seems like ARG2 points at a destination buffer? */
-   /* _clock_gettime (UNDOCUMENTED) ( 0, 0xA, 0x2FF21808 ) */
-   PRINT("_clock_gettime (UNDOCUMENTED) ( %ld, %#lx, %#lx )", ARG1, ARG2, ARG3 );
-   PRE_REG_READ3(int, "_clock_gettime", int, arg1, int, arg2, void*, arg3);
-   PRE_MEM_WRITE( "_clock_gettime(dst)", ARG2, sizeof(struct timespec) );
-}
-POST(sys__clock_gettime)
-{
-   vg_assert(SUCCESS);
-   POST_MEM_WRITE( ARG2, sizeof(struct timespec) );
-}
-
-PRE(sys__fp_fpscrx64_)
-{
-   PRINT("_fp_fpscrx64_ (BOGUS HANDLER)");
-}
-
-PRE(sys_kload)
-{
-   PRINT("kload (UNDOCUMENTED)( %#lx(%s), %ld, %ld )", 
-         ARG1,(Char*)ARG1, ARG2, ARG3 );
-   PRE_REG_READ3(void*, "kload", char*, name, long, arg2, char*, arg3);
-}
-POST(sys_kload)
-{
-   vg_assert(SUCCESS);
-   if (0) VG_(printf)("kload result = %#lx\n", RES);
-   if (RES)
-      POST_MEM_WRITE( RES, 64 );
-   ML_(aix5_rescan_procmap_after_load_or_unload)();
-}
-
-PRE(sys_kunload64)
-{
-   PRINT("kunload64 (UNDOCUMENTED)( %#lx, %ld, %ld, %#lx )", 
-         ARG1, ARG2, ARG3, ARG4 );
-   PRE_REG_READ4(long, "kunload64",
-                 void*, arg1, long, arg2, long, arg3, void*, arg4);
-}
-POST(sys_kunload64)
-{
-   vg_assert(SUCCESS);
-   ML_(aix5_rescan_procmap_after_load_or_unload)();
-}
-
-PRE(sys_thread_setstate)
-{
-   UWord          dst_lwpid = (UWord)ARG1;
-   struct tstate* ats_new   = (struct tstate*)ARG2;
-   struct tstate* ats_old   = (struct tstate*)ARG3;
-   ThreadId       dst_tid   = VG_INVALID_THREADID;
-   ThreadState*   dst_ts    = NULL;
-   Int i;
-
-   /* Arrgh.  We MUST retain the lock during this syscall.  Reason is
-      that this is sometimes used for asynchronous thread cancellation
-      (nuking other threads).  If we don't have the lock during the
-      syscall, then it's possible that the thread we're nuking might
-      get the lock before it gets killed off, and so we can never
-      re-acquire the lock after this syscall, and the system
-      deadlocks. */
-
-   /* 10 July 06: above comment is a misdiagnosis.  It appears that
-      for thread cancellation (that is, with ->flags == TSTATE_INTR)
-      the target thread is has its PC changed by the the kernel to
-      something else, possibly to pthread_exit(), so that it can run
-      its cancellation handlers and exit.  Currently is unknown how
-      the kernel knows what to set the target thread's PC to.  I did
-      establish that all the other data passed in the struct is not
-      relevant: when ->flags == TSTATE_INTR, all the other words can
-      be set to 0x0 or 0xFFFFFFFF and the syscall still works.  So the
-      address is not passed like that.  Also I looked at args to
-      thread_setmystate_fast, which is used when a thread sets its
-      cancellation state, but none of those are code addresses.
-
-      Also, it's ok for the kernel to simply change the target
-      thread's PC to something else for async thread cancellation, but
-      for deferred cancellation something else is needed, and I can't
-      see how that would work either.
-
-      Anyway, net result is, target thread ends up not running on the
-      simulator (not dead), which is why it's necessary to hold onto
-      the lock at this point. */
-
-   /* 30 July 06: added kludge to intercept attempts to cancel another
-      thread and instead just force that thread to run
-      pthread_exit(PTHREAD_CANCELED).  This allows V to keep
-      control. */
-
-   PRINT("thread_setstate (BOGUS HANDLER) "
-         "( %ld, %p,%p )", dst_lwpid, ats_new, ats_old);
-   if (1 && VG_(clo_trace_syscalls) && ats_new)
-      ML_(aix5debugstuff_show_tstate)((Addr)ats_new, 
-                                      "thread_setstate (NEW)");
-
-   /* Intercept and handle ourselves any attempts to cancel 
-      another thread (including this one). */
-
-   if (ats_new && (!ats_old) && ats_new->flags == TSTATE_INTR) {
-      dst_ts = NULL;
-      if (VG_(clo_trace_syscalls))
-         VG_(printf)("(INTR for lwpid %ld)", dst_lwpid);
-      dst_tid = VG_INVALID_THREADID;
-      for (i = 0; i < VG_N_THREADS; i++) {
-         dst_ts = VG_(get_ThreadState)(i);
-         if ((dst_ts->status == VgTs_Runnable 
-              || dst_ts->status == VgTs_Yielding
-              || dst_ts->status == VgTs_WaitSys)
-             && dst_ts->os_state.lwpid == dst_lwpid) {
-            dst_tid = i;
-            break;
-         }
-      }
-      if (VG_(clo_trace_syscalls)) {
-         if (dst_tid == VG_INVALID_THREADID)
-            VG_(printf)("(== unknown tid)");
-         else 
-            VG_(printf)("(== tid %d)", (Int)dst_tid);
-      }
-      if (dst_tid != VG_INVALID_THREADID) {
-         /* A cancel has been requested for ctid.  If the target
-            thread has cancellation enabled, honour it right now.  If
-            not, mark the thread as having a cancellation request, so
-            that if it later enables cancellation then the
-            cancellation will take effect. */
-         vg_assert(dst_ts);
-         if (dst_ts->os_state.cancel_progress == Canc_NoRequest) {
-            if (dst_ts->os_state.cancel_disabled) {
-               if (VG_(clo_trace_syscalls))
-                  VG_(printf)("(target has cancel disabled"
-                              "; request lodged)");
-               dst_ts->os_state.cancel_progress = Canc_Requested;
-            } else {
-               if (VG_(clo_trace_syscalls))
-                  VG_(printf)("(forcing target into pthread_exit)");
-               dst_ts->os_state.cancel_progress = Canc_Actioned;
-               Bool ok = ML_(aix5_force_thread_into_pthread_exit)(dst_tid);
-               if (!ok) {
-                  /* now at serious risk of deadlock/livelock.  Give up
-                     rather than continue. */
-                  ML_(aix5_set_threadstate_for_emergency_exit)
-                     (tid, "pthread_cancel(case2-64): "
-                           "cannot find pthread_exit; aborting");
-                  SET_STATUS_Success(0);
-                  return;
-               }
-            }
-         }
-         SET_STATUS_Success(0);
-         return;
-      }
-   }
-
-   /* Well, it's not a cancellation request.  Maybe it is the
-      initialisation of a previously created thread? */
-
-   if (ats_new && !ats_old) {
-      dst_tid = VG_INVALID_THREADID;
-      for (i = 0; i < VG_N_THREADS; i++) {
-         dst_ts = VG_(get_ThreadState)(i);
-         if (dst_ts->status == VgTs_Init 
-             && dst_ts->os_state.lwpid == dst_lwpid) {
-            dst_tid = i;
-            break;
-         }
-      }
-      if (dst_tid != VG_INVALID_THREADID) {
-         /* Found the associated child */
-         if (VG_(clo_trace_syscalls)) 
-            VG_(printf)("(initialised child tid %d)", (Int)dst_tid);
-         dst_ts = VG_(get_ThreadState)(dst_tid);
-         UWord* stack = (UWord*)ML_(allocstack)(dst_tid);
-         /* XXX TODO: check allocstack failure */
-
-         /* copy the specified child register state into the guest
-            slot (we need that context to run on the simulated CPU,
-            not the real one) and put pointers to our own
-            run-the-simulator function into what we'll hand off to the
-            kernel instead. */
-
-         /* The guest thread is to start running whatever context
-            this syscall showed up with. */
-         dst_ts->arch.vex.guest_GPR0  = ats_new->mst.gpr[0];
-         dst_ts->arch.vex.guest_GPR1  = ats_new->mst.gpr[1]; /* sp */
-         dst_ts->arch.vex.guest_GPR2  = ats_new->mst.gpr[2]; /* toc */
-         dst_ts->arch.vex.guest_GPR3  = ats_new->mst.gpr[3]; /* initarg */
-         dst_ts->arch.vex.guest_GPR4  = ats_new->mst.gpr[4];
-         dst_ts->arch.vex.guest_GPR5  = ats_new->mst.gpr[5];
-         dst_ts->arch.vex.guest_GPR6  = ats_new->mst.gpr[6];
-         dst_ts->arch.vex.guest_GPR7  = ats_new->mst.gpr[7];
-         dst_ts->arch.vex.guest_GPR8  = ats_new->mst.gpr[8];
-         dst_ts->arch.vex.guest_GPR9  = ats_new->mst.gpr[9];
-         dst_ts->arch.vex.guest_GPR10 = ats_new->mst.gpr[10];
-         dst_ts->arch.vex.guest_GPR11 = ats_new->mst.gpr[11]; /* ?? */
-         dst_ts->arch.vex.guest_GPR12 = ats_new->mst.gpr[12];
-         dst_ts->arch.vex.guest_GPR13 = ats_new->mst.gpr[13];
-         dst_ts->arch.vex.guest_GPR14 = ats_new->mst.gpr[14];
-         dst_ts->arch.vex.guest_GPR15 = ats_new->mst.gpr[15];
-         dst_ts->arch.vex.guest_GPR16 = ats_new->mst.gpr[16];
-         dst_ts->arch.vex.guest_GPR17 = ats_new->mst.gpr[17];
-         dst_ts->arch.vex.guest_GPR18 = ats_new->mst.gpr[18];
-         dst_ts->arch.vex.guest_GPR19 = ats_new->mst.gpr[19];
-         dst_ts->arch.vex.guest_GPR20 = ats_new->mst.gpr[20];
-         dst_ts->arch.vex.guest_GPR21 = ats_new->mst.gpr[21];
-         dst_ts->arch.vex.guest_GPR22 = ats_new->mst.gpr[22];
-         dst_ts->arch.vex.guest_GPR23 = ats_new->mst.gpr[23];
-         dst_ts->arch.vex.guest_GPR24 = ats_new->mst.gpr[24];
-         dst_ts->arch.vex.guest_GPR25 = ats_new->mst.gpr[25];
-         dst_ts->arch.vex.guest_GPR26 = ats_new->mst.gpr[26];
-         dst_ts->arch.vex.guest_GPR27 = ats_new->mst.gpr[27];
-         dst_ts->arch.vex.guest_GPR28 = ats_new->mst.gpr[28];
-         dst_ts->arch.vex.guest_GPR29 = ats_new->mst.gpr[29];
-         dst_ts->arch.vex.guest_GPR30 = ats_new->mst.gpr[30];
-         dst_ts->arch.vex.guest_GPR31 = ats_new->mst.gpr[31];
-         dst_ts->arch.vex.guest_CIA   = ats_new->mst.iar; /* pc */
-         dst_ts->arch.vex.guest_LR    = ats_new->mst.lr;
-         dst_ts->arch.vex.guest_CTR   = ats_new->mst.ctr;
-         LibVEX_GuestPPC64_put_CR( ats_new->mst.cr, &dst_ts->arch.vex );
-         LibVEX_GuestPPC64_put_XER( ats_new->mst.xer, &dst_ts->arch.vex );
-
-         /* Record what seems like the highest legitimate stack
-            address for this thread, so that the stack unwinder works
-            properly.  It seems reasonable to use the R1 value
-            supplied here. */
-         dst_ts->client_stack_highest_word = dst_ts->arch.vex.guest_GPR1;
-
-         /* The host thread is to start running
-            start_thread_NORETURN */
-         UWord* wrapper_fdescr = (UWord*) & start_thread_NORETURN;
-         ats_new->mst.gpr[1] = (UWord)stack;
-         ats_new->mst.gpr[2] = wrapper_fdescr[1];
-         ats_new->mst.iar    = wrapper_fdescr[0];
-         ats_new->mst.gpr[3] = (UWord)dst_ts;
-
-         /* Set initial cancellation status for the thread. */
-         dst_ts->os_state.cancel_async    = False;
-         dst_ts->os_state.cancel_disabled = False;
-         dst_ts->os_state.cancel_progress = Canc_NoRequest;
-      }
-   }
-}
-POST(sys_thread_setstate)
-{
-   if (ARG3)
-      POST_MEM_WRITE( ARG3, sizeof(struct tstate) );
-   if (0 && VG_(clo_trace_syscalls) && ARG3)
-      ML_(aix5debugstuff_show_tstate)(ARG3, "thread_setstate (OLD)");
-}
-
-PRE(sys_FAKE_SIGRETURN)
-{
-   /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for
-      an explanation of what follows. */
-   /* This handles the fake signal-return system call created by
-      sigframe-ppc64-aix5.c. */
-
-   PRINT("FAKE_SIGRETURN ( )");
-
-   vg_assert(VG_(is_valid_tid)(tid));
-   vg_assert(tid >= 1 && tid < VG_N_THREADS);
-   vg_assert(VG_(is_running_thread)(tid));
-
-   /* Remove the signal frame from this thread's (guest) stack,
-      in the process restoring the pre-signal guest state. */
-   VG_(sigframe_destroy)(tid, True);
-
-   /* Tell the driver not to update the guest state with the "result",
-      and set a bogus result to keep it happy. */
-   *flags |= SfNoWriteResult;
-   SET_STATUS_Success(0);
-
-   /* Check to see if any signals arose as a result of this. */
-   *flags |= SfPollAfter;
-}
-
-
-/* ---------------------------------------------------------------------
-   The ppc64/AIX5 syscall table
-   ------------------------------------------------------------------ */
-
-typedef
-   struct {
-      UInt* pSysNo;
-      SyscallTableEntry wrappers;
-   }
-   AIX5SCTabEntry;
-
-#undef PLAXY
-#undef PLAX_
-
-#define PLAXY(sysno, name)                     \
-   { & sysno,                                  \
-     { & WRAPPER_PRE_NAME(ppc64_aix5, name),   \
-       & WRAPPER_POST_NAME(ppc64_aix5, name) }} 
-
-#define PLAX_(sysno, name)                     \
-   { & sysno,                                  \
-     { & WRAPPER_PRE_NAME(ppc64_aix5, name),   \
-       NULL }} 
-
-static /* but not const */
-AIX5SCTabEntry aix5_ppc64_syscall_table[]
-= {
-    AIXXY(__NR_AIX5___libc_sbrk,        sys___libc_sbrk),
-    AIXX_(__NR_AIX5___msleep,           sys___msleep),
-    PLAXY(__NR_AIX5__clock_gettime,     sys__clock_gettime),
-    AIXX_(__NR_AIX5__exit,              sys__exit),
-    PLAX_(__NR_AIX5__fp_fpscrx64_,      sys__fp_fpscrx64_),
-    AIXX_(__NR_AIX5__getpid,            sys__getpid),
-    AIXXY(__NR_AIX5__nsleep,            sys__nsleep),
-    AIXX_(__NR_AIX5__pause,             sys__pause),
-    AIXXY(__NR_AIX5__poll,              sys__poll),
-    AIXX_(__NR_AIX5__select,            sys__select),
-    AIXX_(__NR_AIX5__sem_wait,          sys__sem_wait),
-    AIXXY(__NR_AIX5__sigaction,         sys__sigaction),
-    AIXX_(__NR_AIX5__thread_self,       sys__thread_self),
-    AIXX_(__NR_AIX5_access,             sys_access),
-    AIXX_(__NR_AIX5_accessx,            sys_accessx),
-    AIXXY(__NR_AIX5_appgetrlimit,       sys_appgetrlimit),
-    AIXXY(__NR_AIX5_appgetrusage,       sys_appgetrusage),
-    AIXX_(__NR_AIX5_appsetrlimit,       sys_appsetrlimit),
-    AIXX_(__NR_AIX5_appulimit,          sys_appulimit),
-    AIXX_(__NR_AIX5_bind,               sys_bind),
-    AIXX_(__NR_AIX5_chdir,              sys_chdir),
-    AIXX_(__NR_AIX5_chmod,              sys_chmod),
-    AIXX_(__NR_AIX5_chown,              sys_chown),
-    AIXX_(__NR_AIX5_close,              sys_close),
-    AIXX_(__NR_AIX5_connext,            sys_connext),
-    AIXX_(__NR_AIX5_execve,             sys_execve),
-    AIXXY(__NR_AIX5_finfo,              sys_finfo),
-    AIXXY(__NR_AIX5_fstatfs,            sys_fstatfs),
-    AIXXY(__NR_AIX5_fstatx,             sys_fstatx),
-    AIXXY(__NR_AIX5_getdirent,          sys_getdirent),
-    AIXXY(__NR_AIX5_getdirent64,        sys_getdirent64),
-    AIXXY(__NR_AIX5_getdomainname,      sys_getdomainname),
-    AIXX_(__NR_AIX5_getgidx,            sys_getgidx),
-    AIXXY(__NR_AIX5_gethostname,        sys_gethostname),
-    AIXXY(__NR_AIX5_getpriv,            sys_getpriv),
-    AIXXY(__NR_AIX5_getprocs,           sys_getprocs),
-    AIXXY(__NR_AIX5_getprocs64,         sys_getprocs), /* XXX: correct? */
-    AIXX_(__NR_AIX5_getrpid,            sys_getrpid),
-    AIXXY(__NR_AIX5_getsockopt,         sys_getsockopt),
-    AIXX_(__NR_AIX5_gettimerid,         sys_gettimerid),
-    AIXX_(__NR_AIX5_getuidx,            sys_getuidx),
-    AIXXY(__NR_AIX5_incinterval,        sys_incinterval),
-    AIXXY(__NR_AIX5_kfcntl,             sys_kfcntl),
-    AIXX_(__NR_AIX5_kfork,              sys_kfork),
-    AIXX_(__NR_AIX5_kill,               sys_kill),
-    AIXXY(__NR_AIX5_kioctl,             sys_kioctl),
-    PLAXY(__NR_AIX5_kload,              sys_kload),
-    AIXX_(__NR_AIX5_klseek,             sys_klseek),
-    AIXXY(__NR_AIX5_kread,              sys_kread),
-    AIXXY(__NR_AIX5_kreadv,             sys_kreadv),
-    AIXX_(__NR_AIX5_kthread_ctl,        sys_kthread_ctl),
-    AIXX_(__NR_AIX5_ktruncate,          sys_ktruncate),
-    PLAXY(__NR_AIX5_kunload64,          sys_kunload64),
-    AIXXY(__NR_AIX5_kwaitpid,           sys_kwaitpid),
-    AIXX_(__NR_AIX5_kwrite,             sys_kwrite),
-    AIXX_(__NR_AIX5_kwritev,            sys_kwritev),
-    AIXX_(__NR_AIX5_lseek,              sys_lseek),
-    AIXX_(__NR_AIX5_mkdir,              sys_mkdir),
-    AIXXY(__NR_AIX5_mmap,               sys_mmap),
-    AIXXY(__NR_AIX5_mntctl,             sys_mntctl),
-    AIXXY(__NR_AIX5_mprotect,           sys_mprotect),
-    AIXXY(__NR_AIX5_munmap,             sys_munmap),
-    AIXXY(__NR_AIX5_ngetpeername,       sys_ngetpeername),
-    AIXXY(__NR_AIX5_ngetsockname,       sys_ngetsockname),
-    AIXXY(__NR_AIX5_nrecvfrom,          sys_nrecvfrom),
-    AIXX_(__NR_AIX5_nrecvmsg,           sys_nrecvmsg),
-    AIXX_(__NR_AIX5_open,               sys_open),
-    AIXXY(__NR_AIX5_pipe,               sys_pipe),
-    AIXX_(__NR_AIX5_privcheck,          sys_privcheck),
-    AIXX_(__NR_AIX5_rename,             sys_rename),
-    AIXXY(__NR_AIX5_sbrk,               sys_sbrk),
-    AIXXY(__NR_AIX5_sem_init,           sys_sem_init),
-    AIXXY(__NR_AIX5_sem_post,           sys_sem_post),
-    AIXX_(__NR_AIX5_send,               sys_send),
-    AIXX_(__NR_AIX5_setgid,             sys_setgid),
-    AIXX_(__NR_AIX5_setsockopt,         sys_setsockopt),
-    AIXX_(__NR_AIX5_setuid,             sys_setuid),
-    AIXXY(__NR_AIX5_shmat,              sys_shmat),
-    AIXXY(__NR_AIX5_shmctl,             sys_shmctl),
-    AIXXY(__NR_AIX5_shmdt,              sys_shmdt),
-    AIXX_(__NR_AIX5_shmget,             sys_shmget),
-    AIXX_(__NR_AIX5_shutdown,           sys_shutdown),
-    AIXX_(__NR_AIX5_sigcleanup,         sys_sigcleanup),
-    AIXXY(__NR_AIX5_sigprocmask,        sys_sigprocmask),
-    AIXXY(__NR_AIX5_sys_parm,           sys_sys_parm),
-    AIXXY(__NR_AIX5_sysconfig,          sys_sysconfig),
-    AIXX_(__NR_AIX5_socket,             sys_socket),
-    AIXXY(__NR_AIX5_statx,              sys_statx),
-    AIXXY(__NR_AIX5_thread_create,      sys_thread_create),
-    AIXX_(__NR_AIX5_thread_init,        sys_thread_init),
-    AIXX_(__NR_AIX5_thread_kill,        sys_thread_kill),
-    AIXXY(__NR_AIX5_thread_setmystate,  sys_thread_setmystate),
-    AIXX_(__NR_AIX5_thread_setmystate_fast, sys_thread_setmystate_fast),
-    PLAXY(__NR_AIX5_thread_setstate,    sys_thread_setstate),
-    AIXX_(__NR_AIX5_thread_terminate_unlock, sys_thread_terminate_unlock),
-    AIXX_(__NR_AIX5_thread_tsleep,      sys_thread_tsleep),
-    AIXX_(__NR_AIX5_thread_twakeup,     sys_thread_twakeup),
-    AIXX_(__NR_AIX5_thread_unlock,      sys_thread_unlock),
-    AIXX_(__NR_AIX5_thread_waitlock_,   sys_thread_waitlock_),
-    AIXXY(__NR_AIX5_times,              sys_times),
-    AIXXY(__NR_AIX5_uname,              sys_uname),
-    AIXX_(__NR_AIX5_unlink,             sys_unlink),
-    AIXX_(__NR_AIX5_utimes,             sys_utimes),
-    AIXXY(__NR_AIX5_vmgetinfo,          sys_vmgetinfo),
-    AIXX_(__NR_AIX5_yield,              sys_yield),
-    PLAX_(__NR_AIX5_FAKE_SIGRETURN,     sys_FAKE_SIGRETURN)
-  };
-
-SyscallTableEntry* ML_(get_ppc64_aix5_syscall_entry) ( UInt sysno )
-{
-   Int            i;
-   AIX5SCTabEntry tmp;
-
-   const Int tab_size = sizeof(aix5_ppc64_syscall_table) 
-                        / sizeof(aix5_ppc64_syscall_table[0]);
-
-   for (i = 0; i < tab_size; i++)
-      if (sysno == *(aix5_ppc64_syscall_table[i].pSysNo))
-         break;
-
-   vg_assert(i >= 0 && i <= tab_size);
-   if (i == tab_size)
-      return NULL; /* can't find a wrapper */
-
-   /* Move found one a bit closer to the front, so as to
-      make future searches cheaper. */
-   if (i > 0) {
-      tmp = aix5_ppc64_syscall_table[i-1];
-      aix5_ppc64_syscall_table[i-1] = aix5_ppc64_syscall_table[i];
-      aix5_ppc64_syscall_table[i] = tmp;
-      i--;
-   }
-
-   vg_assert(i >= 0 && i < tab_size);
-   return &aix5_ppc64_syscall_table[i].wrappers;
-}
-
-#endif // defined(VGP_ppc64_aix5)
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S
index eefdbfc..e2b7211 100644
--- a/coregrind/m_trampoline.S
+++ b/coregrind/m_trampoline.S
@@ -645,288 +645,6 @@
 #	undef UD2_1024
 #	undef UD2_PAGE
         
-/*---------------- ppc32-aix5 ----------------*/
-#else
-#if defined(VGP_ppc32_aix5)
-
-#	define UD2_16     trap ; trap ; trap; trap
-#	define UD2_64     UD2_16   ; UD2_16   ; UD2_16   ; UD2_16
-#	define UD2_256    UD2_64   ; UD2_64   ; UD2_64   ; UD2_64
-#	define UD2_1024   UD2_256  ; UD2_256  ; UD2_256  ; UD2_256
-#	define UD2_PAGE   UD2_1024 ; UD2_1024 ; UD2_1024 ; UD2_1024  
-
-	.csect .text[PR]
-
-	/* a leading page of unexecutable code */
-	UD2_PAGE
-
-.globl VG_(trampoline_stuff_start)
-VG_(trampoline_stuff_start):
-
-/* See pub_core_trampoline.h for an explaination of this.  Also
-   see pub_core_initimg.h, struct AIX5PreloadPage.  On entry, r3
-   points to an AIX5PreloadPage structure.  Note we can only 
-   use r2-r10 as scratch registers here since those are the
-   only ones restored from the preload page when finally
-   starting the client. */
-.globl VG_(ppc32_aix5_do_preloads_then_start_client)
-VG_(ppc32_aix5_do_preloads_then_start_client):
-	stwu	1,-1024(1)
-	stw	3,512(1)	/* stash r3 512 bytes up stack */
-
-	/* Try to load .../vgpreload_core.so */
-	lwz	2,0(3)		/* r2 = __NR___loadx */
-	lwz	5,20(3)		/* r5 = off_preloadcorename */
-	add	6,3,5		/* r6 = preloadcorename */
-	addis	1,1,-4
-	bl	do___loadx
-	addis	1,1,4
-	cmpwi	0,3,0
-	beq	.Lfailed
-
-	/* Try to load .../vgpreload_tool.so, if it exists */
-	lwz	3,512(1)	/* restore r3 */
-	lwz	2,0(3)		/* r2 = __NR___loadx */
-	lwz	5,24(3)		/* r5 = off_preloadtoolname */
-	cmpwi	0,5,0		/* skip tool preload if */
-	beq	.Ltry_preload	/* name not present */
-	add	6,3,5		/* r6 = preloadtoolname */
-	addis	1,1,-4
-	bl	do___loadx
-	addis	1,1,4
-	cmpwi	0,3,0
-	beq	.Lfailed
-
-.Ltry_preload:
-	/* Try to load the LD_PRELOAD= file, if it exists */
-	lwz	3,512(1)	/* restore r3 */
-	lwz	2,0(3)		/* r2 = __NR___loadx */
-	lwz	5,28(3)		/* r5 = off_ld_preloadname */
-	cmpwi	0,5,0		/* skip ld_preload if */
-	beq	.Lstart_client	/* name not present */
-	add	6,3,5		/* r6 = ld_preloadname */
-	addis	1,1,-4
-	bl	do___loadx
-	addis	1,1,4
-	cmpwi	0,3,0
-	beq	.Lfailed
-	
-.Lstart_client:
-	/* Success.  Restore r2-r10 from preloadpage-> and start
-	the client. */
-	lwz	3,512(1)	/* restore r3 */
-	addi	1,1,1024
-	lwz	2,32+4(3)	/* preloadpage->client_start */
-	mtctr	2
-	lwz	2,40+4(3)	/* preloadpage->r2 */
-	lwz	4,56+4(3)	/* preloadpage->r4 */
-	lwz	5,64+4(3)	/* preloadpage->r5 */
-	lwz	6,72+4(3)	/* preloadpage->r6 */
-	lwz	7,80+4(3)	/* preloadpage->r7 */
-	lwz	8,88+4(3)	/* preloadpage->r8 */
-	lwz	9,96+4(3)	/* preloadpage->r9 */
-	lwz	10,104+4(3)	/* preloadpage->r10 */
-	lwz	3,48+4(3)	/* preloadpage->r3 */
-	bctr
-	/*NOTREACHED*/
-	trap
-
-.Lfailed:
-	/* __loadx barfed for some reason.  Print the error
-	message and get out. */
-	/* First the error msg */
-	lwz	3,512(1)	/* restore r3 */
-	lwz	2,4(3)		/* r2 = __NR_kwrite */
-	lwz	4,12(3)		/* r4 = offset of err msg */
-	add	4,4,3		/* r4 = err msg */
-	lwz	5,16(3)		/* r5 = length err msg */
-	li	3,2		/* r3 = stderr */
-	bl	do_syscall
-	/* now call the diagnosis fn */
-	lwz	3,512(1)	/* restore r3 */
-	lwz	4,112(3)	/* preloadpage->p_diagnose_load_failure */
-	lwz	2,4(4)		/* get its TOC ptr */
-	lwz	4,0(4)		/* get its entry point */
-	mtlr	4
-	blrl
-	/* Now do _exit(1) */
-	lwz	3,512(1)	/* restore r3 */
-	lwz	2,8(3)		/* r2 = __NR_exit */
-	li	3,1		/* doing _exit(1) */
-	addi	1,1,1024	/* fix stack pointer */
-	bl	do_syscall
-	/*NOTREACHED*/
-	trap
-	
-do___loadx:
-	/* On entry: r2 = __NR___loadx,	r6 = name of module */
-	li	3,1
-	slwi	3,3,24	/* r3 = 0x1000000 = VKI_DL_LOAD */
-	mr	4,1
-	lis	5,3
-	li	7,0
-	li	8,0
-	li	9,0
-	li	10,0
-do_syscall:
-	crorc	6,6,6
-	sc
-	trap
-	/* sc continues at 'lr', hence this 
-	constitutes an automatic return */
-
-
-	/* See comment in pub_core_trampoline.h for what this is for */
-.globl VG_(ppctoc_magic_redirect_return_stub)
-VG_(ppctoc_magic_redirect_return_stub):
-	trap
-	
-.globl VG_(trampoline_stuff_end)
-VG_(trampoline_stuff_end):
-
-	/* and a trailing page of unexecutable code */
-	UD2_PAGE
-
-#	undef UD2_16
-#	undef UD2_64
-#	undef UD2_256
-#	undef UD2_1024
-#	undef UD2_PAGE
-
-/*---------------- ppc64-aix5 ----------------*/
-#else
-#if defined(VGP_ppc64_aix5)
-
-#	define UD2_16     trap ; trap ; trap; trap
-#	define UD2_64     UD2_16   ; UD2_16   ; UD2_16   ; UD2_16
-#	define UD2_256    UD2_64   ; UD2_64   ; UD2_64   ; UD2_64
-#	define UD2_1024   UD2_256  ; UD2_256  ; UD2_256  ; UD2_256
-#	define UD2_PAGE   UD2_1024 ; UD2_1024 ; UD2_1024 ; UD2_1024  
-
-.globl VG_(trampoline_stuff_start)
-VG_(trampoline_stuff_start):
-/* See pub_core_trampoline.h for an explaination of this.  Also
-   see pub_core_initimg.h, struct AIX5PreloadPage.  On entry, r3
-   points to an AIX5PreloadPage structure.  Note we can only 
-   use r2-r10 as scratch registers here since those are the
-   only ones restored from the preload page when finally
-   starting the client. */
-.globl VG_(ppc64_aix5_do_preloads_then_start_client)
-VG_(ppc64_aix5_do_preloads_then_start_client):
-	stdu	1,-1024(1)
-	std	3,512(1)	/* stash r3 512 bytes up stack */
-
-	/* Try to load .../vgpreload_core.so */
-	lwz	2,0(3)		/* r2 = __NR_kload */
-	lwz	5,20(3)		/* r5 = off_preloadcorename */
-	add	3,3,5		/* r6 = preloadcorename */
-	bl	do_kload
-	cmpdi	0,3,0
-	beq	.Lfailed
-
-	/* Try to load .../vgpreload_tool.so, if it exists */
-	ld	3,512(1)	/* restore r3 */
-	lwz	2,0(3)		/* r2 = __NR_kload */
-	lwz	5,24(3)		/* r5 = off_preloadtoolname */
-	cmpwi	0,5,0		/* skip tool preload if */
-	beq	.Ltry_preload	/* name not present */
-	add	3,3,5		/* r6 = preloadtoolname */
-	bl	do_kload
-	cmpdi	0,3,0
-	beq	.Lfailed
-
-.Ltry_preload:
-	/* Try to load the LD_PRELOAD= file, if it exists */
-	ld	3,512(1)	/* restore r3 */
-	lwz	2,0(3)		/* r2 = __NR_kload */
-	lwz	5,28(3)		/* r5 = off_ld_preloadname */
-	cmpwi	0,5,0		/* skip ld_preload if */
-	beq	.Lstart_client	/* name not present */
-	add	3,3,5		/* r6 = ld_preloadname */
-	bl	do_kload
-	cmpdi	0,3,0
-	beq	.Lfailed
-	
-.Lstart_client:
-	/* Success.  Restore r2-r10 from preloadpage-> and start
-	the client. */
-	ld	3,512(1)	/* restore r3 */
-	addi	1,1,1024
-	ld	2,32+0(3)	/* preloadpage->client_start */
-	mtctr	2
-	ld	2,40+0(3)	/* preloadpage->r2 */
-	ld	4,56+0(3)	/* preloadpage->r4 */
-	ld	5,64+0(3)	/* preloadpage->r5 */
-	ld	6,72+0(3)	/* preloadpage->r6 */
-	ld	7,80+0(3)	/* preloadpage->r7 */
-	ld	8,88+0(3)	/* preloadpage->r8 */
-	ld	9,96+0(3)	/* preloadpage->r9 */
-	ld	10,104+0(3)	/* preloadpage->r10 */
-	ld	3,48+0(3)	/* preloadpage->r3 */
-	bctr
-	/*NOTREACHED*/
-	trap
-
-.Lfailed:
-	/* __loadx barfed for some reason.  Print the error
-	message and get out. */
-	/* First the error msg */
-	ld	3,512(1)	/* restore r3 */
-	lwz	2,4(3)		/* r2 = __NR_kwrite */
-	lwz	4,12(3)		/* r4 = offset of err msg */
-	add	4,4,3		/* r4 = err msg */
-	lwz	5,16(3)		/* r5 = length err msg */
-	li	3,2		/* r3 = stderr */
-	bl	do_syscall
-	/* now call the diagnosis fn */
-	ld	3,512(1)	/* restore r3 */
-	ld	4,112(3)	/* preloadpage->p_diagnose_load_failure */
-	ld	11,16(4)
-	ld	2,8(4)		/* get its TOC ptr */
-	ld	4,0(4)		/* get its entry point */
-	mtlr	4
-	blrl
-	/* Now do _exit(1) */
-	lwz	3,512(1)	/* restore r3 */
-	lwz	2,8(3)		/* r2 = __NR_exit */
-	li	3,1		/* doing _exit(1) */
-	addi	1,1,1024	/* fix stack pointer */
-	bl	do_syscall
-	/*NOTREACHED*/
-	trap
-	
-do_kload:
-	/* On entry: r2 = __NR_kload,	r3 = name of module */
-	li	4,0
-	li	5,0
-	li	6,0
-	li	7,0
-	li	8,0
-	li	9,0
-	li	10,0
-do_syscall:
-	crorc	6,6,6
-	sc
-	/* sc continues at 'lr', hence this 
-	constitutes an automatic return */
-
-	/* See comment in pub_core_trampoline.h for what this is for */
-.globl VG_(ppctoc_magic_redirect_return_stub)
-VG_(ppctoc_magic_redirect_return_stub):
-	trap
-	
-.globl VG_(trampoline_stuff_end)
-VG_(trampoline_stuff_end):
-
-	/* and a trailing page of unexecutable code */
-	UD2_PAGE
-
-#	undef UD2_16
-#	undef UD2_64
-#	undef UD2_256
-#	undef UD2_1024
-#	undef UD2_PAGE
-
 /*---------------- x86-darwin ----------------*/
 #else
 #if defined(VGP_x86_darwin)
@@ -1279,8 +997,6 @@
 #endif
 #endif
 #endif
-#endif
-#endif
 
 #if defined(VGO_linux)
 /* Let the linker know we don't need an executable stack */
diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c
index 473d3cf..3130927 100644
--- a/coregrind/m_translate.c
+++ b/coregrind/m_translate.c
@@ -856,7 +856,7 @@
 
 /* --------------- helpers for with-TOC platforms --------------- */
 
-/* NOTE: with-TOC platforms are: ppc64-linux, ppc32-aix5, ppc64-aix5. */
+/* NOTE: with-TOC platforms are: ppc64-linux. */
 
 static IRExpr* mkU64 ( ULong n ) {
    return IRExpr_Const(IRConst_U64(n));
@@ -888,7 +888,7 @@
    IRTemp      t1;
    IRExpr*     one;
 
-#  if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
+#  if defined(VGP_ppc64_linux)
    Int    stack_size       = VEX_GUEST_PPC64_REDIR_STACK_SIZE;
    Int    offB_REDIR_SP    = offsetof(VexGuestPPC64State,guest_REDIR_SP);
    Int    offB_REDIR_STACK = offsetof(VexGuestPPC64State,guest_REDIR_STACK);
@@ -979,7 +979,7 @@
 
 static IRTemp gen_POP ( IRSB* bb )
 {
-#  if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
+#  if defined(VGP_ppc64_linux)
    Int    stack_size       = VEX_GUEST_PPC64_REDIR_STACK_SIZE;
    Int    offB_REDIR_SP    = offsetof(VexGuestPPC64State,guest_REDIR_SP);
    Int    offB_REDIR_STACK = offsetof(VexGuestPPC64State,guest_REDIR_STACK);
@@ -1068,7 +1068,7 @@
 
 static void gen_push_and_set_LR_R2 ( IRSB* bb, Addr64 new_R2_value )
 {
-#  if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
+#  if defined(VGP_ppc64_linux)
    Addr64 bogus_RA  = (Addr64)&VG_(ppctoc_magic_redirect_return_stub);
    Int    offB_GPR2 = offsetof(VexGuestPPC64State,guest_GPR2);
    Int    offB_LR   = offsetof(VexGuestPPC64State,guest_LR);
@@ -1077,15 +1077,6 @@
    addStmtToIRSB( bb, IRStmt_Put( offB_LR,   mkU64( bogus_RA )) );
    addStmtToIRSB( bb, IRStmt_Put( offB_GPR2, mkU64( new_R2_value )) );
 
-#  elif defined(VGP_ppc32_aix5)
-   Addr32 bogus_RA  = (Addr32)&VG_(ppctoc_magic_redirect_return_stub);
-   Int    offB_GPR2 = offsetof(VexGuestPPC32State,guest_GPR2);
-   Int    offB_LR   = offsetof(VexGuestPPC32State,guest_LR);
-   gen_PUSH( bb, IRExpr_Get(offB_LR,   Ity_I32) );
-   gen_PUSH( bb, IRExpr_Get(offB_GPR2, Ity_I32) );
-   addStmtToIRSB( bb, IRStmt_Put( offB_LR,   mkU32( bogus_RA )) );
-   addStmtToIRSB( bb, IRStmt_Put( offB_GPR2, mkU32( new_R2_value )) );
-
 #  else
 #    error Platform is not TOC-afflicted, fortunately
 #  endif
@@ -1093,7 +1084,7 @@
 
 static void gen_pop_R2_LR_then_bLR ( IRSB* bb )
 {
-#  if defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
+#  if defined(VGP_ppc64_linux)
    Int    offB_GPR2 = offsetof(VexGuestPPC64State,guest_GPR2);
    Int    offB_LR   = offsetof(VexGuestPPC64State,guest_LR);
    IRTemp old_R2    = newIRTemp( bb->tyenv, Ity_I64 );
@@ -1111,25 +1102,6 @@
    bb->jumpkind = Ijk_Boring;
    bb->next = IRExpr_Binop(Iop_And64, IRExpr_RdTmp(old_LR), mkU64(~(3ULL)));
 
-#  elif defined(VGP_ppc32_aix5)
-   Int    offB_GPR2 = offsetof(VexGuestPPC32State,guest_GPR2);
-   Int    offB_LR   = offsetof(VexGuestPPC32State,guest_LR);
-   IRTemp old_R2    = newIRTemp( bb->tyenv, Ity_I32 );
-   IRTemp old_LR    = newIRTemp( bb->tyenv, Ity_I32 );
-   /* Restore R2 */
-   old_R2 = gen_POP( bb );
-   addStmtToIRSB( bb, IRStmt_Put( offB_GPR2, IRExpr_RdTmp(old_R2)) );
-   /* Restore LR */
-   old_LR = gen_POP( bb );
-   addStmtToIRSB( bb, IRStmt_Put( offB_LR, IRExpr_RdTmp(old_LR)) );
-
-   /* Branch to LR */
-   /* re boring, we arrived here precisely because a wrapped fn did a
-      blr (hence Ijk_Ret); so we should just mark this jump as Boring,
-      else one _Call will have resulted in two _Rets. */
-   bb->jumpkind = Ijk_Boring;
-   bb->next = IRExpr_Binop(Iop_And32, IRExpr_RdTmp(old_LR), mkU32(~3));
-
 #  else
 #    error Platform is not TOC-afflicted, fortunately
 #  endif
@@ -1225,8 +1197,7 @@
             : IRExpr_Const(IRConst_U32( (UInt)closure->nraddr ))
       )
    );
-#  if defined(VGP_ppc64_linux) || defined(VGP_ppc32_aix5) \
-                               || defined(VGP_ppc64_aix5)
+#  if defined(VGP_ppc64_linux)
    addStmtToIRSB( 
       bb,
       IRStmt_Put( 
@@ -1248,48 +1219,6 @@
    return True;
 }
 
-__attribute__((unused))
-static Bool bl_RZ_zap_ok_for_AIX ( Addr64 bl_target )
-{
-   /* paranoia */
-   if (sizeof(void*) == 4)
-      bl_target &= 0xFFFFFFFFULL;
-
-   /* don't zap the redzone for calls to millicode. */
-   if (bl_target < 0x10000ULL)
-      return False;
-
-   /* don't zap the redzone for calls to .$SAVEF14 .. .$SAVEF31.
-      First we need to be reasonably sure we won't segfault by looking
-      at the branch target. */
-   { NSegment const*const seg = VG_(am_find_nsegment)( (Addr)bl_target );
-     if (seg && seg->hasR) {
-        switch ( *(UInt*)(Addr)bl_target ) {
-           case 0xd9c1ff70: /* stfd f14,-144(r1) */
-           case 0xd9e1ff78: /* stfd f15,-136(r1) */
-           case 0xda01ff80: /* stfd f16,-128(r1) */
-           case 0xda21ff88: /* stfd f17,-120(r1) */
-           case 0xda41ff90: /* stfd f18,-112(r1) */
-           case 0xda61ff98: /* stfd f19,-104(r1) */
-           case 0xda81ffa0: /* stfd f20,-96(r1) */
-           case 0xdaa1ffa8: /* stfd f21,-88(r1) */
-           case 0xdac1ffb0: /* stfd f22,-80(r1) */
-           case 0xdae1ffb8: /* stfd f23,-72(r1) */
-           case 0xdb01ffc0: /* stfd f24,-64(r1) */
-           case 0xdb21ffc8: /* stfd f25,-56(r1) */
-           case 0xdb41ffd0: /* stfd f26,-48(r1) */
-           case 0xdb61ffd8: /* stfd f27,-40(r1) */
-           case 0xdb81ffe0: /* stfd f28,-32(r1) */
-           case 0xdba1ffe8: /* stfd f29,-24(r1) */
-           case 0xdbc1fff0: /* stfd f30,-16(r1) */
-           case 0xdbe1fff8: /* stfd f31,-8(r1) */
-              return False;
-        }
-     }
-   }
-   return True;
-}
-
 /* --------------- main translation function --------------- */
 
 /* Note: see comments at top of m_redir.c for the Big Picture on how
@@ -1499,12 +1428,6 @@
    vex_abiinfo.guest_ppc_zap_RZ_at_bl         = const_True;
    vex_abiinfo.host_ppc_calls_use_fndescrs    = True;
 #  endif
-#  if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   vex_abiinfo.guest_ppc_zap_RZ_at_blr        = False;
-   vex_abiinfo.guest_ppc_zap_RZ_at_bl         = bl_RZ_zap_ok_for_AIX;
-   vex_abiinfo.guest_ppc_sc_continues_at_LR   = True;
-   vex_abiinfo.host_ppc_calls_use_fndescrs    = True;
-#  endif
 
    /* Set up closure args. */
    closure.tid    = tid;
diff --git a/coregrind/m_ume/main.c b/coregrind/m_ume/main.c
index 9478715..fdad39c 100644
--- a/coregrind/m_ume/main.c
+++ b/coregrind/m_ume/main.c
@@ -51,14 +51,13 @@
 } ExeHandler;
 
 static ExeHandler exe_handlers[] = {
-   // Nb: AIX5 doesn't use m_ume, which is why it's not represented here.
-#if defined(VGO_linux)
+#  if defined(VGO_linux)
    { VG_(match_ELF),    VG_(load_ELF) },
-#elif defined(VGO_darwin)
+#  elif defined(VGO_darwin)
    { VG_(match_macho),  VG_(load_macho) },
-#else
-#  error "unknown OS"
-#endif
+#  else
+#    error "unknown OS"
+#  endif
    { VG_(match_script), VG_(load_script) },
 };
 #define EXE_HANDLER_COUNT (sizeof(exe_handlers)/sizeof(exe_handlers[0]))
diff --git a/coregrind/m_vki.c b/coregrind/m_vki.c
index a141fa7..aab6e91 100644
--- a/coregrind/m_vki.c
+++ b/coregrind/m_vki.c
@@ -75,7 +75,7 @@
 
    /* --- Platform-specific checks on signal sets --- */
 
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    /* nothing to check */
 #  elif defined(VGP_x86_darwin) || defined(VGP_amd64_darwin)
    vg_assert(_VKI_NSIG == NSIG);
@@ -89,7 +89,7 @@
 
    /* --- Platform-specific checks on sigactions --- */
 
-#  if defined(VGO_linux) || defined(VGO_aix5)
+#  if defined(VGO_linux)
    /* the toK- and fromK- forms are identical */
    vg_assert( sizeof(vki_sigaction_toK_t) 
               == sizeof(vki_sigaction_fromK_t) );
diff --git a/coregrind/m_vkiscnums.c b/coregrind/m_vkiscnums.c
index 2cecf2c..172500a 100644
--- a/coregrind/m_vkiscnums.c
+++ b/coregrind/m_vkiscnums.c
@@ -40,19 +40,6 @@
 
    On Linux, the interface exports a bunch of "#define __NR_foo 42" style
    definitions, so there is no implementation.
-
-   On AIX, syscall numbers are not fixed ahead of time; in principle
-   each process can have its own assignment of numbers to actual
-   syscalls.  As a result we have a bunch of global variables to store
-   the number for each syscall, which are assigned to at system
-   startup, and a bunch of #defines which map "__NR_foo" names to
-   these global variables.  Initially, when we don't know what a
-   syscall's number is, it is set to __NR_AIX5_UNKNOWN.
-
-   Therefore, on AIX, this module provides a home for those variables.
-
-   It also provides VG_(aix5_register_syscall) to assign numbers to
-   those variables.
 */
 
 //---------------------------------------------------------------------------
@@ -71,1091 +58,6 @@
 }
 
 //---------------------------------------------------------------------------
-#elif defined(VGO_aix5)
-//---------------------------------------------------------------------------
-
-/* These ones are for AIX 5.2. */
-Int VG_(aix5_NR_utrchook_sc) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_create) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kfork) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kra_fork) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_execve) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ra_execve) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__load) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___unload) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_loadbind) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___loadx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_bindprocessor) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_trcgent) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_trcgen) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_trchk) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_trchkt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_trchkl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_trchklt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_trchkg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_trchkgt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kill) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__addcpucosts) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mycpu) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_adjtime) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_checkpnt_block) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__checkpnt_kill) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__checkpnt_fail) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__checkpnt_commit) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__checkpnt_register) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__checkpnt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setcrid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getcrid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mkcrid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_checkpnt_wait) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_checkpnt_deliver) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_gencore) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_terminate) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__exit) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kwaitpid64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kwaitpid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_yield) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getprocs64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getevars) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getargs) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getthrds64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getthrds) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getprocs) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sigcleanup) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__setpri) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__getpri) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_profil) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_reboot) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_appgetrlimit) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_appsetrlimit) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__setpriority) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__getpriority) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setrlimit64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getrlimit64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_appgetrusage) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getrusage64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getvtid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getrtid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getrpid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_restart_wait) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_restart) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__rmcpucosts) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__clock_getcpuclockid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__clock_settime) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__clock_gettime) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__clock_getres) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__timer_settime) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__timer_gettime) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__timer_getoverrun) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__timer_delete) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__timer_create) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__sigqueue) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__sigsuspend) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__sigaction) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sigprocmask) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_siglocalmask) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_count_event_waiters) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_waitact) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_waitlock_local) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_waitlock) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_wait) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_unlock) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_twakeup_unlock) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_twakeup_event) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_twakeup) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_tsleep_event) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_tsleep_chkpnt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_tsleep) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_post_many) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_post) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ue_proc_unregister) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ue_proc_register) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kthread_ctl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__thread_setsched) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_threads_runnable) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_getregs) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_terminate_unlock) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_terminate_ack) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_setstate_fast) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_setstate) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_setmymask_fast) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_setmystate_fast) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_setmystate) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_init) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_times) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__nsleep) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_reltimerid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_appresinc) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_apprestimer) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_appresabs) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_appsettimer) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_appgettimer) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_gettimerid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_incinterval) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_absinterval) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getinterval) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_upfget) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_wait) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_post) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_event_init) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_set_tag) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_set) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ptrace64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ptracex) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ptrace) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ksetcontext_sigreturn) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ksetcontext) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kgetcontext) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sigreturn) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_get_bio_stats) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_splice) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rmsock) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_nrecvmsg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_socket_aio_dequeue) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getkerninfo) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getpeereid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getpeername) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ngetpeername) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getsockname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ngetsockname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getsockopt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setsockopt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_shutdown) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_recvmsg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_recv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_nrecvfrom) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_recvfrom) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_nsendmsg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sendmsg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_send) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sendto) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_socketpair) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_accept) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_naccept) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_listen) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_bind) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_socket) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_connext) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setdomainname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getdomainname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sethostname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sethostid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_gethostid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_gethostname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_send_file) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__rmlmbcost) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___rs_pickmcm) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_getsystem) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_getassociativity) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_setpartition) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_getpartition) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ra_getrset) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_getinfo) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_getrad) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_numrads) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___kdb_format_print_rele) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___kdb_format_print_init) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_close) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kfsync_range) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fsync) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kpwrite) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kwritev) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kwrite) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kpread) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kreadv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kread) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_klseek) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__lseek) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_lseek) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__setsid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__setpgid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__setpgrp) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__getpgrpx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__getpgrp) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__getppid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__thread_self) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__getpid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kgetpgidx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setuid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setuidx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getuidx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_seteuid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setreuid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_chdir) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fchdir) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_chroot) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fchmod) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_chmod) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_chown) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_lchown) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fchown) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fchownx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_chownx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kfclear) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fclear) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ffinfo) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_finfo) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fscntl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ktruncate) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kftruncate) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_truncate) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ftruncate) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getdirent64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getdirent) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kioctl32) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kioctl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_link) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_klockf) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_lockf) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mkdir) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mknod) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mntctl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_vmount) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_creat) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_openx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_open) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_quotactl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rename) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rmdir) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fstatx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_statx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_symlink) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_readlink) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_syncvfs) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sync) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_umask) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_uvmount) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_umount) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_unameu) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_unamex) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_uname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_unlink) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ustat) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_utimes) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___msgxrcv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___msgrcv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___msgsnd) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_msgctl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_msgget) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getgidx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___semop) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_semget) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_semctl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_shmctl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_shmdt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_shmat) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_shmget) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ra_shmgetv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ra_shmget) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_privcheck) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_disclaim) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__sem_destroy_unnamed) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__sem_wait) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__sem_close) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__sem_open) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sem_unlink) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sem_post) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sem_init) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sem_getvalue) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sem_destroy) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__mq_notify) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__mq_open) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mq_unlink) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mq_setattr) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mq_send) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mq_receive) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mq_getattr) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mq_close) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_shm_unlink) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_shm_open) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__poll) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__select) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sysconfig) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sys_parm) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_loadquery) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_knlist) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_brk) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fjfs_sys_call) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_jfs_sys_call) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_acct) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__dr_unregister) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__dr_notify) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__dr_register) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getlparload) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_dr_reconfig) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_projctl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sbrk) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__sigpending) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__pause) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_kill) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sigstack) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sigaltstack) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_appulimit) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ras_service) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_class_descr2key) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_get_procinfo) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_get_info) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_getclassname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_unload_classes) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_load) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_tune) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_assign) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__wlm_classify) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fp_cpusync) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__fp_trapstate_ker) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__ewlm_classify_correlator) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_stop_transaction) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_destroy_application) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_stop_application) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_generate_correlator) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_discard_transaction) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_unbind_thread) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_bind_thread) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_unblock_transaction) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_block_transaction) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_update_transaction) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_register_metric) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_report_transaction) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_start_transaction) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_register_transaction) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_start_application) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__arm_register_application) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__lsarm_getinfo) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__ewlm_init) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__ewlm_query) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_verify_policy) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_abort_policy) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_commit_policy) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_prepare_policy) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_get_completions) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_get_activedata) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_get_appldata) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_collect_samples) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_disconnect) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ewlm_connect) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_auditlog) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_auditproc) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getgroups) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setgid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setgidx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setgroups) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_frevoke) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_revoke) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___pag_setvalue) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___pag_getvalue) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___pag_getid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___pag_getname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___pag_setname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kcap_set_proc) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kcap_get_proc) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_pipe) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mwakeup) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___msleep) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kmmap) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_msem_remove) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mincore) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_madvise) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_munmap) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_msync) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mprotect) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_mmap) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_swapqry) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_swapon) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_swapoff) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_psdanger) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_vmgetinfo) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_admregistername) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_discardname) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_setnameattr) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_registername) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_getnamedrset) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_getnameattr) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_rs_getrsetnames) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ra_attachrset) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_ra_detachrset) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_dmapi_init) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kdm_ioctl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_access) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_accessx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kfcntl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___pfcntl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fstatfs64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_statfs64) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fstatfs) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_statfs) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_probe) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_cmp_swap) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__validate_pag) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kgetsidx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kgetsid) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_plock) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_upfput) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_usrinfo) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_audit) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_auditobj) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_auditbin) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_auditevents) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_faccessx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___fchaclx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___chaclx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fchacl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_chacl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___fstataclx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR___stataclx) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fstatacl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_statacl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_setpriv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getpriv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fstatpriv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_statpriv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_fchpriv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_chpriv) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_i_int2cpu_pal) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_hd_cfg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_putpmsg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_putmsg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getpmsg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_getmsg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_strinfo) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_strreset) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_dupmsg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__kgrantpt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_aixgsc) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smaccept) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smconnect) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smlisten) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smbind) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smsocket) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smdetatt) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smattach) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smselect) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smwait) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smsetthresh) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smsendbuff) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smfreebuff) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smrcvbuff) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smgetbuff) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smversion) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_smtcheckinit) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_aio_nwait_timeout) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kaio_stats) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_aio_cntl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_listio) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_acancel) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_iosuspend) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kaio_rdwr) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_aio_nwait) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__posix_iofsync) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__posix_aio_nwait_timeout) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__posix_kaio_stats) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__posix_listio) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__posix_acancel) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__posix_iosuspend) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__posix_kaio_rdwr) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__posix_aio_cntl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__posix_aio_nwait) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_nfs_cntl) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_nfssvc) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_nfs_getfh) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_exportfs) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_lm_svc) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_pw_config) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_pw_post) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_pw_wait) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_pw_loadavg) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_pw_debug) = __NR_AIX5_UNKNOWN;
-
-/* Extras for AIX 5.3 */
-Int VG_(aix5_NR___libc_sbrk) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_thread_waitlock_) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__fp_fpscrx_sc) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_sched_get_priority_max) = __NR_AIX5_UNKNOWN;
-
-/* Extras for AIX 5.3 64-bit mode. */
-Int VG_(aix5_NR_kload) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR__fp_fpscrx64_) = __NR_AIX5_UNKNOWN;
-Int VG_(aix5_NR_kunload64) = __NR_AIX5_UNKNOWN;
-
-/* We need an extra fake syscall to denote signal handler returns, as
-   used in sigframe-ppc{32,64}-aix5.c.  Since we don't know what
-   number we can assign to it, monitor the numbers passed to
-   VG_(aix5_register_syscall), and set it to 10000+the largest syscall
-   nummber seen. */
-Int VG_(aix5_NR_FAKE_SIGRETURN) = __NR_AIX5_UNKNOWN;
-
-
-
-/* Also make a record of the registered syscalls, so we can print the
-   name in bad_before() (syswrap-main.c) if needed.  The obvious
-   approach would be to dump them in an XArray, but that requires
-   dynamic memory allocation, and syscall registration is done before
-   dynamic memory allocation is available.  So just use a fixed size
-   array and hope it doesn't fill up. */
-#define N_BINDINGS 2000
-static Int    bindings_used = 0;
-static Int    bindings_sysno[N_BINDINGS];
-static UChar* bindings_sysname[N_BINDINGS];
-
-Char* VG_(sysnum_string)(Word sysnum, SizeT n_buf, Char* buf)
-{
-   VG_(snprintf)(buf, n_buf, "%3ld", sysnum);
-   return buf;
-}
-
-Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf)
-{
-   Int i;
-   Char* name = "(unknown name)";
-   for (i = 0; i < bindings_used; i++) {
-      if (bindings_sysno[i] == sysnum) {
-         name = bindings_sysname[i];
-         break;
-      }
-   }
-   VG_(snprintf)(buf, n_buf, "%3ld (%s)", sysnum, name);
-   return buf;
-}
-
-static Bool local_streq ( UChar* s1, UChar* s2 ); /* fwds */
-
-Bool VG_(aix5_register_syscall)( Int sysno, UChar* sysname )
-{
-   /* Establish the FAKE_SIGRETURN number. */
-   if (VG_(aix5_NR_FAKE_SIGRETURN) == __NR_AIX5_UNKNOWN)
-      VG_(aix5_NR_FAKE_SIGRETURN) = sysno + 10000;
-   else
-   if (sysno + 10000 > VG_(aix5_NR_FAKE_SIGRETURN))
-      VG_(aix5_NR_FAKE_SIGRETURN) = sysno + 10000;
-
-   /* Note the name, just in case bad_before() needs to complain. */
-   if (bindings_used < N_BINDINGS) {
-      bindings_sysno[bindings_used] = sysno;
-      bindings_sysname[bindings_used] = sysname;
-      bindings_used++;
-   }
-
-   /* Now do the normal name-to-number binding checks. */
-#  define XXX(name)                            \
-      if (local_streq(sysname, #name)) {       \
-         VG_(aix5_NR_##name) = sysno;          \
-         return True;                          \
-      }
-   /* AIX 5.2 */
-   XXX(utrchook_sc)
-   XXX(thread_create)
-   XXX(kfork)
-   XXX(kra_fork)
-   XXX(execve)
-   XXX(ra_execve)
-   XXX(_load)
-   XXX(__unload)
-   XXX(loadbind)
-   XXX(__loadx)
-   XXX(bindprocessor)
-   XXX(trcgent)
-   XXX(trcgen)
-   XXX(trchk)
-   XXX(trchkt)
-   XXX(trchkl)
-   XXX(trchklt)
-   XXX(trchkg)
-   XXX(trchkgt)
-   XXX(kill)
-   XXX(_addcpucosts)
-   XXX(mycpu)
-   XXX(adjtime)
-   XXX(checkpnt_block)
-   XXX(_checkpnt_kill)
-   XXX(_checkpnt_fail)
-   XXX(_checkpnt_commit)
-   XXX(_checkpnt_register)
-   XXX(_checkpnt)
-   XXX(setcrid)
-   XXX(getcrid)
-   XXX(mkcrid)
-   XXX(checkpnt_wait)
-   XXX(checkpnt_deliver)
-   XXX(gencore)
-   XXX(thread_terminate)
-   XXX(_exit)
-   XXX(kwaitpid64)
-   XXX(kwaitpid)
-   XXX(yield)
-   XXX(getprocs64)
-   XXX(getevars)
-   XXX(getargs)
-   XXX(getthrds64)
-   XXX(getthrds)
-   XXX(getprocs)
-   XXX(sigcleanup)
-   XXX(_setpri)
-   XXX(_getpri)
-   XXX(profil)
-   XXX(reboot)
-   XXX(appgetrlimit)
-   XXX(appsetrlimit)
-   XXX(_setpriority)
-   XXX(_getpriority)
-   XXX(setrlimit64)
-   XXX(getrlimit64)
-   XXX(appgetrusage)
-   XXX(getrusage64)
-   XXX(getvtid)
-   XXX(getrtid)
-   XXX(getrpid)
-   XXX(restart_wait)
-   XXX(restart)
-   XXX(_rmcpucosts)
-   XXX(_clock_getcpuclockid)
-   XXX(_clock_settime)
-   XXX(_clock_gettime)
-   XXX(_clock_getres)
-   XXX(_timer_settime)
-   XXX(_timer_gettime)
-   XXX(_timer_getoverrun)
-   XXX(_timer_delete)
-   XXX(_timer_create)
-   XXX(_sigqueue)
-   XXX(_sigsuspend)
-   XXX(_sigaction)
-   XXX(sigprocmask)
-   XXX(siglocalmask)
-   XXX(count_event_waiters)
-   XXX(thread_waitact)
-   XXX(thread_waitlock_local)
-   XXX(thread_waitlock)
-   XXX(thread_wait)
-   XXX(thread_unlock)
-   XXX(thread_twakeup_unlock)
-   XXX(thread_twakeup_event)
-   XXX(thread_twakeup)
-   XXX(thread_tsleep_event)
-   XXX(thread_tsleep_chkpnt)
-   XXX(thread_tsleep)
-   XXX(thread_post_many)
-   XXX(thread_post)
-   XXX(ue_proc_unregister)
-   XXX(ue_proc_register)
-   XXX(kthread_ctl)
-   XXX(_thread_setsched)
-   XXX(threads_runnable)
-   XXX(thread_getregs)
-   XXX(thread_terminate_unlock)
-   XXX(thread_terminate_ack)
-   XXX(thread_setstate_fast)
-   XXX(thread_setstate)
-   XXX(thread_setmymask_fast)
-   XXX(thread_setmystate_fast)
-   XXX(thread_setmystate)
-   XXX(thread_init)
-   XXX(times)
-   XXX(_nsleep)
-   XXX(reltimerid)
-   XXX(appresinc)
-   XXX(apprestimer)
-   XXX(appresabs)
-   XXX(appsettimer)
-   XXX(appgettimer)
-   XXX(gettimerid)
-   XXX(incinterval)
-   XXX(absinterval)
-   XXX(getinterval)
-   XXX(upfget)
-   XXX(_wlm_wait)
-   XXX(_wlm_post)
-   XXX(_wlm_event_init)
-   XXX(_wlm_set_tag)
-   XXX(_wlm_set)
-   XXX(ptrace64)
-   XXX(ptracex)
-   XXX(ptrace)
-   XXX(ksetcontext_sigreturn)
-   XXX(ksetcontext)
-   XXX(kgetcontext)
-   XXX(sigreturn)
-   XXX(_wlm_get_bio_stats)
-   XXX(splice)
-   XXX(rmsock)
-   XXX(nrecvmsg)
-   XXX(socket_aio_dequeue)
-   XXX(getkerninfo)
-   XXX(getpeereid)
-   XXX(getpeername)
-   XXX(ngetpeername)
-   XXX(getsockname)
-   XXX(ngetsockname)
-   XXX(getsockopt)
-   XXX(setsockopt)
-   XXX(shutdown)
-   XXX(recvmsg)
-   XXX(recv)
-   XXX(nrecvfrom)
-   XXX(recvfrom)
-   XXX(nsendmsg)
-   XXX(sendmsg)
-   XXX(send)
-   XXX(sendto)
-   XXX(socketpair)
-   XXX(accept)
-   XXX(naccept)
-   XXX(listen)
-   XXX(bind)
-   XXX(socket)
-   XXX(connext)
-   XXX(setdomainname)
-   XXX(getdomainname)
-   XXX(sethostname)
-   XXX(sethostid)
-   XXX(gethostid)
-   XXX(gethostname)
-   XXX(send_file)
-   XXX(_rmlmbcost)
-   XXX(__rs_pickmcm)
-   XXX(rs_getsystem)
-   XXX(rs_getassociativity)
-   XXX(rs_setpartition)
-   XXX(rs_getpartition)
-   XXX(ra_getrset)
-   XXX(rs_getinfo)
-   XXX(rs_getrad)
-   XXX(rs_numrads)
-   XXX(__kdb_format_print_rele)
-   XXX(__kdb_format_print_init)
-   XXX(close)
-   XXX(kfsync_range)
-   XXX(fsync)
-   XXX(kpwrite)
-   XXX(kwritev)
-   XXX(kwrite)
-   XXX(kpread)
-   XXX(kreadv)
-   XXX(kread)
-   XXX(klseek)
-   XXX(_lseek)
-   XXX(lseek)
-   XXX(_setsid)
-   XXX(_setpgid)
-   XXX(_setpgrp)
-   XXX(_getpgrpx)
-   XXX(_getpgrp)
-   XXX(_getppid)
-   XXX(_thread_self)
-   XXX(_getpid)
-   XXX(kgetpgidx)
-   XXX(setuid)
-   XXX(setuidx)
-   XXX(getuidx)
-   XXX(seteuid)
-   XXX(setreuid)
-   XXX(chdir)
-   XXX(fchdir)
-   XXX(chroot)
-   XXX(fchmod)
-   XXX(chmod)
-   XXX(chown)
-   XXX(lchown)
-   XXX(fchown)
-   XXX(fchownx)
-   XXX(chownx)
-   XXX(kfclear)
-   XXX(fclear)
-   XXX(ffinfo)
-   XXX(finfo)
-   XXX(fscntl)
-   XXX(ktruncate)
-   XXX(kftruncate)
-   XXX(truncate)
-   XXX(ftruncate)
-   XXX(getdirent64)
-   XXX(getdirent)
-   XXX(kioctl32)
-   XXX(kioctl)
-   XXX(link)
-   XXX(klockf)
-   XXX(lockf)
-   XXX(mkdir)
-   XXX(mknod)
-   XXX(mntctl)
-   XXX(vmount)
-   XXX(creat)
-   XXX(openx)
-   XXX(open)
-   XXX(quotactl)
-   XXX(rename)
-   XXX(rmdir)
-   XXX(fstatx)
-   XXX(statx)
-   XXX(symlink)
-   XXX(readlink)
-   XXX(syncvfs)
-   XXX(sync)
-   XXX(umask)
-   XXX(uvmount)
-   XXX(umount)
-   XXX(unameu)
-   XXX(unamex)
-   XXX(uname)
-   XXX(unlink)
-   XXX(ustat)
-   XXX(utimes)
-   XXX(__msgxrcv)
-   XXX(__msgrcv)
-   XXX(__msgsnd)
-   XXX(msgctl)
-   XXX(msgget)
-   XXX(getgidx)
-   XXX(__semop)
-   XXX(semget)
-   XXX(semctl)
-   XXX(shmctl)
-   XXX(shmdt)
-   XXX(shmat)
-   XXX(shmget)
-   XXX(ra_shmgetv)
-   XXX(ra_shmget)
-   XXX(privcheck)
-   XXX(disclaim)
-   XXX(_sem_destroy_unnamed)
-   XXX(_sem_wait)
-   XXX(_sem_close)
-   XXX(_sem_open)
-   XXX(sem_unlink)
-   XXX(sem_post)
-   XXX(sem_init)
-   XXX(sem_getvalue)
-   XXX(sem_destroy)
-   XXX(_mq_notify)
-   XXX(_mq_open)
-   XXX(mq_unlink)
-   XXX(mq_setattr)
-   XXX(mq_send)
-   XXX(mq_receive)
-   XXX(mq_getattr)
-   XXX(mq_close)
-   XXX(shm_unlink)
-   XXX(shm_open)
-   XXX(_poll)
-   XXX(_select)
-   XXX(sysconfig)
-   XXX(sys_parm)
-   XXX(loadquery)
-   XXX(knlist)
-   XXX(brk)
-   XXX(fjfs_sys_call)
-   XXX(jfs_sys_call)
-   XXX(acct)
-   XXX(_dr_unregister)
-   XXX(_dr_notify)
-   XXX(_dr_register)
-   XXX(getlparload)
-   XXX(dr_reconfig)
-   XXX(projctl)
-   XXX(sbrk)
-   XXX(_sigpending)
-   XXX(_pause)
-   XXX(thread_kill)
-   XXX(sigstack)
-   XXX(sigaltstack)
-   XXX(appulimit)
-   XXX(ras_service)
-   XXX(_wlm_class_descr2key)
-   XXX(_wlm_get_procinfo)
-   XXX(_wlm_get_info)
-   XXX(_wlm_getclassname)
-   XXX(_wlm_unload_classes)
-   XXX(_wlm_load)
-   XXX(_wlm_tune)
-   XXX(_wlm_assign)
-   XXX(_wlm_classify)
-   XXX(fp_cpusync)
-   XXX(_fp_trapstate_ker)
-   XXX(_ewlm_classify_correlator)
-   XXX(_arm_stop_transaction)
-   XXX(_arm_destroy_application)
-   XXX(_arm_stop_application)
-   XXX(_arm_generate_correlator)
-   XXX(_arm_discard_transaction)
-   XXX(_arm_unbind_thread)
-   XXX(_arm_bind_thread)
-   XXX(_arm_unblock_transaction)
-   XXX(_arm_block_transaction)
-   XXX(_arm_update_transaction)
-   XXX(_arm_register_metric)
-   XXX(_arm_report_transaction)
-   XXX(_arm_start_transaction)
-   XXX(_arm_register_transaction)
-   XXX(_arm_start_application)
-   XXX(_arm_register_application)
-   XXX(_lsarm_getinfo)
-   XXX(_ewlm_init)
-   XXX(_ewlm_query)
-   XXX(ewlm_verify_policy)
-   XXX(ewlm_abort_policy)
-   XXX(ewlm_commit_policy)
-   XXX(ewlm_prepare_policy)
-   XXX(ewlm_get_completions)
-   XXX(ewlm_get_activedata)
-   XXX(ewlm_get_appldata)
-   XXX(ewlm_collect_samples)
-   XXX(ewlm_disconnect)
-   XXX(ewlm_connect)
-   XXX(auditlog)
-   XXX(auditproc)
-   XXX(getgroups)
-   XXX(setgid)
-   XXX(setgidx)
-   XXX(setgroups)
-   XXX(frevoke)
-   XXX(revoke)
-   XXX(__pag_setvalue)
-   XXX(__pag_getvalue)
-   XXX(__pag_getid)
-   XXX(__pag_getname)
-   XXX(__pag_setname)
-   XXX(kcap_set_proc)
-   XXX(kcap_get_proc)
-   XXX(pipe)
-   XXX(mwakeup)
-   XXX(__msleep)
-   XXX(kmmap)
-   XXX(msem_remove)
-   XXX(mincore)
-   XXX(madvise)
-   XXX(munmap)
-   XXX(msync)
-   XXX(mprotect)
-   XXX(mmap)
-   XXX(swapqry)
-   XXX(swapon)
-   XXX(swapoff)
-   XXX(psdanger)
-   XXX(vmgetinfo)
-   XXX(rs_admregistername)
-   XXX(rs_discardname)
-   XXX(rs_setnameattr)
-   XXX(rs_registername)
-   XXX(rs_getnamedrset)
-   XXX(rs_getnameattr)
-   XXX(rs_getrsetnames)
-   XXX(ra_attachrset)
-   XXX(ra_detachrset)
-   XXX(dmapi_init)
-   XXX(kdm_ioctl)
-   XXX(access)
-   XXX(accessx)
-   XXX(kfcntl)
-   XXX(__pfcntl)
-   XXX(fstatfs64)
-   XXX(statfs64)
-   XXX(fstatfs)
-   XXX(statfs)
-   XXX(probe)
-   XXX(cmp_swap)
-   XXX(_validate_pag)
-   XXX(kgetsidx)
-   XXX(kgetsid)
-   XXX(plock)
-   XXX(upfput)
-   XXX(usrinfo)
-   XXX(audit)
-   XXX(auditobj)
-   XXX(auditbin)
-   XXX(auditevents)
-   XXX(faccessx)
-   XXX(__fchaclx)
-   XXX(__chaclx)
-   XXX(fchacl)
-   XXX(chacl)
-   XXX(__fstataclx)
-   XXX(__stataclx)
-   XXX(fstatacl)
-   XXX(statacl)
-   XXX(setpriv)
-   XXX(getpriv)
-   XXX(fstatpriv)
-   XXX(statpriv)
-   XXX(fchpriv)
-   XXX(chpriv)
-   XXX(i_int2cpu_pal)
-   XXX(hd_cfg)
-   XXX(putpmsg)
-   XXX(putmsg)
-   XXX(getpmsg)
-   XXX(getmsg)
-   XXX(strinfo)
-   XXX(strreset)
-   XXX(dupmsg)
-   XXX(_kgrantpt)
-   XXX(aixgsc)
-   XXX(smaccept)
-   XXX(smconnect)
-   XXX(smlisten)
-   XXX(smbind)
-   XXX(smsocket)
-   XXX(smdetatt)
-   XXX(smattach)
-   XXX(smselect)
-   XXX(smwait)
-   XXX(smsetthresh)
-   XXX(smsendbuff)
-   XXX(smfreebuff)
-   XXX(smrcvbuff)
-   XXX(smgetbuff)
-   XXX(smversion)
-   XXX(smtcheckinit)
-   XXX(aio_nwait_timeout)
-   XXX(kaio_stats)
-   XXX(aio_cntl)
-   XXX(listio)
-   XXX(acancel)
-   XXX(iosuspend)
-   XXX(kaio_rdwr)
-   XXX(aio_nwait)
-   XXX(_posix_iofsync)
-   XXX(_posix_aio_nwait_timeout)
-   XXX(_posix_kaio_stats)
-   XXX(_posix_listio)
-   XXX(_posix_acancel)
-   XXX(_posix_iosuspend)
-   XXX(_posix_kaio_rdwr)
-   XXX(_posix_aio_cntl)
-   XXX(_posix_aio_nwait)
-   XXX(nfs_cntl)
-   XXX(nfssvc)
-   XXX(nfs_getfh)
-   XXX(exportfs)
-   XXX(lm_svc)
-   XXX(pw_config)
-   XXX(pw_post)
-   XXX(pw_wait)
-   XXX(pw_loadavg)
-   XXX(pw_debug)
-   /* Extras for AIX 5.3 */
-   XXX(__libc_sbrk)
-   XXX(thread_waitlock_)
-   XXX(_fp_fpscrx_sc)
-   XXX(sched_get_priority_max)
-   /* Extras for AIX 5.3 64-bit */
-   XXX(kload)
-   XXX(_fp_fpscrx64_)
-   XXX(kunload64)
-#  undef XXX
-   return False;
-}
-
-
-static Bool local_streq ( UChar* s1, UChar* s2 )
-{
-   while (True) {
-      if (*s1 == 0 && *s2 == 0) return True;
-      if (*s1 == 0) return False;
-      if (*s2 == 0) return False;
-      if (*s1 != *s2) return False;
-      s1++; s2++;
-   }
-}
-
-//---------------------------------------------------------------------------
 #elif defined(VGO_darwin)
 //---------------------------------------------------------------------------
 
diff --git a/coregrind/no_op_client_for_valgrind.c b/coregrind/no_op_client_for_valgrind.c
deleted file mode 100644
index 5956607..0000000
--- a/coregrind/no_op_client_for_valgrind.c
+++ /dev/null
@@ -1,16 +0,0 @@
-
-/* This program doesn't do anything.  So why is it here?  It's a
-   helper for ptraced-based launchers (eg aix5).  They can't run 'no
-   program' if the user types "valgrind --help", so they run this
-   do-nothing program.  m_main notices that and turns the exe name
-   back into NULL.  Then --help, --version etc work as they should. */
-
-#include <stdio.h>
-int main ( void )
-{
-  fprintf(stderr, 
-     "This program (part of Valgrind) does nothing except print\n"
-     "this text.  You should not see this text.  If you do, some\n"
-     "part of valgrind's launch mechanism is not working correctly.\n");
-  return 0;
-}
diff --git a/coregrind/pub_core_aspacemgr.h b/coregrind/pub_core_aspacemgr.h
index c93b64a..3b24425 100644
--- a/coregrind/pub_core_aspacemgr.h
+++ b/coregrind/pub_core_aspacemgr.h
@@ -193,51 +193,6 @@
 
 
 //--------------------------------------------------------------
-// Functions pertaining to AIX5-specific notifications.
-
-/* Describes followup actions that need to be done following a call to
-   VG_(am_aix5_reread_procmap).  When acquire==True, the specified
-   code and data segments have been mapped into the process, and so
-   m_debuginfo needs to read info for it; also m_redir needs to know,
-   and the tool needs to be told.  When acquire==False, the specified
-   segments have been unloaded and m_debuginfo, m_redir and the tool
-   (and m_transtab?) need to notified appropriately. */
-typedef
-   struct {
-      Addr   code_start;
-      Word   code_len;
-      Addr   data_start;
-      Word   data_len;
-      UChar* file_name;
-      UChar* mem_name;
-      Bool   is_mainexe;
-      Bool   acquire;
-   }
-   AixCodeSegChange;
-
-/* Tell aspacem that /proc/<pid>/map may have changed (eg following
-   __loadx) and so it should be re-read, and the code/data segment
-   list updated accordingly.  The resulting array of AixCodeChangeSeg
-   directives are written to 'directives', and the number of entries
-   to *ndirectives. */
-extern void VG_(am_aix5_reread_procmap)
-   ( /*OUT*/AixCodeSegChange* directives, /*OUT*/Int* ndirectives );
-
-/* Find out the size of the AixCodeSegChange that must be
-   presented to VG_(am_aix5_reread_procmap). */
-extern Int VG_(am_aix5_reread_procmap_howmany_directives)(void);
-
-/* Tell aspacem where the initial client stack is, so that it
-   can later produce a faked-up NSegment in response to
-   VG_(am_find_nsegment) for athat address, if asked. */
-extern void VG_(am_aix5_set_initial_client_sp)( Addr );
-
-/* The AIX5 aspacem implementation needs to be told when it is and
-   isn't allowed to use sbrk to allocate memory.  Hence: */
-extern Bool VG_(am_aix5_sbrk_allowed);
-
-
-//--------------------------------------------------------------
 // Dealing with mappings which do not arise directly from the
 // simulation of the client.  These are typically used for
 // loading the client and building its stack/data segment, before
diff --git a/coregrind/pub_core_debuginfo.h b/coregrind/pub_core_debuginfo.h
index 330970a..876eac1 100644
--- a/coregrind/pub_core_debuginfo.h
+++ b/coregrind/pub_core_debuginfo.h
@@ -56,7 +56,7 @@
    in later queries to m_debuginfo.  In this case the handle value
    will be one or above.  If the returned value is zero, no debug info
    was read. */
-#if defined(VGO_linux)  ||  defined(VGO_darwin)
+#if defined(VGO_linux) || defined(VGO_darwin)
 extern ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV );
 
 extern void VG_(di_notify_munmap)( Addr a, SizeT len );
@@ -69,28 +69,6 @@
                                           PtrdiffT unknown_purpose__reloc );
 #endif
 
-#if defined(VGO_aix5)
-// GrP fixme use this instead for darwin?
-/* AIX5: Very similar, except packaged more neatly.  The supplied
-   parameters describe a code segment and its associated data segment,
-   that have recently been mapped in -- so we need to read debug info
-   for it -- or conversely, have recently been dumped, in which case
-   the relevant debug info has to be unloaded.
-
-   The returned ULong has the same meaning as documented for
-   VG_(di_notify_mmap) just above. */
-extern ULong VG_(di_aix5_notify_segchange)( 
-                Addr   code_start,
-                Word   code_len,
-                Addr   data_start,
-                Word   data_len,
-                UChar* file_name,
-                UChar* mem_name,
-                Bool   is_mainexe,
-                Bool   acquire
-             );
-#endif
-
 extern void VG_(di_discard_ALL_debuginfo)( void );
 
 /* Like VG_(get_fnname), but it does not do C++ demangling nor Z-demangling
diff --git a/coregrind/pub_core_initimg.h b/coregrind/pub_core_initimg.h
index a351171..864be65 100644
--- a/coregrind/pub_core_initimg.h
+++ b/coregrind/pub_core_initimg.h
@@ -36,8 +36,7 @@
 //--------------------------------------------------------------------
 // PURPOSE: Map the client executable into memory, then set up its
 // stack, environment and data section, ready for execution.  Quite a
-// lot of work on Linux (ELF) but nearly a no-op on AIX (XCOFF) since
-// the AIX kernel does most of the work for us.
+// lot of work on Linux (ELF).
 //--------------------------------------------------------------------
 
 /* These are OS-specific and defined below. */
@@ -88,87 +87,6 @@
    UInt* client_auxv;
 };
 
-
-/* ------------------------- AIX5 ------------------------- */
-
-#elif defined(VGO_aix5)
-
-/* First we need to define this auxiliary structure. */
-typedef
-   struct {
-      /* NOTE: VG_(ppc32/64_aix5_do_preloads_then_start_client) has
-         these offsets hardwired in.  Do not change them without
-         changing it too. */
-      /* system call numbers */
-      /*   0 */ UInt nr_load; /* is __NR___loadx for 32-bit, 
-                                    __NR_kload for 64 */
-      /*   4 */ UInt nr_kwrite;
-      /*   8 */ UInt nr__exit;
-      /* offset/length of error message, if the preloads fail */
-      /*  12 */ UInt off_errmsg;
-      /*  16 */ UInt len_errmsg;
-      /* offsets from start of this struct to the the preload file
-         names */
-      /*  20 */ UInt off_preloadcorename;
-      /*  24 */ UInt off_preloadtoolname;
-      /*  28 */ UInt off_ld_preloadname;
-      /* Once the preloading is done, we'll need to restore the guest
-         state to what it needs to be at client startup.  Here's the
-         relevant info.  Are ULongs; for 32-bit the data is at the
-         lsb (high addressed) end. */
-      /*  32 */ ULong client_start;
-      /*  40 */ ULong r2;
-      /*  48 */ ULong r3;
-      /*  56 */ ULong r4;
-      /*  64 */ ULong r5;
-      /*  72 */ ULong r6;
-      /*  80 */ ULong r7;
-      /*  88 */ ULong r8;
-      /*  96 */ ULong r9;
-      /* 104 */ ULong r10;
-      /* If the loading fails, we'll want to call a diagnostic
-         function in C to figure out what happened.  Here's it's
-         function descriptor.  Note, this runs on the simd cpu
-         (a kludge, and will segfault in 64-bit mode). */
-      /* 112 */ void* p_diagnose_load_failure;
-   }
-   AIX5PreloadPage;
-
-struct _IICreateImageInfo {
-   /* ------ Mandatory fields ------ */
-   HChar* toolname; 
-   Addr   sp_at_startup; /* Not used on AIX. */
-   Addr   clstack_top;   /* Not used on AIX. */
-   /* ------ Per-OS fields ------ */
-   /* Initial values for guest int registers (GPR0 .. GPR31, PC, CR,
-      LR, CTR, XER).  Passed to us from the launcher. */
-   ULong* intregs37;
-   /* AIX5Bootblock*, really */
-   void* bootblock;
-   /* Adler32 checksum of uncompressed data of compressed page. */
-   UInt adler32_exp;
-};
-
-struct _IIFinaliseImageInfo {
-   /* ------ Mandatory fields ------ */
-   SizeT clstack_max_size;
-   /* Initial value for SP (which is merely a copy of r1's value,
-      intregs37[1]). */
-   Addr initial_client_SP;
-   /* ------ Per-OS fields ------ */
-   /* Pointer to the preload page.  The preload page and this pointer
-      to it are set up by VG_(ii_create_image). */
-   AIX5PreloadPage* preloadpage;
-   /* Initial values for guest int registers (GPR0 .. GPR31, PC,
-      CR, LR, CTR, XER).  Copied from the CII. */
-   ULong* intregs37;
-   /* Address of the page compressed by the launcher. */
-   Addr compressed_page;
-   /* Adler32 checksum of uncompressed data of said page. */
-   UInt adler32_exp;
-};
-
-
 /* ------------------------- Darwin ------------------------- */
 
 #elif defined(VGO_darwin)
diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h
index ba8ed8b..9cfaab2 100644
--- a/coregrind/pub_core_libcfile.h
+++ b/coregrind/pub_core_libcfile.h
@@ -78,10 +78,10 @@
 extern Int VG_(check_executable)(/*OUT*/Bool* is_setuid,
                                  const HChar* f, Bool allow_setuid);
 
-/* DDD: Note this moves (or at least, is believed to move) the file pointer
-   on Linux and AIX5 but doesn't on Darwin.  This inconsistency should
-   be fixed.  (In other words, why isn't the Linux/AIX5 version implemented in
-   terms of pread()?) */
+/* DDD: Note this moves (or at least, is believed to move) the file
+   pointer on Linux but doesn't on Darwin.  This inconsistency should
+   be fixed.  (In other words, why isn't the Linux version implemented
+   in terms of pread()?) */
 extern SysRes VG_(pread) ( Int fd, void* buf, Int count, OffT offset );
 
 /* Create and open (-rw------) a tmp file name incorporating said arg.
diff --git a/coregrind/pub_core_libcsignal.h b/coregrind/pub_core_libcsignal.h
index d82eb36..8862b01 100644
--- a/coregrind/pub_core_libcsignal.h
+++ b/coregrind/pub_core_libcsignal.h
@@ -68,8 +68,8 @@
                               vki_sigaction_fromK_t* oldact );
 
 /* Convert a sigaction which you got from the kernel (a _fromK_t) to
-   one which you can give back to the kernel (a _toK_t).  On Linux and
-   AIX, vki_sigaction_{toK,fromK}_t are identical, so this is a no-op
+   one which you can give back to the kernel (a _toK_t).  On Linux,
+   vki_sigaction_{toK,fromK}_t are identical, so this is a no-op
    (structure copy), but on Darwin it's not a no-op. */
 extern void VG_(convert_sigaction_fromK_to_toK)(
                vki_sigaction_fromK_t*, /*OUT*/vki_sigaction_toK_t*);
diff --git a/coregrind/pub_core_machine.h b/coregrind/pub_core_machine.h
index 2043a52..4261b88 100644
--- a/coregrind/pub_core_machine.h
+++ b/coregrind/pub_core_machine.h
@@ -65,11 +65,6 @@
 #  define VG_ELF_MACHINE      EM_ARM
 #  define VG_ELF_CLASS        ELFCLASS32
 #  undef  VG_PLAT_USES_PPCTOC
-#elif defined(VGO_aix5)
-#  undef  VG_ELF_DATA2XXX
-#  undef  VG_ELF_MACHINE
-#  undef  VG_ELF_CLASS
-#  define VG_PLAT_USES_PPCTOC 1
 #elif defined(VGO_darwin)
 #  undef  VG_ELF_DATA2XXX
 #  undef  VG_ELF_MACHINE
diff --git a/coregrind/pub_core_mallocfree.h b/coregrind/pub_core_mallocfree.h
index 1af76ec..1d32abf 100644
--- a/coregrind/pub_core_mallocfree.h
+++ b/coregrind/pub_core_mallocfree.h
@@ -80,8 +80,6 @@
       defined(VGP_ppc32_linux) || \
       defined(VGP_ppc64_linux) || \
       defined(VGP_s390x_linux) || \
-      defined(VGP_ppc64_aix5)  || \
-      defined(VGP_ppc32_aix5)  || \
       defined(VGP_x86_darwin)  || \
       defined(VGP_amd64_darwin)
 #  define VG_MIN_MALLOC_SZB       16
diff --git a/coregrind/pub_core_syscall.h b/coregrind/pub_core_syscall.h
index 7a79905..1e1bbbc 100644
--- a/coregrind/pub_core_syscall.h
+++ b/coregrind/pub_core_syscall.h
@@ -74,8 +74,6 @@
 extern SysRes VG_(mk_SysRes_ppc32_linux) ( UInt  val, UInt  cr0so );
 extern SysRes VG_(mk_SysRes_ppc64_linux) ( ULong val, ULong cr0so );
 extern SysRes VG_(mk_SysRes_arm_linux)   ( Int val );
-extern SysRes VG_(mk_SysRes_ppc32_aix5)  ( UInt val, UInt err );
-extern SysRes VG_(mk_SysRes_ppc64_aix5)  ( ULong val, ULong err );
 extern SysRes VG_(mk_SysRes_x86_darwin)  ( UChar scclass, Bool isErr,
                                            UInt wHI, UInt wLO );
 extern SysRes VG_(mk_SysRes_amd64_darwin)( UChar scclass, Bool isErr,
diff --git a/coregrind/pub_core_threadstate.h b/coregrind/pub_core_threadstate.h
index ebfc907..ba9404c 100644
--- a/coregrind/pub_core_threadstate.h
+++ b/coregrind/pub_core_threadstate.h
@@ -140,20 +140,6 @@
       Word exitcode; // in the case of exitgroup, set by someone else
       Int  fatalsig; // fatal signal
 
-#     if defined(VGO_aix5)
-      /* AIX specific fields to make thread cancellation sort-of work */
-      /* What is this thread's current cancellation state a la
-         POSIX (deferred vs async, enable vs disabled) ? */
-      Bool cancel_async;   // current cancel mode (async vs deferred)
-      Bool cancel_disabled; // cancellation disabled?
-      /* What's happened so far? */
-      enum { Canc_NoRequest=0, // no cancellation requested
-             Canc_Requested=1, // requested but not actioned
-             Canc_Actioned=2 } // requested and actioned
-           cancel_progress;
-      /* Initial state is False, False, Canc_Normal. */
-#     endif
-
 #     if defined(VGO_darwin)
       // Mach trap POST handler as chosen by PRE
       void (*post_mach_trap_fn)(ThreadId tid,
diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h
index aee983c..8acde4f 100644
--- a/coregrind/pub_core_trampoline.h
+++ b/coregrind/pub_core_trampoline.h
@@ -84,11 +84,11 @@
 extern void* VG_(ppc64_linux_REDIR_FOR_strchr)( void*, Int );
 /* A label (sans dot) marking the ultra-magical return stub via which
    all redirected and wrapped functions are made to "return" on
-   ppc64-linux/ppc64-aix5/ppc32-aix5.  The one insn at this label is
-   never really translated.  Instead, m_translate generates IR to
-   restore the thread's LR and R2 registers from a small stack in the
-   ppc64 guest state structure, and then branch to LR.  Convoluted?
-   Confusing?  You betcha.  Could I think of anything simpler?  No. */
+   ppc64-linux.  The one insn at this label is never really
+   translated.  Instead, m_translate generates IR to restore the
+   thread's LR and R2 registers from a small stack in the ppc64 guest
+   state structure, and then branch to LR.  Convoluted?  Confusing?
+   You betcha.  Could I think of anything simpler?  No. */
 extern Addr VG_(ppctoc_magic_redirect_return_stub);
 #endif
 
@@ -98,28 +98,6 @@
 extern void* VG_(arm_linux_REDIR_FOR_memcpy)( void*, void*, Int );
 #endif
 
-#if defined(VGP_ppc32_aix5)
-/* A label (sans dot) marking the client start point for ppc32_aix5.
-   This function is entered with r3 holding a pointer to the
-   AIX5PreloadPage struct set up by m_initimg.  It first tries to
-   __loadx the _core.so and _tool.so preloads mentioned in the struct;
-   then it cleans up the register state to be more what it really
-   should be at client startup, and finally it jumps to the client's
-   real entry point. */
-extern Addr VG_(ppc32_aix5_do_preloads_then_start_client);
-
-/* See comment for VG_(ppctoc_magic_redirect_return_stub) above. */
-extern Addr VG_(ppctoc_magic_redirect_return_stub);
-#endif
-
-#if defined(VGP_ppc64_aix5)
-/* See comment for VG_(ppctoc_magic_redirect_return_stub) above. */
-extern Addr VG_(ppctoc_magic_redirect_return_stub);
-
-/* See comment for ppc32_aix5 equivalent above. */
-extern Addr VG_(ppc64_aix5_do_preloads_then_start_client);
-#endif
-
 #if defined(VGP_x86_darwin)
 extern Addr  VG_(x86_darwin_SUBST_FOR_sigreturn);
 extern SizeT VG_(x86_darwin_REDIR_FOR_strlen)( void* );
diff --git a/coregrind/pub_core_vkiscnums.h b/coregrind/pub_core_vkiscnums.h
index 743257c..3e1fbf2 100644
--- a/coregrind/pub_core_vkiscnums.h
+++ b/coregrind/pub_core_vkiscnums.h
@@ -43,12 +43,6 @@
 // __NR_name, and this file must contain nothing else, since it will
 // be included in assembly code (m_trampoline.S).
 //
-// On AIX the __NR_name consts are renamings of global variables which
-// tell us the number for each syscall.  This elaboration is necessary
-// because on AIX the syscall numbers are not constant; they can be
-// different for each process (in principle; in practice they rarely
-// change).  32- and 64-bit AIX5 share a common "implementation".
-//
 // On Darwin the __NR_name consts are #define'd constants which are
 // encoded using various macros.  32- and 64-bit Darwin share a common
 // "implementation" also.
@@ -66,22 +60,6 @@
 #include "pub_core_vkiscnums_asm.h"
 #include "pub_tool_vkiscnums.h"
 
-
-#if defined(VGO_linux)
-   // Nothing
-
-#elif defined(VGO_aix5)
-/* Bind the given syscall name to the given number.  Returns True if
-   successful, False if the name is unknown. */
-extern Bool VG_(aix5_register_syscall)( Int, UChar* );
-
-#elif defined(VGO_darwin)
-   // Nothing
-
-#else
-#  error Unknown OS
-#endif
-
 #endif // __PUB_CORE_VKISCNUMS_H
 
 /*--------------------------------------------------------------------*/
diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c
index 0943b9a..baee203 100644
--- a/coregrind/vg_preloaded.c
+++ b/coregrind/vg_preloaded.c
@@ -47,7 +47,7 @@
 #include "pub_core_debuginfo.h"  // Needed for pub_core_redir.h
 #include "pub_core_redir.h"      // For VG_NOTIFY_ON_LOAD
 
-#if defined(VGO_linux) || defined(VGO_aix5)
+#if defined(VGO_linux)
 
 /* ---------------------------------------------------------------------
    Hook for running __libc_freeres once the program exits.
@@ -56,7 +56,7 @@
 void VG_NOTIFY_ON_LOAD(freeres)( void );
 void VG_NOTIFY_ON_LOAD(freeres)( void )
 {
-#if !defined(__UCLIBC__) && !defined(VGO_aix5)
+#if !defined(__UCLIBC__)
    extern void __libc_freeres(void);
    __libc_freeres();
 #endif
diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml
index c2d67e4..de0d333 100644
--- a/docs/xml/manual-core.xml
+++ b/docs/xml/manual-core.xml
@@ -1376,8 +1376,7 @@
 
       <para>On Linux, you may request a stack of size up to 2GB.
       Valgrind will stop with a diagnostic message if the stack cannot
-      be allocated.  On AIX5 the allowed stack size is restricted to
-      128MB.</para>
+      be allocated.</para>
 
       <para><option>--main-stacksize</option> only affects the stack
       size for the program's initial thread.  It has no bearing on the
diff --git a/drd/tests/unit_bitmap.c b/drd/tests/unit_bitmap.c
index 236cf06..e48d238 100644
--- a/drd/tests/unit_bitmap.c
+++ b/drd/tests/unit_bitmap.c
@@ -73,7 +73,7 @@
     {               0x00ffffffULL, 1, eLoad  },
     { 0xffffffffULL - (((1 << ADDR_LSB_BITS) + 1) << ADDR_IGNORED_BITS),
                                    1, eStore },
-#if defined(VGP_amd64_linux) || defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
+#if defined(VGP_amd64_linux) || defined(VGP_ppc64_linux)
     { 0xffffffffULL - (1 << ADDR_LSB_BITS << ADDR_IGNORED_BITS),
                                    1, eStore },
     {               0xffffffffULL, 1, eStore },
diff --git a/exp-sgcheck/tests/Makefile.am b/exp-sgcheck/tests/Makefile.am
index fc74c91..74a0e57 100644
--- a/exp-sgcheck/tests/Makefile.am
+++ b/exp-sgcheck/tests/Makefile.am
@@ -47,14 +47,6 @@
 
 # Build shared object for preen_invars
 preen_invars_DEPENDENCIES      = preen_invars_so.so
-if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5 
- preen_invars_LDADD            = -ldl
- preen_invars_LDFLAGS          = $(AM_FLAG_M3264_PRI)
-else
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
- preen_invars_LDADD            = -ldl
- preen_invars_LDFLAGS          = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
-else
 if VGCONF_OS_IS_DARWIN
  preen_invars_LDADD            = -ldl
  preen_invars_LDFLAGS          = $(AM_FLAG_M3264_PRI)
@@ -63,18 +55,9 @@
  preen_invars_LDFLAGS          = $(AM_FLAG_M3264_PRI) \
 				-Wl,-rpath,$(top_builddir)/memcheck/tests
 endif
-endif
-endif
 
 preen_invars_so_so_SOURCES      = preen_invars_so.c	# For automake-1.7.
 preen_invars_so_so_CFLAGS       = $(AM_CFLAGS) -fpic
-if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
- preen_invars_so_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -shared
-else
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
- preen_invars_so_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -shared \
-					-Wl,-G -Wl,-bnogc
-else
 if VGCONF_OS_IS_DARWIN
  preen_invars_so_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -dynamic \
 					-dynamiclib -all_load
@@ -82,6 +65,4 @@
  preen_invars_so_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -shared \
 					-Wl,-soname -Wl,preen_invars_so.so
 endif
-endif
-endif
 
diff --git a/helgrind/tests/tc07_hbl1.c b/helgrind/tests/tc07_hbl1.c
index 2834c5d..e5b11c4 100644
--- a/helgrind/tests/tc07_hbl1.c
+++ b/helgrind/tests/tc07_hbl1.c
@@ -6,8 +6,6 @@
 /* Simple test program, no race.  Parent and child both modify x and
    use the hardware bus lock. */
 
-#undef PLAT_ppc64_aix5
-#undef PLAT_ppc32_aix5
 #undef PLAT_x86_darwin
 #undef PLAT_amd64_darwin
 #undef PLAT_x86_linux
@@ -17,11 +15,7 @@
 #undef PLAT_arm_linux
 #undef PLAT_s390x_linux
 
-#if defined(_AIX) && defined(__64BIT__)
-#  define PLAT_ppc64_aix5 1
-#elif defined(_AIX) && !defined(__64BIT__)
-#  define PLAT_ppc32_aix5 1
-#elif defined(__APPLE__) && defined(__i386__)
+#if defined(__APPLE__) && defined(__i386__)
 #  define PLAT_x86_darwin 1
 #elif defined(__APPLE__) && defined(__x86_64__)
 #  define PLAT_amd64_darwin 1
@@ -44,8 +38,7 @@
 #  define INC(_lval,_lqual) \
       __asm__ __volatile__ ( \
       "lock ; incl (%0)" : /*out*/ : /*in*/"r"(&(_lval)) : "memory", "cc" )
-#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
-      || defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5)
+#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux)
 #  define INC(_lval,_lqual)               \
    __asm__ __volatile__(                  \
       "1:\n"                              \
diff --git a/helgrind/tests/tc08_hbl2.c b/helgrind/tests/tc08_hbl2.c
index 7821cde..9c05e38 100644
--- a/helgrind/tests/tc08_hbl2.c
+++ b/helgrind/tests/tc08_hbl2.c
@@ -22,8 +22,6 @@
    child joins back to parent.  Parent (writer) uses hardware bus lock;
    child is only reading and so does not need to use a bus lock. */
 
-#undef PLAT_ppc64_aix5
-#undef PLAT_ppc32_aix5
 #undef PLAT_x86_darwin
 #undef PLAT_amd64_darwin
 #undef PLAT_x86_linux
@@ -33,11 +31,7 @@
 #undef PLAT_arm_linux
 #undef PLAT_s390x_linux
 
-#if defined(_AIX) && defined(__64BIT__)
-#  define PLAT_ppc64_aix5 1
-#elif defined(_AIX) && !defined(__64BIT__)
-#  define PLAT_ppc32_aix5 1
-#elif defined(__APPLE__) && defined(__i386__)
+#if defined(__APPLE__) && defined(__i386__)
 #  define PLAT_x86_darwin 1
 #elif defined(__APPLE__) && defined(__x86_64__)
 #  define PLAT_amd64_darwin 1
@@ -61,8 +55,7 @@
 #  define INC(_lval,_lqual)	     \
       __asm__ __volatile__ ( \
       "lock ; incl (%0)" : /*out*/ : /*in*/"r"(&(_lval)) : "memory", "cc" )
-#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
-      || defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5)
+#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux)
 #  define INC(_lval,_lqual)		  \
    __asm__ __volatile__(                  \
       "1:\n"                              \
diff --git a/helgrind/tests/tc11_XCHG.c b/helgrind/tests/tc11_XCHG.c
index 584d896..f7fe47f 100644
--- a/helgrind/tests/tc11_XCHG.c
+++ b/helgrind/tests/tc11_XCHG.c
@@ -9,8 +9,6 @@
    use the hardware bus lock (implicitly, since XCHG r,m on x86/amd64
    does not require an explicit LOCK prefix.). */
 
-#undef PLAT_ppc64_aix5
-#undef PLAT_ppc32_aix5
 #undef PLAT_x86_darwin
 #undef PLAT_amd64_darwin
 #undef PLAT_x86_linux
@@ -20,11 +18,7 @@
 #undef PLAT_arm_linux
 #undef PLAT_s390x_linux
 
-#if defined(_AIX) && defined(__64BIT__)
-#  define PLAT_ppc64_aix5 1
-#elif defined(_AIX) && !defined(__64BIT__)
-#  define PLAT_ppc32_aix5 1
-#elif defined(__APPLE__) && defined(__i386__)
+#if defined(__APPLE__) && defined(__i386__)
 #  define PLAT_x86_darwin 1
 #elif defined(__APPLE__) && defined(__x86_64__)
 #  define PLAT_amd64_darwin 1
@@ -61,7 +55,6 @@
      )
 
 #elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
-      || defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5) \
       || defined(PLAT_arm_linux) || defined(PLAT_s390x_linux)
 #  if defined(HAVE_BUILTIN_ATOMIC)
 #    define XCHG_M_R(_addr,_lval)                                           \
diff --git a/helgrind/tests/tc19_shadowmem.c b/helgrind/tests/tc19_shadowmem.c
index ec05061..99cb501 100644
--- a/helgrind/tests/tc19_shadowmem.c
+++ b/helgrind/tests/tc19_shadowmem.c
@@ -2287,5 +2287,5 @@
    if (wot == 999) return fn(info);
    __asm__ __volatile__("");
    assert(0);
-   return 0; /* keep gcc happy on AIX */
+   /*NOTREACHED*/return 0;
 }
diff --git a/helgrind/tests/tc20_verifywrap.c b/helgrind/tests/tc20_verifywrap.c
index 6a8b30c..e370895 100644
--- a/helgrind/tests/tc20_verifywrap.c
+++ b/helgrind/tests/tc20_verifywrap.c
@@ -18,7 +18,7 @@
 #include <pthread.h>
 #include <semaphore.h>
 
-#if !defined(_AIX) && !defined(__APPLE__)
+#if !defined(__APPLE__)
 
 #if !defined(__GLIBC_PREREQ)
 # error "This program needs __GLIBC_PREREQ (in /usr/include/features.h)"
@@ -261,10 +261,10 @@
    return 0;
 }
 
-#else /* defined(_AIX) */
+#else /* defined(__APPLE__) */
 int main ( void )
 {
-   fprintf(stderr, "This program does not work on AIX.\n");
+   fprintf(stderr, "This program does not work on Mac OS X.\n");
    return 0;
 }
 #endif
diff --git a/include/Makefile.am b/include/Makefile.am
index faa3c3a..9f3f4a0 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -60,9 +60,3 @@
 	vki/vki-scnums-arm-linux.h	\
 	vki/vki-scnums-s390x-linux.h	\
 	vki/vki-scnums-darwin.h
-
-noinst_HEADERS = \
-	vki/vki-ppc32-aix5.h		\
-	vki/vki-ppc64-aix5.h		\
-	vki/vki-scnums-aix5.h
-
diff --git a/include/pub_tool_basics.h b/include/pub_tool_basics.h
index 5868d9a..4e75496 100644
--- a/include/pub_tool_basics.h
+++ b/include/pub_tool_basics.h
@@ -109,9 +109,9 @@
 // - off_t is "used for file sizes".
 // At one point we were using it for memory offsets, but PtrdiffT should be
 // used in those cases.
-// Nb: on Linux and AIX, off_t is a signed word-sized int.  On Darwin it's
+// Nb: on Linux, off_t is a signed word-sized int.  On Darwin it's
 // always a signed 64-bit int.  So we defined our own Off64T as well.
-#if defined(VGO_linux) || defined(VGO_aix5)
+#if defined(VGO_linux)
 typedef Word                   OffT;      // 32             64
 #elif defined(VGO_darwin)
 typedef Long                   OffT;      // 64             64
@@ -145,20 +145,6 @@
       When _isError == True,  
          _err holds the error code.
 
-   AIX:
-      _res is the POSIX result of the syscall.
-      _err is the corresponding errno value.
-      _isError === _err==0
-
-      Unlike on Linux, it is possible for _err to be nonzero (thus an
-      error has occurred), nevertheless _res is also nonzero.  AIX
-      userspace does not appear to consistently inspect _err to
-      determine whether or not an error has occurred.  For example,
-      sys_open() will return -1 for _val if a file cannot be opened,
-      as well as the relevant errno value in _err, but AIX userspace
-      then consults _val to figure out if the syscall failed, rather
-      than looking at _err.  Hence we need to represent them both.
-
    Darwin:
       Interpretation depends on _mode:
       MACH, MDEP:
@@ -180,14 +166,6 @@
       Bool  _isError;
    }
    SysRes;
-#elif defined(VGO_aix5)
-typedef
-   struct {
-      UWord _res;
-      UWord _err;
-      Bool  _isError;
-   }
-   SysRes;
 #elif defined(VGO_darwin)
 typedef
    enum { 
@@ -231,10 +209,6 @@
               || (!sr1._isError && !sr2._isError));
 }
 
-#elif defined(VGO_aix5)
-#  error "need to define SysRes accessors on AIX5 (copy from 3.4.1 sources)"
-
-
 #elif defined(VGO_darwin)
 
 static inline Bool sr_isError ( SysRes sr ) {
diff --git a/include/pub_tool_basics_asm.h b/include/pub_tool_basics_asm.h
index 84582af..57a9d2d 100644
--- a/include/pub_tool_basics_asm.h
+++ b/include/pub_tool_basics_asm.h
@@ -48,7 +48,7 @@
 
 #define VGAPPEND(str1,str2) str1##str2
  
-#if defined(VGO_linux) || defined(VGO_aix5)
+#if defined(VGO_linux)
 #  define VG_(str)    VGAPPEND( vgPlain_,          str)
 #  define ML_(str)    VGAPPEND( vgModuleLocal_,    str)
 #elif defined(VGO_darwin)
diff --git a/include/pub_tool_machine.h b/include/pub_tool_machine.h
index 062c2ea..7a957c1 100644
--- a/include/pub_tool_machine.h
+++ b/include/pub_tool_machine.h
@@ -64,23 +64,6 @@
 #  define VG_CLREQ_SZB             20
 #  define VG_STACK_REDZONE_SZB      0
 
-#elif defined(VGP_ppc32_aix5)
-#  define VG_MIN_INSTR_SZB          4
-#  define VG_MAX_INSTR_SZB          4 
-#  define VG_CLREQ_SZB             20
-   /* The PowerOpen ABI actually says 220 bytes, but that is not an
-      8-aligned number, and frequently forces Memcheck's
-      mc_{new,die}_mem_stack_N routines into slow cases by losing
-      8-alignment of the area to be messed with.  So let's just say
-      224 instead.  Gdb has a similar kludge. */
-#  define VG_STACK_REDZONE_SZB    224
-
-#elif defined(VGP_ppc64_aix5)
-#  define VG_MIN_INSTR_SZB          4
-#  define VG_MAX_INSTR_SZB          4 
-#  define VG_CLREQ_SZB             20
-#  define VG_STACK_REDZONE_SZB    288 // is this right?
-
 #elif defined(VGP_s390x_linux)
 #  define VG_MIN_INSTR_SZB          2
 #  define VG_MAX_INSTR_SZB          6
diff --git a/include/pub_tool_redir.h b/include/pub_tool_redir.h
index 0631ac4..7360de1 100644
--- a/include/pub_tool_redir.h
+++ b/include/pub_tool_redir.h
@@ -174,11 +174,6 @@
 
 #if defined(VGO_linux)
 #  define  VG_Z_LIBC_SONAME  libcZdsoZa              // libc.so*
-#elif defined(VGP_ppc32_aix5)
-   /* AIX has both /usr/lib/libc.a and /usr/lib/libc_r.a. */
-#  define  VG_Z_LIBC_SONAME  libcZaZdaZLshrZdoZR     // libc*.a(shr.o)
-#elif defined(VGP_ppc64_aix5)
-#  define  VG_Z_LIBC_SONAME  libcZaZdaZLshrZu64ZdoZR // libc*.a(shr_64.o)
 #elif defined(VGO_darwin)
 #  define  VG_Z_LIBC_SONAME  libSystemZdZaZddylib    // libSystem.*.dylib
 #else
@@ -190,20 +185,9 @@
 // Valid on all platforms(?)
 #define  VG_Z_LIBSTDCXX_SONAME  libstdcZpZpZa           // libstdc++*
 
-/* --- Soname of XLC's C++ library. --- */
-
-/* AIX: xlC's C++ runtime library is called libC.a, and the
-   interesting symbols appear to be in ansicore_32.o or ansicore_64.o
-   respectively. */
-#if defined(VGP_ppc32_aix5)
-#  define  VG_Z_LIBC_DOT_A   libCZdaZLansicoreZu32ZdoZR // libC.a(ansicore_32.o)
-#elif defined(VGP_ppc64_aix5)
-#  define  VG_Z_LIBC_DOT_A   libCZdaZLansicoreZu64ZdoZR // libC.a(ansicore_64.o)
-#endif
-
 /* --- Soname of the pthreads library. --- */
 
-#if defined(VGO_linux) || defined(VGO_aix5)
+#if defined(VGO_linux)
 #  define  VG_Z_LIBPTHREAD_SONAME  libpthreadZdsoZd0     // libpthread.so.0
 #elif defined(VGO_darwin)
 #  define  VG_Z_LIBPTHREAD_SONAME  libSystemZdZaZddylib  // libSystem.*.dylib
diff --git a/include/pub_tool_vki.h b/include/pub_tool_vki.h
index 73a4174..4657d5d 100644
--- a/include/pub_tool_vki.h
+++ b/include/pub_tool_vki.h
@@ -47,10 +47,6 @@
 
 #if defined(VGO_linux)
 #  include "vki/vki-linux.h"
-#elif defined(VGP_ppc32_aix5)
-#  include "vki/vki-ppc32-aix5.h"
-#elif defined(VGP_ppc64_aix5)
-#  include "vki/vki-ppc64-aix5.h"
 #elif defined(VGO_darwin)
 #  include "vki/vki-darwin.h"
 #else
diff --git a/include/pub_tool_vkiscnums.h b/include/pub_tool_vkiscnums.h
index b8b5e88..e9d6261 100644
--- a/include/pub_tool_vkiscnums.h
+++ b/include/pub_tool_vkiscnums.h
@@ -37,7 +37,7 @@
 
 
 // This converts a syscall number into a string, suitable for printing.  It is
-// needed because some platforms (AIX, Darwin) munge sysnums in various ways.
+// needed because some platforms (Darwin) munge sysnums in various ways.
 // It is used in places where the sycall name will be printed alongside.
 extern Char* VG_(sysnum_string)      (Word sysnum, SizeT n_buf, Char* buf);
 
@@ -53,21 +53,6 @@
    ({ Char qq_zz_buf[64]; VG_(sysnum_string_extra)(sysnum, 64, qq_zz_buf); })
 
 
-#if defined(VGO_linux)
-   // Nothing.
-
-#elif defined(VGO_aix5)
-   // See the AIX5-specific case in pub_tool_vkiscnums_asm.h for an
-   // explanation of why we include this here rather than there.
-#  include "vki/vki-scnums-aix5.h"
-
-#elif defined(VGO_darwin)
-   // Nothing.
-
-#else
-#  error Unknown OS
-#endif
-
 #endif   // __PUB_TOOL_VKISCNUMS_H
 
 /*--------------------------------------------------------------------*/
diff --git a/include/pub_tool_vkiscnums_asm.h b/include/pub_tool_vkiscnums_asm.h
index e31347c..8af4141 100644
--- a/include/pub_tool_vkiscnums_asm.h
+++ b/include/pub_tool_vkiscnums_asm.h
@@ -51,12 +51,6 @@
 #elif defined(VGP_arm_linux)
 #  include "vki/vki-scnums-arm-linux.h"
 
-#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   // Nothing:  vki-scnums-aix5.h only contains stuff suitable for inclusion
-   // in C files, not asm files.  So unlike all the other
-   // vki-scnums-PLATFORM.h files, we include it in pub_tool_vkiscnums.h
-   // rather than in include/pub_tool_vkiscnums_asm.h.
-
 #elif defined(VGP_x86_darwin) || defined(VGP_amd64_darwin)
 #  include "vki/vki-scnums-darwin.h"
 
diff --git a/include/valgrind.h b/include/valgrind.h
index 0b5dc5b..da3b8a1 100644
--- a/include/valgrind.h
+++ b/include/valgrind.h
@@ -108,8 +108,6 @@
    Misc note: how to find out what's predefined in gcc by default:
    gcc -Wp,-dM somefile.c
 */
-#undef PLAT_ppc64_aix5
-#undef PLAT_ppc32_aix5
 #undef PLAT_x86_darwin
 #undef PLAT_amd64_darwin
 #undef PLAT_x86_win32
@@ -121,15 +119,12 @@
 #undef PLAT_s390x_linux
 
 
-#if defined(_AIX) && defined(__64BIT__)
-#  define PLAT_ppc64_aix5 1
-#elif defined(_AIX) && !defined(__64BIT__)
-#  define PLAT_ppc32_aix5 1
-#elif defined(__APPLE__) && defined(__i386__)
+#if defined(__APPLE__) && defined(__i386__)
 #  define PLAT_x86_darwin 1
 #elif defined(__APPLE__) && defined(__x86_64__)
 #  define PLAT_amd64_darwin 1
-#elif defined(__MINGW32__) || defined(__CYGWIN32__) || defined(_WIN32) && defined(_M_IX86)
+#elif defined(__MINGW32__) || defined(__CYGWIN32__) \
+      || (defined(_WIN32) && defined(_M_IX86))
 #  define PLAT_x86_win32 1
 #elif defined(__linux__) && defined(__i386__)
 #  define PLAT_x86_linux 1
@@ -585,152 +580,6 @@
 
 #endif /* PLAT_arm_linux */
 
-/* ------------------------ ppc32-aix5 ------------------------- */
-
-#if defined(PLAT_ppc32_aix5)
-
-typedef
-   struct { 
-      unsigned int nraddr; /* where's the code? */
-      unsigned int r2;  /* what tocptr do we need? */
-   }
-   OrigFn;
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "rlwinm 0,0,3,0,0  ; rlwinm 0,0,13,0,0\n\t"  \
-                     "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
-        _zzq_default, _zzq_request,                               \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-                                                                  \
-  __extension__                                                   \
-  ({         unsigned int  _zzq_args[7];                          \
-    register unsigned int  _zzq_result;                           \
-    register unsigned int* _zzq_ptr;                              \
-    _zzq_args[0] = (unsigned int)(_zzq_request);                  \
-    _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \
-    _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \
-    _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \
-    _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \
-    _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \
-    _zzq_args[6] = (unsigned int)(_zzq_default);                  \
-    _zzq_ptr = _zzq_args;                                         \
-    __asm__ volatile("mr 4,%1\n\t"                                \
-                     "lwz 3, 24(4)\n\t"                           \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = client_request ( %R4 ) */           \
-                     "or 1,1,1\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (_zzq_result)                         \
-                     : "b" (_zzq_ptr)                             \
-                     : "r3", "r4", "cc", "memory");               \
-    _zzq_result;                                                  \
-  })
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    register unsigned int __addr;                                 \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR */                     \
-                     "or 2,2,2\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->nraddr = __addr;                                   \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR_GPR2 */                \
-                     "or 4,4,4\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->r2 = __addr;                                       \
-  }
-
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* branch-and-link-to-noredir *%R11 */       \
-                     "or 3,3,3\n\t"
-
-#endif /* PLAT_ppc32_aix5 */
-
-/* ------------------------ ppc64-aix5 ------------------------- */
-
-#if defined(PLAT_ppc64_aix5)
-
-typedef
-   struct { 
-      unsigned long long int nraddr; /* where's the code? */
-      unsigned long long int r2;  /* what tocptr do we need? */
-   }
-   OrigFn;
-
-#define __SPECIAL_INSTRUCTION_PREAMBLE                            \
-                     "rotldi 0,0,3  ; rotldi 0,0,13\n\t"          \
-                     "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
-
-#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \
-        _zzq_default, _zzq_request,                               \
-        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \
-                                                                  \
-  __extension__                                                   \
-  ({         unsigned long long int  _zzq_args[7];                \
-    register unsigned long long int  _zzq_result;                 \
-    register unsigned long long int* _zzq_ptr;                    \
-    _zzq_args[0] = (unsigned int long long)(_zzq_request);        \
-    _zzq_args[1] = (unsigned int long long)(_zzq_arg1);           \
-    _zzq_args[2] = (unsigned int long long)(_zzq_arg2);           \
-    _zzq_args[3] = (unsigned int long long)(_zzq_arg3);           \
-    _zzq_args[4] = (unsigned int long long)(_zzq_arg4);           \
-    _zzq_args[5] = (unsigned int long long)(_zzq_arg5);           \
-    _zzq_args[6] = (unsigned int long long)(_zzq_default);        \
-    _zzq_ptr = _zzq_args;                                         \
-    __asm__ volatile("mr 4,%1\n\t"                                \
-                     "ld 3, 48(4)\n\t"                            \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = client_request ( %R4 ) */           \
-                     "or 1,1,1\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (_zzq_result)                         \
-                     : "b" (_zzq_ptr)                             \
-                     : "r3", "r4", "cc", "memory");               \
-    _zzq_result;                                                  \
-  })
-
-#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \
-  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \
-    register unsigned long long int __addr;                       \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR */                     \
-                     "or 2,2,2\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->nraddr = __addr;                                   \
-    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* %R3 = guest_NRADDR_GPR2 */                \
-                     "or 4,4,4\n\t"                               \
-                     "mr %0,3"                                    \
-                     : "=b" (__addr)                              \
-                     :                                            \
-                     : "r3", "cc", "memory"                       \
-                    );                                            \
-    _zzq_orig->r2 = __addr;                                       \
-  }
-
-#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \
-                     __SPECIAL_INSTRUCTION_PREAMBLE               \
-                     /* branch-and-link-to-noredir *%R11 */       \
-                     "or 3,3,3\n\t"
-
-#endif /* PLAT_ppc64_aix5 */
-
 /* ------------------------ s390x-linux ------------------------ */
 
 #if defined(PLAT_s390x_linux)
@@ -1390,7 +1239,7 @@
    redzone, for the duration of the hidden call, to make it safe.
 
    Probably the same problem afflicts the other redzone-style ABIs too
-   (ppc64-linux, ppc32-aix5, ppc64-aix5); but for those, the stack is
+   (ppc64-linux); but for those, the stack is
    self describing (none of this CFI nonsense) so at least messing
    with the stack pointer doesn't give a danger of non-unwindable
    stack. */
@@ -3232,1128 +3081,6 @@
 
 #endif /* PLAT_arm_linux */
 
-/* ------------------------ ppc32-aix5 ------------------------- */
-
-#if defined(PLAT_ppc32_aix5)
-
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS                                       \
-   "lr", "ctr", "xer",                                            \
-   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
-   "r11", "r12", "r13"
-
-/* Expand the stack frame, copying enough info that unwinding
-   still works.  Trashes r3. */
-
-#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr)                      \
-         "addi 1,1,-" #_n_fr "\n\t"                               \
-         "lwz  3," #_n_fr "(1)\n\t"                               \
-         "stw  3,0(1)\n\t"
-
-#define VG_CONTRACT_FRAME_BY(_n_fr)                               \
-         "addi 1,1," #_n_fr "\n\t"
-
-/* These CALL_FN_ macros assume that on ppc32-aix5, sizeof(unsigned
-   long) == 4. */
-
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+0];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1] = (unsigned long)_orig.r2;                       \
-      _argvec[2] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+1];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+2];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+3];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+4];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+5];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t" /* arg2->r4 */                       \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+6];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+7];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+8];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+9];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(64)                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(64)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+10];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(64)                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,60(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(64)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+11];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(72)                        \
-         /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,64(1)\n\t"                                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,60(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(72)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+12];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      _argvec[2+12] = (unsigned long)arg12;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "stw  2,-8(11)\n\t"  /* save tocptr */                   \
-         "lwz  2,-4(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(72)                        \
-         /* arg12 */                                              \
-         "lwz 3,48(11)\n\t"                                       \
-         "stw 3,68(1)\n\t"                                        \
-         /* arg11 */                                              \
-         "lwz 3,44(11)\n\t"                                       \
-         "stw 3,64(1)\n\t"                                        \
-         /* arg10 */                                              \
-         "lwz 3,40(11)\n\t"                                       \
-         "stw 3,60(1)\n\t"                                        \
-         /* arg9 */                                               \
-         "lwz 3,36(11)\n\t"                                       \
-         "stw 3,56(1)\n\t"                                        \
-         /* args1-8 */                                            \
-         "lwz  3, 4(11)\n\t"  /* arg1->r3 */                      \
-         "lwz  4, 8(11)\n\t"  /* arg2->r4 */                      \
-         "lwz  5, 12(11)\n\t" /* arg3->r5 */                      \
-         "lwz  6, 16(11)\n\t" /* arg4->r6 */                      \
-         "lwz  7, 20(11)\n\t" /* arg5->r7 */                      \
-         "lwz  8, 24(11)\n\t" /* arg6->r8 */                      \
-         "lwz  9, 28(11)\n\t" /* arg7->r9 */                      \
-         "lwz 10, 32(11)\n\t" /* arg8->r10 */                     \
-         "lwz 11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "lwz 2,-8(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(72)                                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_ppc32_aix5 */
-
-/* ------------------------ ppc64-aix5 ------------------------- */
-
-#if defined(PLAT_ppc64_aix5)
-
-/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */
-
-/* These regs are trashed by the hidden call. */
-#define __CALLER_SAVED_REGS                                       \
-   "lr", "ctr", "xer",                                            \
-   "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
-   "r11", "r12", "r13"
-
-/* Expand the stack frame, copying enough info that unwinding
-   still works.  Trashes r3. */
-
-#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr)                      \
-         "addi 1,1,-" #_n_fr "\n\t"                               \
-         "ld   3," #_n_fr "(1)\n\t"                               \
-         "std  3,0(1)\n\t"
-
-#define VG_CONTRACT_FRAME_BY(_n_fr)                               \
-         "addi 1,1," #_n_fr "\n\t"
-
-/* These CALL_FN_ macros assume that on ppc64-aix5, sizeof(unsigned
-   long) == 8. */
-
-#define CALL_FN_W_v(lval, orig)                                   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+0];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1] = (unsigned long)_orig.r2;                       \
-      _argvec[2] = (unsigned long)_orig.nraddr;                   \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_W(lval, orig, arg1)                             \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+1];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld 2,-16(11)\n\t" /* restore tocptr */                  \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+2];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+3];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+4];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+5];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+6];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7)                            \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+7];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8)                       \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+8];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \
-                                 arg7,arg8,arg9)                  \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+9];                        \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(128)                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(128)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10)           \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+10];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(128)                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(128)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                  arg7,arg8,arg9,arg10,arg11)     \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+11];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(144)                       \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(144)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \
-                                arg7,arg8,arg9,arg10,arg11,arg12) \
-   do {                                                           \
-      volatile OrigFn        _orig = (orig);                      \
-      volatile unsigned long _argvec[3+12];                       \
-      volatile unsigned long _res;                                \
-      /* _argvec[0] holds current r2 across the call */           \
-      _argvec[1]   = (unsigned long)_orig.r2;                     \
-      _argvec[2]   = (unsigned long)_orig.nraddr;                 \
-      _argvec[2+1] = (unsigned long)arg1;                         \
-      _argvec[2+2] = (unsigned long)arg2;                         \
-      _argvec[2+3] = (unsigned long)arg3;                         \
-      _argvec[2+4] = (unsigned long)arg4;                         \
-      _argvec[2+5] = (unsigned long)arg5;                         \
-      _argvec[2+6] = (unsigned long)arg6;                         \
-      _argvec[2+7] = (unsigned long)arg7;                         \
-      _argvec[2+8] = (unsigned long)arg8;                         \
-      _argvec[2+9] = (unsigned long)arg9;                         \
-      _argvec[2+10] = (unsigned long)arg10;                       \
-      _argvec[2+11] = (unsigned long)arg11;                       \
-      _argvec[2+12] = (unsigned long)arg12;                       \
-      __asm__ volatile(                                           \
-         "mr 11,%1\n\t"                                           \
-         VG_EXPAND_FRAME_BY_trashes_r3(512)                       \
-         "std  2,-16(11)\n\t" /* save tocptr */                   \
-         "ld   2,-8(11)\n\t"  /* use nraddr's tocptr */           \
-         VG_EXPAND_FRAME_BY_trashes_r3(144)                       \
-         /* arg12 */                                              \
-         "ld  3,96(11)\n\t"                                       \
-         "std 3,136(1)\n\t"                                       \
-         /* arg11 */                                              \
-         "ld  3,88(11)\n\t"                                       \
-         "std 3,128(1)\n\t"                                       \
-         /* arg10 */                                              \
-         "ld  3,80(11)\n\t"                                       \
-         "std 3,120(1)\n\t"                                       \
-         /* arg9 */                                               \
-         "ld  3,72(11)\n\t"                                       \
-         "std 3,112(1)\n\t"                                       \
-         /* args1-8 */                                            \
-         "ld   3, 8(11)\n\t"  /* arg1->r3 */                      \
-         "ld   4, 16(11)\n\t" /* arg2->r4 */                      \
-         "ld   5, 24(11)\n\t" /* arg3->r5 */                      \
-         "ld   6, 32(11)\n\t" /* arg4->r6 */                      \
-         "ld   7, 40(11)\n\t" /* arg5->r7 */                      \
-         "ld   8, 48(11)\n\t" /* arg6->r8 */                      \
-         "ld   9, 56(11)\n\t" /* arg7->r9 */                      \
-         "ld  10, 64(11)\n\t" /* arg8->r10 */                     \
-         "ld  11, 0(11)\n\t"  /* target->r11 */                   \
-         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \
-         "mr 11,%1\n\t"                                           \
-         "mr %0,3\n\t"                                            \
-         "ld  2,-16(11)\n\t" /* restore tocptr */                 \
-         VG_CONTRACT_FRAME_BY(144)                                \
-         VG_CONTRACT_FRAME_BY(512)                                \
-         : /*out*/   "=r" (_res)                                  \
-         : /*in*/    "r" (&_argvec[2])                            \
-         : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS          \
-      );                                                          \
-      lval = (__typeof__(lval)) _res;                             \
-   } while (0)
-
-#endif /* PLAT_ppc64_aix5 */
-
 /* ------------------------- s390x-linux ------------------------- */
 
 #if defined(PLAT_s390x_linux)
@@ -5292,8 +4019,6 @@
                                addr, buf64, 0, 0, 0)
 
 
-#undef PLAT_ppc64_aix5
-#undef PLAT_ppc32_aix5
 #undef PLAT_x86_darwin
 #undef PLAT_amd64_darwin
 #undef PLAT_x86_win32
diff --git a/include/vki/vki-ppc32-aix5.h b/include/vki/vki-ppc32-aix5.h
deleted file mode 100644
index 71ca550..0000000
--- a/include/vki/vki-ppc32-aix5.h
+++ /dev/null
@@ -1,463 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- 32-bit AIX5-specific kernel interface.      vki-ppc32-aix5.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-*/
-
-/* This file defines types and constants for the kernel interface, and to
-   make that clear everything is prefixed VKI_/vki_.
-*/
-
-/* This file was generated by running auxprogs/aix5_VKI_info.c. */
-
-#ifndef __VKI_PPC32_AIX5_H
-#define __VKI_PPC32_AIX5_H
-
-#if !defined(VGP_ppc32_aix5)
-#  error This file should be included in 32-bit AIX5 builds only.
-#endif
-
-//--------------------------------------------------------------
-// VERIFIED
-//--------------------------------------------------------------
-
-/* ---------------- Errors ---------------- */
-
-#define VKI_EINVAL 22
-#define VKI_EINTR  4
-#define VKI_ENOSYS 109
-#define VKI_EAGAIN 11
-#define VKI_ENOMEM 12
-#define VKI_EACCES 13
-#define VKI_EEXIST 17
-#define VKI_EPERM  1
-#define VKI_ENOENT 2
-#define VKI_ESRCH  3
-#define VKI_EBADF  9
-#define VKI_EFAULT 14
-#define VKI_EMFILE 24
-#define VKI_ECHILD 10
-#define VKI_EOVERFLOW 127
-#define VKI_ERESTARTSYS 0 /* AIX doesn't have this */
-
-/* ---------------- File I/O ---------------- */
-
-#define VKI_O_WRONLY 0x00000001
-#define VKI_O_RDONLY 0x00000000
-#define VKI_O_APPEND 0x00000008
-#define VKI_O_CREAT  0x00000100
-#define VKI_O_RDWR   0x00000002
-#define VKI_O_EXCL   0x00000400
-#define VKI_O_TRUNC  0x00000200
-
-#define VKI_S_IRUSR  0x00000100
-#define VKI_S_IXUSR  0x00000040
-#define VKI_S_IXGRP  0x00000008
-#define VKI_S_IXOTH  0x00000001
-#define VKI_S_IWUSR  0x00000080
-#define VKI_S_IWOTH  0x00000002
-#define VKI_S_ISUID  0x00000800
-#define VKI_S_ISGID  0x00000400
-#define VKI_S_IFMT   0x0000f000
-#define VKI_S_IFDIR  0x00004000
-#define VKI_S_IFCHR  0x00002000
-#define VKI_S_IFBLK  0x00006000
-
-/* Next 3 are from include/vki/vki-linux.h */
-#define VKI_S_ISDIR(m)  (((m) & VKI_S_IFMT) == VKI_S_IFDIR)
-#define VKI_S_ISCHR(m)  (((m) & VKI_S_IFMT) == VKI_S_IFCHR)
-#define VKI_S_ISBLK(m)  (((m) & VKI_S_IFMT) == VKI_S_IFBLK)
-
-#define VKI_F_DUPFD  0x00000000
-#define VKI_F_SETFD  0x00000002
-#define VKI_FD_CLOEXEC  0x00000001
-
-#define VKI_R_OK 0x00000004
-#define VKI_W_OK 0x00000002
-#define VKI_X_OK 0x00000001
-
-/* Known:
-   sizeof(struct stat) = 116
-     st_dev:  off  0 sz 4
-     st_ino:  off  4 sz 4
-     st_mode: off  8 sz 4
-     st_uid:  off 16 sz 4
-     st_gid:  off 20 sz 4
-     st_size: off 28 sz 4
-*/
-struct vki_stat {
-   /*  0 */ UInt st_dev;
-   /*  4 */ UInt st_ino;
-   /*  8 */ UInt st_mode;
-   /* 12 */ UInt __off12;
-   /* 16 */ UInt st_uid;
-   /* 20 */ UInt st_gid;
-   /* 24 */ UInt __off24;
-   /* 28 */ UInt st_size;
-   /* 32 */ UChar __off32[116-32];
-};
-
-#define VKI_STX_NORMAL  0
-
-typedef UInt vki_size_t;
-
-#define VKI_SEEK_SET 0
-#define VKI_PATH_MAX 1023
-
-/* Known:
-   sizeof(struct iovec) = 8
-     iov_base: off  0 sz 4
-      iov_len: off  4 sz 4
-*/
-struct vki_iovec {
-   /* 0 */ Addr iov_base;
-   /* 4 */ UInt iov_len;
-};
-
-#define _VKI_IOC_NONE 0
-#define _VKI_IOC_READ 1    /* kernel reads, userspace writes */
-#define _VKI_IOC_WRITE 2   /* kernel writes, userspace reads */
-#define _VKI_IOC_DIR(_x)   (((_x) >> 30) & 3)
-#define _VKI_IOC_SIZE(_x)  (((_x) >> 16) & 0x7F)
-
-/* ---------------- MMappery ---------------- */
-
-/* This assumes the page size is 4096.  That assumption is checked
-   by the launcher. */
-#define VKI_PAGE_SHIFT  12
-#define VKI_PAGE_SIZE   (1UL << VKI_PAGE_SHIFT)
-#define VKI_MAX_PAGE_SHIFT      VKI_PAGE_SHIFT
-#define VKI_MAX_PAGE_SIZE       VKI_PAGE_SIZE
-
-#define VKI_PROT_NONE  0x00000000
-#define VKI_PROT_READ  0x00000001
-#define VKI_PROT_WRITE 0x00000002
-#define VKI_PROT_EXEC  0x00000004
-
-#define VKI_MAP_FIXED     0x00000100
-#define VKI_MAP_PRIVATE   0x00000002
-#define VKI_MAP_ANONYMOUS 0x00000010
-
-/* ---------------- RLimitery ---------------- */
-
-/* rlimit: these pertain to syscall "appgetrlimit" */
-#define VKI_RLIMIT_DATA   0x00000002
-#define VKI_RLIMIT_NOFILE 0x00000007
-#define VKI_RLIMIT_STACK  0x00000003
-#define VKI_RLIMIT_CORE   0x00000004
-
-/* Known:
-   sizeof(struct rlimit) = 8
-     rlim_cur: off  0 sz 4
-     rlim_max: off  4 sz 4
-*/
-struct vki_rlimit {
-   UInt rlim_cur;
-   UInt rlim_max;
-};
-
-/* ---------------- Time ---------------- */
-
-/* Known:
-   sizeof(struct timeval) = 8
-      tv_sec: off  0 sz 4
-     tv_usec: off  4 sz 4
-*/
-struct vki_timeval {
-   UInt tv_sec;         /* seconds */
-   UInt tv_usec;        /* microseconds */
-};
-
-/* Known:
-   sizeof(struct timespec) = 8
-      tv_sec: off  0 sz 4
-     tv_nsec: off  4 sz 4
-*/
-struct vki_timespec {
-   UInt tv_sec;         /* seconds */
-   UInt tv_nsec;        /* nanoseconds */
-};
-
-/* ---------------- Signals ---------------- */
-
-/* This layout verified 27 July 06. */
-#define _VKI_NSIG_BPW   32
-#define _VKI_NSIG       64
-#define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
-
-typedef struct {
-   UInt sig[_VKI_NSIG_WORDS];
-} vki_sigset_t;
-
-#define VKI_SIGSEGV   11
-#define VKI_SIGBUS    10
-#define VKI_SIGFPE     8
-#define VKI_SIGHUP     1
-#define VKI_SIGINT     2
-#define VKI_SIGQUIT    3
-#define VKI_SIGABRT    6
-#define VKI_SIGUSR1   30
-#define VKI_SIGUSR2   31
-#define VKI_SIGPIPE   13
-#define VKI_SIGALRM   14
-#define VKI_SIGTERM   15
-/* VKI_SIGSTKFLT does not exist on AIX 5.2 */
-#define VKI_SIGTTIN   21
-#define VKI_SIGTTOU   22
-#define VKI_SIGXCPU   24
-#define VKI_SIGXFSZ   25
-#define VKI_SIGVTALRM 34
-#define VKI_SIGPROF   32
-#define VKI_SIGIO     23
-#define VKI_SIGPWR    29
-/* VKI_SIGUNUSED does not exist on AIX 5.2 */
-#define VKI_SIGRTMIN  50
-#define VKI_SIGRTMAX  57
-#define VKI_SIGTRAP    5
-#define VKI_SIGCONT   19
-#define VKI_SIGCHLD   20
-#define VKI_SIGWINCH  28
-#define VKI_SIGURG    16
-#define VKI_SIGILL     4
-#define VKI_SIGSTOP   17
-#define VKI_SIGKILL    9
-#define VKI_SIGTSTP   18
-#define VKI_SIGSYS    12
-
-/* Known:
-    sizeof(struct sigaction) = 16
-      sa_handler: off  0 sz 4
-         sa_mask: off  4 sz 8
-        sa_flags: off 12 sz 4
-    sa_sigaction: off  0 sz 4
-*/
-struct vki_sigaction {
-   void*        ksa_handler;
-   vki_sigset_t sa_mask;
-   UInt         sa_flags;
-};
-
-#define VKI_SA_ONSTACK      1
-#define VKI_SA_RESTART      8
-#define VKI_SA_RESETHAND    2
-#define VKI_SA_SIGINFO    256
-#define VKI_SA_NODEFER    512
-#define VKI_SA_NOCLDSTOP    4
-#define VKI_SA_NOCLDWAIT 1024
-
-#define VKI_SA_RESTORER  0 /* AIX doesn't have this */
-#define VKI_SA_NOMASK    0 /* AIX doesn't have this */
-#define VKI_SA_ONESHOT   0 /* AIX doesn't have this */
-
-#define VKI_SS_ONSTACK 1
-#define VKI_SS_DISABLE 2
-
-#define VKI_MINSIGSTKSZ 1168
-
-#define VKI_SI_USER  0
-
-#define VKI_SIG_BLOCK      0
-#define VKI_SIG_SETMASK    2
-#define VKI_SIG_UNBLOCK    1
-#define VKI_SIG_IGN        (void*)1
-#define VKI_SIG_DFL        (void*)0
-
-#define VKI_SEGV_ACCERR 51
-#define VKI_SEGV_MAPERR 50
-
-#define VKI_TRAP_TRACE 61
-#define VKI_TRAP_BRKPT 60
-#define VKI_BUS_OBJERR 3
-#define VKI_BUS_ADRERR 2
-#define VKI_BUS_ADRALN 1
-#define VKI_FPE_FLTSUB 27
-#define VKI_FPE_FLTINV 26
-#define VKI_FPE_FLTRES 25
-#define VKI_FPE_FLTUND 24
-#define VKI_FPE_FLTOVF 23
-#define VKI_FPE_FLTDIV 22
-#define VKI_FPE_INTOVF 21
-#define VKI_FPE_INTDIV 20
-#define VKI_ILL_BADSTK 37
-#define VKI_ILL_COPROC 36
-#define VKI_ILL_PRVREG 35
-#define VKI_ILL_PRVOPC 34
-#define VKI_ILL_ILLTRP 33
-#define VKI_ILL_ILLADR 32
-#define VKI_ILL_ILLOPN 31
-#define VKI_ILL_ILLOPC 30
-
-/* Known: 
-    sizeof(siginfo_t) = 64
-     si_signo: off  0 sz 4
-      si_code: off  8 sz 4
-       si_pid: off 12 sz 4
-      si_addr: off 20 sz 4
-*/
-typedef struct {
-    UInt  si_signo;
-    UInt  __off4;
-    UInt  si_code;
-    UInt  si_pid;
-    UInt  __off16;
-    void* si_addr;
-    UInt  __off24;
-    UInt  __off28;
-    UInt  __off32;
-    UInt  __off36;
-    UInt  __off40;
-    UInt  __off44;
-    UInt  __off48;
-    UInt  __off52;
-    UInt  __off56;
-    UInt  __off60;
-} vki_siginfo_t;
-
-/* Known:
-   sizeof(stack_t) = 28
-       ss_sp: off  0 sz 4
-     ss_size: off  4 sz 4
-    ss_flags: off  8 sz 4
-*/
-typedef struct vki_sigaltstack {
-   /*  0 */ void* ss_sp;
-   /*  4 */ UInt  ss_size;
-   /*  8 */ UInt  ss_flags;
-   /* 12 */ UInt  __off12;
-   /* 16 */ UInt  __off16;
-   /* 20 */ UInt  __off20;
-   /* 24 */ UInt  __off24;
-} vki_stack_t;
-
-/* ---------------- Misc ---------------- */
-
-#define VKI_PTRACE_TRACEME 0  /* nb: is really PT_TRACE_ME */
-#define VKI_PTRACE_DETACH 31  /* nb: is really PT_DETACH */
-
-
-//--------------------------------------------------------------
-// BOGUS
-//--------------------------------------------------------------
-
-struct vki_dirent {
-  int bogus;
-};
-
-struct vki_sockaddr {
-  int bogus;
-};
-
-struct vki_pollfd {
-  int bogus;
-};
-
-/* Structure describing an Internet (IP) socket address. */
-//struct vki_sockaddr_in {
-//  int bogus;
-//};
-
-struct vki_ucontext {
-  int bogus;
-};
-
-
-//--------------------------------------------------------------
-// FROM glibc-ports-2.4/sysdeps/unix/sysv/aix/dlldr.h
-//--------------------------------------------------------------
-
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-/*
-
- int __loadx(flag, module, arg1, arg2, arg3)
-
- The __loadx() is a call to ld_loadutil() kernel function, which
- does the real work. Note ld_loadutil() is not exported an cannot be
- called directly from user space.
-
- void *ld_loadutil() call is a utility function used for loader extensions
- supporting run-time linking and dl*() functions.
-
- void *   - will return the modules entry point if it succeds of NULL
-                on failure.
-
- int flag - the flag field performas a dual role: the top 8 bits specify
-            the work for __loadx() to perform, the bottom 8 bits are
-            used to pass flags to the work routines, all other bits are
-            reserved.
-
-*/
-
-#define VKI_DL_LOAD       0x1000000 /* __loadx(flag,buf, buf_len, filename, libr_path) */
-#define VKI_DL_POSTLOADQ  0x2000000 /* __loadx(flag,buf, buf_len, module_handle) */
-#define VKI_DL_EXECQ      0x3000000 /* __loadx(flag,buf, buf_len) */
-#define VKI_DL_EXITQ      0x4000000 /* __loadx(flag,buf, buf_len) */
-#define VKI_DL_PREUNLOADQ 0x5000000 /* __loadx(flag,buf, buf_len, module_handle) */
-#define VKI_DL_INIT       0x6000000 /* __loadx(flag,NULL) */
-#define VKI_DL_GETSYM     0x7000000 /* __loadx(flag,symbol, index, modules_data_origin) */
-#define VKI_DL_SETDEPEND  0x8000000 /* __loadx(flag,import_data_org, import_index, */
-                                    /*              export_data_org, export_index) */
-#define VKI_DL_DELDEPEND  0x9000000 /* __loadx(flag,import_data_org, import_index, */
-                                    /*              export_data_org, export_index) */
-#define VKI_DL_GLOBALSYM  0xA000000 /* __loadx(flag,symbol_name, ptr_to_rec_index, */
-                                    /*                        ptr_to_rec_data_org) */
-#define VKI_DL_UNIX_SYSCALL 0xB000000 /* __loadx(flag,syscall_symbol_name) */
-
-#define VKI_DL_FUNCTION_MASK 0xFF000000
-#define VKI_DL_SRCHDEPENDS   0x00100000
-#define VKI_DL_SRCHMODULE    0x00080000
-#define VKI_DL_SRCHLOADLIST  0x00040000
-#define VKI_DL_LOAD_LDX1     0x00040000
-#define VKI_DL_LOAD_RTL      0x00020000
-#define VKI_DL_HASHSTRING    0x00020000
-#define VKI_DL_INFO_OK       0x00010000
-#define VKI_DL_LOAD_DLINFO   0x00010000
-#define VKI_DL_UNLOADED      0x00020000
-
-
-#endif // __VKI_PPC32_AIX5_H
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/include/vki/vki-ppc64-aix5.h b/include/vki/vki-ppc64-aix5.h
deleted file mode 100644
index 092d92c..0000000
--- a/include/vki/vki-ppc64-aix5.h
+++ /dev/null
@@ -1,464 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- 64-bit AIX5-specific kernel interface.      vki-ppc64-aix5.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-*/
-
-/* This file defines types and constants for the kernel interface, and to
-   make that clear everything is prefixed VKI_/vki_.
-*/
-
-/* This file was generated by running auxprogs/aix5_VKI_info.c. */
-
-#ifndef __VKI_PPC64_AIX5_H
-#define __VKI_PPC64_AIX5_H
-
-#if !defined(VGP_ppc64_aix5)
-#  error This file should be included in 64-bit AIX5 builds only.
-#endif
-
-//--------------------------------------------------------------
-// VERIFIED
-//--------------------------------------------------------------
-
-/* ---------------- Errors ---------------- */
-
-#define VKI_EINVAL 22
-#define VKI_EINTR  4
-#define VKI_ENOSYS 109
-#define VKI_EAGAIN 11
-#define VKI_ENOMEM 12
-#define VKI_EACCES 13
-#define VKI_EEXIST 17
-#define VKI_EPERM  1
-#define VKI_ENOENT 2
-#define VKI_ESRCH  3
-#define VKI_EBADF  9
-#define VKI_EFAULT 14
-#define VKI_EMFILE 24
-#define VKI_ECHILD 10
-#define VKI_EOVERFLOW 127
-#define VKI_ERESTARTSYS 0 /* AIX doesn't have this */
-
-/* ---------------- File I/O ---------------- */
-
-#define VKI_O_WRONLY 0x00000001
-#define VKI_O_RDONLY 0x00000000
-#define VKI_O_APPEND 0x00000008
-#define VKI_O_CREAT  0x00000100
-#define VKI_O_RDWR   0x00000002
-#define VKI_O_EXCL   0x00000400
-#define VKI_O_TRUNC  0x00000200
-
-#define VKI_S_IRUSR  0x00000100
-#define VKI_S_IXUSR  0x00000040
-#define VKI_S_IXGRP  0x00000008
-#define VKI_S_IXOTH  0x00000001
-#define VKI_S_IWUSR  0x00000080
-#define VKI_S_IWOTH  0x00000002
-#define VKI_S_ISUID  0x00000800
-#define VKI_S_ISGID  0x00000400
-#define VKI_S_IFMT   0x0000f000
-#define VKI_S_IFDIR  0x00004000
-#define VKI_S_IFCHR  0x00002000
-#define VKI_S_IFBLK  0x00006000
-
-/* Next 3 are from include/vki/vki-linux.h */
-#define VKI_S_ISDIR(m)  (((m) & VKI_S_IFMT) == VKI_S_IFDIR)
-#define VKI_S_ISCHR(m)  (((m) & VKI_S_IFMT) == VKI_S_IFCHR)
-#define VKI_S_ISBLK(m)  (((m) & VKI_S_IFMT) == VKI_S_IFBLK)
-
-#define VKI_F_DUPFD  0x00000000
-#define VKI_F_SETFD  0x00000002
-#define VKI_FD_CLOEXEC  0x00000001
-
-#define VKI_R_OK 0x00000004
-#define VKI_W_OK 0x00000002
-#define VKI_X_OK 0x00000001
-
-/* Known:
-   sizeof(struct stat) = 176
-      st_dev:  off   0 sz 8
-      st_ino:  off   8 sz 8
-      st_mode: off  16 sz 4
-      st_uid:  off  24 sz 4
-      st_gid:  off  28 sz 4
-      st_size: off 168 sz 8
-*/
-struct vki_stat {
-   /*   0 */ ULong st_dev;
-   /*   8 */ ULong st_ino;
-   /*  16 */ UInt  st_mode;
-   /*  20 */ UInt  __off20;
-   /*  24 */ UInt  st_uid;
-   /*  28 */ UInt  st_gid;
-   /*  32 */ UChar __off28[168-32];
-   /* 168 */ ULong st_size;
-};
-
-#define VKI_STX_NORMAL  0
-
-typedef ULong vki_size_t;
-
-#define VKI_SEEK_SET 0
-#define VKI_PATH_MAX 1023
-
-/* Known:
-   sizeof(struct iovec) = 16
-      iov_base: off  0 sz 8
-      iov_len:  off  8 sz 8
-
-*/
-struct vki_iovec {
-   /* 0 */ Addr  iov_base;
-   /* 8 */ ULong iov_len;
-};
-
-#define _VKI_IOC_NONE 0
-#define _VKI_IOC_READ 1    /* kernel reads, userspace writes */
-#define _VKI_IOC_WRITE 2   /* kernel writes, userspace reads */
-#define _VKI_IOC_DIR(_x)   (((_x) >> 30) & 3)
-#define _VKI_IOC_SIZE(_x)  (((_x) >> 16) & 0x7F)
-
-/* ---------------- MMappery ---------------- */
-
-/* This assumes the page size is 4096.  That assumption is checked
-   by the launcher. */
-#define VKI_PAGE_SHIFT  12
-#define VKI_PAGE_SIZE   (1UL << VKI_PAGE_SHIFT)
-#define VKI_MAX_PAGE_SHIFT      VKI_PAGE_SHIFT
-#define VKI_MAX_PAGE_SIZE       VKI_PAGE_SIZE
-
-#define VKI_PROT_NONE  0x00000000
-#define VKI_PROT_READ  0x00000001
-#define VKI_PROT_WRITE 0x00000002
-#define VKI_PROT_EXEC  0x00000004
-
-#define VKI_MAP_FIXED     0x00000100
-#define VKI_MAP_PRIVATE   0x00000002
-#define VKI_MAP_ANONYMOUS 0x00000010
-
-/* ---------------- RLimitery ---------------- */
-
-/* rlimit: these pertain to syscall "appgetrlimit" */
-#define VKI_RLIMIT_DATA   0x00000002
-#define VKI_RLIMIT_NOFILE 0x00000007
-#define VKI_RLIMIT_STACK  0x00000003
-#define VKI_RLIMIT_CORE   0x00000004
-
-/* Known:
-   sizeof(struct rlimit) = 16
-      rlim_cur: off  0 sz 8
-      rlim_max: off  8 sz 8
-*/
-struct vki_rlimit {
-   /* 0 */ ULong rlim_cur;
-   /* 8 */ ULong rlim_max;
-};
-
-/* ---------------- Time ---------------- */
-
-/* Known:
-   sizeof(struct timeval) = 16
-      tv_sec: off  0 sz 8
-     tv_usec: off  8 sz 4
-*/
-struct vki_timeval {
-   /*  0 */ ULong tv_sec;         /* seconds */
-   /*  8 */ UInt  tv_usec;        /* microseconds */
-   /* 12 */ UInt  __off12;
-};
-
-/* Known:
-   sizeof(struct timespec) = 16
-      tv_sec: off  0 sz 8
-     tv_nsec: off  8 sz 8
-*/
-struct vki_timespec {
-   /* 0 */ ULong tv_sec;         /* seconds */
-   /* 8 */ ULong tv_nsec;        /* nanoseconds */
-};
-
-/* ---------------- Signals ---------------- */
-
-/* This layout verified 27 July 06. */
-#define _VKI_NSIG_BPW   64
-#define _VKI_NSIG       256
-#define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
-
-typedef struct {
-   ULong sig[_VKI_NSIG_WORDS];
-} vki_sigset_t;
-
-#define VKI_SIGSEGV   11
-#define VKI_SIGBUS    10
-#define VKI_SIGFPE     8
-#define VKI_SIGHUP     1
-#define VKI_SIGINT     2
-#define VKI_SIGQUIT    3
-#define VKI_SIGABRT    6
-#define VKI_SIGUSR1   30
-#define VKI_SIGUSR2   31
-#define VKI_SIGPIPE   13
-#define VKI_SIGALRM   14
-#define VKI_SIGTERM   15
-/* VKI_SIGSTKFLT does not exist on AIX 5.2 */
-#define VKI_SIGTTIN   21
-#define VKI_SIGTTOU   22
-#define VKI_SIGXCPU   24
-#define VKI_SIGXFSZ   25
-#define VKI_SIGVTALRM 34
-#define VKI_SIGPROF   32
-#define VKI_SIGIO     23
-#define VKI_SIGPWR    29
-/* VKI_SIGUNUSED does not exist on AIX 5.2 */
-#define VKI_SIGRTMIN  50
-#define VKI_SIGRTMAX  57
-#define VKI_SIGTRAP    5
-#define VKI_SIGCONT   19
-#define VKI_SIGCHLD   20
-#define VKI_SIGWINCH  28
-#define VKI_SIGURG    16
-#define VKI_SIGILL     4
-#define VKI_SIGSTOP   17
-#define VKI_SIGKILL    9
-#define VKI_SIGTSTP   18
-#define VKI_SIGSYS    12
-
-/* Known:
-   sizeof(struct sigaction) = 48
-   sa_sigaction: off  0 sz 8
-     sa_handler: off  0 sz 8
-        sa_mask: off  8 sz 32
-       sa_flags: off 40 sz 4
-*/
-struct vki_sigaction {
-   /*  0 */ void*        ksa_handler;
-   /*  8 */ vki_sigset_t sa_mask;
-   /* 40 */ UInt         sa_flags;
-   /* 44 */ UInt         __off44;
-};
-
-#define VKI_SA_ONSTACK      1
-#define VKI_SA_RESTART      8
-#define VKI_SA_RESETHAND    2
-#define VKI_SA_SIGINFO    256
-#define VKI_SA_NODEFER    512
-#define VKI_SA_NOCLDSTOP    4
-#define VKI_SA_NOCLDWAIT 1024
-
-#define VKI_SA_RESTORER  0 /* AIX doesn't have this */
-#define VKI_SA_NOMASK    0 /* AIX doesn't have this */
-#define VKI_SA_ONESHOT   0 /* AIX doesn't have this */
-
-#define VKI_SS_ONSTACK 1
-#define VKI_SS_DISABLE 2
-
-#define VKI_MINSIGSTKSZ 1200
-
-#define VKI_SI_USER  0
-
-#define VKI_SIG_BLOCK      0
-#define VKI_SIG_SETMASK    2
-#define VKI_SIG_UNBLOCK    1
-#define VKI_SIG_IGN        (void*)1
-#define VKI_SIG_DFL        (void*)0
-
-#define VKI_SEGV_ACCERR 51
-#define VKI_SEGV_MAPERR 50
-
-#define VKI_TRAP_TRACE 61
-#define VKI_TRAP_BRKPT 60
-#define VKI_BUS_OBJERR 3
-#define VKI_BUS_ADRERR 2
-#define VKI_BUS_ADRALN 1
-#define VKI_FPE_FLTSUB 27
-#define VKI_FPE_FLTINV 26
-#define VKI_FPE_FLTRES 25
-#define VKI_FPE_FLTUND 24
-#define VKI_FPE_FLTOVF 23
-#define VKI_FPE_FLTDIV 22
-#define VKI_FPE_INTOVF 21
-#define VKI_FPE_INTDIV 20
-
-#define VKI_ILL_BADSTK 37
-#define VKI_ILL_COPROC 36
-#define VKI_ILL_PRVREG 35
-#define VKI_ILL_PRVOPC 34
-#define VKI_ILL_ILLTRP 33
-#define VKI_ILL_ILLADR 32
-#define VKI_ILL_ILLOPN 31
-#define VKI_ILL_ILLOPC 30
-
-/* Known: 
-   sizeof(siginfo_t) = 64
-      si_signo: off  0 sz 4
-       si_code: off  8 sz 4
-        si_pid: off 12 sz 4
-       si_addr: off 24 sz 8
-*/
-typedef struct {
-   /*  0 */ UInt  si_signo;
-   /*  4 */ UInt  __off4;
-   /*  8 */ UInt  si_code;
-   /* 12 */ UInt  si_pid;
-   /* 16 */ UInt  __off16;
-   /* 20 */ UInt  __off20;
-   /* 24 */ void* si_addr;
-   /* 32 */ UInt  __off32;
-   /* 36 */ UInt  __off36;
-   /* 40 */ UInt  __off40;
-   /* 44 */ UInt  __off44;
-   /* 48 */ UInt  __off48;
-   /* 52 */ UInt  __off52;
-   /* 56 */ UInt  __off56;
-   /* 60 */ UInt  __off60;
-} vki_siginfo_t;
-
-/* Known:
-   sizeof(stack_t) = 40
-       ss_sp: off  0 sz 8
-     ss_size: off  8 sz 8
-    ss_flags: off 16 sz 4
-*/
-typedef struct vki_sigaltstack {
-   /*  0 */ void* ss_sp;
-   /*  8 */ ULong ss_size;
-   /* 16 */ UInt  ss_flags;
-   /* 20 */ UInt  __off20;
-   /* 24 */ ULong __off24;
-   /* 32 */ ULong __off32;
-} vki_stack_t;
-
-/* ---------------- Misc ---------------- */
-
-#define VKI_PTRACE_TRACEME 0  /* nb: is really PT_TRACE_ME */
-#define VKI_PTRACE_DETACH 31  /* nb: is really PT_DETACH */
-
-
-//--------------------------------------------------------------
-// BOGUS
-//--------------------------------------------------------------
-
-struct vki_dirent {
-  int bogus;
-};
-
-struct vki_sockaddr {
-  int bogus;
-};
-
-struct vki_pollfd {
-  int bogus;
-};
-
-/* Structure describing an Internet (IP) socket address. */
-//struct vki_sockaddr_in {
-//  int bogus;
-//};
-
-struct vki_ucontext {
-  int bogus;
-};
-
-
-//--------------------------------------------------------------
-// FROM glibc-ports-2.4/sysdeps/unix/sysv/aix/dlldr.h
-//--------------------------------------------------------------
-
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-/*
-
- int __loadx(flag, module, arg1, arg2, arg3)
-
- The __loadx() is a call to ld_loadutil() kernel function, which
- does the real work. Note ld_loadutil() is not exported an cannot be
- called directly from user space.
-
- void *ld_loadutil() call is a utility function used for loader extensions
- supporting run-time linking and dl*() functions.
-
- void *   - will return the modules entry point if it succeds of NULL
-                on failure.
-
- int flag - the flag field performas a dual role: the top 8 bits specify
-            the work for __loadx() to perform, the bottom 8 bits are
-            used to pass flags to the work routines, all other bits are
-            reserved.
-
-*/
-
-#define VKI_DL_LOAD       0x1000000 /* __loadx(flag,buf, buf_len, filename, libr_path) */
-#define VKI_DL_POSTLOADQ  0x2000000 /* __loadx(flag,buf, buf_len, module_handle) */
-#define VKI_DL_EXECQ      0x3000000 /* __loadx(flag,buf, buf_len) */
-#define VKI_DL_EXITQ      0x4000000 /* __loadx(flag,buf, buf_len) */
-#define VKI_DL_PREUNLOADQ 0x5000000 /* __loadx(flag,buf, buf_len, module_handle) */
-#define VKI_DL_INIT       0x6000000 /* __loadx(flag,NULL) */
-#define VKI_DL_GETSYM     0x7000000 /* __loadx(flag,symbol, index, modules_data_origin) */
-#define VKI_DL_SETDEPEND  0x8000000 /* __loadx(flag,import_data_org, import_index, */
-                                    /*              export_data_org, export_index) */
-#define VKI_DL_DELDEPEND  0x9000000 /* __loadx(flag,import_data_org, import_index, */
-                                    /*              export_data_org, export_index) */
-#define VKI_DL_GLOBALSYM  0xA000000 /* __loadx(flag,symbol_name, ptr_to_rec_index, */
-                                    /*                        ptr_to_rec_data_org) */
-#define VKI_DL_UNIX_SYSCALL 0xB000000 /* __loadx(flag,syscall_symbol_name) */
-
-#define VKI_DL_FUNCTION_MASK 0xFF000000
-#define VKI_DL_SRCHDEPENDS   0x00100000
-#define VKI_DL_SRCHMODULE    0x00080000
-#define VKI_DL_SRCHLOADLIST  0x00040000
-#define VKI_DL_LOAD_LDX1     0x00040000
-#define VKI_DL_LOAD_RTL      0x00020000
-#define VKI_DL_HASHSTRING    0x00020000
-#define VKI_DL_INFO_OK       0x00010000
-#define VKI_DL_LOAD_DLINFO   0x00010000
-#define VKI_DL_UNLOADED      0x00020000
-
-
-#endif // __VKI_PPC64_AIX5_H
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/include/vki/vki-scnums-aix5.h b/include/vki/vki-scnums-aix5.h
deleted file mode 100644
index 3ca8ebf..0000000
--- a/include/vki/vki-scnums-aix5.h
+++ /dev/null
@@ -1,1616 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- System call numbers for ppc32-aix5 and ppc64-aix5.           ---*/
-/*---                                            vki-scnums-aix5.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
-   This file is part of Valgrind, a dynamic binary instrumentation
-   framework.
-
-   Copyright (C) 2006-2010 OpenWorks LLP
-      info@open-works.co.uk
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307, USA.
-
-   The GNU General Public License is contained in the file COPYING.
-
-   Neither the names of the U.S. Department of Energy nor the
-   University of California nor the names of its contributors may be
-   used to endorse or promote products derived from this software
-   without prior written permission.
-*/
-
-#ifndef __VKI_SCNUMS_AIX5_H
-#define __VKI_SCNUMS_AIX5_H
-
-#if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5)
-#  error This file should be included in AIX5 builds only.
-#endif
-
-// WARNING: note that this file, unlike other vki-scnums-PLATFORM.h files,
-// isn't suitable for inclusion in asm files.
-
-//--------------------------------------------------------------
-// Syscalls for AIX 5.2 running on ppc32
-//--------------------------------------------------------------
-
-/* This is the initial value for a syscall number, when we don't
-   know what it is. */
-#define __NR_AIX5_UNKNOWN (-1)
-
-/* Vanilla AIX 5.2 ones */
-
-extern Int VG_(aix5_NR_utrchook_sc);
-#define __NR_AIX5_utrchook_sc VG_(aix5_NR_utrchook_sc)
-
-extern Int VG_(aix5_NR_thread_create);
-#define __NR_AIX5_thread_create VG_(aix5_NR_thread_create)
-
-extern Int VG_(aix5_NR_kfork);
-#define __NR_AIX5_kfork VG_(aix5_NR_kfork)
-
-extern Int VG_(aix5_NR_kra_fork);
-#define __NR_AIX5_kra_fork VG_(aix5_NR_kra_fork)
-
-extern Int VG_(aix5_NR_execve);
-#define __NR_AIX5_execve VG_(aix5_NR_execve)
-
-extern Int VG_(aix5_NR_ra_execve);
-#define __NR_AIX5_ra_execve VG_(aix5_NR_ra_execve)
-
-extern Int VG_(aix5_NR__load);
-#define __NR_AIX5__load VG_(aix5_NR__load)
-
-extern Int VG_(aix5_NR___unload);
-#define __NR_AIX5___unload VG_(aix5_NR___unload)
-
-extern Int VG_(aix5_NR_loadbind);
-#define __NR_AIX5_loadbind VG_(aix5_NR_loadbind)
-
-extern Int VG_(aix5_NR___loadx);
-#define __NR_AIX5___loadx VG_(aix5_NR___loadx)
-
-extern Int VG_(aix5_NR_bindprocessor);
-#define __NR_AIX5_bindprocessor VG_(aix5_NR_bindprocessor)
-
-extern Int VG_(aix5_NR_trcgent);
-#define __NR_AIX5_trcgent VG_(aix5_NR_trcgent)
-
-extern Int VG_(aix5_NR_trcgen);
-#define __NR_AIX5_trcgen VG_(aix5_NR_trcgen)
-
-extern Int VG_(aix5_NR_trchk);
-#define __NR_AIX5_trchk VG_(aix5_NR_trchk)
-
-extern Int VG_(aix5_NR_trchkt);
-#define __NR_AIX5_trchkt VG_(aix5_NR_trchkt)
-
-extern Int VG_(aix5_NR_trchkl);
-#define __NR_AIX5_trchkl VG_(aix5_NR_trchkl)
-
-extern Int VG_(aix5_NR_trchklt);
-#define __NR_AIX5_trchklt VG_(aix5_NR_trchklt)
-
-extern Int VG_(aix5_NR_trchkg);
-#define __NR_AIX5_trchkg VG_(aix5_NR_trchkg)
-
-extern Int VG_(aix5_NR_trchkgt);
-#define __NR_AIX5_trchkgt VG_(aix5_NR_trchkgt)
-
-extern Int VG_(aix5_NR_kill);
-#define __NR_AIX5_kill VG_(aix5_NR_kill)
-
-extern Int VG_(aix5_NR__addcpucosts);
-#define __NR_AIX5__addcpucosts VG_(aix5_NR__addcpucosts)
-
-extern Int VG_(aix5_NR_mycpu);
-#define __NR_AIX5_mycpu VG_(aix5_NR_mycpu)
-
-extern Int VG_(aix5_NR_adjtime);
-#define __NR_AIX5_adjtime VG_(aix5_NR_adjtime)
-
-extern Int VG_(aix5_NR_checkpnt_block);
-#define __NR_AIX5_checkpnt_block VG_(aix5_NR_checkpnt_block)
-
-extern Int VG_(aix5_NR__checkpnt_kill);
-#define __NR_AIX5__checkpnt_kill VG_(aix5_NR__checkpnt_kill)
-
-extern Int VG_(aix5_NR__checkpnt_fail);
-#define __NR_AIX5__checkpnt_fail VG_(aix5_NR__checkpnt_fail)
-
-extern Int VG_(aix5_NR__checkpnt_commit);
-#define __NR_AIX5__checkpnt_commit VG_(aix5_NR__checkpnt_commit)
-
-extern Int VG_(aix5_NR__checkpnt_register);
-#define __NR_AIX5__checkpnt_register VG_(aix5_NR__checkpnt_register)
-
-extern Int VG_(aix5_NR__checkpnt);
-#define __NR_AIX5__checkpnt VG_(aix5_NR__checkpnt)
-
-extern Int VG_(aix5_NR_setcrid);
-#define __NR_AIX5_setcrid VG_(aix5_NR_setcrid)
-
-extern Int VG_(aix5_NR_getcrid);
-#define __NR_AIX5_getcrid VG_(aix5_NR_getcrid)
-
-extern Int VG_(aix5_NR_mkcrid);
-#define __NR_AIX5_mkcrid VG_(aix5_NR_mkcrid)
-
-extern Int VG_(aix5_NR_checkpnt_wait);
-#define __NR_AIX5_checkpnt_wait VG_(aix5_NR_checkpnt_wait)
-
-extern Int VG_(aix5_NR_checkpnt_deliver);
-#define __NR_AIX5_checkpnt_deliver VG_(aix5_NR_checkpnt_deliver)
-
-extern Int VG_(aix5_NR_gencore);
-#define __NR_AIX5_gencore VG_(aix5_NR_gencore)
-
-extern Int VG_(aix5_NR_thread_terminate);
-#define __NR_AIX5_thread_terminate VG_(aix5_NR_thread_terminate)
-
-extern Int VG_(aix5_NR__exit);
-#define __NR_AIX5__exit VG_(aix5_NR__exit)
-
-extern Int VG_(aix5_NR_kwaitpid64);
-#define __NR_AIX5_kwaitpid64 VG_(aix5_NR_kwaitpid64)
-
-extern Int VG_(aix5_NR_kwaitpid);
-#define __NR_AIX5_kwaitpid VG_(aix5_NR_kwaitpid)
-
-extern Int VG_(aix5_NR_yield);
-#define __NR_AIX5_yield VG_(aix5_NR_yield)
-
-extern Int VG_(aix5_NR_getprocs64);
-#define __NR_AIX5_getprocs64 VG_(aix5_NR_getprocs64)
-
-extern Int VG_(aix5_NR_getevars);
-#define __NR_AIX5_getevars VG_(aix5_NR_getevars)
-
-extern Int VG_(aix5_NR_getargs);
-#define __NR_AIX5_getargs VG_(aix5_NR_getargs)
-
-extern Int VG_(aix5_NR_getthrds64);
-#define __NR_AIX5_getthrds64 VG_(aix5_NR_getthrds64)
-
-extern Int VG_(aix5_NR_getthrds);
-#define __NR_AIX5_getthrds VG_(aix5_NR_getthrds)
-
-extern Int VG_(aix5_NR_getprocs);
-#define __NR_AIX5_getprocs VG_(aix5_NR_getprocs)
-
-extern Int VG_(aix5_NR_sigcleanup);
-#define __NR_AIX5_sigcleanup VG_(aix5_NR_sigcleanup)
-
-extern Int VG_(aix5_NR__setpri);
-#define __NR_AIX5__setpri VG_(aix5_NR__setpri)
-
-extern Int VG_(aix5_NR__getpri);
-#define __NR_AIX5__getpri VG_(aix5_NR__getpri)
-
-extern Int VG_(aix5_NR_profil);
-#define __NR_AIX5_profil VG_(aix5_NR_profil)
-
-extern Int VG_(aix5_NR_reboot);
-#define __NR_AIX5_reboot VG_(aix5_NR_reboot)
-
-extern Int VG_(aix5_NR_appgetrlimit);
-#define __NR_AIX5_appgetrlimit VG_(aix5_NR_appgetrlimit)
-
-extern Int VG_(aix5_NR_appsetrlimit);
-#define __NR_AIX5_appsetrlimit VG_(aix5_NR_appsetrlimit)
-
-extern Int VG_(aix5_NR__setpriority);
-#define __NR_AIX5__setpriority VG_(aix5_NR__setpriority)
-
-extern Int VG_(aix5_NR__getpriority);
-#define __NR_AIX5__getpriority VG_(aix5_NR__getpriority)
-
-extern Int VG_(aix5_NR_setrlimit64);
-#define __NR_AIX5_setrlimit64 VG_(aix5_NR_setrlimit64)
-
-extern Int VG_(aix5_NR_getrlimit64);
-#define __NR_AIX5_getrlimit64 VG_(aix5_NR_getrlimit64)
-
-extern Int VG_(aix5_NR_appgetrusage);
-#define __NR_AIX5_appgetrusage VG_(aix5_NR_appgetrusage)
-
-extern Int VG_(aix5_NR_getrusage64);
-#define __NR_AIX5_getrusage64 VG_(aix5_NR_getrusage64)
-
-extern Int VG_(aix5_NR_getvtid);
-#define __NR_AIX5_getvtid VG_(aix5_NR_getvtid)
-
-extern Int VG_(aix5_NR_getrtid);
-#define __NR_AIX5_getrtid VG_(aix5_NR_getrtid)
-
-extern Int VG_(aix5_NR_getrpid);
-#define __NR_AIX5_getrpid VG_(aix5_NR_getrpid)
-
-extern Int VG_(aix5_NR_restart_wait);
-#define __NR_AIX5_restart_wait VG_(aix5_NR_restart_wait)
-
-extern Int VG_(aix5_NR_restart);
-#define __NR_AIX5_restart VG_(aix5_NR_restart)
-
-extern Int VG_(aix5_NR__rmcpucosts);
-#define __NR_AIX5__rmcpucosts VG_(aix5_NR__rmcpucosts)
-
-extern Int VG_(aix5_NR__clock_getcpuclockid);
-#define __NR_AIX5__clock_getcpuclockid VG_(aix5_NR__clock_getcpuclockid)
-
-extern Int VG_(aix5_NR__clock_settime);
-#define __NR_AIX5__clock_settime VG_(aix5_NR__clock_settime)
-
-extern Int VG_(aix5_NR__clock_gettime);
-#define __NR_AIX5__clock_gettime VG_(aix5_NR__clock_gettime)
-
-extern Int VG_(aix5_NR__clock_getres);
-#define __NR_AIX5__clock_getres VG_(aix5_NR__clock_getres)
-
-extern Int VG_(aix5_NR__timer_settime);
-#define __NR_AIX5__timer_settime VG_(aix5_NR__timer_settime)
-
-extern Int VG_(aix5_NR__timer_gettime);
-#define __NR_AIX5__timer_gettime VG_(aix5_NR__timer_gettime)
-
-extern Int VG_(aix5_NR__timer_getoverrun);
-#define __NR_AIX5__timer_getoverrun VG_(aix5_NR__timer_getoverrun)
-
-extern Int VG_(aix5_NR__timer_delete);
-#define __NR_AIX5__timer_delete VG_(aix5_NR__timer_delete)
-
-extern Int VG_(aix5_NR__timer_create);
-#define __NR_AIX5__timer_create VG_(aix5_NR__timer_create)
-
-extern Int VG_(aix5_NR__sigqueue);
-#define __NR_AIX5__sigqueue VG_(aix5_NR__sigqueue)
-
-extern Int VG_(aix5_NR__sigsuspend);
-#define __NR_AIX5__sigsuspend VG_(aix5_NR__sigsuspend)
-
-extern Int VG_(aix5_NR__sigaction);
-#define __NR_AIX5__sigaction VG_(aix5_NR__sigaction)
-
-extern Int VG_(aix5_NR_sigprocmask);
-#define __NR_AIX5_sigprocmask VG_(aix5_NR_sigprocmask)
-
-extern Int VG_(aix5_NR_siglocalmask);
-#define __NR_AIX5_siglocalmask VG_(aix5_NR_siglocalmask)
-
-extern Int VG_(aix5_NR_count_event_waiters);
-#define __NR_AIX5_count_event_waiters VG_(aix5_NR_count_event_waiters)
-
-extern Int VG_(aix5_NR_thread_waitact);
-#define __NR_AIX5_thread_waitact VG_(aix5_NR_thread_waitact)
-
-extern Int VG_(aix5_NR_thread_waitlock_local);
-#define __NR_AIX5_thread_waitlock_local VG_(aix5_NR_thread_waitlock_local)
-
-extern Int VG_(aix5_NR_thread_waitlock);
-#define __NR_AIX5_thread_waitlock VG_(aix5_NR_thread_waitlock)
-
-extern Int VG_(aix5_NR_thread_wait);
-#define __NR_AIX5_thread_wait VG_(aix5_NR_thread_wait)
-
-extern Int VG_(aix5_NR_thread_unlock);
-#define __NR_AIX5_thread_unlock VG_(aix5_NR_thread_unlock)
-
-extern Int VG_(aix5_NR_thread_twakeup_unlock);
-#define __NR_AIX5_thread_twakeup_unlock VG_(aix5_NR_thread_twakeup_unlock)
-
-extern Int VG_(aix5_NR_thread_twakeup_event);
-#define __NR_AIX5_thread_twakeup_event VG_(aix5_NR_thread_twakeup_event)
-
-extern Int VG_(aix5_NR_thread_twakeup);
-#define __NR_AIX5_thread_twakeup VG_(aix5_NR_thread_twakeup)
-
-extern Int VG_(aix5_NR_thread_tsleep_event);
-#define __NR_AIX5_thread_tsleep_event VG_(aix5_NR_thread_tsleep_event)
-
-extern Int VG_(aix5_NR_thread_tsleep_chkpnt);
-#define __NR_AIX5_thread_tsleep_chkpnt VG_(aix5_NR_thread_tsleep_chkpnt)
-
-extern Int VG_(aix5_NR_thread_tsleep);
-#define __NR_AIX5_thread_tsleep VG_(aix5_NR_thread_tsleep)
-
-extern Int VG_(aix5_NR_thread_post_many);
-#define __NR_AIX5_thread_post_many VG_(aix5_NR_thread_post_many)
-
-extern Int VG_(aix5_NR_thread_post);
-#define __NR_AIX5_thread_post VG_(aix5_NR_thread_post)
-
-extern Int VG_(aix5_NR_ue_proc_unregister);
-#define __NR_AIX5_ue_proc_unregister VG_(aix5_NR_ue_proc_unregister)
-
-extern Int VG_(aix5_NR_ue_proc_register);
-#define __NR_AIX5_ue_proc_register VG_(aix5_NR_ue_proc_register)
-
-extern Int VG_(aix5_NR_kthread_ctl);
-#define __NR_AIX5_kthread_ctl VG_(aix5_NR_kthread_ctl)
-
-extern Int VG_(aix5_NR__thread_setsched);
-#define __NR_AIX5__thread_setsched VG_(aix5_NR__thread_setsched)
-
-extern Int VG_(aix5_NR_threads_runnable);
-#define __NR_AIX5_threads_runnable VG_(aix5_NR_threads_runnable)
-
-extern Int VG_(aix5_NR_thread_getregs);
-#define __NR_AIX5_thread_getregs VG_(aix5_NR_thread_getregs)
-
-extern Int VG_(aix5_NR_thread_terminate_unlock);
-#define __NR_AIX5_thread_terminate_unlock VG_(aix5_NR_thread_terminate_unlock)
-
-extern Int VG_(aix5_NR_thread_terminate_ack);
-#define __NR_AIX5_thread_terminate_ack VG_(aix5_NR_thread_terminate_ack)
-
-extern Int VG_(aix5_NR_thread_setstate_fast);
-#define __NR_AIX5_thread_setstate_fast VG_(aix5_NR_thread_setstate_fast)
-
-extern Int VG_(aix5_NR_thread_setstate);
-#define __NR_AIX5_thread_setstate VG_(aix5_NR_thread_setstate)
-
-extern Int VG_(aix5_NR_thread_setmymask_fast);
-#define __NR_AIX5_thread_setmymask_fast VG_(aix5_NR_thread_setmymask_fast)
-
-extern Int VG_(aix5_NR_thread_setmystate_fast);
-#define __NR_AIX5_thread_setmystate_fast VG_(aix5_NR_thread_setmystate_fast)
-
-extern Int VG_(aix5_NR_thread_setmystate);
-#define __NR_AIX5_thread_setmystate VG_(aix5_NR_thread_setmystate)
-
-extern Int VG_(aix5_NR_thread_init);
-#define __NR_AIX5_thread_init VG_(aix5_NR_thread_init)
-
-extern Int VG_(aix5_NR_times);
-#define __NR_AIX5_times VG_(aix5_NR_times)
-
-extern Int VG_(aix5_NR__nsleep);
-#define __NR_AIX5__nsleep VG_(aix5_NR__nsleep)
-
-extern Int VG_(aix5_NR_reltimerid);
-#define __NR_AIX5_reltimerid VG_(aix5_NR_reltimerid)
-
-extern Int VG_(aix5_NR_appresinc);
-#define __NR_AIX5_appresinc VG_(aix5_NR_appresinc)
-
-extern Int VG_(aix5_NR_apprestimer);
-#define __NR_AIX5_apprestimer VG_(aix5_NR_apprestimer)
-
-extern Int VG_(aix5_NR_appresabs);
-#define __NR_AIX5_appresabs VG_(aix5_NR_appresabs)
-
-extern Int VG_(aix5_NR_appsettimer);
-#define __NR_AIX5_appsettimer VG_(aix5_NR_appsettimer)
-
-extern Int VG_(aix5_NR_appgettimer);
-#define __NR_AIX5_appgettimer VG_(aix5_NR_appgettimer)
-
-extern Int VG_(aix5_NR_gettimerid);
-#define __NR_AIX5_gettimerid VG_(aix5_NR_gettimerid)
-
-extern Int VG_(aix5_NR_incinterval);
-#define __NR_AIX5_incinterval VG_(aix5_NR_incinterval)
-
-extern Int VG_(aix5_NR_absinterval);
-#define __NR_AIX5_absinterval VG_(aix5_NR_absinterval)
-
-extern Int VG_(aix5_NR_getinterval);
-#define __NR_AIX5_getinterval VG_(aix5_NR_getinterval)
-
-extern Int VG_(aix5_NR_upfget);
-#define __NR_AIX5_upfget VG_(aix5_NR_upfget)
-
-extern Int VG_(aix5_NR__wlm_wait);
-#define __NR_AIX5__wlm_wait VG_(aix5_NR__wlm_wait)
-
-extern Int VG_(aix5_NR__wlm_post);
-#define __NR_AIX5__wlm_post VG_(aix5_NR__wlm_post)
-
-extern Int VG_(aix5_NR__wlm_event_init);
-#define __NR_AIX5__wlm_event_init VG_(aix5_NR__wlm_event_init)
-
-extern Int VG_(aix5_NR__wlm_set_tag);
-#define __NR_AIX5__wlm_set_tag VG_(aix5_NR__wlm_set_tag)
-
-extern Int VG_(aix5_NR__wlm_set);
-#define __NR_AIX5__wlm_set VG_(aix5_NR__wlm_set)
-
-extern Int VG_(aix5_NR_ptrace64);
-#define __NR_AIX5_ptrace64 VG_(aix5_NR_ptrace64)
-
-extern Int VG_(aix5_NR_ptracex);
-#define __NR_AIX5_ptracex VG_(aix5_NR_ptracex)
-
-extern Int VG_(aix5_NR_ptrace);
-#define __NR_AIX5_ptrace VG_(aix5_NR_ptrace)
-
-extern Int VG_(aix5_NR_ksetcontext_sigreturn);
-#define __NR_AIX5_ksetcontext_sigreturn VG_(aix5_NR_ksetcontext_sigreturn)
-
-extern Int VG_(aix5_NR_ksetcontext);
-#define __NR_AIX5_ksetcontext VG_(aix5_NR_ksetcontext)
-
-extern Int VG_(aix5_NR_kgetcontext);
-#define __NR_AIX5_kgetcontext VG_(aix5_NR_kgetcontext)
-
-extern Int VG_(aix5_NR_sigreturn);
-#define __NR_AIX5_sigreturn VG_(aix5_NR_sigreturn)
-
-extern Int VG_(aix5_NR__wlm_get_bio_stats);
-#define __NR_AIX5__wlm_get_bio_stats VG_(aix5_NR__wlm_get_bio_stats)
-
-extern Int VG_(aix5_NR_splice);
-#define __NR_AIX5_splice VG_(aix5_NR_splice)
-
-extern Int VG_(aix5_NR_rmsock);
-#define __NR_AIX5_rmsock VG_(aix5_NR_rmsock)
-
-extern Int VG_(aix5_NR_nrecvmsg);
-#define __NR_AIX5_nrecvmsg VG_(aix5_NR_nrecvmsg)
-
-extern Int VG_(aix5_NR_socket_aio_dequeue);
-#define __NR_AIX5_socket_aio_dequeue VG_(aix5_NR_socket_aio_dequeue)
-
-extern Int VG_(aix5_NR_getkerninfo);
-#define __NR_AIX5_getkerninfo VG_(aix5_NR_getkerninfo)
-
-extern Int VG_(aix5_NR_getpeereid);
-#define __NR_AIX5_getpeereid VG_(aix5_NR_getpeereid)
-
-extern Int VG_(aix5_NR_getpeername);
-#define __NR_AIX5_getpeername VG_(aix5_NR_getpeername)
-
-extern Int VG_(aix5_NR_ngetpeername);
-#define __NR_AIX5_ngetpeername VG_(aix5_NR_ngetpeername)
-
-extern Int VG_(aix5_NR_getsockname);
-#define __NR_AIX5_getsockname VG_(aix5_NR_getsockname)
-
-extern Int VG_(aix5_NR_ngetsockname);
-#define __NR_AIX5_ngetsockname VG_(aix5_NR_ngetsockname)
-
-extern Int VG_(aix5_NR_getsockopt);
-#define __NR_AIX5_getsockopt VG_(aix5_NR_getsockopt)
-
-extern Int VG_(aix5_NR_setsockopt);
-#define __NR_AIX5_setsockopt VG_(aix5_NR_setsockopt)
-
-extern Int VG_(aix5_NR_shutdown);
-#define __NR_AIX5_shutdown VG_(aix5_NR_shutdown)
-
-extern Int VG_(aix5_NR_recvmsg);
-#define __NR_AIX5_recvmsg VG_(aix5_NR_recvmsg)
-
-extern Int VG_(aix5_NR_recv);
-#define __NR_AIX5_recv VG_(aix5_NR_recv)
-
-extern Int VG_(aix5_NR_nrecvfrom);
-#define __NR_AIX5_nrecvfrom VG_(aix5_NR_nrecvfrom)
-
-extern Int VG_(aix5_NR_recvfrom);
-#define __NR_AIX5_recvfrom VG_(aix5_NR_recvfrom)
-
-extern Int VG_(aix5_NR_nsendmsg);
-#define __NR_AIX5_nsendmsg VG_(aix5_NR_nsendmsg)
-
-extern Int VG_(aix5_NR_sendmsg);
-#define __NR_AIX5_sendmsg VG_(aix5_NR_sendmsg)
-
-extern Int VG_(aix5_NR_send);
-#define __NR_AIX5_send VG_(aix5_NR_send)
-
-extern Int VG_(aix5_NR_sendto);
-#define __NR_AIX5_sendto VG_(aix5_NR_sendto)
-
-extern Int VG_(aix5_NR_socketpair);
-#define __NR_AIX5_socketpair VG_(aix5_NR_socketpair)
-
-extern Int VG_(aix5_NR_accept);
-#define __NR_AIX5_accept VG_(aix5_NR_accept)
-
-extern Int VG_(aix5_NR_naccept);
-#define __NR_AIX5_naccept VG_(aix5_NR_naccept)
-
-extern Int VG_(aix5_NR_listen);
-#define __NR_AIX5_listen VG_(aix5_NR_listen)
-
-extern Int VG_(aix5_NR_bind);
-#define __NR_AIX5_bind VG_(aix5_NR_bind)
-
-extern Int VG_(aix5_NR_socket);
-#define __NR_AIX5_socket VG_(aix5_NR_socket)
-
-extern Int VG_(aix5_NR_connext);
-#define __NR_AIX5_connext VG_(aix5_NR_connext)
-
-extern Int VG_(aix5_NR_setdomainname);
-#define __NR_AIX5_setdomainname VG_(aix5_NR_setdomainname)
-
-extern Int VG_(aix5_NR_getdomainname);
-#define __NR_AIX5_getdomainname VG_(aix5_NR_getdomainname)
-
-extern Int VG_(aix5_NR_sethostname);
-#define __NR_AIX5_sethostname VG_(aix5_NR_sethostname)
-
-extern Int VG_(aix5_NR_sethostid);
-#define __NR_AIX5_sethostid VG_(aix5_NR_sethostid)
-
-extern Int VG_(aix5_NR_gethostid);
-#define __NR_AIX5_gethostid VG_(aix5_NR_gethostid)
-
-extern Int VG_(aix5_NR_gethostname);
-#define __NR_AIX5_gethostname VG_(aix5_NR_gethostname)
-
-extern Int VG_(aix5_NR_send_file);
-#define __NR_AIX5_send_file VG_(aix5_NR_send_file)
-
-extern Int VG_(aix5_NR__rmlmbcost);
-#define __NR_AIX5__rmlmbcost VG_(aix5_NR__rmlmbcost)
-
-extern Int VG_(aix5_NR___rs_pickmcm);
-#define __NR_AIX5___rs_pickmcm VG_(aix5_NR___rs_pickmcm)
-
-extern Int VG_(aix5_NR_rs_getsystem);
-#define __NR_AIX5_rs_getsystem VG_(aix5_NR_rs_getsystem)
-
-extern Int VG_(aix5_NR_rs_getassociativity);
-#define __NR_AIX5_rs_getassociativity VG_(aix5_NR_rs_getassociativity)
-
-extern Int VG_(aix5_NR_rs_setpartition);
-#define __NR_AIX5_rs_setpartition VG_(aix5_NR_rs_setpartition)
-
-extern Int VG_(aix5_NR_rs_getpartition);
-#define __NR_AIX5_rs_getpartition VG_(aix5_NR_rs_getpartition)
-
-extern Int VG_(aix5_NR_ra_getrset);
-#define __NR_AIX5_ra_getrset VG_(aix5_NR_ra_getrset)
-
-extern Int VG_(aix5_NR_rs_getinfo);
-#define __NR_AIX5_rs_getinfo VG_(aix5_NR_rs_getinfo)
-
-extern Int VG_(aix5_NR_rs_getrad);
-#define __NR_AIX5_rs_getrad VG_(aix5_NR_rs_getrad)
-
-extern Int VG_(aix5_NR_rs_numrads);
-#define __NR_AIX5_rs_numrads VG_(aix5_NR_rs_numrads)
-
-extern Int VG_(aix5_NR___kdb_format_print_rele);
-#define __NR_AIX5___kdb_format_print_rele VG_(aix5_NR___kdb_format_print_rele)
-
-extern Int VG_(aix5_NR___kdb_format_print_init);
-#define __NR_AIX5___kdb_format_print_init VG_(aix5_NR___kdb_format_print_init)
-
-extern Int VG_(aix5_NR_close);
-#define __NR_AIX5_close VG_(aix5_NR_close)
-
-extern Int VG_(aix5_NR_kfsync_range);
-#define __NR_AIX5_kfsync_range VG_(aix5_NR_kfsync_range)
-
-extern Int VG_(aix5_NR_fsync);
-#define __NR_AIX5_fsync VG_(aix5_NR_fsync)
-
-extern Int VG_(aix5_NR_kpwrite);
-#define __NR_AIX5_kpwrite VG_(aix5_NR_kpwrite)
-
-extern Int VG_(aix5_NR_kwritev);
-#define __NR_AIX5_kwritev VG_(aix5_NR_kwritev)
-
-extern Int VG_(aix5_NR_kwrite);
-#define __NR_AIX5_kwrite VG_(aix5_NR_kwrite)
-
-extern Int VG_(aix5_NR_kpread);
-#define __NR_AIX5_kpread VG_(aix5_NR_kpread)
-
-extern Int VG_(aix5_NR_kreadv);
-#define __NR_AIX5_kreadv VG_(aix5_NR_kreadv)
-
-extern Int VG_(aix5_NR_kread);
-#define __NR_AIX5_kread VG_(aix5_NR_kread)
-
-extern Int VG_(aix5_NR_klseek);
-#define __NR_AIX5_klseek VG_(aix5_NR_klseek)
-
-extern Int VG_(aix5_NR__lseek);
-#define __NR_AIX5__lseek VG_(aix5_NR__lseek)
-
-extern Int VG_(aix5_NR_lseek);
-#define __NR_AIX5_lseek VG_(aix5_NR_lseek)
-
-extern Int VG_(aix5_NR__setsid);
-#define __NR_AIX5__setsid VG_(aix5_NR__setsid)
-
-extern Int VG_(aix5_NR__setpgid);
-#define __NR_AIX5__setpgid VG_(aix5_NR__setpgid)
-
-extern Int VG_(aix5_NR__setpgrp);
-#define __NR_AIX5__setpgrp VG_(aix5_NR__setpgrp)
-
-extern Int VG_(aix5_NR__getpgrpx);
-#define __NR_AIX5__getpgrpx VG_(aix5_NR__getpgrpx)
-
-extern Int VG_(aix5_NR__getpgrp);
-#define __NR_AIX5__getpgrp VG_(aix5_NR__getpgrp)
-
-extern Int VG_(aix5_NR__getppid);
-#define __NR_AIX5__getppid VG_(aix5_NR__getppid)
-
-extern Int VG_(aix5_NR__thread_self);
-#define __NR_AIX5__thread_self VG_(aix5_NR__thread_self)
-
-extern Int VG_(aix5_NR__getpid);
-#define __NR_AIX5__getpid VG_(aix5_NR__getpid)
-
-extern Int VG_(aix5_NR_kgetpgidx);
-#define __NR_AIX5_kgetpgidx VG_(aix5_NR_kgetpgidx)
-
-extern Int VG_(aix5_NR_setuid);
-#define __NR_AIX5_setuid VG_(aix5_NR_setuid)
-
-extern Int VG_(aix5_NR_setuidx);
-#define __NR_AIX5_setuidx VG_(aix5_NR_setuidx)
-
-extern Int VG_(aix5_NR_getuidx);
-#define __NR_AIX5_getuidx VG_(aix5_NR_getuidx)
-
-extern Int VG_(aix5_NR_seteuid);
-#define __NR_AIX5_seteuid VG_(aix5_NR_seteuid)
-
-extern Int VG_(aix5_NR_setreuid);
-#define __NR_AIX5_setreuid VG_(aix5_NR_setreuid)
-
-extern Int VG_(aix5_NR_chdir);
-#define __NR_AIX5_chdir VG_(aix5_NR_chdir)
-
-extern Int VG_(aix5_NR_fchdir);
-#define __NR_AIX5_fchdir VG_(aix5_NR_fchdir)
-
-extern Int VG_(aix5_NR_chroot);
-#define __NR_AIX5_chroot VG_(aix5_NR_chroot)
-
-extern Int VG_(aix5_NR_fchmod);
-#define __NR_AIX5_fchmod VG_(aix5_NR_fchmod)
-
-extern Int VG_(aix5_NR_chmod);
-#define __NR_AIX5_chmod VG_(aix5_NR_chmod)
-
-extern Int VG_(aix5_NR_chown);
-#define __NR_AIX5_chown VG_(aix5_NR_chown)
-
-extern Int VG_(aix5_NR_lchown);
-#define __NR_AIX5_lchown VG_(aix5_NR_lchown)
-
-extern Int VG_(aix5_NR_fchown);
-#define __NR_AIX5_fchown VG_(aix5_NR_fchown)
-
-extern Int VG_(aix5_NR_fchownx);
-#define __NR_AIX5_fchownx VG_(aix5_NR_fchownx)
-
-extern Int VG_(aix5_NR_chownx);
-#define __NR_AIX5_chownx VG_(aix5_NR_chownx)
-
-extern Int VG_(aix5_NR_kfclear);
-#define __NR_AIX5_kfclear VG_(aix5_NR_kfclear)
-
-extern Int VG_(aix5_NR_fclear);
-#define __NR_AIX5_fclear VG_(aix5_NR_fclear)
-
-extern Int VG_(aix5_NR_ffinfo);
-#define __NR_AIX5_ffinfo VG_(aix5_NR_ffinfo)
-
-extern Int VG_(aix5_NR_finfo);
-#define __NR_AIX5_finfo VG_(aix5_NR_finfo)
-
-extern Int VG_(aix5_NR_fscntl);
-#define __NR_AIX5_fscntl VG_(aix5_NR_fscntl)
-
-extern Int VG_(aix5_NR_ktruncate);
-#define __NR_AIX5_ktruncate VG_(aix5_NR_ktruncate)
-
-extern Int VG_(aix5_NR_kftruncate);
-#define __NR_AIX5_kftruncate VG_(aix5_NR_kftruncate)
-
-extern Int VG_(aix5_NR_truncate);
-#define __NR_AIX5_truncate VG_(aix5_NR_truncate)
-
-extern Int VG_(aix5_NR_ftruncate);
-#define __NR_AIX5_ftruncate VG_(aix5_NR_ftruncate)
-
-extern Int VG_(aix5_NR_getdirent64);
-#define __NR_AIX5_getdirent64 VG_(aix5_NR_getdirent64)
-
-extern Int VG_(aix5_NR_getdirent);
-#define __NR_AIX5_getdirent VG_(aix5_NR_getdirent)
-
-extern Int VG_(aix5_NR_kioctl32);
-#define __NR_AIX5_kioctl32 VG_(aix5_NR_kioctl32)
-
-extern Int VG_(aix5_NR_kioctl);
-#define __NR_AIX5_kioctl VG_(aix5_NR_kioctl)
-
-extern Int VG_(aix5_NR_link);
-#define __NR_AIX5_link VG_(aix5_NR_link)
-
-extern Int VG_(aix5_NR_klockf);
-#define __NR_AIX5_klockf VG_(aix5_NR_klockf)
-
-extern Int VG_(aix5_NR_lockf);
-#define __NR_AIX5_lockf VG_(aix5_NR_lockf)
-
-extern Int VG_(aix5_NR_mkdir);
-#define __NR_AIX5_mkdir VG_(aix5_NR_mkdir)
-
-extern Int VG_(aix5_NR_mknod);
-#define __NR_AIX5_mknod VG_(aix5_NR_mknod)
-
-extern Int VG_(aix5_NR_mntctl);
-#define __NR_AIX5_mntctl VG_(aix5_NR_mntctl)
-
-extern Int VG_(aix5_NR_vmount);
-#define __NR_AIX5_vmount VG_(aix5_NR_vmount)
-
-extern Int VG_(aix5_NR_creat);
-#define __NR_AIX5_creat VG_(aix5_NR_creat)
-
-extern Int VG_(aix5_NR_openx);
-#define __NR_AIX5_openx VG_(aix5_NR_openx)
-
-extern Int VG_(aix5_NR_open);
-#define __NR_AIX5_open VG_(aix5_NR_open)
-
-extern Int VG_(aix5_NR_quotactl);
-#define __NR_AIX5_quotactl VG_(aix5_NR_quotactl)
-
-extern Int VG_(aix5_NR_rename);
-#define __NR_AIX5_rename VG_(aix5_NR_rename)
-
-extern Int VG_(aix5_NR_rmdir);
-#define __NR_AIX5_rmdir VG_(aix5_NR_rmdir)
-
-extern Int VG_(aix5_NR_fstatx);
-#define __NR_AIX5_fstatx VG_(aix5_NR_fstatx)
-
-extern Int VG_(aix5_NR_statx);
-#define __NR_AIX5_statx VG_(aix5_NR_statx)
-
-extern Int VG_(aix5_NR_symlink);
-#define __NR_AIX5_symlink VG_(aix5_NR_symlink)
-
-extern Int VG_(aix5_NR_readlink);
-#define __NR_AIX5_readlink VG_(aix5_NR_readlink)
-
-extern Int VG_(aix5_NR_syncvfs);
-#define __NR_AIX5_syncvfs VG_(aix5_NR_syncvfs)
-
-extern Int VG_(aix5_NR_sync);
-#define __NR_AIX5_sync VG_(aix5_NR_sync)
-
-extern Int VG_(aix5_NR_umask);
-#define __NR_AIX5_umask VG_(aix5_NR_umask)
-
-extern Int VG_(aix5_NR_uvmount);
-#define __NR_AIX5_uvmount VG_(aix5_NR_uvmount)
-
-extern Int VG_(aix5_NR_umount);
-#define __NR_AIX5_umount VG_(aix5_NR_umount)
-
-extern Int VG_(aix5_NR_unameu);
-#define __NR_AIX5_unameu VG_(aix5_NR_unameu)
-
-extern Int VG_(aix5_NR_unamex);
-#define __NR_AIX5_unamex VG_(aix5_NR_unamex)
-
-extern Int VG_(aix5_NR_uname);
-#define __NR_AIX5_uname VG_(aix5_NR_uname)
-
-extern Int VG_(aix5_NR_unlink);
-#define __NR_AIX5_unlink VG_(aix5_NR_unlink)
-
-extern Int VG_(aix5_NR_ustat);
-#define __NR_AIX5_ustat VG_(aix5_NR_ustat)
-
-extern Int VG_(aix5_NR_utimes);
-#define __NR_AIX5_utimes VG_(aix5_NR_utimes)
-
-extern Int VG_(aix5_NR___msgxrcv);
-#define __NR_AIX5___msgxrcv VG_(aix5_NR___msgxrcv)
-
-extern Int VG_(aix5_NR___msgrcv);
-#define __NR_AIX5___msgrcv VG_(aix5_NR___msgrcv)
-
-extern Int VG_(aix5_NR___msgsnd);
-#define __NR_AIX5___msgsnd VG_(aix5_NR___msgsnd)
-
-extern Int VG_(aix5_NR_msgctl);
-#define __NR_AIX5_msgctl VG_(aix5_NR_msgctl)
-
-extern Int VG_(aix5_NR_msgget);
-#define __NR_AIX5_msgget VG_(aix5_NR_msgget)
-
-extern Int VG_(aix5_NR_getgidx);
-#define __NR_AIX5_getgidx VG_(aix5_NR_getgidx)
-
-extern Int VG_(aix5_NR___semop);
-#define __NR_AIX5___semop VG_(aix5_NR___semop)
-
-extern Int VG_(aix5_NR_semget);
-#define __NR_AIX5_semget VG_(aix5_NR_semget)
-
-extern Int VG_(aix5_NR_semctl);
-#define __NR_AIX5_semctl VG_(aix5_NR_semctl)
-
-extern Int VG_(aix5_NR_shmctl);
-#define __NR_AIX5_shmctl VG_(aix5_NR_shmctl)
-
-extern Int VG_(aix5_NR_shmdt);
-#define __NR_AIX5_shmdt VG_(aix5_NR_shmdt)
-
-extern Int VG_(aix5_NR_shmat);
-#define __NR_AIX5_shmat VG_(aix5_NR_shmat)
-
-extern Int VG_(aix5_NR_shmget);
-#define __NR_AIX5_shmget VG_(aix5_NR_shmget)
-
-extern Int VG_(aix5_NR_ra_shmgetv);
-#define __NR_AIX5_ra_shmgetv VG_(aix5_NR_ra_shmgetv)
-
-extern Int VG_(aix5_NR_ra_shmget);
-#define __NR_AIX5_ra_shmget VG_(aix5_NR_ra_shmget)
-
-extern Int VG_(aix5_NR_privcheck);
-#define __NR_AIX5_privcheck VG_(aix5_NR_privcheck)
-
-extern Int VG_(aix5_NR_disclaim);
-#define __NR_AIX5_disclaim VG_(aix5_NR_disclaim)
-
-extern Int VG_(aix5_NR__sem_destroy_unnamed);
-#define __NR_AIX5__sem_destroy_unnamed VG_(aix5_NR__sem_destroy_unnamed)
-
-extern Int VG_(aix5_NR__sem_wait);
-#define __NR_AIX5__sem_wait VG_(aix5_NR__sem_wait)
-
-extern Int VG_(aix5_NR__sem_close);
-#define __NR_AIX5__sem_close VG_(aix5_NR__sem_close)
-
-extern Int VG_(aix5_NR__sem_open);
-#define __NR_AIX5__sem_open VG_(aix5_NR__sem_open)
-
-extern Int VG_(aix5_NR_sem_unlink);
-#define __NR_AIX5_sem_unlink VG_(aix5_NR_sem_unlink)
-
-extern Int VG_(aix5_NR_sem_post);
-#define __NR_AIX5_sem_post VG_(aix5_NR_sem_post)
-
-extern Int VG_(aix5_NR_sem_init);
-#define __NR_AIX5_sem_init VG_(aix5_NR_sem_init)
-
-extern Int VG_(aix5_NR_sem_getvalue);
-#define __NR_AIX5_sem_getvalue VG_(aix5_NR_sem_getvalue)
-
-extern Int VG_(aix5_NR_sem_destroy);
-#define __NR_AIX5_sem_destroy VG_(aix5_NR_sem_destroy)
-
-extern Int VG_(aix5_NR__mq_notify);
-#define __NR_AIX5__mq_notify VG_(aix5_NR__mq_notify)
-
-extern Int VG_(aix5_NR__mq_open);
-#define __NR_AIX5__mq_open VG_(aix5_NR__mq_open)
-
-extern Int VG_(aix5_NR_mq_unlink);
-#define __NR_AIX5_mq_unlink VG_(aix5_NR_mq_unlink)
-
-extern Int VG_(aix5_NR_mq_setattr);
-#define __NR_AIX5_mq_setattr VG_(aix5_NR_mq_setattr)
-
-extern Int VG_(aix5_NR_mq_send);
-#define __NR_AIX5_mq_send VG_(aix5_NR_mq_send)
-
-extern Int VG_(aix5_NR_mq_receive);
-#define __NR_AIX5_mq_receive VG_(aix5_NR_mq_receive)
-
-extern Int VG_(aix5_NR_mq_getattr);
-#define __NR_AIX5_mq_getattr VG_(aix5_NR_mq_getattr)
-
-extern Int VG_(aix5_NR_mq_close);
-#define __NR_AIX5_mq_close VG_(aix5_NR_mq_close)
-
-extern Int VG_(aix5_NR_shm_unlink);
-#define __NR_AIX5_shm_unlink VG_(aix5_NR_shm_unlink)
-
-extern Int VG_(aix5_NR_shm_open);
-#define __NR_AIX5_shm_open VG_(aix5_NR_shm_open)
-
-extern Int VG_(aix5_NR__poll);
-#define __NR_AIX5__poll VG_(aix5_NR__poll)
-
-extern Int VG_(aix5_NR__select);
-#define __NR_AIX5__select VG_(aix5_NR__select)
-
-extern Int VG_(aix5_NR_sysconfig);
-#define __NR_AIX5_sysconfig VG_(aix5_NR_sysconfig)
-
-extern Int VG_(aix5_NR_sys_parm);
-#define __NR_AIX5_sys_parm VG_(aix5_NR_sys_parm)
-
-extern Int VG_(aix5_NR_loadquery);
-#define __NR_AIX5_loadquery VG_(aix5_NR_loadquery)
-
-extern Int VG_(aix5_NR_knlist);
-#define __NR_AIX5_knlist VG_(aix5_NR_knlist)
-
-extern Int VG_(aix5_NR_brk);
-#define __NR_AIX5_brk VG_(aix5_NR_brk)
-
-extern Int VG_(aix5_NR_fjfs_sys_call);
-#define __NR_AIX5_fjfs_sys_call VG_(aix5_NR_fjfs_sys_call)
-
-extern Int VG_(aix5_NR_jfs_sys_call);
-#define __NR_AIX5_jfs_sys_call VG_(aix5_NR_jfs_sys_call)
-
-extern Int VG_(aix5_NR_acct);
-#define __NR_AIX5_acct VG_(aix5_NR_acct)
-
-extern Int VG_(aix5_NR__dr_unregister);
-#define __NR_AIX5__dr_unregister VG_(aix5_NR__dr_unregister)
-
-extern Int VG_(aix5_NR__dr_notify);
-#define __NR_AIX5__dr_notify VG_(aix5_NR__dr_notify)
-
-extern Int VG_(aix5_NR__dr_register);
-#define __NR_AIX5__dr_register VG_(aix5_NR__dr_register)
-
-extern Int VG_(aix5_NR_getlparload);
-#define __NR_AIX5_getlparload VG_(aix5_NR_getlparload)
-
-extern Int VG_(aix5_NR_dr_reconfig);
-#define __NR_AIX5_dr_reconfig VG_(aix5_NR_dr_reconfig)
-
-extern Int VG_(aix5_NR_projctl);
-#define __NR_AIX5_projctl VG_(aix5_NR_projctl)
-
-extern Int VG_(aix5_NR_sbrk);
-#define __NR_AIX5_sbrk VG_(aix5_NR_sbrk)
-
-extern Int VG_(aix5_NR__sigpending);
-#define __NR_AIX5__sigpending VG_(aix5_NR__sigpending)
-
-extern Int VG_(aix5_NR__pause);
-#define __NR_AIX5__pause VG_(aix5_NR__pause)
-
-extern Int VG_(aix5_NR_thread_kill);
-#define __NR_AIX5_thread_kill VG_(aix5_NR_thread_kill)
-
-extern Int VG_(aix5_NR_sigstack);
-#define __NR_AIX5_sigstack VG_(aix5_NR_sigstack)
-
-extern Int VG_(aix5_NR_sigaltstack);
-#define __NR_AIX5_sigaltstack VG_(aix5_NR_sigaltstack)
-
-extern Int VG_(aix5_NR_appulimit);
-#define __NR_AIX5_appulimit VG_(aix5_NR_appulimit)
-
-extern Int VG_(aix5_NR_ras_service);
-#define __NR_AIX5_ras_service VG_(aix5_NR_ras_service)
-
-extern Int VG_(aix5_NR__wlm_class_descr2key);
-#define __NR_AIX5__wlm_class_descr2key VG_(aix5_NR__wlm_class_descr2key)
-
-extern Int VG_(aix5_NR__wlm_get_procinfo);
-#define __NR_AIX5__wlm_get_procinfo VG_(aix5_NR__wlm_get_procinfo)
-
-extern Int VG_(aix5_NR__wlm_get_info);
-#define __NR_AIX5__wlm_get_info VG_(aix5_NR__wlm_get_info)
-
-extern Int VG_(aix5_NR__wlm_getclassname);
-#define __NR_AIX5__wlm_getclassname VG_(aix5_NR__wlm_getclassname)
-
-extern Int VG_(aix5_NR__wlm_unload_classes);
-#define __NR_AIX5__wlm_unload_classes VG_(aix5_NR__wlm_unload_classes)
-
-extern Int VG_(aix5_NR__wlm_load);
-#define __NR_AIX5__wlm_load VG_(aix5_NR__wlm_load)
-
-extern Int VG_(aix5_NR__wlm_tune);
-#define __NR_AIX5__wlm_tune VG_(aix5_NR__wlm_tune)
-
-extern Int VG_(aix5_NR__wlm_assign);
-#define __NR_AIX5__wlm_assign VG_(aix5_NR__wlm_assign)
-
-extern Int VG_(aix5_NR__wlm_classify);
-#define __NR_AIX5__wlm_classify VG_(aix5_NR__wlm_classify)
-
-extern Int VG_(aix5_NR_fp_cpusync);
-#define __NR_AIX5_fp_cpusync VG_(aix5_NR_fp_cpusync)
-
-extern Int VG_(aix5_NR__fp_trapstate_ker);
-#define __NR_AIX5__fp_trapstate_ker VG_(aix5_NR__fp_trapstate_ker)
-
-extern Int VG_(aix5_NR__ewlm_classify_correlator);
-#define __NR_AIX5__ewlm_classify_correlator VG_(aix5_NR__ewlm_classify_correlator)
-
-extern Int VG_(aix5_NR__arm_stop_transaction);
-#define __NR_AIX5__arm_stop_transaction VG_(aix5_NR__arm_stop_transaction)
-
-extern Int VG_(aix5_NR__arm_destroy_application);
-#define __NR_AIX5__arm_destroy_application VG_(aix5_NR__arm_destroy_application)
-
-extern Int VG_(aix5_NR__arm_stop_application);
-#define __NR_AIX5__arm_stop_application VG_(aix5_NR__arm_stop_application)
-
-extern Int VG_(aix5_NR__arm_generate_correlator);
-#define __NR_AIX5__arm_generate_correlator VG_(aix5_NR__arm_generate_correlator)
-
-extern Int VG_(aix5_NR__arm_discard_transaction);
-#define __NR_AIX5__arm_discard_transaction VG_(aix5_NR__arm_discard_transaction)
-
-extern Int VG_(aix5_NR__arm_unbind_thread);
-#define __NR_AIX5__arm_unbind_thread VG_(aix5_NR__arm_unbind_thread)
-
-extern Int VG_(aix5_NR__arm_bind_thread);
-#define __NR_AIX5__arm_bind_thread VG_(aix5_NR__arm_bind_thread)
-
-extern Int VG_(aix5_NR__arm_unblock_transaction);
-#define __NR_AIX5__arm_unblock_transaction VG_(aix5_NR__arm_unblock_transaction)
-
-extern Int VG_(aix5_NR__arm_block_transaction);
-#define __NR_AIX5__arm_block_transaction VG_(aix5_NR__arm_block_transaction)
-
-extern Int VG_(aix5_NR__arm_update_transaction);
-#define __NR_AIX5__arm_update_transaction VG_(aix5_NR__arm_update_transaction)
-
-extern Int VG_(aix5_NR__arm_register_metric);
-#define __NR_AIX5__arm_register_metric VG_(aix5_NR__arm_register_metric)
-
-extern Int VG_(aix5_NR__arm_report_transaction);
-#define __NR_AIX5__arm_report_transaction VG_(aix5_NR__arm_report_transaction)
-
-extern Int VG_(aix5_NR__arm_start_transaction);
-#define __NR_AIX5__arm_start_transaction VG_(aix5_NR__arm_start_transaction)
-
-extern Int VG_(aix5_NR__arm_register_transaction);
-#define __NR_AIX5__arm_register_transaction VG_(aix5_NR__arm_register_transaction)
-
-extern Int VG_(aix5_NR__arm_start_application);
-#define __NR_AIX5__arm_start_application VG_(aix5_NR__arm_start_application)
-
-extern Int VG_(aix5_NR__arm_register_application);
-#define __NR_AIX5__arm_register_application VG_(aix5_NR__arm_register_application)
-
-extern Int VG_(aix5_NR__lsarm_getinfo);
-#define __NR_AIX5__lsarm_getinfo VG_(aix5_NR__lsarm_getinfo)
-
-extern Int VG_(aix5_NR__ewlm_init);
-#define __NR_AIX5__ewlm_init VG_(aix5_NR__ewlm_init)
-
-extern Int VG_(aix5_NR__ewlm_query);
-#define __NR_AIX5__ewlm_query VG_(aix5_NR__ewlm_query)
-
-extern Int VG_(aix5_NR_ewlm_verify_policy);
-#define __NR_AIX5_ewlm_verify_policy VG_(aix5_NR_ewlm_verify_policy)
-
-extern Int VG_(aix5_NR_ewlm_abort_policy);
-#define __NR_AIX5_ewlm_abort_policy VG_(aix5_NR_ewlm_abort_policy)
-
-extern Int VG_(aix5_NR_ewlm_commit_policy);
-#define __NR_AIX5_ewlm_commit_policy VG_(aix5_NR_ewlm_commit_policy)
-
-extern Int VG_(aix5_NR_ewlm_prepare_policy);
-#define __NR_AIX5_ewlm_prepare_policy VG_(aix5_NR_ewlm_prepare_policy)
-
-extern Int VG_(aix5_NR_ewlm_get_completions);
-#define __NR_AIX5_ewlm_get_completions VG_(aix5_NR_ewlm_get_completions)
-
-extern Int VG_(aix5_NR_ewlm_get_activedata);
-#define __NR_AIX5_ewlm_get_activedata VG_(aix5_NR_ewlm_get_activedata)
-
-extern Int VG_(aix5_NR_ewlm_get_appldata);
-#define __NR_AIX5_ewlm_get_appldata VG_(aix5_NR_ewlm_get_appldata)
-
-extern Int VG_(aix5_NR_ewlm_collect_samples);
-#define __NR_AIX5_ewlm_collect_samples VG_(aix5_NR_ewlm_collect_samples)
-
-extern Int VG_(aix5_NR_ewlm_disconnect);
-#define __NR_AIX5_ewlm_disconnect VG_(aix5_NR_ewlm_disconnect)
-
-extern Int VG_(aix5_NR_ewlm_connect);
-#define __NR_AIX5_ewlm_connect VG_(aix5_NR_ewlm_connect)
-
-extern Int VG_(aix5_NR_auditlog);
-#define __NR_AIX5_auditlog VG_(aix5_NR_auditlog)
-
-extern Int VG_(aix5_NR_auditproc);
-#define __NR_AIX5_auditproc VG_(aix5_NR_auditproc)
-
-extern Int VG_(aix5_NR_getgroups);
-#define __NR_AIX5_getgroups VG_(aix5_NR_getgroups)
-
-extern Int VG_(aix5_NR_setgid);
-#define __NR_AIX5_setgid VG_(aix5_NR_setgid)
-
-extern Int VG_(aix5_NR_setgidx);
-#define __NR_AIX5_setgidx VG_(aix5_NR_setgidx)
-
-extern Int VG_(aix5_NR_setgroups);
-#define __NR_AIX5_setgroups VG_(aix5_NR_setgroups)
-
-extern Int VG_(aix5_NR_frevoke);
-#define __NR_AIX5_frevoke VG_(aix5_NR_frevoke)
-
-extern Int VG_(aix5_NR_revoke);
-#define __NR_AIX5_revoke VG_(aix5_NR_revoke)
-
-extern Int VG_(aix5_NR___pag_setvalue);
-#define __NR_AIX5___pag_setvalue VG_(aix5_NR___pag_setvalue)
-
-extern Int VG_(aix5_NR___pag_getvalue);
-#define __NR_AIX5___pag_getvalue VG_(aix5_NR___pag_getvalue)
-
-extern Int VG_(aix5_NR___pag_getid);
-#define __NR_AIX5___pag_getid VG_(aix5_NR___pag_getid)
-
-extern Int VG_(aix5_NR___pag_getname);
-#define __NR_AIX5___pag_getname VG_(aix5_NR___pag_getname)
-
-extern Int VG_(aix5_NR___pag_setname);
-#define __NR_AIX5___pag_setname VG_(aix5_NR___pag_setname)
-
-extern Int VG_(aix5_NR_kcap_set_proc);
-#define __NR_AIX5_kcap_set_proc VG_(aix5_NR_kcap_set_proc)
-
-extern Int VG_(aix5_NR_kcap_get_proc);
-#define __NR_AIX5_kcap_get_proc VG_(aix5_NR_kcap_get_proc)
-
-extern Int VG_(aix5_NR_pipe);
-#define __NR_AIX5_pipe VG_(aix5_NR_pipe)
-
-extern Int VG_(aix5_NR_mwakeup);
-#define __NR_AIX5_mwakeup VG_(aix5_NR_mwakeup)
-
-extern Int VG_(aix5_NR___msleep);
-#define __NR_AIX5___msleep VG_(aix5_NR___msleep)
-
-extern Int VG_(aix5_NR_kmmap);
-#define __NR_AIX5_kmmap VG_(aix5_NR_kmmap)
-
-extern Int VG_(aix5_NR_msem_remove);
-#define __NR_AIX5_msem_remove VG_(aix5_NR_msem_remove)
-
-extern Int VG_(aix5_NR_mincore);
-#define __NR_AIX5_mincore VG_(aix5_NR_mincore)
-
-extern Int VG_(aix5_NR_madvise);
-#define __NR_AIX5_madvise VG_(aix5_NR_madvise)
-
-extern Int VG_(aix5_NR_munmap);
-#define __NR_AIX5_munmap VG_(aix5_NR_munmap)
-
-extern Int VG_(aix5_NR_msync);
-#define __NR_AIX5_msync VG_(aix5_NR_msync)
-
-extern Int VG_(aix5_NR_mprotect);
-#define __NR_AIX5_mprotect VG_(aix5_NR_mprotect)
-
-extern Int VG_(aix5_NR_mmap);
-#define __NR_AIX5_mmap VG_(aix5_NR_mmap)
-
-extern Int VG_(aix5_NR_swapqry);
-#define __NR_AIX5_swapqry VG_(aix5_NR_swapqry)
-
-extern Int VG_(aix5_NR_swapon);
-#define __NR_AIX5_swapon VG_(aix5_NR_swapon)
-
-extern Int VG_(aix5_NR_swapoff);
-#define __NR_AIX5_swapoff VG_(aix5_NR_swapoff)
-
-extern Int VG_(aix5_NR_psdanger);
-#define __NR_AIX5_psdanger VG_(aix5_NR_psdanger)
-
-extern Int VG_(aix5_NR_vmgetinfo);
-#define __NR_AIX5_vmgetinfo VG_(aix5_NR_vmgetinfo)
-
-extern Int VG_(aix5_NR_rs_admregistername);
-#define __NR_AIX5_rs_admregistername VG_(aix5_NR_rs_admregistername)
-
-extern Int VG_(aix5_NR_rs_discardname);
-#define __NR_AIX5_rs_discardname VG_(aix5_NR_rs_discardname)
-
-extern Int VG_(aix5_NR_rs_setnameattr);
-#define __NR_AIX5_rs_setnameattr VG_(aix5_NR_rs_setnameattr)
-
-extern Int VG_(aix5_NR_rs_registername);
-#define __NR_AIX5_rs_registername VG_(aix5_NR_rs_registername)
-
-extern Int VG_(aix5_NR_rs_getnamedrset);
-#define __NR_AIX5_rs_getnamedrset VG_(aix5_NR_rs_getnamedrset)
-
-extern Int VG_(aix5_NR_rs_getnameattr);
-#define __NR_AIX5_rs_getnameattr VG_(aix5_NR_rs_getnameattr)
-
-extern Int VG_(aix5_NR_rs_getrsetnames);
-#define __NR_AIX5_rs_getrsetnames VG_(aix5_NR_rs_getrsetnames)
-
-extern Int VG_(aix5_NR_ra_attachrset);
-#define __NR_AIX5_ra_attachrset VG_(aix5_NR_ra_attachrset)
-
-extern Int VG_(aix5_NR_ra_detachrset);
-#define __NR_AIX5_ra_detachrset VG_(aix5_NR_ra_detachrset)
-
-extern Int VG_(aix5_NR_dmapi_init);
-#define __NR_AIX5_dmapi_init VG_(aix5_NR_dmapi_init)
-
-extern Int VG_(aix5_NR_kdm_ioctl);
-#define __NR_AIX5_kdm_ioctl VG_(aix5_NR_kdm_ioctl)
-
-extern Int VG_(aix5_NR_access);
-#define __NR_AIX5_access VG_(aix5_NR_access)
-
-extern Int VG_(aix5_NR_accessx);
-#define __NR_AIX5_accessx VG_(aix5_NR_accessx)
-
-extern Int VG_(aix5_NR_kfcntl);
-#define __NR_AIX5_kfcntl VG_(aix5_NR_kfcntl)
-
-extern Int VG_(aix5_NR___pfcntl);
-#define __NR_AIX5___pfcntl VG_(aix5_NR___pfcntl)
-
-extern Int VG_(aix5_NR_fstatfs64);
-#define __NR_AIX5_fstatfs64 VG_(aix5_NR_fstatfs64)
-
-extern Int VG_(aix5_NR_statfs64);
-#define __NR_AIX5_statfs64 VG_(aix5_NR_statfs64)
-
-extern Int VG_(aix5_NR_fstatfs);
-#define __NR_AIX5_fstatfs VG_(aix5_NR_fstatfs)
-
-extern Int VG_(aix5_NR_statfs);
-#define __NR_AIX5_statfs VG_(aix5_NR_statfs)
-
-extern Int VG_(aix5_NR_probe);
-#define __NR_AIX5_probe VG_(aix5_NR_probe)
-
-extern Int VG_(aix5_NR_cmp_swap);
-#define __NR_AIX5_cmp_swap VG_(aix5_NR_cmp_swap)
-
-extern Int VG_(aix5_NR__validate_pag);
-#define __NR_AIX5__validate_pag VG_(aix5_NR__validate_pag)
-
-extern Int VG_(aix5_NR_kgetsidx);
-#define __NR_AIX5_kgetsidx VG_(aix5_NR_kgetsidx)
-
-extern Int VG_(aix5_NR_kgetsid);
-#define __NR_AIX5_kgetsid VG_(aix5_NR_kgetsid)
-
-extern Int VG_(aix5_NR_plock);
-#define __NR_AIX5_plock VG_(aix5_NR_plock)
-
-extern Int VG_(aix5_NR_upfput);
-#define __NR_AIX5_upfput VG_(aix5_NR_upfput)
-
-extern Int VG_(aix5_NR_usrinfo);
-#define __NR_AIX5_usrinfo VG_(aix5_NR_usrinfo)
-
-extern Int VG_(aix5_NR_audit);
-#define __NR_AIX5_audit VG_(aix5_NR_audit)
-
-extern Int VG_(aix5_NR_auditobj);
-#define __NR_AIX5_auditobj VG_(aix5_NR_auditobj)
-
-extern Int VG_(aix5_NR_auditbin);
-#define __NR_AIX5_auditbin VG_(aix5_NR_auditbin)
-
-extern Int VG_(aix5_NR_auditevents);
-#define __NR_AIX5_auditevents VG_(aix5_NR_auditevents)
-
-extern Int VG_(aix5_NR_faccessx);
-#define __NR_AIX5_faccessx VG_(aix5_NR_faccessx)
-
-extern Int VG_(aix5_NR___fchaclx);
-#define __NR_AIX5___fchaclx VG_(aix5_NR___fchaclx)
-
-extern Int VG_(aix5_NR___chaclx);
-#define __NR_AIX5___chaclx VG_(aix5_NR___chaclx)
-
-extern Int VG_(aix5_NR_fchacl);
-#define __NR_AIX5_fchacl VG_(aix5_NR_fchacl)
-
-extern Int VG_(aix5_NR_chacl);
-#define __NR_AIX5_chacl VG_(aix5_NR_chacl)
-
-extern Int VG_(aix5_NR___fstataclx);
-#define __NR_AIX5___fstataclx VG_(aix5_NR___fstataclx)
-
-extern Int VG_(aix5_NR___stataclx);
-#define __NR_AIX5___stataclx VG_(aix5_NR___stataclx)
-
-extern Int VG_(aix5_NR_fstatacl);
-#define __NR_AIX5_fstatacl VG_(aix5_NR_fstatacl)
-
-extern Int VG_(aix5_NR_statacl);
-#define __NR_AIX5_statacl VG_(aix5_NR_statacl)
-
-extern Int VG_(aix5_NR_setpriv);
-#define __NR_AIX5_setpriv VG_(aix5_NR_setpriv)
-
-extern Int VG_(aix5_NR_getpriv);
-#define __NR_AIX5_getpriv VG_(aix5_NR_getpriv)
-
-extern Int VG_(aix5_NR_fstatpriv);
-#define __NR_AIX5_fstatpriv VG_(aix5_NR_fstatpriv)
-
-extern Int VG_(aix5_NR_statpriv);
-#define __NR_AIX5_statpriv VG_(aix5_NR_statpriv)
-
-extern Int VG_(aix5_NR_fchpriv);
-#define __NR_AIX5_fchpriv VG_(aix5_NR_fchpriv)
-
-extern Int VG_(aix5_NR_chpriv);
-#define __NR_AIX5_chpriv VG_(aix5_NR_chpriv)
-
-extern Int VG_(aix5_NR_i_int2cpu_pal);
-#define __NR_AIX5_i_int2cpu_pal VG_(aix5_NR_i_int2cpu_pal)
-
-extern Int VG_(aix5_NR_hd_cfg);
-#define __NR_AIX5_hd_cfg VG_(aix5_NR_hd_cfg)
-
-extern Int VG_(aix5_NR_putpmsg);
-#define __NR_AIX5_putpmsg VG_(aix5_NR_putpmsg)
-
-extern Int VG_(aix5_NR_putmsg);
-#define __NR_AIX5_putmsg VG_(aix5_NR_putmsg)
-
-extern Int VG_(aix5_NR_getpmsg);
-#define __NR_AIX5_getpmsg VG_(aix5_NR_getpmsg)
-
-extern Int VG_(aix5_NR_getmsg);
-#define __NR_AIX5_getmsg VG_(aix5_NR_getmsg)
-
-extern Int VG_(aix5_NR_strinfo);
-#define __NR_AIX5_strinfo VG_(aix5_NR_strinfo)
-
-extern Int VG_(aix5_NR_strreset);
-#define __NR_AIX5_strreset VG_(aix5_NR_strreset)
-
-extern Int VG_(aix5_NR_dupmsg);
-#define __NR_AIX5_dupmsg VG_(aix5_NR_dupmsg)
-
-extern Int VG_(aix5_NR__kgrantpt);
-#define __NR_AIX5__kgrantpt VG_(aix5_NR__kgrantpt)
-
-extern Int VG_(aix5_NR_aixgsc);
-#define __NR_AIX5_aixgsc VG_(aix5_NR_aixgsc)
-
-extern Int VG_(aix5_NR_smaccept);
-#define __NR_AIX5_smaccept VG_(aix5_NR_smaccept)
-
-extern Int VG_(aix5_NR_smconnect);
-#define __NR_AIX5_smconnect VG_(aix5_NR_smconnect)
-
-extern Int VG_(aix5_NR_smlisten);
-#define __NR_AIX5_smlisten VG_(aix5_NR_smlisten)
-
-extern Int VG_(aix5_NR_smbind);
-#define __NR_AIX5_smbind VG_(aix5_NR_smbind)
-
-extern Int VG_(aix5_NR_smsocket);
-#define __NR_AIX5_smsocket VG_(aix5_NR_smsocket)
-
-extern Int VG_(aix5_NR_smdetatt);
-#define __NR_AIX5_smdetatt VG_(aix5_NR_smdetatt)
-
-extern Int VG_(aix5_NR_smattach);
-#define __NR_AIX5_smattach VG_(aix5_NR_smattach)
-
-extern Int VG_(aix5_NR_smselect);
-#define __NR_AIX5_smselect VG_(aix5_NR_smselect)
-
-extern Int VG_(aix5_NR_smwait);
-#define __NR_AIX5_smwait VG_(aix5_NR_smwait)
-
-extern Int VG_(aix5_NR_smsetthresh);
-#define __NR_AIX5_smsetthresh VG_(aix5_NR_smsetthresh)
-
-extern Int VG_(aix5_NR_smsendbuff);
-#define __NR_AIX5_smsendbuff VG_(aix5_NR_smsendbuff)
-
-extern Int VG_(aix5_NR_smfreebuff);
-#define __NR_AIX5_smfreebuff VG_(aix5_NR_smfreebuff)
-
-extern Int VG_(aix5_NR_smrcvbuff);
-#define __NR_AIX5_smrcvbuff VG_(aix5_NR_smrcvbuff)
-
-extern Int VG_(aix5_NR_smgetbuff);
-#define __NR_AIX5_smgetbuff VG_(aix5_NR_smgetbuff)
-
-extern Int VG_(aix5_NR_smversion);
-#define __NR_AIX5_smversion VG_(aix5_NR_smversion)
-
-extern Int VG_(aix5_NR_smtcheckinit);
-#define __NR_AIX5_smtcheckinit VG_(aix5_NR_smtcheckinit)
-
-extern Int VG_(aix5_NR_aio_nwait_timeout);
-#define __NR_AIX5_aio_nwait_timeout VG_(aix5_NR_aio_nwait_timeout)
-
-extern Int VG_(aix5_NR_kaio_stats);
-#define __NR_AIX5_kaio_stats VG_(aix5_NR_kaio_stats)
-
-extern Int VG_(aix5_NR_aio_cntl);
-#define __NR_AIX5_aio_cntl VG_(aix5_NR_aio_cntl)
-
-extern Int VG_(aix5_NR_listio);
-#define __NR_AIX5_listio VG_(aix5_NR_listio)
-
-extern Int VG_(aix5_NR_acancel);
-#define __NR_AIX5_acancel VG_(aix5_NR_acancel)
-
-extern Int VG_(aix5_NR_iosuspend);
-#define __NR_AIX5_iosuspend VG_(aix5_NR_iosuspend)
-
-extern Int VG_(aix5_NR_kaio_rdwr);
-#define __NR_AIX5_kaio_rdwr VG_(aix5_NR_kaio_rdwr)
-
-extern Int VG_(aix5_NR_aio_nwait);
-#define __NR_AIX5_aio_nwait VG_(aix5_NR_aio_nwait)
-
-extern Int VG_(aix5_NR__posix_iofsync);
-#define __NR_AIX5__posix_iofsync VG_(aix5_NR__posix_iofsync)
-
-extern Int VG_(aix5_NR__posix_aio_nwait_timeout);
-#define __NR_AIX5__posix_aio_nwait_timeout VG_(aix5_NR__posix_aio_nwait_timeout)
-
-extern Int VG_(aix5_NR__posix_kaio_stats);
-#define __NR_AIX5__posix_kaio_stats VG_(aix5_NR__posix_kaio_stats)
-
-extern Int VG_(aix5_NR__posix_listio);
-#define __NR_AIX5__posix_listio VG_(aix5_NR__posix_listio)
-
-extern Int VG_(aix5_NR__posix_acancel);
-#define __NR_AIX5__posix_acancel VG_(aix5_NR__posix_acancel)
-
-extern Int VG_(aix5_NR__posix_iosuspend);
-#define __NR_AIX5__posix_iosuspend VG_(aix5_NR__posix_iosuspend)
-
-extern Int VG_(aix5_NR__posix_kaio_rdwr);
-#define __NR_AIX5__posix_kaio_rdwr VG_(aix5_NR__posix_kaio_rdwr)
-
-extern Int VG_(aix5_NR__posix_aio_cntl);
-#define __NR_AIX5__posix_aio_cntl VG_(aix5_NR__posix_aio_cntl)
-
-extern Int VG_(aix5_NR__posix_aio_nwait);
-#define __NR_AIX5__posix_aio_nwait VG_(aix5_NR__posix_aio_nwait)
-
-extern Int VG_(aix5_NR_nfs_cntl);
-#define __NR_AIX5_nfs_cntl VG_(aix5_NR_nfs_cntl)
-
-extern Int VG_(aix5_NR_nfssvc);
-#define __NR_AIX5_nfssvc VG_(aix5_NR_nfssvc)
-
-extern Int VG_(aix5_NR_nfs_getfh);
-#define __NR_AIX5_nfs_getfh VG_(aix5_NR_nfs_getfh)
-
-extern Int VG_(aix5_NR_exportfs);
-#define __NR_AIX5_exportfs VG_(aix5_NR_exportfs)
-
-extern Int VG_(aix5_NR_lm_svc);
-#define __NR_AIX5_lm_svc VG_(aix5_NR_lm_svc)
-
-extern Int VG_(aix5_NR_pw_config);
-#define __NR_AIX5_pw_config VG_(aix5_NR_pw_config)
-
-extern Int VG_(aix5_NR_pw_post);
-#define __NR_AIX5_pw_post VG_(aix5_NR_pw_post)
-
-extern Int VG_(aix5_NR_pw_wait);
-#define __NR_AIX5_pw_wait VG_(aix5_NR_pw_wait)
-
-extern Int VG_(aix5_NR_pw_loadavg);
-#define __NR_AIX5_pw_loadavg VG_(aix5_NR_pw_loadavg)
-
-extern Int VG_(aix5_NR_pw_debug);
-#define __NR_AIX5_pw_debug VG_(aix5_NR_pw_debug)
-
-/* Extras for AIX 5.3 */
-
-extern Int VG_(aix5_NR___libc_sbrk);
-#define __NR_AIX5___libc_sbrk VG_(aix5_NR___libc_sbrk)
-
-extern Int VG_(aix5_NR_thread_waitlock_);
-#define __NR_AIX5_thread_waitlock_ VG_(aix5_NR_thread_waitlock_)
-
-extern Int VG_(aix5_NR__fp_fpscrx_sc);
-#define __NR_AIX5__fp_fpscrx_sc VG_(aix5_NR__fp_fpscrx_sc)
-
-extern Int VG_(aix5_NR_sched_get_priority_max);
-#define __NR_AIX5_sched_get_priority_max \
-        VG_(aix5_NR_sched_get_priority_max)
-
-/* Extras for AIX 5.3 64-bit mode. */
-
-extern Int VG_(aix5_NR_kload);
-#define __NR_AIX5_kload VG_(aix5_NR_kload)
-
-extern Int VG_(aix5_NR__fp_fpscrx64_);
-#define __NR_AIX5__fp_fpscrx64_ VG_(aix5_NR__fp_fpscrx64_)
-
-extern Int VG_(aix5_NR_kunload64);
-#define __NR_AIX5_kunload64 VG_(aix5_NR_kunload64)
-
-/* We need an extra fake syscall to denote signal handler returns, as
-   used in sigframe-ppc32/64-aix5.h.  Since we don't know what number we
-   can assign to it, monitor the numbers passed to
-   VG_(aix5_register_syscall), and set it to 10000+the largest syscall
-   nummber seen. */
-
-extern Int VG_(aix5_NR_FAKE_SIGRETURN);
-#define __NR_AIX5_FAKE_SIGRETURN VG_(aix5_NR_FAKE_SIGRETURN)
-
-
-//--------------------------------------------------------------
-// "Bindings" to Linux-like names
-//--------------------------------------------------------------
-
-#define __NR_getppid         __NR_AIX5__getppid
-#define __NR_getpid          __NR_AIX5__getpid
-#define __NR_close           __NR_AIX5_close
-#define __NR_open            __NR_AIX5_open
-#define __NR_mmap            __NR_AIX5_mmap
-#define __NR_write           __NR_AIX5_kwrite
-#define __NR_exit            __NR_AIX5__exit
-#define __NR_read            __NR_AIX5_kread
-#define __NR_getrlimit       __NR_AIX5_appgetrlimit
-#define __NR_setrlimit       __NR_AIX5_appsetrlimit
-#define __NR_rt_sigaction    __NR_AIX5__sigaction
-#define __NR_rt_sigprocmask  __NR_AIX5_sigprocmask
-#define __NR__sigpending     __NR_AIX5__sigpending
-#define __NR__sigsuspend     __NR_AIX5__sigsuspend
-#define __NR_fcntl           __NR_AIX5_kfcntl
-#define __NR_unlink          __NR_AIX5_unlink
-#define __NR_pipe            __NR_AIX5_pipe
-#define __NR_mprotect        __NR_AIX5_mprotect
-#define __NR_munmap          __NR_AIX5_munmap
-#define __NR_fork            __NR_AIX5_kfork
-#define __NR_execve          __NR_AIX5_execve
-#define __NR_rename          __NR_AIX5_rename
-#define __NR_access          __NR_AIX5_access
-#define __NR_kill            __NR_AIX5_kill
-#define __NR_tkill           __NR_AIX5_thread_kill
-#define __NR_getgroups       __NR_AIX5_getgroups
-#define __NR_sched_yield     __NR_AIX5_yield
-
-//--------------------------------------------------------------
-// BOGUS
-//--------------------------------------------------------------
-
-/* XXXXXXXXX BOGUS */
-#define __NR_rt_sigreturn    9999
-#define __NR_getegid         9999
-#define __NR_ptrace          9999
-#define __NR_rt_sigtimedwait 9999
-#define __NR_lseek           9999
-#define __NR_fstat           9999
-#define __NR_dup             9999
-#define __NR_getcwd          9999
-#define __NR_readlink        9999
-#define __NR_getdents        9999
-#define __NR_gettid          9999
-#define __NR_getpgrp         9999
-#define __NR_geteuid         9999
-
-
-#endif /* __VKI_SCNUMS_AIX5_H */
-
-/*--------------------------------------------------------------------*/
-/*--- end                                                          ---*/
-/*--------------------------------------------------------------------*/
diff --git a/massif/ms_main.c b/massif/ms_main.c
index 7dcc3dd..609f34d 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -344,12 +344,7 @@
    DO("operator new[](unsigned, std::nothrow_t const&)"     );
    DO("operator new(unsigned long, std::nothrow_t const&)"  );
    DO("operator new[](unsigned long, std::nothrow_t const&)");
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   DO("malloc_common"                                       );
-   DO("calloc_common"                                       );
-   DO("realloc_common"                                      );
-   DO("memalign_common"                                     );
-#elif defined(VGO_darwin)
+#if defined(VGO_darwin)
    DO("malloc_zone_malloc"                                  );
    DO("malloc_zone_calloc"                                  );
    DO("malloc_zone_realloc"                                 );
diff --git a/massif/tests/malloc_usable.c b/massif/tests/malloc_usable.c
index 2578173..1a8b863 100644
--- a/massif/tests/malloc_usable.c
+++ b/massif/tests/malloc_usable.c
@@ -5,7 +5,7 @@
 
 int main(void)
 {
-#  if !defined(VGO_aix5) && !defined(VGO_darwin)
+#  if !defined(VGO_darwin)
    // Because our allocations are in multiples of 8 or 16, 99 will round up
    // to 104 or 112.
    int* x = malloc(99);
diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c
index 09074c2..ed36273 100644
--- a/memcheck/mc_errors.c
+++ b/memcheck/mc_errors.c
@@ -837,35 +837,6 @@
    if (VG_(is_watched)( (isWrite ? write_watchpoint : read_watchpoint), a, szB))
       return;
 
-#  if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   /* AIX zero-page handling.  On AIX, reads from page zero are,
-      bizarrely enough, legitimate.  Writes to page zero aren't,
-      though.  Since memcheck can't distinguish reads from writes, the
-      best we can do is to 'act normal' and mark the A bits in the
-      normal way as noaccess, but then hide any reads from that page
-      that get reported here. */
-   if ((!isWrite) && a >= 0 && a < 4096 && a+szB <= 4096) 
-      return;
-
-   /* Appalling AIX hack.  It suppresses reads done by glink
-      fragments.  Getting rid of this would require figuring out
-      somehow where the referenced data areas are (and their
-      sizes). */
-   if ((!isWrite) && szB == sizeof(Word)) { 
-      UInt i1, i2;
-      UInt* pc = (UInt*)VG_(get_IP)(tid);
-      if (sizeof(Word) == 4) {
-         i1 = 0x800c0000; /* lwz r0,0(r12) */
-         i2 = 0x804c0004; /* lwz r2,4(r12) */
-      } else {
-         i1 = 0xe80c0000; /* ld  r0,0(r12) */
-         i2 = 0xe84c0008; /* ld  r2,8(r12) */
-      }
-      if (pc[0] == i1 && pc[1] == i2) return;
-      if (pc[0] == i2 && pc[-1] == i1) return;
-   }
-#  endif
-
    just_below_esp = is_just_below_ESP( VG_(get_SP)(tid), a );
 
    /* If this is caused by an access immediately below %ESP, and the
diff --git a/memcheck/mc_replace_strmem.c b/memcheck/mc_replace_strmem.c
index c45d270..17ea205 100644
--- a/memcheck/mc_replace_strmem.c
+++ b/memcheck/mc_replace_strmem.c
@@ -1212,317 +1212,6 @@
 
 #endif /* defined(VGO_linux) */
 
-
-/*------------------------------------------------------------*/
-/*--- AIX stuff only after this point                      ---*/
-/*------------------------------------------------------------*/
-
-/* Generate replacements for strcat, strncat, strcpy, strncpy, strcmp
-   in the given soname. */
-#define Str5FNs(_soname)       \
-    STRCAT(_soname, strcat)    \
-   STRNCAT(_soname, strncat)   \
-    STRCPY(_soname, strcpy)    \
-   STRNCPY(_soname, strncpy)   \
-    STRCMP(_soname, strcmp)
-
-#if defined(VGP_ppc32_aix5)
-Str5FNs(NONE)                             /* in main exe */
-Str5FNs(libCZdaZLshrcoreZdoZR)            /* libC.a(shrcore.o) */
-Str5FNs(libX11ZdaZLshr4ZdoZR)             /* libX11.a(shr4.o) */
-Str5FNs(libXmZdaZLshrZaZdoZR)             /* libXm.a(shr*.o) */
-Str5FNs(libXtZdaZLshr4ZdoZR)              /* libXt.a(shr4.o) */
-Str5FNs(libppeZurZdaZLdynamicZdoZR)       /* libppe_r.a(dynamic.o) */
-Str5FNs(libodmZdaZLshrZdoZR)              /* libodm.a(shr.o) */
-Str5FNs(libmpiZurZdaZLmpicoreZurZdoZR)    /* libmpi_r.a(mpicore_r.o) */
-Str5FNs(libmpiZurZdaZLmpipoeZurZdoZR)     /* libmpi_r.a(mpipoe_r.o) */
-Str5FNs(libmpiZurZdaZLmpciZurZdoZR)       /* libmpi_r.a(mpci_r.o) */
-Str5FNs(libslurmZdso)                     /* libslurm.so */
-Str5FNs(libglibZdso)                      /* libglib.so */
-Str5FNs(libIMZdaZLshrZdoZR)               /* libIM.a(shr.o) */
-Str5FNs(libiconvZdaZLshr4ZdoZR)           /* libiconv.a(shr4.o) */
-Str5FNs(libGLZdaZLshrZdoZR)               /* libGL.a(shr.o) */
-Str5FNs(libgdkZdso)                       /* libgdk.so */
-Str5FNs(libcursesZdaZLshr42ZdoZR)         /* libcurses.a(shr42.o) */
-Str5FNs(libqtZda)                         /* libqt.a */
-Str5FNs(ZaZLlibglibZhZaZdsoZaZR)          /* *(libglib-*.so*) */
-Str5FNs(ZaZLlibfontconfigZdsoZaZR)        /* *(libfontconfig.so*) */
-Str5FNs(libQtZaa)                         /* libQt*.a */
-#endif
-#if defined(VGP_ppc64_aix5)
-Str5FNs(NONE)                             /* in main exe */
-Str5FNs(libX11ZdaZLshrZu64ZdoZR)          /* libX11.a(shr_64.o) */
-Str5FNs(libiconvZdaZLshr4Zu64ZdoZR)       /* libiconv.a(shr4_64.o) */
-Str5FNs(libGLZdaZLshrZu64ZdoZR)           /* libGL.a(shr_64.o) */
-Str5FNs(libppeZurZdaZLdynamic64ZdoZR)     /* libppe_r.a(dynamic64.o) */
-Str5FNs(libodmZdaZLshrZu64ZdoZR)          /* libodm.a(shr_64.o) */
-Str5FNs(libmpiZurZdaZLmpicore64ZurZdoZR)  /* libmpi_r.a(mpicore64_r.o) */
-Str5FNs(libmpiZurZdaZLmpipoe64ZurZdoZR)   /* libmpi_r.a(mpipoe64_r.o) */
-Str5FNs(libCZdaZLshrcoreZu64ZdoZR)        /* libC.a(shrcore_64.o) */
-Str5FNs(libmpiZurZdaZLmpci64ZurZdoZR)     /* libmpi_r.a(mpci64_r.o) */
-Str5FNs(libqtZda)                         /* libqt.a */
-Str5FNs(ZaZLlibglibZhZaZdsoZaZR)          /* *(libglib-*.so*) */
-Str5FNs(ZaZLlibfontconfigZdsoZaZR)        /* *(libfontconfig.so*) */
-Str5FNs(libQtZaa)                         /* libQt*.a */
-#endif
-
-
-/* AIX's libm contains a sqrt implementation which does a nasty thing:
-   it loads the initial estimate of the root into a FP register, but
-   only the upper half of the number is initialised data.  Hence the
-   least significant 32 mantissa bits are undefined, and it then uses
-   Newton-Raphson iteration to compute the final, defined result.
-   This fools memcheck completely; the only solution I can think of is
-   provide our own substitute.  The _FAST variant is almost right
-   except the result is not correctly rounded.  The _EXACT variant,
-   which is selected by default, is always right; but it's also pretty
-   darn slow. */
-
-#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-#define SQRT_FAST(soname, fnname) \
-   double VG_REPLACE_FUNCTION_ZU(soname,fnname)( double x ); \
-   double VG_REPLACE_FUNCTION_ZU(soname,fnname)( double x ) \
-   { \
-      static UInt T1[32] =  \
-         { 0,       1024,   3062,   5746,   9193,  13348, \
-           18162,  23592,  29598,  36145,  43202,  50740, \
-           58733,  67158,  75992,  85215,  83599,  71378, \
-           60428,  50647,  41945,  34246,  27478,  21581, \
-           16499,  12183,   8588,   5674,   3403,   1742, \
-           661,    130 }; \
-      UInt x0, x1, sign, expo, mant0, bIGENDIAN = 1; \
-      union { UInt w[2]; double d; } u; \
-      u.d   = x; \
-      x0    = u.w[1 - bIGENDIAN]; /* high half */ \
-      x1    = u.w[bIGENDIAN];  /* low half */ \
-      sign  = x0 >> 31; \
-      expo  = (x0 >> 20) & 0x7FF; \
-      mant0 = x0 & 0xFFFFF; \
-      if ( (sign == 0 && expo >= 1 && expo <= 0x7FE) /* +normal */ \
-           || (sign == 0 && expo == 0  \
-                         && (mant0 | x1) > 0) /* +denorm */) { \
-         /* common case; do Newton-Raphson */ \
-         /* technically k should be signed int32, but since we're \
-            always entering here with x > 0, doesn't matter that it's \
-            unsigned. */ \
-         double y; \
-         UInt k = (x0>>1) + 0x1ff80000; \
-         u.w[1 - bIGENDIAN] = k - T1[31&(k>>15)]; \
-         u.w[bIGENDIAN] = 0; \
-         y = u.d; \
-         y = (y+x/y)/2.0 ; \
-         y = (y+x/y)/2.0 ; \
-         y = y-(y-x/y)/2.0 ; \
-         return y; \
-      } \
-      if ( (sign == 1 && expo >= 1 && expo <= 0x7FE) /* -normal */ \
-           || (sign == 1 && expo == 0  \
-                         && (mant0 | x1) > 0) /* -denorm */) { \
-         u.w[1 - bIGENDIAN] = 0xFFF00000; \
-         u.w[bIGENDIAN] = 0x1; \
-         return u.d; /* -Inf -> NaN */ \
-      } \
-      if ((expo | mant0 | x1) == 0) \
-         return x; /* +/-zero -> self */ \
-      if (expo == 0x7FF && (mant0 | x1) == 0) { \
-         if (sign == 0) \
-            return x; /* +Inf -> self */ \
-         u.w[1 - bIGENDIAN] = 0xFFF00000; \
-         u.w[bIGENDIAN] = 0x1; \
-         return u.d; /* -Inf -> NaN */ \
-      } \
-      /* must be +/- NaN */ \
-      return x; /* +/-NaN -> self */ \
-   }
-
-#define SQRT_EXACT(soname, fnname) \
-   /* \
-    * ==================================================== \
-    * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. \
-    * \
-    * Developed at SunPro, a Sun Microsystems, Inc. business. \
-    * Permission to use, copy, modify, and distribute this \
-    * software is freely granted, provided that this notice \
-    * is preserved. \
-    * ==================================================== \
-    */ \
-   /* \
-    * Return correctly rounded sqrt. \
-    *           ------------------------------------------ \
-    *           |  Use the hardware sqrt if you have one | \
-    *           ------------------------------------------ \
-    * Method: \
-    *   Bit by bit method using integer arithmetic. (Slow, but portable) \
-    *   1. Normalization \
-    *      Scale x to y in [1,4) with even powers of 2: \
-    *      find an integer k such that  1 <= (y=x*2^(2k)) < 4, then \
-    *              sqrt(x) = 2^k * sqrt(y) \
-    *   2. Bit by bit computation \
-    *      Let q  = sqrt(y) truncated to i bit after binary point (q = 1), \
-    *           i                                                   0 \
-    *                                     i+1         2 \
-    *          s  = 2*q , and      y  =  2   * ( y - q  ).         (1) \
-    *           i      i            i                 i \
-    * \
-    *      To compute q    from q , one checks whether \
-    *                  i+1       i \
-    * \
-    *                            -(i+1) 2 \
-    *                      (q + 2      ) <= y.                     (2) \
-    *                        i \
-    *                                                            -(i+1) \
-    *      If (2) is false, then q   = q ; otherwise q   = q  + 2      . \
-    *                             i+1   i             i+1   i \
-    * \
-    *      With some algebric manipulation, it is not difficult to see \
-    *      that (2) is equivalent to \
-    *                             -(i+1) \
-    *                      s  +  2       <= y                      (3) \
-    *                       i                i \
-    * \
-    *      The advantage of (3) is that s  and y  can be computed by \
-    *                                    i      i \
-    *      the following recurrence formula: \
-    *          if (3) is false \
-    * \
-    *          s     =  s  ,       y    = y   ;                    (4) \
-    *           i+1      i          i+1    i \
-    * \
-    *          otherwise, \
-    *                         -i                     -(i+1) \
-    *          s     =  s  + 2  ,  y    = y  -  s  - 2             (5) \
-    *           i+1      i          i+1    i     i \
-    * \
-    * \
-    *      One may easily use induction to prove (4) and (5). \
-    *      Note. Since the left hand side of (3) contain only i+2 bits, \
-    *            it does not necessary to do a full (53-bit) comparison \
-    *            in (3). \
-    *   3. Final rounding \
-    *      After generating the 53 bits result, we compute one more bit. \
-    *      Together with the remainder, we can decide whether the \
-    *      result is exact, bigger than 1/2ulp, or less than 1/2ulp \
-    *      (it will never equal to 1/2ulp). \
-    *      The rounding mode can be detected by checking whether \
-    *      huge + tiny is equal to huge, and whether huge - tiny is \
-    *      equal to huge for some floating point number "huge" and "tiny". \
-    * \
-    * Special cases: \
-    *      sqrt(+-0) = +-0         ... exact \
-    *      sqrt(inf) = inf \
-    *      sqrt(-ve) = NaN         ... with invalid signal \
-    *      sqrt(NaN) = NaN         ... with invalid signal for signaling NaN \
-    * \
-    */ \
-   double VG_REPLACE_FUNCTION_ZU(soname,fnname)( double x ); \
-   double VG_REPLACE_FUNCTION_ZU(soname,fnname)( double x ) \
-   {  \
-      const Int    bIGENDIAN = 1; \
-      const double one = 1.0, tiny=1.0e-300; \
-      double z; \
-      Int sign = (Int)0x80000000; \
-      Int ix0,s0,q,m,t,i; \
-      UInt r,t1,s1,ix1,q1; \
-      union { UInt w[2]; double d; } u; \
-      u.d = x; \
-      ix0 = u.w[1-bIGENDIAN]; \
-      ix1 = u.w[bIGENDIAN];    \
-      \
-      /* take care of Inf and NaN */ \
-      if((ix0&0x7ff00000)==0x7ff00000) { \
-         return x*x+x;               /* sqrt(NaN)=NaN, sqrt(+inf)=+inf \
-                                        sqrt(-inf)=sNaN */ \
-      } \
-      /* take care of zero */ \
-      if(ix0<=0) { \
-         if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ \
-         else if(ix0<0) \
-              return (x-x)/(x-x);             /* sqrt(-ve) = sNaN */ \
-      } \
-      /* normalize x */ \
-      m = (ix0>>20); \
-      if(m==0) {                              /* subnormal x */ \
-         while(ix0==0) { \
-            m -= 21; \
-            ix0 |= (ix1>>11); ix1 <<= 21; \
-         } \
-         for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1; \
-         m -= i-1; \
-         ix0 |= (ix1>>(32-i)); \
-         ix1 <<= i; \
-      } \
-      m -= 1023;      /* unbias exponent */ \
-      ix0 = (ix0&0x000fffff)|0x00100000; \
-      if(m&1){        /* odd m, double x to make it even */ \
-         ix0 += ix0 + ((ix1&sign)>>31); \
-         ix1 += ix1; \
-      } \
-      m >>= 1;        /* m = [m/2] */ \
-      /* generate sqrt(x) bit by bit */ \
-      ix0 += ix0 + ((ix1&sign)>>31); \
-      ix1 += ix1; \
-      q = q1 = s0 = s1 = 0;   /* [q,q1] = sqrt(x) */ \
-      r = 0x00200000;         /* r = moving bit from right to left */ \
-      while(r!=0) { \
-         t = s0+r; \
-         if(t<=ix0) { \
-            s0   = t+r; \
-            ix0 -= t; \
-            q   += r; \
-         } \
-         ix0 += ix0 + ((ix1&sign)>>31); \
-         ix1 += ix1; \
-         r>>=1; \
-      } \
-      r = sign; \
-      while(r!=0) { \
-         t1 = s1+r; \
-         t  = s0; \
-         if((t<ix0)||((t==ix0)&&(t1<=ix1))) { \
-            s1  = t1+r; \
-            if(((t1&sign)==sign)&&(s1&sign)==0) s0 += 1; \
-            ix0 -= t; \
-            if (ix1 < t1) ix0 -= 1; \
-            ix1 -= t1; \
-            q1  += r; \
-         } \
-         ix0 += ix0 + ((ix1&sign)>>31); \
-         ix1 += ix1; \
-         r>>=1; \
-      } \
-      /* use floating add to find out rounding direction */ \
-      if((ix0|ix1)!=0) { \
-         z = one-tiny; /* trigger inexact flag */ \
-         if (z>=one) { \
-            z = one+tiny; \
-            if (q1==(UInt)0xffffffff) { q1=0; q += 1;} \
-            else if (z>one) { \
-                    if (q1==(UInt)0xfffffffe) q+=1; \
-                    q1+=2; \
-                 } else \
-                    q1 += (q1&1); \
-         } \
-      } \
-      ix0 = (q>>1)+0x3fe00000; \
-      ix1 = q1>>1; \
-      if ((q&1)==1) ix1 |= sign; \
-      ix0 += (m <<20); \
-      ix0 = u.w[1-bIGENDIAN] = ix0; \
-      ix1 = u.w[bIGENDIAN] = ix1;    \
-      z = u.d; \
-      return z; \
-   }
-
-#if 0
-SQRT_FAST(NONE, sqrt)  /* xlC generates these */
-SQRT_FAST(NONE, _sqrt) /* xlf generates these */
-#else
-SQRT_EXACT(NONE, sqrt)  /* xlC generates these */
-SQRT_EXACT(NONE, _sqrt) /* xlf generates these */
-#endif
-
-#endif /* defined(VGP_ppc32_aix5) */
-
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c
index 9f13be1..f07d90b 100644
--- a/memcheck/mc_translate.c
+++ b/memcheck/mc_translate.c
@@ -4896,7 +4896,7 @@
       to cause IR sanity check failures, due to references to
       non-existent shadows.  This is only evident for the complex
       preambles used for function wrapping on TOC-afflicted platforms
-      (ppc64-linux, ppc32-aix5, ppc64-aix5).
+      (ppc64-linux).
 
       The following loop therefore scans the preamble looking for
       assignments to temporaries.  For each one found it creates an
diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am
index 93939a9..1e03bfd 100644
--- a/memcheck/tests/Makefile.am
+++ b/memcheck/tests/Makefile.am
@@ -329,34 +329,9 @@
 varinfo5_CFLAGS		= $(AM_CFLAGS) -O
 varinfo6_CFLAGS		= $(AM_CFLAGS) -O
 
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
-if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
-else
- # persuade the AIX linker not to junk apparently unused
- # function descriptors.  Unfortunately -Wl,-G -Wl,-bnogc
- # produces a link error on 64-bit AIX, hence only 32-bit
- # gets these flags.
- wrap1_LDFLAGS = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
- wrap2_LDFLAGS = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
- wrap3_LDFLAGS = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
- wrap4_LDFLAGS = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
- wrap5_LDFLAGS = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
- wrap6_LDFLAGS = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
- wrap8_LDFLAGS = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
-endif
-endif
-
 # Build shared object for varinfo5
 varinfo5_SOURCES        = varinfo5.c
 varinfo5_DEPENDENCIES   = varinfo5so.so
-if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5 
- varinfo5_LDADD         = `pwd`/varinfo5so.so
- varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI)
-else
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
- varinfo5_LDADD         = `pwd`/varinfo5so.so
- varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
-else
 if VGCONF_OS_IS_DARWIN
  varinfo5_LDADD         = `pwd`/varinfo5so.so
  varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI)
@@ -365,17 +340,9 @@
  varinfo5_LDFLAGS       = $(AM_FLAG_M3264_PRI) \
 				-Wl,-rpath,$(top_builddir)/memcheck/tests
 endif
-endif
 
 varinfo5so_so_SOURCES   = varinfo5so.c
 varinfo5so_so_CFLAGS    = $(AM_CFLAGS) -fpic -O -Wno-shadow
-if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
- varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -shared
-else
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
- varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -shared \
-				-Wl,-G -Wl,-bnogc
-else
 if VGCONF_OS_IS_DARWIN
  varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -dynamic \
 				-dynamiclib -all_load
@@ -383,20 +350,10 @@
  varinfo5so_so_LDFLAGS  = -fpic $(AM_FLAG_M3264_PRI) -shared \
 				-Wl,-soname -Wl,varinfo5so.so
 endif
-endif
-endif
 
 # Build shared object for wrap7
 wrap7_SOURCES           = wrap7.c
 wrap7_DEPENDENCIES      = wrap7so.so
-if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5 
- wrap7_LDADD            = `pwd`/wrap7so.so
- wrap7_LDFLAGS          = $(AM_FLAG_M3264_PRI)
-else
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
- wrap7_LDADD            = `pwd`/wrap7so.so
- wrap7_LDFLAGS          = $(AM_FLAG_M3264_PRI) -Wl,-G -Wl,-bnogc
-else
 if VGCONF_OS_IS_DARWIN
  wrap7_LDADD            = `pwd`/wrap7so.so
  wrap7_LDFLAGS          = $(AM_FLAG_M3264_PRI)
@@ -405,18 +362,9 @@
  wrap7_LDFLAGS          = $(AM_FLAG_M3264_PRI) \
 				-Wl,-rpath,$(top_builddir)/memcheck/tests
 endif
-endif
-endif
 
 wrap7so_so_SOURCES      = wrap7so.c
 wrap7so_so_CFLAGS       = $(AM_CFLAGS) -fpic
-if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
- wrap7so_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -shared
-else
-if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
- wrap7so_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -shared \
-				-Wl,-G -Wl,-bnogc
-else
 if VGCONF_OS_IS_DARWIN
  wrap7so_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -dynamic \
 				-dynamiclib -all_load
@@ -424,8 +372,4 @@
  wrap7so_so_LDFLAGS     = -fpic $(AM_FLAG_M3264_PRI) -shared \
 				-Wl,-soname -Wl,wrap7so.so
 endif
-endif
-endif
-
-endif
 
diff --git a/memcheck/tests/badjump.c b/memcheck/tests/badjump.c
index 30a0787..b02c493 100644
--- a/memcheck/tests/badjump.c
+++ b/memcheck/tests/badjump.c
@@ -2,7 +2,7 @@
 
 int main ( void )
 {
-#if defined(__powerpc64__) || defined(_AIX)
+#if defined(__powerpc64__)
    /* on ppc64-linux, a function pointer points to a function
       descriptor, not to the function's entry point.  Hence to get
       uniform behaviour on all supported targets - a jump to an
diff --git a/memcheck/tests/badjump2.c b/memcheck/tests/badjump2.c
index a4ba803..6488724 100644
--- a/memcheck/tests/badjump2.c
+++ b/memcheck/tests/badjump2.c
@@ -24,7 +24,7 @@
    /* Install own SIGSEGV handler */
    sigsegv_new.sa_handler  = SIGSEGV_handler;
    sigsegv_new.sa_flags    = 0;
-#if !defined(_AIX) && !defined(__APPLE__)
+#if !defined(__APPLE__)
    sigsegv_new.sa_restorer = NULL;
 #endif
    res = sigemptyset( &sigsegv_new.sa_mask );
@@ -35,7 +35,7 @@
 
    if (__builtin_setjmp(myjmpbuf) == 0) {
       // Jump to zero; will cause seg fault
-#if defined(__powerpc64__) || defined(_AIX)
+#if defined(__powerpc64__)
       unsigned long int fake_fndescr[3];
       fake_fndescr[0] = 0;
       fake_fndescr[1] = 0;
diff --git a/memcheck/tests/long_namespace_xml.cpp b/memcheck/tests/long_namespace_xml.cpp
index cd34d06..b4d6a11 100644
--- a/memcheck/tests/long_namespace_xml.cpp
+++ b/memcheck/tests/long_namespace_xml.cpp
@@ -2,17 +2,17 @@
 /* Check that very long function names are safely truncated in 
    memcheck's XML output. */
 
-#if defined(_AIX)
-
-#include <stdio.h>
-int main () { 
-   printf("This test is not compilable on AIX using gcc.\n");
-   return 0;
-}
 
 
 
-#else
+
+
+
+
+
+
+
+
 
 #define N1 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
 
@@ -44,5 +44,3 @@
   N1::N2::f();
   return 0;
 }
-
-#endif /* defined(_AIX) */
diff --git a/memcheck/tests/malloc_usable.c b/memcheck/tests/malloc_usable.c
index ab57663..b036b10 100644
--- a/memcheck/tests/malloc_usable.c
+++ b/memcheck/tests/malloc_usable.c
@@ -5,7 +5,7 @@
 
 int main(void)
 {
-#  if !defined(VGO_aix5) && !defined(VGO_darwin)
+#  if !defined(VGO_darwin)
    // Because Memcheck marks any slop as inaccessible, it doesn't round up
    // sizes for malloc_usable_size().
    int* x = malloc(99);
diff --git a/memcheck/tests/memalign2.c b/memcheck/tests/memalign2.c
index a3aacfe..99f322f 100644
--- a/memcheck/tests/memalign2.c
+++ b/memcheck/tests/memalign2.c
@@ -19,11 +19,9 @@
 
 int main ( void )
 {
-#  if defined(VGO_aix5)
-   // AIX 5.2 has neither memalign() nor posix_memalign();  do nothing.
-
-#  elif defined(VGO_darwin)
-   // Likewise for Mac OS X.
+#  if defined(VGO_darwin)
+   // Mac OS X has neither memalign() nor posix_memalign();  do nothing.
+   // Still true for 10.6 / 10.7 ?
 
 #  else
    // Nb: assuming VG_MIN_MALLOC_SZB is 8 or more...
diff --git a/memcheck/tests/sigprocmask.c b/memcheck/tests/sigprocmask.c
index 5747dcb..ebb788e 100644
--- a/memcheck/tests/sigprocmask.c
+++ b/memcheck/tests/sigprocmask.c
@@ -1,9 +1,7 @@
 
 #include <signal.h>
 #include <stdio.h>
-#if !defined(_AIX)
-# include <sys/syscall.h>
-#endif
+#include <sys/syscall.h>
 #include <unistd.h>
 
 // Reg test for bug #93328: we were using too-big sigset types, and thus
@@ -14,7 +12,6 @@
 #if defined(__NR_sigprocmask)        \
     && !defined(__powerpc64__)       \
     && !defined(__s390x__)           \
-    && !defined(_AIX)                \
     && !defined(__arm__)
 
    // arm-linux uses rt_sigprocmask, so no sigset mangling takes place
diff --git a/memcheck/tests/str_tester.c b/memcheck/tests/str_tester.c
index 7516696..2e2e67d 100644
--- a/memcheck/tests/str_tester.c
+++ b/memcheck/tests/str_tester.c
@@ -467,7 +467,7 @@
 }
 
 // DDD: better done by testing for the function.
-#if !defined(_AIX) && !defined(__APPLE__)
+#if !defined(__APPLE__)
 static void
 test_strchrnul (void)
 {
@@ -501,10 +501,10 @@
       }
    }
 }
-#endif /* !defined(_AIX) */
+#endif
 
 // DDD: better done by testing for the function.
-#if !defined(_AIX) && !defined(__APPLE__)
+#if !defined(__APPLE__)
 static void
 test_rawmemchr (void)
 {
@@ -531,7 +531,7 @@
       }
    }
 }
-#endif /* !defined(_AIX) */
+#endif
 
 static void
 test_index (void)
@@ -580,7 +580,7 @@
 }
 
 // DDD: better done by testing for the function.
-#if !defined(_AIX) && !defined(__APPLE__)
+#if !defined(__APPLE__)
 static void
 test_memrchr (void)
 {
@@ -626,7 +626,7 @@
     }
   }
 }
-#endif /* !defined(_AIX) */
+#endif
 
 static void
 test_rindex (void)
@@ -902,7 +902,7 @@
   equal(one+4, "c", 50);
 
   {
-#   if !defined(_AIX) && !defined(__APPLE__)
+#   if !defined(__APPLE__)
     char text[] = "This,is,a,test";
     char *list = strdupa (text);
     equal (strsep (&list, ","), "This", 51);
@@ -1063,7 +1063,7 @@
     }
 }
 
-#if !defined(_AIX) && !defined(__APPLE__)
+#if !defined(__APPLE__)
 static void
 test_mempcpy (void)
 {
@@ -1100,7 +1100,7 @@
       equal (two, "hi there", 12 + (i * 6));
     }
 }
-#endif /* !defined(_AIX) */
+#endif
 
 static void
 test_memmove (void)
@@ -1410,12 +1410,12 @@
   /* strchr.  */
   test_strchr ();
 
-# if !defined(_AIX) && !defined(__APPLE__)
+# if !defined(__APPLE__)
   /* strchrnul.  */
   test_strchrnul ();
 # endif
 
-# if !defined(_AIX) && !defined(__APPLE__)
+# if !defined(__APPLE__)
   /* rawmemchr.  */
   test_rawmemchr ();
 # endif
@@ -1426,7 +1426,7 @@
   /* strrchr.  */
   test_strrchr ();
 
-# if !defined(_AIX) && !defined(__APPLE__)
+# if !defined(__APPLE__)
   /* memrchr.  */
   test_memrchr ();
 # endif
@@ -1467,7 +1467,7 @@
   /* memmove - must work on overlap.  */
   test_memmove ();
 
-# if !defined(_AIX) && !defined(__APPLE__)
+# if !defined(__APPLE__)
   /* mempcpy */
   test_mempcpy ();
 # endif
diff --git a/mpi/Makefile.am b/mpi/Makefile.am
index d00c730..c96701f 100644
--- a/mpi/Makefile.am
+++ b/mpi/Makefile.am
@@ -12,7 +12,6 @@
 LDFLAGS =
 
 EXTRA_DIST = \
-	libmpiwrap_aix5.exp \
 	mpiwrap_type_test.c
 
 #----------------------------------------------------------------------------
@@ -38,15 +37,6 @@
  MPI_FLAG_M3264_PRI = $(AM_FLAG_M3264_PRI)
  MPI_FLAG_M3264_SEC = $(AM_FLAG_M3264_SEC)
 endif
-if VGCONF_OS_IS_AIX5
- # MPICC on AIX is called XLC.  It uses weird options.
- CFLAGS_MPI = -g -O -qflag=w:w -qlanglvl=extended
- LDFLAGS_MPI = -bE:libmpiwrap_aix5.exp -bM:SRE -bnoentry \
-			-qflag=w:w -qlanglvl=extended
- # The sed bit changes eg. "maix32" to "q32" which is the XLC option.
- MPI_FLAG_M3264_PRI = `echo $(AM_FLAG_M3264_PRI) | sed s/maix/q/g`
- MPI_FLAG_M3264_SEC = `echo $(AM_FLAG_M3264_SEC) | sed s/maix/q/g`
-endif
 if VGCONF_OS_IS_DARWIN
  CFLAGS_MPI  = -g -O -fno-omit-frame-pointer -Wall -dynamic
  LDFLAGS_MPI = -dynamic -dynamiclib -all_load
diff --git a/mpi/libmpiwrap.c b/mpi/libmpiwrap.c
index 0e307b3..4aad81f 100644
--- a/mpi/libmpiwrap.c
+++ b/mpi/libmpiwrap.c
@@ -112,21 +112,11 @@
    Open MPI      lib/libmpi.so,   soname = libmpi.so.0
    Quadrics MPI  lib/libmpi.so,   soname = libmpi.so.0
    MPICH         libmpich.so.1.0, soname = libmpich.so.1.0
-   AIX: in /usr/lpp/ppe.poe/lib/libmpi_r.a(mpicore*_r.o)
 
-   For the non-AIX targets, a suitable soname to match with
-   is "libmpi*.so*".
+   A suitable soname to match with is therefore "libmpi*.so*".
 */
-#if defined(_AIX)
-# define I_WRAP_FNNAME_U(_name) \
-         I_WRAP_SONAME_FNNAME_ZU(libmpiZurZdaZLmpicoreZaZurZdoZR,_name)
-  /* Don't change this without also changing all the names in
-     libmpiwrap.exp. */
-#else
-# define I_WRAP_FNNAME_U(_name) \
-         I_WRAP_SONAME_FNNAME_ZU(libmpiZaZdsoZa,_name)
-
-#endif
+#define I_WRAP_FNNAME_U(_name) \
+        I_WRAP_SONAME_FNNAME_ZU(libmpiZaZdsoZa,_name)
 
 
 /* Define HAVE_MPI_STATUS_IGNORE iff we have to deal with
@@ -1124,11 +1114,7 @@
    int    err;
    VALGRIND_GET_ORIG_FN(fn);
    before("Get_count");
-#  if defined(_AIX)
-   check_mem_is_addressable_untyped(status, sizeof(*status));
-#  else
    check_mem_is_defined_untyped(status, sizeof(*status));
-#  endif
    CALL_FN_W_WWW(err, fn, status,ty,count);
    after("Get_count", err);
    return err;
diff --git a/mpi/libmpiwrap_aix5.exp b/mpi/libmpiwrap_aix5.exp
deleted file mode 100644
index 7a3c33d..0000000
--- a/mpi/libmpiwrap_aix5.exp
+++ /dev/null
@@ -1,298 +0,0 @@
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Abort
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Accumulate
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Add_error_class
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Add_error_code
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Add_error_string
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Allgather
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Allgatherv
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Alloc_mem
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Allreduce
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Alltoall
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Alltoallv
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Alltoallw
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Attr_delete
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Attr_get
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Attr_put
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Barrier
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Bcast
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Bsend
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Bsend_init
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Buffer_attach
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Buffer_detach
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Cancel
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Cart_coords
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Cart_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Cart_get
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Cart_map
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Cart_rank
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Cart_shift
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Cart_sub
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Cartdim_get
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Close_port
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_accept
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_call_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_compare
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_connect
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_create_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_create_keyval
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_delete_attr
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_disconnect
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_dup
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_free
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_free_keyval
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_get_attr
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_get_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_get_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_get_parent
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_group
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_join
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_rank
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_remote_group
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_remote_size
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_set_attr
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_set_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_set_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_size
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_spawn
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_spawn_multiple
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_split
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Comm_test_inter
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Dims_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Errhandler_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Errhandler_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Errhandler_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Errhandler_free
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Errhandler_get
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Errhandler_set
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Error_class
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Error_string
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Exscan
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_call_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_close
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_create_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_delete
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_amode
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_atomicity
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_byte_offset
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_group
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_info
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_position
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_position_shared
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_size
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_type_extent
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_get_view
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_iread
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_iread_at
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_iread_shared
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_iwrite
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_iwrite_at
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_iwrite_shared
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_open
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_preallocate
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_all
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_all_begin
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_all_end
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_at
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_at_all
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_at_all_begin
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_at_all_end
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_ordered
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_ordered_begin
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_ordered_end
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_read_shared
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_seek
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_seek_shared
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_set_atomicity
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_set_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_set_info
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_set_size
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_set_view
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_sync
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_all
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_all_begin
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_all_end
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_at
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_at_all
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_at_all_begin
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_at_all_end
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_ordered
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_ordered_begin
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_ordered_end
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_File_write_shared
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Finalize
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Finalized
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Free_mem
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Gather
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Gatherv
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Get
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Get_address
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Get_count
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Get_elements
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Get_processor_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Get_version
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Graph_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Graph_get
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Graph_map
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Graph_neighbors
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Graph_neighbors_count
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Graphdims_get
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Grequest_complete
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Grequest_start
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_compare
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_difference
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_excl
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_free
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_incl
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_intersection
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_range_excl
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_range_incl
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_rank
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_size
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_translate_ranks
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Group_union
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Ibsend
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_delete
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_dup
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_free
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_get
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_get_nkeys
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_get_nthkey
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_get_valuelen
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Info_set
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Init
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Init_thread
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Initialized
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Intercomm_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Intercomm_merge
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Iprobe
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Irecv
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Irsend
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Is_thread_main
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Isend
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Issend
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Keyval_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Keyval_free
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Lookup_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Op_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Op_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Op_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Op_free
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Open_port
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Pack
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Pack_external
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Pack_external_size
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Pack_size
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Probe
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Publish_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Put
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Query_thread
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Recv
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Recv_init
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Reduce
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Reduce_scatter
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Register_datarep
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Request_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Request_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Request_free
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Request_get_status
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Rsend
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Rsend_init
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Scan
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Scatter
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Scatterv
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Send
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Send_init
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Sendrecv
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Sendrecv_replace
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Ssend
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Ssend_init
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Start
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Startall
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Status_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Status_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Status_set_cancelled
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Status_set_elements
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Test
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Test_cancelled
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Testall
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Testany
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Testsome
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Topo_test
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_commit
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_contiguous
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_darray
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_f90_complex
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_f90_integer
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_f90_real
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_hindexed
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_hvector
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_indexed_block
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_keyval
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_resized
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_struct
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_create_subarray
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_delete_attr
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_dup
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_free
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_free_keyval
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_get_attr
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_get_extent
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_get_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_get_true_extent
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_hindexed
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_hvector
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_indexed
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_lb
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_match_size
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_set_attr
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_set_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_size
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_struct
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_ub
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Type_vector
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Unpack
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Unpack_external
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Unpublish_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Wait
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Waitall
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Waitany
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Waitsome
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_c2f
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_call_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_complete
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_create
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_create_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_create_keyval
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_delete_attr
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_f2c
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_fence
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_free
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_free_keyval
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_get_attr
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_get_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_get_group
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_get_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_lock
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_post
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_set_attr
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_set_errhandler
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_set_name
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_start
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_test
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_unlock
-_vgwZU_libmpiZurZdaZLmpicoreZaZurZdoZR_PMPI_Win_wait
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
index 5c3fc81..097adb8 100644
--- a/none/tests/Makefile.am
+++ b/none/tests/Makefile.am
@@ -236,30 +236,18 @@
 pth_once_LDADD		= -lpthread
 pth_rwlock_LDADD	= -lpthread
 pth_stackalign_LDADD	= -lpthread
-if VGCONF_OS_IS_AIX5
- res_search_LDADD       = -lpthread
-else
- res_search_LDADD       = -lresolv -lpthread
- resolv_LDADD           = -lresolv -lpthread
-endif
+res_search_LDADD        = -lresolv -lpthread
+resolv_LDADD            = -lresolv -lpthread
 semlimit_LDADD		= -lpthread
 thread_exits_LDADD	= -lpthread
 threaded_fork_LDADD	= -lpthread
 threadederrno_LDADD	= -lpthread
 tls_SOURCES		= tls.c tls2.c
 tls_DEPENDENCIES	= tls.so tls2.so
-if VGCONF_OS_IS_AIX5
- tls_LDFLAGS		= 
-else
- tls_LDFLAGS		= -Wl,-rpath,$(top_builddir)/none/tests
-endif
+tls_LDFLAGS		= -Wl,-rpath,$(top_builddir)/none/tests
 tls_LDADD		= tls.so tls2.so -lpthread
 tls_so_SOURCES		= tls_so.c
 tls_so_DEPENDENCIES	= tls2.so
-if VGCONF_OS_IS_AIX5
- tls_so_LDFLAGS		= -shared -fPIC
- tls_so_LDADD		= `pwd`/tls2.so
-else
 if VGCONF_OS_IS_DARWIN
  tls_so_LDFLAGS		= -dynamic -dynamiclib -all_load -fpic
  tls_so_LDADD		= `pwd`/tls2.so
@@ -267,13 +255,12 @@
  tls_so_LDFLAGS		= -Wl,-rpath,$(top_builddir)/none/tests -shared -fPIC
  tls_so_LDADD		= tls2.so
 endif
-endif
 tls_so_CFLAGS		= $(AM_CFLAGS) -fPIC
 tls2_so_SOURCES		= tls2_so.c
 if VGCONF_OS_IS_DARWIN
-tls2_so_LDFLAGS		= -dynamic -dynamiclib -all_load
+ tls2_so_LDFLAGS	= -dynamic -dynamiclib -all_load
 else
-tls2_so_LDFLAGS		= -shared
+ tls2_so_LDFLAGS	= -shared
 endif
 
 valgrind_cpp_test_SOURCES = valgrind_cpp_test.cpp
diff --git a/none/tests/amd64/xadd.c b/none/tests/amd64/xadd.c
index 38d4f20..78c495b 100644
--- a/none/tests/amd64/xadd.c
+++ b/none/tests/amd64/xadd.c
@@ -10,12 +10,10 @@
 #undef PLAT_amd64_linux
 #undef PLAT_ppc32_linux
 #undef PLAT_ppc64_linux
-#undef PLAT_ppc32_aix5
-#undef PLAT_ppc64_aix5
 
-#if !defined(_AIX) && defined(__i386__)
+#if defined(__i386__)
 #  define PLAT_x86_linux 1
-#elif !defined(_AIX) && defined(__x86_64__)
+#elif defined(__x86_64__)
 #  define PLAT_amd64_linux 1
 #endif
 
diff --git a/none/tests/fdleak_cmsg.c b/none/tests/fdleak_cmsg.c
index 0bb32da..530932b 100644
--- a/none/tests/fdleak_cmsg.c
+++ b/none/tests/fdleak_cmsg.c
@@ -1,22 +1,22 @@
 
-/* On AIX 5.2, _LINUX_SOURCE_COMPAT needs to be defined when reading
-   sys/socket.h in order to make CMSG_SPACE and CMSG_LEN visible. */
 
-#if defined(_AIX)
-#define _LINUX_SOURCE_COMPAT 1
-#endif
+
+
+
+
+
 
 #include <sys/socket.h>
 
-#if defined(_AIX)
-#undef _LINUX_SOURCE_COMPAT
-#endif
 
 
-/* Needed for 'memset' on AIX 5.2 */
-#if defined(_AIX)
-# include <memory.h>
-#endif
+
+
+
+
+
+
+
 
 #include <string.h>
 #include <sys/types.h>
diff --git a/none/tests/pth_atfork1.c b/none/tests/pth_atfork1.c
index df5ef98..99a087f 100644
--- a/none/tests/pth_atfork1.c
+++ b/none/tests/pth_atfork1.c
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#if !defined(_AIX) && !defined(__APPLE__)
+#if !defined(__APPLE__)
 # include <error.h>
 #endif
 #include <stdlib.h>
@@ -27,7 +27,7 @@
 #include <sys/wait.h>
 #include <stdio.h>
 
-#if defined(_AIX) || defined(__APPLE__)
+#if defined(__APPLE__)
 #include <string.h>  /* strerror */
 static void error (int status, int errnum, char* msg)
 {
diff --git a/none/tests/x86/xadd.c b/none/tests/x86/xadd.c
index 38d4f20..78c495b 100644
--- a/none/tests/x86/xadd.c
+++ b/none/tests/x86/xadd.c
@@ -10,12 +10,10 @@
 #undef PLAT_amd64_linux
 #undef PLAT_ppc32_linux
 #undef PLAT_ppc64_linux
-#undef PLAT_ppc32_aix5
-#undef PLAT_ppc64_aix5
 
-#if !defined(_AIX) && defined(__i386__)
+#if defined(__i386__)
 #  define PLAT_x86_linux 1
-#elif !defined(_AIX) && defined(__x86_64__)
+#elif defined(__x86_64__)
 #  define PLAT_amd64_linux 1
 #endif
 
diff --git a/tests/arch_test.c b/tests/arch_test.c
index 564fb2d..4263c89 100644
--- a/tests/arch_test.c
+++ b/tests/arch_test.c
@@ -51,15 +51,6 @@
 #elif defined(VGP_s390x_linux)
    if ( 0 == strcmp( arch, "s390x" ) ) return True;
 
-#elif defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
-   if (sizeof(void*) == 8) {
-      /* CPU is in 64-bit mode */
-      if ( 0 == strcmp( arch, "ppc64" ) ) return True;
-      if ( 0 == strcmp( arch, "ppc32" ) ) return True;
-   } else {
-      if ( 0 == strcmp( arch, "ppc32" ) ) return True;
-   }
-
 #elif defined(VGP_arm_linux)
    if ( 0 == strcmp( arch, "arm" ) ) return True;
 
diff --git a/tests/os_test.c b/tests/os_test.c
index a65115c..d13bd60 100644
--- a/tests/os_test.c
+++ b/tests/os_test.c
@@ -21,7 +21,6 @@
 
 char* all_OSes[] = {
    "linux",
-   "aix5",
    "darwin",
    NULL
 };
@@ -31,9 +30,6 @@
 #if defined(VGO_linux)
    if ( 0 == strcmp( OS, "linux" ) ) return True;
 
-#elif defined(VGO_aix5)
-   if ( 0 == strcmp( OS, "aix5" ) ) return True;
-
 #elif defined(VGO_darwin)
    if ( 0 == strcmp( OS, "darwin" ) ) return True;