This patch:
Renames _send_to_ppe to __send_to_ppe in libgloss, and moves errno
processing from individual stubs into __send_to_ppe (like we currently
have in c99ppe.h).
Renames send_to_ppe to __send_to_ppe in libc code, removes the static
send_to_ppe in c99ppe.h, and so uses the __send_to_ppe in libgloss,
This way, we can link with an alternate __send_to_ppe (not to be supplied
by newlib) that supports argument passing that will work when the SPU is
running in isolated mode.
The change also decreases the object size: errno setting is consolidated;
and if calling different offloaded functions in one program, send_to_ppe
is no longer duplicated in each function. Non-inlined code is probably a
bit slower, but this is not an issue for offloaded calls, the difference
probably can't be measured, and so we are better off with smaller object
size.
Is there a better place for the __send_to_ppe prototype, rather than a
single line in libc/machine/spu/sys/send_to_ppe.h?
Original patch by Vlad Zbarsky <vzbarsky@us.ibm.com>, I have updated it
for current cvs. This has been through a good amount of testing (with
newlib 1.15.0).
libgloss/Changelog:
2007-03-15 Patrick Mansfield <patmans@us.ibm.com>
* spu/syscalls.c: Rename _send_to_ppe __send_to_ppe, and set errno
on return from the offload call.
* spu/jsre.h: Include sys/send_to_ppe.h instead of a prototype
for send_to_ppe.
* spu/access.c: Call __send_to_ppe instead of _send_to_ppe, and
remove the setting of errno.
* spu/close.c: Ditto.
* spu/dup.c: Ditto.
* spu/fstat.c: Ditto.
* spu/ftruncate.c: Ditto.
* spu/gettimeofday.c: Ditto.
* spu/lseek.c: Ditto.
* spu/open.c: Ditto.
* spu/read.c: Ditto.
* spu/stat.c: Ditto.
* spu/unlink.c: Ditto.
* spu/write.c: Ditto.
newlib/ChangeLog:
2007-03-15 Patrick Mansfield <patmans@us.ibm.com>
* libc/machine/spu/sys/send_to_ppe.h: New file for __send_to_ppe
prototype.
* libc/machine/spu/c99ppe.h: Remove static version of send_to_ppe.
* libc/machine/spu/clearerr.c: Call __send_to_ppe vs send_to_ppe.
* libc/machine/spu/fclose.c: Ditto.
* libc/machine/spu/feof.c: Ditto.
* libc/machine/spu/ferror.c: Ditto.
* libc/machine/spu/fflush.c: Ditto.
* libc/machine/spu/fgetc.c: Ditto.
* libc/machine/spu/fgetpos.c: Ditto.
* libc/machine/spu/fgets.c: Ditto.
* libc/machine/spu/fileno.c: Ditto.
* libc/machine/spu/fopen.c: Ditto.
* libc/machine/spu/fprintf.c: Ditto.
* libc/machine/spu/fputc.c: Ditto.
* libc/machine/spu/fputs.c: Ditto.
* libc/machine/spu/fread.c: Ditto.
* libc/machine/spu/freopen.c: Ditto.
* libc/machine/spu/fscanf.c: Ditto.
* libc/machine/spu/fseek.c: Ditto.
* libc/machine/spu/fsetpos.c: Ditto.
* libc/machine/spu/ftell.c: Ditto.
* libc/machine/spu/fwrite.c: Ditto.
* libc/machine/spu/getc.c: Ditto.
* libc/machine/spu/getchar.c: Ditto.
* libc/machine/spu/gets.c: Ditto.
* libc/machine/spu/perror.c: Ditto.
* libc/machine/spu/printf.c: Ditto.
* libc/machine/spu/putc.c: Ditto.
* libc/machine/spu/putchar.c: Ditto.
* libc/machine/spu/puts.c: Ditto.
* libc/machine/spu/remove.c: Ditto.
* libc/machine/spu/rename.c: Ditto.
* libc/machine/spu/rewind.c: Ditto.
* libc/machine/spu/scanf.c: Ditto.
* libc/machine/spu/setbuf.c: Ditto.
* libc/machine/spu/setvbuf.c: Ditto.
* libc/machine/spu/snprintf.c: Ditto.
* libc/machine/spu/sprintf.c: Ditto.
* libc/machine/spu/sscanf.c: Ditto.
* libc/machine/spu/tmpfile.c: Ditto.
* libc/machine/spu/tmpnam.c: Ditto.
* libc/machine/spu/ungetc.c: Ditto.
* libc/machine/spu/vfprintf.c: Ditto.
* libc/machine/spu/vfscanf.c: Ditto.
* libc/machine/spu/vprintf.c: Ditto.
* libc/machine/spu/vscanf.c: Ditto.
* libc/machine/spu/vsnprintf.c: Ditto.
* libc/machine/spu/vsprintf.c: Ditto.
* libc/machine/spu/vsscanf.c: Ditto.
Index: my-base-quilt/libgloss/spu/access.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/access.c
+++ my-base-quilt/libgloss/spu/access.c
@@ -29,7 +29,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/
-#include <errno.h>
#include "jsre.h"
int
@@ -41,9 +40,8 @@ access (const char *pathname, int mode)
sys.pathname = (unsigned int) pathname;
sys.mode = mode;
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_ACCESS, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_ACCESS, &sys);
- errno = psys_out->err;
return ( psys_out->rc);
}
Index: my-base-quilt/libgloss/spu/close.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/close.c
+++ my-base-quilt/libgloss/spu/close.c
@@ -30,7 +30,6 @@ POSSIBILITY OF SUCH DAMAGE.
Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
*/
-#include <errno.h>
#include "jsre.h"
int
@@ -41,9 +40,8 @@ close (int file)
sys.file = file;
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_CLOSE, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_CLOSE, &sys);
- errno = psys_out->err;
return ( psys_out->rc);
}
Index: my-base-quilt/libgloss/spu/dup.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/dup.c
+++ my-base-quilt/libgloss/spu/dup.c
@@ -29,7 +29,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/
-#include <errno.h>
#include "jsre.h"
int
@@ -40,9 +39,8 @@ dup (int oldfd)
sys.oldfd = oldfd;
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_DUP, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_DUP, &sys);
- errno = psys_out->err;
return ( psys_out->rc);
}
Index: my-base-quilt/libgloss/spu/fstat.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/fstat.c
+++ my-base-quilt/libgloss/spu/fstat.c
@@ -31,7 +31,6 @@ Author: Andreas Neukoetter (ti95neuk@de.
*/
#include <sys/stat.h>
-#include <errno.h>
#include "jsre.h"
int
@@ -44,7 +43,7 @@ fstat (int file, struct stat *pstat)
sys.file = file;
sys.ptr = ( unsigned int )&pjstat;
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_FSTAT, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_FSTAT, &sys);
pstat->st_dev = pjstat.dev;
pstat->st_ino = pjstat.ino;
@@ -61,7 +60,6 @@ fstat (int file, struct stat *pstat)
pstat->st_ctime = pjstat.ctime;
- errno = psys_out->err;
return( psys_out->rc );
}
Index: my-base-quilt/libgloss/spu/ftruncate.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/ftruncate.c
+++ my-base-quilt/libgloss/spu/ftruncate.c
@@ -29,7 +29,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include <unistd.h>
-#include <errno.h>
#include "jsre.h"
int
@@ -41,9 +40,8 @@ ftruncate (int file, off_t length)
sys.file = file;
sys.length = length;
- _send_to_ppe(JSRE_POSIX1_SIGNALCODE, JSRE_FTRUNCATE, &sys);
+ __send_to_ppe(JSRE_POSIX1_SIGNALCODE, JSRE_FTRUNCATE, &sys);
- errno = psys_out->err;
return ( psys_out->rc);
}
Index: my-base-quilt/libgloss/spu/jsre.h
===================================================================
--- my-base-quilt.orig/libgloss/spu/jsre.h
+++ my-base-quilt/libgloss/spu/jsre.h
@@ -188,6 +188,6 @@ typedef struct {
unsigned int ctime;
} jsre_stat_t;
-void _send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data);
+#include <sys/send_to_ppe.h>
#endif
Index: my-base-quilt/libgloss/spu/lseek.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/lseek.c
+++ my-base-quilt/libgloss/spu/lseek.c
@@ -31,7 +31,6 @@ Author: Andreas Neukoetter (ti95neuk@de.
*/
#include <unistd.h>
-#include <errno.h>
#include "jsre.h"
off_t
@@ -55,9 +54,8 @@ lseek (int file, off_t offset, int whenc
break;
}
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_LSEEK, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_LSEEK, &sys);
- errno = psys_out->err;
return ( psys_out->rc);
}
Index: my-base-quilt/libgloss/spu/open.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/open.c
+++ my-base-quilt/libgloss/spu/open.c
@@ -32,7 +32,6 @@ Author: Andreas Neukoetter (ti95neuk@de.
#include <stdarg.h>
#include <fcntl.h>
-#include <errno.h>
#include "jsre.h"
int
@@ -81,9 +80,8 @@ open (const char *filename, int flags, .
sys.mode = 0;
}
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_OPEN, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_OPEN, &sys);
- errno = psys_out->err;
return ( psys_out->rc);
}
Index: my-base-quilt/libgloss/spu/read.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/read.c
+++ my-base-quilt/libgloss/spu/read.c
@@ -31,7 +31,6 @@ Author: Andreas Neukoetter (ti95neuk@de.
*/
#include <fcntl.h>
-#include <errno.h>
#include "jsre.h"
int
@@ -44,9 +43,8 @@ read (int file, void *ptr, size_t len)
sys.ptr = ( unsigned int )ptr;
sys.len = len;
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_READ, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_READ, &sys);
- errno = psys_out->err;
return ( psys_out->rc);
}
Index: my-base-quilt/libgloss/spu/stat.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/stat.c
+++ my-base-quilt/libgloss/spu/stat.c
@@ -32,7 +32,6 @@ Author: Andreas Neukoetter (ti95neuk@de.
#include <stdarg.h>
#include <fcntl.h>
-#include <errno.h>
#include "jsre.h"
int
@@ -45,7 +44,7 @@ stat (const char *pathname, struct stat
sys.pathname = (unsigned int)pathname;
sys.ptr = ( unsigned int )&pjstat;
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_STAT, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_STAT, &sys);
pstat->st_dev = pjstat.dev;
pstat->st_ino = pjstat.ino;
@@ -61,7 +60,6 @@ stat (const char *pathname, struct stat
pstat->st_mtime = pjstat.mtime;
pstat->st_ctime = pjstat.ctime;
- errno = psys_out->err;
return( psys_out->rc );
}
Index: my-base-quilt/libgloss/spu/syscalls.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/syscalls.c
+++ my-base-quilt/libgloss/spu/syscalls.c
@@ -29,10 +29,11 @@ POSSIBILITY OF SUCH DAMAGE.
Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
*/
+#include <errno.h>
#include "jsre.h"
void
-_send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data)
+__send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data)
{
unsigned int combined = ( ( opcode<<24 )&0xff000000 ) | ( ( unsigned int )data & 0x00ffffff );
@@ -46,6 +47,7 @@ _send_to_ppe (unsigned int signalcode, u
void (*f) (void) = (void *) &stopfunc;
asm ("sync");
- return (f ());
+ f ();
+ errno = ((unsigned int *) data)[3];
}
Index: my-base-quilt/libgloss/spu/unlink.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/unlink.c
+++ my-base-quilt/libgloss/spu/unlink.c
@@ -30,7 +30,6 @@ POSSIBILITY OF SUCH DAMAGE.
Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
*/
-#include <errno.h>
#include "jsre.h"
int
@@ -41,9 +40,8 @@ unlink (const char *pathname)
sys.pathname = ( unsigned int )pathname;
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_UNLINK, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_UNLINK, &sys);
- errno = psys_out->err;
return ( psys_out->rc);
}
Index: my-base-quilt/libgloss/spu/write.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/write.c
+++ my-base-quilt/libgloss/spu/write.c
@@ -31,7 +31,6 @@ Author: Andreas Neukoetter (ti95neuk@de.
*/
#include <fcntl.h>
-#include <errno.h>
#include "jsre.h"
int
@@ -44,9 +43,8 @@ write (int file, const void *ptr, size_t
sys.ptr = ( unsigned int )ptr;
sys.len = len;
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_WRITE, &sys);
+ __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_WRITE, &sys);
- errno = psys_out->err;
return ( psys_out->rc);
}
Index: my-base-quilt/newlib/libc/machine/spu/fgets.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fgets.c
+++ my-base-quilt/newlib/libc/machine/spu/fgets.c
@@ -61,7 +61,7 @@ _DEFUN (fgets, (buf, n, fp),
args.fp = fp->_fp;
ret = (char**) &args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETS, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETS, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/fprintf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fprintf.c
+++ my-base-quilt/newlib/libc/machine/spu/fprintf.c
@@ -75,7 +75,7 @@ fprintf(FILE * fp, _CONST char *fmt,...)
va_start (args.ap);
#endif
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args);
va_end (args.ap);
return *ret;
Index: my-base-quilt/newlib/libc/machine/spu/fputc.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fputc.c
+++ my-base-quilt/newlib/libc/machine/spu/fputc.c
@@ -59,7 +59,7 @@ fputc (c, fp)
args.fp = fp->_fp;
ret = (int*)&args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTC, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTC, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/fputs.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fputs.c
+++ my-base-quilt/newlib/libc/machine/spu/fputs.c
@@ -59,7 +59,7 @@ _DEFUN (fputs, (s, fp),
args.fp = fp->_fp;
ret = (int*)&args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTS, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTS, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/fread.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fread.c
+++ my-base-quilt/newlib/libc/machine/spu/fread.c
@@ -66,7 +66,7 @@ _DEFUN (fread, (buf, size, count, fp),
args.fp = fp->_fp;
ret = (size_t*) &args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREAD, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREAD, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/freopen.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/freopen.c
+++ my-base-quilt/newlib/libc/machine/spu/freopen.c
@@ -62,7 +62,7 @@ _DEFUN (freopen, (file, mode, fp),
args.fp = fp->_fp;
ret = (int *) &args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREOPEN, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREOPEN, &args);
if (*ret) {
fp->_fp = *ret;
Index: my-base-quilt/newlib/libc/machine/spu/fscanf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fscanf.c
+++ my-base-quilt/newlib/libc/machine/spu/fscanf.c
@@ -74,7 +74,7 @@ fscanf(FILE *fp, _CONST char *fmt, ...)
#endif
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args);
va_end (args.ap);
return *ret;
Index: my-base-quilt/newlib/libc/machine/spu/fseek.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fseek.c
+++ my-base-quilt/newlib/libc/machine/spu/fseek.c
@@ -62,7 +62,7 @@ _DEFUN (fseek, (fp, offset, whence),
args.whence = whence;
ret = (int*)&args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSEEK, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSEEK, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/fsetpos.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fsetpos.c
+++ my-base-quilt/newlib/libc/machine/spu/fsetpos.c
@@ -58,7 +58,7 @@ _DEFUN (fsetpos, (iop, pos),
args.pos = pos;
ret = (int*)&args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSETPOS, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSETPOS, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/fwrite.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fwrite.c
+++ my-base-quilt/newlib/libc/machine/spu/fwrite.c
@@ -66,7 +66,7 @@ _DEFUN (fwrite, (buf, size, count, fp),
args.fp = fp->_fp;
ret = (size_t*) &args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FWRITE, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FWRITE, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/getchar.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/getchar.c
+++ my-base-quilt/newlib/libc/machine/spu/getchar.c
@@ -45,7 +45,7 @@ getchar ()
CHECK_STD_INIT(_REENT);
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETCHAR, &ret);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETCHAR, &ret);
return ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/gets.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/gets.c
+++ my-base-quilt/newlib/libc/machine/spu/gets.c
@@ -44,7 +44,7 @@ gets (buf)
/* The return value gets written over buf
*/
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETS, &buf);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETS, &buf);
return buf;
}
Index: my-base-quilt/newlib/libc/machine/spu/putc.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/putc.c
+++ my-base-quilt/newlib/libc/machine/spu/putc.c
@@ -59,7 +59,7 @@ putc (c, fp)
args.fp = fp->_fp;
ret = (int*)&args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTC, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTC, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/putchar.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/putchar.c
+++ my-base-quilt/newlib/libc/machine/spu/putchar.c
@@ -14,7 +14,7 @@ putchar (c)
/* c gets overwritten before return */
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTCHAR, &c);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTCHAR, &c);
return c;
}
Index: my-base-quilt/newlib/libc/machine/spu/puts.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/puts.c
+++ my-base-quilt/newlib/libc/machine/spu/puts.c
@@ -12,7 +12,7 @@ _DEFUN (puts, (s),
/* The return value gets written over s
*/
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTS, &s);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTS, &s);
return (int)s;
}
Index: my-base-quilt/newlib/libc/machine/spu/remove.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/remove.c
+++ my-base-quilt/newlib/libc/machine/spu/remove.c
@@ -41,7 +41,7 @@ remove (filename)
/* The return value gets written over buf
*/
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_REMOVE, &filename);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_REMOVE, &filename);
return (int)filename;
}
Index: my-base-quilt/newlib/libc/machine/spu/rename.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/rename.c
+++ my-base-quilt/newlib/libc/machine/spu/rename.c
@@ -54,7 +54,7 @@ rename (old, new)
args.new = new;
ret = (int*) &args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_RENAME, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_RENAME, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/scanf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/scanf.c
+++ my-base-quilt/newlib/libc/machine/spu/scanf.c
@@ -71,7 +71,7 @@ scanf(_CONST char *fmt, ...)
#endif
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args);
va_end (args.ap);
return *ret;
Index: my-base-quilt/newlib/libc/machine/spu/setbuf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/setbuf.c
+++ my-base-quilt/newlib/libc/machine/spu/setbuf.c
@@ -57,7 +57,7 @@ _DEFUN (setbuf, (fp, buf),
args.fp = fp->_fp;
args.buf = buf;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_SETBUF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_SETBUF, &args);
return;
}
Index: my-base-quilt/newlib/libc/machine/spu/setvbuf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/setvbuf.c
+++ my-base-quilt/newlib/libc/machine/spu/setvbuf.c
@@ -67,7 +67,7 @@ _DEFUN (setvbuf, (fp, buf, mode, size),
args.size = size;
ret = (int*)&args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_SETVBUF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_SETVBUF, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/snprintf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/snprintf.c
+++ my-base-quilt/newlib/libc/machine/spu/snprintf.c
@@ -79,7 +79,7 @@ _DEFUN(snprintf, (str, size, fmt),
va_start (args.ap);
#endif
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args);
va_end (args.ap);
return *ret;
Index: my-base-quilt/newlib/libc/machine/spu/sprintf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/sprintf.c
+++ my-base-quilt/newlib/libc/machine/spu/sprintf.c
@@ -75,7 +75,7 @@ _DEFUN(sprintf, (str, fmt),
va_start (args.ap);
#endif
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSPRINTF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSPRINTF, &args);
va_end (args.ap);
return *ret;
Index: my-base-quilt/newlib/libc/machine/spu/sscanf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/sscanf.c
+++ my-base-quilt/newlib/libc/machine/spu/sscanf.c
@@ -76,7 +76,7 @@ _DEFUN(sscanf, (str, fmt),
va_start (args.ap);
#endif
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSSCANF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSSCANF, &args);
va_end (args.ap);
return *ret;
Index: my-base-quilt/newlib/libc/machine/spu/sys/send_to_ppe.h
===================================================================
--- /dev/null
+++ my-base-quilt/newlib/libc/machine/spu/sys/send_to_ppe.h
@@ -0,0 +1,6 @@
+#ifndef __SEND_TO_PPE_H_
+#define __SEND_TO_PPE_H_
+
+void __send_to_ppe(unsigned int signalcode, unsigned int opcode, void *data);
+
+#endif /* __SEND_TO_PPE_H_ */
Index: my-base-quilt/newlib/libc/machine/spu/tmpfile.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/tmpfile.c
+++ my-base-quilt/newlib/libc/machine/spu/tmpfile.c
@@ -50,7 +50,7 @@ _DEFUN_VOID (tmpfile)
return NULL;
}
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPFILE, &ret);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPFILE, &ret);
if (ret) {
fp->_fp = ret;
Index: my-base-quilt/newlib/libc/machine/spu/tmpnam.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/tmpnam.c
+++ my-base-quilt/newlib/libc/machine/spu/tmpnam.c
@@ -41,7 +41,7 @@ _DEFUN (tmpnam, (s),
char **ret = &s;
/* The return value gets written over buf
*/
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPNAM, &s);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPNAM, &s);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/ungetc.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/ungetc.c
+++ my-base-quilt/newlib/libc/machine/spu/ungetc.c
@@ -59,7 +59,7 @@ ungetc (c, fp)
args.fp = fp->_fp;
ret = (int*)&args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_UNGETC, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_UNGETC, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/vfprintf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/vfprintf.c
+++ my-base-quilt/newlib/libc/machine/spu/vfprintf.c
@@ -73,7 +73,7 @@ _DEFUN (vfprintf, (fp, fmt0, ap),
args.fmt = (char*) fmt0;
va_copy(args.ap,ap);
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/vfscanf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/vfscanf.c
+++ my-base-quilt/newlib/libc/machine/spu/vfscanf.c
@@ -73,7 +73,7 @@ _DEFUN (vfscanf, (fp, fmt, ap),
args.fmt = (char*) fmt;
va_copy(args.ap,ap);
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/vprintf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/vprintf.c
+++ my-base-quilt/newlib/libc/machine/spu/vprintf.c
@@ -37,7 +37,7 @@ _DEFUN (vprintf, (fmt, ap),
args.fmt = fmt;
va_copy(args.ap,ap);
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/vscanf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/vscanf.c
+++ my-base-quilt/newlib/libc/machine/spu/vscanf.c
@@ -69,7 +69,7 @@ _DEFUN (vscanf, (fmt, ap),
args.fmt = (char*) fmt;
va_copy(args.ap,ap);
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/vsnprintf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/vsnprintf.c
+++ my-base-quilt/newlib/libc/machine/spu/vsnprintf.c
@@ -45,7 +45,7 @@ _DEFUN (vsnprintf, (str, size, fmt, ap),
args.fmt = fmt;
va_copy(args.ap,ap);
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/vsprintf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/vsprintf.c
+++ my-base-quilt/newlib/libc/machine/spu/vsprintf.c
@@ -42,7 +42,7 @@ _DEFUN (vsprintf, (str, fmt, ap),
args.fmt = (char*) fmt;
va_copy(args.ap,ap);
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSPRINTF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSPRINTF, &args);
return *ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/vsscanf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/vsscanf.c
+++ my-base-quilt/newlib/libc/machine/spu/vsscanf.c
@@ -73,7 +73,7 @@ _DEFUN (vsscanf, (str, fmt, ap),
args.fmt = (char*) fmt;
va_copy(args.ap,ap);
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSSCANF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSSCANF, &args);
return *ret;
}
Index: my-base-quilt/libgloss/spu/gettimeofday.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/gettimeofday.c
+++ my-base-quilt/libgloss/spu/gettimeofday.c
@@ -43,8 +43,7 @@ gettimeofday (struct timeval *tv, struct
sys.tv = (unsigned int)tv;
sys.tz = (unsigned int)tz;
- _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_GETTIMEOFDAY, &sys);
+ __send_to_ppe(JSRE_POSIX1_SIGNALCODE, JSRE_GETTIMEOFDAY, &sys);
- errno = psys_out->err;
return (psys_out->rc);
}
Index: my-base-quilt/newlib/libc/machine/spu/c99ppe.h
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/c99ppe.h
+++ my-base-quilt/newlib/libc/machine/spu/c99ppe.h
@@ -31,6 +31,7 @@ Author: Joel Schopp <jschopp@austin.ibm.
*/
#include <errno.h>
+#include <sys/send_to_ppe.h>
#define SPE_C99_SIGNALCODE 0x2100
@@ -93,27 +94,6 @@ struct spe_reg128{
unsigned int slot[4];
};
-static void
-send_to_ppe(int signalcode, int opcode, void *data)
-{
-
- unsigned int combined = ( ( opcode<<24 )&0xff000000 ) | ( ( unsigned int )data & 0x00ffffff );
- struct spe_reg128* ret = data;
-
- __vector unsigned int stopfunc = {
- signalcode, /* stop 0x210x*/
- (unsigned int) combined,
- 0x4020007f, /* nop */
- 0x35000000 /* bi $0 */
- };
-
- void (*f) (void) = (void *) &stopfunc;
- asm ("sync":::"memory");
- f();
- errno = ret->slot[3];
- return;
-}
-
void _EXFUN(__sinit,(struct _reent *));
FILE *_EXFUN(__sfp,(struct _reent *));
#define __sfp_free(fp) ( (fp)->_fp = 0 )
Index: my-base-quilt/newlib/libc/machine/spu/clearerr.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/clearerr.c
+++ my-base-quilt/newlib/libc/machine/spu/clearerr.c
@@ -47,7 +47,7 @@ _DEFUN (clearerr, (fp),
ret = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_CLEARERR, &ret);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_CLEARERR, &ret);
return;
}
Index: my-base-quilt/newlib/libc/machine/spu/fclose.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fclose.c
+++ my-base-quilt/newlib/libc/machine/spu/fclose.c
@@ -46,7 +46,7 @@ _DEFUN (fclose, (fp),
ret = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FCLOSE, &ret);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FCLOSE, &ret);
__sfp_free(fp);
Index: my-base-quilt/newlib/libc/machine/spu/feof.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/feof.c
+++ my-base-quilt/newlib/libc/machine/spu/feof.c
@@ -46,7 +46,7 @@ _DEFUN (feof, (fp),
result = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FEOF, &result);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FEOF, &result);
return result;
Index: my-base-quilt/newlib/libc/machine/spu/ferror.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/ferror.c
+++ my-base-quilt/newlib/libc/machine/spu/ferror.c
@@ -46,7 +46,7 @@ _DEFUN (ferror, (fp),
result = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FERROR, &result);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FERROR, &result);
return result;
Index: my-base-quilt/newlib/libc/machine/spu/fflush.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fflush.c
+++ my-base-quilt/newlib/libc/machine/spu/fflush.c
@@ -45,7 +45,7 @@ _DEFUN (fflush, (fp),
result = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FFLUSH, &result);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FFLUSH, &result);
return result;
Index: my-base-quilt/newlib/libc/machine/spu/fgetc.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fgetc.c
+++ my-base-quilt/newlib/libc/machine/spu/fgetc.c
@@ -46,7 +46,7 @@ _DEFUN (fgetc, (fp),
result = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETC, &result);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETC, &result);
return result;
}
Index: my-base-quilt/newlib/libc/machine/spu/fgetpos.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fgetpos.c
+++ my-base-quilt/newlib/libc/machine/spu/fgetpos.c
@@ -58,7 +58,7 @@ _DEFUN (fgetpos, (fp, pos),
arg.fp = fp->_fp;
arg.pos = pos;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETPOS, &arg);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETPOS, &arg);
return *result;
Index: my-base-quilt/newlib/libc/machine/spu/fileno.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fileno.c
+++ my-base-quilt/newlib/libc/machine/spu/fileno.c
@@ -47,7 +47,7 @@ _DEFUN (fileno, (fp),
ret = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FILENO, &ret);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FILENO, &ret);
return ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/fopen.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/fopen.c
+++ my-base-quilt/newlib/libc/machine/spu/fopen.c
@@ -65,7 +65,7 @@ _DEFUN (fopen, (file, mode),
args.mode = mode;
ret = (int *) &args;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FOPEN, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FOPEN, &args);
if (*ret) {
fp->_fp = *ret;
Index: my-base-quilt/newlib/libc/machine/spu/ftell.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/ftell.c
+++ my-base-quilt/newlib/libc/machine/spu/ftell.c
@@ -47,7 +47,7 @@ _DEFUN (ftell, (fp),
ret = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FTELL, &ret);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FTELL, &ret);
return ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/getc.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/getc.c
+++ my-base-quilt/newlib/libc/machine/spu/getc.c
@@ -49,7 +49,7 @@ getc (fp)
ret = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETC, &ret);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETC, &ret);
return ret;
}
Index: my-base-quilt/newlib/libc/machine/spu/perror.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/perror.c
+++ my-base-quilt/newlib/libc/machine/spu/perror.c
@@ -11,7 +11,7 @@ _DEFUN (perror, (s),
{
CHECK_STD_INIT(_REENT);
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PERROR, &s);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PERROR, &s);
return;
}
Index: my-base-quilt/newlib/libc/machine/spu/printf.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/printf.c
+++ my-base-quilt/newlib/libc/machine/spu/printf.c
@@ -49,7 +49,7 @@ printf (fmt, va_alist)
va_start (args.ap);
#endif
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args);
va_end (args.ap);
return *ret;
Index: my-base-quilt/newlib/libc/machine/spu/rewind.c
===================================================================
--- my-base-quilt.orig/newlib/libc/machine/spu/rewind.c
+++ my-base-quilt/newlib/libc/machine/spu/rewind.c
@@ -46,7 +46,7 @@ _DEFUN (rewind, (fp),
ret = fp->_fp;
- send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_REWIND, &ret);
+ __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_REWIND, &ret);
return;
}