From patchwork Mon Jul 10 19:21:27 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: 107321 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3839974qge; Mon, 10 Jul 2017 12:26:07 -0700 (PDT) X-Received: by 10.55.184.71 with SMTP id i68mr6107638qkf.87.1499714767612; Mon, 10 Jul 2017 12:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499714767; cv=none; d=google.com; s=arc-20160816; b=YfPoAD/BaRWeehqMwOUJ5h2wzANaOXtJWhyzmNH2aGWTCvGqfo1hv7WCtOVJusRH7x J9S6QNXAx72R8b6kkjn/8XS5E8g0fgPkEezk7GzAKU12RpJGqt+qN+RNEK+Y504I1j1Q DkKVX7A+6MvOl7nnz2UVIbFDBmyA1+kaIcrBbANryy3BwNoGkw+CzkhALkDr2lxdZryp X9DwKBdDgQwjz8oofIpS8JdbOxoTi38TMMQ/+WrkasGZds2ze16pgRmfQaySg5TPNt2m 9I7A47aWceeUVWm+8fBVDvGzF9TpKc1GM139Tmpc6ScewakczHoa/gVEufvJnmUmqPnZ Bt7Q== 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=Oq2k5itGUG3T56W06iZ6wHVpmze4AVn+j6M2n/FDFkU=; b=Urw7vFPA6JWoFFxrL+bf1SgYhXZAez2EBOl9koVhm2WMNjyg4G/nmAgCHWGaMMtYgN 1PlB8grsHroL5ZVGCevsifNJUgBTjkb7xO+5NXg4ex/tHq+NB271VK4GEXsicGWmefVr yWtgPe6ELzCTgPO0EJQHrHj7VZkXzfZ78V41PK4qrVIDfSTmwkR8Vdp/yeVBxYTlr4Af bdKd8417NtmkAv0Zv5rEIYUjZA43EdKsJAjCuZyT98coXFHRytTeCOij4Yarrgq2b1m9 K+PX6m6MwIvNkNdIHvOQ5CWuP1n7QGkXJajJ2Ru+rkPMeDjZY4beYazOsCfd/RPnuv6A EmzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=kKlKkS3F; 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 l64si12074589qkl.189.2017.07.10.12.26.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Jul 2017 12:26:07 -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=kKlKkS3F; 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]:42638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeJp-0002He-0r for patch@linaro.org; Mon, 10 Jul 2017 15:26:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeGV-00089W-K8 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUeGS-00077y-G8 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:39 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:33506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUeGS-00077S-9i for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:36 -0400 Received: by mail-wr0-f180.google.com with SMTP id r103so151965621wrb.0 for ; Mon, 10 Jul 2017 12:22:36 -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=Oq2k5itGUG3T56W06iZ6wHVpmze4AVn+j6M2n/FDFkU=; b=kKlKkS3FfiORcwVz88Axwe06jw2JT2/AtyOqeryxEsvC4nyKlRSbGrA86ve4KwvebM m2FErzrnIbUwQpJG5/O7aeoapWW97FG+fhsb4yU13lUCWd3x9Tcxq+zSfgV4K8RRNZqt cXxZL+BO5ejaPmvgaWoi/LEO2tv2qI5JA/EpA= 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=Oq2k5itGUG3T56W06iZ6wHVpmze4AVn+j6M2n/FDFkU=; b=m8YMOkACATLitMVXtHsQ3eU+/UQRn37AkKBYGGXZOiM+fBcbccKXFcnvuOs5xl+TGR rzpVPzlE8Tc6wJgWuXudTYy5CLVLMbKWXhDq9nUSyGEfVLPGy4PyqIGGPy+ycJkA21lK KFlDjcrFr8Cy14ugMK4uaT7S/+qNjJlKJYYMNbA1pyauiBUcYJXDcyPjPJ8Hdbgn6VVw FKC+SqSYLc1vc9qOEOgm6YCsiMMH1JjDrxUGBeXT76cRVtooRzKWfmYsRiOI4dXgFnMX lG0W1ydMydMqtJ1wrXDwu5m4I31C4K0+jxOI0e5gXvWKhqMmiozga530gWKpVsoUOv+8 5wNQ== X-Gm-Message-State: AIVw112ZTez1ATVDIS/hYB1vA5No8DNQlO+xQ09n4ZWG1kFyhIneKnaY Vl2MWPs0rBD8zdhy X-Received: by 10.28.113.23 with SMTP id m23mr8754429wmc.128.1499714495127; Mon, 10 Jul 2017 12:21:35 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o131sm9640275wmd.26.2017.07.10.12.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 12:21:32 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B48C03E07CF; Mon, 10 Jul 2017 20:21:28 +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 20:21:27 +0100 Message-Id: <20170710192128.9048-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170710192128.9048-1-alex.bennee@linaro.org> References: <20170710192128.9048-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.180 Subject: [Qemu-devel] [PATCH v2 4/5] target/arm: use DISAS_JUMP for ISB handling 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" While an ISB will ensure any raised IRQs happen on the next instruction it doesn't cause any to get raised by itself. We can therefor use DISAS_JUMP for ISB instructions and rely on the exit_request check at the top of each TB to deal with exiting if needed. Signed-off-by: Alex Bennée --- target/arm/translate-a64.c | 3 ++- target/arm/translate.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) -- 2.13.0 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 66139b6046..ad46d84efb 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1393,7 +1393,8 @@ static void handle_sync(DisasContext *s, uint32_t insn, * a self-modified code correctly and also to take * any pending interrupts immediately. */ - s->is_jmp = DISAS_UPDATE; + gen_a64_set_pc_im(s->pc); + s->is_jmp = DISAS_JUMP; return; default: unallocated_encoding(s); diff --git a/target/arm/translate.c b/target/arm/translate.c index ccc4768b2e..94aa4bbb4d 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1201,6 +1201,15 @@ static inline void gen_lookup_tb(DisasContext *s) s->is_jmp = DISAS_EXIT; } +/* End the current block and force a TB lookup. We may chain to the + * next TB but exit_req will be immediately checked so we will exit to + * the main loop if we need to */ +static inline void gen_jump_tb(DisasContext *s) +{ + tcg_gen_movi_i32(cpu_R[15], s->pc & ~1); + s->is_jmp = DISAS_JUMP; +} + static inline void gen_hlt(DisasContext *s, int imm) { /* HLT. This has two purposes. @@ -8165,7 +8174,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) * self-modifying code correctly and also to take * any pending interrupts immediately. */ - gen_lookup_tb(s); + gen_jump_tb(s); return; default: goto illegal_op; @@ -10558,7 +10567,7 @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw * and also to take any pending interrupts * immediately. */ - gen_lookup_tb(s); + gen_jump_tb(s); break; default: goto illegal_op;