[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r10240 - in /fsf/trunk/libc: ./ elf/ stdlib/ sysdeps/unix/sysv/linux/s390/s390-32/ sysdeps/unix/sysv/linux/s390/s390-64/ sys...



Author: eglibc
Date: Wed Apr 14 00:03:27 2010
New Revision: 10240

Log:
Import glibc-mainline for 2010-04-14

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/elf/elf.h
    fsf/trunk/libc/stdlib/tst-makecontext3.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
    fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Apr 14 00:03:27 2010
@@ -1,3 +1,24 @@
+2010-04-13  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/init-arch.h: Pretty printing.
+	Add SSE 4.1 macros.
+
+2010-04-10  Matt Fleming  <matt@xxxxxxxxxxxxxxxxx>
+
+	* elf/elf.h: Add SH specific ELF header flags.
+
+2010-04-13  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c: Fix setup of
+	overflow area.
+	* sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c: Likewise.
+
+2010-04-12  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* stdlib/tst-makecontext3.c (main): Initialize ucontext_t objects
+	only with getcontext.  Test for unimplemented makecontext by
+	checking errno.
+
 2010-04-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* nscd/aicache.c (addhstaiX): Correct passing memory to address

Modified: fsf/trunk/libc/elf/elf.h
==============================================================================
--- fsf/trunk/libc/elf/elf.h (original)
+++ fsf/trunk/libc/elf/elf.h Wed Apr 14 00:03:27 2010
@@ -2477,6 +2477,30 @@
 
 /* SH specific declarations */
 
+/* Processor specific flags for the ELF header e_flags field.  */
+#define EF_SH_MACH_MASK		0x1f
+#define EF_SH_UNKNOWN		0x0
+#define EF_SH1			0x1
+#define EF_SH2			0x2
+#define EF_SH3			0x3
+#define EF_SH_DSP		0x4
+#define EF_SH3_DSP		0x5
+#define EF_SH4AL_DSP		0x6
+#define EF_SH3E			0x8
+#define EF_SH4			0x9
+#define EF_SH2E			0xb
+#define EF_SH4A			0xc
+#define EF_SH2A			0xd
+#define EF_SH4_NOFPU		0x10
+#define EF_SH4A_NOFPU		0x11
+#define EF_SH4_NOMMU_NOFPU	0x12
+#define EF_SH2A_NOFPU		0x13
+#define EF_SH3_NOMMU		0x14
+#define EF_SH2A_SH4_NOFPU	0x15
+#define EF_SH2A_SH3_NOFPU	0x16
+#define EF_SH2A_SH4		0x17
+#define EF_SH2A_SH3E		0x18
+
 /* SH relocs.  */
 #define	R_SH_NONE		0
 #define	R_SH_DIR32		1

Modified: fsf/trunk/libc/stdlib/tst-makecontext3.c
==============================================================================
--- fsf/trunk/libc/stdlib/tst-makecontext3.c (original)
+++ fsf/trunk/libc/stdlib/tst-makecontext3.c Wed Apr 14 00:03:27 2010
@@ -136,38 +136,42 @@
       exit (1);
     }
 
-  ctx[1] = ctx[0];
+  if (getcontext (&ctx[1]) != 0)
+    {
+      printf ("%s: getcontext: %m\n", __FUNCTION__);
+      exit (1);
+    }
+
   ctx[1].uc_stack.ss_sp = st1;
   ctx[1].uc_stack.ss_size = sizeof st1;
   ctx[1].uc_link = &ctx[0];
