From patchwork Wed Jun 22 10:58:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 2158 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4563723F08 for ; Wed, 22 Jun 2011 10:58:31 +0000 (UTC) Received: from mail-vw0-f52.google.com (mail-vw0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id D9008A18535 for ; Wed, 22 Jun 2011 10:58:30 +0000 (UTC) Received: by vws16 with SMTP id 16so741378vws.11 for ; Wed, 22 Jun 2011 03:58:30 -0700 (PDT) Received: by 10.52.95.194 with SMTP id dm2mr743226vdb.47.1308740310124; Wed, 22 Jun 2011 03:58:30 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.52.183.130 with SMTP id em2cs128621vdc; Wed, 22 Jun 2011 03:58:29 -0700 (PDT) Received: by 10.227.11.148 with SMTP id t20mr560036wbt.98.1308740308002; Wed, 22 Jun 2011 03:58:28 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk [81.2.115.146]) by mx.google.com with ESMTPS id ek19si1084920wbb.69.2011.06.22.03.58.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Jun 2011 03:58:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1QZL8b-0004ar-Cf; Wed, 22 Jun 2011 11:58:25 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH] exec.c: Fix calculation of code_gen_buffer_max_size Date: Wed, 22 Jun 2011 11:58:25 +0100 Message-Id: <1308740305-17634-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 When calculating the point at which we should not try to put another TB into the code gen buffer, we have to allow not just for OPC_MAX_SIZE but OPC_BUF_SIZE. This is because the target translate.c will only stop when an instruction has put it past the OPC_MAX_SIZE limit, so we have to include the MAX_OP_PER_INSTR margin which that final insn might have used. Signed-off-by: Peter Maydell --- exec.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index 09928a3..c910840 100644 --- a/exec.c +++ b/exec.c @@ -555,8 +555,8 @@ static void code_gen_alloc(unsigned long tb_size) #endif #endif /* !USE_STATIC_CODE_GEN_BUFFER */ map_exec(code_gen_prologue, sizeof(code_gen_prologue)); - code_gen_buffer_max_size = code_gen_buffer_size - - (TCG_MAX_OP_SIZE * OPC_MAX_SIZE); + code_gen_buffer_max_size = code_gen_buffer_size - + (TCG_MAX_OP_SIZE * OPC_BUF_SIZE); code_gen_max_blocks = code_gen_buffer_size / CODE_GEN_AVG_BLOCK_SIZE; tbs = qemu_malloc(code_gen_max_blocks * sizeof(TranslationBlock)); }