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

[commits] r8511 - in /fsf/trunk/libc: ./ sysdeps/ieee754/ldbl-128/ sysdeps/s390/s390-32/ sysdeps/s390/s390-64/ sysdeps/unix/sysv/linux...



Author: eglibc
Date: Sat May 30 00:10:52 2009
New Revision: 8511

Log:
Import glibc-mainline for 2009-05-30

Added:
    fsf/trunk/libc/sysdeps/s390/s390-32/____longjmp_chk.c
    fsf/trunk/libc/sysdeps/s390/s390-64/____longjmp_chk.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_cosl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_expm1l.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_sinl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_tanl.c
    fsf/trunk/libc/sysdeps/s390/s390-32/__longjmp.c
    fsf/trunk/libc/sysdeps/s390/s390-64/__longjmp.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sysconf.c
    fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat May 30 00:10:52 2009
@@ -1,3 +1,28 @@
+2009-05-29  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/ieee754/ldbl-128/s_expm1l.c: Include <errno.h>.
+	(__expm1l): Set errno to ERANGE on overflow.
+	* sysdeps/ieee754/ldbl-128/s_tanl.c: Include <errno.h>.
+	(__tanl): Set errno to EDOM for ±Inf.
+	* sysdeps/ieee754/ldbl-128/s_cosl.c: Include <errno.h>.
+	(__cosl): Set errno to EDOM for ±Inf.
+	* sysdeps/ieee754/ldbl-128/s_sinl.c: Include <errno.h>.
+	(__sinl): Set errno to EDOM for ±Inf.
+
+2009-05-29  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/s390/s390-32/__longjmp.c (__longjmp): If CHECK_SP is
+	defined, use it.
+	* sysdeps/s390/s390-64/__longjmp.c (__longjmp): Likewise.
+	* sysdeps/s390/s390-32/____longjmp_chk.c: New file.
+	* sysdeps/s390/s390-64/____longjmp_chk.c: New file.
+
+2009-05-29  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/cacheinfo.c: Compact intel_02_known array.  Adjust
+	code accessing it.
+	* sysdeps/unix/sysv/linux/i386/sysconf.c: Likewise.
+
 2009-05-22  Andreas Schwab  <schwab@xxxxxxxxxxxxxx>
 
 	* sysdeps/ieee754/ldbl-128ibm/s_sinl.c: Set errno for ±Inf.

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_cosl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_cosl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_cosl.c Sat May 30 00:10:52 2009
@@ -44,6 +44,7 @@
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -66,7 +67,14 @@
 	  return __kernel_cosl(x,z);
 
     /* cos(Inf or NaN) is NaN */
