Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2008-11-20 23:20:51 +0300
committerJeff Johnston <jjohnstn@redhat.com>2008-11-20 23:20:51 +0300
commit75cc619bb3dc7929b23fa561abe1202711befb30 (patch)
tree9492bde08d48ba42b8b1393aa20cb0c323e07767
parent01eb6cd6d94249e6571aa741b8bfc195ef69f306 (diff)
2008-11-20 Ken Werner <ken.werner@de.ibm.com>
Patrick Mansfield <patmans@us.ibm.com> Joel Schopp <jschopp@austin.ibm.com> * libc/machine/spu/configure.in: Add __ea detection. * libc/machine/spu/Makefile.am: Add new files. * libc/machine/spu/include/ea.h: New file. * libc/machine/spu/ea_internal.h: Likewise. * libc/machine/spu/sys/mman.h: Likewise. * libc/machine/spu/mmap_ea.c: Likewise. * libc/machine/spu/munmap_ea.c: Likewise. * libc/machine/spu/mremap_ea.c: Likewise. * libc/machine/spu/msync_ea.c: Likewise. * libc/machine/spu/memchr_ea.c: Likewise. * libc/machine/spu/memcmp_ea.c: Likewise. * libc/machine/spu/memcpy_ea.c: Likewise. * libc/machine/spu/memmove_ea.c: Likewise. * libc/machine/spu/memset_ea.c: Likewise. * libc/machine/spu/malloc_ea.c: Likewise. * libc/machine/spu/realloc_ea.c: Likewise. * libc/machine/spu/calloc_ea.c: Likewise. * libc/machine/spu/free_ea.c: Likewise. * libc/machine/spu/posix_memalign_ea.c: Likewise. * libc/machine/spu/strcat_ea.c: Likewise. * libc/machine/spu/strchr_ea.c: Likewise. * libc/machine/spu/strcmp_ea.c: Likewise. * libc/machine/spu/strcpy_ea.c: Likewise. * libc/machine/spu/strcspn_ea.c: Likewise. * libc/machine/spu/strlen_ea.c: Likewise. * libc/machine/spu/strncat_ea.c: Likewise. * libc/machine/spu/strncmp_ea.c: Likewise. * libc/machine/spu/strncpy_ea.c: Likewise. * libc/machine/spu/strpbrk_ea.c: Likewise. * libc/machine/spu/strrchr_ea.c: Likewise. * libc/machine/spu/strspn_ea.c: Likewise. * libc/machine/spu/strstr_ea.c: Likewise. * libc/machine/spu/read_ea.c: Likewise. * libc/machine/spu/pread_ea.c: Likewise. * libc/machine/spu/readv_ea.c: Likewise. * libc/machine/spu/write_ea.c: Likewise. * libc/machine/spu/pwrite_ea.c: Likewise. * libc/machine/spu/writev_ea.c: Likewise.
-rw-r--r--newlib/ChangeLog43
-rw-r--r--newlib/libc/machine/spu/Makefile.am9
-rw-r--r--newlib/libc/machine/spu/Makefile.in293
-rw-r--r--newlib/libc/machine/spu/calloc_ea.c56
-rw-r--r--newlib/libc/machine/spu/configure41
-rw-r--r--newlib/libc/machine/spu/configure.in16
-rw-r--r--newlib/libc/machine/spu/ea_internal.h147
-rw-r--r--newlib/libc/machine/spu/free_ea.c51
-rw-r--r--newlib/libc/machine/spu/include/ea.h137
-rw-r--r--newlib/libc/machine/spu/malloc_ea.c47
-rw-r--r--newlib/libc/machine/spu/memchr_ea.c73
-rw-r--r--newlib/libc/machine/spu/memcmp_ea.c78
-rw-r--r--newlib/libc/machine/spu/memcpy_ea.c76
-rw-r--r--newlib/libc/machine/spu/memmove_ea.c77
-rw-r--r--newlib/libc/machine/spu/memset_ea.c64
-rw-r--r--newlib/libc/machine/spu/mmap_ea.c61
-rw-r--r--newlib/libc/machine/spu/mremap_ea.c62
-rw-r--r--newlib/libc/machine/spu/msync_ea.c44
-rw-r--r--newlib/libc/machine/spu/munmap_ea.c43
-rw-r--r--newlib/libc/machine/spu/posix_memalign_ea.c66
-rw-r--r--newlib/libc/machine/spu/pread_ea.c59
-rw-r--r--newlib/libc/machine/spu/pwrite_ea.c59
-rw-r--r--newlib/libc/machine/spu/read_ea.c59
-rw-r--r--newlib/libc/machine/spu/readv_ea.c69
-rw-r--r--newlib/libc/machine/spu/realloc_ea.c55
-rw-r--r--newlib/libc/machine/spu/strcat_ea.c55
-rw-r--r--newlib/libc/machine/spu/strchr_ea.c47
-rw-r--r--newlib/libc/machine/spu/strcmp_ea.c86
-rw-r--r--newlib/libc/machine/spu/strcpy_ea.c51
-rw-r--r--newlib/libc/machine/spu/strcspn_ea.c63
-rw-r--r--newlib/libc/machine/spu/strlen_ea.c67
-rw-r--r--newlib/libc/machine/spu/strncat_ea.c60
-rw-r--r--newlib/libc/machine/spu/strncmp_ea.c87
-rw-r--r--newlib/libc/machine/spu/strncpy_ea.c57
-rw-r--r--newlib/libc/machine/spu/strpbrk_ea.c47
-rw-r--r--newlib/libc/machine/spu/strrchr_ea.c84
-rw-r--r--newlib/libc/machine/spu/strspn_ea.c65
-rw-r--r--newlib/libc/machine/spu/strstr_ea.c75
-rw-r--r--newlib/libc/machine/spu/sys/mman.h85
-rw-r--r--newlib/libc/machine/spu/write_ea.c60
-rw-r--r--newlib/libc/machine/spu/writev_ea.c69
41 files changed, 2825 insertions, 18 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index c186a4728..eceb979d3 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,46 @@
+2008-11-20 Ken Werner <ken.werner@de.ibm.com>
+ Patrick Mansfield <patmans@us.ibm.com>
+ Joel Schopp <jschopp@austin.ibm.com>
+
+ * libc/machine/spu/configure.in: Add __ea detection.
+ * libc/machine/spu/Makefile.am: Add new files.
+ * libc/machine/spu/include/ea.h: New file.
+ * libc/machine/spu/ea_internal.h: Likewise.
+ * libc/machine/spu/sys/mman.h: Likewise.
+ * libc/machine/spu/mmap_ea.c: Likewise.
+ * libc/machine/spu/munmap_ea.c: Likewise.
+ * libc/machine/spu/mremap_ea.c: Likewise.
+ * libc/machine/spu/msync_ea.c: Likewise.
+ * libc/machine/spu/memchr_ea.c: Likewise.
+ * libc/machine/spu/memcmp_ea.c: Likewise.
+ * libc/machine/spu/memcpy_ea.c: Likewise.
+ * libc/machine/spu/memmove_ea.c: Likewise.
+ * libc/machine/spu/memset_ea.c: Likewise.
+ * libc/machine/spu/malloc_ea.c: Likewise.
+ * libc/machine/spu/realloc_ea.c: Likewise.
+ * libc/machine/spu/calloc_ea.c: Likewise.
+ * libc/machine/spu/free_ea.c: Likewise.
+ * libc/machine/spu/posix_memalign_ea.c: Likewise.
+ * libc/machine/spu/strcat_ea.c: Likewise.
+ * libc/machine/spu/strchr_ea.c: Likewise.
+ * libc/machine/spu/strcmp_ea.c: Likewise.
+ * libc/machine/spu/strcpy_ea.c: Likewise.
+ * libc/machine/spu/strcspn_ea.c: Likewise.
+ * libc/machine/spu/strlen_ea.c: Likewise.
+ * libc/machine/spu/strncat_ea.c: Likewise.
+ * libc/machine/spu/strncmp_ea.c: Likewise.
+ * libc/machine/spu/strncpy_ea.c: Likewise.
+ * libc/machine/spu/strpbrk_ea.c: Likewise.
+ * libc/machine/spu/strrchr_ea.c: Likewise.
+ * libc/machine/spu/strspn_ea.c: Likewise.
+ * libc/machine/spu/strstr_ea.c: Likewise.
+ * libc/machine/spu/read_ea.c: Likewise.
+ * libc/machine/spu/pread_ea.c: Likewise.
+ * libc/machine/spu/readv_ea.c: Likewise.
+ * libc/machine/spu/write_ea.c: Likewise.
+ * libc/machine/spu/pwrite_ea.c: Likewise.
+ * libc/machine/spu/writev_ea.c: Likewise.
+
2008-11-19 Joel Sherrill <joel.sherrill@oarcorp.com>
* libc/include/sys/config.h[__mips__]: Don't bother
diff --git a/newlib/libc/machine/spu/Makefile.am b/newlib/libc/machine/spu/Makefile.am
index 070779140..8a192dd0a 100644
--- a/newlib/libc/machine/spu/Makefile.am
+++ b/newlib/libc/machine/spu/Makefile.am
@@ -25,6 +25,15 @@ lib_a_SOURCES = setjmp.S assert.c clearerr.c creat.c fclose.c feof.c \
spu_timer_slih.c spu_timer_slih_reg.c spu_timer_svcs.c \
spu_timer_stop.c spu_timer_free.c spu_timebase.c
+if HAVE_SPU_EA
+lib_a_SOURCES += calloc_ea.c free_ea.c malloc_ea.c memchr_ea.c memcmp_ea.c \
+ memcpy_ea.c memmove_ea.c memset_ea.c mmap_ea.c mremap_ea.c msync_ea.c \
+ munmap_ea.c posix_memalign_ea.c realloc_ea.c strcat_ea.c strchr_ea.c \
+ strcmp_ea.c strcpy_ea.c strcspn_ea.c strlen_ea.c strncat_ea.c strncmp_ea.c \
+ strncpy_ea.c strpbrk_ea.c strrchr_ea.c strspn_ea.c strstr_ea.c read_ea.c \
+ pread_ea.c readv_ea.c write_ea.c pwrite_ea.c writev_ea.c
+endif
+
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/spu/Makefile.in b/newlib/libc/machine/spu/Makefile.in
index d219c9601..723ec4085 100644
--- a/newlib/libc/machine/spu/Makefile.in
+++ b/newlib/libc/machine/spu/Makefile.in
@@ -36,6 +36,13 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+@HAVE_SPU_EA_TRUE@am__append_1 = calloc_ea.c free_ea.c malloc_ea.c memchr_ea.c memcmp_ea.c \
+@HAVE_SPU_EA_TRUE@ memcpy_ea.c memmove_ea.c memset_ea.c mmap_ea.c mremap_ea.c msync_ea.c \
+@HAVE_SPU_EA_TRUE@ munmap_ea.c posix_memalign_ea.c realloc_ea.c strcat_ea.c strchr_ea.c \
+@HAVE_SPU_EA_TRUE@ strcmp_ea.c strcpy_ea.c strcspn_ea.c strlen_ea.c strncat_ea.c strncmp_ea.c \
+@HAVE_SPU_EA_TRUE@ strncpy_ea.c strpbrk_ea.c strrchr_ea.c strspn_ea.c strstr_ea.c read_ea.c \
+@HAVE_SPU_EA_TRUE@ pread_ea.c readv_ea.c write_ea.c pwrite_ea.c writev_ea.c
+
DIST_COMMON = $(srcdir)/../../../../config.guess \
$(srcdir)/../../../../config.sub $(srcdir)/Makefile.in \
$(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -78,7 +85,24 @@ DIST_COMMON = $(srcdir)/../../../../config.guess \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
- $(srcdir)/../../../../compile $(srcdir)/../../../../compile
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
+ $(srcdir)/../../../../compile
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../../../acinclude.m4 \
@@ -93,6 +117,39 @@ LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
lib_a_AR = $(AR) $(ARFLAGS)
lib_a_LIBADD =
+@HAVE_SPU_EA_TRUE@am__objects_1 = lib_a-calloc_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-free_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-malloc_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-memchr_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-memcmp_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-memcpy_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-memmove_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-memset_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-mmap_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-mremap_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-msync_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-munmap_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-posix_memalign_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-realloc_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strcat_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strchr_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strcmp_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strcpy_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strcspn_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strlen_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strncat_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strncmp_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strncpy_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strpbrk_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strrchr_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strspn_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-strstr_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-read_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-pread_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-readv_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-write_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-pwrite_ea.$(OBJEXT) \
+@HAVE_SPU_EA_TRUE@ lib_a-writev_ea.$(OBJEXT)
am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-assert.$(OBJEXT) \
lib_a-clearerr.$(OBJEXT) lib_a-creat.$(OBJEXT) \
lib_a-fclose.$(OBJEXT) lib_a-feof.$(OBJEXT) \
@@ -140,7 +197,8 @@ am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-assert.$(OBJEXT) \
lib_a-spu_timer_flih.$(OBJEXT) lib_a-spu_timer_slih.$(OBJEXT) \
lib_a-spu_timer_slih_reg.$(OBJEXT) \
lib_a-spu_timer_svcs.$(OBJEXT) lib_a-spu_timer_stop.$(OBJEXT) \
- lib_a-spu_timer_free.$(OBJEXT) lib_a-spu_timebase.$(OBJEXT)
+ lib_a-spu_timer_free.$(OBJEXT) lib_a-spu_timebase.$(OBJEXT) \
+ $(am__objects_1)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp =
@@ -183,6 +241,8 @@ ELIX_LEVEL_3_FALSE = @ELIX_LEVEL_3_FALSE@
ELIX_LEVEL_3_TRUE = @ELIX_LEVEL_3_TRUE@
ELIX_LEVEL_4_FALSE = @ELIX_LEVEL_4_FALSE@
ELIX_LEVEL_4_TRUE = @ELIX_LEVEL_4_TRUE@
+HAVE_SPU_EA_FALSE = @HAVE_SPU_EA_FALSE@
+HAVE_SPU_EA_TRUE = @HAVE_SPU_EA_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -266,22 +326,23 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
AM_CCASFLAGS = $(INCLUDES)
lib_a_SOURCES = setjmp.S assert.c clearerr.c creat.c fclose.c feof.c \
- ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c fiprintf.S \
- fiscanf.S fopen.c fprintf.S fputc.c fputs.c fread.c freopen.c \
- fscanf.S fseek.c fsetpos.c ftell.c fwrite.c getc.c getchar.c \
- gets.c impure.c iprintf.S iscanf.S memcmp.c memcpy.c memmove.c \
- memset.c perror.c printf.S putc.c putchar.c puts.c remove.c \
- rename.c rewind.c scanf.S setbuf.c setvbuf.c siprintf.S siscanf.S \
- sleep.c sniprintf.S snprintf.S sprintf.S sscanf.S stdio.c strcat.c \
- strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c \
- strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c tmpfile.c \
- tmpnam.c ungetc.c usleep.c vfiprintf.c vfiscanf.c vfprintf.c \
- vfscanf.c viprintf.c viscanf.c vprintf.c vscanf.c vsiprintf.c \
- vsiscanf.c vsniprintf.c vsnprintf.c vsprintf.c vsscanf.c \
- stack_reg_va.S spu_clock_svcs.c spu_clock_stop.c spu_timer_flih.S \
+ ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c \
+ fiprintf.S fiscanf.S fopen.c fprintf.S fputc.c fputs.c fread.c \
+ freopen.c fscanf.S fseek.c fsetpos.c ftell.c fwrite.c getc.c \
+ getchar.c gets.c impure.c iprintf.S iscanf.S memcmp.c memcpy.c \
+ memmove.c memset.c perror.c printf.S putc.c putchar.c puts.c \
+ remove.c rename.c rewind.c scanf.S setbuf.c setvbuf.c \
+ siprintf.S siscanf.S sleep.c sniprintf.S snprintf.S sprintf.S \
+ sscanf.S stdio.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \
+ strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c \
+ strspn.c strxfrm.c tmpfile.c tmpnam.c ungetc.c usleep.c \
+ vfiprintf.c vfiscanf.c vfprintf.c vfscanf.c viprintf.c \
+ viscanf.c vprintf.c vscanf.c vsiprintf.c vsiscanf.c \
+ vsniprintf.c vsnprintf.c vsprintf.c vsscanf.c stack_reg_va.S \
+ spu_clock_svcs.c spu_clock_stop.c spu_timer_flih.S \
spu_timer_slih.c spu_timer_slih_reg.c spu_timer_svcs.c \
- spu_timer_stop.c spu_timer_free.c spu_timebase.c
-
+ spu_timer_stop.c spu_timer_free.c spu_timebase.c \
+ $(am__append_1)
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
@@ -918,6 +979,204 @@ lib_a-spu_timebase.o: spu_timebase.c
lib_a-spu_timebase.obj: spu_timebase.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timebase.obj `if test -f 'spu_timebase.c'; then $(CYGPATH_W) 'spu_timebase.c'; else $(CYGPATH_W) '$(srcdir)/spu_timebase.c'; fi`
+
+lib_a-calloc_ea.o: calloc_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-calloc_ea.o `test -f 'calloc_ea.c' || echo '$(srcdir)/'`calloc_ea.c
+
+lib_a-calloc_ea.obj: calloc_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-calloc_ea.obj `if test -f 'calloc_ea.c'; then $(CYGPATH_W) 'calloc_ea.c'; else $(CYGPATH_W) '$(srcdir)/calloc_ea.c'; fi`
+
+lib_a-free_ea.o: free_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-free_ea.o `test -f 'free_ea.c' || echo '$(srcdir)/'`free_ea.c
+
+lib_a-free_ea.obj: free_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-free_ea.obj `if test -f 'free_ea.c'; then $(CYGPATH_W) 'free_ea.c'; else $(CYGPATH_W) '$(srcdir)/free_ea.c'; fi`
+
+lib_a-malloc_ea.o: malloc_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-malloc_ea.o `test -f 'malloc_ea.c' || echo '$(srcdir)/'`malloc_ea.c
+
+lib_a-malloc_ea.obj: malloc_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-malloc_ea.obj `if test -f 'malloc_ea.c'; then $(CYGPATH_W) 'malloc_ea.c'; else $(CYGPATH_W) '$(srcdir)/malloc_ea.c'; fi`
+
+lib_a-memchr_ea.o: memchr_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memchr_ea.o `test -f 'memchr_ea.c' || echo '$(srcdir)/'`memchr_ea.c
+
+lib_a-memchr_ea.obj: memchr_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memchr_ea.obj `if test -f 'memchr_ea.c'; then $(CYGPATH_W) 'memchr_ea.c'; else $(CYGPATH_W) '$(srcdir)/memchr_ea.c'; fi`
+
+lib_a-memcmp_ea.o: memcmp_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcmp_ea.o `test -f 'memcmp_ea.c' || echo '$(srcdir)/'`memcmp_ea.c
+
+lib_a-memcmp_ea.obj: memcmp_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcmp_ea.obj `if test -f 'memcmp_ea.c'; then $(CYGPATH_W) 'memcmp_ea.c'; else $(CYGPATH_W) '$(srcdir)/memcmp_ea.c'; fi`
+
+lib_a-memcpy_ea.o: memcpy_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy_ea.o `test -f 'memcpy_ea.c' || echo '$(srcdir)/'`memcpy_ea.c
+
+lib_a-memcpy_ea.obj: memcpy_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy_ea.obj `if test -f 'memcpy_ea.c'; then $(CYGPATH_W) 'memcpy_ea.c'; else $(CYGPATH_W) '$(srcdir)/memcpy_ea.c'; fi`
+
+lib_a-memmove_ea.o: memmove_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memmove_ea.o `test -f 'memmove_ea.c' || echo '$(srcdir)/'`memmove_ea.c
+
+lib_a-memmove_ea.obj: memmove_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memmove_ea.obj `if test -f 'memmove_ea.c'; then $(CYGPATH_W) 'memmove_ea.c'; else $(CYGPATH_W) '$(srcdir)/memmove_ea.c'; fi`
+
+lib_a-memset_ea.o: memset_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memset_ea.o `test -f 'memset_ea.c' || echo '$(srcdir)/'`memset_ea.c
+
+lib_a-memset_ea.obj: memset_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memset_ea.obj `if test -f 'memset_ea.c'; then $(CYGPATH_W) 'memset_ea.c'; else $(CYGPATH_W) '$(srcdir)/memset_ea.c'; fi`
+
+lib_a-mmap_ea.o: mmap_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-mmap_ea.o `test -f 'mmap_ea.c' || echo '$(srcdir)/'`mmap_ea.c
+
+lib_a-mmap_ea.obj: mmap_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-mmap_ea.obj `if test -f 'mmap_ea.c'; then $(CYGPATH_W) 'mmap_ea.c'; else $(CYGPATH_W) '$(srcdir)/mmap_ea.c'; fi`
+
+lib_a-mremap_ea.o: mremap_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-mremap_ea.o `test -f 'mremap_ea.c' || echo '$(srcdir)/'`mremap_ea.c
+
+lib_a-mremap_ea.obj: mremap_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-mremap_ea.obj `if test -f 'mremap_ea.c'; then $(CYGPATH_W) 'mremap_ea.c'; else $(CYGPATH_W) '$(srcdir)/mremap_ea.c'; fi`
+
+lib_a-msync_ea.o: msync_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-msync_ea.o `test -f 'msync_ea.c' || echo '$(srcdir)/'`msync_ea.c
+
+lib_a-msync_ea.obj: msync_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-msync_ea.obj `if test -f 'msync_ea.c'; then $(CYGPATH_W) 'msync_ea.c'; else $(CYGPATH_W) '$(srcdir)/msync_ea.c'; fi`
+
+lib_a-munmap_ea.o: munmap_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-munmap_ea.o `test -f 'munmap_ea.c' || echo '$(srcdir)/'`munmap_ea.c
+
+lib_a-munmap_ea.obj: munmap_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-munmap_ea.obj `if test -f 'munmap_ea.c'; then $(CYGPATH_W) 'munmap_ea.c'; else $(CYGPATH_W) '$(srcdir)/munmap_ea.c'; fi`
+
+lib_a-posix_memalign_ea.o: posix_memalign_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-posix_memalign_ea.o `test -f 'posix_memalign_ea.c' || echo '$(srcdir)/'`posix_memalign_ea.c
+
+lib_a-posix_memalign_ea.obj: posix_memalign_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-posix_memalign_ea.obj `if test -f 'posix_memalign_ea.c'; then $(CYGPATH_W) 'posix_memalign_ea.c'; else $(CYGPATH_W) '$(srcdir)/posix_memalign_ea.c'; fi`
+
+lib_a-realloc_ea.o: realloc_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-realloc_ea.o `test -f 'realloc_ea.c' || echo '$(srcdir)/'`realloc_ea.c
+
+lib_a-realloc_ea.obj: realloc_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-realloc_ea.obj `if test -f 'realloc_ea.c'; then $(CYGPATH_W) 'realloc_ea.c'; else $(CYGPATH_W) '$(srcdir)/realloc_ea.c'; fi`
+
+lib_a-strcat_ea.o: strcat_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcat_ea.o `test -f 'strcat_ea.c' || echo '$(srcdir)/'`strcat_ea.c
+
+lib_a-strcat_ea.obj: strcat_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcat_ea.obj `if test -f 'strcat_ea.c'; then $(CYGPATH_W) 'strcat_ea.c'; else $(CYGPATH_W) '$(srcdir)/strcat_ea.c'; fi`
+
+lib_a-strchr_ea.o: strchr_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strchr_ea.o `test -f 'strchr_ea.c' || echo '$(srcdir)/'`strchr_ea.c
+
+lib_a-strchr_ea.obj: strchr_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strchr_ea.obj `if test -f 'strchr_ea.c'; then $(CYGPATH_W) 'strchr_ea.c'; else $(CYGPATH_W) '$(srcdir)/strchr_ea.c'; fi`
+
+lib_a-strcmp_ea.o: strcmp_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcmp_ea.o `test -f 'strcmp_ea.c' || echo '$(srcdir)/'`strcmp_ea.c
+
+lib_a-strcmp_ea.obj: strcmp_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcmp_ea.obj `if test -f 'strcmp_ea.c'; then $(CYGPATH_W) 'strcmp_ea.c'; else $(CYGPATH_W) '$(srcdir)/strcmp_ea.c'; fi`
+
+lib_a-strcpy_ea.o: strcpy_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy_ea.o `test -f 'strcpy_ea.c' || echo '$(srcdir)/'`strcpy_ea.c
+
+lib_a-strcpy_ea.obj: strcpy_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy_ea.obj `if test -f 'strcpy_ea.c'; then $(CYGPATH_W) 'strcpy_ea.c'; else $(CYGPATH_W) '$(srcdir)/strcpy_ea.c'; fi`
+
+lib_a-strcspn_ea.o: strcspn_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcspn_ea.o `test -f 'strcspn_ea.c' || echo '$(srcdir)/'`strcspn_ea.c
+
+lib_a-strcspn_ea.obj: strcspn_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcspn_ea.obj `if test -f 'strcspn_ea.c'; then $(CYGPATH_W) 'strcspn_ea.c'; else $(CYGPATH_W) '$(srcdir)/strcspn_ea.c'; fi`
+
+lib_a-strlen_ea.o: strlen_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strlen_ea.o `test -f 'strlen_ea.c' || echo '$(srcdir)/'`strlen_ea.c
+
+lib_a-strlen_ea.obj: strlen_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strlen_ea.obj `if test -f 'strlen_ea.c'; then $(CYGPATH_W) 'strlen_ea.c'; else $(CYGPATH_W) '$(srcdir)/strlen_ea.c'; fi`
+
+lib_a-strncat_ea.o: strncat_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncat_ea.o `test -f 'strncat_ea.c' || echo '$(srcdir)/'`strncat_ea.c
+
+lib_a-strncat_ea.obj: strncat_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncat_ea.obj `if test -f 'strncat_ea.c'; then $(CYGPATH_W) 'strncat_ea.c'; else $(CYGPATH_W) '$(srcdir)/strncat_ea.c'; fi`
+
+lib_a-strncmp_ea.o: strncmp_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncmp_ea.o `test -f 'strncmp_ea.c' || echo '$(srcdir)/'`strncmp_ea.c
+
+lib_a-strncmp_ea.obj: strncmp_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncmp_ea.obj `if test -f 'strncmp_ea.c'; then $(CYGPATH_W) 'strncmp_ea.c'; else $(CYGPATH_W) '$(srcdir)/strncmp_ea.c'; fi`
+
+lib_a-strncpy_ea.o: strncpy_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncpy_ea.o `test -f 'strncpy_ea.c' || echo '$(srcdir)/'`strncpy_ea.c
+
+lib_a-strncpy_ea.obj: strncpy_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncpy_ea.obj `if test -f 'strncpy_ea.c'; then $(CYGPATH_W) 'strncpy_ea.c'; else $(CYGPATH_W) '$(srcdir)/strncpy_ea.c'; fi`
+
+lib_a-strpbrk_ea.o: strpbrk_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strpbrk_ea.o `test -f 'strpbrk_ea.c' || echo '$(srcdir)/'`strpbrk_ea.c
+
+lib_a-strpbrk_ea.obj: strpbrk_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strpbrk_ea.obj `if test -f 'strpbrk_ea.c'; then $(CYGPATH_W) 'strpbrk_ea.c'; else $(CYGPATH_W) '$(srcdir)/strpbrk_ea.c'; fi`
+
+lib_a-strrchr_ea.o: strrchr_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strrchr_ea.o `test -f 'strrchr_ea.c' || echo '$(srcdir)/'`strrchr_ea.c
+
+lib_a-strrchr_ea.obj: strrchr_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strrchr_ea.obj `if test -f 'strrchr_ea.c'; then $(CYGPATH_W) 'strrchr_ea.c'; else $(CYGPATH_W) '$(srcdir)/strrchr_ea.c'; fi`
+
+lib_a-strspn_ea.o: strspn_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strspn_ea.o `test -f 'strspn_ea.c' || echo '$(srcdir)/'`strspn_ea.c
+
+lib_a-strspn_ea.obj: strspn_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strspn_ea.obj `if test -f 'strspn_ea.c'; then $(CYGPATH_W) 'strspn_ea.c'; else $(CYGPATH_W) '$(srcdir)/strspn_ea.c'; fi`
+
+lib_a-strstr_ea.o: strstr_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strstr_ea.o `test -f 'strstr_ea.c' || echo '$(srcdir)/'`strstr_ea.c
+
+lib_a-strstr_ea.obj: strstr_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strstr_ea.obj `if test -f 'strstr_ea.c'; then $(CYGPATH_W) 'strstr_ea.c'; else $(CYGPATH_W) '$(srcdir)/strstr_ea.c'; fi`
+
+lib_a-read_ea.o: read_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-read_ea.o `test -f 'read_ea.c' || echo '$(srcdir)/'`read_ea.c
+
+lib_a-read_ea.obj: read_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-read_ea.obj `if test -f 'read_ea.c'; then $(CYGPATH_W) 'read_ea.c'; else $(CYGPATH_W) '$(srcdir)/read_ea.c'; fi`
+
+lib_a-pread_ea.o: pread_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-pread_ea.o `test -f 'pread_ea.c' || echo '$(srcdir)/'`pread_ea.c
+
+lib_a-pread_ea.obj: pread_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-pread_ea.obj `if test -f 'pread_ea.c'; then $(CYGPATH_W) 'pread_ea.c'; else $(CYGPATH_W) '$(srcdir)/pread_ea.c'; fi`
+
+lib_a-readv_ea.o: readv_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-readv_ea.o `test -f 'readv_ea.c' || echo '$(srcdir)/'`readv_ea.c
+
+lib_a-readv_ea.obj: readv_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-readv_ea.obj `if test -f 'readv_ea.c'; then $(CYGPATH_W) 'readv_ea.c'; else $(CYGPATH_W) '$(srcdir)/readv_ea.c'; fi`
+
+lib_a-write_ea.o: write_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-write_ea.o `test -f 'write_ea.c' || echo '$(srcdir)/'`write_ea.c
+
+lib_a-write_ea.obj: write_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-write_ea.obj `if test -f 'write_ea.c'; then $(CYGPATH_W) 'write_ea.c'; else $(CYGPATH_W) '$(srcdir)/write_ea.c'; fi`
+
+lib_a-pwrite_ea.o: pwrite_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-pwrite_ea.o `test -f 'pwrite_ea.c' || echo '$(srcdir)/'`pwrite_ea.c
+
+lib_a-pwrite_ea.obj: pwrite_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-pwrite_ea.obj `if test -f 'pwrite_ea.c'; then $(CYGPATH_W) 'pwrite_ea.c'; else $(CYGPATH_W) '$(srcdir)/pwrite_ea.c'; fi`
+
+lib_a-writev_ea.o: writev_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-writev_ea.o `test -f 'writev_ea.c' || echo '$(srcdir)/'`writev_ea.c
+
+lib_a-writev_ea.obj: writev_ea.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-writev_ea.obj `if test -f 'writev_ea.c'; then $(CYGPATH_W) 'writev_ea.c'; else $(CYGPATH_W) '$(srcdir)/writev_ea.c'; fi`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
diff --git a/newlib/libc/machine/spu/calloc_ea.c b/newlib/libc/machine/spu/calloc_ea.c
new file mode 100644
index 000000000..019bf4b1a
--- /dev/null
+++ b/newlib/libc/machine/spu/calloc_ea.c
@@ -0,0 +1,56 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include <sys/syscall.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+typedef struct
+{
+ unsigned long long nmemb;
+ unsigned int pad0[2];
+ unsigned long long length;
+ unsigned int pad1[2];
+} calloc_ea_t;
+
+COMPAT_EA_ALIAS (calloc_ea);
+
+__ea void *
+calloc_ea (size_ea_t nmemb, size_ea_t length)
+{
+ calloc_ea_t args;
+
+ args.nmemb = (unsigned long long) nmemb;
+ args.length = (unsigned long long) length;
+ __send_to_ppe (JSRE_LIBEA_SIGNALCODE, SPE_LIBEA_CALLOC, &args);
+ return ull_to_eavoid (args.nmemb);
+}
diff --git a/newlib/libc/machine/spu/configure b/newlib/libc/machine/spu/configure
index f111ce34c..c47f7b1cb 100644
--- a/newlib/libc/machine/spu/configure
+++ b/newlib/libc/machine/spu/configure
@@ -272,7 +272,7 @@ PACKAGE_STRING='newlib 1.16.0'
PACKAGE_BUGREPORT=''
ac_unique_file="Makefile.am"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAY_SUPPLY_SYSCALLS_TRUE MAY_SUPPLY_SYSCALLS_FALSE newlib_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB READELF ac_ct_READELF MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CCAS CCASFLAGS NEWLIB_CFLAGS LDFLAGS ELIX_LEVEL_0_TRUE ELIX_LEVEL_0_FALSE ELIX_LEVEL_1_TRUE ELIX_LEVEL_1_FALSE ELIX_LEVEL_2_TRUE ELIX_LEVEL_2_FALSE ELIX_LEVEL_3_TRUE ELIX_LEVEL_3_FALSE ELIX_LEVEL_4_TRUE ELIX_LEVEL_4_FALSE USE_LIBTOOL_TRUE USE_LIBTOOL_FALSE OBJEXT oext aext lpfx libm_machine_dir machine_dir sys_dir LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAY_SUPPLY_SYSCALLS_TRUE MAY_SUPPLY_SYSCALLS_FALSE newlib_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB READELF ac_ct_READELF MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CCAS CCASFLAGS NEWLIB_CFLAGS LDFLAGS ELIX_LEVEL_0_TRUE ELIX_LEVEL_0_FALSE ELIX_LEVEL_1_TRUE ELIX_LEVEL_1_FALSE ELIX_LEVEL_2_TRUE ELIX_LEVEL_2_FALSE ELIX_LEVEL_3_TRUE ELIX_LEVEL_3_FALSE ELIX_LEVEL_4_TRUE ELIX_LEVEL_4_FALSE USE_LIBTOOL_TRUE USE_LIBTOOL_FALSE OBJEXT oext aext lpfx libm_machine_dir machine_dir sys_dir HAVE_SPU_EA_TRUE HAVE_SPU_EA_FALSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -2815,6 +2815,36 @@ OBJEXT=${oext}
+echo "$as_me:$LINENO: checking whether the compiler supports __ea" >&5
+echo $ECHO_N "checking whether the compiler supports __ea... $ECHO_C" >&6
+cat > conftest.c <<EOF
+#if defined (__EA32__) || defined (__EA64__)
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } | egrep yes >/dev/null 2>&1; then
+ spu_compiler_has_ea=yes
+else
+ spu_compiler_has_ea=no
+fi
+
+
+if test x${spu_compiler_has_ea} != xno; then
+ HAVE_SPU_EA_TRUE=
+ HAVE_SPU_EA_FALSE='#'
+else
+ HAVE_SPU_EA_TRUE='#'
+ HAVE_SPU_EA_FALSE=
+fi
+
+echo "$as_me:$LINENO: result: $spu_compiler_has_ea" >&5
+echo "${ECHO_T}$spu_compiler_has_ea" >&6
+
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
@@ -3009,6 +3039,13 @@ echo "$as_me: error: conditional \"USE_LIBTOOL\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${HAVE_SPU_EA_TRUE}" && test -z "${HAVE_SPU_EA_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"HAVE_SPU_EA\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_SPU_EA\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
@@ -3611,6 +3648,8 @@ s,@lpfx@,$lpfx,;t t
s,@libm_machine_dir@,$libm_machine_dir,;t t
s,@machine_dir@,$machine_dir,;t t
s,@sys_dir@,$sys_dir,;t t
+s,@HAVE_SPU_EA_TRUE@,$HAVE_SPU_EA_TRUE,;t t
+s,@HAVE_SPU_EA_FALSE@,$HAVE_SPU_EA_FALSE,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/newlib/libc/machine/spu/configure.in b/newlib/libc/machine/spu/configure.in
index 7c5011ab6..a287ff59b 100644
--- a/newlib/libc/machine/spu/configure.in
+++ b/newlib/libc/machine/spu/configure.in
@@ -10,5 +10,21 @@ AC_CONFIG_AUX_DIR(../../../..)
NEWLIB_CONFIGURE(../../..)
+AC_MSG_CHECKING([whether the compiler supports __ea])
+dnl We do not use AC_COMPILE_IFELSE to support building newlib with
+dnl a cross-compiler that is not (yet) able to link executables
+cat > conftest.c <<EOF
+#if defined (__EA32__) || defined (__EA64__)
+ yes;
+#endif
+EOF
+if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
+ spu_compiler_has_ea=yes
+else
+ spu_compiler_has_ea=no
+fi
+AM_CONDITIONAL(HAVE_SPU_EA, test x${spu_compiler_has_ea} != xno)
+AC_MSG_RESULT($spu_compiler_has_ea)
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/newlib/libc/machine/spu/ea_internal.h b/newlib/libc/machine/spu/ea_internal.h
new file mode 100644
index 000000000..4f10d2eed
--- /dev/null
+++ b/newlib/libc/machine/spu/ea_internal.h
@@ -0,0 +1,147 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef __EA_INTERNAL_H
+#define __EA_INTERNAL_H
+
+#include <ea.h>
+#define JSRE_POSIX1_SIGNALCODE 0x2101
+#define SPE_POSIX1_FTOK 0x05
+#define SPE_POSIX1_MMAP 0x0b
+#define SPE_POSIX1_MUNMAP 0x0e
+/* implemented to here */
+#define SPE_POSIX1_MREMAP 0x0c
+#define SPE_POSIX1_MSYNC 0x0d
+#define SPE_POSIX1_SHMGET 0x14
+#define SPE_POSIX1_SHMCTL 0x12
+#define SPE_POSIX1_SHMAT 0x11
+#define SPE_POSIX1_SHMDT 0x13
+#define SPE_POSIX1_SHM_OPEN 0x15
+#define SPE_POSIX1_SHM_UNLINK 0x16
+
+#define JSRE_LIBEA_SIGNALCODE 0x2105
+#define SPE_LIBEA_CALLOC 0x01
+#define SPE_LIBEA_FREE 0x02
+#define SPE_LIBEA_MALLOC 0x03
+#define SPE_LIBEA_REALLOC 0x04
+#define SPE_LIBEA_POSIX_MEMALIGN 0x05
+
+#define PAD_INT 3
+#ifdef __EA64__
+#define PAD_LONG 2
+#else /* 32 bit */
+#define PAD_LONG 3
+#endif
+
+#define ROUND_UP_NEXT_128(x) (((x) + 128) & (~127))
+#define ROUND_DOWN_128(x) ((x) & (~127))
+
+/* Macro that generates an __ea alias. */
+#ifdef __EA64__
+#define COMPAT_EA_ALIAS(name) asm (".global\t__" #name "64\n\t.set\t__" #name "64," #name)
+#else
+#define COMPAT_EA_ALIAS(name) asm (".global\t__" #name "32\n\t.set\t__" #name "32," #name)
+#endif
+
+static inline __ea void* round_down_128_ea(__ea void* x)
+{
+ size_ea_t tmp = (size_ea_t) x;
+ tmp &= (~127);
+ return (__ea void*)tmp;
+}
+
+static
+inline __ea void* round_up_next_128_ea(__ea void* x)
+{
+ size_ea_t tmp = (size_ea_t) x;
+ tmp += 128;
+ tmp &= (~127);
+ return (__ea void*)tmp;
+}
+
+#define __cache_fetch_dirty_all(x) \
+ __cache_fetch_dirty(round_down_128_ea(x), 128)
+
+/* please optimize, this hurts my eyes */
+static inline size_t
+three_way_min(size_t x, size_t y, size_t z)
+{
+ if (x < y)
+ if (x < z)
+ return x;
+ else
+ return z;
+ else
+ if (y < z)
+ return y;
+ else
+ return z;
+}
+
+#undef eavoid_to_ul
+#define eavoid_to_ul(X) ({ \
+ unsigned long _y; \
+ __asm__ ("# %0 %1" : "=r" (_y) : "0" (X)); \
+ _y; \
+})
+
+#undef eavoid_to_ull
+#define eavoid_to_ull(X) ({ \
+ unsigned long long _y; \
+ __asm__ ("# %0 %1" : "=r" (_y) : "0" (X)); \
+ _y; \
+})
+
+#ifdef __EA32__
+#undef ull_to_eavoid
+#define ull_to_eavoid(X) ({ \
+ __ea void* _y; \
+ unsigned long long X2; \
+ (X2) = (X) << 32;\
+ __asm__ ("# %0 %1" : "=r" (_y) : "0" (X2)); \
+ _y; \
+})
+#else /*__EA64__*/
+#define ull_to_eavoid(X) ({ \
+ __ea void* _y; \
+ __asm__ ("# %0 %1" : "=r" (_y) : "0" (X)); \
+ _y; \
+})
+#endif
+
+#undef ul_to_eavoid
+#define ul_to_eavoid(X) ({ \
+ __ea void* _y; \
+ __asm__ ("# %0 %1" : "=r" (_y) : "0" (X)); \
+ _y; \
+})
+
+#endif /*__EA_INTERNAL_H*/
diff --git a/newlib/libc/machine/spu/free_ea.c b/newlib/libc/machine/spu/free_ea.c
new file mode 100644
index 000000000..ac206a125
--- /dev/null
+++ b/newlib/libc/machine/spu/free_ea.c
@@ -0,0 +1,51 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include <sys/syscall.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <spu_cache.h>
+
+extern void __cache_flush (void) __attribute__ ((weak));
+
+COMPAT_EA_ALIAS (free_ea);
+
+void free_ea(__ea void *ptr)
+{
+ unsigned long long ptr_arg;
+ ptr_arg = (unsigned long long) (size_ea_t) ptr;
+ /* Flush cache only if the application really uses the software cache. */
+ if (__cache_flush)
+ __cache_flush ();
+ __send_to_ppe(JSRE_LIBEA_SIGNALCODE, SPE_LIBEA_FREE , &ptr_arg);
+ return;
+}
diff --git a/newlib/libc/machine/spu/include/ea.h b/newlib/libc/machine/spu/include/ea.h
new file mode 100644
index 000000000..01e0dcc5c
--- /dev/null
+++ b/newlib/libc/machine/spu/include/ea.h
@@ -0,0 +1,137 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef __EA_H
+#define __EA_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <sys/unistd.h>
+
+/*
+ * take this out when compiler support is common
+ */
+#if (!defined( __EA32__ ) && !defined( __EA64__ ))
+#warning "need __ea support in compiler to compile to take advantage of libea features"
+#define __ea
+#define __EA32__
+#endif
+
+#ifdef __EA64__
+
+typedef uint64_t size_ea_t;
+typedef int64_t ssize_ea_t;
+typedef uint64_t key_ea_t;
+#define MAP_FAILED_EA ((__ea void *) -1LL)
+
+#else
+
+typedef uint32_t size_ea_t;
+typedef int32_t ssize_ea_t;
+typedef uint32_t key_ea_t;
+#define MAP_FAILED_EA ((__ea void *) -1)
+
+#endif
+
+typedef __ea void * eaptr;
+struct iovec_ea
+{
+#ifdef __EA32__
+ unsigned int __pad1; /* 32 bit padding */
+#endif
+ /*__ea void *iov_base;*/
+ eaptr iov_base; /* Starting address */
+#ifdef __EA32__
+ unsigned int __pad2; /* 32 bit padding */
+#endif
+ size_ea_t iov_len; /* Number of bytes */
+};
+
+
+/* Memory Mapping functions */
+__ea void *mmap_ea (__ea void *start, size_ea_t length, int prot, int
+ flags, int fd, off_t offset);
+int munmap_ea (__ea void *start, size_ea_t length);
+__ea void *mremap_ea (__ea void *old_address, size_ea_t old_size,
+ size_ea_t new_size, unsigned long flags);
+int msync_ea (__ea void *start, size_ea_t length, int flags);
+
+/* EA memory mangement functions */
+__ea void *calloc_ea (size_ea_t nmemb, size_ea_t length);
+void free_ea (__ea void *ptr);
+__ea void *malloc_ea (size_ea_t size);
+__ea void *realloc_ea (__ea void *ptr, size_ea_t size);
+int posix_memalign_ea (__ea void **memptr, size_ea_t alignment, size_ea_t size);
+
+/* String copying functions */
+__ea void *memcpy_ea (__ea void *dest, __ea const void *src, size_ea_t n);
+__ea void *memmove_ea (__ea void *dest, __ea const void *src, size_ea_t n);
+__ea char *strcpy_ea (__ea char *dest, __ea const char *src);
+__ea char *strncpy_ea (__ea char *dest, __ea const char *src, size_ea_t n);
+
+/* Concatenation functions */
+__ea char *strcat_ea (__ea char *dest, __ea const char *src);
+__ea char *strncat_ea (__ea char *dest, __ea const char *src, size_ea_t n);
+
+/* Comparison functions */
+int memcmp_ea (__ea void *s1, __ea const void *s2, size_ea_t n);
+int strcmp_ea (__ea char *s1, __ea const char *s2);
+int strncmp_ea (__ea void *s1, __ea const void *s2, size_ea_t n3);
+
+/* Search functions*/
+__ea void *memchr_ea (__ea const void *s, int c, size_ea_t n);
+__ea char *strchr_ea (__ea const char *s, int c);
+size_ea_t strcspn_ea (__ea const char *s, const char *reject);
+__ea char *strpbrk_ea (__ea const char *s, const char *accept);
+__ea char *strrchr_ea (__ea const char *s, int c);
+size_ea_t strspn_ea (__ea const char *s, const char *accept);
+__ea char * strstr_ea (__ea const char *s1, __ea const char *s2);
+
+/* Misc functions */
+__ea void *memset_ea (__ea void *dest, int c, size_ea_t n);
+size_ea_t strlen_ea (__ea const char *s);
+
+/* Linux system call functions */
+ssize_ea_t read_ea(int fd, __ea void *buf, size_ea_t count);
+ssize_ea_t pread_ea(int fd, __ea void *buf, size_ea_t count, off_t offset);
+ssize_ea_t readv_ea(int fd, struct iovec_ea *vector, int count);
+ssize_ea_t write_ea(int fd, __ea const void *buf, size_ea_t count);
+ssize_ea_t pwrite_ea(int fd, __ea const void *buf, size_ea_t count, off_t offset);
+ssize_ea_t writev_ea(int fd, struct iovec_ea *vector, int count);
+
+
+#if defined( __EA64__ ) && defined( __EA32__ )
+#error __EA64__ and __EA32__ are both defined
+#endif
+
+#endif
diff --git a/newlib/libc/machine/spu/malloc_ea.c b/newlib/libc/machine/spu/malloc_ea.c
new file mode 100644
index 000000000..e5f9e2f16
--- /dev/null
+++ b/newlib/libc/machine/spu/malloc_ea.c
@@ -0,0 +1,47 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include <sys/syscall.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (malloc_ea);
+
+__ea void *
+malloc_ea (size_ea_t size)
+{
+ unsigned long long sz;
+
+ sz = (unsigned long long) size;
+ __send_to_ppe (JSRE_LIBEA_SIGNALCODE, SPE_LIBEA_MALLOC, &sz);
+ return ull_to_eavoid (sz);
+}
diff --git a/newlib/libc/machine/spu/memchr_ea.c b/newlib/libc/machine/spu/memchr_ea.c
new file mode 100644
index 000000000..10d0d59c5
--- /dev/null
+++ b/newlib/libc/machine/spu/memchr_ea.c
@@ -0,0 +1,73 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <string.h>
+#include <spu_cache.h>
+
+COMPAT_EA_ALIAS (memchr_ea);
+
+__ea void *
+memchr_ea (__ea const void *s, int c, size_ea_t n)
+{
+ __ea void *curr_s = (__ea void *) s;
+ void *local_s;
+ size_ea_t left_in_cacheline;
+ size_ea_t search_size;
+ void *where;
+ size_ea_t ret;
+
+ while (n)
+ {
+ left_in_cacheline = ROUND_UP_NEXT_128 ((size_ea_t) curr_s) -
+ (size_ea_t) curr_s;
+ search_size = left_in_cacheline < n ? left_in_cacheline : n;
+
+ local_s = __cache_fetch (curr_s);
+ where = memchr (local_s, c, search_size);
+
+ if (where)
+ {
+ ret = (size_ea_t) curr_s +
+ ((size_ea_t) (int) where - (size_ea_t) (int) local_s);
+ return (__ea void *) ret;
+ }
+
+ /* update values to take into account what we copied */
+ curr_s += search_size;
+ n -= search_size;
+ }
+
+ /* if we got here n was initially 0 */
+ return NULL;
+}
diff --git a/newlib/libc/machine/spu/memcmp_ea.c b/newlib/libc/machine/spu/memcmp_ea.c
new file mode 100644
index 000000000..4088bcc14
--- /dev/null
+++ b/newlib/libc/machine/spu/memcmp_ea.c
@@ -0,0 +1,78 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <string.h>
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <spu_cache.h>
+
+COMPAT_EA_ALIAS (memcmp_ea);
+
+int
+memcmp_ea (__ea void *s1, __ea const void *s2, size_ea_t n)
+{
+ __ea void *curr_s1 = s1;
+ __ea void *curr_s2 = (__ea void *) s2;
+ void *l_s1;
+ void *l_s2;
+ size_ea_t local_n;
+ size_ea_t s2_n;
+ size_ea_t s1_n;
+ int ret;
+
+ ret = 0;
+ while (n)
+ {
+ l_s2 = __cache_fetch (curr_s2);
+ l_s1 = __cache_fetch (curr_s1);
+
+ /*
+ * Use the smaller of the size left to compare (n), the space left in
+ * s2 cacheline (s2_n), or the space left in the s1 cacheline (s1_n).
+ */
+ s2_n = ROUND_UP_NEXT_128 ((size_ea_t) curr_s2) - (size_ea_t) curr_s2;
+ s1_n = ROUND_UP_NEXT_128 ((size_ea_t) curr_s1) - (size_ea_t) curr_s1;
+ local_n = three_way_min (s2_n, s1_n, n);
+
+ ret = memcmp (l_s1, l_s2, local_n);
+ if (ret)
+ return ret;
+
+ /* update values to take into account what we copied */
+ curr_s2 += local_n;
+ curr_s1 += local_n;
+ n -= local_n;
+
+ }
+
+ return ret;
+}
diff --git a/newlib/libc/machine/spu/memcpy_ea.c b/newlib/libc/machine/spu/memcpy_ea.c
new file mode 100644
index 000000000..6dfea7abb
--- /dev/null
+++ b/newlib/libc/machine/spu/memcpy_ea.c
@@ -0,0 +1,76 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <string.h>
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <spu_cache.h>
+
+COMPAT_EA_ALIAS (memcpy_ea);
+
+__ea void *
+memcpy_ea (__ea void *dest, __ea const void *src, size_ea_t n)
+{
+ __ea void *curr_dest = dest;
+ __ea const void *curr_src = src;
+ void *l_dest;
+ void *l_src;
+ size_ea_t local_n;
+ size_ea_t src_n;
+ size_ea_t dst_n;
+
+ while (n)
+ {
+ l_src = __cache_fetch ((__ea void *) curr_src);
+
+ /*
+ * use the smaller of the size left to copy (n), the space left in the
+ * src cacheline (src_n), or the space left in the destination
+ * cacheline (dst_n)
+ */
+ src_n = ROUND_UP_NEXT_128 ((size_ea_t) curr_src) - (size_ea_t) curr_src;
+ dst_n =
+ ROUND_UP_NEXT_128 ((size_ea_t) curr_dest) - (size_ea_t) curr_dest;
+ local_n = three_way_min (src_n, dst_n, n);
+
+ l_dest = __cache_fetch_dirty (curr_dest, local_n);
+
+ memcpy (l_dest, l_src, local_n);
+
+ /* update values to take into account what we copied */
+ curr_src += local_n;
+ curr_dest += local_n;
+ n -= local_n;
+ }
+
+ return dest;
+}
diff --git a/newlib/libc/machine/spu/memmove_ea.c b/newlib/libc/machine/spu/memmove_ea.c
new file mode 100644
index 000000000..356ab5669
--- /dev/null
+++ b/newlib/libc/machine/spu/memmove_ea.c
@@ -0,0 +1,77 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include <spu_cache.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <string.h>
+
+COMPAT_EA_ALIAS (memmove_ea);
+
+__ea void *
+memmove_ea (__ea void *dest, __ea const void *src, size_ea_t n)
+{
+ __ea void *curr_dest = dest;
+ __ea void *curr_src;
+ void *l_dest;
+ void *l_src;
+ size_ea_t local_n;
+ size_ea_t src_n;
+ size_ea_t dst_n;
+
+ curr_src = (__ea void *) src;
+ while (n)
+ {
+ l_src = __cache_fetch (curr_src);
+
+ /*
+ * use the smaller of the size left to copy (n), the space left in the
+ * src cacheline (src_n), or the space left in the destination
+ * cacheline (dst_n).
+ */
+ src_n = ROUND_UP_NEXT_128 ((size_ea_t) curr_src) - (size_ea_t) curr_src;
+ dst_n =
+ ROUND_UP_NEXT_128 ((size_ea_t) curr_dest) - (size_ea_t) curr_dest;
+ local_n = three_way_min (src_n, dst_n, n);
+
+ l_dest = __cache_fetch_dirty (curr_dest, local_n);
+
+ memmove (l_dest, l_src, local_n);
+
+ /* update values to take into account what we copied */
+ curr_src += local_n;
+ curr_dest += local_n;
+ n -= local_n;
+ }
+
+ return dest;
+}
diff --git a/newlib/libc/machine/spu/memset_ea.c b/newlib/libc/machine/spu/memset_ea.c
new file mode 100644
index 000000000..a18baf206
--- /dev/null
+++ b/newlib/libc/machine/spu/memset_ea.c
@@ -0,0 +1,64 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <string.h>
+#include <stddef.h>
+#include <spu_cache.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (memset_ea);
+
+__ea void *
+memset_ea (__ea void *dest, int c, size_ea_t n)
+{
+ __ea void *curr_dest = dest;
+ void *l_dest;
+ size_ea_t local_n;
+ size_ea_t dst_n;
+
+ while (n)
+ {
+ dst_n =
+ ROUND_UP_NEXT_128 ((size_ea_t) curr_dest) - (size_ea_t) curr_dest;
+ local_n = dst_n < n ? dst_n : n;
+
+ l_dest = __cache_fetch_dirty (curr_dest, local_n);
+
+ memset (l_dest, c, local_n);
+
+ /* update values to take into account what we copied */
+ curr_dest += local_n;
+ n -= local_n;
+ }
+
+ return dest;
+}
diff --git a/newlib/libc/machine/spu/mmap_ea.c b/newlib/libc/machine/spu/mmap_ea.c
new file mode 100644
index 000000000..4097fc007
--- /dev/null
+++ b/newlib/libc/machine/spu/mmap_ea.c
@@ -0,0 +1,61 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (mmap_ea);
+
+__ea void *mmap_ea (__ea void *start, size_ea_t length, int prot, int
+ flags, int fd, off_t offset)
+{
+#ifdef __EA64__
+ return (__ea void *) mmap_eaddr ((unsigned long long) start, length,
+ prot, flags, fd, offset);
+#else /* __EA32__ */
+ unsigned long long res;
+ /*
+ * mmap_eaddr returns 64 bits. For ea32, only the lower 32 bits can be
+ * returned.
+ */
+ res = mmap_eaddr ((unsigned long long) (unsigned int) start, length,
+ prot, flags, fd, offset);
+ if (res != MAP_FAILED_EADDR && res > 0xffffffffULL) {
+ munmap_eaddr (res, length);
+ errno = ENOMEM;
+ res = MAP_FAILED_EADDR;
+ }
+ return (__ea void *) (int) res;
+#endif
+}
diff --git a/newlib/libc/machine/spu/mremap_ea.c b/newlib/libc/machine/spu/mremap_ea.c
new file mode 100644
index 000000000..dfd778ece
--- /dev/null
+++ b/newlib/libc/machine/spu/mremap_ea.c
@@ -0,0 +1,62 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (mremap_ea);
+
+__ea void *
+mremap_ea (__ea void *old_address, size_ea_t old_size,
+ size_ea_t new_size, unsigned long flags)
+{
+#ifdef __EA64__
+ return (__ea void *) mremap_eaddr ((unsigned long long) old_address,
+ old_size, new_size, flags);
+#else /* __EA32__ */
+ unsigned long long res;
+ res = mremap_eaddr ((unsigned long long) (unsigned int) old_address,
+ old_size, new_size, flags);
+ if (res != MAP_FAILED_EADDR && res > 0xffffffffULL)
+ {
+ /*
+ * We cannot reliably undo the successful remap, so unmap the address.
+ */
+ munmap_eaddr (res, new_size);
+ errno = ENOMEM;
+ res = MAP_FAILED_EADDR;
+ }
+ return (__ea void *) (int) res;
+#endif
+}
diff --git a/newlib/libc/machine/spu/msync_ea.c b/newlib/libc/machine/spu/msync_ea.c
new file mode 100644
index 000000000..cfb959729
--- /dev/null
+++ b/newlib/libc/machine/spu/msync_ea.c
@@ -0,0 +1,44 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include <sys/mman.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (msync_ea);
+
+int
+msync_ea (__ea void *start, size_ea_t length, int flags)
+{
+ return msync_eaddr ((unsigned long long) (size_ea_t) start, length,
+ flags);
+}
diff --git a/newlib/libc/machine/spu/munmap_ea.c b/newlib/libc/machine/spu/munmap_ea.c
new file mode 100644
index 000000000..7b4f6240e
--- /dev/null
+++ b/newlib/libc/machine/spu/munmap_ea.c
@@ -0,0 +1,43 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include <sys/mman.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (munmap_ea);
+
+int
+munmap_ea (__ea void *start, size_ea_t length)
+{
+ return munmap_eaddr ((unsigned long long) (size_ea_t) start, length);
+}
diff --git a/newlib/libc/machine/spu/posix_memalign_ea.c b/newlib/libc/machine/spu/posix_memalign_ea.c
new file mode 100644
index 000000000..a1a73610b
--- /dev/null
+++ b/newlib/libc/machine/spu/posix_memalign_ea.c
@@ -0,0 +1,66 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include <sys/syscall.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+typedef struct
+{
+ unsigned int memptr;
+ unsigned int pad0[3];
+ unsigned long long align;
+ unsigned int pad1[2];
+ unsigned long long size;
+ unsigned int pad2[2];
+} memalign_ea_t;
+
+COMPAT_EA_ALIAS (posix_memalign_ea);
+
+int
+posix_memalign_ea (__ea void **memptr, size_ea_t align, size_ea_t size)
+{
+ memalign_ea_t arg;
+
+ /*
+ * Note that memptr is an LS address that will store an EA address. So,
+ * it fits in 32 bits.
+ *
+ * The assist call will store 32 or 64 bits, depending on whether it's
+ * 32 or 64 bit ppu code.
+ */
+ arg.memptr = (unsigned int) memptr;
+ arg.align = (unsigned long long) align;
+ arg.size = (unsigned long long) size;
+ return __send_to_ppe (JSRE_LIBEA_SIGNALCODE, SPE_LIBEA_POSIX_MEMALIGN,
+ &arg);
+}
diff --git a/newlib/libc/machine/spu/pread_ea.c b/newlib/libc/machine/spu/pread_ea.c
new file mode 100644
index 000000000..124afcd57
--- /dev/null
+++ b/newlib/libc/machine/spu/pread_ea.c
@@ -0,0 +1,59 @@
+/*
+(C) Copyright IBM Corp. 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Ken Werner <ken.werner@de.ibm.com>
+*/
+
+#include "ea_internal.h"
+#include <ea.h>
+#include <spu_cache.h>
+#include "sys/linux_syscalls.h"
+
+extern void __cache_flush (void) __attribute__ ((weak));
+
+COMPAT_EA_ALIAS (pread_ea);
+
+ssize_ea_t
+pread_ea (int fd, __ea void *buf, size_ea_t count, off_t offset)
+{
+ struct spu_syscall_block s = {
+ __NR_pread64,
+ {
+ fd,
+ (size_ea_t) buf,
+ count,
+ offset,
+ 0,
+ 0}
+ };
+ /* Flush cache only if the application really uses the software cache. */
+ if (__cache_flush)
+ __cache_flush ();
+ return __linux_syscall (&s);
+}
diff --git a/newlib/libc/machine/spu/pwrite_ea.c b/newlib/libc/machine/spu/pwrite_ea.c
new file mode 100644
index 000000000..e08012c47
--- /dev/null
+++ b/newlib/libc/machine/spu/pwrite_ea.c
@@ -0,0 +1,59 @@
+/*
+(C) Copyright IBM Corp. 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Ken Werner <ken.werner@de.ibm.com>
+*/
+
+#include "ea_internal.h"
+#include <ea.h>
+#include <spu_cache.h>
+#include "sys/linux_syscalls.h"
+
+extern void __cache_flush (void) __attribute__ ((weak));
+
+COMPAT_EA_ALIAS (pwrite_ea);
+
+ssize_ea_t
+pwrite_ea (int fd, __ea const void *buf, size_ea_t count, off_t offset)
+{
+ struct spu_syscall_block s = {
+ __NR_pwrite64,
+ {
+ fd,
+ (size_ea_t) buf,
+ count,
+ offset,
+ 0,
+ 0}
+ };
+ /* Flush cache only if the application really uses the software cache. */
+ if (__cache_flush)
+ __cache_flush ();
+ return __linux_syscall (&s);
+}
diff --git a/newlib/libc/machine/spu/read_ea.c b/newlib/libc/machine/spu/read_ea.c
new file mode 100644
index 000000000..adc72d257
--- /dev/null
+++ b/newlib/libc/machine/spu/read_ea.c
@@ -0,0 +1,59 @@
+/*
+(C) Copyright IBM Corp. 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Ken Werner <ken.werner@de.ibm.com>
+*/
+
+#include "ea_internal.h"
+#include <ea.h>
+#include <spu_cache.h>
+#include "sys/linux_syscalls.h"
+
+extern void __cache_flush (void) __attribute__ ((weak));
+
+COMPAT_EA_ALIAS (read_ea);
+
+ssize_ea_t
+read_ea (int fd, __ea void *buf, size_ea_t count)
+{
+ struct spu_syscall_block s = {
+ __NR_read,
+ {
+ fd,
+ (size_ea_t) buf,
+ count,
+ 0,
+ 0,
+ 0}
+ };
+ /* Flush cache only if the application really uses the software cache. */
+ if (__cache_flush)
+ __cache_flush ();
+ return __linux_syscall (&s);
+}
diff --git a/newlib/libc/machine/spu/readv_ea.c b/newlib/libc/machine/spu/readv_ea.c
new file mode 100644
index 000000000..f8875d981
--- /dev/null
+++ b/newlib/libc/machine/spu/readv_ea.c
@@ -0,0 +1,69 @@
+/*
+(C) Copyright IBM Corp. 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Ken Werner <ken.werner@de.ibm.com>
+*/
+
+#include "ea_internal.h"
+#include <ea.h>
+#include <spu_cache.h>
+#include "sys/linux_syscalls.h"
+
+extern void __cache_flush (void) __attribute__ ((weak));
+
+COMPAT_EA_ALIAS (readv_ea);
+
+ssize_ea_t
+readv_ea (int fd, struct iovec_ea *vector, int count)
+{
+#ifdef __EA32__
+ int i;
+#endif
+ struct spu_syscall_block s = {
+ __NR_readv,
+ {
+ fd,
+ (size_ea_t) (__ea void *) vector,
+ count,
+ 0,
+ 0,
+ 0}
+ };
+#ifdef __EA32__
+ for (i = 0; i < count; ++i)
+ {
+ vector[i].__pad1 = 0x0; /* 32 bit padding */
+ vector[i].__pad2 = 0x0; /* 32 bit padding */
+ }
+#endif
+ /* Flush cache only if the application really uses the software cache. */
+ if (__cache_flush)
+ __cache_flush ();
+ return __linux_syscall (&s);
+}
diff --git a/newlib/libc/machine/spu/realloc_ea.c b/newlib/libc/machine/spu/realloc_ea.c
new file mode 100644
index 000000000..4b7dc879e
--- /dev/null
+++ b/newlib/libc/machine/spu/realloc_ea.c
@@ -0,0 +1,55 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include<stddef.h>
+#include<sys/syscall.h>
+#include"ea_internal.h"
+#include<ea.h>
+
+typedef struct
+{
+ unsigned long long ptr;
+ unsigned int pad0[2];
+ unsigned long long size;
+ unsigned int pad1[2];
+} realloc_ea_t;
+
+COMPAT_EA_ALIAS (realloc_ea);
+
+__ea void *
+realloc_ea (__ea void *ptr, size_ea_t size)
+{
+ realloc_ea_t args;
+ args.ptr = (unsigned long long) (size_ea_t) ptr;
+ args.size = (unsigned long long) size;
+ __send_to_ppe (JSRE_LIBEA_SIGNALCODE, SPE_LIBEA_REALLOC, &args);
+ return ull_to_eavoid (args.ptr);
+}
diff --git a/newlib/libc/machine/spu/strcat_ea.c b/newlib/libc/machine/spu/strcat_ea.c
new file mode 100644
index 000000000..f6178e4c0
--- /dev/null
+++ b/newlib/libc/machine/spu/strcat_ea.c
@@ -0,0 +1,55 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <string.h>
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (strcat_ea);
+
+/*
+ * Maybe not the fastest thing ever since it reads through the data once on
+ * strlen and once on memcpy, but it should work.
+ */
+__ea char *
+strcat_ea (__ea char *dest, __ea const char *src)
+{
+ size_ea_t length_src;
+ size_ea_t length_dest;
+ __ea char *new_dest;
+
+ length_src = strlen_ea (src);
+ length_dest = strlen_ea (dest);
+ new_dest = dest + length_dest;
+ memcpy_ea ((__ea void *) new_dest, (__ea void *) src, length_src + 1);
+ return dest;
+}
diff --git a/newlib/libc/machine/spu/strchr_ea.c b/newlib/libc/machine/spu/strchr_ea.c
new file mode 100644
index 000000000..6c751c80e
--- /dev/null
+++ b/newlib/libc/machine/spu/strchr_ea.c
@@ -0,0 +1,47 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <string.h>
+#include <spu_cache.h>
+
+COMPAT_EA_ALIAS (strchr_ea);
+
+__ea char *
+strchr_ea (__ea const char *s, int c)
+{
+ size_ea_t size;
+
+ size = strlen_ea (s);
+ return (char *) memchr_ea (s, c, size);
+}
diff --git a/newlib/libc/machine/spu/strcmp_ea.c b/newlib/libc/machine/spu/strcmp_ea.c
new file mode 100644
index 000000000..2c9c5ebb2
--- /dev/null
+++ b/newlib/libc/machine/spu/strcmp_ea.c
@@ -0,0 +1,86 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <string.h>
+#include <stddef.h>
+#include <sys/param.h>
+#include <spu_cache.h>
+#include <spu_intrinsics.h>
+#include "ea_internal.h"
+#include "strncmp.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (strcmp_ea);
+
+/*
+ * It's not clear what is returned if both strings are equal to
+ * each other up to the length of the shorter string.
+ */
+int
+strcmp_ea (__ea char *s1, __ea const char *s2)
+{
+ __ea char *curr_s1 = (__ea char *) s1;
+ __ea char *curr_s2 = (__ea char *) s2;
+ void *l_s1;
+ void *l_s2;
+ size_ea_t s2_n;
+ size_ea_t s1_n;
+ int min;
+ int ret;
+ vec_uint4 end_v;
+
+ while (1)
+ {
+ l_s2 = __cache_fetch (curr_s2);
+ l_s1 = __cache_fetch (curr_s1);
+ /*
+ * Use the smaller of the the space left in s2 cacheline or
+ * the space left in the s1 cacheline.
+ */
+ s2_n = ROUND_UP_NEXT_128 ((size_ea_t) curr_s2) - (size_ea_t) curr_s2;
+ s1_n = ROUND_UP_NEXT_128 ((size_ea_t) curr_s1) - (size_ea_t) curr_s1;
+ min = MIN (s2_n, s1_n);
+
+ ret = _strncmp_internal (l_s1, l_s2, min, &end_v, 1);
+ /*
+ * Only the first slot of end_v is set.
+ */
+ if (ret || spu_extract (end_v, 0))
+ /*
+ * If any NUL values were seen (end_v values of zero) we still have
+ * to return ret, as it might not be zero.
+ */
+ return ret;
+
+ curr_s1 += min;
+ curr_s2 += min;
+ }
+}
diff --git a/newlib/libc/machine/spu/strcpy_ea.c b/newlib/libc/machine/spu/strcpy_ea.c
new file mode 100644
index 000000000..7d3905800
--- /dev/null
+++ b/newlib/libc/machine/spu/strcpy_ea.c
@@ -0,0 +1,51 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <string.h>
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (strcpy_ea);
+
+/*
+ * Not the fastest since it reads through the data once on
+ * strlen and once on memcpy.
+ */
+__ea char *
+strcpy_ea (__ea char *dest, __ea const char *src)
+{
+ size_ea_t length;
+
+ length = strlen_ea (src);
+ memcpy_ea ((__ea void *) dest, (__ea void *) src, length + 1);
+ return dest;
+}
diff --git a/newlib/libc/machine/spu/strcspn_ea.c b/newlib/libc/machine/spu/strcspn_ea.c
new file mode 100644
index 000000000..2cc0f08b4
--- /dev/null
+++ b/newlib/libc/machine/spu/strcspn_ea.c
@@ -0,0 +1,63 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <string.h>
+#include <spu_cache.h>
+
+COMPAT_EA_ALIAS (strcspn_ea);
+
+size_ea_t
+strcspn_ea (__ea const char *s, const char *reject)
+{
+ size_ea_t s_length;
+ size_ea_t found_length;
+ __ea void *found_it;
+ size_ea_t ret;
+ size_t i;
+ size_t rej_length;
+
+ s_length = strlen_ea (s);
+ rej_length = strlen (reject);
+ ret = s_length;
+
+ for (i = 0; i < rej_length; i++)
+ {
+ found_it = memchr_ea (s, reject[i], s_length);
+ found_length = (size_ea_t) found_it - (size_ea_t) s;
+ if (found_length < ret)
+ ret = found_length;
+ }
+
+ return ret;
+}
diff --git a/newlib/libc/machine/spu/strlen_ea.c b/newlib/libc/machine/spu/strlen_ea.c
new file mode 100644
index 000000000..f00cec275
--- /dev/null
+++ b/newlib/libc/machine/spu/strlen_ea.c
@@ -0,0 +1,67 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <string.h>
+#include <spu_cache.h>
+
+COMPAT_EA_ALIAS (strlen_ea);
+
+size_ea_t
+strlen_ea (__ea const char *s)
+{
+ __ea void *curr_s = (__ea void *) s;
+ void *local_s;
+ size_ea_t left_in_cacheline;
+ void *where_null;
+ size_ea_t length_of_string = 0;
+
+ while (1)
+ {
+ left_in_cacheline =
+ ROUND_UP_NEXT_128 ((size_ea_t) curr_s) - (size_ea_t) curr_s;
+ local_s = __cache_fetch (curr_s);
+ where_null = memchr (local_s, '\0', left_in_cacheline);
+
+ if (where_null)
+ {
+ length_of_string += ((size_ea_t) (int) where_null - (size_ea_t)
+ (int) local_s);
+ return length_of_string;
+ }
+
+ /* update values to take into account what we copied */
+ curr_s += left_in_cacheline;
+ length_of_string += left_in_cacheline;
+ }
+}
diff --git a/newlib/libc/machine/spu/strncat_ea.c b/newlib/libc/machine/spu/strncat_ea.c
new file mode 100644
index 000000000..b6c7389b7
--- /dev/null
+++ b/newlib/libc/machine/spu/strncat_ea.c
@@ -0,0 +1,60 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <string.h>
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (strncat_ea);
+
+/*
+ * Not the fastest thing ever since it reads through the data once on
+ * strlen and once on memcpy.
+ */
+__ea char *
+strncat_ea (__ea char *dest, __ea const char *src, size_ea_t n)
+{
+ size_ea_t length_src;
+ size_ea_t length_dest;
+ __ea char *new_dest;
+ size_ea_t smaller_length;
+
+ length_src = strlen_ea (src);
+ length_dest = strlen_ea (dest);
+ new_dest = dest + length_dest;
+ smaller_length = length_src < n ? length_src : n;
+ memcpy_ea ((__ea void *) new_dest, (__ea void *) src, smaller_length);
+ /* null out last character */
+ memset_ea ((__ea void *) (new_dest + smaller_length), 0, 1);
+
+ return dest;
+}
diff --git a/newlib/libc/machine/spu/strncmp_ea.c b/newlib/libc/machine/spu/strncmp_ea.c
new file mode 100644
index 000000000..1a4f366ee
--- /dev/null
+++ b/newlib/libc/machine/spu/strncmp_ea.c
@@ -0,0 +1,87 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <string.h>
+#include <stddef.h>
+#include <spu_intrinsics.h>
+#include <spu_cache.h>
+#include "ea_internal.h"
+#include "strncmp.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (strncmp_ea);
+
+int
+strncmp_ea (__ea void *s1, __ea const void *s2, size_ea_t n3)
+{
+ __ea void *curr_s1 = (__ea void *) s1;
+ __ea void *curr_s2 = (__ea void *) s2;
+ void *l_s1;
+ void *l_s2;
+ int min;
+ size_ea_t s2_n;
+ size_ea_t s1_n;
+ int ret;
+ vec_uint4 end_v;
+
+ ret = 0; /* in case n3 is 0 */
+ while (n3)
+ {
+ l_s2 = __cache_fetch (curr_s2);
+ l_s1 = __cache_fetch (curr_s1);
+
+ /*
+ * Use the smaller of the size left to compare (n3), the space left in
+ * s2 cacheline (s2_n), or the space left in the s1 cacheline (s1_n)
+ */
+ s2_n = ROUND_UP_NEXT_128 ((size_ea_t) curr_s2) - (size_ea_t) curr_s2;
+ s1_n = ROUND_UP_NEXT_128 ((size_ea_t) curr_s1) - (size_ea_t) curr_s1;
+ min = three_way_min (s2_n, s1_n, n3);
+
+ ret = _strncmp_internal (l_s1, l_s2, min, &end_v, 1);
+ /*
+ * Only the first slot of end_v is set.
+ */
+ /* if (ret || spu_extract(spu_cmpeq(end_v, 0), 0)) { */
+ /* if (ret || spu_extract(spu_gather(spu_cmpeq(end_v, 0)), 0)) { */
+ if (ret || spu_extract (end_v, 0))
+ /*
+ * If any NUL values were seen (end_v values of zero) we still have
+ * to return ret, as it might not be zero.
+ */
+ return ret;
+
+ curr_s2 += min;
+ curr_s1 += min;
+ n3 -= min;
+ }
+ return ret;
+}
diff --git a/newlib/libc/machine/spu/strncpy_ea.c b/newlib/libc/machine/spu/strncpy_ea.c
new file mode 100644
index 000000000..c29ba9136
--- /dev/null
+++ b/newlib/libc/machine/spu/strncpy_ea.c
@@ -0,0 +1,57 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <string.h>
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+
+COMPAT_EA_ALIAS (strncpy_ea);
+
+/*
+ * Not the fastest since it reads through the data once on strlen and once
+ * on memcpy.
+ */
+__ea char *
+strncpy_ea (__ea char *dest, __ea const char *src, size_ea_t n)
+{
+ size_ea_t length = strlen_ea (src);
+ if (length < n)
+ {
+ memcpy_ea ((__ea void *) dest, (__ea void *) src, length);
+ memset_ea ((__ea void *) (dest + length), 0, n - length);
+ }
+ else
+ {
+ memcpy_ea ((__ea void *) dest, (__ea void *) src, n);
+ }
+ return dest;
+}
diff --git a/newlib/libc/machine/spu/strpbrk_ea.c b/newlib/libc/machine/spu/strpbrk_ea.c
new file mode 100644
index 000000000..a8b69f5a4
--- /dev/null
+++ b/newlib/libc/machine/spu/strpbrk_ea.c
@@ -0,0 +1,47 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <string.h>
+#include <spu_cache.h>
+
+COMPAT_EA_ALIAS (strpbrk_ea);
+
+__ea char *
+strpbrk_ea (__ea const char *s, const char *accept)
+{
+ size_ea_t where;
+
+ where = strcspn_ea (s, accept);
+ return (__ea char *) ((size_ea_t) s + where);
+}
diff --git a/newlib/libc/machine/spu/strrchr_ea.c b/newlib/libc/machine/spu/strrchr_ea.c
new file mode 100644
index 000000000..76ebb3162
--- /dev/null
+++ b/newlib/libc/machine/spu/strrchr_ea.c
@@ -0,0 +1,84 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <string.h>
+#include <spu_cache.h>
+
+static __ea char *
+similie_ls_to_ea (char *l1, __ea char *ea1, char *l2)
+{
+ return (__ea char *) ((size_ea_t) ea1 +
+ ((size_ea_t) (int) l2 - (size_ea_t) (int) l1));
+}
+
+COMPAT_EA_ALIAS (strrchr_ea);
+
+__ea char *
+strrchr_ea (__ea const char *s, int c)
+{
+ size_ea_t string_length;
+ char *curr_ptr;
+ __ea char *string_start_local;
+ __ea char *end_of_string_ea;
+ __ea char *start_of_cacheline_ea;
+ char *start_of_cachline_local;
+
+ string_start_local = __cache_fetch ((__ea char *) s);
+ string_length = strlen_ea (s);
+ end_of_string_ea = (__ea char *) s + string_length;
+
+ start_of_cacheline_ea = round_down_128_ea (end_of_string_ea - 1);
+ start_of_cachline_local = __cache_fetch (start_of_cacheline_ea);
+ /*this next line should be the same cacheline, just the end of the string */
+ curr_ptr = __cache_fetch (end_of_string_ea - 1);
+
+ while (1)
+ {
+ /*search backwards through this cachline */
+ while (curr_ptr >= start_of_cachline_local)
+ {
+ if (*curr_ptr == (char) c)
+ return similie_ls_to_ea (start_of_cachline_local,
+ start_of_cacheline_ea, curr_ptr);
+ curr_ptr--;
+ if (curr_ptr < string_start_local)
+ return NULL;
+ }
+
+ /* iterate cacheline backwards */
+ start_of_cacheline_ea -= 128;
+ start_of_cachline_local = __cache_fetch (start_of_cacheline_ea);
+ curr_ptr = __cache_fetch (start_of_cacheline_ea + 128);
+ }
+}
diff --git a/newlib/libc/machine/spu/strspn_ea.c b/newlib/libc/machine/spu/strspn_ea.c
new file mode 100644
index 000000000..d1e294793
--- /dev/null
+++ b/newlib/libc/machine/spu/strspn_ea.c
@@ -0,0 +1,65 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <string.h>
+#include <spu_cache.h>
+
+COMPAT_EA_ALIAS (strspn_ea);
+
+size_ea_t
+strspn_ea (__ea const char *s, const char *accept)
+{
+ __ea void *curr_s = (__ea void *) s;
+ char *local_s;
+ size_ea_t length_of_string = 0;
+ size_ea_t s_len;
+ int i;
+
+ s_len = strlen_ea (s);
+
+ for (i = 0; i < s_len; i++)
+ {
+ local_s = (char *) __cache_fetch (curr_s);
+ if (!strchr (accept, local_s[0]))
+ {
+ return length_of_string;
+ }
+ else
+ {
+ length_of_string++;
+ curr_s++;
+ }
+ }
+ return length_of_string;
+}
diff --git a/newlib/libc/machine/spu/strstr_ea.c b/newlib/libc/machine/spu/strstr_ea.c
new file mode 100644
index 000000000..9200cbf84
--- /dev/null
+++ b/newlib/libc/machine/spu/strstr_ea.c
@@ -0,0 +1,75 @@
+/*
+(C) Copyright IBM Corp. 2007, 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stddef.h>
+#include "ea_internal.h"
+#include <ea.h>
+#include <string.h>
+#include <spu_cache.h>
+
+COMPAT_EA_ALIAS (strstr_ea);
+
+__ea char *strstr_ea (__ea const char *s1, __ea const char *s2)
+{
+ __ea char *ret;
+ __ea char *curr;
+ size_ea_t s2_length;
+ size_ea_t s1_length;
+ int i;
+ int found;
+
+ ret = (__ea char *) s1;
+ s2_length = strlen_ea (s2);
+ s1_length = strlen_ea (s1);
+ while (ret < (s1 + s1_length)) {
+ /* search for first letter */
+ //temporary hack for broken 64 bit compiler
+ ret = strchr_ea (ret, s2[0]);
+ /*if we find it search for the rest */
+ if (ret) {
+ found = 1;
+ for (i = 1; i < s2_length; i++) {
+ //temporary hack for broken 64 bit compiler
+ curr = strchr_ea (ret, s2[i]);
+ /* if the letter doesn't exist or isn't in the right spot we unfind */
+ if (!curr || (curr != (ret + i)))
+ found = 0;
+ }
+ }
+ if (found) {
+ return ret;
+ } else {
+ ret++;
+ }
+ /*go back and try again with the rest of it */
+ }
+ return NULL;
+}
diff --git a/newlib/libc/machine/spu/sys/mman.h b/newlib/libc/machine/spu/sys/mman.h
new file mode 100644
index 000000000..84fad62ca
--- /dev/null
+++ b/newlib/libc/machine/spu/sys/mman.h
@@ -0,0 +1,85 @@
+/*
+(C) Copyright IBM Corp. 2007
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef _MMAN_H_
+#define _MMAN_H_
+
+#include <sys/types.h>
+
+/*
+ * Prots to 'mmap'.
+ */
+#define PROT_READ 0x1
+#define PROT_WRITE 0x2
+#define PROT_EXEC 0x4
+#define PROT_NONE 0x0
+/*
+ * Flags to 'mmap'.
+ */
+#define MAP_SHARED 0x001
+#define MAP_PRIVATE 0x002
+#define MAP_FIXED 0x010
+#define MAP_FILE 0x000
+#define MAP_ANONYMOUS 0x020
+#define MAP_ANON MAP_ANONYMOUS
+#define MAP_GROWSDOWN 0x0100
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_LOCKED 0x0080
+#define MAP_NORESERVE 0x0040
+/*
+ * Failed flag from 'mmap'.
+ */
+#define MAP_FAILED_EADDR ((unsigned long long) (-1LL))
+/*
+ * Flags to 'mremap'.
+ */
+#define MREMAP_MAYMOVE 1
+/*
+ * Flags to 'msync'.
+ */
+#define MS_ASYNC 1
+#define MS_SYNC 4
+#define MS_INVALIDATE 2
+
+
+extern int shm_open(const char *name, int oflag, mode_t mode);
+extern int shm_unlink(const char * name);
+
+unsigned long long mmap_eaddr(unsigned long long start, size_t length, int
+ prot, int flags, int fd, off_t offset);
+unsigned long long mremap_eaddr(unsigned long long old_addr, size_t
+ old_size, size_t new_size, int flags);
+unsigned long long msync_eaddr(unsigned long long start, size_t length,
+ int flags);
+unsigned long long munmap_eaddr(unsigned long long start, size_t length);
+
+#endif /* _MMAN_H_ */
diff --git a/newlib/libc/machine/spu/write_ea.c b/newlib/libc/machine/spu/write_ea.c
new file mode 100644
index 000000000..05d6bdf84
--- /dev/null
+++ b/newlib/libc/machine/spu/write_ea.c
@@ -0,0 +1,60 @@
+/*
+(C) Copyright IBM Corp. 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Ken Werner <ken.werner@de.ibm.com>
+*/
+
+#include "ea_internal.h"
+#include <ea.h>
+#include <spu_cache.h>
+#include "sys/linux_syscalls.h"
+
+extern void __cache_flush (void) __attribute__ ((weak));
+
+
+COMPAT_EA_ALIAS (write_ea);
+
+ssize_ea_t
+write_ea (int fd, __ea const void *buf, size_ea_t count)
+{
+ struct spu_syscall_block s = {
+ __NR_write,
+ {
+ fd,
+ (size_ea_t) buf,
+ count,
+ 0,
+ 0,
+ 0}
+ };
+ /* Flush cache only if the application really uses the software cache. */
+ if (__cache_flush)
+ __cache_flush ();
+ return __linux_syscall (&s);
+}
diff --git a/newlib/libc/machine/spu/writev_ea.c b/newlib/libc/machine/spu/writev_ea.c
new file mode 100644
index 000000000..efda38b5c
--- /dev/null
+++ b/newlib/libc/machine/spu/writev_ea.c
@@ -0,0 +1,69 @@
+/*
+(C) Copyright IBM Corp. 2008
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Ken Werner <ken.werner@de.ibm.com>
+*/
+
+#include "ea_internal.h"
+#include <ea.h>
+#include <spu_cache.h>
+#include "sys/linux_syscalls.h"
+
+extern void __cache_flush (void) __attribute__ ((weak));
+
+COMPAT_EA_ALIAS (writev_ea);
+
+ssize_ea_t
+writev_ea (int fd, struct iovec_ea *vector, int count)
+{
+#ifdef __EA32__
+ int i;
+#endif
+ struct spu_syscall_block s = {
+ __NR_writev,
+ {
+ fd,
+ (size_ea_t) (__ea void *) vector,
+ count,
+ 0,
+ 0,
+ 0}
+ };
+#ifdef __EA32__
+ for (i = 0; i < count; ++i)
+ {
+ vector[i].__pad1 = 0x0; /* 32 bit padding */
+ vector[i].__pad2 = 0x0; /* 32 bit padding */
+ }
+#endif
+ /* Flush cache only if the application really uses the software cache. */
+ if (__cache_flush)
+ __cache_flush ();
+ return __linux_syscall (&s);
+}