From: Stefan Weil <sw@weilnetz.de>
To: QEMU Developer <qemu-devel@nongnu.org>,
Andrew Baumann <Andrew.Baumann@microsoft.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Stefan Weil <sw@weilnetz.de>,
Richard Henderson <rth@twiddle.net>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c
Date: Tue, 1 Mar 2016 06:07:49 +0100 [thread overview]
Message-ID: <1456808869-20286-1-git-send-email-sw@weilnetz.de> (raw)
The rest of the code can use longjmp with stack unwinding.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
This is a bug fix needed for 64 bit Windows.
QEMU for Windows currently gets the wrong definition for
sigsetjmp. It uses stack unwinding for longjmp which results
in a crash when it is called from generated code.
Thanks to Andrew Baumann for his reminder that this patch was
still missing. Andrew, could you please test it with your
RPi emulation?
Regards,
Stefan
cpu-exec.c | 9 +++++++++
include/sysemu/os-win32.h | 8 --------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index fd92452..6a725e0 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -33,6 +33,15 @@
#endif
#include "sysemu/replay.h"
+#if defined(_WIN64)
+/* On w64, sigsetjmp is implemented by _setjmp which needs a second parameter.
+ * If this parameter is NULL, longjump does no stack unwinding.
+ * That is what we need for QEMU. Passing the value of register rsp (default)
+ * lets longjmp try a stack unwinding which will crash with generated code. */
+#undef sigsetjmp
+#define sigsetjmp(env, savesigs) _setjmp(env, NULL)
+#endif
+
/* -icount align implementation. */
typedef struct SyncClocks {
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
index fbed346..b151e74 100644
--- a/include/sysemu/os-win32.h
+++ b/include/sysemu/os-win32.h
@@ -55,14 +55,6 @@
# define EWOULDBLOCK WSAEWOULDBLOCK
#endif
-#if defined(_WIN64)
-/* On w64, setjmp is implemented by _setjmp which needs a second parameter.
- * If this parameter is NULL, longjump does no stack unwinding.
- * That is what we need for QEMU. Passing the value of register rsp (default)
- * lets longjmp try a stack unwinding which will crash with generated code. */
-# undef setjmp
-# define setjmp(env) _setjmp(env, NULL)
-#endif
/* QEMU uses sigsetjmp()/siglongjmp() as the portable way to specify
* "longjmp and don't touch the signal masks". Since we know that the
* savemask parameter will always be zero we can safely define these
--
2.1.4
next reply other threads:[~2016-03-01 5:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 5:07 Stefan Weil [this message]
2016-03-01 6:23 ` [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c Andrew Baumann
2016-03-01 9:59 ` Peter Maydell
2016-03-01 11:54 ` Stefan Weil
2016-03-01 12:22 ` Peter Maydell
2016-03-01 13:15 ` Stefan Weil
2016-03-01 17:46 ` Andrew Baumann
2016-03-01 17:53 ` Paolo Bonzini
2016-03-01 17:54 ` Peter Maydell
2016-03-01 19:08 ` Stefan Weil
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=1456808869-20286-1-git-send-email-sw@weilnetz.de \
--to=sw@weilnetz.de \
--cc=Andrew.Baumann@microsoft.com \
--cc=crosthwaite.peter@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).