about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-11-05 19:58:06 +0000
committerUlrich Drepper <drepper@redhat.com>2002-11-05 19:58:06 +0000
commit5bfed16d69f287251f95d8ec35ec16068b453224 (patch)
treec48fff87996f6d42574a8812986149f5ad71c739 /sysdeps
parentf6e50e66ad9e75627caf800e0f0f24efac28e456 (diff)
downloadglibc-5bfed16d69f287251f95d8ec35ec16068b453224.tar.gz
glibc-5bfed16d69f287251f95d8ec35ec16068b453224.tar.xz
glibc-5bfed16d69f287251f95d8ec35ec16068b453224.zip
Update.
2002-11-05  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Handle
	__NR_pread64 and __NR_pwrite64.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/pread.c: Remove __NR_pread64
	and __NR_pwrite64.
	Revert change to use INLINE_SYSCALL.
	* sysdeps/unix/sysv/linux/powerpc/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/ftruncate64.c: Revert change to use
	INLINE_SYSCALL.
	* sysdeps/unix/sysv/linux/powerpc/truncate64.c: Likewise.

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (INLINE_SYSCALL):
	Update clobber list and add a comment about the syscall ABI.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/ftruncate64.c2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h25
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h18
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/pread.c9
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/pread64.c9
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/pwrite.c9
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/pwrite64.c9
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/truncate64.c2
8 files changed, 48 insertions, 35 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/ftruncate64.c b/sysdeps/unix/sysv/linux/powerpc/ftruncate64.c
index bb54b53f47..39f7d1fb59 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/ftruncate64.c
@@ -47,7 +47,7 @@ __ftruncate64 (fd, length)
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       int saved_errno = errno;
 #endif
-      int result = INLINE_SYSCALL (ftruncate64, 2, fd, length);
+      int result = __syscall_ftruncate64 (fd, length);
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       if (result != -1 || errno != ENOSYS)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index c0f04f1ddd..9389d5ca12 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -21,6 +21,24 @@
 
 #include <sysdeps/unix/powerpc/sysdep.h>
 
+/* Some systen calls got renamed over time, but retained the same semantics.
+   Handle them here so they can be catched by both C and assembler stubs in
+   glibc.  */
+
+#ifdef __NR_pread64
+# ifdef __NR_pread
+#  error "__NR_pread and __NR_pread64 both defined???"
+# endif
+# define __NR_pread __NR_pread64
+#endif
+
+#ifdef __NR_pwrite64
+# ifdef __NR_pwrite
+#  error "__NR_pwrite and __NR_pwrite64 both defined???"
+# endif
+# define __NR_pwrite __NR_pwrite64
+#endif
+
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
    of the kernel.  But these symbols do not follow the SYS_* syntax
@@ -36,6 +54,11 @@
 
 # include <errno.h>
 
+/* On powerpc a system call basically clobbers the same registers like a
+   function call, with the exception of LR (which is needed for the 
+   "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal
+   an error return status).  */
+
 # undef INLINE_SYSCALL
 # define INLINE_SYSCALL(name, nr, args...)				\
   ({									\
@@ -59,7 +82,7 @@
 	 "=&r" (r3), "=&r" (r4), "=&r" (r5),  "=&r" (r6),  "=&r" (r7),	\
 	 "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12)	\
        : ASM_INPUT_##nr							\
-       : "cc", "memory");						\
+       : "cr0", "ctr", "memory");					\
     err = r0;								\
     ret = r3;								\
     if (err & (1 << 28))						\
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 4031959df3..d56ff877ac 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -29,6 +29,24 @@
 #include <errno.h>
 #endif
 
+/* Some systen calls got renamed over time, but retained the same semantics.
+   Handle them here so they can be catched by both C and assembler stubs in
+   glibc.  */
+
+#ifdef __NR_pread64
+# ifdef __NR_pread
+#  error "__NR_pread and __NR_pread64 both defined???"
+# endif
+# define __NR_pread __NR_pread64
+#endif
+
+#ifdef __NR_pwrite64
+# ifdef __NR_pwrite
+#  error "__NR_pwrite and __NR_pwrite64 both defined???"
+# endif
+# define __NR_pwrite __NR_pwrite64
+#endif
+
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
    of the kernel.  But these symbols do not follow the SYS_* syntax
diff --git a/sysdeps/unix/sysv/linux/powerpc/pread.c b/sysdeps/unix/sysv/linux/powerpc/pread.c
index 48c476c28a..e5e3ed8bfe 100644
--- a/sysdeps/unix/sysv/linux/powerpc/pread.c
+++ b/sysdeps/unix/sysv/linux/powerpc/pread.c
@@ -24,13 +24,6 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
 #ifdef __NR_pread
 
 extern ssize_t __syscall_pread (int fd, void *buf, size_t count,
@@ -50,7 +43,7 @@ __libc_pread (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-  result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
+  result = __syscall_pread (fd, CHECK_N (buf, count), count, (off64_t) offset);
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
     result = __emulate_pread (fd, buf, count, offset);
diff --git a/sysdeps/unix/sysv/linux/powerpc/pread64.c b/sysdeps/unix/sysv/linux/powerpc/pread64.c
index 68ef8388e0..d6acb72b9d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/pread64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/pread64.c
@@ -24,13 +24,6 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
 #ifdef __NR_pread
 
 extern ssize_t __syscall_pread (int fd, void *buf, size_t count,
@@ -50,7 +43,7 @@ __libc_pread64 (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-  result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
+  result = __syscall_pread (fd, CHECK_N (buf, count), count, offset);
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
     result = __emulate_pread64 (fd, buf, count, offset);
diff --git a/sysdeps/unix/sysv/linux/powerpc/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/pwrite.c
index 3f3b79d0e3..7be7b44fef 100644
--- a/sysdeps/unix/sysv/linux/powerpc/pwrite.c
+++ b/sysdeps/unix/sysv/linux/powerpc/pwrite.c
@@ -24,13 +24,6 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
 #ifdef __NR_pwrite
 
 extern ssize_t __syscall_pwrite (int fd, const void *buf, size_t count,
@@ -50,7 +43,7 @@ __libc_pwrite (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-  result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
+  result = __syscall_pwrite (fd, CHECK_N (buf, count), count, (off64_t) offset);
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
     result = __emulate_pwrite (fd, buf, count, offset);
diff --git a/sysdeps/unix/sysv/linux/powerpc/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/pwrite64.c
index 038e7a77da..24ad56d1c0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/pwrite64.c
@@ -24,13 +24,6 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
 #ifdef __NR_pwrite
 
 extern ssize_t __syscall_pwrite (int fd, const void *buf, size_t count,
@@ -50,7 +43,7 @@ __libc_pwrite64 (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-  result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
+  result = __syscall_pwrite (fd, CHECK_N (buf, count), count, offset);
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
     result = __emulate_pwrite64 (fd, buf, count, offset);
diff --git a/sysdeps/unix/sysv/linux/powerpc/truncate64.c b/sysdeps/unix/sysv/linux/powerpc/truncate64.c
index cf76e5341b..3f5c581444 100644
--- a/sysdeps/unix/sysv/linux/powerpc/truncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/truncate64.c
@@ -48,7 +48,7 @@ truncate64 (path, length)
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       int saved_errno = errno;
 #endif
-      int result = INLINE_SYSCALL (truncate64, 2, CHECK_STRING (path), length);
+      int result = __syscall_truncate64 (CHECK_STRING (path), length);
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       if (result != -1 || errno != ENOSYS)