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 <del...@gmx.de> --- target/loongarch/cpu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 -- 2.41.0