svn commit: r249323 - head/lib/libthr/thread

David Xu davidxu at FreeBSD.org
Wed Apr 10 02:40:04 UTC 2013


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);


More information about the svn-src-head mailing list