This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc 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]

GNU C Library master sources branch, master, updated. glibc-2.15-1009-gda0331a


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  da0331a873dbb62462c151c3d824da2f6fe2e770 (commit)
       via  31a39bd8410d366ee03b9e48e9d56b8099868f26 (commit)
      from  45470df3787aa9e97db24635b8b33066531430ad (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=da0331a873dbb62462c151c3d824da2f6fe2e770

commit da0331a873dbb62462c151c3d824da2f6fe2e770
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue May 22 12:43:46 2012 -0700

    Add x32 arch_prctl

diff --git a/ChangeLog b/ChangeLog
index 2682acc..7b41570 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile (sysdep_routines):
+	Add arch_prctl.
+	* sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c: New file.
+
 	* sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
 	(posix_fallocate): Use INTERNAL_SYSCALL_TYPES if it is defined.
 	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (INLINE_SYSCALL_TYPES):
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
index 5f77df7..aa78238 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
@@ -1,3 +1,7 @@
+ifeq ($(subdir),misc)
+sysdep_routines += arch_prctl
+endif
+
 ifeq ($(subdir),posix)
 sysdep_routines += getcpu sched_getcpu-static
 endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c b/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c
new file mode 100644
index 0000000..6933306
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c
@@ -0,0 +1,62 @@
+/* arch_prctl call for Linux/x32.
+   Copyright (C) 2012 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <sys/prctl.h>
+#include <sys/syscall.h>
+#include <sysdep.h>
+
+/* Since x32 arch_prctl stores 32-bit base address of segment registers
+   %fs and %gs as unsigned 64-bit value via ARCH_GET_FS and ARCH_GET_GS,
+   we use an unsigned 64-bit variable to hold the base address and copy
+   it to ADDR after the system call returns.  */
+
+int
+__arch_prctl (int code, uintptr_t *addr)
+{
+  int res;
+  uint64_t addr64;
+  void *prctl_arg = addr;
+
+  switch (code)
+    {
+    case ARCH_GET_FS:
+    case ARCH_GET_GS:
+      prctl_arg = &addr64;
+      break;
+    }
+
+  res = INLINE_SYSCALL (arch_prctl, 2, code, prctl_arg);
+  if (res == 0)
+    switch (code)
+      {
+      case ARCH_GET_FS:
+      case ARCH_GET_GS:
+	 /* Check for a large value that overflows.  */
+	if ((uintptr_t) addr64 != addr64)
+	  {
+	    __set_errno (EOVERFLOW);
+	    return -1;
+	  }
+	*addr = (uintptr_t) addr64;
+	break;
+      }
+
+  return res;
+}
+weak_alias (__arch_prctl, arch_prctl)

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=31a39bd8410d366ee03b9e48e9d56b8099868f26

commit 31a39bd8410d366ee03b9e48e9d56b8099868f26
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue May 22 12:42:36 2012 -0700

    Add INTERNAL_SYSCALL_TYPES

diff --git a/ChangeLog b/ChangeLog
index 7988544..2682acc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-05-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
+	(posix_fallocate): Use INTERNAL_SYSCALL_TYPES if it is defined.
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (INLINE_SYSCALL_TYPES):
+	New macro.
+	(INTERNAL_SYSCALL_NCS_TYPES): Likewise.
+	(INTERNAL_SYSCALL_TYPES): Likewise.
+	(LOAD_ARGS_TYPES_[1-6]): Likewise.
+	(LOAD_REGS_TYPES_[1-6]): Likewise.
+	(LOAD_ARGS_[1-6]): Use LOAD_ARGS_TYPES_[1-6].
+	(LOAD_REGS_[1-6]): Use LOAD_REGS_TYPES_[1-6].
+
 2012-05-22  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 
 	* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Add compat symbol
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
index 906b5c2..f791422 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
@@ -38,7 +38,13 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
 # endif
     {
       INTERNAL_SYSCALL_DECL (err);
+# ifdef INTERNAL_SYSCALL_TYPES
+      int res = INTERNAL_SYSCALL_TYPES (fallocate, err, 4, int, fd,
+					int, 0, off_t, offset,
+					off_t, len);
+# else
       int res = INTERNAL_SYSCALL (fallocate, err, 4, fd, 0, offset, len);
+# endif
 
       if (! INTERNAL_SYSCALL_ERROR_P (res, err))
 	return 0;
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 396345e..cde8652 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -203,6 +203,20 @@
       }									      \
     (long int) resultvar; })
 
