[ECOS] Stack access violations in eCos

Jonathan Larmour jifl@eCosCentric.com
Thu Apr 3 20:32:00 GMT 2003

Larice Robert wrote:
> I'm using SH4 (SH7751).

Aha! The one we definitely identified as potentially having the problem. 
So it looks like we've solved this one. Phew.

> calmrisc16 calmrisc32 seem to lack this alignment in HAL_THREAD_INIT_CONTEXT too.

Actually they lack HAL_THREAD_INIT_CONTEXT entirely! They're RedBoot-only 

> I agree with Bart, fixing HAL_THREAD_INIT_CONTEXT is the best way.

Yep. I'll do this now, however I don't have an SH. Can you try the 
attached patch?

After this I'll check in the other parts of your patch to do with the 
stuff that would remain a problem.

> One tiny issue then remains, the length of actual available space will be
> nondeterministic. Somebody might sooner or later recompile some application,
> get a different alignment of his char stack[], which will be corrected by
> the macro, but the actual available stackspace might suddenly be smaller up
> to 15 bytes. Of course one should have had enough headroom.

Definitely. Trying to be byte accurate with stack sizes tends to be a 
losing strategy.

 > But suddenly
> getting a stack overflow, just by recompilation, might be a somewhat
> unpleasant experience.
> Perhaps it would thus be reasonable to add the alignment too, just for
> better design practice.

Not sure. I'm not inclined to since conversely we don't want to overalign 
things as that can be wasteful, but it's not a strong feeling. Unless 
someone else speaks up anyway?

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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sh.align.pat
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20030403/c06b7668/attachment.ksh>
-------------- next part --------------
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