summaryrefslogtreecommitdiffstats
path: root/target/arm/cpu.h
diff options
context:
space:
mode:
authorAlex Bennée2019-02-15 10:56:38 +0100
committerPeter Maydell2019-02-15 10:56:38 +0100
commitb5bd7440422bb66deaceb812bb9287a6a3cdf10c (patch)
tree91210051e97d3019452d27365229de29dd73195a /target/arm/cpu.h
parenttarget/arm: Fix int128_make128 lo, hi order in paired_cmpxchg64_be (diff)
downloadqemu-b5bd7440422bb66deaceb812bb9287a6a3cdf10c.tar.gz
qemu-b5bd7440422bb66deaceb812bb9287a6a3cdf10c.tar.xz
qemu-b5bd7440422bb66deaceb812bb9287a6a3cdf10c.zip
target/arm: relax permission checks for HWCAP_CPUID registers
Although technically not visible to userspace the kernel does make them visible via a trap and emulate ABI. We provide a new permission mask (PL0U_R) which maps to PL0_R for CONFIG_USER builds and adjust the minimum permission check accordingly. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20190205190224.2198-2-alex.bennee@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/cpu.h')
-rw-r--r--target/arm/cpu.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 47238e4245..c92c097b44 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -2226,6 +2226,18 @@ static inline bool cptype_valid(int cptype)
#define PL0_R (0x02 | PL1_R)
#define PL0_W (0x01 | PL1_W)
+/*
+ * For user-mode some registers are accessible to EL0 via a kernel
+ * trap-and-emulate ABI. In this case we define the read permissions
+ * as actually being PL0_R. However some bits of any given register
+ * may still be masked.
+ */
+#ifdef CONFIG_USER_ONLY
+#define PL0U_R PL0_R
+#else
+#define PL0U_R PL1_R
+#endif
+
#define PL3_RW (PL3_R | PL3_W)
#define PL2_RW (PL2_R | PL2_W)
#define PL1_RW (PL1_R | PL1_W)