pixman: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Feb 24 19:26:31 UTC 2024
pixman/pixman-x86.c | 65 ++--------------------------------------------------
1 file changed, 3 insertions(+), 62 deletions(-)
New commits:
commit 8c6d59a9f8b1c47377fc01646f1da8cfde274ccd
Author: Matt Turner <mattst88 at gmail.com>
Date: Wed Jan 3 21:23:06 2024 -0500
pixman-x86: Use cpuid.h header
diff --git a/pixman/pixman-x86.c b/pixman/pixman-x86.c
index 7f4d80e..87808db 100644
--- a/pixman/pixman-x86.c
+++ b/pixman/pixman-x86.c
@@ -22,7 +22,7 @@
#ifdef HAVE_CONFIG_H
#include <pixman-config.h>
#endif
-
+#include <cpuid.h>
#include "pixman-private.h"
#if defined(USE_X86_MMX) || defined (USE_SSE2) || defined (USE_SSSE3)
@@ -74,69 +74,13 @@ detect_cpu_features (void)
#else
-#define _PIXMAN_X86_64 \
- (defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64))
-
-static pixman_bool_t
-have_cpuid (void)
-{
-#if _PIXMAN_X86_64 || defined (_MSC_VER)
-
- return TRUE;
-
-#elif defined (__GNUC__)
- uint32_t result;
-
- __asm__ volatile (
- "pushf" "\n\t"
- "pop %%eax" "\n\t"
- "mov %%eax, %%ecx" "\n\t"
- "xor $0x00200000, %%eax" "\n\t"
- "push %%eax" "\n\t"
- "popf" "\n\t"
- "pushf" "\n\t"
- "pop %%eax" "\n\t"
- "xor %%ecx, %%eax" "\n\t"
- "mov %%eax, %0" "\n\t"
- : "=r" (result)
- :
- : "%eax", "%ecx");
-
- return !!result;
-
-#else
-#error "Unknown compiler"
-#endif
-}
-
static void
pixman_cpuid (uint32_t feature,
uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
{
#if defined (__GNUC__)
-
-#if _PIXMAN_X86_64
- __asm__ volatile (
- "cpuid" "\n\t"
- : "=a" (*a), "=b" (*b), "=c" (*c), "=d" (*d)
- : "a" (feature));
-#else
- /* On x86-32 we need to be careful about the handling of %ebx
- * and %esp. 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 that %ebx is
- * preserved, and that %esp has its original value when
- * accessing the output operands.
- */
- __asm__ volatile (
- "xchg %%ebx, %1" "\n\t"
- "cpuid" "\n\t"
- "xchg %%ebx, %1" "\n\t"
- : "=a" (*a), "=r" (*b), "=c" (*c), "=d" (*d)
- : "a" (feature));
-#endif
-
+ *a = *b = *c = *d = 0;
+ __get_cpuid(feature, a, b, c, d);
#elif defined (_MSC_VER)
int info[4];
@@ -157,9 +101,6 @@ detect_cpu_features (void)
uint32_t a, b, c, d;
cpu_features_t features = 0;
- if (!have_cpuid())
- return features;
-
/* Get feature bits */
pixman_cpuid (0x01, &a, &b, &c, &d);
if (d & (1 << 15))
More information about the xorg-commit
mailing list