diff options
author | ume <ume@FreeBSD.org> | 2006-01-22 13:47:53 +0800 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2006-01-22 13:47:53 +0800 |
commit | 3741cfb89629b7acd480b6f6e5c942f8fe50106b (patch) | |
tree | c9d187362c56d44220a73a1f0ea067ad32dec046 /lang | |
parent | 2e0b10746e1c58e6a3fb065e659e25a3b0df4900 (diff) | |
download | freebsd-ports-graphics-3741cfb89629b7acd480b6f6e5c942f8fe50106b.tar.gz freebsd-ports-graphics-3741cfb89629b7acd480b6f6e5c942f8fe50106b.tar.zst freebsd-ports-graphics-3741cfb89629b7acd480b6f6e5c942f8fe50106b.zip |
Better fix for the problem on AMD64 and Pentium4 since rev1.4.
getcontext() saves EFLAGS and setcontext() restores it. When carry
flag is set in EFLAGS, setcontext() treats it as an system call error.
This problem is filed as misc/92110.
rev1.3 and before hid this problem, and rev1.4 exposed it.
Drop carry flag before getcontext() for workaround for this problem.
Submitted by: Tanaka Akira <akr__at__m17n.org>
Tested by: TAKANO Yuji <takachan__at__running-dog.net>
Diffstat (limited to 'lang')
-rw-r--r-- | lang/ruby18/files/patch-eval.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/lang/ruby18/files/patch-eval.c b/lang/ruby18/files/patch-eval.c index 9c0f6694b83..72fc25e2260 100644 --- a/lang/ruby18/files/patch-eval.c +++ b/lang/ruby18/files/patch-eval.c @@ -1,8 +1,8 @@ Index: eval.c diff -u -p eval.c.orig eval.c --- eval.c.orig Tue Dec 20 22:41:47 2005 -+++ eval.c Sun Jan 22 02:50:12 2006 -@@ -129,20 +129,44 @@ rb_jump_context(env, val) ++++ eval.c Sun Jan 22 13:59:48 2006 +@@ -129,32 +129,64 @@ rb_jump_context(env, val) * But it has not the problem because gcc knows setjmp may return twice. * gcc detects setjmp and generates setjmp safe code. * @@ -34,42 +34,39 @@ diff -u -p eval.c.orig eval.c + * http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html */ -#if defined (__GNUC__) && (defined(sparc) || defined(__sparc__)) -+#define FUNCTION_CALL_MAY_RETURN_TWICE \ -+ ({ __asm__ volatile ("" : : : \ -+ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \ -+ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \ -+ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); }) -+#else #define FUNCTION_CALL_MAY_RETURN_TWICE \ ({ __asm__ volatile ("" : : : \ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \ - "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \ +- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \ ++ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); }) -+#endif #else ++#define FUNCTION_CALL_MAY_RETURN_TWICE \ ++ ({ __asm__ volatile ("" : : : \ ++ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \ ++ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \ ++ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); }) ++#endif ++#elif defined(__ia64) static jmp_buf function_call_may_return_twice_jmp_buf; int function_call_may_return_twice_false = 0; -@@ -151,11 +175,23 @@ int function_call_may_return_twice_false + #define FUNCTION_CALL_MAY_RETURN_TWICE \ + (function_call_may_return_twice_false ? \ setjmp(function_call_may_return_twice_jmp_buf) : \ 0) - #endif +#else +#define FUNCTION_CALL_MAY_RETURN_TWICE 0 +#endif - #define ruby_longjmp(env, val) rb_jump_context(env, val) -+#if GCC_VERSION_BEFORE(4,0,3) && \ -+ (defined(sparc) || defined(__sparc__) || defined(__ia64)) -+#define ruby_setjmp(j) ((j)->status = 0, \ -+ FUNCTION_CALL_MAY_RETURN_TWICE, \ -+ getcontext(&(j)->context), \ -+ FUNCTION_CALL_MAY_RETURN_TWICE, \ -+ (j)->status) +#else ++#define FUNCTION_CALL_MAY_RETURN_TWICE 0 + #endif + #define ruby_longjmp(env, val) rb_jump_context(env, val) ++static volatile int freebsd_clear_carry_flag = 0; #define ruby_setjmp(j) ((j)->status = 0, \ FUNCTION_CALL_MAY_RETURN_TWICE, \ ++ freebsd_clear_carry_flag = freebsd_clear_carry_flag + freebsd_clear_carry_flag, \ getcontext(&(j)->context), \ ++ FUNCTION_CALL_MAY_RETURN_TWICE, \ (j)->status) -+#endif #else typedef jmp_buf rb_jmpbuf_t; - #if !defined(setjmp) && defined(HAVE__SETJMP) |