This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: thread_self() and STACK_GROWS_UP


On Mon, Jun 05, 2006 at 01:33:06PM +0100, Will Newton wrote:
> On 6/5/06, Daniel Jacobowitz <drow@false.org> wrote:
> 
> >Not especially, no.  Thread stacks don't need to be anywhere in
> >particular, and LinuxThreads normally allocates them with mmap.  So
> >why put them "above" your initial thread stack, instead of letting that
> >mmap put them in the heap, as it would do by default?
> 
> As I understand it this is "FLOATING_STACKS" and requires a working
> thread_self() so you can find your TCB?

No.  That's a completely separate concept.

> Without a thread_self() don't we mask the stack pointer to find the TCB?

Yes.  But that just means the stack has to have a fixed size and
alignment, not that it has to be in any particular location relative
to the initial stack.

You'll have to map them all together... but you can do it wherever.

See THREAD_STACK_START_ADDRESS, which you can redefine - as far as I
know, fairly freely.

Looking at the default for __pthread_initial_thread_bos, I'd have
thought it would put thread stacks below your stack already, by
default.  Did you change that to get them above somehow?

> >It's that layout difference which is messing you up, not the fact that
> >your stack grows up.
> 
> The layout difference with what? Is there another port that has an
> upward growing stack but no thread_self()?

Apparently not.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]