libc_r/uthread/uthread_create.c

Marc Olzheim marcolz at stack.nl
Thu Jan 22 02:16:47 PST 2004


On Wed, Jan 21, 2004 at 11:09:16PM +0100, Marc Olzheim wrote:
> On Wed, Jan 21, 2004 at 10:13:44PM +0100, Marc Olzheim wrote:
> > Could someone tell me ?
> 
> Erhm... For some clue what this is about:
> http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg44893.html

Found it out already, shouldn't be a problem. A new thread doesn't
expect to find anything in ebp, so it isn't an issue.

Daniel Eischen proposed a simpler patch, which does the same trick...

Marc
-------------- next part --------------
--- /usr/src/lib/libc_r/uthread/pthread_private.h	Thu Jan 22 11:06:15 2004
+++ /usr/src/lib/libc_r/uthread/pthread_private.h	Thu Jan 22 11:08:57 2004
@@ -86,7 +86,10 @@
 	fdata = (char *) (ucp)->uc_mcontext.mc_fpstate;	\
 	__asm__("frstor %0": :"m"(*fdata));		\
 } while (0)
-#define SET_RETURN_ADDR_JB(jb, ra)	(jb)[0]._jb[0] = (int)(ra)
+#define SET_RETURN_ADDR_JB(jb, ra)	do {		\
+	(jb)[0]._jb[0] = (int)(ra);			\
+	(jb)[0]._jb[3] = 0;				\
+} while(0)
 #elif	defined(__amd64__)
 #define	GET_STACK_JB(jb)	((unsigned long)((jb)[0]._jb[2]))
 #define	GET_STACK_SJB(sjb)	((unsigned long)((sjb)[0]._sjb[2]))


More information about the freebsd-hackers mailing list