Zebediah Figura : dbghelp: Avoid using inline assembly in have_x86cpuid().

Alexandre Julliard julliard at winehq.org
Wed Nov 28 14:11:49 CST 2018


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Nov 27 19:29:45 2018 -0600

dbghelp: Avoid using inline assembly in have_x86cpuid().

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

---

 dlls/dbghelp/minidump.c | 35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/dlls/dbghelp/minidump.c b/dlls/dbghelp/minidump.c
index 25c209c..04dc775 100644
--- a/dlls/dbghelp/minidump.c
+++ b/dlls/dbghelp/minidump.c
@@ -558,34 +558,29 @@ __ASM_GLOBAL_FUNC( do_x86cpuid,
                    "popl %ebx\n\t"
                    "popl %esi\n\t"
                    "ret" )
+extern int have_x86cpuid(void);
+__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
 static void do_x86cpuid(unsigned int ax, unsigned int *p)
 {
 }
-#endif
 
-/* From xf86info havecpuid.c 1.11 */
-static inline int have_x86cpuid(void)
+static 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;
-#else
     return 0;
-#endif
 }
+#endif
 
 /******************************************************************
  *		dump_system_info




More information about the wine-cvs mailing list