From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH v2 07/10] target/arm: Tidy scr_write
Date: Mon, 3 Dec 2018 14:38:36 -0600 [thread overview]
Message-ID: <20181203203839.757-8-richard.henderson@linaro.org> (raw)
In-Reply-To: <20181203203839.757-1-richard.henderson@linaro.org>
Because EL3 has a fixed execution mode, we can properly decide
which of the bits are RES{0,1}.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/cpu.h | 2 --
target/arm/helper.c | 14 +++++++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index e871b946c8..a84101efa9 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -1312,8 +1312,6 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)
#define SCR_FIEN (1U << 21)
#define SCR_ENSCXT (1U << 25)
#define SCR_ATA (1U << 26)
-#define SCR_AARCH32_MASK (0x3fff & ~(SCR_RW | SCR_ST))
-#define SCR_AARCH64_MASK (0x3fff & ~SCR_NET)
/* Return the current FPSCR value. */
uint32_t vfp_get_fpscr(CPUARMState *env);
diff --git a/target/arm/helper.c b/target/arm/helper.c
index b248dfcd39..faf7f922bf 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -1279,11 +1279,15 @@ static void vbar_write(CPUARMState *env, const ARMCPRegInfo *ri,
static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
{
- /* We only mask off bits that are RES0 both for AArch64 and AArch32.
- * For bits that vary between AArch32/64, code needs to check the
- * current execution mode before directly using the feature bit.
- */
- uint32_t valid_mask = SCR_AARCH64_MASK | SCR_AARCH32_MASK;
+ /* Begin with base v8.0 state. */
+ uint32_t valid_mask = 0x3fff;
+
+ if (arm_el_is_aa64(env, 3)) {
+ value |= SCR_FW | SCR_AW; /* these two bits are RES1. */
+ valid_mask &= ~SCR_NET;
+ } else {
+ valid_mask &= ~(SCR_RW | SCR_ST);
+ }
if (!arm_feature(env, ARM_FEATURE_EL2)) {
valid_mask &= ~SCR_HCE;
--
2.17.2
next prev parent reply other threads:[~2018-12-03 20:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 20:38 [Qemu-devel] [PATCH v2 00/10] target/arm: LOR, HPD, AA32HPD Richard Henderson
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 01/10] target/arm: Move id_aa64mmfr* to ARMISARegisters Richard Henderson
2018-12-06 12:10 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 02/10] target/arm: Add HCR_EL2 bits up to ARMv8.5 Richard Henderson
2018-12-06 11:15 ` Peter Maydell
2018-12-06 12:10 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 03/10] target/arm: Add SCR_EL3 " Richard Henderson
2018-12-06 12:10 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 04/10] target/arm: Fix HCR_EL2.TGE check in arm_phys_excp_target_el Richard Henderson
2018-12-06 12:11 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 05/10] target/arm: Introduce arm_hcr_el2_eff Richard Henderson
2018-12-06 12:09 ` Peter Maydell
2018-12-06 17:23 ` Richard Henderson
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 06/10] target/arm: Use arm_hcr_el2_eff more places Richard Henderson
2018-12-06 13:06 ` Peter Maydell
2018-12-06 13:32 ` Richard Henderson
2018-12-06 13:50 ` Peter Maydell
2018-12-03 20:38 ` Richard Henderson [this message]
2018-12-06 13:23 ` [Qemu-devel] [PATCH v2 07/10] target/arm: Tidy scr_write Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 08/10] target/arm: Implement the ARMv8.1-LOR extension Richard Henderson
2018-12-06 13:49 ` Peter Maydell
2018-12-06 13:58 ` Richard Henderson
2018-12-06 16:25 ` Richard Henderson
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 09/10] target/arm: Implement the ARMv8.1-HPD extension Richard Henderson
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 10/10] target/arm: Implement the ARMv8.2-AA32HPD extension Richard Henderson
2018-12-06 14:03 ` [Qemu-devel] [PATCH v2 00/10] target/arm: LOR, HPD, AA32HPD Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181203203839.757-8-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).