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 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.



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