Current-Users archive

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

Re: Stack alignment with pthreads



On Fri, Aug 29, 2008 at 11:59:50AM +0200, Anthony Mallet wrote:
> Just curious, where did you find this? I googled a bit for the ABI 
> requirements
> but did not find very useful info yet.

src/gnu/dist/gcc4/gcc/config/i386/i386.h

> Ok. What I find strange at the moment is that the stack seems to be
> MAP_ALIGNED(pthread__stacksize_lg) in pthread_stackalloc, with
> pthread__stacksize_lg set to 18 are there do not seem to be a problem with the
> address returned by mmap.

Yeah, that confused me too - seems the stack should start page aligned,
this is then passed to the machine depended makecontext() which bounces
off to pthread__create_tramp(), which uses another few bytes via an
automatic variable plus an artifical alloca().

The thread alignement should happen in makecontext(), look for an example at
src/lib/libc/arch/sparc64/gen/makecontext.c.

Martin


Home | Main Index | Thread Index | Old Index