-  {
-    ucontext_t tempctx = ctx[1];
-    makecontext (&ctx[1], (void (*) (void)) f1, 33,
-		 0x00000001 << flag, 0x00000004 << flag,
-		 0x00000012 << flag, 0x00000048 << flag,
-		 0x00000123 << flag, 0x0000048d << flag,
-		 0x00001234 << flag, 0x000048d1 << flag,
-		 0x00012345 << flag, 0x00048d15 << flag,
-		 0x00123456 << flag, 0x0048d159 << flag,
-		 0x01234567 << flag, 0x048d159e << flag,
-		 0x12345678 << flag, 0x48d159e2 << flag,
-		 0x23456789 << flag, 0x8d159e26 << flag,
-		 0x3456789a << flag, 0xd159e26a << flag,
-		 0x456789ab << flag, 0x159e26af << flag,
-		 0x56789abc << flag, 0x59e26af3 << flag,
-		 0x6789abcd << flag, 0x9e26af37 << flag,
-		 0x789abcde << flag, 0xe26af37b << flag,
-		 0x89abcdef << flag, 0x26af37bc << flag,
-		 0x9abcdef0 << flag, 0x6af37bc3 << flag,
-		 0xabcdef0f << flag);
-
-    /* Without this check, a stub makecontext can make us spin forever.  */
-    if (memcmp (&tempctx, &ctx[1], sizeof ctx[1]) == 0)
-      {
-	puts ("makecontext was a no-op, presuming not implemented");
-	return 0;
-      }
-  }
+  errno = 0;
+  makecontext (&ctx[1], (void (*) (void)) f1, 33,
+	       0x00000001 << flag, 0x00000004 << flag,
+	       0x00000012 << flag, 0x00000048 << flag,
+	       0x00000123 << flag, 0x0000048d << flag,
+	       0x00001234 << flag, 0x000048d1 << flag,
+	       0x00012345 << flag, 0x00048d15 << flag,
+	       0x00123456 << flag, 0x0048d159 << flag,
+	       0x01234567 << flag, 0x048d159e << flag,
+	       0x12345678 << flag, 0x48d159e2 << flag,
+	       0x23456789 << flag, 0x8d159e26 << flag,
+	       0x3456789a << flag, 0xd159e26a << flag,
+	       0x456789ab << flag, 0x159e26af << flag,
+	       0x56789abc << flag, 0x59e26af3 << flag,
+	       0x6789abcd << flag, 0x9e26af37 << flag,
+	       0x789abcde << flag, 0xe26af37b << flag,
+	       0x89abcdef << flag, 0x26af37bc << flag,
+	       0x9abcdef0 << flag, 0x6af37bc3 << flag,
+	       0xabcdef0f << flag);
+
+  /* Without this check, a stub makecontext can make us spin forever.  */
+  if (errno == ENOSYS)
+    {
+      puts ("makecontext not implemented");
+      back_in_main = 1;
+      return 0;
+    }
 
   /* Play some tricks with this context.  */
   if (++global == 1)

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c Wed Apr 14 00:03:27 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky (schwidefsky@xxxxxxxxxx).
 
@@ -28,15 +28,15 @@
    double, complex and structure with sizes 0, 2, 4 or 8
    won't work.
    makecontext sets up a stack and the registers for the
-   context. The stack looks like this:
-           size                         offset
+   user context. The stack looks like this:
+	   size                         offset
     %r15 ->    +-----------------------+
-             4 | back chain (zero)     |  0
-             4 | reserved              |  4
-            88 | save area for (*func) |  8
-               +-----------------------+
-             n | overflow parameters   | 96
-               +-----------------------+
+	     4 | back chain (zero)     |  0
+	     4 | reserved              |  4
+	    88 | save area for (*func) |  8
+	       +-----------------------+
+	     n | overflow parameters   | 96
+	       +-----------------------+
    The registers are set up like this:
      %r2-%r6: parameters 1 to 5
      %r7    : (*func) pointer
@@ -54,27 +54,27 @@
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
   extern void __makecontext_ret (void);
-  unsigned long *sp;
+  unsigned long int *sp;
   va_list ap;
-  int i;
 
-  sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
-			   + ucp->uc_stack.ss_size) & -8L);
+  sp = (unsigned long int *) (((unsigned long int) ucp->uc_stack.ss_sp
+			       + ucp->uc_stack.ss_size) & -8L);
 
   /* Set the return address to trampoline.  */
-  ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
+  ucp->uc_mcontext.gregs[14] = (long int) __makecontext_ret;
 
   /* Set register parameters.  */
   va_start (ap, argc);
-  for (i = 0; (i < argc) && (i < 5); i++)
-    ucp->uc_mcontext.gregs[2+i] = va_arg (ap, long);
+  for (int i = 0; i < argc && i < 5; ++i)
+    ucp->uc_mcontext.gregs[2 + i] = va_arg (ap, long int);
 
   /* The remaining arguments go to the overflow area.  */
