[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/57] target/nios2: Populate CPUClass.mmu_index
From: |
Richard Henderson |
Subject: |
[PULL 18/57] target/nios2: Populate CPUClass.mmu_index |
Date: |
Fri, 2 Feb 2024 15:49:57 +1000 |
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/nios2/cpu.h | 12 ++++++------
target/nios2/cpu.c | 7 +++++++
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
index 2d79b5b298..9965ff74c1 100644
--- a/target/nios2/cpu.h
+++ b/target/nios2/cpu.h
@@ -270,12 +270,6 @@ void do_nios2_semihosting(CPUNios2State *env);
#define MMU_SUPERVISOR_IDX 0
#define MMU_USER_IDX 1
-static inline int cpu_mmu_index(CPUNios2State *env, bool ifetch)
-{
- return (env->ctrl[CR_STATUS] & CR_STATUS_U) ? MMU_USER_IDX :
- MMU_SUPERVISOR_IDX;
-}
-
#ifndef CONFIG_USER_ONLY
hwaddr nios2_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
bool nios2_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
@@ -292,6 +286,12 @@ FIELD(TBFLAGS, CRS0, 0, 1) /* Set if CRS == 0. */
FIELD(TBFLAGS, U, 1, 1) /* Overlaps CR_STATUS_U */
FIELD(TBFLAGS, R0_0, 2, 1) /* Set if R0 == 0. */
+int nios2_cpu_mmu_index(CPUState *cs, bool ifetch);
+static inline int cpu_mmu_index(CPUNios2State *env, bool ifetch)
+{
+ return nios2_cpu_mmu_index(env_cpu(env), ifetch);
+}
+
static inline void cpu_get_tb_cpu_state(CPUNios2State *env, vaddr *pc,
uint64_t *cs_base, uint32_t *flags)
{
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
index 596c0c5617..e42885997e 100644
--- a/target/nios2/cpu.c
+++ b/target/nios2/cpu.c
@@ -57,6 +57,12 @@ static bool nios2_cpu_has_work(CPUState *cs)
return cs->interrupt_request & CPU_INTERRUPT_HARD;
}
+int nios2_cpu_mmu_index(CPUState *cs, bool ifetch)
+{
+ return (cpu_env(cs)->ctrl[CR_STATUS] & CR_STATUS_U
+ ? MMU_USER_IDX : MMU_SUPERVISOR_IDX);
+}
+
static void nios2_cpu_reset_hold(Object *obj)
{
CPUState *cs = CPU(obj);
@@ -381,6 +387,7 @@ static void nios2_cpu_class_init(ObjectClass *oc, void
*data)
cc->class_by_name = nios2_cpu_class_by_name;
cc->has_work = nios2_cpu_has_work;
+ cc->mmu_index = nios2_cpu_mmu_index;
cc->dump_state = nios2_cpu_dump_state;
cc->set_pc = nios2_cpu_set_pc;
cc->get_pc = nios2_cpu_get_pc;
--
2.34.1
- [PULL 10/57] target/i386: Populate CPUClass.mmu_index, (continued)
- [PULL 10/57] target/i386: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 11/57] target/loongarch: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 12/57] target/loongarch: Rename MMU_IDX_*, Richard Henderson, 2024/02/02
- [PULL 13/57] target/m68k: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 14/57] target/microblaze: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 15/57] target/mips: Pass ptw_mmu_idx down from mips_cpu_tlb_fill, Richard Henderson, 2024/02/02
- [PULL 19/57] target/openrisc: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 20/57] target/ppc: Split out ppc_env_mmu_index, Richard Henderson, 2024/02/02
- [PULL 21/57] target/ppc: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 22/57] target/riscv: Rename riscv_cpu_mmu_index to riscv_env_mmu_index, Richard Henderson, 2024/02/02
- [PULL 18/57] target/nios2: Populate CPUClass.mmu_index,
Richard Henderson <=
- [PULL 17/57] target/mips: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 16/57] target/mips: Split out mips_env_mmu_index, Richard Henderson, 2024/02/02
- [PULL 23/57] target/riscv: Replace cpu_mmu_index with riscv_env_mmu_index, Richard Henderson, 2024/02/02
- [PULL 24/57] target/riscv: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 25/57] target/rx: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 28/57] target/sh4: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 30/57] target/tricore: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 27/57] target/s390x: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 29/57] target/sparc: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02
- [PULL 31/57] target/xtensa: Populate CPUClass.mmu_index, Richard Henderson, 2024/02/02