[ECOS] 1.3, nonaligned stack

Larice Robert larice@vidisys.de
Tue May 28 01:20:00 GMT 2002


I've seen access violations caused by non word aligned stacks.
the target is sh4 based.
the problem is in packages/kernel/current/src/common/thread.cxx line 1218

static char idle_thread_stack[CYGNUM_KERNEL_CPU_MAX][CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE];

at least my sh4 gcc toolchain did not align this static char array to
word boundaries (correct behaviour in my opinion).

i've fixed this with
static char idle_thread_stack[CYGNUM_KERNEL_CPU_MAX][CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE] __attribute__ ((aligned (4)));

but if i remember correctly, i've seen such char [] allocations for stack
space in other places too.

other cpu might allow non alligned access, but with reduced performance.


Robert Larice

-- 
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