diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2006-10-18 18:11:06 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2006-10-18 18:11:06 -0700 |
commit | 357b37b3826fa6e9878c0bd895164259c2ed3c0d (patch) | |
tree | 5b16ba6d41384f8af82d0321304bd9dc9970c83f /fb | |
parent | 5eca750fe2f3f243fb352271ad8da196af0cb16a (diff) |
Use getisax() instead of asm code to determine available x86 ISA extensions on Solaris
Diffstat (limited to 'fb')
-rw-r--r-- | fb/fbpict.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/fb/fbpict.c b/fb/fbpict.c index eb305b906..d839994ae 100644 --- a/fb/fbpict.c +++ b/fb/fbpict.c @@ -1435,6 +1435,10 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) */ #if !defined(__amd64__) && !defined(__x86_64__) +#ifdef HAVE_GETISAX +#include <sys/auxv.h> +#endif + enum CPUFeatures { NoFeatures = 0, MMX = 0x1, @@ -1445,7 +1449,23 @@ enum CPUFeatures { }; static unsigned int detectCPUFeatures(void) { + unsigned int features = 0; 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]; vendor[0] = 0; vendor[12] = 0; @@ -1454,7 +1474,8 @@ static unsigned int detectCPUFeatures(void) { * %esp here. We can't declare either one as clobbered * since they are special registers (%ebx is the "PIC * 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" "pop %%eax\n" @@ -1490,7 +1511,6 @@ static unsigned int detectCPUFeatures(void) { : "%eax", "%ecx", "%edx" ); - unsigned int features = 0; if (result) { /* result now contains the standard feature bits */ if (result & (1 << 15)) @@ -1524,6 +1544,7 @@ static unsigned int detectCPUFeatures(void) { features |= MMX_Extensions; } } +#endif /* HAVE_GETISAX */ return features; } |