[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 278/437: x86_64: Change x86_64 to also save/restore %rbx
From: |
Andy Wingo |
Subject: |
[Guile-commits] 278/437: x86_64: Change x86_64 to also save/restore %rbx in inline asm. |
Date: |
Mon, 2 Jul 2018 05:14:36 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit c146f067937fbd285ec378b1e7e0583f60a74bae
Author: pcpa <address@hidden>
Date: Sun Feb 23 17:31:12 2014 -0300
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').
---
ChangeLog | 6 ++++++
lib/jit_x86.c | 20 +++++++++++---------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f3ab5a0..d5a24a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-23-02 Paulo Andrade <address@hidden>
+
+ * 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 <address@hidden>
* lib/jit_x86.c: Rewrite incorrect inline assembly that could
diff --git a/lib/jit_x86.c b/lib/jit_x86.c
index 027e6db..5eaad68 100644
--- a/lib/jit_x86.c
+++ b/lib/jit_x86.c
@@ -170,7 +170,7 @@ jit_get_cpu(void)
jit_uint32_t __reserved3 : 1;
jit_uint32_t __alwayszero : 1; /* amd RAZ */
} bits;
- jit_uint32_t cpuid;
+ jit_uword_t cpuid;
} ecx;
union {
struct {
@@ -207,12 +207,12 @@ jit_get_cpu(void)
jit_uint32_t __reserved2 : 1;
jit_uint32_t pbe : 1; /* amd reserved */
} bits;
- jit_uint32_t cpuid;
+ jit_uword_t cpuid;
} edx;
#if __WORDSIZE == 32
int ac, flags;
#endif
- jit_uint32_t eax, ebx;
+ jit_uword_t eax, ebx;
#if __WORDSIZE == 32
/* adapted from glibc __sysconf */
@@ -236,11 +236,14 @@ jit_get_cpu(void)
#endif
/* 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),
"=c" (ecx.cpuid), "=d" (edx.cpuid)
- : "0" (1)
- : "ebx");
+ : "0" (1));
jit_cpu.fpu = edx.bits.fpu;
jit_cpu.cmpxchg8b = edx.bits.cmpxchg8b;
@@ -262,11 +265,10 @@ jit_get_cpu(void)
#if __WORDSIZE == 64
/* query %eax = 0x80000001 function */
- __asm__ volatile ("cpuid; movl %%ebx, %1"
+ __asm__ volatile ("xchgq %%rbx, %1; cpuid; xchgq %%rbx, %1"
: "=a" (eax), "=r" (ebx),
"=c" (ecx.cpuid), "=d" (edx.cpuid)
- : "0" (0x80000001)
- : "ebx");
+ : "0" (0x80000001));
jit_cpu.lahf = ecx.cpuid & 1;
#endif
}
- [Guile-commits] 418/437: Correct typo and values in jit_sparc-sz.c, (continued)
- [Guile-commits] 418/437: Correct typo and values in jit_sparc-sz.c, Andy Wingo, 2018/07/02
- [Guile-commits] 359/437: ARM: Regenerate size table for hard float armv7 or newer., Andy Wingo, 2018/07/02
- [Guile-commits] 396/437: Move definition of jit_va_ codes, cosmetic change., Andy Wingo, 2018/07/02
- [Guile-commits] 407/437: Update copyright year, Andy Wingo, 2018/07/02
- [Guile-commits] 435/437: Add GUILE_ENABLE_JIT macro, Andy Wingo, 2018/07/02
- [Guile-commits] 367/437: X86: No longer make st7 available as a temporary, Andy Wingo, 2018/07/02
- [Guile-commits] 406/437: Adapt for binutils 2.29, Andy Wingo, 2018/07/02
- [Guile-commits] 395/437: Use an actual, invalid code, as last jit code., Andy Wingo, 2018/07/02
- [Guile-commits] 344/437: ARM: Better check for constants offset overflow, Andy Wingo, 2018/07/02
- [Guile-commits] 351/437: PPC: Only call binutils function if it is available, Andy Wingo, 2018/07/02
- [Guile-commits] 278/437: x86_64: Change x86_64 to also save/restore %rbx in inline asm.,
Andy Wingo <=
- [Guile-commits] 427/437: Remove some more of the lightning build machinery, Andy Wingo, 2018/07/02
- [Guile-commits] 328/437: Update THANKS file, Andy Wingo, 2018/07/02
- [Guile-commits] 129/437: Remove previous macro files as they are no longer used., Andy Wingo, 2018/07/02
- [Guile-commits] 09/437: add autotools-generated files, Andy Wingo, 2018/07/02
- [Guile-commits] 69/437: implement long mul/div/mod for x86-64, Andy Wingo, 2018/07/02
- [Guile-commits] 162/437: Correct regressions with --with-float={soft, softfp} in the arm backend, Andy Wingo, 2018/07/02
- [Guile-commits] 377/437: aarch64: Add initial jit_va_ calls to aarch64, Andy Wingo, 2018/07/02
- [Guile-commits] 298/437: ARM: Correct wrong table of instruction sizes in software float, Andy Wingo, 2018/07/02
- [Guile-commits] 99/437: always set and replace lightning_frag, Andy Wingo, 2018/07/02
- [Guile-commits] 336/437: Correct bogus git entry, Andy Wingo, 2018/07/02