[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 273/437: x86: Ensure the x87 stack is empty when calling
From: |
Andy Wingo |
Subject: |
[Guile-commits] 273/437: x86: Ensure the x87 stack is empty when calling a function. |
Date: |
Mon, 2 Jul 2018 05:14:35 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 0b0d63d89293475409161e86ae727087a14d99b1
Author: pcpa <address@hidden>
Date: Tue Dec 3 15:09:48 2013 -0200
x86: Ensure the x87 stack is empty when calling a function.
* lib/jit_x86-cpu.c: Use the emms instruction before
calling any function. This is particularly important
when using c99 complex functions as it can easily
overflow the x87 stack due to the way lightning uses
the x87 stack as a flat register file.
---
ChangeLog | 8 ++++++++
lib/jit_x86-cpu.c | 5 +++++
2 files changed, 13 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index eef5617..8eaed7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-12-03 Paulo Andrade <address@hidden>
+
+ * lib/jit_x86-cpu.c: Use the emms instruction before
+ calling any function. This is particularly important
+ when using c99 complex functions as it can easily
+ overflow the x87 stack due to the way lightning uses
+ the x87 stack as a flat register file.
+
2013-12-02 Paulo Andrade <address@hidden>
* lib/jit_x86-x87.c: Correct wrong code generation due
diff --git a/lib/jit_x86-cpu.c b/lib/jit_x86-cpu.c
index 4cf16c1..e79697a 100644
--- a/lib/jit_x86-cpu.c
+++ b/lib/jit_x86-cpu.c
@@ -139,6 +139,7 @@ static void
_rx(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
# define nop(n) _nop(_jit, n)
static void _nop(jit_state_t*, jit_int32_t);
+# define emms() is(0x770f)
# define lea(md, rb, ri, ms, rd) _lea(_jit, md, rb, ri, ms, rd)
static void
_lea(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t,jit_int32_t);
@@ -3258,6 +3259,9 @@ _bxsubi_u(jit_state_t *_jit, jit_word_t i0, jit_int32_t
r0, jit_word_t i1)
static void
_callr(jit_state_t *_jit, jit_int32_t r0)
{
+#if __WORDSIZE == 32
+ emms();
+#endif
rex(0, 0, _NOREG, _NOREG, r0);
ic(0xff);
mrm(0x03, 0x02, r7(r0));
@@ -3276,6 +3280,7 @@ _calli(jit_state_t *_jit, jit_word_t i0)
jit_unget_reg(reg);
#else
jit_word_t w;
+ emms();
ic(0xe8);
w = i0 - (_jit->pc.w + 4);
ii(w);
- [Guile-commits] 189/437: Pass all but the (not yet implemented) qmul and qdiv tests in sparc, (continued)
- [Guile-commits] 189/437: Pass all but the (not yet implemented) qmul and qdiv tests in sparc, Andy Wingo, 2018/07/02
- [Guile-commits] 217/437: Adjust lightning to work on ppc AIX., Andy Wingo, 2018/07/02
- [Guile-commits] 223/437: Build and pass all tests on big endian Irix mips using the n32 abi., Andy Wingo, 2018/07/02
- [Guile-commits] 205/437: Properly split instruction groups for predicate registers., Andy Wingo, 2018/07/02
- [Guile-commits] 391/437: aarch64: Correct va_list offsets and double load., Andy Wingo, 2018/07/02
- [Guile-commits] 304/437: Correct typo in documentation., Andy Wingo, 2018/07/02
- [Guile-commits] 409/437: Correct binutils version detection, Andy Wingo, 2018/07/02
- [Guile-commits] 310/437: Allow jit_jmpi on an immediate constant address., Andy Wingo, 2018/07/02
- [Guile-commits] 264/437: ARM: Do not use ldrt/strt by default, Andy Wingo, 2018/07/02
- [Guile-commits] 244/437: HPPA: Correct bogus logic when calling function pointers., Andy Wingo, 2018/07/02
- [Guile-commits] 273/437: x86: Ensure the x87 stack is empty when calling a function.,
Andy Wingo <=
- [Guile-commits] 126/437: Cleanup on preparation for lightning rework., Andy Wingo, 2018/07/02
- [Guile-commits] 364/437: GNU lightning 2.1.0 release, Andy Wingo, 2018/07/02
- [Guile-commits] 242/437: Add missing jit_clear_state to documentation sample., Andy Wingo, 2018/07/02
- [Guile-commits] 417/437: HPPA: Correct wrong regarg_p check, Andy Wingo, 2018/07/02
- [Guile-commits] 333/437: Implement jit_flush, Andy Wingo, 2018/07/02
- [Guile-commits] 316/437: Implement the jit_rsb* interface., Andy Wingo, 2018/07/02
- [Guile-commits] 358/437: Add new --enable-devel-disassembler configure option, Andy Wingo, 2018/07/02
- [Guile-commits] 262/437: Rerun tests on supported backends after bogus self test correction, Andy Wingo, 2018/07/02
- [Guile-commits] 399/437: mips: Pass tests for variadic jit functions on new abi, Andy Wingo, 2018/07/02
- [Guile-commits] 408/437: GNU lightning 2.1.1 release, Andy Wingo, 2018/07/02