-  if (argc > 5) {
-    sp -= argc - 5;
-    for (i = 5; i < argc; i++)
-      sp[i] = va_arg(ap, long);
-  }
+  if (argc > 5)
+    {
+      sp -= argc - 5;
+      for (int i = 5; i < argc; ++i)
+	sp[i - 5] = va_arg (ap, long int);
+    }
   va_end (ap);
 
   /* Make room for the save area and set the backchain.  */
@@ -82,24 +82,24 @@
   *sp = 0;
 
   /* Pass (*func) to __start_context in %r7.  */
-  ucp->uc_mcontext.gregs[7] = (long) func;
+  ucp->uc_mcontext.gregs[7] = (long int) func;
 
   /* Pass ucp->uc_link to __start_context in %r8.  */
-  ucp->uc_mcontext.gregs[8] = (long) ucp->uc_link;
+  ucp->uc_mcontext.gregs[8] = (long int) ucp->uc_link;
 
   /* Pass address of setcontext in %r9.  */
-  ucp->uc_mcontext.gregs[9] = (long) &setcontext;
+  ucp->uc_mcontext.gregs[9] = (long int) &setcontext;
 
   /* Set stack pointer.  */
-  ucp->uc_mcontext.gregs[15] = (long) sp;
+  ucp->uc_mcontext.gregs[15] = (long int) sp;
 }
 
-asm(".text\n"
-    ".type __makecontext_ret,@function\n"
-    "__makecontext_ret:\n"
-    "      basr  %r14,%r7\n"
-    "      lr    %r2,%r8\n"
-    "      br    %r9\n"
-    ".size __makecontext_ret, .-__makecontext_ret");
+asm (".text\n"
+     ".type __makecontext_ret,@function\n"
+     "__makecontext_ret:\n"
+     "      basr  %r14,%r7\n"
+     "      lr    %r2,%r8\n"
+     "      br    %r9\n"
+     ".size __makecontext_ret, .-__makecontext_ret");
 
 weak_alias (__makecontext, makecontext)

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c Wed Apr 14 00:03:27 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky (schwidefsky@xxxxxxxxxx).
 
@@ -29,14 +29,14 @@
    won't work.
    makecontext sets up a stack and the registers for the
    user context. The stack looks like this:
-           size                         offset
+	   size                         offset
     %r15 ->    +-----------------------+
-             8 | back chain (zero)     |  0
-             8 | reserved              |  8
-           144 | save area for (*func) | 16
-               +-----------------------+
-             n | overflow parameters   | 160
-               +-----------------------+
+	     8 | back chain (zero)     |  0
+	     8 | reserved              |  8
+	   144 | save area for (*func) | 16
+	       +-----------------------+
+	     n | overflow parameters   | 160
+	       +-----------------------+
    The registers are set up like this:
      %r2-%r6: parameters 1 to 5
      %r7    : (*func) pointer
@@ -54,27 +54,27 @@
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
   extern void __makecontext_ret (void);
-  unsigned long *sp;
+  unsigned long int *sp;
   va_list ap;
-  int i;
 
-  sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
-			   + ucp->uc_stack.ss_size) & -8L);
+  sp = (unsigned long int *) (((unsigned long int) ucp->uc_stack.ss_sp
+			       + ucp->uc_stack.ss_size) & -8L);
 
   /* Set the return address to trampoline.  */
-  ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
+  ucp->uc_mcontext.gregs[14] = (long int) __makecontext_ret;
 
   /* Set register parameters.  */
   va_start (ap, argc);
-  for (i = 0; (i < argc) && (i < 5); i++)
-    ucp->uc_mcontext.gregs[2+i] = va_arg (ap, long);
+  for (int i = 0; i < argc && i < 5; ++i)
+    ucp->uc_mcontext.gregs[2 + i] = va_arg (ap, long int);
 
   /* The remaining arguments go to the overflow area.  */
-  if (argc > 5) {
-    sp -= argc - 5;
-    for (i = 5; i < argc; i++)
-      sp[i] = va_arg(ap, long);
-  }
+  if (argc > 5)
+    {
+      sp -= argc - 5;
+      for (int i = 5; i < argc; ++i)
+	sp[i - 5] = va_arg (ap, long int);
+    }
   va_end (ap);
 
   /* Make room for the save area and set the backchain.  */
