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]

1.3, nonaligned stack


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]