diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2007-08-23 22:45:22 +0400 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2007-08-23 22:45:22 +0400 |
commit | e6e56f7c72648ab51f54dc7a2cfc83b9c5b9c6e5 (patch) | |
tree | cd78bb15deffea016411d3743adb7cbf5c108787 /newlib/libc/machine | |
parent | fc32145a4c2dc74dc6b5309ba58dba2df1768e16 (diff) |
2007-08-23 Hidetaka Takano <hidetaka.takano@glb.toshiba.co.jp>
Reduce the memory consumption of variable argument functions
for SPU (cell):
* libc/machine/spu/Makefile.am: Replace printf/scanf family C sources
to assembler sources.
* libc/machine/spu/Makefile.in: Regenerated.
* libc/machine/spu/stdio.c: Add __check_init function wrapping
CHECK_INIT macro to use from assembler routines.
* libc/machine/spu/c99ppe.h: Add definitions for assembler code.
* libc/machine/spu/fiprintf.S: New file.
* libc/machine/spu/fiscanf.S: Ditto.
* libc/machine/spu/fprintf.S: Ditto.
* libc/machine/spu/fscanf.S: Ditto.
* libc/machine/spu/iprintf.S: Ditto.
* libc/machine/spu/iscanf.S: Ditto.
* libc/machine/spu/printf.S: Ditto.
* libc/machine/spu/scanf.S: Ditto.
* libc/machine/spu/siprintf.S: Ditto.
* libc/machine/spu/siscanf.S: Ditto.
* libc/machine/spu/sniprintf.S: Ditto.
* libc/machine/spu/snprintf.S: Ditto.
* libc/machine/spu/sprintf.S: Ditto.
* libc/machine/spu/sscanf.S: Ditto.
* libc/machine/spu/stack_reg_va.S: Ditto.
* libc/machine/spu/syscall.def: Ditto. (for maintenance)
* libc/machine/spu/mk_syscalls: Ditto. (for maintenance)
* libc/machine/spu/fiprintf.c: Removed. (Replaced by .S)
* libc/machine/spu/fiscanf.c: Ditto.
* libc/machine/spu/fprintf.c: Ditto.
* libc/machine/spu/fscanf.c: Ditto.
* libc/machine/spu/iprintf.c: Ditto.
* libc/machine/spu/iscanf.c: Ditto.
* libc/machine/spu/printf.c: Ditto.
* libc/machine/spu/scanf.c: Ditto.
* libc/machine/spu/siprintf.c: Ditto.
* libc/machine/spu/siscanf.c: Ditto.
* libc/machine/spu/sniprintf.c: Ditto.
* libc/machine/spu/snprintf.c: Ditto.
* libc/machine/spu/sprintf.c: Ditto.
* libc/machine/spu/sscanf.c: Ditto.
Diffstat (limited to 'newlib/libc/machine')
35 files changed, 1045 insertions, 712 deletions
diff --git a/newlib/libc/machine/spu/Makefile.am b/newlib/libc/machine/spu/Makefile.am index 6c8e68b1f..47d826c94 100644 --- a/newlib/libc/machine/spu/Makefile.am +++ b/newlib/libc/machine/spu/Makefile.am @@ -9,18 +9,18 @@ noinst_LIBRARIES = lib.a AM_CCASFLAGS = $(INCLUDES) lib_a_SOURCES = setjmp.S clearerr.c creat.c fclose.c feof.c ferror.c fflush.c \ - fgetc.c fgetpos.c fgets.c fileno.c fiprintf.c fiscanf.c fopen.c \ - fprintf.c fputc.c fputs.c fread.c freopen.c fscanf.c fseek.c \ - fsetpos.c ftell.c fwrite.c getc.c getchar.c gets.c iprintf.c \ - iscanf.c memcpy.c memmove.c memset.c perror.c printf.c \ - putc.c putchar.c puts.c remove.c rename.c rewind.c scanf.c \ - setbuf.c setvbuf.c siprintf.c siscanf.c sleep.c sniprintf.c \ - snprintf.c sprintf.c sscanf.c stdio.c strcat.c strchr.c strcmp.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 iprintf.S \ + iscanf.S 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 + vsprintf.c vsscanf.c stack_reg_va.S 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 db6100af0..04c22227b 100644 --- a/newlib/libc/machine/spu/Makefile.in +++ b/newlib/libc/machine/spu/Makefile.in @@ -73,13 +73,6 @@ 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 subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -135,7 +128,8 @@ am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-clearerr.$(OBJEXT) \ lib_a-vprintf.$(OBJEXT) lib_a-vscanf.$(OBJEXT) \ lib_a-vsiprintf.$(OBJEXT) lib_a-vsiscanf.$(OBJEXT) \ lib_a-vsniprintf.$(OBJEXT) lib_a-vsnprintf.$(OBJEXT) \ - lib_a-vsprintf.$(OBJEXT) lib_a-vsscanf.$(OBJEXT) + lib_a-vsprintf.$(OBJEXT) lib_a-vsscanf.$(OBJEXT) \ + lib_a-stack_reg_va.$(OBJEXT) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) depcomp = @@ -261,18 +255,18 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) noinst_LIBRARIES = lib.a AM_CCASFLAGS = $(INCLUDES) lib_a_SOURCES = setjmp.S clearerr.c creat.c fclose.c feof.c ferror.c fflush.c \ - fgetc.c fgetpos.c fgets.c fileno.c fiprintf.c fiscanf.c fopen.c \ - fprintf.c fputc.c fputs.c fread.c freopen.c fscanf.c fseek.c \ - fsetpos.c ftell.c fwrite.c getc.c getchar.c gets.c iprintf.c \ - iscanf.c memcpy.c memmove.c memset.c perror.c printf.c \ - putc.c putchar.c puts.c remove.c rename.c rewind.c scanf.c \ - setbuf.c setvbuf.c siprintf.c siscanf.c sleep.c sniprintf.c \ - snprintf.c sprintf.c sscanf.c stdio.c strcat.c strchr.c strcmp.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 iprintf.S \ + iscanf.S 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 + vsprintf.c vsscanf.c stack_reg_va.S lib_a_CCASFLAGS = $(AM_CCASFLAGS) lib_a_CFLAGS = $(AM_CFLAGS) @@ -341,6 +335,96 @@ lib_a-setjmp.o: setjmp.S lib_a-setjmp.obj: setjmp.S $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-setjmp.obj `if test -f 'setjmp.S'; then $(CYGPATH_W) 'setjmp.S'; else $(CYGPATH_W) '$(srcdir)/setjmp.S'; fi` +lib_a-fiprintf.o: fiprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-fiprintf.o `test -f 'fiprintf.S' || echo '$(srcdir)/'`fiprintf.S + +lib_a-fiprintf.obj: fiprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-fiprintf.obj `if test -f 'fiprintf.S'; then $(CYGPATH_W) 'fiprintf.S'; else $(CYGPATH_W) '$(srcdir)/fiprintf.S'; fi` + +lib_a-fiscanf.o: fiscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-fiscanf.o `test -f 'fiscanf.S' || echo '$(srcdir)/'`fiscanf.S + +lib_a-fiscanf.obj: fiscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-fiscanf.obj `if test -f 'fiscanf.S'; then $(CYGPATH_W) 'fiscanf.S'; else $(CYGPATH_W) '$(srcdir)/fiscanf.S'; fi` + +lib_a-fprintf.o: fprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-fprintf.o `test -f 'fprintf.S' || echo '$(srcdir)/'`fprintf.S + +lib_a-fprintf.obj: fprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.S'; then $(CYGPATH_W) 'fprintf.S'; else $(CYGPATH_W) '$(srcdir)/fprintf.S'; fi` + +lib_a-fscanf.o: fscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-fscanf.o `test -f 'fscanf.S' || echo '$(srcdir)/'`fscanf.S + +lib_a-fscanf.obj: fscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-fscanf.obj `if test -f 'fscanf.S'; then $(CYGPATH_W) 'fscanf.S'; else $(CYGPATH_W) '$(srcdir)/fscanf.S'; fi` + +lib_a-iprintf.o: iprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-iprintf.o `test -f 'iprintf.S' || echo '$(srcdir)/'`iprintf.S + +lib_a-iprintf.obj: iprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-iprintf.obj `if test -f 'iprintf.S'; then $(CYGPATH_W) 'iprintf.S'; else $(CYGPATH_W) '$(srcdir)/iprintf.S'; fi` + +lib_a-iscanf.o: iscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-iscanf.o `test -f 'iscanf.S' || echo '$(srcdir)/'`iscanf.S + +lib_a-iscanf.obj: iscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-iscanf.obj `if test -f 'iscanf.S'; then $(CYGPATH_W) 'iscanf.S'; else $(CYGPATH_W) '$(srcdir)/iscanf.S'; fi` + +lib_a-printf.o: printf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-printf.o `test -f 'printf.S' || echo '$(srcdir)/'`printf.S + +lib_a-printf.obj: printf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-printf.obj `if test -f 'printf.S'; then $(CYGPATH_W) 'printf.S'; else $(CYGPATH_W) '$(srcdir)/printf.S'; fi` + +lib_a-scanf.o: scanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-scanf.o `test -f 'scanf.S' || echo '$(srcdir)/'`scanf.S + +lib_a-scanf.obj: scanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-scanf.obj `if test -f 'scanf.S'; then $(CYGPATH_W) 'scanf.S'; else $(CYGPATH_W) '$(srcdir)/scanf.S'; fi` + +lib_a-siprintf.o: siprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-siprintf.o `test -f 'siprintf.S' || echo '$(srcdir)/'`siprintf.S + +lib_a-siprintf.obj: siprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-siprintf.obj `if test -f 'siprintf.S'; then $(CYGPATH_W) 'siprintf.S'; else $(CYGPATH_W) '$(srcdir)/siprintf.S'; fi` + +lib_a-siscanf.o: siscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-siscanf.o `test -f 'siscanf.S' || echo '$(srcdir)/'`siscanf.S + +lib_a-siscanf.obj: siscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-siscanf.obj `if test -f 'siscanf.S'; then $(CYGPATH_W) 'siscanf.S'; else $(CYGPATH_W) '$(srcdir)/siscanf.S'; fi` + +lib_a-sniprintf.o: sniprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-sniprintf.o `test -f 'sniprintf.S' || echo '$(srcdir)/'`sniprintf.S + +lib_a-sniprintf.obj: sniprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-sniprintf.obj `if test -f 'sniprintf.S'; then $(CYGPATH_W) 'sniprintf.S'; else $(CYGPATH_W) '$(srcdir)/sniprintf.S'; fi` + +lib_a-snprintf.o: snprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-snprintf.o `test -f 'snprintf.S' || echo '$(srcdir)/'`snprintf.S + +lib_a-snprintf.obj: snprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-snprintf.obj `if test -f 'snprintf.S'; then $(CYGPATH_W) 'snprintf.S'; else $(CYGPATH_W) '$(srcdir)/snprintf.S'; fi` + +lib_a-sprintf.o: sprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-sprintf.o `test -f 'sprintf.S' || echo '$(srcdir)/'`sprintf.S + +lib_a-sprintf.obj: sprintf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.S'; then $(CYGPATH_W) 'sprintf.S'; else $(CYGPATH_W) '$(srcdir)/sprintf.S'; fi` + +lib_a-sscanf.o: sscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.S' || echo '$(srcdir)/'`sscanf.S + +lib_a-sscanf.obj: sscanf.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-sscanf.obj `if test -f 'sscanf.S'; then $(CYGPATH_W) 'sscanf.S'; else $(CYGPATH_W) '$(srcdir)/sscanf.S'; fi` + +lib_a-stack_reg_va.o: stack_reg_va.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-stack_reg_va.o `test -f 'stack_reg_va.S' || echo '$(srcdir)/'`stack_reg_va.S + +lib_a-stack_reg_va.obj: stack_reg_va.S + $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-stack_reg_va.obj `if test -f 'stack_reg_va.S'; then $(CYGPATH_W) 'stack_reg_va.S'; else $(CYGPATH_W) '$(srcdir)/stack_reg_va.S'; fi` + .c.o: $(COMPILE) -c $< @@ -407,30 +491,12 @@ lib_a-fileno.o: fileno.c lib_a-fileno.obj: fileno.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fileno.obj `if test -f 'fileno.c'; then $(CYGPATH_W) 'fileno.c'; else $(CYGPATH_W) '$(srcdir)/fileno.c'; fi` -lib_a-fiprintf.o: fiprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fiprintf.o `test -f 'fiprintf.c' || echo '$(srcdir)/'`fiprintf.c - -lib_a-fiprintf.obj: fiprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fiprintf.obj `if test -f 'fiprintf.c'; then $(CYGPATH_W) 'fiprintf.c'; else $(CYGPATH_W) '$(srcdir)/fiprintf.c'; fi` - -lib_a-fiscanf.o: fiscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fiscanf.o `test -f 'fiscanf.c' || echo '$(srcdir)/'`fiscanf.c - -lib_a-fiscanf.obj: fiscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fiscanf.obj `if test -f 'fiscanf.c'; then $(CYGPATH_W) 'fiscanf.c'; else $(CYGPATH_W) '$(srcdir)/fiscanf.c'; fi` - lib_a-fopen.o: fopen.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fopen.o `test -f 'fopen.c' || echo '$(srcdir)/'`fopen.c lib_a-fopen.obj: fopen.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fopen.obj `if test -f 'fopen.c'; then $(CYGPATH_W) 'fopen.c'; else $(CYGPATH_W) '$(srcdir)/fopen.c'; fi` -lib_a-fprintf.o: fprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.o `test -f 'fprintf.c' || echo '$(srcdir)/'`fprintf.c - -lib_a-fprintf.obj: fprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi` - lib_a-fputc.o: fputc.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c @@ -455,12 +521,6 @@ lib_a-freopen.o: freopen.c lib_a-freopen.obj: freopen.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-freopen.obj `if test -f 'freopen.c'; then $(CYGPATH_W) 'freopen.c'; else $(CYGPATH_W) '$(srcdir)/freopen.c'; fi` -lib_a-fscanf.o: fscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fscanf.o `test -f 'fscanf.c' || echo '$(srcdir)/'`fscanf.c - -lib_a-fscanf.obj: fscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fscanf.obj `if test -f 'fscanf.c'; then $(CYGPATH_W) 'fscanf.c'; else $(CYGPATH_W) '$(srcdir)/fscanf.c'; fi` - lib_a-fseek.o: fseek.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fseek.o `test -f 'fseek.c' || echo '$(srcdir)/'`fseek.c @@ -503,18 +563,6 @@ lib_a-gets.o: gets.c lib_a-gets.obj: gets.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gets.obj `if test -f 'gets.c'; then $(CYGPATH_W) 'gets.c'; else $(CYGPATH_W) '$(srcdir)/gets.c'; fi` -lib_a-iprintf.o: iprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-iprintf.o `test -f 'iprintf.c' || echo '$(srcdir)/'`iprintf.c - -lib_a-iprintf.obj: iprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-iprintf.obj `if test -f 'iprintf.c'; then $(CYGPATH_W) 'iprintf.c'; else $(CYGPATH_W) '$(srcdir)/iprintf.c'; fi` - -lib_a-iscanf.o: iscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-iscanf.o `test -f 'iscanf.c' || echo '$(srcdir)/'`iscanf.c - -lib_a-iscanf.obj: iscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-iscanf.obj `if test -f 'iscanf.c'; then $(CYGPATH_W) 'iscanf.c'; else $(CYGPATH_W) '$(srcdir)/iscanf.c'; fi` - lib_a-memcpy.o: memcpy.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy.o `test -f 'memcpy.c' || echo '$(srcdir)/'`memcpy.c @@ -539,12 +587,6 @@ lib_a-perror.o: perror.c lib_a-perror.obj: perror.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-perror.obj `if test -f 'perror.c'; then $(CYGPATH_W) 'perror.c'; else $(CYGPATH_W) '$(srcdir)/perror.c'; fi` -lib_a-printf.o: printf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-printf.o `test -f 'printf.c' || echo '$(srcdir)/'`printf.c - -lib_a-printf.obj: printf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-printf.obj `if test -f 'printf.c'; then $(CYGPATH_W) 'printf.c'; else $(CYGPATH_W) '$(srcdir)/printf.c'; fi` - lib_a-putc.o: putc.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-putc.o `test -f 'putc.c' || echo '$(srcdir)/'`putc.c @@ -581,12 +623,6 @@ lib_a-rewind.o: rewind.c lib_a-rewind.obj: rewind.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rewind.obj `if test -f 'rewind.c'; then $(CYGPATH_W) 'rewind.c'; else $(CYGPATH_W) '$(srcdir)/rewind.c'; fi` -lib_a-scanf.o: scanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-scanf.o `test -f 'scanf.c' || echo '$(srcdir)/'`scanf.c - -lib_a-scanf.obj: scanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-scanf.obj `if test -f 'scanf.c'; then $(CYGPATH_W) 'scanf.c'; else $(CYGPATH_W) '$(srcdir)/scanf.c'; fi` - lib_a-setbuf.o: setbuf.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-setbuf.o `test -f 'setbuf.c' || echo '$(srcdir)/'`setbuf.c @@ -599,48 +635,12 @@ lib_a-setvbuf.o: setvbuf.c lib_a-setvbuf.obj: setvbuf.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-setvbuf.obj `if test -f 'setvbuf.c'; then $(CYGPATH_W) 'setvbuf.c'; else $(CYGPATH_W) '$(srcdir)/setvbuf.c'; fi` -lib_a-siprintf.o: siprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-siprintf.o `test -f 'siprintf.c' || echo '$(srcdir)/'`siprintf.c - -lib_a-siprintf.obj: siprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-siprintf.obj `if test -f 'siprintf.c'; then $(CYGPATH_W) 'siprintf.c'; else $(CYGPATH_W) '$(srcdir)/siprintf.c'; fi` - -lib_a-siscanf.o: siscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-siscanf.o `test -f 'siscanf.c' || echo '$(srcdir)/'`siscanf.c - -lib_a-siscanf.obj: siscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-siscanf.obj `if test -f 'siscanf.c'; then $(CYGPATH_W) 'siscanf.c'; else $(CYGPATH_W) '$(srcdir)/siscanf.c'; fi` - lib_a-sleep.o: sleep.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sleep.o `test -f 'sleep.c' || echo '$(srcdir)/'`sleep.c lib_a-sleep.obj: sleep.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sleep.obj `if test -f 'sleep.c'; then $(CYGPATH_W) 'sleep.c'; else $(CYGPATH_W) '$(srcdir)/sleep.c'; fi` -lib_a-sniprintf.o: sniprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sniprintf.o `test -f 'sniprintf.c' || echo '$(srcdir)/'`sniprintf.c - -lib_a-sniprintf.obj: sniprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sniprintf.obj `if test -f 'sniprintf.c'; then $(CYGPATH_W) 'sniprintf.c'; else $(CYGPATH_W) '$(srcdir)/sniprintf.c'; fi` - -lib_a-snprintf.o: snprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-snprintf.o `test -f 'snprintf.c' || echo '$(srcdir)/'`snprintf.c - -lib_a-snprintf.obj: snprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-snprintf.obj `if test -f 'snprintf.c'; then $(CYGPATH_W) 'snprintf.c'; else $(CYGPATH_W) '$(srcdir)/snprintf.c'; fi` - -lib_a-sprintf.o: sprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.o `test -f 'sprintf.c' || echo '$(srcdir)/'`sprintf.c - -lib_a-sprintf.obj: sprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi` - -lib_a-sscanf.o: sscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.c' || echo '$(srcdir)/'`sscanf.c - -lib_a-sscanf.obj: sscanf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.obj `if test -f 'sscanf.c'; then $(CYGPATH_W) 'sscanf.c'; else $(CYGPATH_W) '$(srcdir)/sscanf.c'; fi` - lib_a-stdio.o: stdio.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stdio.o `test -f 'stdio.c' || echo '$(srcdir)/'`stdio.c diff --git a/newlib/libc/machine/spu/c99ppe.h b/newlib/libc/machine/spu/c99ppe.h index da5d03c5c..b0ccf2dc0 100644 --- a/newlib/libc/machine/spu/c99ppe.h +++ b/newlib/libc/machine/spu/c99ppe.h @@ -30,8 +30,10 @@ POSSIBILITY OF SUCH DAMAGE. Author: Joel Schopp <jschopp@austin.ibm.com> */ +#ifndef __ASSEMBLER__ #include <errno.h> #include <sys/syscall.h> +#endif /* !__ASSEMBLER__ */ #define SPE_C99_SIGNALCODE 0x2100 @@ -39,50 +41,49 @@ Author: Joel Schopp <jschopp@austin.ibm.com> #define SPE_C99_OP_MASK 0xff #define SPE_C99_DATA_MASK 0xffffff -enum { - SPE_C99_CLEARERR=0x01, - SPE_C99_FCLOSE, - SPE_C99_FEOF, - SPE_C99_FERROR, - SPE_C99_FFLUSH, - SPE_C99_FGETC, - SPE_C99_FGETPOS, - SPE_C99_FGETS, - SPE_C99_FILENO, - SPE_C99_FOPEN, //implemented - SPE_C99_FPUTC, - SPE_C99_FPUTS, - SPE_C99_FREAD, - SPE_C99_FREOPEN, - SPE_C99_FSEEK, - SPE_C99_FSETPOS, - SPE_C99_FTELL, - SPE_C99_FWRITE, - SPE_C99_GETC, - SPE_C99_GETCHAR, - SPE_C99_GETS, - SPE_C99_PERROR, - SPE_C99_PUTC, - SPE_C99_PUTCHAR, - SPE_C99_PUTS, - SPE_C99_REMOVE, - SPE_C99_RENAME, - SPE_C99_REWIND, - SPE_C99_SETBUF, - SPE_C99_SETVBUF, - SPE_C99_SYSTEM, //not yet implemented in newlib - SPE_C99_TMPFILE, - SPE_C99_TMPNAM, - SPE_C99_UNGETC, - SPE_C99_VFPRINTF, - SPE_C99_VFSCANF, - SPE_C99_VPRINTF, - SPE_C99_VSCANF, - SPE_C99_VSNPRINTF, - SPE_C99_VSPRINTF, - SPE_C99_VSSCANF, - SPE_C99_LAST_OPCODE, -}; +#define SPE_C99_CLEARERR 1 +#define SPE_C99_FCLOSE 2 +#define SPE_C99_FEOF 3 +#define SPE_C99_FERROR 4 +#define SPE_C99_FFLUSH 5 +#define SPE_C99_FGETC 6 +#define SPE_C99_FGETPOS 7 +#define SPE_C99_FGETS 8 +#define SPE_C99_FILENO 9 +#define SPE_C99_FOPEN 10 //implemented +#define SPE_C99_FPUTC 11 +#define SPE_C99_FPUTS 12 +#define SPE_C99_FREAD 13 +#define SPE_C99_FREOPEN 14 +#define SPE_C99_FSEEK 15 +#define SPE_C99_FSETPOS 16 +#define SPE_C99_FTELL 17 +#define SPE_C99_FWRITE 18 +#define SPE_C99_GETC 19 +#define SPE_C99_GETCHAR 20 +#define SPE_C99_GETS 21 +#define SPE_C99_PERROR 22 +#define SPE_C99_PUTC 23 +#define SPE_C99_PUTCHAR 24 +#define SPE_C99_PUTS 25 +#define SPE_C99_REMOVE 26 +#define SPE_C99_RENAME 27 +#define SPE_C99_REWIND 28 +#define SPE_C99_SETBUF 29 +#define SPE_C99_SETVBUF 30 +#define SPE_C99_SYSTEM 31 //not yet implemented in newlib +#define SPE_C99_TMPFILE 32 +#define SPE_C99_TMPNAM 33 +#define SPE_C99_UNGETC 34 +#define SPE_C99_VFPRINTF 35 +#define SPE_C99_VFSCANF 36 +#define SPE_C99_VPRINTF 37 +#define SPE_C99_VSCANF 38 +#define SPE_C99_VSNPRINTF 39 +#define SPE_C99_VSPRINTF 40 +#define SPE_C99_VSSCANF 41 +#define SPE_C99_LAST_OPCODE 42 + #define SPE_C99_NR_OPCODES ((SPE_C99_LAST_OPCODE - SPE_C99_CLEARERR) + 1) #define SPE_STDIN 1 @@ -90,6 +91,10 @@ enum { #define SPE_STDERR 3 #define SPE_FOPEN_MAX FOPEN_MAX +#ifdef __ASSEMBLER__ +#define SPE_STACK_REGS 72 /* Number of registers preserved in stack + in case of variable argument API. */ +#else /* !__ASSEMBLER__ */ struct spe_reg128{ unsigned int slot[4]; }; @@ -102,3 +107,4 @@ FILE *_EXFUN(__sfp,(struct _reent *)); do { if ((ptr) && !(ptr)->__sdidinit) __sinit (ptr); } while (0) #define CHECK_STD_INIT(ptr) /* currently, do nothing */ #define CHECK_STR_INIT(ptr) /* currently, do nothing */ +#endif /* __ASSEMBLER__ */ diff --git a/newlib/libc/machine/spu/fiprintf.S b/newlib/libc/machine/spu/fiprintf.S new file mode 100644 index 000000000..c0d23ca04 --- /dev/null +++ b/newlib/libc/machine/spu/fiprintf.S @@ -0,0 +1,32 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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. + */ + +#define fprintf fiprintf +#include "fprintf.S" diff --git a/newlib/libc/machine/spu/fiprintf.c b/newlib/libc/machine/spu/fiprintf.c deleted file mode 100644 index 7bd781b12..000000000 --- a/newlib/libc/machine/spu/fiprintf.c +++ /dev/null @@ -1,2 +0,0 @@ -#define INTEGER_ONLY -#include "fprintf.c" diff --git a/newlib/libc/machine/spu/fiscanf.S b/newlib/libc/machine/spu/fiscanf.S new file mode 100644 index 000000000..52115727a --- /dev/null +++ b/newlib/libc/machine/spu/fiscanf.S @@ -0,0 +1,32 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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. + */ + +#define fscanf fiscanf +#include "fscanf.S" diff --git a/newlib/libc/machine/spu/fiscanf.c b/newlib/libc/machine/spu/fiscanf.c deleted file mode 100644 index 2c8b00952..000000000 --- a/newlib/libc/machine/spu/fiscanf.c +++ /dev/null @@ -1,2 +0,0 @@ -#define INTEGER_ONLY -#include "fscanf.c" diff --git a/newlib/libc/machine/spu/fprintf.S b/newlib/libc/machine/spu/fprintf.S new file mode 100644 index 000000000..ddd02550e --- /dev/null +++ b/newlib/libc/machine/spu/fprintf.S @@ -0,0 +1,55 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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 "c99ppe.h" + + .text + .align 4 + GLOBL fprintf +fprintf: + stqd $0, 16($sp) /* save caller address */ + il $2, 2 /* number of fixed arguments */ + brsl $0, __stack_reg_va /* save register to the stack frame */ + + brsl $0, __check_init + lqd $3, 16*2($sp) /* $3 <- saved FP on the stack frame */ + lqd $2, 0($3) /* FP = fp->_fp */ + rotqby $2, $2, $3 + stqd $2, 16*2($sp) /* replace FP on the stack frame */ + + il $3, SPE_C99_SIGNALCODE + il $4, SPE_C99_VFPRINTF + ai $5, $sp, 16*2 /* data ($3 save address) */ + brsl $0, __send_to_ppe + + il $2, 16*(SPE_STACK_REGS+2+2) + a $sp, $sp, $2 + lqd $0, 16($sp) /* load caller address */ + bi $0 /* return to caller */ diff --git a/newlib/libc/machine/spu/fprintf.c b/newlib/libc/machine/spu/fprintf.c deleted file mode 100644 index 08b4b1cbf..000000000 --- a/newlib/libc/machine/spu/fprintf.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -(C) Copyright IBM Corp. 2006 - -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: Joel Schopp <jschopp@austin.ibm.com> -*/ - -#include <_ansi.h> -#include <stdio.h> - -#include "c99ppe.h" - -#ifdef _HAVE_STDC -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -#ifdef INTEGER_ONLY -# define fprintf fiprintf -#endif - -typedef struct -{ - int fp; - unsigned int pad0[ 3 ]; - _CONST char* fmt; - unsigned int pad1[ 3 ]; - va_list ap; -} c99_fprintf_t; - -#ifndef _REENT_ONLY - -int -fprintf(FILE * fp, _CONST char *fmt,...) -{ - int ret; - c99_fprintf_t args; - - CHECK_INIT(_REENT); - - args.fp = fp->_fp; - args.fmt = (char*) fmt; - -#ifdef _HAVE_STDC - va_start (args.ap, fmt); -#else - va_start (args.ap); -#endif - - ret =__send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args); - - va_end (args.ap); - return ret; -} -#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fscanf.S b/newlib/libc/machine/spu/fscanf.S new file mode 100644 index 000000000..5b51e1dbe --- /dev/null +++ b/newlib/libc/machine/spu/fscanf.S @@ -0,0 +1,55 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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 "c99ppe.h" + + .text + .align 4 + GLOBL fscanf +fscanf: + stqd $0, 16($sp) /* save caller address */ + il $2, 2 /* number of fixed arguments */ + brsl $0, __stack_reg_va /* save register to the stack frame */ + + brsl $0, __check_init + lqd $3, 16*2($sp) /* $3 <- saved FP on the stack frame */ + lqd $2, 0($3) /* FP = fp->_fp */ + rotqby $2, $2, $3 + stqd $2, 16*2($sp) /* replace FP on the stack frame */ + + il $3, SPE_C99_SIGNALCODE + il $4, SPE_C99_VFSCANF + ai $5, $sp, 16*2 /* data ($3 save address) */ + brsl $0, __send_to_ppe + + il $2, 16*(SPE_STACK_REGS+2+2) + a $sp, $sp, $2 + lqd $0, 16($sp) /* load caller address */ + bi $0 /* return to caller */ diff --git a/newlib/libc/machine/spu/fscanf.c b/newlib/libc/machine/spu/fscanf.c deleted file mode 100644 index b47d93027..000000000 --- a/newlib/libc/machine/spu/fscanf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -(C) Copyright IBM Corp. 2006 - -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: Joel Schopp <jschopp@austin.ibm.com> -*/ - -#include <_ansi.h> -#include <stdio.h> - -#include "c99ppe.h" - -#ifdef _HAVE_STDC -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -#ifdef INTEGER_ONLY -# define fscanf fiscanf -#endif - -typedef struct -{ - int fp; - unsigned int pad0[ 3 ]; - _CONST char* fmt; - unsigned int pad1[ 3 ]; - va_list ap; -} c99_vfscanf_t; - -#ifndef _REENT_ONLY - -fscanf(FILE *fp, _CONST char *fmt, ...) -{ - int ret; - c99_vfscanf_t args; - - CHECK_INIT(_REENT); - - args.fp = fp->_fp; - args.fmt = (char*) fmt; -#ifdef _HAVE_STDC - va_start (args.ap, fmt); -#else - va_start (args.ap); -#endif - - - ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args); - - va_end (args.ap); - return ret; -} -#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/iprintf.S b/newlib/libc/machine/spu/iprintf.S new file mode 100644 index 000000000..1c3440ba0 --- /dev/null +++ b/newlib/libc/machine/spu/iprintf.S @@ -0,0 +1,32 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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. + */ + +#define printf iprintf +#include "printf.S" diff --git a/newlib/libc/machine/spu/iprintf.c b/newlib/libc/machine/spu/iprintf.c deleted file mode 100644 index 6394399d4..000000000 --- a/newlib/libc/machine/spu/iprintf.c +++ /dev/null @@ -1,2 +0,0 @@ -#define INTEGER_ONLY -#include "printf.c" diff --git a/newlib/libc/machine/spu/iscanf.S b/newlib/libc/machine/spu/iscanf.S new file mode 100644 index 000000000..f96be15e7 --- /dev/null +++ b/newlib/libc/machine/spu/iscanf.S @@ -0,0 +1,32 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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. + */ + +#define scanf iscanf +#include "scanf.S" diff --git a/newlib/libc/machine/spu/iscanf.c b/newlib/libc/machine/spu/iscanf.c deleted file mode 100644 index 0e35a0ab9..000000000 --- a/newlib/libc/machine/spu/iscanf.c +++ /dev/null @@ -1,2 +0,0 @@ -#define INTEGER_ONLY -#include "scanf.c" diff --git a/newlib/libc/machine/spu/mk_syscalls b/newlib/libc/machine/spu/mk_syscalls new file mode 100644 index 000000000..db9ea9409 --- /dev/null +++ b/newlib/libc/machine/spu/mk_syscalls @@ -0,0 +1,98 @@ +#!/usr/bin/perl -w +# +# (C) Copyright 2007 TOSHIBA CORPORATION +# 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 names of Toshiba 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. + +open(DEFS, "syscall.def"); + +while ($line = <DEFS>) { + next if ($line =~ /^#.*/); + + ($opcode, $name, $fp, $parms) = split(" ", $line); + $filename = ">" . $name . ".S"; + open(SOURCE, $filename); + + print SOURCE "\/\*\n"; + print SOURCE " Copyright (c) 2007, Toshiba Corporation\n\n"; + + print SOURCE " All rights reserved.\n\n"; + + print SOURCE " Redistribution and use in source and binary forms, with or without\n"; + print SOURCE " modification, are permitted provided that the following conditions are met:\n\n"; + + print SOURCE " \* Redistributions of source code must retain the above copyright notice,\n"; + print SOURCE " this list of conditions and the following disclaimer.\n"; + print SOURCE " \* Redistributions in binary form must reproduce the above copyright\n"; + print SOURCE " notice, this list of conditions and the following disclaimer in the\n"; + print SOURCE " documentation and/or other materials provided with the distribution.\n"; + print SOURCE " \* Neither the names of Toshiba nor the names of its\n"; + print SOURCE " contributors may be used to endorse or promote products derived from this\n"; + print SOURCE " software without specific prior written permission.\n\n"; + + print SOURCE " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n"; + print SOURCE " AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n"; + print SOURCE " IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n"; + print SOURCE " ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n"; + print SOURCE " LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n"; + print SOURCE " CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n"; + print SOURCE " SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n"; + print SOURCE " INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n"; + print SOURCE " CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n"; + print SOURCE " ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n"; + print SOURCE " POSSIBILITY OF SUCH DAMAGE.\n"; + print SOURCE " \*\/\n\n"; + print SOURCE "#include \"c99ppe.h\"\n\n"; + print SOURCE " .text\n"; + print SOURCE " .align 4\n"; + print SOURCE " GLOBL ", $name, "\n"; + print SOURCE $name, ":\n"; + + print SOURCE " stqd \$0, 16(\$sp) \/\* save caller address \*\/\n"; + print SOURCE " il \$2, ", $parms, " \/\* number of fixed arguments \*\/\n"; + print SOURCE " brsl \$0, __stack_reg_va \/\* save register to the stack frame \*\/\n\n"; + + if ($fp > 0) { + print SOURCE " brsl \$0, __check_init\n"; + print SOURCE " lqd \$3, 16\*2(\$sp) \/\* \$3 <- saved FP on the stack frame \*\/\n"; + print SOURCE " lqd \$2, 0(\$3) \/\* FP = fp->_fp \*\/\n"; + print SOURCE " rotqby \$2, \$2, \$3\n"; + print SOURCE " stqd \$2, 16\*2(\$sp) \/\* replace FP on the stack frame \*\/\n\n"; + } + + print SOURCE " il \$3, SPE_C99_SIGNALCODE\n"; + print SOURCE " il \$4, ", $opcode, "\n"; + print SOURCE " ai \$5, \$sp, 16\*2 \/\* data (\$3 save address) \*\/\n"; + print SOURCE " brsl \$0, __send_to_ppe\n\n"; + + print SOURCE " il \$2, 16\*(SPE_STACK_REGS+2+2)\n"; + print SOURCE " a \$sp, \$sp, \$2\n"; + print SOURCE " lqd \$0, 16(\$sp) \/\* load caller address \*\/\n"; + print SOURCE " bi \$0 \/\* return to caller \*\/\n"; + + close(SOURCE); +} + diff --git a/newlib/libc/machine/spu/printf.S b/newlib/libc/machine/spu/printf.S new file mode 100644 index 000000000..36feaf7aa --- /dev/null +++ b/newlib/libc/machine/spu/printf.S @@ -0,0 +1,49 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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 "c99ppe.h" + + .text + .align 4 + GLOBL printf +printf: + stqd $0, 16($sp) /* save caller address */ + il $2, 1 /* number of fixed arguments */ + brsl $0, __stack_reg_va /* save register to the stack frame */ + + il $3, SPE_C99_SIGNALCODE + il $4, SPE_C99_VPRINTF + ai $5, $sp, 16*2 /* data ($3 save address) */ + brsl $0, __send_to_ppe + + il $2, 16*(SPE_STACK_REGS+2+2) + a $sp, $sp, $2 + lqd $0, 16($sp) /* load caller address */ + bi $0 /* return to caller */ diff --git a/newlib/libc/machine/spu/printf.c b/newlib/libc/machine/spu/printf.c deleted file mode 100644 index bf3658ba6..000000000 --- a/newlib/libc/machine/spu/printf.c +++ /dev/null @@ -1,56 +0,0 @@ -#include <_ansi.h> -#include <stdio.h> - -#include "c99ppe.h" - -#ifdef _HAVE_STDC -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -#ifdef INTEGER_ONLY -# define printf iprintf -#endif - -typedef struct -{ - _CONST char* fmt; - unsigned int pad0[ 3 ]; - va_list ap; -} c99_printf_t; - -#ifndef _REENT_ONLY - -#ifdef _HAVE_STDC -int -_DEFUN (printf, (fmt,ap), - _CONST char *fmt _AND - ...) -#else -int -#error -printf (fmt, va_alist) - _CONST char *fmt; - va_dcl -#endif -{ - int ret; - c99_printf_t args; - - CHECK_STD_INIT(_REENT); - - args.fmt = fmt; -#ifdef _HAVE_STDC - va_start (args.ap, fmt); -#else - va_start (args.ap); -#endif - - ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args); - - va_end (args.ap); - return ret; -} - -#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/scanf.S b/newlib/libc/machine/spu/scanf.S new file mode 100644 index 000000000..f547d8ecf --- /dev/null +++ b/newlib/libc/machine/spu/scanf.S @@ -0,0 +1,49 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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 "c99ppe.h" + + .text + .align 4 + GLOBL scanf +scanf: + stqd $0, 16($sp) /* save caller address */ + il $2, 1 /* number of fixed arguments */ + brsl $0, __stack_reg_va /* save register to the stack frame */ + + il $3, SPE_C99_SIGNALCODE + il $4, SPE_C99_VSCANF + ai $5, $sp, 16*2 /* data ($3 save address) */ + brsl $0, __send_to_ppe + + il $2, 16*(SPE_STACK_REGS+2+2) + a $sp, $sp, $2 + lqd $0, 16($sp) /* load caller address */ + bi $0 /* return to caller */ diff --git a/newlib/libc/machine/spu/scanf.c b/newlib/libc/machine/spu/scanf.c deleted file mode 100644 index 29157a3ba..000000000 --- a/newlib/libc/machine/spu/scanf.c +++ /dev/null @@ -1,78 +0,0 @@ -/* -(C) Copyright IBM Corp. 2006 - -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: Joel Schopp <jschopp@austin.ibm.com> -*/ - -#include <_ansi.h> -#include <stdio.h> - -#include "c99ppe.h" - -#ifdef _HAVE_STDC -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -#ifdef INTEGER_ONLY -# define scanf iscanf -#endif - -typedef struct -{ - _CONST char* fmt; - unsigned int pad0[ 3 ]; - va_list ap; -} c99_vscanf_t; - -#ifndef _REENT_ONLY - -scanf(_CONST char *fmt, ...) -{ - int ret; - c99_vscanf_t args; - - CHECK_STD_INIT(_REENT); - - args.fmt = (char*) fmt; -#ifdef _HAVE_STDC - va_start (args.ap, fmt); -#else - va_start (args.ap); -#endif - - - ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args); - - va_end (args.ap); - return ret; -} - -#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/siprintf.S b/newlib/libc/machine/spu/siprintf.S new file mode 100644 index 000000000..9463501e2 --- /dev/null +++ b/newlib/libc/machine/spu/siprintf.S @@ -0,0 +1,32 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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. + */ + +#define sprintf siprintf +#include "sprintf.S" diff --git a/newlib/libc/machine/spu/siprintf.c b/newlib/libc/machine/spu/siprintf.c deleted file mode 100644 index f630f83b5..000000000 --- a/newlib/libc/machine/spu/siprintf.c +++ /dev/null @@ -1,2 +0,0 @@ -#define INTEGER_ONLY -#include "sprintf.c" diff --git a/newlib/libc/machine/spu/siscanf.S b/newlib/libc/machine/spu/siscanf.S new file mode 100644 index 000000000..4f8755f25 --- /dev/null +++ b/newlib/libc/machine/spu/siscanf.S @@ -0,0 +1,32 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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. + */ + +#define sscanf siscanf +#include "sscanf.S" diff --git a/newlib/libc/machine/spu/siscanf.c b/newlib/libc/machine/spu/siscanf.c deleted file mode 100644 index f37b1e5a3..000000000 --- a/newlib/libc/machine/spu/siscanf.c +++ /dev/null @@ -1,2 +0,0 @@ -#define INTEGER_ONLY -#include "sscanf.c" diff --git a/newlib/libc/machine/spu/sniprintf.S b/newlib/libc/machine/spu/sniprintf.S new file mode 100644 index 000000000..e62278e16 --- /dev/null +++ b/newlib/libc/machine/spu/sniprintf.S @@ -0,0 +1,32 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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. + */ + +#define snprintf sniprintf +#include "snprintf.S" diff --git a/newlib/libc/machine/spu/sniprintf.c b/newlib/libc/machine/spu/sniprintf.c deleted file mode 100644 index 004c24b61..000000000 --- a/newlib/libc/machine/spu/sniprintf.c +++ /dev/null @@ -1,2 +0,0 @@ -#define INTEGER_ONLY -#include "snprintf.c" diff --git a/newlib/libc/machine/spu/snprintf.S b/newlib/libc/machine/spu/snprintf.S new file mode 100644 index 000000000..90bd98a03 --- /dev/null +++ b/newlib/libc/machine/spu/snprintf.S @@ -0,0 +1,49 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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 "c99ppe.h" + + .text + .align 4 + GLOBL snprintf +snprintf: + stqd $0, 16($sp) /* save caller address */ + il $2, 3 /* number of fixed arguments */ + brsl $0, __stack_reg_va /* save register to the stack frame */ + + il $3, SPE_C99_SIGNALCODE + il $4, SPE_C99_VSNPRINTF + ai $5, $sp, 16*2 /* data ($3 save address) */ + brsl $0, __send_to_ppe + + il $2, 16*(SPE_STACK_REGS+2+2) + a $sp, $sp, $2 + lqd $0, 16($sp) /* load caller address */ + bi $0 /* return to caller */ diff --git a/newlib/libc/machine/spu/snprintf.c b/newlib/libc/machine/spu/snprintf.c deleted file mode 100644 index 98d7f575e..000000000 --- a/newlib/libc/machine/spu/snprintf.c +++ /dev/null @@ -1,86 +0,0 @@ -/* -(C) Copyright IBM Corp. 2006 - -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: Joel Schopp <jschopp@austin.ibm.com> -*/ - -#include <_ansi.h> -#include <stdio.h> - -#include "c99ppe.h" - -#ifdef _HAVE_STDC -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -#ifdef INTEGER_ONLY -# define snprintf sniprintf -#endif - -typedef struct -{ - char* str; - unsigned int pad0[ 3 ]; - size_t size; - unsigned int pad1[ 3 ]; - _CONST char* fmt; - unsigned int pad2[ 3 ]; - va_list ap; -} c99_snprintf_t; - -#ifndef _REENT_ONLY - -_DEFUN(snprintf, (str, size, fmt), - char *str _AND - size_t size _AND - _CONST char *fmt _DOTS) -{ - int ret; - c99_snprintf_t args; - - CHECK_STR_INIT(_REENT); - - args.str = str; - args.size = size; - args.fmt = fmt; -#ifdef _HAVE_STDC - va_start (args.ap, fmt); -#else - va_start (args.ap); -#endif - - ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args); - - va_end (args.ap); - return ret; -} - -#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/sprintf.S b/newlib/libc/machine/spu/sprintf.S new file mode 100644 index 000000000..56fca77ea --- /dev/null +++ b/newlib/libc/machine/spu/sprintf.S @@ -0,0 +1,49 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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 "c99ppe.h" + + .text + .align 4 + GLOBL sprintf +sprintf: + stqd $0, 16($sp) /* save caller address */ + il $2, 2 /* number of fixed arguments */ + brsl $0, __stack_reg_va /* save register to the stack frame */ + + il $3, SPE_C99_SIGNALCODE + il $4, SPE_C99_VSPRINTF + ai $5, $sp, 16*2 /* data ($3 save address) */ + brsl $0, __send_to_ppe + + il $2, 16*(SPE_STACK_REGS+2+2) + a $sp, $sp, $2 + lqd $0, 16($sp) /* load caller address */ + bi $0 /* return to caller */ diff --git a/newlib/libc/machine/spu/sprintf.c b/newlib/libc/machine/spu/sprintf.c deleted file mode 100644 index b4f7dadd0..000000000 --- a/newlib/libc/machine/spu/sprintf.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -(C) Copyright IBM Corp. 2006 - -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: Joel Schopp <jschopp@austin.ibm.com> -*/ - -#include <_ansi.h> -#include <stdio.h> - -#include "c99ppe.h" - -#ifdef _HAVE_STDC -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -#ifdef INTEGER_ONLY -# define sprintf siprintf -#endif - -typedef struct -{ - char* str; - unsigned int pad0[ 3 ]; - _CONST char* fmt; - unsigned int pad1[ 3 ]; - va_list ap; -} c99_sprintf_t; - -#ifndef _REENT_ONLY - -_DEFUN(sprintf, (str, fmt), - char *str _AND - _CONST char *fmt _DOTS) -{ - int ret; - c99_sprintf_t args; - - CHECK_STR_INIT(_REENT); - - args.str = str; - args.fmt = fmt; -#ifdef _HAVE_STDC - va_start (args.ap, fmt); -#else - va_start (args.ap); -#endif - - ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSPRINTF, &args); - - va_end (args.ap); - return ret; -} - -#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/sscanf.S b/newlib/libc/machine/spu/sscanf.S new file mode 100644 index 000000000..980955aaf --- /dev/null +++ b/newlib/libc/machine/spu/sscanf.S @@ -0,0 +1,49 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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 "c99ppe.h" + + .text + .align 4 + GLOBL sscanf +sscanf: + stqd $0, 16($sp) /* save caller address */ + il $2, 2 /* number of fixed arguments */ + brsl $0, __stack_reg_va /* save register to the stack frame */ + + il $3, SPE_C99_SIGNALCODE + il $4, SPE_C99_VSSCANF + ai $5, $sp, 16*2 /* data ($3 save address) */ + brsl $0, __send_to_ppe + + il $2, 16*(SPE_STACK_REGS+2+2) + a $sp, $sp, $2 + lqd $0, 16($sp) /* load caller address */ + bi $0 /* return to caller */ diff --git a/newlib/libc/machine/spu/sscanf.c b/newlib/libc/machine/spu/sscanf.c deleted file mode 100644 index 669c6e51e..000000000 --- a/newlib/libc/machine/spu/sscanf.c +++ /dev/null @@ -1,83 +0,0 @@ -/* -(C) Copyright IBM Corp. 2006 - -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: Joel Schopp <jschopp@austin.ibm.com> -*/ - -#include <_ansi.h> -#include <stdio.h> - -#include "c99ppe.h" - -#ifdef _HAVE_STDC -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -#ifdef INTEGER_ONLY -# define sscanf siscanf -#endif - -typedef struct -{ - _CONST char* str; - unsigned int pad0[ 3 ]; - _CONST char* fmt; - unsigned int pad1[ 3 ]; - va_list ap; -} c99_sscanf_t; - -#ifndef _REENT_ONLY - -int -_DEFUN(sscanf, (str, fmt), - _CONST char *str _AND - _CONST char *fmt _DOTS) -{ - int ret; - c99_sscanf_t args; - - CHECK_STR_INIT(_REENT); - - args.str = str; - args.fmt = fmt; -#ifdef _HAVE_STDC - va_start (args.ap, fmt); -#else - va_start (args.ap); -#endif - - ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSSCANF, &args); - - va_end (args.ap); - return ret; -} - -#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/stack_reg_va.S b/newlib/libc/machine/spu/stack_reg_va.S new file mode 100644 index 000000000..5a0b632e8 --- /dev/null +++ b/newlib/libc/machine/spu/stack_reg_va.S @@ -0,0 +1,166 @@ +/* + Copyright (c) 2007, Toshiba Corporation + + 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 names of Toshiba 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. + */ +/* + * This file contains code use to construct a PIC, spu side, syscall + * function with variable parameters in accordance with the CBE ABI. + * + * This function is equivalent to constructing a va_list structure and + * calling the va_list form of the function. Therefore, for example, + * a printf function stack frame will look like this: + * + * | Stack | high memory + * | Parms | + * | | + * |------------| + * | Link Reg | + * |------------| + * | Back Chain |<-----. <---- input SP + * |------------| | + * | Reg 74 | | + * |------------| | + * | Reg 73 | | + * |------------| | + * // ... // | + * |------------| | + * | Reg 5 | | + * |------------| | + * | Reg 4 |<--. | + * |------------| | | + * va_list.| call_stack |------' + * |------------| | + * va_list.| next_arg |---' + * |------------| + * | format (r3)| <---- start of parameters + * |------------| |------------| + * | stack | | | + * | code | |(Back Chain)| <---- output SP + * | 1-3 qwords | <---- code_ptr `------------' + * `------------' + * low memory + * + * This was written in assembly so that it is smaller than what would + * be produced by using va_start. + */ + +#include "c99ppe.h" + +#define parms $2 /* Number of fixed arguments */ + +#define offset $67 +#define flag $68 +#define regdec $69 +#define link $70 + +#define code_ptr $71 +#define ptr $72 +#define inst $73 +#define tmp $74 + + .text + .global __stack_reg_va + +__stack_reg_va: + + /* Save registers 69-74 explicitly so that we have some + * working registers. + */ + stqd $74, 16*(-1)($sp) + stqd $73, 16*(-2)($sp) + stqd $72, 16*(-3)($sp) + stqd $71, 16*(-4)($sp) + stqd $70, 16*(-5)($sp) + stqd $69, 16*(-6)($sp) + + /* Construct self-modifying stack code that saves the remaining + * volatile registers onto the stack. + */ + il regdec, -1 /* for decrement register value in save instruction */ + shlqbyi regdec, regdec, 12 + il tmp, -(SPE_STACK_REGS+2+3)*16 + a code_ptr, $sp, tmp + lqr tmp, save_regs_1 /* store stack code */ + stqd tmp, 0(code_ptr) + lqr inst, save_regs_2 + ai ptr, $sp, 16*(-6) + sync + bisl link, code_ptr /* branch to the constructed stack code */ + + /* Adjust pointer so that it points to the first variable + * argument on the stack. + */ + ai offset, parms, -1 /* offset = parms - 1 */ + mpyi offset, offset, 16 /* offset = offset * 16 */ + a ptr, ptr, offset /* ptr = ptr + offset */ + + /* Store the va_list to the parameter list. + */ + stqd $sp, 16*(-1)(ptr) + stqd ptr, 16*(-2)(ptr) + + /* Make $3 store address. + */ + ai offset, parms, 2 /* offset = parms + 2 */ + mpyi offset, offset, -16 /* offset = offset * -16 */ + a ptr, ptr, offset /* ptr = ptr + offset */ + + /* Save all the fixed (non-variable arguments on the stack) + */ + ceqi flag, parms, 0x01 /* if(parms==1) flag=0xFFFFFFFF */ + brnz flag, reg_3 /* if(flag!=0) jump */ + ceqi flag, parms, 0x02 /* if(parms==2) flag=0xFFFFFFFF */ + brnz flag, reg_4 /* if(flag!=0) jump */ + stqd $5, 16*2(ptr) +reg_4: + stqd $4, 16*1(ptr) +reg_3: + stqd $3, 0(ptr) + + il $3, -16*(SPE_STACK_REGS+2+2) + stqx $sp, $3, $sp /* save back chain */ + a $sp, $sp, $3 + bi $0 /* return to caller */ + +/***************************** stack code *********************************************/ + + /* The following code is copied into the stack for re-entract, + * self-modified, code execution. This code copies the volatile + * registers into a va_list parameter array. + */ + .balignl 16, 0 +save_regs_1: + stqd inst, 16(code_ptr) /* store instruction */ + sync + a inst, inst, regdec /* decrement register number in the instruction */ + ceqbi tmp, inst, 3 /* if (reg-num == 3) tmp = 0x000000FF 000..0 */ +save_regs_2: + stqd $68, -16(ptr) + ai ptr, ptr, -16 + brz tmp, save_regs_1 /* if (tmp == 0) jump */ + bi link /* finish to make va_list */ diff --git a/newlib/libc/machine/spu/stdio.c b/newlib/libc/machine/spu/stdio.c index 13addad26..997ccb7a0 100644 --- a/newlib/libc/machine/spu/stdio.c +++ b/newlib/libc/machine/spu/stdio.c @@ -80,3 +80,9 @@ _DEFUN (__sinit, (s), s->_stderr = &s->__sf[2]; s->_stderr->_fp = SPE_STDERR; } + +_VOID +_DEFUN_VOID (__check_init) +{ + CHECK_INIT(_REENT); +} diff --git a/newlib/libc/machine/spu/syscall.def b/newlib/libc/machine/spu/syscall.def new file mode 100644 index 000000000..bcf2e471c --- /dev/null +++ b/newlib/libc/machine/spu/syscall.def @@ -0,0 +1,38 @@ +# +# (C) Copyright 2007 TOSHIBA CORPORATION +# 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 names of Toshiba 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. +# +# +# OPCODE NAME FP PARMS(Number of fixed arguments) +# +SPE_C99_VFPRINTF fprintf 1 2 +SPE_C99_VFSCANF fscanf 1 2 +SPE_C99_VPRINTF printf 0 1 +SPE_C99_VSCANF scanf 0 1 +SPE_C99_VSNPRINTF snprintf 0 3 +SPE_C99_VSPRINTF sprintf 0 2 +SPE_C99_VSSCANF sscanf 0 2 |