https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1c16ab4847b7d447fab7360c55efc4a43e529a5e

commit 1c16ab4847b7d447fab7360c55efc4a43e529a5e
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 15:55:24 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:40 2020 +0200

    [WINESYNC] dbghelp: Avoid using inline assembly in have_x86cpuid().
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 797f93be6553d4a759473886ad00826c3371d094 by Zebediah Figura 
<[email protected]>
---
 dll/win32/dbghelp/minidump.c   | 50 +++++++++++++++++++++++++-----------------
 sdk/tools/winesync/dbghelp.cfg |  2 +-
 2 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/dll/win32/dbghelp/minidump.c b/dll/win32/dbghelp/minidump.c
index d01b44484b8..f72177e6d2d 100644
--- a/dll/win32/dbghelp/minidump.c
+++ b/dll/win32/dbghelp/minidump.c
@@ -559,40 +559,50 @@ __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)
 {
     __cpuid((int*)p, ax);
 }
+
+static int have_x86cpuid(void)
+{
+    ULONG CallerFlags, Flags;
+
+    /* Read the original flags, and add the CPUID bit */
+    CallerFlags = __readeflags() ^ 0x200000;
+    __writeeflags(CallerFlags);
+
+    /* Read our flags now */
+    Flags = __readeflags();
+
+    /* Check if the bit stuck */
+    return (((CallerFlags ^ Flags) >> 21) & 1) ^ 1;
+}
 #endif
 #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
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index 9bc1bc767d6..ddd733899ab 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -4,4 +4,4 @@ files:
   include/dbghelp.h: sdk/include/psdk/dbghelp.h
   include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
 tags:
-  wine: b7f3e6ba317bec299e43156efcdb5469f39a8a3c
+  wine: 797f93be6553d4a759473886ad00826c3371d094

Reply via email to