Hi Richard,
On 2/2/24 06:49, Richard Henderson wrote:
Rather than adjust env->hflags so that the value computed
by cpu_mmu_index() changes, compute the mmu_idx that we
want directly and pass it down.
Introduce symbolic constants for MMU_{KERNEL,ERL}_IDX.
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>
Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
target/mips/cpu.h | 4 +++-
target/mips/tcg/sysemu/tlb_helper.c | 32 ++++++++++++-----------------
2 files changed, 16 insertions(+), 20 deletions(-)
@@ -944,12 +940,10 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int
size,
* Memory reads during hardware page table walking are performed
* as if they were kernel-mode load instructions.
*/
- int mode = (env->hflags & MIPS_HFLAG_KSU);
- bool ret_walker;
- env->hflags &= ~MIPS_HFLAG_KSU;
- ret_walker = page_table_walk_refill(env, address, mmu_idx);
- env->hflags |= mode;
- if (ret_walker) {
+ int ptw_mmu_idx = (env->hflags & MIPS_HFLAG_ERL ?
+ MMU_ERL_IDX : MMU_KERNEL_IDX);
Checking https://gitlab.com/qemu-project/qemu/-/issues/2470.
Parenthesis are mis-placed.
int ptw_mmu_idx = (env->hflags & MIPS_HFLAG_ERL) ?
MMU_ERL_IDX : MMU_KERNEL_IDX;
Revisiting, we loose possible MMU_USER_IDX value but
- we don't use it
- this is sysemu code so we only expect MMU_KERNEL_IDX
Is that right?
+
+ if (page_table_walk_refill(env, address, ptw_mmu_idx)) {
ret = get_physical_address(env, &physical, &prot, address,
access_type, mmu_idx);
if (ret == TLBRET_MATCH) {