Use getisax() instead of asm code to determine available x86 ISA extensions on Solaris
This commit is contained in:
parent
a8a0abdbea
commit
d029c8f1b7
|
@ -82,7 +82,8 @@ AC_TYPE_PID_T
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
|
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
|
||||||
strtol getopt getopt_long vsnprintf walkcontext backtrace])
|
strtol getopt getopt_long vsnprintf walkcontext backtrace \
|
||||||
|
getisax])
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
dnl Old HAS_* names used in os/*.c.
|
dnl Old HAS_* names used in os/*.c.
|
||||||
AC_CHECK_FUNC([getdtablesize],
|
AC_CHECK_FUNC([getdtablesize],
|
||||||
|
|
25
fb/fbpict.c
25
fb/fbpict.c
|
@ -1435,6 +1435,10 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||||
*/
|
*/
|
||||||
#if !defined(__amd64__) && !defined(__x86_64__)
|
#if !defined(__amd64__) && !defined(__x86_64__)
|
||||||
|
|
||||||
|
#ifdef HAVE_GETISAX
|
||||||
|
#include <sys/auxv.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
enum CPUFeatures {
|
enum CPUFeatures {
|
||||||
NoFeatures = 0,
|
NoFeatures = 0,
|
||||||
MMX = 0x1,
|
MMX = 0x1,
|
||||||
|
@ -1445,7 +1449,23 @@ enum CPUFeatures {
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned int detectCPUFeatures(void) {
|
static unsigned int detectCPUFeatures(void) {
|
||||||
|
unsigned int features = 0;
|
||||||
unsigned int result;
|
unsigned int result;
|
||||||
|
|
||||||
|
#ifdef HAVE_GETISAX
|
||||||
|
if (getisax(&result, 1)) {
|
||||||
|
if (result & AV_386_CMOV)
|
||||||
|
features |= CMOV;
|
||||||
|
if (result & AV_386_MMX)
|
||||||
|
features |= MMX;
|
||||||
|
if (result & AV_386_AMD_MMX)
|
||||||
|
features |= MMX_Extensions;
|
||||||
|
if (result & AV_386_SSE)
|
||||||
|
features |= SSE;
|
||||||
|
if (result & AV_386_SSE2)
|
||||||
|
features |= SSE2;
|
||||||
|
}
|
||||||
|
#else
|
||||||
char vendor[13];
|
char vendor[13];
|
||||||
vendor[0] = 0;
|
vendor[0] = 0;
|
||||||
vendor[12] = 0;
|
vendor[12] = 0;
|
||||||
|
@ -1454,7 +1474,8 @@ static unsigned int detectCPUFeatures(void) {
|
||||||
* %esp here. We can't declare either one as clobbered
|
* %esp here. We can't declare either one as clobbered
|
||||||
* since they are special registers (%ebx is the "PIC
|
* since they are special registers (%ebx is the "PIC
|
||||||
* register" holding an offset to global data, %esp the
|
* register" holding an offset to global data, %esp the
|
||||||
* stack pointer), so we need to make sure they have their+ * original values when we access the output operands.
|
* stack pointer), so we need to make sure they have their
|
||||||
|
* original values when we access the output operands.
|
||||||
*/
|
*/
|
||||||
__asm__ ("pushf\n"
|
__asm__ ("pushf\n"
|
||||||
"pop %%eax\n"
|
"pop %%eax\n"
|
||||||
|
@ -1490,7 +1511,6 @@ static unsigned int detectCPUFeatures(void) {
|
||||||
: "%eax", "%ecx", "%edx"
|
: "%eax", "%ecx", "%edx"
|
||||||
);
|
);
|
||||||
|
|
||||||
unsigned int features = 0;
|
|
||||||
if (result) {
|
if (result) {
|
||||||
/* result now contains the standard feature bits */
|
/* result now contains the standard feature bits */
|
||||||
if (result & (1 << 15))
|
if (result & (1 << 15))
|
||||||
|
@ -1524,6 +1544,7 @@ static unsigned int detectCPUFeatures(void) {
|
||||||
features |= MMX_Extensions;
|
features |= MMX_Extensions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_GETISAX */
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,9 @@
|
||||||
/* Define to 1 if you have the `geteuid' function. */
|
/* Define to 1 if you have the `geteuid' function. */
|
||||||
#undef HAVE_GETEUID
|
#undef HAVE_GETEUID
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getisax' function. */
|
||||||
|
#undef HAVE_GETISAX
|
||||||
|
|
||||||
/* Define to 1 if you have the `getopt' function. */
|
/* Define to 1 if you have the `getopt' function. */
|
||||||
#undef HAVE_GETOPT
|
#undef HAVE_GETOPT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue