This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: thread_self() and STACK_GROWS_UP
- From: "Will Newton" <will dot newton at gmail dot com>
- To: "Daniel Jacobowitz" <drow at false dot org>
- Cc: libc-ports at sourceware dot org
- Date: Mon, 5 Jun 2006 09:46:16 +0100
- Subject: Re: thread_self() and STACK_GROWS_UP
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=OXuTlYcYRkn1QLZNU3tkULqWTaVPZU6OwXNp44kkwHaDJ61gKyaEXF+PKag7+bX56YSWCEkpQmOJhKEOScumaCw8a5xuwI2RmpM33mVLymXzOOSjlk1OQlwk9fTYJw2y87KHIjmcASLg7GDbHi8CvJuSdNXFcZFjSP6uBz2kZO8=
- References: <87a5b0800605090422j4ba06a69wed795414ede62623@mail.gmail.com> <20060602170654.GA31443@nevyn.them.org>
On 6/2/06, Daniel Jacobowitz <drow@false.org> wrote:
> 0x40000000 - top of user space
> 0x3f800000 - bottom of stack
> - code, heap etc.
> 0x10000000 - bottom of userspace (approx.)
>
> As such __pthread_initial_thread_bos has the lowest address of our
> stacks so all stacks other than the malloced manager thread stack are
> greater than __pthread_initial_thread_bos.
Confused. Why is __pthread_initial_thread_bos the lowest address of
stacks? The diagram you've drawn says that the initial stack is at
0x3f800000 and above. And there's only 8MB above there, so unless
you've got really tight limits on stack size, there's no way your
thread stacks are above 0x3f800000. They'll be in the heap, instead.
Well our Linux port statically allocates the top 8Mb of the process
address space for the stack. I am aware that this is a serious
limitation, but because we are targetting the embedded market it's not
top of the list for fixing right now.
As I understand it the thread stacks should look like:
0x3fc00000 -> thread 1 stack (for 2Mb)
0x3fa00000 -> thread 0 stack (for 2Mb)
0x3f800000 -> __pthread_initial_thread_bos and bottom of process stack (for 2Mb)
Although we actually use smaller per-thread stacks for obvious reasons.
Does that seem correct?
So what am I missing?
I'm sure I've asked you this before but can't you at least manage real
TLS, which would involve defining THREAD_SELF?
Possibly in the future. I haven't found a register I can use for that yet.