This is the mail archive of the ecos-bugs@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]

[Bug 1000184] Ecos kernel data corrupted


http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000184





------- Additional Comments From erik@dd.nec.com.au  2005-30-06 08:10 -------
With CYG_KERNEL_SYNC_MBOX_QUEUE_SIZE = 50, two threads can play ping-pong via
mboxes, flashing a LED as they go. (i.e. everything works) Trying the same with
4 threads causes a machine check exception, during creation of the 4th thread,
in Cyg_Thread::add_to_list( void ). The exception arises when the code seems to
walk off the end of a linked list:

        do {
            if ( this == prev )
                break; // found it already!
            prev = prev->list_next;             <- prev = 0xDEADBEEF
        } while ( prev != thread_list );

In assembler, it looks like this:
(Superimposed source is my effort. objdump omitted it from this part.)

  Erik: do {
  Erik: if ( this == prev )
  111f28:   7c 03 48 00    cmpw  r3,r9
  111f2c:   41 a2 ff c0    beq-  111eec <_ZN10Cyg_Thread11add_to_listEv+0x34>
  Erik: prev = prev->list_next;              
  111f30:   81 29 00 70    lwz   r9,112(r9)     <-- r9 = 0xDEADBEEF
  Erik: } while ( prev != thread_list );
  111f34:   7c 09 00 00    cmpw  r9,r0
  111f38:   40 82 ff f0    bne+  111f28 <_ZN10Cyg_Thread11add_to_listEv+0x70>

On the first iteration, it fetches 0xDEADBEEF. On the second, the exception is
inevitable.

By setting CYGVAR_KERNEL_THREADS_LIST to 0, in ecos.ecc, I'm able to run 4
threads playing ping-pong with mboxes.

I'll try building again, without the explicit inclusion of kernel.h, in an
attempt to discover why the inclusion from kapi.h didn't take. (I saw the size
of cyg_mbox mboxes[1]; change from 56 to 216, with the header inclusion, AFAIR.)




------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


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