[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 28/33] target/sh4: Populate CPUClass.mmu_index
|
From: |
Richard Henderson |
|
Subject: |
[PATCH 28/33] target/sh4: Populate CPUClass.mmu_index |
|
Date: |
Tue, 30 Jan 2024 09:30:38 +1000 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/sh4/cpu.h | 16 ++++++----------
target/sh4/cpu.c | 16 ++++++++++++++++
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h
index 0e6fa65bae..9c5e2b349e 100644
--- a/target/sh4/cpu.h
+++ b/target/sh4/cpu.h
@@ -273,16 +273,6 @@ void cpu_load_tlb(CPUSH4State * env);
/* MMU modes definitions */
#define MMU_USER_IDX 1
-static inline int cpu_mmu_index (CPUSH4State *env, bool ifetch)
-{
- /* The instruction in a RTE delay slot is fetched in privileged
- mode, but executed in user mode. */
- if (ifetch && (env->flags & TB_FLAG_DELAY_SLOT_RTE)) {
- return 0;
- } else {
- return (env->sr & (1u << SR_MD)) == 0 ? 1 : 0;
- }
-}
#include "exec/cpu-all.h"
@@ -380,6 +370,12 @@ static inline void cpu_write_sr(CPUSH4State *env,
target_ulong sr)
env->sr = sr & ~((1u << SR_M) | (1u << SR_Q) | (1u << SR_T));
}
+int sh4_cpu_mmu_index(CPUState *cs, bool ifetch);
+static inline int cpu_mmu_index(CPUSH4State *env, bool ifetch)
+{
+ return sh4_cpu_mmu_index(env_cpu(env), ifetch);
+}
+
static inline void cpu_get_tb_cpu_state(CPUSH4State *env, vaddr *pc,
uint64_t *cs_base, uint32_t *flags)
{
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
index 39772955b5..6fead5655f 100644
--- a/target/sh4/cpu.c
+++ b/target/sh4/cpu.c
@@ -89,6 +89,21 @@ static bool superh_cpu_has_work(CPUState *cs)
return cs->interrupt_request & CPU_INTERRUPT_HARD;
}
+int sh4_cpu_mmu_index(CPUState *cs, bool ifetch)
+{
+ CPUSH4State *env = cpu_env(cs);
+
+ /*
+ * The instruction in a RTE delay slot is fetched in privileged mode,
+ * but executed in user mode.
+ */
+ if (ifetch && (env->flags & TB_FLAG_DELAY_SLOT_RTE)) {
+ return 0;
+ } else {
+ return (env->sr & (1u << SR_MD)) == 0 ? 1 : 0;
+ }
+}
+
static void superh_cpu_reset_hold(Object *obj)
{
CPUState *s = CPU(obj);
@@ -266,6 +281,7 @@ static void superh_cpu_class_init(ObjectClass *oc, void
*data)
cc->class_by_name = superh_cpu_class_by_name;
cc->has_work = superh_cpu_has_work;
+ cc->mmu_index = sh4_cpu_mmu_index;
cc->dump_state = superh_cpu_dump_state;
cc->set_pc = superh_cpu_set_pc;
cc->get_pc = superh_cpu_get_pc;
--
2.34.1
- [PATCH 20/33] target/ppc: Split out ppc_env_mmu_index, (continued)
- [PATCH 20/33] target/ppc: Split out ppc_env_mmu_index, Richard Henderson, 2024/01/29
- [PATCH 21/33] target/ppc: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 22/33] target/riscv: Rename riscv_cpu_mmu_index to riscv_env_mmu_index, Richard Henderson, 2024/01/29
- [PATCH 23/33] target/riscv: Replace cpu_mmu_index with riscv_env_mmu_index, Richard Henderson, 2024/01/29
- [PATCH 24/33] target/riscv: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 25/33] target/rx: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 27/33] target/s390x: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 28/33] target/sh4: Populate CPUClass.mmu_index,
Richard Henderson <=
- [PATCH 29/33] target/sparc: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 32/33] include/exec: Implement cpu_mmu_index generically, Richard Henderson, 2024/01/29
- [PATCH 30/33] target/tricore: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 26/33] target/s390x: Split out s390x_env_mmu_index, Richard Henderson, 2024/01/29
- [PATCH 31/33] target/xtensa: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 33/33] include/exec: Change cpu_mmu_index argument to CPUState, Richard Henderson, 2024/01/29