[ECOS] Stack access violations in eCos

Jonathan Larmour jifl@eCosCentric.com
Thu Mar 20 10:53:00 GMT 2003


Larice Robert wrote:
>>Yes, you're absolutely right. However I think the patch needs one little 
>>improvement: for thread stacks, we should use CYGBLD_ATTRIB_ALIGNED like 
>>you say (but ATTRIB not ANNOTATE for consistency with other names in 
>>cyg_type.h).
>>
>>However this patch deals with more than thread stacks, although that's the 
>>main bit. It also does e.g. thread objects, in which case we should use a 
>>different macro, like say:
>>
>>#define CYGBLD_ATTRIB_ALIGNOFTYPE( _type_ ) \ 
>>__attribute__((aligned(__alignof__( _type_ ))))
>>
>>And I certainly know it's a pain, but we'd need ChangeLog entries for 
>>these, although it's worth using a script to do this, e.g.
>>
>>for i in `cat filelist` ; do
>>   CL=`echo $i | sed 's@current/.*@current/ChangeLog@g'`
>>   sed "s@FILE@${i}@g" < /tmp/myentry > /tmp/myentry.tmp
>>   cat /tmp/myentry.tmp $CL > $CL.new
>>   mv $CL.new $CL
>>done
>>
>>for some appropriate files "filelist" and "/tmp/myentry", e.g.
>>
>>2003-03-19  Larice Robert  <larice@vidisys.de>
>>
>>	* FILE: Add alignments where required.
>>
>>
>>Finally, don't use a #warning for calmrisc32 just because you aren't sure.
>>
>>With that, I can apply your patch! And thanks for looking into all this 
>>and spending the time!
> 
> 
> Hello Jifl,
> 
> nice amount of work which you are shifting to me.

Renaming CYGBLD_ANNOTATE_ALIGNED is just a search and replace. And I've 
done what I can to help with the ChangeLog!

> do you have a propose for CYGBLD_ATTRIB_ALIGN ?
> 
> garry once noted:
>   #define CYGBLD_ATTRIB_ALIGN(__align__) __attribute__((aligned(__align__)))
> i'd like to have an __attribute__((aligned)) for stacks though.
> thats a special case for gcc, where gcc will itself deside how much alignement
> is reasonable for the current machine architecture.
> though gcc accepts __attribute__((aligned())) as well, the macro doesnt
> accept an empty argument.
> 
> do you have some beautiful idea how to solve this ?

CYGBLD_ATTRIB_ALIGN should stay as it is, accepting an argument. We're 
adding a new CYGBLD_ATTRIB_ALIGNED macro that takes the maximum alignment 
required for a thread stack. Perhaps the best thing to do is in fact to 
rename your CYGBLD_ANNOTATE_ALIGNED to CYGBLD_ATTRIB_ALIGNED_MAX to make 
this intention clearer.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


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



More information about the Ecos-discuss mailing list