This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
RE: stack base pointer not align to 4 bytes
- From: "Paul D. DeRocco" <pderocco at ix dot netcom dot com>
- To: "eCos Discuss" <ecos-discuss at ecos dot sourceware dot org>
- Date: Sun, 25 May 2008 23:00:16 -0700
- Subject: RE: [ECOS] stack base pointer not align to 4 bytes
> 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