Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2006-08-23 20:13:24 +0400
committerJeff Johnston <jjohnstn@redhat.com>2006-08-23 20:13:24 +0400
commit1fa66a83d11a56874aa94125a724baef2bec66aa (patch)
treeda342a66dc94fba7fe294c85d90fb221ac93bdec /libgloss
parentb8e05321bafa23703a30027a8e3ab64037fd67b0 (diff)
2006-08-23 Kazunori Asayama <asayama@sm.sony.co.jp>
* spu/Makefile.in: Add new object files. * spu/syscalls.c: Move each system call to individual file. * spu/jsre.h: Add declaration of _send_to_ppe_0x2101(). * spu/close.c: New file. Moved from spu/syscalls.c. * spu/fstat.c: Likewise. * spu/getpid.c: Likewise. * spu/isatty.c: Likewise. * spu/kill.c: Likewise. * spu/lseek.c: Likewise. * spu/open.c: Likewise. * spu/read.c: Likewise. * spu/stat.c: Likewise. * spu/unlink.c: Likewise. * spu/write.c: Likewise.
Diffstat (limited to 'libgloss')
-rw-r--r--libgloss/ChangeLog17
-rw-r--r--libgloss/spu/Makefile.in3
-rw-r--r--libgloss/spu/close.c49
-rw-r--r--libgloss/spu/fstat.c67
-rw-r--r--libgloss/spu/getpid.c38
-rw-r--r--libgloss/spu/isatty.c38
-rw-r--r--libgloss/spu/jsre.h1
-rw-r--r--libgloss/spu/kill.c43
-rw-r--r--libgloss/spu/lseek.c63
-rw-r--r--libgloss/spu/open.c89
-rw-r--r--libgloss/spu/read.c52
-rw-r--r--libgloss/spu/stat.c67
-rw-r--r--libgloss/spu/syscalls.c245
-rw-r--r--libgloss/spu/unlink.c49
-rw-r--r--libgloss/spu/write.c52
15 files changed, 629 insertions, 244 deletions
diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog
index 275317ddd..0b69a75fb 100644
--- a/libgloss/ChangeLog
+++ b/libgloss/ChangeLog
@@ -1,3 +1,20 @@
+2006-08-23 Kazunori Asayama <asayama@sm.sony.co.jp>
+
+ * spu/Makefile.in: Add new object files.
+ * spu/syscalls.c: Move each system call to individual file.
+ * spu/jsre.h: Add declaration of _send_to_ppe_0x2101().
+ * spu/close.c: New file. Moved from spu/syscalls.c.
+ * spu/fstat.c: Likewise.
+ * spu/getpid.c: Likewise.
+ * spu/isatty.c: Likewise.
+ * spu/kill.c: Likewise.
+ * spu/lseek.c: Likewise.
+ * spu/open.c: Likewise.
+ * spu/read.c: Likewise.
+ * spu/stat.c: Likewise.
+ * spu/unlink.c: Likewise.
+ * spu/write.c: Likewise.
+
2006-08-21 David Ung <davidu@mips.com>
* mips/Makefile.in: Add rule for cygmon.o and pass the -mno-mips16
diff --git a/libgloss/spu/Makefile.in b/libgloss/spu/Makefile.in
index 9b18e8c51..5709e5630 100644
--- a/libgloss/spu/Makefile.in
+++ b/libgloss/spu/Makefile.in
@@ -54,7 +54,8 @@ OBJDUMP = `t='$(program_transform_name)'; echo objdump | sed -e $$t`
OBJCOPY = `t='$(program_transform_name)'; echo objcopy | sed -e $$t`
# object files needed
-OBJS = syscalls.o init.o exit.o sbrk.o
+OBJS = syscalls.o init.o exit.o sbrk.o close.o fstat.o getpid.o isatty.o \
+ kill.o lseek.o open.o read.o unlink.o write.o stat.o
# Object files specific to particular targets.
EVALOBJS = ${OBJS}
diff --git a/libgloss/spu/close.c b/libgloss/spu/close.c
new file mode 100644
index 000000000..4810447bb
--- /dev/null
+++ b/libgloss/spu/close.c
@@ -0,0 +1,49 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+#include <errno.h>
+#include "jsre.h"
+
+int
+close (int file)
+{
+ syscall_close_t sys ;
+ syscall_out_t *psys_out = ( syscall_out_t* )&sys;
+
+ sys.file = file;
+
+ _send_to_ppe_0x2101 (JSRE_CLOSE, &sys);
+
+ errno = psys_out->err;
+ return ( psys_out->rc);
+}
+
diff --git a/libgloss/spu/fstat.c b/libgloss/spu/fstat.c
new file mode 100644
index 000000000..7a4920239
--- /dev/null
+++ b/libgloss/spu/fstat.c
@@ -0,0 +1,67 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+#include <sys/stat.h>
+#include <errno.h>
+#include "jsre.h"
+
+int
+fstat (int file, struct stat *pstat)
+{
+ syscall_fstat_t sys;
+ syscall_out_t *psys_out = ( syscall_out_t* )&sys;
+ jsre_stat_t pjstat;
+
+ sys.file = file;
+ sys.ptr = ( unsigned int )&pjstat;
+
+ _send_to_ppe_0x2101 (JSRE_FSTAT, &sys);
+
+ pstat->st_dev = pjstat.dev;
+ pstat->st_ino = pjstat.ino;
+ pstat->st_mode = pjstat.mode;
+ pstat->st_nlink = pjstat.nlink;
+ pstat->st_uid = pjstat.uid;
+ pstat->st_gid = pjstat.gid;
+ pstat->st_rdev = pjstat.rdev;
+ pstat->st_size = pjstat.size;
+ pstat->st_blksize = pjstat.blksize;
+ pstat->st_blocks = pjstat.blocks;
+ pstat->st_atime = pjstat.atime;
+ pstat->st_mtime = pjstat.mtime;
+ pstat->st_ctime = pjstat.ctime;
+
+
+ errno = psys_out->err;
+ return( psys_out->rc );
+}
+
diff --git a/libgloss/spu/getpid.c b/libgloss/spu/getpid.c
new file mode 100644
index 000000000..ff2d82028
--- /dev/null
+++ b/libgloss/spu/getpid.c
@@ -0,0 +1,38 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+int
+getpid ()
+{
+ return (1);
+}
+
diff --git a/libgloss/spu/isatty.c b/libgloss/spu/isatty.c
new file mode 100644
index 000000000..7a20e1541
--- /dev/null
+++ b/libgloss/spu/isatty.c
@@ -0,0 +1,38 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+int
+isatty (int fd)
+{
+ return (0);
+}
+
diff --git a/libgloss/spu/jsre.h b/libgloss/spu/jsre.h
index 5f575577b..b366f60f4 100644
--- a/libgloss/spu/jsre.h
+++ b/libgloss/spu/jsre.h
@@ -152,5 +152,6 @@ typedef struct {
unsigned int ctime;
} jsre_stat_t;
+void _send_to_ppe_0x2101 (int opcode, void *data);
#endif
diff --git a/libgloss/spu/kill.c b/libgloss/spu/kill.c
new file mode 100644
index 000000000..8a5d22c82
--- /dev/null
+++ b/libgloss/spu/kill.c
@@ -0,0 +1,43 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+#include <unistd.h>
+
+int
+kill (int pid, int sig)
+{
+ if (pid == 1)
+ {
+ _exit (sig);
+ }
+}
+
diff --git a/libgloss/spu/lseek.c b/libgloss/spu/lseek.c
new file mode 100644
index 000000000..bb57c6a90
--- /dev/null
+++ b/libgloss/spu/lseek.c
@@ -0,0 +1,63 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+#include <unistd.h>
+#include <errno.h>
+#include "jsre.h"
+
+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;
+
+ switch( whence ){
+ case SEEK_SET:
+ sys.whence = JSRE_SEEK_SET;
+ break;
+ case SEEK_CUR:
+ sys.whence = JSRE_SEEK_CUR;
+ break;
+ case SEEK_END:
+ sys.whence = JSRE_SEEK_END;
+ break;
+ }
+
+ _send_to_ppe_0x2101 (JSRE_LSEEK, &sys);
+
+ errno = psys_out->err;
+ return ( psys_out->rc);
+}
+
diff --git a/libgloss/spu/open.c b/libgloss/spu/open.c
new file mode 100644
index 000000000..05a227441
--- /dev/null
+++ b/libgloss/spu/open.c
@@ -0,0 +1,89 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+#include <stdarg.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "jsre.h"
+
+int
+open (const char *filename, int flags, ...)
+{
+ syscall_open_t sys ;
+ syscall_out_t *psys_out = ( syscall_out_t* )&sys;
+
+ sys.pathname = ( unsigned int )filename;
+
+ sys.flags = 0;
+
+ sys.flags |= ( ( flags & O_CREAT ) ? JSRE_O_CREAT : 0 );
+ sys.flags |= ( ( flags & O_EXCL ) ? JSRE_O_EXCL : 0 );
+ sys.flags |= ( ( flags & O_NOCTTY ) ? JSRE_O_NOCTTY : 0 );
+ sys.flags |= ( ( flags & O_TRUNC ) ? JSRE_O_TRUNC : 0 );
+ sys.flags |= ( ( flags & O_APPEND ) ? JSRE_O_APPEND : 0 );
+// sys.flags |= ( ( flags & O_NOBLOCK ) ? JSRE_O_NOBLOCK : 0 );
+// sys.flags |= ( ( flags & O_NDELAY ) ? JSRE_O_NDELAY : 0 );
+ sys.flags |= ( ( flags & O_SYNC ) ? JSRE_O_SYNC : 0 );
+// sys.flags |= ( ( flags & O_NOFOLLOW ) ? JSRE_O_NOFOLLOW : 0 );
+// sys.flags |= ( ( flags & O_DIRECTORY ) ? JSRE_O_DIRECTORY : 0 );
+// sys.flags |= ( ( flags & O_DIRECT ) ? JSRE_O_DIRECT : 0 );
+// sys.flags |= ( ( flags & O_ASYNC ) ? JSRE_O_ASYNC : 0 );
+// sys.flags |= ( ( flags & O_LARGEFILE ) ? JSRE_O_LARGEFILE : 0 );
+
+
+ sys.flags |= ( ( flags & O_RDONLY ) ? JSRE_O_RDONLY : 0 );
+ sys.flags |= ( ( flags & O_WRONLY ) ? JSRE_O_WRONLY : 0 );
+ sys.flags |= ( ( flags & O_RDWR ) ? JSRE_O_RDWR : 0 );
+
+
+ /* FIXME: we have to check/map all flags */
+
+ if ((sys.flags & O_CREAT))
+ {
+ va_list ap;
+
+ va_start (ap, flags);
+ sys.mode = va_arg (ap, int);
+ va_end (ap);
+
+ }
+ else
+ {
+ sys.mode = 0;
+ }
+
+ _send_to_ppe_0x2101 ( JSRE_OPEN, &sys);
+
+ errno = psys_out->err;
+ return ( psys_out->rc);
+}
+
diff --git a/libgloss/spu/read.c b/libgloss/spu/read.c
new file mode 100644
index 000000000..580610809
--- /dev/null
+++ b/libgloss/spu/read.c
@@ -0,0 +1,52 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+#include <fcntl.h>
+#include <errno.h>
+#include "jsre.h"
+
+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_0x2101 (JSRE_READ, &sys);
+
+ errno = psys_out->err;
+ return ( psys_out->rc);
+}
+
diff --git a/libgloss/spu/stat.c b/libgloss/spu/stat.c
new file mode 100644
index 000000000..fe6513f4e
--- /dev/null
+++ b/libgloss/spu/stat.c
@@ -0,0 +1,67 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+#include <stdarg.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "jsre.h"
+
+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;
+
+ sys.pathname = pathname;
+ sys.ptr = ( unsigned int )&pjstat;
+
+ _send_to_ppe_0x2101 (JSRE_STAT, &sys);
+
+ pstat->st_dev = pjstat.dev;
+ pstat->st_ino = pjstat.ino;
+ pstat->st_mode = pjstat.mode;
+ pstat->st_nlink = pjstat.nlink;
+ pstat->st_uid = pjstat.uid;
+ pstat->st_gid = pjstat.gid;
+ pstat->st_rdev = pjstat.rdev;
+ pstat->st_size = pjstat.size;
+ pstat->st_blksize = pjstat.blksize;
+ pstat->st_blocks = pjstat.blocks;
+ pstat->st_atime = pjstat.atime;
+ pstat->st_mtime = pjstat.mtime;
+ pstat->st_ctime = pjstat.ctime;
+
+ errno = psys_out->err;
+ return( psys_out->rc );
+}
+
diff --git a/libgloss/spu/syscalls.c b/libgloss/spu/syscalls.c
index 20aabb79c..26c3c99a3 100644
--- a/libgloss/spu/syscalls.c
+++ b/libgloss/spu/syscalls.c
@@ -30,19 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
*/
-#include <spu_intrinsics.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include "../syscall.h"
-
-#include "jsre.h"
-
-static void
-send_to_ppe_0x2101 (int opcode, void *data)
+void
+_send_to_ppe_0x2101 (int opcode, void *data)
{
unsigned int combined = ( ( opcode<<24 )&0xff000000 ) | ( ( unsigned int )data & 0x00ffffff );
@@ -59,233 +48,3 @@ send_to_ppe_0x2101 (int opcode, void *data)
return (f ());
}
-
-int
-isatty (int fd)
-{
- return (0);
-}
-
-int
-getpid ()
-{
- return (1);
-}
-
-int
-kill (int pid, int sig)
-{
- if (pid == 1)
- {
- _exit (sig);
- }
-}
-
-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_0x2101 (JSRE_READ, &sys);
-
- errno = psys_out->err;
- return ( psys_out->rc);
-}
-
-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;
-
- switch( whence ){
- case SEEK_SET:
- sys.whence = JSRE_SEEK_SET;
- break;
- case SEEK_CUR:
- sys.whence = JSRE_SEEK_CUR;
- break;
- case SEEK_END:
- sys.whence = JSRE_SEEK_END;
- break;
- }
-
- send_to_ppe_0x2101 (JSRE_LSEEK, &sys);
-
- errno = psys_out->err;
- return ( psys_out->rc);
-}
-
-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_0x2101 (JSRE_WRITE, &sys);
-
- errno = psys_out->err;
- return ( psys_out->rc);
-}
-
-int
-open (const char *filename, int flags, ...)
-{
- int rc;
- int len;
-
- syscall_open_t sys ;
- syscall_out_t *psys_out = ( syscall_out_t* )&sys;
-
- sys.pathname = ( unsigned int )filename;
-
- sys.flags = 0;
-
- sys.flags |= ( ( flags & O_CREAT ) ? JSRE_O_CREAT : 0 );
- sys.flags |= ( ( flags & O_EXCL ) ? JSRE_O_EXCL : 0 );
- sys.flags |= ( ( flags & O_NOCTTY ) ? JSRE_O_NOCTTY : 0 );
- sys.flags |= ( ( flags & O_TRUNC ) ? JSRE_O_TRUNC : 0 );
- sys.flags |= ( ( flags & O_APPEND ) ? JSRE_O_APPEND : 0 );
-// sys.flags |= ( ( flags & O_NOBLOCK ) ? JSRE_O_NOBLOCK : 0 );
-// sys.flags |= ( ( flags & O_NDELAY ) ? JSRE_O_NDELAY : 0 );
- sys.flags |= ( ( flags & O_SYNC ) ? JSRE_O_SYNC : 0 );
-// sys.flags |= ( ( flags & O_NOFOLLOW ) ? JSRE_O_NOFOLLOW : 0 );
-// sys.flags |= ( ( flags & O_DIRECTORY ) ? JSRE_O_DIRECTORY : 0 );
-// sys.flags |= ( ( flags & O_DIRECT ) ? JSRE_O_DIRECT : 0 );
-// sys.flags |= ( ( flags & O_ASYNC ) ? JSRE_O_ASYNC : 0 );
-// sys.flags |= ( ( flags & O_LARGEFILE ) ? JSRE_O_LARGEFILE : 0 );
-
-
- sys.flags |= ( ( flags & O_RDONLY ) ? JSRE_O_RDONLY : 0 );
- sys.flags |= ( ( flags & O_WRONLY ) ? JSRE_O_WRONLY : 0 );
- sys.flags |= ( ( flags & O_RDWR ) ? JSRE_O_RDWR : 0 );
-
-
- /* FIXME: we have to check/map all flags */
-
- if ((sys.flags & O_CREAT))
- {
- va_list ap;
-
- va_start (ap, flags);
- sys.mode = va_arg (ap, int);
- va_end (ap);
-
- }
- else
- {
- sys.mode = 0;
- }
-
- send_to_ppe_0x2101 ( JSRE_OPEN, &sys);
-
- errno = psys_out->err;
- return ( psys_out->rc);
-}
-
-int
-close (int file)
-{
- int rc;
-
- syscall_close_t sys ;
- syscall_out_t *psys_out = ( syscall_out_t* )&sys;
-
- sys.file = file;
-
- send_to_ppe_0x2101 (JSRE_CLOSE, &sys);
-
- errno = psys_out->err;
- return ( psys_out->rc);
-}
-
-int
-fstat (int file, struct stat *pstat)
-{
- syscall_fstat_t sys;
- syscall_out_t *psys_out = ( syscall_out_t* )&sys;
- jsre_stat_t pjstat;
-
- sys.file = file;
- sys.ptr = ( unsigned int )&pjstat;
-
- send_to_ppe_0x2101 (JSRE_FSTAT, &sys);
-
- pstat->st_dev = pjstat.dev;
- pstat->st_ino = pjstat.ino;
- pstat->st_mode = pjstat.mode;
- pstat->st_nlink = pjstat.nlink;
- pstat->st_uid = pjstat.uid;
- pstat->st_gid = pjstat.gid;
- pstat->st_rdev = pjstat.rdev;
- pstat->st_size = pjstat.size;
- pstat->st_blksize = pjstat.blksize;
- pstat->st_blocks = pjstat.blocks;
- pstat->st_atime = pjstat.atime;
- pstat->st_mtime = pjstat.mtime;
- pstat->st_ctime = pjstat.ctime;
-
-
- errno = psys_out->err;
- return( psys_out->rc );
-}
-
-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;
-
- sys.pathname = pathname;
- sys.ptr = ( unsigned int )&pjstat;
-
- send_to_ppe_0x2101 (JSRE_STAT, &sys);
-
- pstat->st_dev = pjstat.dev;
- pstat->st_ino = pjstat.ino;
- pstat->st_mode = pjstat.mode;
- pstat->st_nlink = pjstat.nlink;
- pstat->st_uid = pjstat.uid;
- pstat->st_gid = pjstat.gid;
- pstat->st_rdev = pjstat.rdev;
- pstat->st_size = pjstat.size;
- pstat->st_blksize = pjstat.blksize;
- pstat->st_blocks = pjstat.blocks;
- pstat->st_atime = pjstat.atime;
- pstat->st_mtime = pjstat.mtime;
- pstat->st_ctime = pjstat.ctime;
-
- errno = psys_out->err;
- return( psys_out->rc );
-}
-
-
-int
-unlink (const char *pathname)
-{
- int rc;
-
- syscall_unlink_t sys ;
- syscall_out_t *psys_out = ( syscall_out_t* )&sys;
-
- sys.pathname = ( unsigned int )pathname;
-
- send_to_ppe_0x2101 (JSRE_UNLINK, &sys);
-
- errno = psys_out->err;
- return ( psys_out->rc);
-}
-
diff --git a/libgloss/spu/unlink.c b/libgloss/spu/unlink.c
new file mode 100644
index 000000000..c6a746e46
--- /dev/null
+++ b/libgloss/spu/unlink.c
@@ -0,0 +1,49 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+#include <errno.h>
+#include "jsre.h"
+
+int
+unlink (const char *pathname)
+{
+ syscall_unlink_t sys ;
+ syscall_out_t *psys_out = ( syscall_out_t* )&sys;
+
+ sys.pathname = ( unsigned int )pathname;
+
+ _send_to_ppe_0x2101 (JSRE_UNLINK, &sys);
+
+ errno = psys_out->err;
+ return ( psys_out->rc);
+}
+
diff --git a/libgloss/spu/write.c b/libgloss/spu/write.c
new file mode 100644
index 000000000..97f2174b5
--- /dev/null
+++ b/libgloss/spu/write.c
@@ -0,0 +1,52 @@
+/*
+(C) Copyright IBM Corp. 2005, 2006
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+ * Neither the name of IBM nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
+*/
+
+#include <fcntl.h>
+#include <errno.h>
+#include "jsre.h"
+
+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_0x2101 (JSRE_WRITE, &sys);
+
+ errno = psys_out->err;
+ return ( psys_out->rc);
+}
+