From patchwork Thu Feb 4 14:56:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 8223711 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7B5C99F1C0 for ; Thu, 4 Feb 2016 14:56:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC74020395 for ; Thu, 4 Feb 2016 14:56:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8EB3D203A0 for ; Thu, 4 Feb 2016 14:56:55 +0000 (UTC) Received: from localhost ([::1]:42206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRLL4-0001hk-Uq for patchwork-qemu-devel@patchwork.kernel.org; Thu, 04 Feb 2016 09:56:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRLKn-0001dt-0p for qemu-devel@nongnu.org; Thu, 04 Feb 2016 09:56:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRLKj-0001PY-Td for qemu-devel@nongnu.org; Thu, 04 Feb 2016 09:56:36 -0500 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:38669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRLKj-0001P3-Jm for qemu-devel@nongnu.org; Thu, 04 Feb 2016 09:56:33 -0500 Received: by mail-wm0-x22d.google.com with SMTP id p63so121010447wmp.1 for ; Thu, 04 Feb 2016 06:56:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=4uuBjztc1Dr56qBMz4GNwNio9FkY9k6IxhqfMzAT1uA=; b=ZPkket99hjSojMLmRGXc2nBO22Dq6H2Pb6W5xV22I8Wv3tnLGbD3Sh507dVkFCLtlO 00Vt9cZ1hgFNA8TL7rgN/NMvpeYtuq7loWkqUXplXQJg4kZb1tGkmrjBZrl2cYgZ/lF8 tlo0kc0a41q6WHuK3gsGWZ+n1Jhd8hwsbhoQw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=4uuBjztc1Dr56qBMz4GNwNio9FkY9k6IxhqfMzAT1uA=; b=bSQrJN72ec02nOgertVSZ/gsmV1teXZgbK7IjRSTEyzqOFMPiRtIQ0TfUFjMcC9JBb lX1X25foe2BkWoIFv/zK7bttW/lZKwJFUrESADAaKqGjt/6/KGelowIBZ71Io4JINT3B THm8v1ue8p9Qa+gDhWKehWNBCxCjZZdKTRO/Qd2CfJoYo8TtYXRfAQut/4/T1/8a0SCx 3+uzEaARfWPK2Z/u7UjqVBetJZgjUcMHeSBZq7JyjJCCk/NozAwpH3gqGAMPutRHtr7l pfedhJmNXbFGKbONDWJOzvx2e320unEVZQ2ZMJaFXixJTfBeU74wSfr2x+nU/uSZ06UT KmAQ== X-Gm-Message-State: AG10YORVCYjQbpbUbajzGgkhHJFmcK35M9aiV7xIw3Ja4mYQ6lEVxuvuTix0QL+EGKQB3VCE X-Received: by 10.28.91.147 with SMTP id p141mr10833597wmb.19.1454597792875; Thu, 04 Feb 2016 06:56:32 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id n5sm13131719wmf.3.2016.02.04.06.56.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Feb 2016 06:56:30 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 9FB443E04E7; Thu, 4 Feb 2016 14:56:29 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 4 Feb 2016 14:56:13 +0000 Message-Id: <1454597781-18115-2-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1454597781-18115-1-git-send-email-alex.bennee@linaro.org> References: <1454597781-18115-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22d Cc: peter.maydell@linaro.org, Peter Crosthwaite , dgilbert@redhat.com, crosthwaitepeter@gmail.com, pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net, rth@twiddle.net Subject: [Qemu-devel] [PATCH v5 1/9] tcg: pass down TranslationBlock to tcg_code_gen 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP My later debugging patches need access to the origin PC which is held in the TranslationBlock structure. Pass down the whole structure as it also holds the information about the code start point. Signed-off-by: Alex Bennée --- v1 - checkpatch fixes v5 - much simplified due to changes since last posting --- tcg/tcg.c | 6 +++--- tcg/tcg.h | 2 +- translate-all.c | 10 ++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 3ce02dc..0101cc1 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2316,7 +2316,7 @@ void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf) #endif -int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf) +int tcg_gen_code(TCGContext *s, TranslationBlock *tb) { int i, oi, oi_next, num_insns; @@ -2375,8 +2375,8 @@ int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf) tcg_reg_alloc_start(s); - s->code_buf = gen_code_buf; - s->code_ptr = gen_code_buf; + s->code_buf = tb->tc_ptr; + s->code_ptr = tb->tc_ptr; tcg_out_tb_init(s); diff --git a/tcg/tcg.h b/tcg/tcg.h index a696922..9a18ee4 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -626,7 +626,7 @@ void tcg_context_init(TCGContext *s); void tcg_prologue_init(TCGContext *s); void tcg_func_start(TCGContext *s); -int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf); +int tcg_gen_code(TCGContext *s, TranslationBlock *tb); void tcg_set_frame(TCGContext *s, int reg, intptr_t start, intptr_t size); diff --git a/translate-all.c b/translate-all.c index ab61fac..dce00d5 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1055,7 +1055,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, TranslationBlock *tb; tb_page_addr_t phys_pc, phys_page2; target_ulong virt_page2; - tcg_insn_unit *gen_code_buf; int gen_code_size, search_size; #ifdef CONFIG_PROFILER int64_t ti; @@ -1078,8 +1077,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_ctx.tb_ctx.tb_invalidated_flag = 1; } - gen_code_buf = tcg_ctx.code_gen_ptr; - tb->tc_ptr = gen_code_buf; + tb->tc_ptr = tcg_ctx.code_gen_ptr; tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; @@ -1119,11 +1117,11 @@ TranslationBlock *tb_gen_code(CPUState *cpu, the tcg optimization currently hidden inside tcg_gen_code. All that should be required is to flush the TBs, allocate a new TB, re-initialize it per above, and re-do the actual code generation. */ - gen_code_size = tcg_gen_code(&tcg_ctx, gen_code_buf); + gen_code_size = tcg_gen_code(&tcg_ctx, tb); if (unlikely(gen_code_size < 0)) { goto buffer_overflow; } - search_size = encode_search(tb, (void *)gen_code_buf + gen_code_size); + search_size = encode_search(tb, (void *)tb->tc_ptr + gen_code_size); if (unlikely(search_size < 0)) { goto buffer_overflow; } @@ -1145,7 +1143,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, #endif tcg_ctx.code_gen_ptr = (void *) - ROUND_UP((uintptr_t)gen_code_buf + gen_code_size + search_size, + ROUND_UP((uintptr_t)tb->tc_ptr + gen_code_size + search_size, CODE_GEN_ALIGN); /* check next page if needed */