ntdll: Avoid inline assembly in have_cpuid().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-11-26 10:00:06 -06:00 committed by Alexandre Julliard
parent b459572910
commit e6f00d6943
1 changed files with 17 additions and 21 deletions

View File

@ -973,30 +973,26 @@ __ASM_GLOBAL_FUNC( do_cpuid,
"ret" ) "ret" )
#endif #endif
/* From xf86info havecpuid.c 1.11 */
static inline BOOL have_cpuid(void)
{
#ifdef __i386__ #ifdef __i386__
unsigned int f1, f2; extern int have_cpuid(void);
__asm__("pushfl\n\t" __ASM_GLOBAL_FUNC( have_cpuid,
"pushfl\n\t" "pushfl\n\t"
"popl %0\n\t" "pushfl\n\t"
"movl %0,%1\n\t" "movl (%esp),%ecx\n\t"
"xorl %2,%0\n\t" "xorl $0x00200000,(%esp)\n\t"
"pushl %0\n\t" "popfl\n\t"
"popfl\n\t" "pushfl\n\t"
"pushfl\n\t" "popl %eax\n\t"
"popl %0\n\t" "popfl\n\t"
"popfl" "xorl %ecx,%eax\n\t"
: "=&r" (f1), "=&r" (f2) "andl $0x00200000,%eax\n\t"
: "ir" (0x00200000)); "ret" )
return ((f1^f2) & 0x00200000) != 0;
#elif defined(__x86_64__)
return TRUE;
#else #else
return FALSE; static int have_cpuid(void)
#endif {
return 1;
} }
#endif
/* Detect if a SSE2 processor is capable of Denormals Are Zero (DAZ) mode. /* Detect if a SSE2 processor is capable of Denormals Are Zero (DAZ) mode.
* *