@@ -82,24 +82,24 @@
   *sp = 0;
 
   /* Pass (*func) to __start_context in %r7.  */
-  ucp->uc_mcontext.gregs[7] = (long) func;
+  ucp->uc_mcontext.gregs[7] = (long int) func;
 
   /* Pass ucp->uc_link to __start_context in %r8.  */
-  ucp->uc_mcontext.gregs[8] = (long) ucp->uc_link;
+  ucp->uc_mcontext.gregs[8] = (long int) ucp->uc_link;
 
   /* Pass address of setcontext in %r9.  */
-  ucp->uc_mcontext.gregs[9] = (long) &setcontext;
+  ucp->uc_mcontext.gregs[9] = (long int) &setcontext;
 
   /* Set stack pointer.  */
-  ucp->uc_mcontext.gregs[15] = (long) sp;
+  ucp->uc_mcontext.gregs[15] = (long int) sp;
 }
 
-asm(".text\n"
-    ".type __makecontext_ret,@function\n"
-    "__makecontext_ret:\n"
-    "      basr  %r14,%r7\n"
-    "      lgr   %r2,%r8\n"
-    "      br    %r9\n"
-    ".size __makecontext_ret, .-__makecontext_ret");
+asm (".text\n"
+     ".type __makecontext_ret,@function\n"
+     "__makecontext_ret:\n"
+     "      basr  %r14,%r7\n"
+     "      lgr   %r2,%r8\n"
+     "      br    %r9\n"
+     ".size __makecontext_ret, .-__makecontext_ret");
 
 weak_alias (__makecontext, makecontext)

Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h Wed Apr 14 00:03:27 2010
@@ -20,21 +20,23 @@
 
 #ifdef	__ASSEMBLER__
 
-#include <ifunc-defines.h>
+# include <ifunc-defines.h>
 
-#define bit_SSE2	(1 << 26)
-#define bit_SSSE3	(1 << 9)
-#define bit_SSE4_2	(1 << 20)
+# define bit_SSE2	(1 << 26)
+# define bit_SSSE3	(1 << 9)
+# define bit_SSE4_1	(1 << 19)
+# define bit_SSE4_2	(1 << 20)
 
-#define index_SSE2	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_EDX_OFFSET
-#define index_SSSE3	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
-#define index_SSE4_2	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
+# define index_SSE2	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_EDX_OFFSET
+# define index_SSSE3	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
+# define index_SSE4_1	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
+# define index_SSE4_2	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
 
 #define index_Fast_Rep_String	FEATURE_INDEX_1*FEATURE_SIZE
 
 #else	/* __ASSEMBLER__ */
 
-#include <sys/param.h>
+# include <sys/param.h>
 
 enum
   {
@@ -84,20 +86,22 @@
 extern const struct cpu_features *__get_cpu_features (void)
      __attribute__ ((const));
 
-#ifndef NOT_IN_libc
-# define __get_cpu_features()	(&__cpu_features)
-#endif
+# ifndef NOT_IN_libc
+#  define __get_cpu_features()	(&__cpu_features)
+# endif
 
-#define HAS_CPU_FEATURE(idx, reg, bit) \
+# define HAS_CPU_FEATURE(idx, reg, bit) \
   ((__get_cpu_features ()->cpuid[idx].reg & (1 << (bit))) != 0)
 
 /* Following are the feature tests used throughout libc.  */
 
-#define HAS_SSE2	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, edx, 26)
-#define HAS_POPCOUNT	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 23)
-#define HAS_SSE4_2	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 20)
-#define HAS_FMA		HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 12)
+# define HAS_SSE2	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, edx, 26)
+# define HAS_POPCOUNT	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 23)
+# define HAS_SSSE3	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 9)
+# define HAS_SSE4_1	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 19)
+# define HAS_SSE4_2	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 20)
+# define HAS_FMA	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 12)
 
-#define index_Fast_Rep_String	FEATURE_INDEX_1
+# define index_Fast_Rep_String	FEATURE_INDEX_1
 
 #endif	/* __ASSEMBLER__ */