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] |
Other format: | [Raw text] |
Bart wrote:2) adjust the stack pointer during thread creation, e.g.
register CYG_WORD* _sp_ = ((CYG_WORD*)((_sparg_) &~15));
This could be done in certain HAL's, e.g. I already do this in HAL_THREAD_INIT_CONTEXT() in the synthetic target. Or possibly it could be done more centrally in the kernel's Cyg_HardwareThread::attach_stack(), using an alignment #define provided by the HAL. Or optionally provided by the HAL, with the kernel using a #ifdef. Or possibly we have a default alignment of e.g. 4.
This would be a much smaller change than patching all the testcases with CYG_STACK macros or alignment directives, and probably more robust. There is a risk that some bytes of the provided stack will be wasted, but if the application developer is careful then the size will be just right and aligning the stack pointer has no effect. There are also a couple of extra cycles to do this alignment, but only during thread creation.
This is clearly the correct way of handling stack alignment. Those architectures that require their stacks aligned should already have the appropriate code in HAL_THREAD_INIT_CONTEXT(). Certainly i386, MIPS and PowerPC do. Any architecture that requires alignment but does not do it here is broken and should be fixed.
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
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |