diff mbox series

[07/23] target/loongarch: Use MMU_INDEX() helper

Message ID 20230806120001.89130-8-deller@gmx.de (mailing list archive)
State New, archived
Headers show
Series Introduce MMU_INDEX() | expand

Commit Message

Helge Deller Aug. 6, 2023, 11:59 a.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/loongarch/cpu.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
2.41.0
diff mbox series

Patch

diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index fa371ca8ba..ab15146d77 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -404,9 +404,9 @@  struct LoongArchCPUClass {
  */
 #define MMU_PLV_KERNEL   0
 #define MMU_PLV_USER     3
-#define MMU_IDX_KERNEL   MMU_PLV_KERNEL
-#define MMU_IDX_USER     MMU_PLV_USER
-#define MMU_IDX_DA       4
+#define MMU_IDX_KERNEL   MMU_INDEX(MMU_PLV_KERNEL)
+#define MMU_IDX_USER     MMU_INDEX(MMU_PLV_USER)
+#define MMU_IDX_DA       MMU_INDEX(4)

 static inline int cpu_mmu_index(CPULoongArchState *env, bool ifetch)
 {
@@ -414,7 +414,7 @@  static inline int cpu_mmu_index(CPULoongArchState *env, bool ifetch)
     return MMU_IDX_USER;
 #else
     if (FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PG)) {
-        return FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV);
+        return MMU_INDEX(FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV));
     }
     return MMU_IDX_DA;
 #endif