summary refs log tree commit diff stats
path: root/target/sparc/cpu.h
diff options
context:
space:
mode:
authorArtyom Tarasenko <atar4qemu@gmail.com>2016-11-01 21:57:01 +0100
committerArtyom Tarasenko <atar4qemu@gmail.com>2017-01-18 22:03:44 +0100
commitc9b459aab8c5775a21dd913fc8820b736181e7be (patch)
tree41948f34dfda9cd68bfcff46c48319c87a6fe1d1 /target/sparc/cpu.h
parent1ceca928538a3633b74a7dc718a05ce6767f2f76 (diff)
downloadfocaccia-qemu-c9b459aab8c5775a21dd913fc8820b736181e7be.tar.gz
focaccia-qemu-c9b459aab8c5775a21dd913fc8820b736181e7be.zip
target-sparc: store cpu super- and hypervisor flags in TB
Suggested-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Diffstat (limited to 'target/sparc/cpu.h')
-rw-r--r--target/sparc/cpu.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h
index e815a1949b..1e65c94e2d 100644
--- a/target/sparc/cpu.h
+++ b/target/sparc/cpu.h
@@ -670,6 +670,11 @@ static inline int cpu_supervisor_mode(CPUSPARCState *env1)
 {
     return env1->pstate & PS_PRIV;
 }
+#else
+static inline int cpu_supervisor_mode(CPUSPARCState *env1)
+{
+    return env1->psrs;
+}
 #endif
 
 static inline int cpu_mmu_index(CPUSPARCState *env, bool ifetch)
@@ -736,6 +741,8 @@ trap_state* cpu_tsptr(CPUSPARCState* env);
 #define TB_FLAG_MMU_MASK     7
 #define TB_FLAG_FPU_ENABLED  (1 << 4)
 #define TB_FLAG_AM_ENABLED   (1 << 5)
+#define TB_FLAG_SUPER        (1 << 6)
+#define TB_FLAG_HYPER        (1 << 7)
 #define TB_FLAG_ASI_SHIFT    24
 
 static inline void cpu_get_tb_cpu_state(CPUSPARCState *env, target_ulong *pc,
@@ -745,7 +752,17 @@ static inline void cpu_get_tb_cpu_state(CPUSPARCState *env, target_ulong *pc,
     *pc = env->pc;
     *cs_base = env->npc;
     flags = cpu_mmu_index(env, false);
+#ifndef CONFIG_USER_ONLY
+    if (cpu_supervisor_mode(env)) {
+        flags |= TB_FLAG_SUPER;
+    }
+#endif
 #ifdef TARGET_SPARC64
+#ifndef CONFIG_USER_ONLY
+    if (cpu_hypervisor_mode(env)) {
+        flags |= TB_FLAG_HYPER;
+    }
+#endif
     if (env->pstate & PS_AM) {
         flags |= TB_FLAG_AM_ENABLED;
     }