Subject: Re: Stability Problem with Cygwin Pthreads
From: Cliff Hones <[email-masked]>
To: Arash Partow <[email-masked]>
Cc: [email-masked]
Date: Mon, 03 Nov 2003 11:23:48 +0000

Arash Partow wrote:
> for the people that are interested, this is where the threads
> seem to be CONTINUALLY crashing:
> 
> /cygdrive/c/cygwin\bin>addr2line -e cygwin1.dll 0x610de964
> ../../../../../../cygwin-snapshot-20031028-1/newlib/libc/machine/i386/memcpy.S:53
> 
> .L11:
> shrl $2,ecx
> .p2align 2
> rep          <------------
> movsl
> 
> movl ebx,ecx
> andl $3,ecx
> 
> from what i can see the memcpy is moving data from esi to edi
> (ecx/4)'times (word blocks), however i don't think in the rep
> (REPZ) of the ecx ever gets to zero, or before it does it tries
> to copy data from a place which it does not have access to.

Seeing this, and recalling that the crashes are indeterminate,
suggests to me the possibility that the problem may be caused
by thread switches during the execution of the REP MOVSL
instruction.  REP instructions are interruptable, and can
be safely restarted from where they left off, *but*
indeterminate behaviour will occur if the processor string
direction flag (in EFLAGS, set by CLD/STD) is not saved
and restored correctly during a thread switch following
an interrupt.

Not knowing the internal workings of Cygwin (or Windows) threads,
I don't know if this could be the problem, and unfortunately
I don't have the time to research it, but I offer it as a
hopefully useful suggestion.

-- 
Cliff

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/