-	else if (ix>=0x7fff000000000000LL) return x-x;
+	else if (ix>=0x7fff000000000000LL) {
+	    if (ix == 0x7fff000000000000LL) {
+		GET_LDOUBLE_LSW64(n,x);
+		if (n == 0)
+		    __set_errno (EDOM);
+	    }
+	    return x-x;
+	}
 
     /* argument reduction needed */
 	else {

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_expm1l.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_expm1l.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_expm1l.c Sat May 30 00:10:52 2009
@@ -53,6 +53,7 @@
 
 
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -121,7 +122,10 @@
 
   /* Overflow.  */
   if (x > maxlog)
-    return (big * big);
+    {
+      __set_errno (ERANGE);
+      return (big * big);
+    }
 
   /* Minimum value.  */
   if (x < minarg)

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_sinl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_sinl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_sinl.c Sat May 30 00:10:52 2009
@@ -44,6 +44,7 @@
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -66,7 +67,14 @@
 	  return __kernel_sinl(x,z,0);
 
     /* sin(Inf or NaN) is NaN */
-	else if (ix>=0x7fff000000000000LL) return x-x;
+	else if (ix>=0x7fff000000000000LL) {
+	    if (ix == 0x7fff000000000000LL) {
+		GET_LDOUBLE_LSW64(n,x);
+		if (n == 0)
+		    __set_errno (EDOM);
+	    }
+	    return x-x;
+	}
 
     /* argument reduction needed */
 	else {

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_tanl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_tanl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128/s_tanl.c Sat May 30 00:10:52 2009
@@ -44,6 +44,7 @@
  *	TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -65,7 +66,14 @@
 	if(ix <= 0x3ffe921fb54442d1LL) return __kernel_tanl(x,z,1);
 
     /* tanl(Inf or NaN) is NaN */
-	else if (ix>=0x7fff000000000000LL) return x-x;		/* NaN */
+	else if (ix>=0x7fff000000000000LL) {
+	    if (ix == 0x7fff000000000000LL) {
+		GET_LDOUBLE_LSW64(n,x);
+		if (n == 0)
+		    __set_errno (EDOM);
+	    }
+	    return x-x;		/* NaN */
+	}
 
     /* argument reduction needed */
 	else {

Added: fsf/trunk/libc/sysdeps/s390/s390-32/____longjmp_chk.c
==============================================================================
--- fsf/trunk/libc/sysdeps/s390/s390-32/____longjmp_chk.c (added)
+++ fsf/trunk/libc/sysdeps/s390/s390-32/____longjmp_chk.c Sat May 30 00:10:52 2009
@@ -1,0 +1,41 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sysdep.h>
+#include <setjmp.h>
+#include <bits/setjmp.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#define __longjmp ____longjmp_chk
+
+#define CHECK_SP(env, guard) \
+  do									\
+    {									\
+      uintptr_t cur_sp;							\
+      uintptr_t new_sp = env->__gregs[9];				\
+      __asm ("lr %0, %%r15" : "=r" (cur_sp));				\
+      new_sp ^= guard;							\
+      if (new_sp < cur_sp)						\
+	__fortify_fail ("longjmp causes uninitialized stack frame");	\
+    } while (0)
+
+#include "__longjmp.c"

Modified: fsf/trunk/libc/sysdeps/s390/s390-32/__longjmp.c
==============================================================================
--- fsf/trunk/libc/sysdeps/s390/s390-32/__longjmp.c (original)
+++ fsf/trunk/libc/sysdeps/s390/s390-32/__longjmp.c Sat May 30 00:10:52 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2005, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky (schwidefsky@xxxxxxxxxx).
 
@@ -33,6 +33,11 @@
 #ifdef PTR_DEMANGLE
   register uintptr_t r3 __asm ("%r3") = THREAD_GET_POINTER_GUARD ();
   register void *r1 __asm ("%r1") = (void *) env;
+# ifdef CHECK_SP
+  CHECK_SP (env, r3);
+# endif
+#elif defined CHECK_SP
+  CHECK_SP (env, 0);
 #endif
   /* Restore registers and jump back.  */
   asm volatile ("ld   %%f6,48(%1)\n\t"

Added: fsf/trunk/libc/sysdeps/s390/s390-64/____longjmp_chk.c
==============================================================================
--- fsf/trunk/libc/sysdeps/s390/s390-64/____longjmp_chk.c (added)
+++ fsf/trunk/libc/sysdeps/s390/s390-64/____longjmp_chk.c Sat May 30 00:10:52 2009
@@ -1,0 +1,41 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sysdep.h>
+#include <setjmp.h>
+#include <bits/setjmp.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#define __longjmp ____longjmp_chk
+
+#define CHECK_SP(env, guard) \
+  do									\
+    {									\
+      uintptr_t cur_sp;							\
+      uintptr_t new_sp = env->__gregs[9];				\
+      __asm ("lgr %0, %%r15" : "=r" (cur_sp));				\
+      new_sp ^= guard;							\
+      if (new_sp < cur_sp)						\
+	__fortify_fail ("longjmp causes uninitialized stack frame");	\
+    } while (0)
+
+#include "__longjmp.c"

Modified: fsf/trunk/libc/sysdeps/s390/s390-64/__longjmp.c
==============================================================================
--- fsf/trunk/libc/sysdeps/s390/s390-64/__longjmp.c (original)
+++ fsf/trunk/libc/sysdeps/s390/s390-64/__longjmp.c Sat May 30 00:10:52 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2005, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky (schwidefsky@xxxxxxxxxx).
 
@@ -33,6 +33,11 @@
 #ifdef PTR_DEMANGLE
   register uintptr_t r3 __asm ("%r3") = THREAD_GET_POINTER_GUARD ();
   register void *r1 __asm ("%r1") = (void *) env;
+# ifdef CHECK_SP
+  CHECK_SP (env, r3);
+# endif
+#elif defined CHECK_SP
+  CHECK_SP (env, 0);
 #endif
   /* Restore registers and jump back.  */
   asm volatile ("ld   %%f7,104(%1)\n\t"

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sysconf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sysconf.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sysconf.c Sat May 30 00:10:52 2009
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006, 2007, 2009 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
@@ -67,76 +67,77 @@
 
 static const struct intel_02_cache_info
 {
-  unsigned int idx;
-  int name;
-  long int size;
-  long int assoc;
-  long int linesize;
-} intel_02_known[] =
+  unsigned char idx;
+  unsigned char assoc;
+  unsigned char linesize;
+  unsigned char rel_name;
+  unsigned int size;
+} intel_02_known [] =
   {
-    { 0x06, _SC_LEVEL1_ICACHE_SIZE, 8192, 4, 32 },
-    { 0x08, _SC_LEVEL1_ICACHE_SIZE, 16384, 4, 32 },
-    { 0x09, _SC_LEVEL1_ICACHE_SIZE, 32768, 4, 32 },
-    { 0x0a, _SC_LEVEL1_DCACHE_SIZE, 8192, 2, 32 },
-    { 0x0c, _SC_LEVEL1_DCACHE_SIZE, 16384, 4, 32 },
-    { 0x0d, _SC_LEVEL1_DCACHE_SIZE, 16384, 4, 64 },
-    { 0x21, _SC_LEVEL2_CACHE_SIZE, 262144, 8, 64 },
-    { 0x22, _SC_LEVEL3_CACHE_SIZE, 524288, 4, 64 },
-    { 0x23, _SC_LEVEL3_CACHE_SIZE, 1048576, 8, 64 },
-    { 0x25, _SC_LEVEL3_CACHE_SIZE, 2097152, 8, 64 },
-    { 0x29, _SC_LEVEL3_CACHE_SIZE, 4194304, 8, 64 },
-    { 0x2c, _SC_LEVEL1_DCACHE_SIZE, 32768, 8, 64 },
-    { 0x30, _SC_LEVEL1_ICACHE_SIZE, 32768, 8, 64 },
-    { 0x39, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 64 },
-    { 0x3a, _SC_LEVEL2_CACHE_SIZE, 196608, 6, 64 },
-    { 0x3b, _SC_LEVEL2_CACHE_SIZE, 131072, 2, 64 },
-    { 0x3c, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 64 },
-    { 0x3d, _SC_LEVEL2_CACHE_SIZE, 393216, 6, 64 },
-    { 0x3e, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 64 },
-    { 0x3f, _SC_LEVEL2_CACHE_SIZE, 262144, 2, 64 },
-    { 0x41, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 32 },
-    { 0x42, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 32 },
-    { 0x43, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 32 },
-    { 0x44, _SC_LEVEL2_CACHE_SIZE, 1048576, 4, 32 },
-    { 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 },
-    { 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 },
-    { 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 },
-    { 0x48, _SC_LEVEL2_CACHE_SIZE, 3145728, 12, 64 },
-    { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 },
-    { 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 },
-    { 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 },
-    { 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 },
-    { 0x4d, _SC_LEVEL3_CACHE_SIZE, 16777216, 16, 64 },
-    { 0x4e, _SC_LEVEL2_CACHE_SIZE, 6291456, 24, 64 },
-    { 0x60, _SC_LEVEL1_DCACHE_SIZE, 16384, 8, 64 },
-    { 0x66, _SC_LEVEL1_DCACHE_SIZE, 8192, 4, 64 },
-    { 0x67, _SC_LEVEL1_DCACHE_SIZE, 16384, 4, 64 },
-    { 0x68, _SC_LEVEL1_DCACHE_SIZE, 32768, 4, 64 },
-    { 0x78, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 64 },
-    { 0x79, _SC_LEVEL2_CACHE_SIZE, 131072, 8, 64 },
-    { 0x7a, _SC_LEVEL2_CACHE_SIZE, 262144, 8, 64 },
-    { 0x7b, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 64 },
-    { 0x7c, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 64 },
-    { 0x7d, _SC_LEVEL2_CACHE_SIZE, 2097152, 8, 64 },
-    { 0x7f, _SC_LEVEL2_CACHE_SIZE, 524288, 2, 64 },
-    { 0x82, _SC_LEVEL2_CACHE_SIZE, 262144, 8, 32 },
-    { 0x83, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 32 },
-    { 0x84, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 32 },
-    { 0x85, _SC_LEVEL2_CACHE_SIZE, 2097152, 8, 32 },
-    { 0x86, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 64 },
-    { 0x87, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 64 },
-    { 0xd0, _SC_LEVEL3_CACHE_SIZE, 524288, 4, 64 },
-    { 0xd1, _SC_LEVEL3_CACHE_SIZE, 1048576, 4, 64 },
-    { 0xd2, _SC_LEVEL3_CACHE_SIZE, 2097152, 4, 64 },
-    { 0xd6, _SC_LEVEL3_CACHE_SIZE, 1048576, 8, 64 },
-    { 0xd7, _SC_LEVEL3_CACHE_SIZE, 2097152, 8, 64 },
-    { 0xd8, _SC_LEVEL3_CACHE_SIZE, 4194304, 8, 64 },
-    { 0xdc, _SC_LEVEL3_CACHE_SIZE, 2097152, 12, 64 },
-    { 0xdd, _SC_LEVEL3_CACHE_SIZE, 4194304, 12, 64 },
-    { 0xde, _SC_LEVEL3_CACHE_SIZE, 8388608, 12, 64 },
-    { 0xe3, _SC_LEVEL3_CACHE_SIZE, 2097152, 16, 64 },
-    { 0xe3, _SC_LEVEL3_CACHE_SIZE, 4194304, 16, 64 },
-    { 0xe4, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 },
+#define M(sc) ((sc) - _SC_LEVEL1_ICACHE_SIZE)
+    { 0x06,  4, 32, M(_SC_LEVEL1_ICACHE_SIZE),    8192 },
+    { 0x08,  4, 32, M(_SC_LEVEL1_ICACHE_SIZE),   16384 },
+    { 0x09,  4, 32, M(_SC_LEVEL1_ICACHE_SIZE),   32768 },
+    { 0x0a,  2, 32, M(_SC_LEVEL1_DCACHE_SIZE),    8192 },
+    { 0x0c,  4, 32, M(_SC_LEVEL1_DCACHE_SIZE),   16384 },
+    { 0x0d,  4, 64, M(_SC_LEVEL1_DCACHE_SIZE),   16384 },
+    { 0x21,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x22,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),   524288 },
+    { 0x23,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  1048576 },
+    { 0x25,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0x29,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0x2c,  8, 64, M(_SC_LEVEL1_DCACHE_SIZE),   32768 },
+    { 0x30,  8, 64, M(_SC_LEVEL1_ICACHE_SIZE),   32768 },
+    { 0x39,  4, 64, M(_SC_LEVEL2_CACHE_SIZE),   131072 },
+    { 0x3a,  6, 64, M(_SC_LEVEL2_CACHE_SIZE),   196608 },
+    { 0x3b,  2, 64, M(_SC_LEVEL2_CACHE_SIZE),   131072 },
+    { 0x3c,  4, 64, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x3d,  6, 64, M(_SC_LEVEL2_CACHE_SIZE),   393216 },
+    { 0x3e,  4, 64, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x3f,  2, 64, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x41,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),   131072 },
+    { 0x42,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x43,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x44,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0x45,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),  2097152 },
+    { 0x46,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0x47,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  8388608 },
+    { 0x48, 12, 64, M(_SC_LEVEL2_CACHE_SIZE),  3145728 },
+    { 0x49, 16, 64, M(_SC_LEVEL2_CACHE_SIZE),  4194304 },
+    { 0x4a, 12, 64, M(_SC_LEVEL3_CACHE_SIZE),  6291456 },
+    { 0x4b, 16, 64, M(_SC_LEVEL3_CACHE_SIZE),  8388608 },
+    { 0x4c, 12, 64, M(_SC_LEVEL3_CACHE_SIZE), 12582912 },
+    { 0x4d, 16, 64, M(_SC_LEVEL3_CACHE_SIZE), 16777216 },
+    { 0x4e, 24, 64, M(_SC_LEVEL2_CACHE_SIZE),  6291456 },
+    { 0x60,  8, 64, M(_SC_LEVEL1_DCACHE_SIZE),   16384 },
+    { 0x66,  4, 64, M(_SC_LEVEL1_DCACHE_SIZE),    8192 },
+    { 0x67,  4, 64, M(_SC_LEVEL1_DCACHE_SIZE),   16384 },
+    { 0x68,  4, 64, M(_SC_LEVEL1_DCACHE_SIZE),   32768 },
+    { 0x78,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0x79,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),   131072 },
+    { 0x7a,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x7b,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x7c,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0x7d,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),  2097152 },
+    { 0x7f,  2, 64, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x82,  8, 32, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x83,  8, 32, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x84,  8, 32, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0x85,  8, 32, M(_SC_LEVEL2_CACHE_SIZE),  2097152 },
+    { 0x86,  4, 64, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x87,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0xd0,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),   524288 },
+    { 0xd1,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),  1048576 },
+    { 0xd2,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0xd6,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  1048576 },
+    { 0xd7,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0xd8,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0xdc, 12, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0xdd, 12, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0xde, 12, 64, M(_SC_LEVEL3_CACHE_SIZE),  8388608 },
+    { 0xe3, 16, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0xe3, 16, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0xe4, 16, 64, M(_SC_LEVEL3_CACHE_SIZE),  8388608 },
   };
 #define nintel_02_known (sizeof (intel_02_known) / sizeof (intel_02_known[0]))
 
