From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aait8-00078Z-JY for qemu-devel@nongnu.org; Tue, 01 Mar 2016 06:54:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aait5-0000gV-Tm for qemu-devel@nongnu.org; Tue, 01 Mar 2016 06:54:50 -0500 Received: from smtp.mail.uni-mannheim.de ([134.155.96.80]:36102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aait5-0000g9-Nk for qemu-devel@nongnu.org; Tue, 01 Mar 2016 06:54:47 -0500 References: <1456808869-20286-1-git-send-email-sw@weilnetz.de> From: Stefan Weil Message-ID: <56D58309.10206@weilnetz.de> Date: Tue, 1 Mar 2016 12:54:49 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Use special code for sigsetjmp only in cpu-exec.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Peter Crosthwaite , QEMU Developer , Andrew Baumann , Richard Henderson Am 01.03.2016 um 10:59 schrieb Peter Maydell: > On 1 March 2016 at 05:07, Stefan Weil wrote: >> The rest of the code can use longjmp with stack unwinding. >> >> Signed-off-by: Stefan Weil >> --- >> >> 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? > I don't understand this patch. Why doesn't it work to have > sigsetjmp() be implemented the same way for every use that > QEMU makes of it? > > thanks > -- PMM It does, as long as the "same way" is the correct one, namely the one without stack unwinding. The current code used to work, but re-arranged include files broke the working code somewhere in the past: include/sysemu/os-win32.h does the right thing at the wrong place. Its correct definition of sigsetjmp is overwritten by the definition from a Mingw-w64 system header file which triggers stack unwinding. Stack unwinding is fatal for QEMU's generated code. My patch makes sure that the critical code in cpu-exec.c gets the correct definition of sigsetjmp. In addition, it removes code which might or might not change the default definition of sigsetjmp (depending on the order of include files). Now all other files beside cpu-exec.c will use the default behaviour with stack unwinding. Regards, Stefan