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

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


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

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

dbghelp: Avoid using inline assembly in do_x86cpuid().

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

---

 dlls/dbghelp/minidump.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/dlls/dbghelp/minidump.c b/dlls/dbghelp/minidump.c
index 975bb45..25c209c 100644
--- a/dlls/dbghelp/minidump.c
+++ b/dlls/dbghelp/minidump.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
 #include <time.h>
 
 #define NONAMELESSUNION
@@ -542,20 +543,26 @@ static  unsigned        dump_modules(struct dump_context* dc, BOOL dump_elf)
     return sz;
 }
 
-/* Calls cpuid with an eax of 'ax' and returns the 16 bytes in *p
- * We are compiled with -fPIC, so we can't clobber ebx.
- */
-static inline void do_x86cpuid(unsigned int ax, unsigned int *p)
+#ifdef __i386__
+extern void do_x86cpuid(unsigned int ax, unsigned int *p);
+__ASM_GLOBAL_FUNC( do_x86cpuid,
+                   "pushl %esi\n\t"
+                   "pushl %ebx\n\t"
+                   "movl 12(%esp),%eax\n\t"
+                   "movl 16(%esp),%esi\n\t"
+                   "cpuid\n\t"
+                   "movl %eax,(%esi)\n\t"
+                   "movl %ebx,4(%esi)\n\t"
+                   "movl %ecx,8(%esi)\n\t"
+                   "movl %edx,12(%esi)\n\t"
+                   "popl %ebx\n\t"
+                   "popl %esi\n\t"
+                   "ret" )
+#else
+static void do_x86cpuid(unsigned int ax, unsigned int *p)
 {
-#if defined(__GNUC__) && defined(__i386__)
-    __asm__("pushl %%ebx\n\t"
-            "cpuid\n\t"
-            "movl %%ebx, %%esi\n\t"
-            "popl %%ebx"
-            : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3])
-            :  "0" (ax));
-#endif
 }
+#endif
 
 /* From xf86info havecpuid.c 1.11 */
 static inline int have_x86cpuid(void)




More information about the wine-cvs mailing list