diff mbox series

[v2,19/23] target/ppc: Use MMU_INDEX() helper

Message ID 20230806121732.91853-20-deller@gmx.de
State New
Headers show
Series Introduce MMU_INDEX() | expand

Commit Message

Helge Deller Aug. 6, 2023, 12:17 p.m. UTC
Use the new MMU_INDEX() helper to specify the index of the CPUTLB which
should be used.  Additionally, in a follow-up patch this helper allows
then to optimize the tcg code generation.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 target/ppc/cpu.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--
2.41.0
diff mbox series

Patch

diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 25fac9577a..dfd9ba2518 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1474,13 +1474,14 @@  int ppc_dcr_write(ppc_dcr_t *dcr_env, int dcrn, uint32_t val);
 #define cpu_list ppc_cpu_list

 /* MMU modes definitions */
-#define MMU_USER_IDX 0
+#define MMU_USER_IDX MMU_INDEX(0)
 static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch)
 {
 #ifdef CONFIG_USER_ONLY
     return MMU_USER_IDX;
 #else
-    return (env->hflags >> (ifetch ? HFLAGS_IMMU_IDX : HFLAGS_DMMU_IDX)) & 7;
+    int idx = (env->hflags >> (ifetch ? HFLAGS_IMMU_IDX : HFLAGS_DMMU_IDX)) & 7;
+    return MMU_INDEX(idx);
 #endif
 }