This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] Alpha hwcaps
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: libc-alpha at sources dot redhat dot com
- Date: 29 Feb 2004 03:52:23 +0100
- Subject: [PATCH] Alpha hwcaps
Hi,
this add support for Alpha hwcaps. Since the scheme of orthogonal
hwcap bits simply doesn't fit with Alpha, which has plain linear
feature inclusion, I had to replace the whole _dl_important_hwcaps.
Obviously, as I've done it is not the best solution, how can I achieve
this in a nicer way?
--- sysdeps/generic/dl-sysdep.c.orig 2004-02-29 02:52:07.000000000 +0100
+++ sysdeps/generic/dl-sysdep.c 2004-02-29 03:25:43.000000000 +0100
@@ -336,6 +336,71 @@
_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
size_t *max_capstrlen)
{
+#ifdef __alpha__
+ enum {
+ ARCH_EV7,
+ ARCH_EV68,
+ ARCH_EV67,
+ ARCH_EV6,
+ ARCH_PCA56,
+ ARCH_EV56,
+ ARCH_EV5,
+ ARCH_EV4,
+ ARCH_END = ARCH_EV4
+ };
+#define STRLENPAIR(S) { S, sizeof S - 1 }
+ static const struct r_strlenpair archs[] = {
+ STRLENPAIR("ev7/"),
+ STRLENPAIR("ev68/"),
+ STRLENPAIR("ev67/"),
+ STRLENPAIR("ev6/"),
+ STRLENPAIR("pca56/"),
+ STRLENPAIR("ev56/"),
+ STRLENPAIR("ev5/"),
+ };
+ enum {
+ AMASK_BWX = 1 << 0,
+ AMASK_FIX = 1 << 1,
+ AMASK_CIX = 1 << 2,
+ AMASK_MVI = 1 << 8,
+ AMASK_PREC_TRAPS = 1 << 9,
+ AMASK_PREFETCH_WH = 1 << 12,
+ };
+ enum { IMPLVER_EV4, IMPLVER_EV5, IMPLVER_EV6, IMPLVER_EV7 };
+ unsigned long implver, amask;
+ int arch;
+
+ asm ("implver %0" : "=r" (implver));
+ asm ("amask %1,%0" : "=r" (amask) : "r" (-1));
+ amask = ~amask;
+
+ if (implver == IMPLVER_EV4)
+ arch = ARCH_EV4;
+ else if (implver == IMPLVER_EV5)
+ {
+ if (amask & AMASK_MVI)
+ arch = ARCH_PCA56;
+ else if (amask & AMASK_BWX)
+ arch = ARCH_EV56;
+ else
+ arch = ARCH_EV5;
+ }
+ else if (implver == IMPLVER_EV6)
+ {
+ if (amask & AMASK_PREFETCH_WH)
+ arch = ARCH_EV68;
+ else if (amask & AMASK_CIX)
+ arch = ARCH_EV67;
+ else
+ arch = ARCH_EV6;
+ }
+ else
+ arch = ARCH_EV7;
+
+ *sz = ARCH_END - arch;
+ *max_capstrlen = strlen("pca56/");
+ return archs + arch;
+#else
/* Determine how many important bits are set. */
unsigned long int masked = GL(dl_hwcap) & GL(dl_hwcap_mask);
size_t cnt = platform != NULL;
@@ -511,4 +576,5 @@
*max_capstrlen = result[0].len;
return result;
+#endif
}
--
Falk