Martin Husemann <mar...@duskware.de> wrote:

> However, for a dummie like me who hasn't seen the code in question, could
> you please explain how they handle the stack pointer in the context?

- get current ucontext_t wht getcontext();
- allocate a stack with malloc(), add it to ucontext_t (uc_stack field)
- call makecontext() to set the target function and argument
- call swapcontext()

swapcontext(3) uses setcontext(2), which setup the stack pointer
according to what has been specified in ucontext_t. As far as I
understand, setcontext(2) offers an MI interface and takes care of the
MD problems, included those related to the stack.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
m...@netbsd.org

Reply via email to