Received: from eggs.gnu.org ([2001:4830:134:3::10]:56113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSW69-0001q5-A5 for qemu-devel@nongnu.org; Sat, 05 Oct 2013 13:57:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSW64-0000HQ-D3 for qemu-devel@nongnu.org; Sat, 05 Oct 2013 13:57:01 -0400 Received: from gelbbaer.kn-bremen.de ([78.46.108.116]:59380 helo=smtp.kn-bremen.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSW64-0000HH-6X for qemu-devel@nongnu.org; Sat, 05 Oct 2013 13:56:56 -0400 From: Juergen Lock Date: Sat, 5 Oct 2013 19:54:33 +0200 Message-ID: <20131005175432.GA25070@enceladus10.kn-bremen.de> References: <20131003140937.GA59761@enceladus10.kn-bremen.de> <524E6B19.9020805@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <524E6B19.9020805@siemens.com> Subject: Re: [Qemu-devel] [PATCH] cpu-exec(): also reload CPUClass *cc after longjmp return List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Peter Maydell , Dimitry Andric , QEMU Developers , Andreas Faerber On Fri, Oct 04, 2013 at 09:15:37AM +0200, Jan Kiszka wrote: > On 2013-10-03 18:05, Peter Maydell wrote: > > On 3 October 2013 23:09, Juergen Lock 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 > >> Found-by: Dimitry Andric > >> > >> --- 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... > > But we didn't decide if we should stop supporting the affected compiler > versions. > > Does this issue also exist with the latest clang version available for > your platform? > It happens with up to date clang as it's in FreeBSD 10.0-current which is due for a release soon. I think the clang folks are looking into this issue but I don't know if a fix will make it into the release... (For now I've added the workaround to the FreeBSD qemu-devel port.) Thanx, Juergen