From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JFRtR-0005lU-1m for qemu-devel@nongnu.org; Thu, 17 Jan 2008 05:22:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JFRtO-0005kv-Gg for qemu-devel@nongnu.org; Thu, 17 Jan 2008 05:22:39 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JFRtN-0005kf-VQ for qemu-devel@nongnu.org; Thu, 17 Jan 2008 05:22:38 -0500 Received: from kassel160.server4you.de ([62.75.246.160] helo=csgraf.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JFRtN-0008JU-Ht for qemu-devel@nongnu.org; Thu, 17 Jan 2008 05:22:37 -0500 Received: from [10.10.100.38] (charybdis-ext.suse.de [195.135.221.2]) by csgraf.de (Postfix) with ESMTP id 6B8C7615F for ; Thu, 17 Jan 2008 11:22:36 +0100 (CET) Message-ID: <478EF8E3.2050503@csgraf.de> Date: Thu, 17 Jan 2008 07:42:43 +0100 From: Alexander Graf MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070406010906020700070700" Subject: [Qemu-devel] [PATCH 2/5] Add a PowerPC branch detector Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------070406010906020700070700 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit PowerPCs have static instruction lengths, so writing an "in-between" brl detection is quite simple on this architecture. You are welcome to write something like this for any other platform, but if a compile doesn't trigger build errors on PowerPC, it shouldn't on other platforms either, as PowerPC has quite advanced branch instructions. This patch is not mandatory, makes debugging a lot easier though. --------------070406010906020700070700 Content-Type: text/x-patch; name="qemu-gcc4-ppc-warnbranch.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-gcc4-ppc-warnbranch.patch" Index: qemu-snapshot-2008-01-15_05/dyngen.c =================================================================== --- qemu-snapshot-2008-01-15_05.orig/dyngen.c +++ qemu-snapshot-2008-01-15_05/dyngen.c @@ -1488,6 +1488,16 @@ void gen_code(const char *name, host_ulo if (get32((uint32_t *)p) != 0x4e800020) error("blr expected at the end of %s", name); copy_size = p - p_start; + +/* blr check for inline returns */ + + if(strstart(name, "op_", NULL) && !strstart(name, "op_exit", NULL)) { + for(p=p_start; p < p_end - 4; p+=4) { + if ((get32((uint32_t *)p) & 0xfc00fff0) == 0x4c000020) { + error("Inline blr detected in %s. Please append FORCE_RET to the function.", name); + } + } + } } #elif defined(HOST_S390) { --------------070406010906020700070700--