From patchwork Mon Jul 24 20:27:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9860391 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 7CF4460385 for ; Mon, 24 Jul 2017 20:37:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70A2D285AD for ; Mon, 24 Jul 2017 20:37:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65CBB285BD; Mon, 24 Jul 2017 20:37:56 +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 06598285AD for ; Mon, 24 Jul 2017 20:37:56 +0000 (UTC) Received: from localhost ([::1]:56860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZk71-0001Qc-8J for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Jul 2017 16:37:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZjxs-0003GW-R3 for qemu-devel@nongnu.org; Mon, 24 Jul 2017 16:28:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZjxr-0001EG-LT for qemu-devel@nongnu.org; Mon, 24 Jul 2017 16:28:28 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:36120) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZjxr-0001Di-HF for qemu-devel@nongnu.org; Mon, 24 Jul 2017 16:28:27 -0400 Received: by mail-qk0-x243.google.com with SMTP id d136so10952810qkg.3 for ; Mon, 24 Jul 2017 13:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gl3q8qjnAN6tqhh+ZNa/8AEbbFFM4qkBsue2FUoJDv8=; b=IIQJgyd/+6AwsmOFe6syP87FLkUFoeWHtlnaAyf4EVNWs5iJ2K+G9Y3yeA/+WndcNN U5wS3UgBzXlxJnPzqY8CqzYnD1yxtHkfz/L26alq3J8v6jaeWDVg3POkssazvQBHhAjU xVW1ITDAQIGQpUYg1Xtr1hJwv3g4UK7IKG4v4tsShrBbjyLNeHWpxAd57jk3ZZNrQoWm QV4FULPmEdGALFuKT4iH9ovBHPaqoOIY9jhNyEfI3giG8pLA5nNrcv3mw/UvTa09cOLy r8RClhhd12944Ov+ZLCzfbo7nvuwNHOLTKnFhmqGgt1gp6tpFZItt6Mx3+qiSDCHvn8V Quhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gl3q8qjnAN6tqhh+ZNa/8AEbbFFM4qkBsue2FUoJDv8=; b=NiADbfe6OvgzckmooYCKW7TysjSqW7a8H1qYanfoOK3liPxUtIz0556hi/cjGJ88xO H5srX/AGYeQPKRPpCzwov6c6Lxf0H4bP8KnqjgKxhrPemNVHitOPPQM39rusUHD0mVuN OtCLR48nROVKWKEvknV9lJvCWX3fZwiNpsn1S1WJvwhMGM9QKbRFTpU34PbdguRtlx4b ZHc0zSbvG6I13ZWrMCmv9llsvomLRzLPUJcAIXN5c0Sq5CmX4EAKRMIQKymRylUvtfNC UhIN3UCJoQ2e21khynfJ2/V9PlKswdDZhdBxs4KYiFSywjtzEb7VNOLz+pFfclt053yn gTew== X-Gm-Message-State: AIVw1133Bmimh2Kd7Yi/oMwFlQqJ/OpamTRN7DqRszVmV+TO7ID/mVq/ /oblFC/jPJuWG3Fco5M= X-Received: by 10.55.21.28 with SMTP id f28mr12570412qkh.220.1500928106755; Mon, 24 Jul 2017 13:28:26 -0700 (PDT) Received: from bigtime.com ([71.217.194.233]) by smtp.gmail.com with ESMTPSA id p52sm9196808qtc.74.2017.07.24.13.28.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jul 2017 13:28:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 24 Jul 2017 13:27:13 -0700 Message-Id: <20170724202728.25960-18-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170724202728.25960-1-rth@twiddle.net> References: <20170724202728.25960-1-rth@twiddle.net> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [PATCH v15 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: cota@braap.org, vilanova@ac.upc.edu 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 7e2dee59ca..2919e5a636 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -11179,21 +11179,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; @@ -11219,7 +11210,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: @@ -11244,6 +11235,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) { @@ -11252,6 +11261,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);