public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS] ecos cme555 help
@ 2004-04-07  8:41 sowmya
  2004-04-27 21:01 ` [ECOS] ecos context switch & stack usage question for Sparc platform Ottawa Guy
  0 siblings, 1 reply; 3+ messages in thread
From: sowmya @ 2004-04-07  8:41 UTC (permalink / raw)
  To: Rycerz Roman-G11565, ecos-discuss

This might be a trivial question, but how and where can I set 
these options is looked in the ecosHAL tab and could not 
figure out where to set this option.

thank you

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] ecos context switch & stack usage question for Sparc platform
  2004-04-07  8:41 [ECOS] ecos cme555 help sowmya
@ 2004-04-27 21:01 ` Ottawa Guy
  2004-04-27 22:15   ` Grant Edwards
  0 siblings, 1 reply; 3+ messages in thread
From: Ottawa Guy @ 2004-04-27 21:01 UTC (permalink / raw)
  To: ecos-discuss

Hello all,
I have two question regarding sparc ECOS porting. 

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. 


Question 2
++++++++++
I am trying to implement something that would give the
PC of every task running in the system.
I can walk through the list of all task then print
information about the task. I print the stack_ptr by
calling get_saved_context(). I assumed the all
registers are saved into stack during the context
switch, so  %l1,%l2 would give me the PC and nPc.
However I didnt see that happening. Can you suggest me
something. I went through  hal_thread_switch_context()
code, which confirms that, however the stack_ptr value
didnt provide me PC and nPc. Following is the example
.

        Cyg_Thread *t = Cyg_Thread::get_list_head();

        printf("\nThreads:\n\n");
    
        while( NULL != t )
        {

		printf( "%20s stack base = %08x ptr = %08x size =
%08x\n",
                         "",
                         t->get_stack_base(),
                         t->get_saved_context(),
                         t->get_stack_size()
                );

 		t = t->get_list_next();
	}




The memory content at (t->get_saved_context()+4)
should content the PC for that task. Right ?? 

               Thanks
                    Ottawa


 



	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] ecos context switch & stack usage question for Sparc platform
  2004-04-27 21:01 ` [ECOS] ecos context switch & stack usage question for Sparc platform Ottawa Guy
@ 2004-04-27 22:15   ` Grant Edwards
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Edwards @ 2004-04-27 22:15 UTC (permalink / raw)
  To: Ottawa Guy; +Cc: ecos-discuss


> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-04-27 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-07  8:41 [ECOS] ecos cme555 help sowmya
2004-04-27 21:01 ` [ECOS] ecos context switch & stack usage question for Sparc platform Ottawa Guy
2004-04-27 22:15   ` Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).