![]() | |||||||||||
Messages in this thread |
Konstantin Muenning wrote: >On Fri, 4 Sep 1998, Richard Gooch wrote: >>Chris Wedgwood writes: >>> On Fri, Sep 04, 1998 at 01:29:55AM +0200, Konstantin Muenning wrote: >>> > I have figured out that any combination of the clone-flags works >>> > except when using CLONE_VM. Even when using CLONE_VM, the call >>> > completes successful. >>> >>> I think when using CLONE_VM both processes return with the same stack >>> and bad things happen. [...] >>> You need some assembly here to fix this up, I think libpthreads does >>> it this way. >> >>Yep. > >I'm not afraid of assembler but I don't see where I'll need it. > >If it's realy true that also the stack pointer is passed identical to the >child process so they use really the same physical memory it is clear that >one of the processes cannot run right. In that case I have to allocate a >new selector for the PL3 Stack (hmm, maybe for the PL0 stack too?), [...] You're working too hard. All you have to do is change the user-space stack pointer to point at (the top of) a block of memory allocated for the purpose, and jump into a new function. If that function returns, make an exit() syscall. Obviously you do this only in the child. Or you can use glibc, which has a clone() wrapper that does all this for you. /* int clone(int (*fn)(void *), void *child_stack, int flags, void *arg); */ It doesn't work right if you try to use it without CLONE_VM though - something to fix. Hmm... A clone flag that shared all of VM except the stack might be interesting. zw - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/faq.html | ||||||||||
| Last update: 2005-03-22 13:44 [from the cache] ©2003-2008 | |||||||||||