[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec
From: |
Andrew Baumann |
Subject: |
Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c |
Date: |
Tue, 1 Mar 2016 06:23:37 +0000 |
> From: Stefan Weil [mailto:address@hidden
> Sent: Monday, 29 February 2016 9:08 PM
>
> The rest of the code can use longjmp with stack unwinding.
>
> Signed-off-by: Stefan Weil <address@hidden>
> ---
>
> 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
Thanks Stefan. This works for me with a mingw64 native build.
Tested-by: Andrew Baumann <address@hidden>
Andrew
- [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c, Stefan Weil, 2016/03/01
- Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c,
Andrew Baumann <=
- Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c, Peter Maydell, 2016/03/01
- Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c, Stefan Weil, 2016/03/01
- Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c, Peter Maydell, 2016/03/01
- Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c, Stefan Weil, 2016/03/01
- Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c, Andrew Baumann, 2016/03/01
- Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c, Paolo Bonzini, 2016/03/01
- Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c, Peter Maydell, 2016/03/01
- Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c, Stefan Weil, 2016/03/01