about summary refs log tree commit diff
path: root/sysdeps/powerpc/dl-procinfo.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-09-15 07:48:10 +0000
committerUlrich Drepper <drepper@redhat.com>2006-09-15 07:48:10 +0000
commit4cd3633d1acf8861ace92260f07893e6fdd173e9 (patch)
tree6cc5894e130b993aaa0cd173a0102eb4fddba567 /sysdeps/powerpc/dl-procinfo.h
parent30aa57851a93d6efd6493c5a29cf82f58083bdf4 (diff)
downloadglibc-4cd3633d1acf8861ace92260f07893e6fdd173e9.tar.gz
glibc-4cd3633d1acf8861ace92260f07893e6fdd173e9.tar.xz
glibc-4cd3633d1acf8861ace92260f07893e6fdd173e9.zip
2006-09-14 Jakub Jelinek <jakub@redhat.com> cvs/fedora-glibc-20060915T0943
	    Steven Munroe  <sjmunroe@us.ibm.com>
	    
	* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add 4 new cap
	names to the beginning.  Rename "cell" to "cellbe".
	(_dl_powerpc_platforms): New.
	* sysdeps/powerpc/dl-procinfo.h (_DL_HWCAP_FIRST): Decrease.
	(HWCAP_IMPORTANT): Remove power{4,5,5+} and cell.
	(_DL_PLATFORMS_COUNT, _DL_FIRST_PLATFORM): Define.
	(_DL_HWCAP_PLATFORM): Define to new mask.
	(_dl_platform_string, _dl_string_platform): New functions.
	* sysdeps/powerpc/sysdep.h (PPC_FEATURE_BOOKE, PPC_FEATURE_SMT,
	PPC_FEATURE_ICACHE_SNOOP, PPC_FEATURE_ARCH_2_05): Define.
Diffstat (limited to 'sysdeps/powerpc/dl-procinfo.h')
-rw-r--r--sysdeps/powerpc/dl-procinfo.h73
1 files changed, 60 insertions, 13 deletions
diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
index 8edc5e539a..f63da6d555 100644
--- a/sysdeps/powerpc/dl-procinfo.h
+++ b/sysdeps/powerpc/dl-procinfo.h
@@ -1,5 +1,5 @@
 /* Processor capability information handling macros.  PowerPC version.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006 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
@@ -23,27 +23,33 @@
 #include <ldsodefs.h>
 #include <sysdep.h>		/* This defines the PPC_FEATURE_* macros.  */
 
-/* There are 16 bits used, but they are bits 16..31.  */
-#define _DL_HWCAP_FIRST		16
+/* There are 20 bits used, but they are bits 12..31.  */
+#define _DL_HWCAP_FIRST		12
 #define _DL_HWCAP_COUNT		32
 
 /* These bits influence library search.  */
-#define HWCAP_IMPORTANT		(PPC_FEATURE_HAS_ALTIVEC		      \
-				 | PPC_FEATURE_POWER4			      \
-				 | PPC_FEATURE_POWER5			      \
-				 | PPC_FEATURE_POWER5_PLUS		      \
-				 | PPC_FEATURE_CELL)
+#define HWCAP_IMPORTANT		(PPC_FEATURE_HAS_ALTIVEC)
 
-/* We don't use AT_PLATFORM.  */
-#define _DL_HWCAP_PLATFORM 	0
-#define _dl_string_platform(str) (-1)
+#define _DL_PLATFORMS_COUNT	6
+
+#define _DL_FIRST_PLATFORM      32
+/* Mask to filter out platforms.  */
+#define _DL_HWCAP_PLATFORM      (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
+                                 << _DL_FIRST_PLATFORM)
 
 static inline const char *
 __attribute__ ((unused))
 _dl_hwcap_string (int idx)
 {
   return GLRO(dl_powerpc_cap_flags)[idx - _DL_HWCAP_FIRST];
-};
+}
+
+static inline const char *
+__attribute__ ((unused))
+_dl_platform_string (int idx)
+{
+  return GLRO(dl_powerpc_platforms)[idx - _DL_FIRST_PLATFORM];
+}
 
 static inline int
 __attribute__ ((unused))
@@ -53,7 +59,48 @@ _dl_string_hwcap (const char *str)
     if (strcmp (str, _dl_hwcap_string (i)) == 0)
       return i;
   return -1;
-};
+}
+
+static inline int
+__attribute__ ((unused, always_inline))
+_dl_string_platform (const char *str)
+{
+  if (str == NULL)
+    return -1;
+
+  if (strncmp (str, GLRO(dl_powerpc_platforms)[0], 5) == 0)
+    {
+      int ret;
+      str += 5;
+      switch (*str)
+	{
+	case '4':
+	  ret = _DL_FIRST_PLATFORM + 0;
+	  break;
+	case '5':
+	  ret = _DL_FIRST_PLATFORM + 2;
+	  if (str[1] == '+')
+	    ++ret, ++str;
+	  break;
+	case '6':
+	  ret = _DL_FIRST_PLATFORM + 4;
+	  break;
+	default:
+	  return -1;
+	}
+      if (str[1] == '\0')
+	return ret;
+    }
+  else if (strncmp (str, GLRO(dl_powerpc_platforms)[1], 3) == 0)
+    {
+      if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[1] + 3) == 0)
+	return _DL_FIRST_PLATFORM + 1;
+      else if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[5] + 3) == 0)
+	return _DL_FIRST_PLATFORM + 5;
+    }
+
+  return -1;
+}
 
 #ifdef IS_IN_rtld
 static inline int