@@ -168,8 +169,7 @@
 
   /* Fold the name.  The _SC_ constants are always in the order SIZE,
      ASSOC, LINESIZE.  */
-  int folded_name = (_SC_LEVEL1_ICACHE_SIZE
-		     + ((name - _SC_LEVEL1_ICACHE_SIZE) / 3) * 3);
+  int folded_rel_name = (M(name) / 3) * 3;
 
   while (value != 0)
     {
@@ -179,13 +179,13 @@
 	{
 	  *no_level_2_or_3 = true;
 
-	  if (folded_name == _SC_LEVEL3_CACHE_SIZE)
+	  if (folded_rel_name == M(_SC_LEVEL3_CACHE_SIZE))
 	    /* No need to look further.  */
 	    break;
 	}
       else
 	{
-	  if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE)
+	  if (byte == 0x49 && folded_rel_name == M(_SC_LEVEL3_CACHE_SIZE))
 	    {
 	      /* Intel reused this value.  For family 15, model 6 it
 		 specifies the 3rd level cache.  Otherwise the 2nd
@@ -208,7 +208,7 @@
 		     the caller asked for the level 2 cache.  */
 		  name = (_SC_LEVEL2_CACHE_SIZE
 			  + (name - _SC_LEVEL3_CACHE_SIZE));
-		  folded_name = _SC_LEVEL3_CACHE_SIZE;
+		  folded_rel_name = M(_SC_LEVEL2_CACHE_SIZE);
 		}
 	    }
 
