summaryrefslogtreecommitdiff
path: root/target/arm/translate-a64.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2018-02-15 18:29:37 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-02-15 18:29:48 +0000
commit490aa7f13a2ad31f92205879c4dc2387b602ef14 (patch)
treefd1447b82e2b2cf2ddafd9f41921b7b3bc139109 /target/arm/translate-a64.c
parentb916c9c35ce8158bf7f9ed5514eb279e52875de2 (diff)
downloadqemu-490aa7f13a2ad31f92205879c4dc2387b602ef14.tar.gz
target/arm: Enforce access to ZCR_EL at translation
This also makes sure that we get the correct ordering of SVE vs FP exceptions. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20180211205848.4568-5-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/translate-a64.c')
-rw-r--r--target/arm/translate-a64.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 89f50558a7..e3881d4999 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -1182,6 +1182,19 @@ static inline bool fp_access_check(DisasContext *s)
return false;
}
+/* Check that SVE access is enabled. If it is, return true.
+ * If not, emit code to generate an appropriate exception and return false.
+ */
+static inline bool sve_access_check(DisasContext *s)
+{
+ if (s->sve_excp_el) {
+ gen_exception_insn(s, 4, EXCP_UDEF, syn_sve_access_trap(),
+ s->sve_excp_el);
+ return false;
+ }
+ return true;
+}
+
/*
* This utility function is for doing register extension with an
* optional shift. You will likely want to pass a temporary for the
@@ -1631,6 +1644,9 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
default:
break;
}
+ if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) {
+ return;
+ }
if ((ri->type & ARM_CP_FPU) && !fp_access_check(s)) {
return;
}