[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] cpu-exec(): also reload CPUClass *cc after long
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH] cpu-exec(): also reload CPUClass *cc after longjmp return |
Date: |
Fri, 4 Oct 2013 01:05:52 +0900 |
On 3 October 2013 23:09, Juergen Lock <address@hidden> wrote:
> Local variable CPUClass *cc needs to be reloaded after return from longjmp
> too. (This fixes the mips-softmmu crash observed on FreeBSD when qemu is
> built with clang.)
>
> Signed-off-by: Juergen Lock <address@hidden>
> Found-by: Dimitry Andric <address@hidden>
>
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -681,6 +681,10 @@ int cpu_exec(CPUArchState *env)
> * local variables as longjmp is marked 'noreturn'. */
> cpu = current_cpu;
> env = cpu->env_ptr;
> +#if !(defined(CONFIG_USER_ONLY) && \
> + (defined(TARGET_M68K) || defined(TARGET_PPC) || defined(TARGET_S390X)))
> + cc = CPU_GET_CLASS(cpu);
> +#endif
This is a c compiler or libc bug -- the C standard says that this
local variable should not be trashed by the longjmp. We were
actually discussing removing the current workarounds there...
-- PMM