From patchwork Tue Mar 5 16:50:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 159680 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp5188647jad; Tue, 5 Mar 2019 08:56:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwruTw6rjHXefKGRQ8otDLSToC8cD5rXqYt4wurt7eceOqzN3iASOt5xoj+GQpAcQtddnfd X-Received: by 2002:a25:16d7:: with SMTP id 206mr2956352ybw.335.1551805007977; Tue, 05 Mar 2019 08:56:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551805007; cv=none; d=google.com; s=arc-20160816; b=ko9awZd7Qe9k+/tvoQDHOH4M/ldKiYvUb6L93lf8DgT6N1szrygPqkOQMZOsd7iIvS KdbvCQW4llq3lAdWgCagbCC3HFiiVJBVq1LaaRw9mmfRf4fAYW34rlWXKQY3IREk698y 0GF43VwWx2SglGoyvsvhFT6UdXu92dk8/2OYQwV6J6+hEvc7rAEQolGjs/lXy37UCvxy KpSlR9T39lFyY+0SbOY8KEi7P868zPxx2TcSwrM0enG+ygQ0Qz6O25qzUE3u8CuqNtlR warbqjt4vu+VvwdB8qK4G9MOoI+7gbb1Qf4bRtDnyNm6jEXw2ho+8ekLFNHzeQ1AWmd4 mYdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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; bh=EDyr2piT8eh6n8gl9h9qI3HhLKCnFnXduVRUaxbET4o=; b=gAyPSh+79E/BNR/ZiAAMwfw8w4jE9Sqd9Ae62xJXmGJpPYJStpxZZCT/32D9EaNzhm Wiy1kZTLijaK301JqLQnQ07rI9WA6eeOI1rl3No6y15ojmGaW/LO9jVhxetHM8agBm+L XizCdK1mrAJvfUwxhbm/QSm2IBxx2PkINOyuSv8IIWkUQBJL73KLKFdn8mkaga4Iw/XM uZdpPrbQSvEyC6piycJ0M308g8P7XWLZkzWIlFq8nO6kcn3iGVR2J4UnX34Q7/+p6MlL fnlFaVTWFCQfVpY7bmOzMRBfVIfqWQfudxIETa9rMJ0vwJWejUvBHNHKPPCcU6WoC+3I Zogw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vwqvhsCz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.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. [209.51.188.17]) by mx.google.com with ESMTPS id y67si5280603yby.395.2019.03.05.08.56.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 05 Mar 2019 08:56:47 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vwqvhsCz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.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 ([127.0.0.1]:45794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1DN1-0005AT-DE for patch@linaro.org; Tue, 05 Mar 2019 11:56:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1DHU-0001Zy-3Y for qemu-devel@nongnu.org; Tue, 05 Mar 2019 11:51:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1DHT-0000nK-2Q for qemu-devel@nongnu.org; Tue, 05 Mar 2019 11:51:04 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:45683) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1DHS-0000lw-Qg for qemu-devel@nongnu.org; Tue, 05 Mar 2019 11:51:03 -0500 Received: by mail-wr1-x434.google.com with SMTP id w17so10240582wrn.12 for ; Tue, 05 Mar 2019 08:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EDyr2piT8eh6n8gl9h9qI3HhLKCnFnXduVRUaxbET4o=; b=vwqvhsCzXC/Raz7V+okJlpN/TvG748azhlmnMaFCQd69W2lhsc3Amu9hR/C2+lwbiQ qX4B4Ha72b/sh8X0bbpKKoElv/8P9mOXmiq8LLbhiy64HqqzJjB443CgrV1UuX7kXFR9 c2/F1I6dCwAYv6kJRsAO/L8wPxXeVrJZSZaRzaIvyEoDhn9hogj9QeV+l4Jxsg3U36GO h2XjY48LWZJxqecPFXHWkDfXMUA5uLacfbof3yxl3PiQel0+WGGfOk98mOazNBG5WHyZ UmlEIA2aBiGTwJmCcvs5nWzgJ9fSSjNL0aP+rjW3flS2BFLpE+1JDlS58OZYNrHi0bcl 0uBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EDyr2piT8eh6n8gl9h9qI3HhLKCnFnXduVRUaxbET4o=; b=Jnemlo8281UVPiPmfTvzLNAz9ilLZY+JaxG6WaelWj7NPFn5myJ2Cu7S9ZbHvSN6hz CGXTkQLlBuK6OPvx0q36SuaqtwG6ptnxjvJ2hfNKJnDRAKhZbcdXQkQC+m5puYKDMn3G Z5pd5lTUBqwlhSMSdxAdRNzt6GkWhcS2mjO3GGV0LgbvJvddeEAUGa45+iKA8ox/1/9f 6vfDlkU0w0HPFPvTdqogOYbxLr7c5jCqZjNyp3/pCYqhN/DGYJXplPuDYuPVyCcxA/1O NJBPplpApOnbNWOIGb1BAb+v/2Lqwnas6WAqCJjEwcACIUt5ftCc6C4+9wYxc2U+0PsO JaVg== X-Gm-Message-State: APjAAAVKwDEk2EMziG9HA36R2z5Djrj2YVSa8fhzbxaHXTk/2XEDovH8 jKaoAklnsRxSdkSUg4q2UXWHioFn13E= X-Received: by 2002:adf:824b:: with SMTP id 69mr17706761wrb.24.1551804661400; Tue, 05 Mar 2019 08:51:01 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 2sm10071495wrg.89.2019.03.05.08.51.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 08:51:00 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 5 Mar 2019 16:50:35 +0000 Message-Id: <20190305165051.26860-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190305165051.26860-1-peter.maydell@linaro.org> References: <20190305165051.26860-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 Subject: [Qemu-devel] [PULL 06/22] target/arm: Add set/clear_pstate_bits, share gen_ss_advance 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We do not need an out-of-line helper for manipulating bits in pstate. While changing things, share the implementation of gen_ss_advance. Signed-off-by: Richard Henderson Message-id: 20190301200501.16533-6-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.h | 2 -- target/arm/translate.h | 34 ++++++++++++++++++++++++++++++++++ target/arm/op_helper.c | 5 ----- target/arm/translate-a64.c | 11 ----------- target/arm/translate.c | 11 ----------- 5 files changed, 34 insertions(+), 29 deletions(-) -- 2.20.1 diff --git a/target/arm/helper.h b/target/arm/helper.h index 6f0f3869262..583adba9b04 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -77,8 +77,6 @@ DEF_HELPER_2(get_cp_reg, i32, env, ptr) DEF_HELPER_3(set_cp_reg64, void, env, ptr, i64) DEF_HELPER_2(get_cp_reg64, i64, env, ptr) -DEF_HELPER_1(clear_pstate_ss, void, env) - DEF_HELPER_2(get_r13_banked, i32, env, i32) DEF_HELPER_3(set_r13_banked, void, env, i32, i32) diff --git a/target/arm/translate.h b/target/arm/translate.h index f25fe756859..912cc2a4a52 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -202,6 +202,40 @@ static inline TCGv_i32 get_ahp_flag(void) return ret; } +/* Set bits within PSTATE. */ +static inline void set_pstate_bits(uint32_t bits) +{ + TCGv_i32 p = tcg_temp_new_i32(); + + tcg_debug_assert(!(bits & CACHED_PSTATE_BITS)); + + tcg_gen_ld_i32(p, cpu_env, offsetof(CPUARMState, pstate)); + tcg_gen_ori_i32(p, p, bits); + tcg_gen_st_i32(p, cpu_env, offsetof(CPUARMState, pstate)); + tcg_temp_free_i32(p); +} + +/* Clear bits within PSTATE. */ +static inline void clear_pstate_bits(uint32_t bits) +{ + TCGv_i32 p = tcg_temp_new_i32(); + + tcg_debug_assert(!(bits & CACHED_PSTATE_BITS)); + + tcg_gen_ld_i32(p, cpu_env, offsetof(CPUARMState, pstate)); + tcg_gen_andi_i32(p, p, ~bits); + tcg_gen_st_i32(p, cpu_env, offsetof(CPUARMState, pstate)); + tcg_temp_free_i32(p); +} + +/* If the singlestep state is Active-not-pending, advance to Active-pending. */ +static inline void gen_ss_advance(DisasContext *s) +{ + if (s->ss_active) { + s->pstate_ss = 0; + clear_pstate_bits(PSTATE_SS); + } +} /* Vector operations shared between ARM and AArch64. */ extern const GVecGen3 bsl_op; diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index c5721a866d3..8698b4dc83e 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -861,11 +861,6 @@ uint64_t HELPER(get_cp_reg64)(CPUARMState *env, void *rip) return res; } -void HELPER(clear_pstate_ss)(CPUARMState *env) -{ - env->pstate &= ~PSTATE_SS; -} - void HELPER(pre_hvc)(CPUARMState *env) { ARMCPU *cpu = arm_env_get_cpu(env); diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 1e49d333655..eaeb43577df 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -421,17 +421,6 @@ static void gen_exception_bkpt_insn(DisasContext *s, int offset, s->base.is_jmp = DISAS_NORETURN; } -static void gen_ss_advance(DisasContext *s) -{ - /* If the singlestep state is Active-not-pending, advance to - * Active-pending. - */ - if (s->ss_active) { - s->pstate_ss = 0; - gen_helper_clear_pstate_ss(cpu_env); - } -} - static void gen_step_complete_exception(DisasContext *s) { /* We just completed step of an insn. Move from Active-not-pending diff --git a/target/arm/translate.c b/target/arm/translate.c index 9f71206f857..d408e4d7ef4 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -298,17 +298,6 @@ static void gen_exception(int excp, uint32_t syndrome, uint32_t target_el) tcg_temp_free_i32(tcg_excp); } -static void gen_ss_advance(DisasContext *s) -{ - /* If the singlestep state is Active-not-pending, advance to - * Active-pending. - */ - if (s->ss_active) { - s->pstate_ss = 0; - gen_helper_clear_pstate_ss(cpu_env); - } -} - static void gen_step_complete_exception(DisasContext *s) { /* We just completed step of an insn. Move from Active-not-pending