From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gc0W2-0005b9-OH for qemu-devel@nongnu.org; Mon, 23 Oct 2006 10:10:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gc0Vx-0005N0-DS for qemu-devel@nongnu.org; Mon, 23 Oct 2006 10:10:57 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gc0Vx-0005MW-5d for qemu-devel@nongnu.org; Mon, 23 Oct 2006 10:10:53 -0400 Received: from [65.74.133.4] (helo=mail.codesourcery.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Gc0Vw-0006jX-PK for qemu-devel@nongnu.org; Mon, 23 Oct 2006 10:10:53 -0400 From: Paul Brook Subject: Re: [Qemu-devel] qemu vs gcc4 Date: Mon, 23 Oct 2006 15:10:45 +0100 References: <45391B22.1050608@palmsource.com> <200610231320.08914.paul@codesourcery.com> <453CCAAF.9080904@qumranet.com> In-Reply-To: <453CCAAF.9080904@qumranet.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610231510.47140.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org > > That's exactly what my gcc4 hacks do. > > > > It gets complicated because a x86 uses variable length insn encodings so > > you don't know where insn boundaries are, and a jmp instruction is larger > > than a ret instruction so it's not always possible to do a straight > > replacement. > > how about > > void some_generated_instruction(u32 a1, u32 s2) > { > // code > asm volatile ( "" ); > } > > > that will force the code to fall through to the null asm code, avoiding > premature returns. > > if the code uses 'return' explicitly, turn it to a goto just before the > 'asm volatile'. We already do that. It doesn't stop gcc putting the return in the middle of the function. Paul