From patchwork Wed Jun 22 14:16:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 101500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6AA7DB6FF4 for ; Thu, 23 Jun 2011 01:21:25 +1000 (EST) Received: from localhost ([::1]:42834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZPF2-0005hV-QK for incoming@patchwork.ozlabs.org; Wed, 22 Jun 2011 11:21:20 -0400 Received: from eggs.gnu.org ([140.186.70.92]:41838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZOEP-0007bG-8I for qemu-devel@nongnu.org; Wed, 22 Jun 2011 10:16:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZOEN-0006No-MO for qemu-devel@nongnu.org; Wed, 22 Jun 2011 10:16:37 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:32849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZOEN-0006NK-2X for qemu-devel@nongnu.org; Wed, 22 Jun 2011 10:16:35 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1QZOEK-0004eK-CA; Wed, 22 Jun 2011 15:16:32 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 22 Jun 2011 15:16:32 +0100 Message-Id: <1308752192-17849-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: patches@linaro.org Subject: [Qemu-devel] [PATCH] exec-all.h: Make MAX_OP_PER_INSTR large enough for target-arm's uses X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The target-arm frontend's worst-case TCG ops per instr is 194 (and in general many of the "load multiple registers" ARM instructions generate more than 100 TCG ops). Raise MAX_OP_PER_INSTR accordingly to avoid possible buffer overruns. Since it doesn't make any sense for the "64 bit guest on 32 bit host" case to have a smaller limit than the normal case, we collapse the two cases back into each other again. (This increase costs us about 14K in extra static buffer space and 21K of extra margin at the end of a 32MB codegen buffer.) Signed-off-by: Peter Maydell --- You might recall the patchset which moves the Neon load/store multiple instructions to helper functions, and which turns out to slow them down rather a lot. This is the other approach, which is just to raise the limit so that the existing implementations don't risk buffer overruns. The extra memory costs are tiny IMHO. (The Neon instructions are the worst offenders but the VFP load/store multiple insns also breach the previous limit. I think we should consider an implementation of an instruction that's been basically the same since VFP support was added to QEMU in 2005 to be an acceptable one, and make sure our buffer sizes cope with it :-)) exec-all.h | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/exec-all.h b/exec-all.h index 2a13a95..ef5f5b6 100644 --- a/exec-all.h +++ b/exec-all.h @@ -43,11 +43,7 @@ typedef ram_addr_t tb_page_addr_t; typedef struct TranslationBlock TranslationBlock; /* XXX: make safe guess about sizes */ -#if (HOST_LONG_BITS == 32) && (TARGET_LONG_BITS == 64) -#define MAX_OP_PER_INSTR 128 -#else -#define MAX_OP_PER_INSTR 96 -#endif +#define MAX_OP_PER_INSTR 208 #if HOST_LONG_BITS == 32 #define MAX_OPC_PARAM_PER_ARG 2