diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index 9f192b396..3585869eb 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,3 +1,24 @@ +2007-06-05 Patrick Mansfield + + * spu/jsre.h: Remove the assist call structs and defines that are + specific to one assist call from here. + * spu/access.c: Move struct syscall_access_t to here. + * spu/fstat.c: Move struct syscall_fstat_t to here. + * spu/ftruncate.c: Move struct syscall_ftruncate_t to here. + * spu/gettimeofday.c: Move struct syscall_gettimeofday_t to here. + * spu/lseek.c: Move struct syscall_lseek_t and JSRE_SEEK defines to + here. + * spu/open.c: Move struct syscall_open_t and JSRE_O_ defines to here. + * spu/read.c: Move struct syscall_read_t to here, and actually use + it (it is the same as syscall_write_t). + * spu/stat.c: Move struct syscall_stat_t to here. + * spu/write.c: Move struct syscall_write_t to here. + * spu/close.c: Pass the address of the first and only argument to + __send_to_ppe rather than using an automatic variable and a + special struct. + * spu/dup.c: Ditto. + * spu/unlink.c: Ditto. + 2007-05-30 Kazu Hirata * m68k/cf-crt1.C, m68k/cf.sc, m68k/fido.sc, m68k/fido-crt0.S: diff --git a/libgloss/spu/access.c b/libgloss/spu/access.c index 8b023166b..9c5cea43d 100644 --- a/libgloss/spu/access.c +++ b/libgloss/spu/access.c @@ -31,6 +31,14 @@ POSSIBILITY OF SUCH DAMAGE. #include "jsre.h" +typedef struct +{ + unsigned int pathname; + unsigned int pad0[3]; + unsigned int mode; + unsigned int pad1[3]; +} syscall_access_t; + int access (const char *pathname, int mode) { diff --git a/libgloss/spu/close.c b/libgloss/spu/close.c index ea47d0268..57011f178 100644 --- a/libgloss/spu/close.c +++ b/libgloss/spu/close.c @@ -35,8 +35,5 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) int close (int file) { - syscall_close_t sys; - - sys.file = file; - return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_CLOSE, &sys); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_CLOSE, &file); } diff --git a/libgloss/spu/dup.c b/libgloss/spu/dup.c index 2ff787055..325db63ee 100644 --- a/libgloss/spu/dup.c +++ b/libgloss/spu/dup.c @@ -34,8 +34,5 @@ POSSIBILITY OF SUCH DAMAGE. int dup (int oldfd) { - syscall_dup_t sys; - - sys.oldfd = oldfd; - return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_DUP, &sys); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_DUP, &oldfd); } diff --git a/libgloss/spu/fstat.c b/libgloss/spu/fstat.c index 69316d481..45abeeb02 100644 --- a/libgloss/spu/fstat.c +++ b/libgloss/spu/fstat.c @@ -33,6 +33,14 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) #include #include "jsre.h" +typedef struct +{ + unsigned int file; + unsigned int pad0[3]; + unsigned int ptr; + unsigned int pad1[3]; +} syscall_fstat_t; + int fstat (int file, struct stat *pstat) { diff --git a/libgloss/spu/ftruncate.c b/libgloss/spu/ftruncate.c index 47a998f09..138f60ed6 100644 --- a/libgloss/spu/ftruncate.c +++ b/libgloss/spu/ftruncate.c @@ -31,6 +31,14 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "jsre.h" +typedef struct +{ + unsigned int file; + unsigned int pad0[3]; + unsigned int length; + unsigned int pad1[3]; +} syscall_ftruncate_t; + int ftruncate (int file, off_t length) { diff --git a/libgloss/spu/gettimeofday.c b/libgloss/spu/gettimeofday.c index 93051f695..372597648 100644 --- a/libgloss/spu/gettimeofday.c +++ b/libgloss/spu/gettimeofday.c @@ -34,6 +34,14 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "jsre.h" +typedef struct +{ + unsigned int tv; + unsigned int pad0[3]; + unsigned int tz; + unsigned int pad1[3]; +} syscall_gettimeofday_t; + int gettimeofday (struct timeval *tv, struct timezone *tz) { diff --git a/libgloss/spu/jsre.h b/libgloss/spu/jsre.h index f69cd490e..dc89c0d9f 100644 --- a/libgloss/spu/jsre.h +++ b/libgloss/spu/jsre.h @@ -35,23 +35,6 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) #ifndef __JSRE_H #define __JSRE_H -#define JSRE_SEEK_SET 0 -#define JSRE_SEEK_CUR 1 -#define JSRE_SEEK_END 2 - -#define JSRE_O_RDONLY 0 -#define JSRE_O_WRONLY 1 -#define JSRE_O_RDWR 2 - -#define JSRE_O_CREAT 64 -#define JSRE_O_EXCL 128 -#define JSRE_O_NOCTTY 256 -#define JSRE_O_TRUNC 512 -#define JSRE_O_APPEND 1024 -#define JSRE_O_NDELAY 2048 -#define JSRE_O_SYNC 4096 -#define JSRE_O_ASYNC 8192 - #define JSRE_POSIX1_SIGNALCODE 0x2101 #define JSRE_CLOSE 2 @@ -67,104 +50,6 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) #define JSRE_ACCESS 29 #define JSRE_DUP 30 -typedef struct -{ - unsigned int pathname; - unsigned int pad0[ 3 ]; - unsigned int flags; - unsigned int pad1[ 3 ]; - unsigned int mode; - unsigned int pad2[ 3 ]; -} syscall_open_t; - -typedef struct -{ - unsigned int file; - unsigned int pad0[ 3 ]; - unsigned int ptr; - unsigned int pad1[ 3 ]; - unsigned int len; - unsigned int pad2[ 3 ]; -} syscall_write_t; - -typedef struct -{ - unsigned int file; - unsigned int pad0[ 3 ]; - unsigned int ptr; - unsigned int pad1[ 3 ]; - unsigned int len; - unsigned int pad2[ 3 ]; -} syscall_read_t; - -typedef struct -{ - unsigned int file; - unsigned int pad0[ 3 ]; -} syscall_close_t; - -typedef struct -{ - unsigned int file; - unsigned int pad0[ 3 ]; - unsigned int offset; - unsigned int pad1[ 3 ]; - unsigned int whence; - unsigned int pad2[ 3 ]; -} syscall_lseek_t; - -typedef struct -{ - unsigned int file; - unsigned int pad0[ 3 ]; - unsigned int length; - unsigned int pad1[ 3 ]; -} syscall_ftruncate_t; - -typedef struct -{ - unsigned int pathname; - unsigned int pad0[ 3 ]; - unsigned int mode; - unsigned int pad1[ 3 ]; -} syscall_access_t; - -typedef struct -{ - unsigned int oldfd; - unsigned int pad0[ 3 ]; -} syscall_dup_t; - -typedef struct -{ - unsigned int tv; - unsigned int pad0[ 3 ]; - unsigned int tz; - unsigned int pad1[ 3 ]; -} syscall_gettimeofday_t; - -typedef struct -{ - unsigned int pathname; - unsigned int pad0[ 3 ]; -} syscall_unlink_t; - -typedef struct -{ - unsigned int file; - unsigned int pad0[ 3 ]; - unsigned int ptr; - unsigned int pad1[ 3 ]; -} syscall_fstat_t; - -typedef struct -{ - unsigned int pathname; - unsigned int pad0[ 3 ]; - unsigned int ptr; - unsigned int pad1[ 3 ]; -} syscall_stat_t; - typedef struct { unsigned int dev; unsigned int ino; diff --git a/libgloss/spu/lseek.c b/libgloss/spu/lseek.c index 9ba372ccf..e5b3b75d0 100644 --- a/libgloss/spu/lseek.c +++ b/libgloss/spu/lseek.c @@ -33,6 +33,20 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) #include #include "jsre.h" +#define JSRE_SEEK_SET 0 +#define JSRE_SEEK_CUR 1 +#define JSRE_SEEK_END 2 + +typedef struct +{ + unsigned int file; + unsigned int pad0[3]; + unsigned int offset; + unsigned int pad1[3]; + unsigned int whence; + unsigned int pad2[3]; +} syscall_lseek_t; + off_t lseek (int file, off_t offset, int whence) { diff --git a/libgloss/spu/open.c b/libgloss/spu/open.c index 46afcab2d..0c1b253a5 100644 --- a/libgloss/spu/open.c +++ b/libgloss/spu/open.c @@ -34,6 +34,29 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) #include #include "jsre.h" +#define JSRE_O_RDONLY 0 +#define JSRE_O_WRONLY 1 +#define JSRE_O_RDWR 2 + +#define JSRE_O_CREAT 64 +#define JSRE_O_EXCL 128 +#define JSRE_O_NOCTTY 256 +#define JSRE_O_TRUNC 512 +#define JSRE_O_APPEND 1024 +#define JSRE_O_NDELAY 2048 +#define JSRE_O_SYNC 4096 +#define JSRE_O_ASYNC 8192 + +typedef struct +{ + unsigned int pathname; + unsigned int pad0[3]; + unsigned int flags; + unsigned int pad1[3]; + unsigned int mode; + unsigned int pad2[3]; +} syscall_open_t; + int open (const char *filename, int flags, ...) { diff --git a/libgloss/spu/read.c b/libgloss/spu/read.c index 1a75ae0a2..4e7189c19 100644 --- a/libgloss/spu/read.c +++ b/libgloss/spu/read.c @@ -33,10 +33,20 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) #include #include "jsre.h" +typedef struct +{ + unsigned int file; + unsigned int pad0[3]; + unsigned int ptr; + unsigned int pad1[3]; + unsigned int len; + unsigned int pad2[3]; +} syscall_read_t; + int read (int file, void *ptr, size_t len) { - syscall_write_t sys; + syscall_read_t sys; sys.file = file; sys.ptr = ( unsigned int )ptr; diff --git a/libgloss/spu/stat.c b/libgloss/spu/stat.c index ad925c624..5f64c42f5 100644 --- a/libgloss/spu/stat.c +++ b/libgloss/spu/stat.c @@ -34,6 +34,14 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) #include #include "jsre.h" +typedef struct +{ + unsigned int pathname; + unsigned int pad0[3]; + unsigned int ptr; + unsigned int pad1[3]; +} syscall_stat_t; + int stat (const char *pathname, struct stat *pstat) { diff --git a/libgloss/spu/unlink.c b/libgloss/spu/unlink.c index 4a7edefb7..6c5daddcc 100644 --- a/libgloss/spu/unlink.c +++ b/libgloss/spu/unlink.c @@ -35,8 +35,5 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) int unlink (const char *pathname) { - syscall_unlink_t sys; - - sys.pathname = ( unsigned int )pathname; - return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_UNLINK, &sys); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_UNLINK, &pathname); } diff --git a/libgloss/spu/write.c b/libgloss/spu/write.c index c9663429c..7cd5e5ae2 100644 --- a/libgloss/spu/write.c +++ b/libgloss/spu/write.c @@ -33,6 +33,16 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) #include #include "jsre.h" +typedef struct +{ + unsigned int file; + unsigned int pad0[3]; + unsigned int ptr; + unsigned int pad1[3]; + unsigned int len; + unsigned int pad2[3]; +} syscall_write_t; + int write (int file, const void *ptr, size_t len) {