[ECOS] stack base pointer not align to 4 bytes
Paul D. DeRocco
pderocco@ix.netcom.com
Mon May 26 06:00:00 GMT 2008
> From: Xiaochen Zhou
>
> Here is the modified kernel/current/include/thread.inl fiile to
> check and asjust stack alignment automaticly:
>
> inline void Cyg_HardwareThread::attach_stack(CYG_ADDRESS
> s_base_p, cyg_uint32 s_size_p)
> {
> CYG_ADDRESS s_base = s_base_p;
> cyg_uint32 s_size = s_size_p;
>
> // Check and adjust stack alignment automaticly
> if( 0 != ((sizeof(CYG_WORD)-1) & (cyg_uint32)s_base)) {
> s_base += sizeof(cyg_uint32);
> s_base &= ~(sizeof(CYG_WORD)-1);
> s_size -= sizeof(cyg_uint32);
> }
> if( 0 != ((sizeof(CYG_WORD)-1) & (cyg_uint32)s_size)) {
> s_size &= ~(sizeof(CYG_WORD)-1);
> }
>
> ....
> ....
> ....
> }
It seems to me that this is the wrong place to fix this, because the need
for a particular alignment is hardware-dependent. The comment on this
function indicates that there is a macro that will be used instead, if the
HAL defines it. That seems like the place to do this sort of thing.
--
Ciao, Paul D. DeRocco
Paul mailto:pderocco@ix.netcom.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
More information about the Ecos-discuss
mailing list