Pass the CPU state to compute_pagemask() and update both callers. This prepares for CPU specific PageMask validation without changing behavior.
Signed-off-by: Kirill A. Korinsky <[email protected]> Suggested-by: Philippe Mathieu-Daudé <[email protected]> --- target/mips/tcg/system/cp0_helper.c | 4 ++-- target/mips/tcg/system/tlb_helper.c | 2 +- target/mips/tcg/tcg-internal.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/mips/tcg/system/cp0_helper.c b/target/mips/tcg/system/cp0_helper.c index 33fb7365d7..3fc55314a8 100644 --- a/target/mips/tcg/system/cp0_helper.c +++ b/target/mips/tcg/system/cp0_helper.c @@ -882,7 +882,7 @@ void HELPER(mtc0_memorymapid)(CPUMIPSState *env, target_ulong arg1) } } -uint32_t compute_pagemask(uint32_t val) +uint32_t compute_pagemask(CPUMIPSState *env, uint32_t val) { /* Don't care MASKX as we don't support 1KB page */ uint32_t mask = extract32(val, CP0PM_MASK, 16); @@ -899,7 +899,7 @@ uint32_t compute_pagemask(uint32_t val) void HELPER(mtc0_pagemask)(CPUMIPSState *env, target_ulong arg1) { - env->CP0_PageMask = compute_pagemask(arg1); + env->CP0_PageMask = compute_pagemask(env, arg1); } void HELPER(mtc0_pagegrain)(CPUMIPSState *env, target_ulong arg1) diff --git a/target/mips/tcg/system/tlb_helper.c b/target/mips/tcg/system/tlb_helper.c index 08b978b3f5..4df557b457 100644 --- a/target/mips/tcg/system/tlb_helper.c +++ b/target/mips/tcg/system/tlb_helper.c @@ -877,7 +877,7 @@ refill: } } pw_pagemask = m >> TARGET_PAGE_BITS; - pw_pagemask = compute_pagemask(pw_pagemask << CP0PM_MASK); + pw_pagemask = compute_pagemask(env, pw_pagemask << CP0PM_MASK); pw_entryhi = (address & ~0x1fff) | (env->CP0_EntryHi & 0xFF); { target_ulong tmp_entryhi = env->CP0_EntryHi; diff --git a/target/mips/tcg/tcg-internal.h b/target/mips/tcg/tcg-internal.h index 9f230e757d..8fb96284df 100644 --- a/target/mips/tcg/tcg-internal.h +++ b/target/mips/tcg/tcg-internal.h @@ -45,7 +45,7 @@ bool mips_cpu_exec_interrupt(CPUState *cpu, int int_req); void mmu_init(CPUMIPSState *env, const mips_def_t *def); -uint32_t compute_pagemask(uint32_t val); +uint32_t compute_pagemask(CPUMIPSState *env, uint32_t val); void r4k_invalidate_tlb(CPUMIPSState *env, int idx, int use_extra); uint32_t cpu_mips_get_random(CPUMIPSState *env); -- 2.56.0
