summary refs log tree commit diff stats
path: root/target/openrisc/cpu.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-01-29 10:13:23 +1000
committerRichard Henderson <richard.henderson@linaro.org>2024-02-03 16:46:10 +1000
commitdb8b41941aabdfdc505b372ae8b8445581e96840 (patch)
tree2af5c7ee002f7b3d8701b4257b09e3a5972539be /target/openrisc/cpu.h
parent498c7d78d3ef0346d3885842c505eb8d0ffb940e (diff)
downloadfocaccia-qemu-db8b41941aabdfdc505b372ae8b8445581e96840.tar.gz
focaccia-qemu-db8b41941aabdfdc505b372ae8b8445581e96840.zip
target/openrisc: Populate CPUClass.mmu_index
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/openrisc/cpu.h')
-rw-r--r--target/openrisc/cpu.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h
index b454014ddd..7dbed8d8be 100644
--- a/target/openrisc/cpu.h
+++ b/target/openrisc/cpu.h
@@ -361,16 +361,10 @@ static inline void cpu_get_tb_cpu_state(CPUOpenRISCState *env, vaddr *pc,
            | (env->sr & (SR_SM | SR_DME | SR_IME | SR_OVE));
 }
 
+int openrisc_cpu_mmu_index(CPUState *cs, bool ifetch);
 static inline int cpu_mmu_index(CPUOpenRISCState *env, bool ifetch)
 {
-    int ret = MMU_NOMMU_IDX;  /* mmu is disabled */
-
-    if (env->sr & (ifetch ? SR_IME : SR_DME)) {
-        /* The mmu is enabled; test supervisor state.  */
-        ret = env->sr & SR_SM ? MMU_SUPERVISOR_IDX : MMU_USER_IDX;
-    }
-
-    return ret;
+    return openrisc_cpu_mmu_index(env_cpu(env), ifetch);
 }
 
 static inline uint32_t cpu_get_sr(const CPUOpenRISCState *env)