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]

[PATCH] sharing spu _send_to_ppe()


The patch below modifies the definition of _send_to_ppe() in SPU
libgloss to make it possible to share it between libgloss and stdio
offloading routines.

Thanks,

2006-08-30  Kazunori Asayama  <asayama@sm.sony.co.jp>

	* spu/syscalls.c: Add a new argument to _send_to_ppe() to 
	specify signal code.
	* spu/jsre.h: Update declaration of _send_to_ppe().
	* spu/close.c: Replace _send_to_ppe_0x2101() by _send_to_ppe().
	* spu/fstat.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.


Index: newlib-trunk/libgloss/spu/jsre.h
===================================================================
--- newlib-trunk.orig/libgloss/spu/jsre.h	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/jsre.h	2006-08-30 15:56:45.000000000 +0900
@@ -52,6 +52,8 @@
 #define JSRE_O_SYNC 4096
 #define JSRE_O_ASYNC 8192
 
+#define JSRE_POSIX1_SIGNALCODE 0x2101
+
 #define JSRE_CLOSE 2
 #define JSRE_FSTAT 4
 #define JSRE_LSEEK 9
@@ -152,6 +154,6 @@
     unsigned int ctime;
 } jsre_stat_t;
 
-void _send_to_ppe_0x2101 (int opcode, void *data);
+void _send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data);
 
 #endif
Index: newlib-trunk/libgloss/spu/syscalls.c
===================================================================
--- newlib-trunk.orig/libgloss/spu/syscalls.c	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/syscalls.c	2006-08-30 16:37:18.000000000 +0900
@@ -30,14 +30,16 @@
 Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
 */
 
+#include "jsre.h"
+
 void
-_send_to_ppe_0x2101 (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 );
 
         vector unsigned int stopfunc = {
-                0x00002101,     /* stop 0x2101 */
+                signalcode,     /* stop */
                 (unsigned int) combined,
                 0x4020007f,     /* nop */
                 0x35000000      /* bi $0 */
Index: newlib-trunk/libgloss/spu/close.c
===================================================================
--- newlib-trunk.orig/libgloss/spu/close.c	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/close.c	2006-08-30 15:57:12.000000000 +0900
@@ -41,7 +41,7 @@
 
 	sys.file = file;
 
-        _send_to_ppe_0x2101 (JSRE_CLOSE, &sys);
+        _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_CLOSE, &sys);
 
         errno = psys_out->err;
         return ( psys_out->rc);
Index: newlib-trunk/libgloss/spu/fstat.c
===================================================================
--- newlib-trunk.orig/libgloss/spu/fstat.c	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/fstat.c	2006-08-30 15:57:35.000000000 +0900
@@ -44,7 +44,7 @@
         sys.file = file;
         sys.ptr = ( unsigned int )&pjstat;
 
-        _send_to_ppe_0x2101 (JSRE_FSTAT, &sys);
+        _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_FSTAT, &sys);
 
         pstat->st_dev = pjstat.dev;
         pstat->st_ino = pjstat.ino;
Index: newlib-trunk/libgloss/spu/lseek.c
===================================================================
--- newlib-trunk.orig/libgloss/spu/lseek.c	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/lseek.c	2006-08-30 15:57:46.000000000 +0900
@@ -55,7 +55,7 @@
 			break;
 	}
 
-	_send_to_ppe_0x2101 (JSRE_LSEEK, &sys);
+	_send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_LSEEK, &sys);
 
         errno = psys_out->err;
         return ( psys_out->rc);
Index: newlib-trunk/libgloss/spu/open.c
===================================================================
--- newlib-trunk.orig/libgloss/spu/open.c	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/open.c	2006-08-30 15:57:53.000000000 +0900
@@ -81,7 +81,7 @@
                   sys.mode = 0;
           }
 
-        _send_to_ppe_0x2101 ( JSRE_OPEN, &sys);
+        _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_OPEN, &sys);
 
         errno = psys_out->err;
         return ( psys_out->rc);
Index: newlib-trunk/libgloss/spu/read.c
===================================================================
--- newlib-trunk.orig/libgloss/spu/read.c	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/read.c	2006-08-30 15:57:59.000000000 +0900
@@ -44,7 +44,7 @@
 	sys.ptr = ( unsigned int )ptr;
 	sys.len = len;
 
-	_send_to_ppe_0x2101 (JSRE_READ, &sys);
+	_send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_READ, &sys);
 
         errno = psys_out->err;
         return ( psys_out->rc);
Index: newlib-trunk/libgloss/spu/stat.c
===================================================================
--- newlib-trunk.orig/libgloss/spu/stat.c	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/stat.c	2006-08-30 15:58:04.000000000 +0900
@@ -45,7 +45,7 @@
 	sys.pathname = pathname;
 	sys.ptr = ( unsigned int )&pjstat;
 
-	_send_to_ppe_0x2101 (JSRE_STAT, &sys);
+	_send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_STAT, &sys);
 
 	pstat->st_dev = pjstat.dev;
 	pstat->st_ino = pjstat.ino;
Index: newlib-trunk/libgloss/spu/unlink.c
===================================================================
--- newlib-trunk.orig/libgloss/spu/unlink.c	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/unlink.c	2006-08-30 15:58:09.000000000 +0900
@@ -41,7 +41,7 @@
 
 	sys.pathname = ( unsigned int )pathname;
 
-        _send_to_ppe_0x2101 (JSRE_UNLINK, &sys);
+        _send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_UNLINK, &sys);
 
         errno = psys_out->err;
         return ( psys_out->rc);
Index: newlib-trunk/libgloss/spu/write.c
===================================================================
--- newlib-trunk.orig/libgloss/spu/write.c	2006-08-29 17:06:19.000000000 +0900
+++ newlib-trunk/libgloss/spu/write.c	2006-08-30 15:58:23.000000000 +0900
@@ -44,7 +44,7 @@
 	sys.ptr = ( unsigned int )ptr;
 	sys.len = len;
 
-	_send_to_ppe_0x2101 (JSRE_WRITE, &sys);
+	_send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_WRITE, &sys);
 
         errno = psys_out->err;
         return ( psys_out->rc);


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