[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/17] w64: Fix definition of setjmp
From: |
Stefan Weil |
Subject: |
[Qemu-devel] [PATCH 07/17] w64: Fix definition of setjmp |
Date: |
Sun, 15 Apr 2012 21:55:13 +0200 |
The default definition of setjmp which is implemented in MinGW-w64
cannot be used with programs like QEMU which call longjmp from
code without structured exception handling (SEH).
This code therefore disables stack unwinding.
We could also implement SEH for QEMU's generated JIT code, but
that is much more difficult. Stack unwinding would also cost
execution time.
Signed-off-by: Stefan Weil <address@hidden>
---
qemu-os-win32.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/qemu-os-win32.h b/qemu-os-win32.h
index b6533c0..753679b 100644
--- a/qemu-os-win32.h
+++ b/qemu-os-win32.h
@@ -56,6 +56,15 @@
# 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
+
/* Declaration of ffs() is missing in MinGW's strings.h. */
int ffs(int i);
--
1.7.0.4
- [Qemu-devel] [PATCH v2 00/17] w64: Add support for new host, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 01/17] tcg/i386: Use GDB JIT debugging interface only for hosts with ELF, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 02/17] tcg/i386: Add support for w64 ABI, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 05/17] w64: Use larger alignment for section with generated code, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 03/17] w64: Fix type casts used in some macros in cpu-all.h, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 08/17] w64: Fix struct CPUTLBEntry, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 04/17] w64: Fix data types in cpu-all.h, exec.c, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 09/17] softmmu: Use uintptr_t for physaddr and rename it, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 07/17] w64: Fix definition of setjmp,
Stefan Weil <=
- [Qemu-devel] [PATCH 14/17] cpu-exec: Remove non-portable type cast and fix format string, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 16/17] nbd: Fix compiler warning (w64), Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 17/17] w64: Fix time conversion for some versions of MinGW-w64, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 13/17] target-mips: Fix type cast for w64 (uintptr_t), Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 06/17] w32: Move defines for socket specific errors to qemu-os-win32.h, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 12/17] w64: Fix type cast in os_host_main_loop_wait, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 11/17] w64: Fix data types in softmmu*.h, Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 15/17] disas: Replace 'unsigned long' by 'uintptr_t', Stefan Weil, 2012/04/15
- [Qemu-devel] [PATCH 10/17] w64: Use uintptr_t in exec.c, Stefan Weil, 2012/04/15
- Re: [Qemu-devel] [PATCH v2 00/17] w64: Add support for new host, Blue Swirl, 2012/04/15