@@ -220,9 +220,9 @@
 			   sizeof (intel_02_known[0]), intel_02_known_compare);
 	  if (found != NULL)
 	    {
-	      if (found->name == folded_name)
+	      if (found->rel_name == folded_rel_name)
 		{
-		  unsigned int offset = name - folded_name;
+		  unsigned int offset = M(name) - folded_rel_name;
 
 		  if (offset == 0)
 		    /* Cache size.  */
@@ -234,7 +234,7 @@
 		  return found->linesize;
 		}
 
-	      if (found->name == _SC_LEVEL2_CACHE_SIZE)
+	      if (found->rel_name == M(_SC_LEVEL2_CACHE_SIZE))
 		*has_level_2 = true;
 	    }
 	}

Modified: fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c Sat May 30 00:10:52 2009
@@ -1,5 +1,5 @@
 /* x86_64 cache info.
-   Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006, 2007, 2009 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
@@ -29,76 +29,77 @@
 
 static const struct intel_02_cache_info
 {
-  unsigned int idx;
-  int name;
-  long int size;
-  long int assoc;
-  long int linesize;
+  unsigned char idx;
+  unsigned char assoc;
+  unsigned char linesize;
+  unsigned char rel_name;
+  unsigned int size;
 } intel_02_known [] =
   {
-    { 0x06, _SC_LEVEL1_ICACHE_SIZE,    8192,  4, 32 },
-    { 0x08, _SC_LEVEL1_ICACHE_SIZE,   16384,  4, 32 },
-    { 0x09, _SC_LEVEL1_ICACHE_SIZE,   32768,  4, 32 },
-    { 0x0a, _SC_LEVEL1_DCACHE_SIZE,    8192,  2, 32 },
-    { 0x0c, _SC_LEVEL1_DCACHE_SIZE,   16384,  4, 32 },
-    { 0x0d, _SC_LEVEL1_DCACHE_SIZE,   16384,  4, 64 },
-    { 0x21, _SC_LEVEL2_CACHE_SIZE,   262144,  8, 64 },
-    { 0x22, _SC_LEVEL3_CACHE_SIZE,   524288,  4, 64 },
-    { 0x23, _SC_LEVEL3_CACHE_SIZE,  1048576,  8, 64 },
-    { 0x25, _SC_LEVEL3_CACHE_SIZE,  2097152,  8, 64 },
-    { 0x29, _SC_LEVEL3_CACHE_SIZE,  4194304,  8, 64 },
-    { 0x2c, _SC_LEVEL1_DCACHE_SIZE,   32768,  8, 64 },
-    { 0x30, _SC_LEVEL1_ICACHE_SIZE,   32768,  8, 64 },
-    { 0x39, _SC_LEVEL2_CACHE_SIZE,   131072,  4, 64 },
-    { 0x3a, _SC_LEVEL2_CACHE_SIZE,   196608,  6, 64 },
-    { 0x3b, _SC_LEVEL2_CACHE_SIZE,   131072,  2, 64 },
-    { 0x3c, _SC_LEVEL2_CACHE_SIZE,   262144,  4, 64 },
-    { 0x3d, _SC_LEVEL2_CACHE_SIZE,   393216,  6, 64 },
-    { 0x3e, _SC_LEVEL2_CACHE_SIZE,   524288,  4, 64 },
-    { 0x3f, _SC_LEVEL2_CACHE_SIZE,   262144,  2, 64 },
-    { 0x41, _SC_LEVEL2_CACHE_SIZE,   131072,  4, 32 },
-    { 0x42, _SC_LEVEL2_CACHE_SIZE,   262144,  4, 32 },
-    { 0x43, _SC_LEVEL2_CACHE_SIZE,   524288,  4, 32 },
-    { 0x44, _SC_LEVEL2_CACHE_SIZE,  1048576,  4, 32 },
-    { 0x45, _SC_LEVEL2_CACHE_SIZE,  2097152,  4, 32 },
-    { 0x46, _SC_LEVEL3_CACHE_SIZE,  4194304,  4, 64 },
-    { 0x47, _SC_LEVEL3_CACHE_SIZE,  8388608,  8, 64 },
-    { 0x48, _SC_LEVEL2_CACHE_SIZE,  3145728, 12, 64 },
-    { 0x49, _SC_LEVEL2_CACHE_SIZE,  4194304, 16, 64 },
-    { 0x4a, _SC_LEVEL3_CACHE_SIZE,  6291456, 12, 64 },
-    { 0x4b, _SC_LEVEL3_CACHE_SIZE,  8388608, 16, 64 },
-    { 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 },
-    { 0x4d, _SC_LEVEL3_CACHE_SIZE, 16777216, 16, 64 },
-    { 0x4e, _SC_LEVEL2_CACHE_SIZE,  6291456, 24, 64 },
-    { 0x60, _SC_LEVEL1_DCACHE_SIZE,   16384,  8, 64 },
-    { 0x66, _SC_LEVEL1_DCACHE_SIZE,    8192,  4, 64 },
-    { 0x67, _SC_LEVEL1_DCACHE_SIZE,   16384,  4, 64 },
-    { 0x68, _SC_LEVEL1_DCACHE_SIZE,   32768,  4, 64 },
-    { 0x78, _SC_LEVEL2_CACHE_SIZE,  1048576,  8, 64 },
-    { 0x79, _SC_LEVEL2_CACHE_SIZE,   131072,  8, 64 },
-    { 0x7a, _SC_LEVEL2_CACHE_SIZE,   262144,  8, 64 },
-    { 0x7b, _SC_LEVEL2_CACHE_SIZE,   524288,  8, 64 },
-    { 0x7c, _SC_LEVEL2_CACHE_SIZE,  1048576,  8, 64 },
-    { 0x7d, _SC_LEVEL2_CACHE_SIZE,  2097152,  8, 64 },
-    { 0x7f, _SC_LEVEL2_CACHE_SIZE,   524288,  2, 64 },
-    { 0x82, _SC_LEVEL2_CACHE_SIZE,   262144,  8, 32 },
-    { 0x83, _SC_LEVEL2_CACHE_SIZE,   524288,  8, 32 },
-    { 0x84, _SC_LEVEL2_CACHE_SIZE,  1048576,  8, 32 },
-    { 0x85, _SC_LEVEL2_CACHE_SIZE,  2097152,  8, 32 },
-    { 0x86, _SC_LEVEL2_CACHE_SIZE,   524288,  4, 64 },
-    { 0x87, _SC_LEVEL2_CACHE_SIZE,  1048576,  8, 64 },
-    { 0xd0, _SC_LEVEL3_CACHE_SIZE,   524288,  4, 64 },
-    { 0xd1, _SC_LEVEL3_CACHE_SIZE,  1048576,  4, 64 },
-    { 0xd2, _SC_LEVEL3_CACHE_SIZE,  2097152,  4, 64 },
-    { 0xd6, _SC_LEVEL3_CACHE_SIZE,  1048576,  8, 64 },
-    { 0xd7, _SC_LEVEL3_CACHE_SIZE,  2097152,  8, 64 },
-    { 0xd8, _SC_LEVEL3_CACHE_SIZE,  4194304,  8, 64 },
-    { 0xdc, _SC_LEVEL3_CACHE_SIZE,  2097152, 12, 64 },
-    { 0xdd, _SC_LEVEL3_CACHE_SIZE,  4194304, 12, 64 },
-    { 0xde, _SC_LEVEL3_CACHE_SIZE,  8388608, 12, 64 },
-    { 0xe3, _SC_LEVEL3_CACHE_SIZE,  2097152, 16, 64 },
-    { 0xe3, _SC_LEVEL3_CACHE_SIZE,  4194304, 16, 64 },
-    { 0xe4, _SC_LEVEL3_CACHE_SIZE,  8388608, 16, 64 },
+#define M(sc) ((sc) - _SC_LEVEL1_ICACHE_SIZE)
+    { 0x06,  4, 32, M(_SC_LEVEL1_ICACHE_SIZE),    8192 },
+    { 0x08,  4, 32, M(_SC_LEVEL1_ICACHE_SIZE),   16384 },
+    { 0x09,  4, 32, M(_SC_LEVEL1_ICACHE_SIZE),   32768 },
+    { 0x0a,  2, 32, M(_SC_LEVEL1_DCACHE_SIZE),    8192 },
+    { 0x0c,  4, 32, M(_SC_LEVEL1_DCACHE_SIZE),   16384 },
+    { 0x0d,  4, 64, M(_SC_LEVEL1_DCACHE_SIZE),   16384 },
+    { 0x21,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x22,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),   524288 },
+    { 0x23,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  1048576 },
+    { 0x25,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0x29,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0x2c,  8, 64, M(_SC_LEVEL1_DCACHE_SIZE),   32768 },
+    { 0x30,  8, 64, M(_SC_LEVEL1_ICACHE_SIZE),   32768 },
+    { 0x39,  4, 64, M(_SC_LEVEL2_CACHE_SIZE),   131072 },
+    { 0x3a,  6, 64, M(_SC_LEVEL2_CACHE_SIZE),   196608 },
+    { 0x3b,  2, 64, M(_SC_LEVEL2_CACHE_SIZE),   131072 },
+    { 0x3c,  4, 64, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x3d,  6, 64, M(_SC_LEVEL2_CACHE_SIZE),   393216 },
+    { 0x3e,  4, 64, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x3f,  2, 64, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x41,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),   131072 },
+    { 0x42,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x43,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x44,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0x45,  4, 32, M(_SC_LEVEL2_CACHE_SIZE),  2097152 },
+    { 0x46,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0x47,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  8388608 },
+    { 0x48, 12, 64, M(_SC_LEVEL2_CACHE_SIZE),  3145728 },
+    { 0x49, 16, 64, M(_SC_LEVEL2_CACHE_SIZE),  4194304 },
+    { 0x4a, 12, 64, M(_SC_LEVEL3_CACHE_SIZE),  6291456 },
+    { 0x4b, 16, 64, M(_SC_LEVEL3_CACHE_SIZE),  8388608 },
+    { 0x4c, 12, 64, M(_SC_LEVEL3_CACHE_SIZE), 12582912 },
+    { 0x4d, 16, 64, M(_SC_LEVEL3_CACHE_SIZE), 16777216 },
+    { 0x4e, 24, 64, M(_SC_LEVEL2_CACHE_SIZE),  6291456 },
+    { 0x60,  8, 64, M(_SC_LEVEL1_DCACHE_SIZE),   16384 },
+    { 0x66,  4, 64, M(_SC_LEVEL1_DCACHE_SIZE),    8192 },
+    { 0x67,  4, 64, M(_SC_LEVEL1_DCACHE_SIZE),   16384 },
+    { 0x68,  4, 64, M(_SC_LEVEL1_DCACHE_SIZE),   32768 },
+    { 0x78,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0x79,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),   131072 },
+    { 0x7a,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x7b,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x7c,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0x7d,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),  2097152 },
+    { 0x7f,  2, 64, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x82,  8, 32, M(_SC_LEVEL2_CACHE_SIZE),   262144 },
+    { 0x83,  8, 32, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x84,  8, 32, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0x85,  8, 32, M(_SC_LEVEL2_CACHE_SIZE),  2097152 },
+    { 0x86,  4, 64, M(_SC_LEVEL2_CACHE_SIZE),   524288 },
+    { 0x87,  8, 64, M(_SC_LEVEL2_CACHE_SIZE),  1048576 },
+    { 0xd0,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),   524288 },
+    { 0xd1,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),  1048576 },
+    { 0xd2,  4, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0xd6,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  1048576 },
+    { 0xd7,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0xd8,  8, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0xdc, 12, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0xdd, 12, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0xde, 12, 64, M(_SC_LEVEL3_CACHE_SIZE),  8388608 },
+    { 0xe3, 16, 64, M(_SC_LEVEL3_CACHE_SIZE),  2097152 },
+    { 0xe3, 16, 64, M(_SC_LEVEL3_CACHE_SIZE),  4194304 },
+    { 0xe4, 16, 64, M(_SC_LEVEL3_CACHE_SIZE),  8388608 },
   };
 
 #define nintel_02_known (sizeof (intel_02_known) / sizeof (intel_02_known [0]))
@@ -130,8 +131,7 @@
 
   /* Fold the name.  The _SC_ constants are always in the order SIZE,
      ASSOC, LINESIZE.  */
