From a0050b64fc79c4bab523e7abf0739ab22a4d2a33 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 23 May 2007 21:39:54 +0000 Subject: [PATCH] 2007-05-23 Patrick Mansfield * spu/syscalls.c: Change __send_to_ppe to return the result stored in stored in slot 0 of the data, rather than have each assisted call retrieve the value. * spu/jsre.h: Remove the now unused syscall_out_t. * spu/access.c: Use the __send_to_ppe result instead of the slot 0 value, remove unused syscall_out_t variable. * 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. --- libgloss/ChangeLog | 20 ++++++++++++++++++++ libgloss/spu/access.c | 7 +------ libgloss/spu/close.c | 9 ++------- libgloss/spu/dup.c | 7 +------ libgloss/spu/fstat.c | 9 +++------ libgloss/spu/ftruncate.c | 7 +------ libgloss/spu/gettimeofday.c | 6 +----- libgloss/spu/jsre.h | 7 ------- libgloss/spu/lseek.c | 6 +----- libgloss/spu/open.c | 8 ++------ libgloss/spu/read.c | 7 +------ libgloss/spu/stat.c | 8 +++----- libgloss/spu/syscalls.c | 7 ++++++- libgloss/spu/unlink.c | 9 ++------- libgloss/spu/write.c | 7 +------ 15 files changed, 45 insertions(+), 79 deletions(-) diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index 58dcce372..1346e2623 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,3 +1,23 @@ +2007-05-23 Patrick Mansfield + + * spu/syscalls.c: Change __send_to_ppe to return the result stored + in stored in slot 0 of the data, rather than have each assisted + call retrieve the value. + * spu/jsre.h: Remove the now unused syscall_out_t. + * spu/access.c: Use the __send_to_ppe result instead of the slot 0 + value, remove unused syscall_out_t variable. + * 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. + 2007-05-23 Kazu Hirata * m68k/fido.sc (.data): Move .jcr to .text. Catch .got.plt diff --git a/libgloss/spu/access.c b/libgloss/spu/access.c index 0b639a981..8b023166b 100644 --- a/libgloss/spu/access.c +++ b/libgloss/spu/access.c @@ -35,13 +35,8 @@ int access (const char *pathname, int mode) { syscall_access_t sys; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; sys.pathname = (unsigned int) pathname; sys.mode = mode; - - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_ACCESS, &sys); - - return ( psys_out->rc); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_ACCESS, &sys); } - diff --git a/libgloss/spu/close.c b/libgloss/spu/close.c index 77e3ce177..ea47d0268 100644 --- a/libgloss/spu/close.c +++ b/libgloss/spu/close.c @@ -35,13 +35,8 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) int close (int file) { - syscall_close_t sys ; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; + syscall_close_t sys; sys.file = file; - - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_CLOSE, &sys); - - return ( psys_out->rc); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_CLOSE, &sys); } - diff --git a/libgloss/spu/dup.c b/libgloss/spu/dup.c index 3240a0da5..2ff787055 100644 --- a/libgloss/spu/dup.c +++ b/libgloss/spu/dup.c @@ -35,12 +35,7 @@ int dup (int oldfd) { syscall_dup_t sys; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; sys.oldfd = oldfd; - - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_DUP, &sys); - - return ( psys_out->rc); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_DUP, &sys); } - diff --git a/libgloss/spu/fstat.c b/libgloss/spu/fstat.c index cef243161..69316d481 100644 --- a/libgloss/spu/fstat.c +++ b/libgloss/spu/fstat.c @@ -37,13 +37,12 @@ int fstat (int file, struct stat *pstat) { syscall_fstat_t sys; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; jsre_stat_t pjstat; + int ret; sys.file = file; sys.ptr = ( unsigned int )&pjstat; - - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_FSTAT, &sys); + ret = __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_FSTAT, &sys); pstat->st_dev = pjstat.dev; pstat->st_ino = pjstat.ino; @@ -59,7 +58,5 @@ fstat (int file, struct stat *pstat) pstat->st_mtime = pjstat.mtime; pstat->st_ctime = pjstat.ctime; - - return( psys_out->rc ); + return ret; } - diff --git a/libgloss/spu/ftruncate.c b/libgloss/spu/ftruncate.c index 487c70dac..47a998f09 100644 --- a/libgloss/spu/ftruncate.c +++ b/libgloss/spu/ftruncate.c @@ -35,13 +35,8 @@ int ftruncate (int file, off_t length) { syscall_ftruncate_t sys; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; sys.file = file; sys.length = length; - - __send_to_ppe(JSRE_POSIX1_SIGNALCODE, JSRE_FTRUNCATE, &sys); - - return ( psys_out->rc); + return __send_to_ppe(JSRE_POSIX1_SIGNALCODE, JSRE_FTRUNCATE, &sys); } - diff --git a/libgloss/spu/gettimeofday.c b/libgloss/spu/gettimeofday.c index 91b73535a..93051f695 100644 --- a/libgloss/spu/gettimeofday.c +++ b/libgloss/spu/gettimeofday.c @@ -38,12 +38,8 @@ int gettimeofday (struct timeval *tv, struct timezone *tz) { syscall_gettimeofday_t sys; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; sys.tv = (unsigned int)tv; sys.tz = (unsigned int)tz; - - __send_to_ppe(JSRE_POSIX1_SIGNALCODE, JSRE_GETTIMEOFDAY, &sys); - - return (psys_out->rc); + return __send_to_ppe(JSRE_POSIX1_SIGNALCODE, JSRE_GETTIMEOFDAY, &sys); } diff --git a/libgloss/spu/jsre.h b/libgloss/spu/jsre.h index 46f8ee539..f69cd490e 100644 --- a/libgloss/spu/jsre.h +++ b/libgloss/spu/jsre.h @@ -165,13 +165,6 @@ typedef struct unsigned int pad1[ 3 ]; } syscall_stat_t; -typedef struct -{ - unsigned int rc; - unsigned int pad0[ 2 ]; - unsigned int err; -} syscall_out_t; - typedef struct { unsigned int dev; unsigned int ino; diff --git a/libgloss/spu/lseek.c b/libgloss/spu/lseek.c index e4e1754fa..9ba372ccf 100644 --- a/libgloss/spu/lseek.c +++ b/libgloss/spu/lseek.c @@ -37,7 +37,6 @@ off_t lseek (int file, off_t offset, int whence) { syscall_lseek_t sys; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; sys.file = file; sys.offset = offset; @@ -54,8 +53,5 @@ lseek (int file, off_t offset, int whence) break; } - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_LSEEK, &sys); - - return ( psys_out->rc); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_LSEEK, &sys); } - diff --git a/libgloss/spu/open.c b/libgloss/spu/open.c index c6882bd86..46afcab2d 100644 --- a/libgloss/spu/open.c +++ b/libgloss/spu/open.c @@ -37,8 +37,7 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) int open (const char *filename, int flags, ...) { - syscall_open_t sys ; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; + syscall_open_t sys; va_list ap; sys.pathname = ( unsigned int )filename; @@ -70,8 +69,5 @@ open (const char *filename, int flags, ...) sys.mode = va_arg (ap, int); va_end (ap); - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_OPEN, &sys); - - return ( psys_out->rc); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_OPEN, &sys); } - diff --git a/libgloss/spu/read.c b/libgloss/spu/read.c index 95c25b36f..1a75ae0a2 100644 --- a/libgloss/spu/read.c +++ b/libgloss/spu/read.c @@ -37,14 +37,9 @@ int read (int file, void *ptr, size_t len) { syscall_write_t sys; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; sys.file = file; sys.ptr = ( unsigned int )ptr; sys.len = len; - - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_READ, &sys); - - return ( psys_out->rc); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_READ, &sys); } - diff --git a/libgloss/spu/stat.c b/libgloss/spu/stat.c index ec7ab6d3a..ad925c624 100644 --- a/libgloss/spu/stat.c +++ b/libgloss/spu/stat.c @@ -38,13 +38,12 @@ int stat (const char *pathname, struct stat *pstat) { syscall_stat_t sys; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; jsre_stat_t pjstat; + int ret; sys.pathname = (unsigned int)pathname; sys.ptr = ( unsigned int )&pjstat; - - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_STAT, &sys); + ret = __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_STAT, &sys); pstat->st_dev = pjstat.dev; pstat->st_ino = pjstat.ino; @@ -60,6 +59,5 @@ stat (const char *pathname, struct stat *pstat) pstat->st_mtime = pjstat.mtime; pstat->st_ctime = pjstat.ctime; - return( psys_out->rc ); + return ret; } - diff --git a/libgloss/spu/syscalls.c b/libgloss/spu/syscalls.c index e4509c097..f2f292853 100644 --- a/libgloss/spu/syscalls.c +++ b/libgloss/spu/syscalls.c @@ -32,7 +32,7 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) #include #include "jsre.h" -void +int __send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data) { @@ -49,5 +49,10 @@ __send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data) asm ("sync"); f (); errno = ((unsigned int *) data)[3]; + + /* + * Return the rc code stored in slot 0. + */ + return ((unsigned int *) data)[0]; } diff --git a/libgloss/spu/unlink.c b/libgloss/spu/unlink.c index 47b02a6a4..4a7edefb7 100644 --- a/libgloss/spu/unlink.c +++ b/libgloss/spu/unlink.c @@ -35,13 +35,8 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) int unlink (const char *pathname) { - syscall_unlink_t sys ; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; + syscall_unlink_t sys; sys.pathname = ( unsigned int )pathname; - - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_UNLINK, &sys); - - return ( psys_out->rc); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_UNLINK, &sys); } - diff --git a/libgloss/spu/write.c b/libgloss/spu/write.c index eec559e97..c9663429c 100644 --- a/libgloss/spu/write.c +++ b/libgloss/spu/write.c @@ -37,14 +37,9 @@ int write (int file, const void *ptr, size_t len) { syscall_write_t sys; - syscall_out_t *psys_out = ( syscall_out_t* )&sys; sys.file = file; sys.ptr = ( unsigned int )ptr; sys.len = len; - - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_WRITE, &sys); - - return ( psys_out->rc); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_WRITE, &sys); } -