[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/33] target/microblaze: Populate CPUClass.mmu_index
|
From: |
Richard Henderson |
|
Subject: |
[PATCH 14/33] target/microblaze: Populate CPUClass.mmu_index |
|
Date: |
Tue, 30 Jan 2024 09:30:24 +1000 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/microblaze/cpu.h | 13 ++-----------
target/microblaze/cpu.c | 18 +++++++++++++++++-
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h
index b5374365f5..90ab796de9 100644
--- a/target/microblaze/cpu.h
+++ b/target/microblaze/cpu.h
@@ -434,19 +434,10 @@ void mb_cpu_transaction_failed(CPUState *cs, hwaddr
physaddr, vaddr addr,
MemTxResult response, uintptr_t retaddr);
#endif
+int mb_cpu_mmu_index(CPUState *cs, bool ifetch);
static inline int cpu_mmu_index(CPUMBState *env, bool ifetch)
{
- MicroBlazeCPU *cpu = env_archcpu(env);
-
- /* Are we in nommu mode?. */
- if (!(env->msr & MSR_VM) || !cpu->cfg.use_mmu) {
- return MMU_NOMMU_IDX;
- }
-
- if (env->msr & MSR_UM) {
- return MMU_USER_IDX;
- }
- return MMU_KERNEL_IDX;
+ return mb_cpu_mmu_index(env_cpu(env), ifetch);
}
#ifndef CONFIG_USER_ONLY
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
index 2318ad7013..6dad11905b 100644
--- a/target/microblaze/cpu.c
+++ b/target/microblaze/cpu.c
@@ -118,6 +118,22 @@ static bool mb_cpu_has_work(CPUState *cs)
return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI);
}
+int mb_cpu_mmu_index(CPUState *cs, bool ifetch)
+{
+ CPUMBState *env = cpu_env(cs);
+ MicroBlazeCPU *cpu = env_archcpu(env);
+
+ /* Are we in nommu mode?. */
+ if (!(env->msr & MSR_VM) || !cpu->cfg.use_mmu) {
+ return MMU_NOMMU_IDX;
+ }
+
+ if (env->msr & MSR_UM) {
+ return MMU_USER_IDX;
+ }
+ return MMU_KERNEL_IDX;
+}
+
#ifndef CONFIG_USER_ONLY
static void mb_cpu_ns_axi_dp(void *opaque, int irq, int level)
{
@@ -415,7 +431,7 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
cc->class_by_name = mb_cpu_class_by_name;
cc->has_work = mb_cpu_has_work;
-
+ cc->mmu_index = mb_cpu_mmu_index;
cc->dump_state = mb_cpu_dump_state;
cc->set_pc = mb_cpu_set_pc;
cc->get_pc = mb_cpu_get_pc;
--
2.34.1
- [PATCH 07/33] target/cris: Cache mem_index in DisasContext, (continued)
- [PATCH 07/33] target/cris: Cache mem_index in DisasContext, Richard Henderson, 2024/01/29
- [PATCH 11/33] target/loongarch: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 09/33] target/hppa: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 12/33] target/loongarch: Rename MMU_IDX_*, Richard Henderson, 2024/01/29
- [PATCH 13/33] target/m68k: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 05/33] target/arm: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 10/33] target/i386: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 16/33] target/mips: Split out mips_env_mmu_index, Richard Henderson, 2024/01/29
- [PATCH 15/33] target/mips: Pass ptw_mmu_idx down from mips_cpu_tlb_fill, Richard Henderson, 2024/01/29
- [PATCH 17/33] target/mips: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 14/33] target/microblaze: Populate CPUClass.mmu_index,
Richard Henderson <=
- [PATCH 18/33] target/nios2: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [PATCH 19/33] target/openrisc: Populate CPUClass.mmu_index, Richard Henderson, 2024/01/29
- [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