From patchwork Mon Jul 10 15:47:45 2017 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: 107312 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3600994qge; Mon, 10 Jul 2017 08:55:11 -0700 (PDT) X-Received: by 10.55.17.77 with SMTP id b74mr4999709qkh.257.1499702111303; Mon, 10 Jul 2017 08:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499702111; cv=none; d=google.com; s=arc-20160816; b=y2HvfnjaPTLIUkFXs0vVjYMMwWZb6GG2aa+6zdTM45V2VNeEaARAhgWiYP5OlBtZRY pa3WJ60fWIQwqi6OwWOZ7ANr1137HEznzIhjGsVl/K5Ub/v5fn0XWMIUs9ZXxARDkGwB /qE2qVc6UT1XokHdl5aev00TjxVqC2qXEC8nJXo2wZAV1eoc380BFKS/IFVfkCfsK+kn KRUzxME6AcgRrcktyWFJpMEuYiUucG16DcepB9m8FbxdZt6BQf623PBImS/oLqYgE8bh 67+SYczImlQaxjiHcEwHoARWFFtKbBlClFIcTSGD07VnA2Zd/qvTEFNCQbFoUxrtLEUi z/mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=d+lUf75p7oCpeoNpdjeEYcXfr0douZtxpAcsHe48WmA=; b=qa4fBn8T8nnpG5J+J7b0vHjCK61rJPoZ2yVUhfj6eCPM9MD9FRjsDKNm9D+OdOsQTg cqk+BFF/5A8OADc8jdNbxaJn6FTF2Prmb5BA53NLO/2EVnFLSM16ezNq7TkLFWM0nWW4 9BV4CryjMsndBa4t3jknxQ5fccLBBbl4SkhxIV9baEC0s7GdAKkl2L3PFFlRledc/mDz ZNSVO+1L/aysF2pRfXldHeQ+CNHtFT7UkStlk6g70ebYgcfa5yDB41O+BYcFIweTx1s5 vaJWL4ebvi7TCRFojxtxfJ0lC/MX5+pXaML2wc2oQ6ZIRhDm0S5E6rM2PHIRHPER1s75 Y5dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=JOpQYNS0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id h23si11038931qtc.321.2017.07.10.08.55.10 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Jul 2017 08:55:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.b=JOpQYNS0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUb1h-0003oi-1f for patch@linaro.org; Mon, 10 Jul 2017 11:55:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUavi-0006g9-Sh for qemu-devel@nongnu.org; Mon, 10 Jul 2017 11:49:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUavf-00048d-QB for qemu-devel@nongnu.org; Mon, 10 Jul 2017 11:48:58 -0400 Received: from mail-wr0-f170.google.com ([209.85.128.170]:33143) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUavf-00048A-Jo for qemu-devel@nongnu.org; Mon, 10 Jul 2017 11:48:55 -0400 Received: by mail-wr0-f170.google.com with SMTP id r103so144219685wrb.0 for ; Mon, 10 Jul 2017 08:48:55 -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=d+lUf75p7oCpeoNpdjeEYcXfr0douZtxpAcsHe48WmA=; b=JOpQYNS0c8cQLeacsigAr9qXuJl1vd9St8eamPiGMe7jfuwOR4Ztsx+wP3d5i9Flpj Tp2eRWrKFL/BnEEJl0lbW5JPuZV4wBX1VC7pDkoPcYauuSbEUBkOrct2r7GzZxKJO0NN TOfcv2wmnIc8jaTz9cWAB0otX4B90upf7ZupY= 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=d+lUf75p7oCpeoNpdjeEYcXfr0douZtxpAcsHe48WmA=; b=RoS1BJ/gz3vt54gf9CYH0jyXzBaSFsQ3rUq3ZPwJ5BpgW5nsmTD4AhOedY3koFC9Bn K5wUNBgT0u90FLdsOw6P/NsVtPSHEnhjI2FG9lrkPWEDGg8ZleBq3pXhvXZE6DbzYoTx AIaZndVy/o0435269FG4j+rzJByKWXIq0PDqFXVLCVw8p8KQr2tevXV+p25gEFC9RcZF azqO85m6GfyTvIVE4qXSFuG9MsX2MzOEwpwJkN4x52sj1zulZPhqDr15D6/+Xapi9CGP YkpPs7aDLH4Ka0htsUX4PGqBJD0WZuPy5V/vIsf21u76kP2+K7NuBuQw6HrObkvgmri2 MPaw== X-Gm-Message-State: AIVw112qoT1fVqmxbK1a6ltqYNPjaEh9utcw+NgFmILp4kIpstoy9AEU 5UqW1ft8R3ipIhvn X-Received: by 10.28.139.204 with SMTP id n195mr8390319wmd.14.1499701674336; Mon, 10 Jul 2017 08:47:54 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id z190sm11434839wmz.31.2017.07.10.08.47.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 08:47:51 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 77CCD3E03FE; Mon, 10 Jul 2017 16:47:49 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, cota@braap.org Date: Mon, 10 Jul 2017 16:47:45 +0100 Message-Id: <20170710154749.13624-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170710154749.13624-1-alex.bennee@linaro.org> References: <20170710154749.13624-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.170 Subject: [Qemu-devel] [PATCH v1 2/6] target/arm/translate.c: make DISAS_UPDATE match declared semantics 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: "open list:ARM" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" DISAS_UPDATE should be used when the wider CPU state other than just the PC has been updated and we should therefor exit the TCG runtime and return to the main execution loop rather assuming DISAS_JUMP would do that. As some DISAS_UPDATE users may update the PC dynamically via a helper we also push the updating to the PC to hhe call sites which set ->is_jmp to DISAS_UPDATE. Signed-off-by: Alex Bennée --- target/arm/translate.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.13.0 diff --git a/target/arm/translate.c b/target/arm/translate.c index 0862f9e4aa..f9c4aee1b6 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4430,6 +4430,7 @@ static void gen_msr_banked(DisasContext *s, int r, int sysm, int rn) tcg_temp_free_i32(tcg_tgtmode); tcg_temp_free_i32(tcg_regno); tcg_temp_free_i32(tcg_reg); + gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_UPDATE; } @@ -4452,6 +4453,7 @@ static void gen_mrs_banked(DisasContext *s, int r, int sysm, int rn) tcg_temp_free_i32(tcg_tgtmode); tcg_temp_free_i32(tcg_regno); store_reg(s, rn, tcg_reg); + gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_UPDATE; } @@ -8058,6 +8060,7 @@ static void gen_srs(DisasContext *s, tcg_temp_free_i32(tmp); } tcg_temp_free_i32(addr); + gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_UPDATE; } @@ -8146,6 +8149,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) /* setend */ if (((insn >> 9) & 1) != !!(s->be_data == MO_BE)) { gen_helper_setend(cpu_env); + gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_UPDATE; } return; @@ -11619,6 +11623,7 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s) ARCH(6); if (((insn >> 3) & 1) != !!(s->be_data == MO_BE)) { gen_helper_setend(cpu_env); + gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_UPDATE; } break; @@ -12076,7 +12081,6 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb) break; case DISAS_NEXT: case DISAS_UPDATE: - gen_set_pc_im(dc, dc->pc); /* fall through */ default: /* FIXME: Single stepping a WFI insn will not halt the CPU. */ @@ -12095,12 +12099,11 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb) case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; - case DISAS_UPDATE: - gen_set_pc_im(dc, dc->pc); - /* fall through */ case DISAS_JUMP: gen_goto_ptr(); break; + case DISAS_UPDATE: + /* fall through */ default: /* indicate that the hash table must be used to find the next TB */ tcg_gen_exit_tb(0);