target/nios2: Use hw/registerfields.h for CR_TLBMISC fields

Use FIELD_EX32 and FIELD_DP32 instead of managing the
masking by hand.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220421151735.31996-30-richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-04-21 08:17:00 -07:00
parent 8036281527
commit 17c20fe3c8
4 changed files with 39 additions and 34 deletions

View file

@ -281,11 +281,8 @@ bool nios2_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
return false;
}
if (access_type == MMU_INST_FETCH) {
env->ctrl[CR_TLBMISC] &= ~CR_TLBMISC_D;
} else {
env->ctrl[CR_TLBMISC] |= CR_TLBMISC_D;
}
env->ctrl[CR_TLBMISC] = FIELD_DP32(env->ctrl[CR_TLBMISC], CR_TLBMISC, D,
access_type != MMU_INST_FETCH);
env->ctrl[CR_PTEADDR] = FIELD_DP32(env->ctrl[CR_PTEADDR], CR_PTEADDR, VPN,
address >> TARGET_PAGE_BITS);
env->mmu.pteaddr_wr = env->ctrl[CR_PTEADDR];