[ECOS] RE: ecos context switch & stack usage question for Sparc platform

amassa@san.rr.com amassa@san.rr.com
Tue Apr 27 22:24:00 GMT 2004

I think the kernel code handles the location of the stack pointer when the
thread is created.  The code assumes a falling stack.

If you look in thread.inl (under packages/kernel/current/include) the
member function Cyg_HardwareThread::attach_stack handles setting up the
stack pointer.  Line 254 sets up the falling stack.  Unless you override
the default function with your own.

Hope this helps.



Question 1
In ECOS I see the stack size grows from low memAddress
to high memAddress. However in sparc platform the
stack grows from high memAddress to lowMem address. I
looked at the BSP code, I was bit confused how it is
handled. 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);

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);

In our application we have been using the first method
without any problem. However I want to confirm this. 

mail2web - Check your email from the web at
http://mail2web.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

More information about the Ecos-discuss mailing list