mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-07 08:40:21 +02:00
x86_64: Correct wrong inline assembly in jit_get_cpu
* lib/jit_x86.c: Rewrite incorrect inline assembly that could truncate a variable in a callee save register. Now it simply tells gcc that the register is clobbered, instead of using a *32 bit* swap with a temporary variable. The problem only happens when compiling with optimization.
This commit is contained in:
parent
6e75c0352d
commit
dbb9fe1e81
2 changed files with 14 additions and 4 deletions
|
@ -236,10 +236,11 @@ jit_get_cpu(void)
|
|||
#endif
|
||||
|
||||
/* query %eax = 1 function */
|
||||
__asm__ volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
|
||||
__asm__ volatile ("cpuid; movl %%ebx, %1"
|
||||
: "=a" (eax), "=r" (ebx),
|
||||
"=c" (ecx.cpuid), "=d" (edx.cpuid)
|
||||
: "0" (1));
|
||||
: "0" (1)
|
||||
: "ebx");
|
||||
|
||||
jit_cpu.fpu = edx.bits.fpu;
|
||||
jit_cpu.cmpxchg8b = edx.bits.cmpxchg8b;
|
||||
|
@ -261,10 +262,11 @@ jit_get_cpu(void)
|
|||
|
||||
#if __WORDSIZE == 64
|
||||
/* query %eax = 0x80000001 function */
|
||||
__asm__ volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
|
||||
__asm__ volatile ("cpuid; movl %%ebx, %1"
|
||||
: "=a" (eax), "=r" (ebx),
|
||||
"=c" (ecx.cpuid), "=d" (edx.cpuid)
|
||||
: "0" (0x80000001));
|
||||
: "0" (0x80000001)
|
||||
: "ebx");
|
||||
jit_cpu.lahf = ecx.cpuid & 1;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue