[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 112/437: Add safety check on number of integer and float
From: |
Andy Wingo |
Subject: |
[Guile-commits] 112/437: Add safety check on number of integer and float arguments on x86_64. |
Date: |
Mon, 2 Jul 2018 05:13:55 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 58043d717d9899ba68211a0eba84f3cc0bb596b9
Author: Paulo Cesar Pereira de Andrade <address@hidden>
Date: Mon Aug 23 18:59:39 2010 -0300
Add safety check on number of integer and float arguments on x86_64.
---
lightning/i386/core-64.h | 11 +++++++++++
lightning/i386/fp-64.h | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/lightning/i386/core-64.h b/lightning/i386/core-64.h
index 4c0c5dc..01cc9d2 100644
--- a/lightning/i386/core-64.h
+++ b/lightning/i386/core-64.h
@@ -38,6 +38,12 @@
#define JIT_CAN_16 0
#define JIT_REXTMP _R9D
+/* Number or integer argument registers */
+#define JIT_ARG_MAX 6
+
+/* Number of float argument registers */
+#define JIT_FP_ARG_MAX 8
+
#define JIT_R_NUM 3
#define JIT_R(i) ((i) == 0 ? _EAX : _R9D + (i))
#define JIT_V_NUM 3
@@ -132,7 +138,12 @@ struct jit_local_state {
#define jit_callr(reg) CALLsr((reg))
/* Stack isn't used for arguments: */
+#if !defined(_ASM_SAFETY)
#define jit_prepare_i(ni) (_jitl.argssize = (ni))
+#else
+#define jit_prepare_i(ni) ((ni) <= JIT_ARG_MAX ? _jitl.argssize = (ni) :
JITFAIL("too many integer arguments"))
+#endif
+
#define jit_pusharg_i(rs) (--_jitl.argssize, MOVQrr(rs,
jit_arg_reg_order[_jitl.argssize]))
#define jit_finish(sub) (MOVQir((long) (sub), JIT_REXTMP), \
diff --git a/lightning/i386/fp-64.h b/lightning/i386/fp-64.h
index 2dfe399..a7b8a7b 100644
--- a/lightning/i386/fp-64.h
+++ b/lightning/i386/fp-64.h
@@ -290,8 +290,13 @@ union jit_double_imm {
#define jit_ordr_d(d, s1, s2) (XORLrr ((d), (d)), UCOMISDrr ((s1),
(s2)), SETNPr (jit_reg8((d))))
#define jit_unordr_d(d, s1, s2) (XORLrr ((d), (d)), UCOMISDrr ((s1),
(s2)), SETPr (jit_reg8((d))))
+#if !defined(_ASM_SAFETY)
#define jit_prepare_f(num) (_jitl.nextarg_putfp = _XMM0 + (num))
#define jit_prepare_d(num) (_jitl.nextarg_putfp = _XMM0 + (num))
+#else
+#define jit_prepare_f(num) ((num) <= JIT_FP_ARG_MAX ?
(_jitl.nextarg_putfp = _XMM0 + (num)) : JITFAIL("too many float arguments"))
+#define jit_prepare_d(num) ((num) <= JIT_FP_ARG_MAX ?
(_jitl.nextarg_putfp = _XMM0 + (num)) : JITFAIL("too many float arguments"))
+#endif
#define jit_arg_f() (_XMM0 + _jitl.nextarg_getfp++)
#define jit_arg_d() (_XMM0 + _jitl.nextarg_getfp++)
- [Guile-commits] 96/437: fix blunder in operand order (i386), (continued)
- [Guile-commits] 96/437: fix blunder in operand order (i386), Andy Wingo, 2018/07/02
- [Guile-commits] 97/437: fix x86 shifts, Andy Wingo, 2018/07/02
- [Guile-commits] 104/437: fix jit_extr_f_d and jit_extr_d_f for x86-64, Andy Wingo, 2018/07/02
- [Guile-commits] 107/437: fix -D_ASM_SAFETY compilation of beqr_d and bne_d, Andy Wingo, 2018/07/02
- [Guile-commits] 101/437: fix i386 jit_replace and x86_64 jit_movi_f, Andy Wingo, 2018/07/02
- [Guile-commits] 118/437: Account stack alignment on jit functions with odd number of arguments., Andy Wingo, 2018/07/02
- [Guile-commits] 03/437: big merge, Andy Wingo, 2018/07/02
- [Guile-commits] 111/437: Define extra SSE2 xmmN registers and set JIT_FPTMP to the topmost one., Andy Wingo, 2018/07/02
- [Guile-commits] 94/437: fix problems with i386 32-bit floating point branches, Andy Wingo, 2018/07/02
- [Guile-commits] 115/437: Change JIT_FPR_NUM to 7 to prevent clobber of JIT_FPR(7), Andy Wingo, 2018/07/02
- [Guile-commits] 112/437: Add safety check on number of integer and float arguments on x86_64.,
Andy Wingo <=
- [Guile-commits] 95/437: another fix to jit_fp_btest, Andy Wingo, 2018/07/02
- [Guile-commits] 110/437: Change jit_getarg_{c, uc, s, us, i, ui} to extr_l to sign extend on 64 bits., Andy Wingo, 2018/07/02
- [Guile-commits] 117/437: Implement x86_64 support for multiple integer and float arguments., Andy Wingo, 2018/07/02
- [Guile-commits] 105/437: fix 64-bit load with sign extension, Andy Wingo, 2018/07/02
- [Guile-commits] 70/437: add _s32P, Andy Wingo, 2018/07/02
- [Guile-commits] 121/437: Define some extra fp-common macros when sizeof(long) == sizeof(int)., Andy Wingo, 2018/07/02
- [Guile-commits] 77/437: add .gitattributes file, Andy Wingo, 2018/07/02
- [Guile-commits] 44/437: merge some bugfixes, give right meaning to jit_retval_[fd], Andy Wingo, 2018/07/02
- [Guile-commits] 106/437: ldst test update, Andy Wingo, 2018/07/02
- [Guile-commits] 114/437: Change JIT_REXTMP to not clobber 6th argument., Andy Wingo, 2018/07/02