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


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


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