diff options
author | Peter Maydell | 2021-06-18 16:10:19 +0200 |
---|---|---|
committer | Peter Maydell | 2021-06-21 17:49:38 +0200 |
commit | 88137f787f374ac4117877bcc8c8af97326a10bd (patch) | |
tree | 162e9736d9d0249c4033d0b7037a653a47dd2dd9 /target/arm/translate-vfp.c | |
parent | target/arm: Split vfp_access_check() into A and M versions (diff) | |
download | qemu-88137f787f374ac4117877bcc8c8af97326a10bd.tar.gz qemu-88137f787f374ac4117877bcc8c8af97326a10bd.tar.xz qemu-88137f787f374ac4117877bcc8c8af97326a10bd.zip |
target/arm: Handle FPU check for FPCXT_NS insns via vfp_access_check_m()
Instead of open-coding the "take NOCP exception if FPU disabled,
otherwise call gen_preserve_fp_state()" code in the accessors for
FPCXT_NS, add an argument to vfp_access_check_m() which tells it to
skip the gen_update_fp_context() call, so we can use it for the
FPCXT_NS case.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210618141019.10671-8-peter.maydell@linaro.org
Diffstat (limited to 'target/arm/translate-vfp.c')
-rw-r--r-- | target/arm/translate-vfp.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index d89c7834fa..86e43c02dc 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -109,7 +109,7 @@ static inline long vfp_f16_offset(unsigned reg, bool top) * Generate code for M-profile lazy FP state preservation if needed; * this corresponds to the pseudocode PreserveFPState() function. */ -void gen_preserve_fp_state(DisasContext *s) +static void gen_preserve_fp_state(DisasContext *s) { if (s->v7m_lspact) { /* @@ -218,8 +218,9 @@ static bool vfp_access_check_a(DisasContext *s, bool ignore_vfp_enabled) * If VFP is enabled, do the necessary M-profile lazy-FP handling and then * return true. If not, emit code to generate an appropriate exception and * return false. + * skip_context_update is true to skip the "update FP context" part of this. */ -static bool vfp_access_check_m(DisasContext *s) +bool vfp_access_check_m(DisasContext *s, bool skip_context_update) { if (s->fp_excp_el) { /* @@ -239,8 +240,10 @@ static bool vfp_access_check_m(DisasContext *s) /* Trigger lazy-state preservation if necessary */ gen_preserve_fp_state(s); - /* Update ownership of FP context and create new FP context if needed */ - gen_update_fp_context(s); + if (!skip_context_update) { + /* Update ownership of FP context and create new FP context if needed */ + gen_update_fp_context(s); + } return true; } @@ -252,7 +255,7 @@ static bool vfp_access_check_m(DisasContext *s) bool vfp_access_check(DisasContext *s) { if (arm_dc_feature(s, ARM_FEATURE_M)) { - return vfp_access_check_m(s); + return vfp_access_check_m(s, false); } else { return vfp_access_check_a(s, false); } |