about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-17 06:56:24 +0000
committerRoland McGrath <roland@gnu.org>2002-09-17 06:56:24 +0000
commit735d67f2f832234be907c48866edb821b76b87c4 (patch)
treeb2867e0fa54f368e855226542d765c19d369b615 /sysdeps
parent4874b009bd4c92e46bd9bd2be1d4c4e0a7c4516e (diff)
downloadglibc-735d67f2f832234be907c48866edb821b76b87c4.tar.gz
glibc-735d67f2f832234be907c48866edb821b76b87c4.tar.xz
glibc-735d67f2f832234be907c48866edb821b76b87c4.zip
* sysdeps/unix/sysv/linux/powerpc/mmap64.c (__mmap64): Add a cast.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (INLINE_SYSCALL):
	New macro.

	* elf/rtld.c [HP_TIMING_NONAVAIL]: Fix last change for this case.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/mmap64.c9
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h57
2 files changed, 61 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/mmap64.c b/sysdeps/unix/sysv/linux/powerpc/mmap64.c
index d94deb040f..63f32e9908 100644
--- a/sysdeps/unix/sysv/linux/powerpc/mmap64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/mmap64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,01,02 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -56,9 +56,10 @@ __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset)
       int saved_errno = errno;
 # endif
       void *result;
-      __ptrvalue (result) = INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), len,
-					    prot, flags, fd,
-					    (off_t) (offset >> PAGE_SHIFT));
+      __ptrvalue (result)
+	= (void *) INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), len,
+				   prot, flags, fd,
+				   (off_t) (offset >> PAGE_SHIFT));
 # if __BOUNDED_POINTERS__
       __ptrlow (result) = __ptrvalue (result);
       __ptrhigh (result) = __ptrvalue (result) + len;
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index 78ff4edcc6..524a32b9b4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1992,97,98,99,2000,01,02 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -32,4 +32,59 @@
 # define SYS_ify(syscall_name)	__NR_/**/syscall_name
 #endif
 
+#ifndef __ASSEMBLER__
+
+# include <errno.h>
+
+# undef INLINE_SYSCALL
+# define INLINE_SYSCALL(name, nr, args...)	\
+  ({						\
+    long ret, err;				\
+    LOADARGS_##nr(name, args);			\
+    __asm__ ("sc\n\t"				\
+	     "mfcr	%1\n\t"			\
+	     : "=r" (r3), "=r" (err)		\
+	     : ASM_INPUT_##nr			\
+	     : "cc", "memory");			\
+    ret = r3;					\
+    if (err & 1 << 28)				\
+      {						\
+	__set_errno (ret);			\
+	ret = -1L;				\
+      }						\
+    ret;					\
+  })
+
+# define LOADARGS_0(name) \
+	register long r0 __asm__ ("r0") = __NR_##name; \
+	register long r3 __asm__ ("r3")
+# define LOADARGS_1(name, arg1) \
+	LOADARGS_0(name) = (long) (arg1)
+# define LOADARGS_2(name, arg1, arg2) \
+	LOADARGS_1(name, arg1); \
+	register long r4 __asm__ ("r4") = (long) (arg2)
+# define LOADARGS_3(name, arg1, arg2, arg3) \
+	LOADARGS_2(name, arg1, arg2); \
+	register long r5 __asm__ ("r5") = (long) (arg3)
+# define LOADARGS_4(name, arg1, arg2, arg3, arg4) \
+	LOADARGS_3(name, arg1, arg2, arg3); \
+	register long r6 __asm__ ("r6") = (long) (arg4)
+# define LOADARGS_5(name, arg1, arg2, arg3, arg4, arg5) \
+	LOADARGS_4(name, arg1, arg2, arg3, arg4); \
+	register long r7 __asm__ ("r7") = (long) (arg5)
+# define LOADARGS_6(name, arg1, arg2, arg3, arg4, arg5, arg6) \
+	LOADARGS_5(name, arg1, arg2, arg3, arg4, arg5); \
+	register long r8 __asm__ ("r8") = (long) (arg6)
+
+# define ASM_INPUT_0 "r" (r0)
+# define ASM_INPUT_1 ASM_INPUT_0, "0" (r3)
+# define ASM_INPUT_2 ASM_INPUT_1, "r" (r4)
+# define ASM_INPUT_3 ASM_INPUT_2, "r" (r5)
+# define ASM_INPUT_4 ASM_INPUT_3, "r" (r6)
+# define ASM_INPUT_5 ASM_INPUT_4, "r" (r7)
+# define ASM_INPUT_6 ASM_INPUT_5, "r" (r8)
+
+#endif /* __ASSEMBLER__ */
+
+
 #endif /* linux/powerpc/sysdep.h */