mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 15:40:11 +01:00
util: Fix cpuid invocation for x86_64.
This commit is contained in:
parent
eb2e41f0c6
commit
7a7dfb09aa
1 changed files with 23 additions and 11 deletions
|
|
@ -336,22 +336,34 @@ cpuid(unsigned int ax, unsigned int *p)
|
|||
{
|
||||
int ret = -1;
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if defined(PIPE_CC_GCC)
|
||||
__asm __volatile
|
||||
("movl %%ebx, %%esi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchgl %%ebx, %%esi"
|
||||
: "=a" (p[0]), "=S" (p[1]),
|
||||
"=c" (p[2]), "=d" (p[3])
|
||||
: "0" (ax));
|
||||
|
||||
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
|
||||
__asm __volatile (
|
||||
"movl %%ebx, %%esi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchgl %%ebx, %%esi"
|
||||
: "=a" (p[0]),
|
||||
"=S" (p[1]),
|
||||
"=c" (p[2]),
|
||||
"=d" (p[3])
|
||||
: "0" (ax)
|
||||
);
|
||||
ret = 0;
|
||||
#elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)
|
||||
__asm __volatile (
|
||||
"movq %%rbx, %%rsi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchgq %%rbx, %%rsi"
|
||||
: "=a" (p[0]),
|
||||
"=S" (p[1]),
|
||||
"=c" (p[2]),
|
||||
"=d" (p[3])
|
||||
: "0" (ax)
|
||||
);
|
||||
ret = 0;
|
||||
#elif defined(PIPE_CC_MSVC)
|
||||
__cpuid(ax, p);
|
||||
|
||||
ret = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue