From: Avi Kivity <avi@redhat.com>
To: Matteo Frigo <athena@fftw.org>
Cc: kvm@vger.kernel.org
Subject: Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM
Date: Fri, 13 Feb 2009 23:46:20 +0200 [thread overview]
Message-ID: <4995EA2C.7060004@redhat.com> (raw)
In-Reply-To: <87ab8q6ngc.fsf@cilk.com>
[-- Attachment #1: Type: text/plain, Size: 1415 bytes --]
Matteo Frigo wrote:
> Avi Kivity <avi@redhat.com> writes:
>
>
>> More questions:
>> - is the bad 'mov gs' instruction reached on AMD? or is it avoided
>> somehow? What about bare metal?
>>
>
> The instruction is indeed reached on amd, and gs is 0x2b after
> the instruction. I don't know about bare metal.
>
>
>> - does the attached program fail when compiled and run in cygwin on an
>> AMD host?
>>
>
> The program runs as follows:
>
> w2k3-64:/cygdrive/v$ gcc -O gs.c
> w2k3-64:/cygdrive/v$ ./a.exe
> gs: 2b
> gs:0x30: 7efdb000
> test
>
>
>> - does setjmp()/longjmp() come from the Windows run-time library, or
>> from cygwin?
>>
>
> The setjmp()/longjmp() is in the cygwin library /bin/cygwin1.dll .
> bash calls longjmp() at the end of the expr built-in, which causes the
> problem reported by the original poster.
>
> I should also mention that, as an experiment, I have replaced the mov
> gs,ax instruction with a couple of no-ops in cygwin1.dll, and cygwin
> runs fine on Intel with this patch.
>
>
That was going to be my next question :)
Right now I don't understand how cygwin's longjmp() is supposed to work
at all, given that it clobbers gs.
Can you run the slightly modified gs.c (attached) and rerun on AMD? The
is to see if the runtime somehow restores gs.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
[-- Attachment #2: gs.c --]
[-- Type: text/x-csrc, Size: 371 bytes --]
#include <stdio.h>
int main()
{
unsigned short gs;
unsigned x;
asm ("mov %%gs, %0\n" : "=g"(gs));
asm ("movl %%gs:0x30, %0\n" : "=r"(x));
printf("gs: %x\n", gs);
printf("gs:0x30: %x\n", x);
asm volatile ("mov %0, %%gs\n" : : "g"(gs));
asm volatile ("movl %%gs:0x30, %0\n" : "=r"(x));
printf("gs:0x30: %x\n", x);
return 0;
}
next prev parent reply other threads:[~2009-02-13 21:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <40ddf2480901050654y268213d1jbf34f9d81d6faeb0@mail.gmail.com>
2009-01-05 16:22 ` Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM Jamie Kirkpatrick
2009-01-22 15:02 ` Avi Kivity
2009-02-06 1:28 ` Matteo Frigo
2009-02-13 20:01 ` Avi Kivity
2009-02-13 20:18 ` Matteo Frigo
2009-02-13 20:27 ` Avi Kivity
2009-02-13 20:28 ` Avi Kivity
2009-02-13 20:39 ` Matteo Frigo
2009-02-13 21:02 ` Avi Kivity
2009-02-13 21:23 ` Matteo Frigo
2009-02-13 21:46 ` Avi Kivity [this message]
2009-02-13 21:46 ` Avi Kivity
2009-02-13 21:49 ` Matteo Frigo
2009-02-13 21:52 ` Matteo Frigo
2009-02-13 22:05 ` Avi Kivity
2009-02-13 22:32 ` Avi Kivity
2009-02-13 22:46 ` Matteo Frigo
2009-02-13 22:52 ` Avi Kivity
2009-02-13 22:06 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4995EA2C.7060004@redhat.com \
--to=avi@redhat.com \
--cc=athena@fftw.org \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox