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]

Re: HAL_THREAD_INIT_CONTEXT


Sergei Organov <osv@javad.ru> writes:

> Hello,
> 
> While developing FP support for the PowerPC hal I've got problem. The
> HAL_THREAD_INIT_CONTEXT macro seems to have no way to know the size of
> stack. This prevents me from allocating space for the FP context on the unused
> side of the stack. The macro looks like this:
> 
> HAL_THREAD_INIT_CONTEXT( _sparg_, _thread_, _entry_, _id_ )
> 
> Unfortunately _thread_ argument isn't guaranteed to be pointer to the current
> Cyg_Thread object by the documentation (while it's indeed used this way in the 
> kernel), and assuming this breaks hal/context.c test that passes just an
> integer as the second argument to the macro.
> 
> Without knowing the stack size in the macro it is also unclear how to
> implement hal for architecture where stack grows to the higher addresses.
>

At present GCC does not support any rising-stack processors. If we are
ever asked to port to one there will likely be more work to do than
just change this macro. In particular the code in
Cyg_HardwareThread::attach_stack() would also need to change.  So
right now this is not a problem.

> Do you think the interface should be changed?
> 

Maybe it should change. The main problem with this, though, is that it
would require a change in all HALs, which is something we would only
want to do at a major release point. I'll put this on my TODO list as
something to consider.

For now I would suggest using _thread_ as a thread pointer and not
worry about breaking the HAL test program. If you want to be clean
about this, ifdef the test to make is not applicable if your FP
support is enabled. 

-- 
Nick Garnett
Cygnus Solutions, a Red Hat Company
Cambridge, UK


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