-  int folded_name = (_SC_LEVEL1_ICACHE_SIZE
-		     + ((name - _SC_LEVEL1_ICACHE_SIZE) / 3) * 3);
+  int folded_rel_name = (M(name) / 3) * 3;
 
   while (value != 0)
     {
@@ -141,13 +141,13 @@
 	{
 	  *no_level_2_or_3 = true;
 
-	  if (folded_name == _SC_LEVEL3_CACHE_SIZE)
+	  if (folded_rel_name == M(_SC_LEVEL3_CACHE_SIZE))
 	    /* No need to look further.  */
 	    break;
 	}
       else
 	{
-	  if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE)
+	  if (byte == 0x49 && folded_rel_name == M(_SC_LEVEL3_CACHE_SIZE))
 	    {
 	      /* Intel reused this value.  For family 15, model 6 it
 		 specifies the 3rd level cache.  Otherwise the 2nd
@@ -170,7 +170,7 @@
 		     the caller asked for the level 2 cache.  */
 		  name = (_SC_LEVEL2_CACHE_SIZE
 			  + (name - _SC_LEVEL3_CACHE_SIZE));
-		  folded_name = _SC_LEVEL3_CACHE_SIZE;
+		  folded_rel_name = M(_SC_LEVEL2_CACHE_SIZE);
 		}
 	    }
 
@@ -182,9 +182,9 @@
 			   sizeof (intel_02_known[0]), intel_02_known_compare);
 	  if (found != NULL)
 	    {
-	      if (found->name == folded_name)
+	      if (found->rel_name == folded_rel_name)
 		{
-		  unsigned int offset = name - folded_name;
+		  unsigned int offset = M(name) - folded_rel_name;
 
 		  if (offset == 0)
 		    /* Cache size.  */
@@ -196,7 +196,7 @@
 		  return found->linesize;
 		}
 
-	      if (found->name == _SC_LEVEL2_CACHE_SIZE)
+	      if (found->rel_name == M(_SC_LEVEL2_CACHE_SIZE))
 		*has_level_2 = true;
 	    }
 	}