This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] spu move jsre.h structs and defines to specific C files


Ok, done.

-- Jeff J.

Patrick Mansfield wrote:
Jeff -

Can you apply this patch?

Thanks ...

-- Patrick Mansfield

On Wed, May 23, 2007 at 09:12:39AM -0700, Patrick Mansfield wrote:
Move function specific structs and defines for assisted calls into the C
files that use them, similar to what is done for the libc assist calls.

For functions using only one argument, just use the local stack and do not
bother with a special struct, just like we have in the libc spu assist
calls. That doesn't save any object code, but the C code is simpler.

Depends on spu return rc value from __send_to_ppe patch.

libgloss ChangeLog:

2007-05-22 Patrick Mansfield <patmans@us.ibm.com>

* 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.


Index: my-base-quilt/libgloss/spu/close.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/close.c
+++ my-base-quilt/libgloss/spu/close.c
@@ -35,8 +35,5 @@ Author: Andreas Neukoetter (ti95neuk@de.
 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);
 }
Index: my-base-quilt/libgloss/spu/dup.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/dup.c
+++ my-base-quilt/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);
 }
Index: my-base-quilt/libgloss/spu/jsre.h
===================================================================
--- my-base-quilt.orig/libgloss/spu/jsre.h
+++ my-base-quilt/libgloss/spu/jsre.h
@@ -35,23 +35,6 @@ Author: Andreas Neukoetter (ti95neuk@de.
 #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.
 #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;
Index: my-base-quilt/libgloss/spu/access.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/access.c
+++ my-base-quilt/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)
 {
Index: my-base-quilt/libgloss/spu/fstat.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/fstat.c
+++ my-base-quilt/libgloss/spu/fstat.c
@@ -33,6 +33,14 @@ Author: Andreas Neukoetter (ti95neuk@de.
 #include <sys/stat.h>
 #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)
 {
Index: my-base-quilt/libgloss/spu/ftruncate.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/ftruncate.c
+++ my-base-quilt/libgloss/spu/ftruncate.c
@@ -31,6 +31,14 @@ POSSIBILITY OF SUCH DAMAGE.
 #include <unistd.h>
 #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)
 {
Index: my-base-quilt/libgloss/spu/gettimeofday.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/gettimeofday.c
+++ my-base-quilt/libgloss/spu/gettimeofday.c
@@ -34,6 +34,14 @@ POSSIBILITY OF SUCH DAMAGE.
 #include <sys/time.h>
 #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)
 {
Index: my-base-quilt/libgloss/spu/lseek.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/lseek.c
+++ my-base-quilt/libgloss/spu/lseek.c
@@ -33,6 +33,20 @@ Author: Andreas Neukoetter (ti95neuk@de.
 #include <unistd.h>
 #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)
 {
Index: my-base-quilt/libgloss/spu/open.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/open.c
+++ my-base-quilt/libgloss/spu/open.c
@@ -34,6 +34,29 @@ Author: Andreas Neukoetter (ti95neuk@de.
 #include <fcntl.h>
 #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, ...)
 {
Index: my-base-quilt/libgloss/spu/read.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/read.c
+++ my-base-quilt/libgloss/spu/read.c
@@ -33,10 +33,20 @@ Author: Andreas Neukoetter (ti95neuk@de.
 #include <fcntl.h>
 #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;
Index: my-base-quilt/libgloss/spu/stat.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/stat.c
+++ my-base-quilt/libgloss/spu/stat.c
@@ -34,6 +34,14 @@ Author: Andreas Neukoetter (ti95neuk@de.
 #include <fcntl.h>
 #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)
 {
Index: my-base-quilt/libgloss/spu/write.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/write.c
+++ my-base-quilt/libgloss/spu/write.c
@@ -33,6 +33,16 @@ Author: Andreas Neukoetter (ti95neuk@de.
 #include <fcntl.h>
 #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)
 {
Index: my-base-quilt/libgloss/spu/unlink.c
===================================================================
--- my-base-quilt.orig/libgloss/spu/unlink.c
+++ my-base-quilt/libgloss/spu/unlink.c
@@ -35,8 +35,5 @@ Author: Andreas Neukoetter (ti95neuk@de.
 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);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]