From patchwork Wed Sep 6 16:05:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9941087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CE1D46035F for ; Wed, 6 Sep 2017 16:21:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEA0428ABB for ; Wed, 6 Sep 2017 16:21:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1FBB28BD3; Wed, 6 Sep 2017 16:21:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 5A0C828ABB for ; Wed, 6 Sep 2017 16:21:53 +0000 (UTC) Received: from localhost ([::1]:37013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpd5M-0003cu-E4 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Sep 2017 12:21:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpcql-0000Je-IF for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpcqd-0002Qu-EG for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:47 -0400 Received: from mail-pf0-x230.google.com ([2607:f8b0:400e:c00::230]:34782) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dpcqd-0002Mh-4r for qemu-devel@nongnu.org; Wed, 06 Sep 2017 12:06:39 -0400 Received: by mail-pf0-x230.google.com with SMTP id m1so13485441pfk.1 for ; Wed, 06 Sep 2017 09:06:39 -0700 (PDT) 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-transfer-encoding; bh=uZN6Az7gZPVb4WSjnLDcTNF9gV7xLS6OAi0/yMa5ABU=; b=TCBhE9C3L4eNvhojKApqPnrXy5uoOqLGYEEqYBUnYzRg7T55eep2nReK4TiTe+UhQZ ICeR0fmA4cL9WrRBlbr0LTNx3SyJ59rBuY1yOd2ZWdMZgoQhEXUjlV4hyWiT2rJyWtg9 TnJJ/5NAx+Y/Uo7jj0ejuaDXuxepjg2HkwiIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uZN6Az7gZPVb4WSjnLDcTNF9gV7xLS6OAi0/yMa5ABU=; b=oloO2X+cH/XFN632OioSDd9hqPoLXGaVY1OOxQBJxa/ewdNL6MEkMxC9Dk1aZdnOCD Xxv1QK5zZfUANWRa1jub4XO3xRWkWudllJkTjD4TarZjDCi9BQ+mqknWAHkj+OYL76jw qHJq1yS+tWolECCs0RxP+hFMV8bzVeAvPsrQfoHmUlXC8jXDJNSteme2Km0V+MFPxlI4 WhErCuOnY6TVFJD96CyaWYPgJdziu11FyyOazbt6CvOFD7UNGQ1GXsQz6v1B+zLw1TWW nf0SzmZXPCecrpmavG0BpgBUciisKQQNX3HJf1sVYYa71780q2jTLuf38QZ4vf9LxX1V MlIA== X-Gm-Message-State: AHPjjUj/TwwTvJtq03RShRRA+Hv6pbdSPLr9wa8rfBhfcYQlduoBWr+b T0CxnEpGsnuctc/eQau3xQ== X-Google-Smtp-Source: ADKCNb4grL0UBTs6Z0NyJgJ2zN4YFUOlDzDzSUyHjL7GEWBWDfj/AfpeMsdq5lm14esRMetHU+ic8w== X-Received: by 10.84.130.97 with SMTP id 88mr9072991plc.138.1504713997938; Wed, 06 Sep 2017 09:06:37 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id t65sm262863pfk.59.2017.09.06.09.06.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Sep 2017 09:06:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 09:05:57 -0700 Message-Id: <20170906160612.22769-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170906160612.22769-1-richard.henderson@linaro.org> References: <20170906160612.22769-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::230 Subject: [Qemu-devel] [PULL 17/32] target/arm: [tcg, a64] Port to init_disas_context X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Lluís Vilanova Incrementally paves the way towards using the generic instruction translation loop. Signed-off-by: Lluís Vilanova Reviewed-by: Richard Henderson Reviewed-by: Alex Benneé Message-Id: <150002340430.22386.10889954302345646107.stgit@frigg.lan> [rth: Adjust for max_insns interface change.] Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index f5c678ef25..e8dc96c28a 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -11200,21 +11200,12 @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s) free_tmp_a64(s); } -void gen_intermediate_code_a64(DisasContextBase *dcbase, CPUState *cs, - TranslationBlock *tb) +static int aarch64_tr_init_disas_context(DisasContextBase *dcbase, + CPUState *cpu, int max_insns) { - CPUARMState *env = cs->env_ptr; - ARMCPU *cpu = arm_env_get_cpu(env); DisasContext *dc = container_of(dcbase, DisasContext, base); - target_ulong next_page_start; - int max_insns; - - dc->base.tb = tb; - dc->base.pc_first = dc->base.tb->pc; - dc->base.pc_next = dc->base.pc_first; - dc->base.is_jmp = DISAS_NEXT; - dc->base.num_insns = 0; - dc->base.singlestep_enabled = cs->singlestep_enabled; + CPUARMState *env = cpu->env_ptr; + ARMCPU *arm_cpu = arm_env_get_cpu(env); dc->pc = dc->base.pc_first; dc->condjmp = 0; @@ -11240,7 +11231,7 @@ void gen_intermediate_code_a64(DisasContextBase *dcbase, CPUState *cs, dc->fp_excp_el = ARM_TBFLAG_FPEXC_EL(dc->base.tb->flags); dc->vec_len = 0; dc->vec_stride = 0; - dc->cp_regs = cpu->cp_regs; + dc->cp_regs = arm_cpu->cp_regs; dc->features = env->features; /* Single step state. The code-generation logic here is: @@ -11265,6 +11256,24 @@ void gen_intermediate_code_a64(DisasContextBase *dcbase, CPUState *cs, init_tmp_a64_array(dc); + return max_insns; +} + +void gen_intermediate_code_a64(DisasContextBase *dcbase, CPUState *cs, + TranslationBlock *tb) +{ + CPUARMState *env = cs->env_ptr; + DisasContext *dc = container_of(dcbase, DisasContext, base); + target_ulong next_page_start; + int max_insns; + + dc->base.tb = tb; + dc->base.pc_first = dc->base.tb->pc; + dc->base.pc_next = dc->base.pc_first; + dc->base.is_jmp = DISAS_NEXT; + dc->base.num_insns = 0; + dc->base.singlestep_enabled = cs->singlestep_enabled; + next_page_start = (dc->base.pc_first & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; max_insns = dc->base.tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { @@ -11273,6 +11282,7 @@ void gen_intermediate_code_a64(DisasContextBase *dcbase, CPUState *cs, if (max_insns > TCG_MAX_INSNS) { max_insns = TCG_MAX_INSNS; } + max_insns = aarch64_tr_init_disas_context(&dc->base, cs, max_insns); gen_tb_start(tb);