mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-04 14:20:26 +02:00
x86_64: Change x86_64 to also save/restore %rbx in inline asm.
* lib/jit_x86.c: Rewrite previous patch to inline save/restore because clobbering %ebx in x86 is treated as an error (jit_x86.c:239:5: error: PIC register clobbered by 'ebx' in 'asm').
This commit is contained in:
parent
dbb9fe1e81
commit
c146f06793
2 changed files with 17 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2014-23-02 Paulo Andrade <pcpa@gnu.org>
|
||||||
|
|
||||||
|
* lib/jit_x86.c: Rewrite previous patch to inline save/restore
|
||||||
|
because clobbering %ebx in x86 is treated as an error
|
||||||
|
(jit_x86.c:239:5: error: PIC register clobbered by 'ebx' in 'asm').
|
||||||
|
|
||||||
2014-19-02 Paulo Andrade <pcpa@gnu.org>
|
2014-19-02 Paulo Andrade <pcpa@gnu.org>
|
||||||
|
|
||||||
* lib/jit_x86.c: Rewrite incorrect inline assembly that could
|
* lib/jit_x86.c: Rewrite incorrect inline assembly that could
|
||||||
|
|
|
@ -170,7 +170,7 @@ jit_get_cpu(void)
|
||||||
jit_uint32_t __reserved3 : 1;
|
jit_uint32_t __reserved3 : 1;
|
||||||
jit_uint32_t __alwayszero : 1; /* amd RAZ */
|
jit_uint32_t __alwayszero : 1; /* amd RAZ */
|
||||||
} bits;
|
} bits;
|
||||||
jit_uint32_t cpuid;
|
jit_uword_t cpuid;
|
||||||
} ecx;
|
} ecx;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
|
@ -207,12 +207,12 @@ jit_get_cpu(void)
|
||||||
jit_uint32_t __reserved2 : 1;
|
jit_uint32_t __reserved2 : 1;
|
||||||
jit_uint32_t pbe : 1; /* amd reserved */
|
jit_uint32_t pbe : 1; /* amd reserved */
|
||||||
} bits;
|
} bits;
|
||||||
jit_uint32_t cpuid;
|
jit_uword_t cpuid;
|
||||||
} edx;
|
} edx;
|
||||||
#if __WORDSIZE == 32
|
#if __WORDSIZE == 32
|
||||||
int ac, flags;
|
int ac, flags;
|
||||||
#endif
|
#endif
|
||||||
jit_uint32_t eax, ebx;
|
jit_uword_t eax, ebx;
|
||||||
|
|
||||||
#if __WORDSIZE == 32
|
#if __WORDSIZE == 32
|
||||||
/* adapted from glibc __sysconf */
|
/* adapted from glibc __sysconf */
|
||||||
|
@ -236,11 +236,14 @@ jit_get_cpu(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* query %eax = 1 function */
|
/* query %eax = 1 function */
|
||||||
__asm__ volatile ("cpuid; movl %%ebx, %1"
|
#if __WORDSIZE == 32
|
||||||
|
__asm__ volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
|
||||||
|
#else
|
||||||
|
__asm__ volatile ("xchgq %%rbx, %1; cpuid; xchgq %%rbx, %1"
|
||||||
|
#endif
|
||||||
: "=a" (eax), "=r" (ebx),
|
: "=a" (eax), "=r" (ebx),
|
||||||
"=c" (ecx.cpuid), "=d" (edx.cpuid)
|
"=c" (ecx.cpuid), "=d" (edx.cpuid)
|
||||||
: "0" (1)
|
: "0" (1));
|
||||||
: "ebx");
|
|
||||||
|
|
||||||
jit_cpu.fpu = edx.bits.fpu;
|
jit_cpu.fpu = edx.bits.fpu;
|
||||||
jit_cpu.cmpxchg8b = edx.bits.cmpxchg8b;
|
jit_cpu.cmpxchg8b = edx.bits.cmpxchg8b;
|
||||||
|
@ -262,11 +265,10 @@ jit_get_cpu(void)
|
||||||
|
|
||||||
#if __WORDSIZE == 64
|
#if __WORDSIZE == 64
|
||||||
/* query %eax = 0x80000001 function */
|
/* query %eax = 0x80000001 function */
|
||||||
__asm__ volatile ("cpuid; movl %%ebx, %1"
|
__asm__ volatile ("xchgq %%rbx, %1; cpuid; xchgq %%rbx, %1"
|
||||||
: "=a" (eax), "=r" (ebx),
|
: "=a" (eax), "=r" (ebx),
|
||||||
"=c" (ecx.cpuid), "=d" (edx.cpuid)
|
"=c" (ecx.cpuid), "=d" (edx.cpuid)
|
||||||
: "0" (0x80000001)
|
: "0" (0x80000001));
|
||||||
: "ebx");
|
|
||||||
jit_cpu.lahf = ecx.cpuid & 1;
|
jit_cpu.lahf = ecx.cpuid & 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue