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]

Re: portability problem in pthread_create()


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


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