+/* Define a macro with explicit types for arguments, which expands inline
+   into the wrapper code for a system call.  It should be used when size
+   of any argument > size of long int.  */
+# undef INLINE_SYSCALL_TYPES
+# define INLINE_SYSCALL_TYPES(name, nr, args...) \
+  ({									      \
+    unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args);  \
+    if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))	      \
+      {									      \
+	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		      \
+	resultvar = (unsigned long int) -1;				      \
+      }									      \
+    (long int) resultvar; })
+
 # undef INTERNAL_SYSCALL_DECL
 # define INTERNAL_SYSCALL_DECL(err) do { } while (0)
 
@@ -220,6 +234,20 @@
 # define INTERNAL_SYSCALL(name, err, nr, args...) \
   INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
 
+# define INTERNAL_SYSCALL_NCS_TYPES(name, err, nr, args...) \
+  ({									      \
+    unsigned long int resultvar;					      \
+    LOAD_ARGS_TYPES_##nr (args)						      \
+    LOAD_REGS_TYPES_##nr (args)						      \
+    asm volatile (							      \
+    "syscall\n\t"							      \
+    : "=a" (resultvar)							      \
+    : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");		      \
+    (long int) resultvar; })
+# undef INTERNAL_SYSCALL_TYPES
+# define INTERNAL_SYSCALL_TYPES(name, err, nr, args...) \
+  INTERNAL_SYSCALL_NCS_TYPES (__NR_##name, err, nr, ##args)
+
 # undef INTERNAL_SYSCALL_ERROR_P
 # define INTERNAL_SYSCALL_ERROR_P(val, err) \
   ((unsigned long int) (long int) (val) >= -4095L)
@@ -286,53 +314,83 @@
 # define LOAD_REGS_0
 # define ASM_ARGS_0
 
-# define LOAD_ARGS_1(a1)				\
-  long int __arg1 = (long int) (a1);			\
+# define LOAD_ARGS_TYPES_1(t1, a1)					   \
+  t1 __arg1 = (t1) (a1);						   \
   LOAD_ARGS_0 ()
-# define LOAD_REGS_1					\
-  register long int _a1 asm ("rdi") = __arg1;		\
+# define LOAD_REGS_TYPES_1(t1, a1)					   \
+  register t1 _a1 asm ("rdi") = __arg1;					   \
   LOAD_REGS_0
 # define ASM_ARGS_1	ASM_ARGS_0, "r" (_a1)
-
-# define LOAD_ARGS_2(a1, a2)				\
-  long int __arg2 = (long int) (a2);			\
-  LOAD_ARGS_1 (a1)
-# define LOAD_REGS_2					\
-  register long int _a2 asm ("rsi") = __arg2;		\
-  LOAD_REGS_1
+# define LOAD_ARGS_1(a1)						   \
+  LOAD_ARGS_TYPES_1 (long int, a1)
+# define LOAD_REGS_1							   \
+  LOAD_REGS_TYPES_1 (long int, a1)
+
+# define LOAD_ARGS_TYPES_2(t1, a1, t2, a2)				   \
+  t2 __arg2 = (t2) (a2);						   \
+  LOAD_ARGS_TYPES_1 (t1, a1)
+# define LOAD_REGS_TYPES_2(t1, a1, t2, a2)				   \
+  register t2 _a2 asm ("rsi") = __arg2;					   \
+  LOAD_REGS_TYPES_1(t1, a1)
 # define ASM_ARGS_2	ASM_ARGS_1, "r" (_a2)
-
-# define LOAD_ARGS_3(a1, a2, a3)			\
-  long int __arg3 = (long int) (a3);			\
-  LOAD_ARGS_2 (a1, a2)
-# define LOAD_REGS_3					\
-  register long int _a3 asm ("rdx") = __arg3;		\
-  LOAD_REGS_2
+# define LOAD_ARGS_2(a1, a2)						   \
+  LOAD_ARGS_TYPES_2 (long int, a1, long int, a2)
+# define LOAD_REGS_2							   \
+  LOAD_REGS_TYPES_2 (long int, a1, long int, a2)
+
+# define LOAD_ARGS_TYPES_3(t1, a1, t2, a2, t3, a3)			   \
+  t3 __arg3 = (t3) (a3);						   \
+  LOAD_ARGS_TYPES_2 (t1, a1, t2, a2)
+# define LOAD_REGS_TYPES_3(t1, a1, t2, a2, t3, a3)			   \
+  register t3 _a3 asm ("rdx") = __arg3;					   \
+  LOAD_REGS_TYPES_2(t1, a1, t2, a2)
 # define ASM_ARGS_3	ASM_ARGS_2, "r" (_a3)
-
-# define LOAD_ARGS_4(a1, a2, a3, a4)			\
-  long int __arg4 = (long int) (a4);			\
-  LOAD_ARGS_3 (a1, a2, a3)
-# define LOAD_REGS_4					\
-  register long int _a4 asm ("r10") = __arg4;		\
-  LOAD_REGS_3
+# define LOAD_ARGS_3(a1, a2, a3)					   \
+  LOAD_ARGS_TYPES_3 (long int, a1, long int, a2, long int, a3)
+# define LOAD_REGS_3							   \
+  LOAD_REGS_TYPES_3 (long int, a1, long int, a2, long int, a3)
+
+# define LOAD_ARGS_TYPES_4(t1, a1, t2, a2, t3, a3, t4, a4)		   \
+  t4 __arg4 = (t4) (a4);						   \
+  LOAD_ARGS_TYPES_3 (t1, a1, t2, a2, t3, a3)
+# define LOAD_REGS_TYPES_4(t1, a1, t2, a2, t3, a3, t4, a4)		   \
+  register t4 _a4 asm ("r10") = __arg4;					   \
+  LOAD_REGS_TYPES_3(t1, a2, t2, a2, t3, a3)
 # define ASM_ARGS_4	ASM_ARGS_3, "r" (_a4)
-
-# define LOAD_ARGS_5(a1, a2, a3, a4, a5)		\
-  long int __arg5 = (long int) (a5);			\
-  LOAD_ARGS_4 (a1, a2, a3, a4)
-# define LOAD_REGS_5					\
-  register long int _a5 asm ("r8") = __arg5;		\
-  LOAD_REGS_4
+# define LOAD_ARGS_4(a1, a2, a3, a4)					   \
+  LOAD_ARGS_TYPES_4 (long int, a1, long int, a2, long int, a3,		   \
+		     long int, a4)
+# define LOAD_REGS_4							   \
+  LOAD_REGS_TYPES_4 (long int, a1, long int, a2, long int, a3,		   \
+		     long int, a4)
+
+# define LOAD_ARGS_TYPES_5(t1, a1, t2, a2, t3, a3, t4, a4, t5, a5)	   \
+  t5 __arg5 = (t5) (a5);						   \
+  LOAD_ARGS_TYPES_4 (t1, a1, t2, a2, t3, a3, t4, a4)
+# define LOAD_REGS_TYPES_5(t1, a1, t2, a2, t3, a3, t4, a4, t5, a5)	   \
+  register t5 _a5 asm ("r8") = __arg5;					   \
+  LOAD_REGS_TYPES_4 (t1, a1, t2, a2, t3, a3, t4, a4)
 # define ASM_ARGS_5	ASM_ARGS_4, "r" (_a5)
-
-# define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)		\
-  long int __arg6 = (long int) (a6);			\
-  LOAD_ARGS_5 (a1, a2, a3, a4, a5)
-# define LOAD_REGS_6					\
-  register long int _a6 asm ("r9") = __arg6;		\
-  LOAD_REGS_5
+# define LOAD_ARGS_5(a1, a2, a3, a4, a5)				   \
+  LOAD_ARGS_TYPES_5 (long int, a1, long int, a2, long int, a3,		   \
+		     long int, a4, long int, a5)
+# define LOAD_REGS_5							   \
+  LOAD_REGS_TYPES_5 (long int, a1, long int, a2, long int, a3,		   \
+		     long int, a4, long int, a5)
+
+# define LOAD_ARGS_TYPES_6(t1, a1, t2, a2, t3, a3, t4, a4, t5, a5, t6, a6) \
+  t6 __arg6 = (t6) (a6);						   \
+  LOAD_ARGS_TYPES_5 (t1, a1, t2, a2, t3, a3, t4, a4, t5, a5)
+# define LOAD_REGS_TYPES_6(t1, a1, t2, a2, t3, a3, t4, a4, t5, a5, t6, a6) \
+  register t6 _a6 asm ("r9") = __arg6;					   \
+  LOAD_REGS_TYPES_5 (t1, a1, t2, a2, t3, a3, t4, a4, t5, a5)
 # define ASM_ARGS_6	ASM_ARGS_5, "r" (_a6)
+# define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)				   \
+  LOAD_ARGS_TYPES_6 (long int, a1, long int, a2, long int, a3,		   \
+		     long int, a4, long int, a5, long int, a6)
+# define LOAD_REGS_6							   \
+  LOAD_REGS_TYPES_6 (long int, a1, long int, a2, long int, a3,		   \
+		     long int, a4, long int, a5, long int, a6)
 
 #endif	/* __ASSEMBLER__ */
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   17 +++
 .../unix/sysv/linux/wordsize-64/posix_fallocate.c  |    6 +
 sysdeps/unix/sysv/linux/x86_64/sysdep.h            |  136 ++++++++++++++------
 sysdeps/unix/sysv/linux/x86_64/x32/Makefile        |    4 +
 sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c    |   62 +++++++++
 5 files changed, 186 insertions(+), 39 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c


hooks/post-receive
-- 
GNU C Library master sources


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