qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Pavel Dovgaluk" <Pavel.Dovgaluk@ispras.ru>
To: 'Stefan Weil' <sw@weilnetz.de>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, zealot351@gmail.com, maria.klimushenkova@ispras.ru
Subject: Re: [Qemu-devel] [PATCH] win64: perform correct setjmp calls
Date: Tue, 10 Feb 2015 08:50:06 +0300	[thread overview]
Message-ID: <000901d044f5$6d265790$477306b0$@Dovgaluk@ispras.ru> (raw)
In-Reply-To: <54D90EE6.50402@weilnetz.de>

> From: Stefan Weil [mailto:sw@weilnetz.de]
> Am 09.02.2015 um 09:07 schrieb Pavel Dovgaluk:
> >> From: Stefan Weil [mailto:sw@weilnetz.de]
> >> Am 09.02.2015 um 08:55 schrieb Pavel Dovgalyuk:
> >>> On w64, setjmp is implemented by _setjmp which needs a second parameter.
> >>> This parameter should be NULL to allow using longjump from generated code.
> >>> This patch replaces all usages of setjmp.h with new header files which
> >>> replaces setjmp with _setjmp function on win64 platform.
> >>>
> >>> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> >> Please have a look at include/sysemu/os-win32.h. I think that your patch
> >> is not needed because the current code already uses _setjmp.
> > Right, but some of the files (e.g. include/qom/cpu.h) include setjmp.h directly.
> > Then we have the following for compiling cpu-exec.c:
> >
> > cpu-exec.c:
> > ...
> > os-win32.h
> > ...
> > setjmp.h
> > ...
> >
> > In this situation cpu-exec will call incorrect setjmp function.
> >
> > Pavel Dovgalyuk
> 
> 
> It won't call the wrong setjmp function, at least not in my tests.
> cpu-exec.c gets the setjmp declaration from os-win32.h. Without it, QEMU
> would be unusable because it would crash very soon during the emulation.
> 
> Do you see problems caused by a wrong setjmp with latest QEMU? If yes:
> which build environment do you use (host, compiler, version of MinGW*)?

Yes, I've got the problems. To verify the correctness of the call I disassembled
cpu-exec.o and found that setjmp is called with second parameter not equal to zero.

I'm using Cygwin environment and packages from here: http://win-builds.org/
My host OS is Windows 7x64 and the compiler is x86_64-w64-mingw32-gcc.exe (GCC) 4.8.3

Pavel Dovgalyuk

      reply	other threads:[~2015-02-10  5:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09  7:55 [Qemu-devel] [PATCH] win64: perform correct setjmp calls Pavel Dovgalyuk
2015-02-09  8:04 ` Stefan Weil
2015-02-09  8:07   ` Pavel Dovgaluk
2015-02-09 19:47     ` Stefan Weil
2015-02-10  5:50       ` Pavel Dovgaluk [this message]

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='000901d044f5$6d265790$477306b0$@Dovgaluk@ispras.ru' \
    --to=pavel.dovgaluk@ispras.ru \
    --cc=maria.klimushenkova@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    --cc=zealot351@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).