mirror of
https://github.com/deadw00d/AROS.git
synced 2026-03-20 04:00:58 +00:00
make sure GCC knows about the effect of the xchg.
This commit is contained in:
@ -226,28 +226,26 @@ void cpuid2(unsigned int leaf, unsigned int subleaf,
|
|||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
unsigned int a = leaf, b, c = subleaf, d;
|
unsigned int a = leaf, b, c = subleaf, d;
|
||||||
__asm__ volatile(
|
__asm__ volatile(
|
||||||
"mov %%rbx, %%rdi\n\t"
|
"mov %%rbx, %%rdi\n\t" /* save RBX (used by PIC) */
|
||||||
"cpuid\n\t"
|
"cpuid\n\t"
|
||||||
"xchg %%rbx, %%rdi\n\t"
|
"xchg %%rbx, %%rdi\n\t" /* restore RBX */
|
||||||
: "+a"(a), "=r"(b), "+c"(c), "=d"(d)
|
: "+a"(a), "=D"(b), "+c"(c), "=d"(d)
|
||||||
:
|
:
|
||||||
: "rdi", "memory");
|
: "memory");
|
||||||
if (eax) *eax = a;
|
if (eax) *eax = a;
|
||||||
if (ebx) *ebx = b;
|
if (ebx) *ebx = b;
|
||||||
if (ecx) *ecx = c;
|
if (ecx) *ecx = c;
|
||||||
if (edx) *edx = d;
|
if (edx) *edx = d;
|
||||||
|
|
||||||
#elif defined(__i386__)
|
#elif defined(__i386__)
|
||||||
unsigned int a, b, c, d;
|
unsigned int a = leaf, b, c = subleaf, d;
|
||||||
__asm__ volatile(
|
__asm__ volatile(
|
||||||
"xchg %%ebx, %%edi\n\t"
|
"xchg %%ebx, %%edi\n\t" /* save EBX (PIC-safe) */
|
||||||
"mov %4, %%eax\n\t"
|
|
||||||
"mov %5, %%ecx\n\t"
|
|
||||||
"cpuid\n\t"
|
"cpuid\n\t"
|
||||||
"xchg %%ebx, %%edi\n\t"
|
"xchg %%ebx, %%edi\n\t" /* restore EBX */
|
||||||
: "=a"(a), "=r"(b), "=c"(c), "=d"(d)
|
: "=a"(a), "=D"(b), "=c"(c), "=d"(d)
|
||||||
: "r"(leaf), "r"(subleaf)
|
: "a"(leaf), "c"(subleaf)
|
||||||
: "edi", "memory");
|
: "memory");
|
||||||
if (eax) *eax = a;
|
if (eax) *eax = a;
|
||||||
if (ebx) *ebx = b;
|
if (ebx) *ebx = b;
|
||||||
if (ecx) *ecx = c;
|
if (ecx) *ecx = c;
|
||||||
|
|||||||
Reference in New Issue
Block a user