Date: Wed, 10 Apr 2013 02:40:03 +0000 (UTC) From: David Xu <davidxu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249323 - head/lib/libthr/thread Message-ID: <201304100240.r3A2e3XL045383@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davidxu Date: Wed Apr 10 02:40:03 2013 New Revision: 249323 URL: http://svnweb.freebsd.org/changeset/base/249323 Log: swapcontext wrapper can not be implemented in C, the stack pointer saved in the context becomes invalid when the function returns, same as setjmp, it must be implemented in assemble language, see discussions in PR misc/177624. Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Wed Apr 10 02:18:17 2013 (r249322) +++ head/lib/libthr/thread/thr_sig.c Wed Apr 10 02:40:03 2013 (r249323) @@ -737,13 +737,4 @@ _setcontext(const ucontext_t *ucp) return __sys_setcontext(&uc); } -__weak_reference(_swapcontext, swapcontext); -int -_swapcontext(ucontext_t *oucp, const ucontext_t *ucp) -{ - ucontext_t uc; - - (void) memcpy(&uc, ucp, sizeof(uc)); - remove_thr_signals(&uc.uc_sigmask); - return __sys_swapcontext(oucp, &uc); -} +__weak_reference(__sys_swapcontext, swapcontext);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304100240.r3A2e3XL045383>