[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 277/437: x86_64: Correct wrong inline assembly in jit_ge
From: |
Andy Wingo |
Subject: |
[Guile-commits] 277/437: x86_64: Correct wrong inline assembly in jit_get_cpu |
Date: |
Mon, 2 Jul 2018 05:14:36 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit dbb9fe1e81ca8c684ea902a59a4889c7345c45ee
Author: pcpa <address@hidden>
Date: Wed Feb 19 15:29:26 2014 -0300
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.
---
ChangeLog | 8 ++++++++
lib/jit_x86.c | 10 ++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 81d3919..f3ab5a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2014-19-02 Paulo Andrade <address@hidden>
+ * 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.
+
+2014-19-02 Paulo Andrade <address@hidden>
+
* include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
diff --git a/lib/jit_x86.c b/lib/jit_x86.c
index 69df289..027e6db 100644
--- a/lib/jit_x86.c
+++ b/lib/jit_x86.c
@@ -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
}
- [Guile-commits] 410/437: GNU lightning 2.1.2 release, (continued)
- [Guile-commits] 410/437: GNU lightning 2.1.2 release, Andy Wingo, 2018/07/02
- [Guile-commits] 270/437: x86: Use aligned offset for x87 to/from sse move., Andy Wingo, 2018/07/02
- [Guile-commits] 302/437: Add info menu entry for lightning, Andy Wingo, 2018/07/02
- [Guile-commits] 214/437: Remove remaining ia64 port debug code., Andy Wingo, 2018/07/02
- [Guile-commits] 331/437: mips: Do not make t9 available as a generic register, Andy Wingo, 2018/07/02
- [Guile-commits] 287/437: ARM: Do not leave early init_jit if /proc is not mounted., Andy Wingo, 2018/07/02
- [Guile-commits] 405/437: Add a second pass to compute live register ranges, Andy Wingo, 2018/07/02
- [Guile-commits] 300/437: Add consistency check on temporaries during a jump, Andy Wingo, 2018/07/02
- [Guile-commits] 276/437: Rewrite jit_regset_scan1 for easier optimization., Andy Wingo, 2018/07/02
- [Guile-commits] 268/437: Sync after regenerating version.texi., Andy Wingo, 2018/07/02
- [Guile-commits] 277/437: x86_64: Correct wrong inline assembly in jit_get_cpu,
Andy Wingo <=
- [Guile-commits] 360/437: Correct wrong check in simplify_stxi., Andy Wingo, 2018/07/02
- [Guile-commits] 389/437: alpha: Save correct offset if loading a vararg double., Andy Wingo, 2018/07/02
- [Guile-commits] 380/437: ppc: Add initial jit_va_ calls to ppc, Andy Wingo, 2018/07/02
- [Guile-commits] 239/437: Avoid possible problem if built with gcc 4.8 or newer., Andy Wingo, 2018/07/02
- [Guile-commits] 347/437: S390: Add support for 32 bit., Andy Wingo, 2018/07/02
- [Guile-commits] 428/437: Further lightning integration work, Andy Wingo, 2018/07/02
- [Guile-commits] 420/437: Strip "get-jit-size" feature from lightning., Andy Wingo, 2018/07/02
- [Guile-commits] 434/437: Remove unused AM_CONDITIONAL statements from lightning configure, Andy Wingo, 2018/07/02
- [Guile-commits] 390/437: Correct make check for systems without gcc., Andy Wingo, 2018/07/02
- [Guile-commits] 388/437: sparc: Add initial jit_va_ calls to sparc, Andy Wingo, 2018/07/02