Module: wine Branch: master Commit: d0413d833f430a487589283c53f797da2b4f48a0 URL: https://source.winehq.org/git/wine.git/?a=commit;h=d0413d833f430a487589283c5...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Dec 17 15:57:32 2021 +0100
ntdll: Don't use inline assembly in do_cpuid.
Avoids problems on old GCC.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51862 Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/unix/system.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index c2f1ee11eca..9f49b9e6f58 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -249,10 +249,36 @@ BOOL xstate_compaction_enabled = FALSE; #define INEI 0x49656e69 /* "ineI" */ #define NTEL 0x6c65746e /* "ntel" */
-static inline void do_cpuid(unsigned int ax, unsigned int cx, unsigned int *p) -{ - __asm__ ("cpuid" : "=a"(p[0]), "=b" (p[1]), "=c"(p[2]), "=d"(p[3]) : "a"(ax), "c"(cx)); -} +extern void do_cpuid( unsigned int ax, unsigned int cx, unsigned int *p ) DECLSPEC_HIDDEN; +#ifdef __i386__ +__ASM_GLOBAL_FUNC( do_cpuid, + "pushl %esi\n\t" + "pushl %ebx\n\t" + "movl 12(%esp),%eax\n\t" + "movl 16(%esp),%ecx\n\t" + "movl 20(%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 +__ASM_GLOBAL_FUNC( do_cpuid, + "pushq %rbx\n\t" + "movl %edi,%eax\n\t" + "movl %esi,%ecx\n\t" + "movq %rdx,%r8\n\t" + "cpuid\n\t" + "movl %eax,(%r8)\n\t" + "movl %ebx,4(%r8)\n\t" + "movl %ecx,8(%r8)\n\t" + "movl %edx,12(%r8)\n\t" + "popq %rbx\n\t" + "ret" ) +#endif
#ifdef __i386__ extern int have_cpuid(void) DECLSPEC_HIDDEN;