This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: portability problem in pthread_create()
- From: Bart Veer <bartv at redhat dot com>
- To: lars dot viklund at axis dot com
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Tue, 5 Mar 2002 16:56:34 GMT
- Subject: Re: [ECOS] portability problem in pthread_create()
- References: <3C6BEE8B5E1BAC42905A93F13004E8ABB3F493@mailse01.axis.se>
- Reply-to: bartv at redhat dot com
>>>>> "Lars" == Lars Viklund <lars.viklund@axis.com> writes:
<snip>
>> Have you seen this assertion trigger under normal
>> circumstances?
Lars> Yes, on Axis ETRAX it does trigger when pthread_create()
Lars> tries to create the thread.
OK.
Rather than change pthread_create() and add aligning overhead to every
architecture, I think a better fix would be to change
Cyg_HardwareThread::attach_stack(). The assertions could be moved
to the bottom of the inline, which currently looks like this:
#ifdef HAL_THREAD_ATTACH_STACK
HAL_THREAD_ATTACH_STACK(stack_ptr, stack_base, stack_size);
#else
stack_ptr = stack_base + stack_size;
#endif
so either appropriate target-specific assertions could be added to
HAL_THREAD_ATTACH_STACK(), or to the #else case.
A disadvantage is that if either stack checking or stack measurement
is enabled the code may have performed word accesses to unaligned data
before the asserts, and possibly raised an exception. I suspect that
would still be good enough, in the sense of being able to debug the
problem quickly.
However, NickG is the authority on this code so he gets to decide on
the best way forward.
Bart
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss