tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [RFC][PATCH] _UC_TLSBASE for all ports



On Sat, Aug 11, 2012 at 01:50:58PM +0200, Emmanuel Dreyfus wrote:
> Martin Husemann <martin%duskware.de@localhost> 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()

Ah, IC, so every task has its own stack and you never use the original pthread
thread stack. Yes, this would work (and swapcontext deals with the register
windows).

Thanks for explanation,

Martin


Home | Main Index | Thread Index | Old Index