From: Chris Copeland <[email protected]>

A/R-profile exception returns prior to Armv8 do not clear the local
exclusive monitor, but in Armv8-A/R it is cleared.

>From the Arm Architecture Reference Manual for A-profile architecture
(DDI0487 M.d) §E2.10.4 "Context switch support":

    "An exception return clears the local monitor."

The same language appears in the R-profile manual (DDI111353 A.a)
§B2.11.4 "Context switch support".

We correctly clear the monitor for an A64 exception return, but
in adding v8 support we missed that the A32 exception return path
needed updating.

Cc: [email protected]
Signed-off-by: Chris Copeland <[email protected]>
Message-id: 20261108-armv8-exception-return-clrex-v1-1-ec11079bf...@chrisnc.net
Reviewed-by: Peter Maydell <[email protected]>
[PMM: commit message tweak]
Signed-off-by: Peter Maydell <[email protected]>
(cherry picked from commit 47ecb80041034b09b96490e4ee72d06232dfc919)
Signed-off-by: Michael Tokarev <[email protected]>

diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c
index 38ba515bef4..422cef2163c 100644
--- a/target/arm/tcg/op_helper.c
+++ b/target/arm/tcg/op_helper.c
@@ -808,6 +808,10 @@ void HELPER(cpsr_write_eret)(CPUARMState *env, uint32_t 
val)
     mask = aarch32_cpsr_valid_mask(env->features, &env_archcpu(env)->isar);
     cpsr_write(env, val, mask, CPSRWriteExceptionReturn);
 
+    if (arm_feature(env, ARM_FEATURE_V8)) {
+        arm_clear_exclusive(env);
+    }
+
     /* Generated code has already stored the new PC value, but
      * without masking out its low bits, because which bits need
      * masking depends on whether we're returning to Thumb or ARM
-- 
2.47.3


Reply via email to