This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: New 64 bit Cygwin DLL
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin-developers at cygwin dot com
- Date: Tue, 19 Mar 2013 12:29:01 -0400
- Subject: Re: New 64 bit Cygwin DLL
- References: <20130319094622 dot GL3003 at calimero dot vinschen dot de> <20130319160819 dot GA5336 at ednor dot casa dot cgf dot cx> <20130319162407 dot GC20727 at calimero dot vinschen dot de>
- Reply-to: cygwin-developers at cygwin dot com
On Tue, Mar 19, 2013 at 05:24:07PM +0100, Corinna Vinschen wrote:
>On Mar 19 12:08, Christopher Faylor wrote:
>> On Tue, Mar 19, 2013 at 10:46:22AM +0100, Corinna Vinschen wrote:
>> >Hi guys,
>> >
>> >
>> >at long last, it looks like we found the real bug which was the reason
>> >for the random crashes.
>> >
>> >There's a function sigdelayed, written in assembler, which is called
>> >when a thread got a signal. Due to the way the function is called,
>> >it turned out that it was missing two crucial features:
>> >
>> >- It can be called with any stack alignment, but on x86_64 it's important
>> > that the stack is always 16 byte aligned when calling functions. So
>> > sigdelayed had to make sure to align the stack before trundling along.
>>
>> >- sigdelayed only saved and restored the CPU registers which are
>> > callee-saved in the Microsoft ABI, plus the registers used for the
>> > return value of a function. Given how sigdelayed is called, this
>> > was insufficient. The original, interrupted function needs the CPU
>> > in its original state when sigdelayed returns to it, so sigdelayed
>> > has to save and restore *all* registers.
>>
>> That's not really true for the 32-bit version. eax and ebx aren't
>> normally saved around function calls but they are for sigdelayed.
>
>Yes, I saw that. And I thought it's necessary only for 32 bit due to
>the different calling conventions, so I only saved the caller-saved and
>return value registers on x86_64. So, in fact, this is entirely my own
>fault.
>
>> It doesn't currently save floating point and debugging registers though.
>
>There may be situations in which it might be helpful to save and restore
>the FP regs on 32 bit as well, though. For instance, printf is a SIGFE
>function dealing with FP values.
Right.
cgf