This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: ecos context switch & stack usage question for Sparc platform
- From: "amassa at san dot rr dot com" <amassa at san dot rr dot com>
- To: ottawaguy81 at yahoo dot com
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Tue, 27 Apr 2004 12:28:29 -0400
- Subject: [ECOS] RE: ecos context switch & stack usage question for Sparc platform
- Reply-to: amassa at san dot rr dot com
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.
--Anthony
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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