qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH target-arm v3 8/8] target-arm: Call pmccntr_sync() w


From: Peter Crosthwaite
Subject: [Qemu-devel] [PATCH target-arm v3 8/8] target-arm: Call pmccntr_sync() when swapping ELs
Date: Mon, 18 Aug 2014 01:16:29 -0700

Call the pmccntr_sync() when the EL changes. All Runtime changes
of EL are done as a pstate_write so we can catch these EL-change side
effects here.

Signed-off-by: Peter Crosthwaite <address@hidden>
---

 target-arm/cpu.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 5bc2afe..2533fc0 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -503,12 +503,24 @@ static inline uint32_t pstate_read(CPUARMState *env)
 
 static inline void pstate_write(CPUARMState *env, uint32_t val)
 {
+#ifndef CONFIG_USER_ONLY
+    bool pmccntr_need_sync = (env->pstate ^ val) & PSTATE_M;
+
+    if (pmccntr_need_sync) {
+        pmccntr_sync(env);
+    }
+#endif
     env->ZF = (~val) & PSTATE_Z;
     env->NF = val;
     env->CF = (val >> 29) & 1;
     env->VF = (val << 3) & 0x80000000;
     env->daif = val & PSTATE_DAIF;
     env->pstate = val & ~CACHED_PSTATE_BITS;
+#ifndef CONFIG_USER_ONLY
+    if (pmccntr_need_sync) {
+        pmccntr_sync(env);
+    }
+#endif
 }
 
 /* Return the current CPSR value.  */
-- 
2.0.1.1.gfbfc394




reply via email to

[Prev in Thread] Current Thread [Next in Thread]