Re: [Prex-devel] What's wrong with this code?
Status: Beta
Brought to you by:
kohtani
From: Kohsuke O. <ko...@us...> - 2008-01-03 12:13:26
|
Tieu Bao wrote: >> You have to pass the stack pointer for thread_load(). "stack" is a base >> address of the stack in this case. > > Yeah, it's very interesting point. It's worked when I modify calling > thread_load to: > if (thread_load(child, child_thread, stack+1024) != 0) > > But I have little confused: why don't we use "stack" instead of > "stack+1024"? Is there any clue when declare stack pointer for thread? A stack grows downward on i386. So, the initial stack pointer should be set to the end of stack area. Please note that Prex kernel does not take care of the "size" of user mode stack. The thread creator has the responsible to setup the proper stack for the child thread. This will be typically done by an exec server or pthread_create() library routine under POSIX environment. -- Kohsuke |