This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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: ecos context switch & stack usage question for Sparc platform


> In ECOS I see the stack size grows from low memAddress
> to high memAddress.

Where do you see that?

> In ECOS twothread.c example
> 
>  char stack[6000];
>  cyg_thread threadInfo;
>  cyg_thread_create(4, simple_program, (cyg_addrword_t)
> 0,"Thread A", (void *) stack, 4096,0, threadInfo);

Why allocate a stack of 6000 bytes and then only use 4096 of
them?

If you look at the SPARC HAL code, I suspect it intializes SP
to ((unsigned)stackpointer) + stacksize.  Or possibly 4 less
than that.

> Since Sparc stack grows from high to low, should it be
> 
> cyg_thread_create(4, simple_program, (cyg_addrword_t)
> 0,"Thread A", (void *) ((unsigned int)stack+6000),
> 4096,0, threadInfo);

No, I don't think so.

-- 
Grant Edwards
grante@visi.com

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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