Zebediah Figura : ntdll: Avoid inline assembly in have_cpuid().

Alexandre Julliard julliard at winehq.org
Tue Nov 27 14:26:12 CST 2018


Module: wine
Branch: master
Commit: e6f00d69439b205bed8cfc3861497de8c197d2fa
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e6f00d69439b205bed8cfc3861497de8c197d2fa

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Nov 26 10:00:06 2018 -0600

ntdll: Avoid inline assembly in have_cpuid().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/nt.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index a0ea037..aa6f846 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -973,30 +973,26 @@ __ASM_GLOBAL_FUNC( do_cpuid,
                    "ret" )
 #endif
 
-/* From xf86info havecpuid.c 1.11 */
-static inline BOOL have_cpuid(void)
-{
 #ifdef __i386__
-	unsigned int f1, f2;
-	__asm__("pushfl\n\t"
-                "pushfl\n\t"
-                "popl %0\n\t"
-                "movl %0,%1\n\t"
-                "xorl %2,%0\n\t"
-                "pushl %0\n\t"
-                "popfl\n\t"
-                "pushfl\n\t"
-                "popl %0\n\t"
-                "popfl"
-                : "=&r" (f1), "=&r" (f2)
-                : "ir" (0x00200000));
-	return ((f1^f2) & 0x00200000) != 0;
-#elif defined(__x86_64__)
-        return TRUE;
+extern int have_cpuid(void);
+__ASM_GLOBAL_FUNC( have_cpuid,
+                   "pushfl\n\t"
+                   "pushfl\n\t"
+                   "movl (%esp),%ecx\n\t"
+                   "xorl $0x00200000,(%esp)\n\t"
+                   "popfl\n\t"
+                   "pushfl\n\t"
+                   "popl %eax\n\t"
+                   "popfl\n\t"
+                   "xorl %ecx,%eax\n\t"
+                   "andl $0x00200000,%eax\n\t"
+                   "ret" )
 #else
-        return FALSE;
-#endif
+static int have_cpuid(void)
+{
+    return 1;
 }
+#endif
 
 /* Detect if a SSE2 processor is capable of Denormals Are Zero (DAZ) mode.
  *




More information about the wine-cvs mailing list