[PATCH 2/4] dbghelp: Avoid using inline assembly in have_x86cpuid().

Zebediah Figura z.figura12 at gmail.com
Sun Nov 25 22:12:36 CST 2018


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/dbghelp/minidump.c | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/dlls/dbghelp/minidump.c b/dlls/dbghelp/minidump.c
index 6829a700ac..c2aef286a9 100644
--- a/dlls/dbghelp/minidump.c
+++ b/dlls/dbghelp/minidump.c
@@ -564,28 +564,27 @@ void do_x86cpuid(unsigned int ax, unsigned int *p)
 }
 #endif
 
-/* From xf86info havecpuid.c 1.11 */
-static inline int have_x86cpuid(void)
-{
-#if defined(__GNUC__) && defined(__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;
+extern int have_x86cpuid(void);
+
+#ifdef __i386__
+__ASM_GLOBAL_FUNC( have_x86cpuid,
+                   "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
+int have_x86cpuid(void)
+{
     return 0;
-#endif
 }
+#endif
 
 /******************************************************************
  *		dump_system_info
-- 
2.14.1




More information about the wine-devel mailing list