target/mips: Replace magic values by CP0PM_MASK or TARGET_PAGE_BITS_MIN

Replace magic values related to page size:

  12 -> TARGET_PAGE_BITS_MIN
  13 -> CP0PM_MASK

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Huacai Chen <chenhc@lemote.com>
Message-Id: <20201109090422.2445166-2-f4bug@amsat.org>
This commit is contained in:
Philippe Mathieu-Daudé 2020-11-09 09:15:41 +01:00
parent 34cffe960e
commit 547b9b17f9
2 changed files with 5 additions and 4 deletions

View File

@ -904,7 +904,7 @@ void update_pagemask(CPUMIPSState *env, target_ulong arg1, int32_t *pagemask)
goto invalid; goto invalid;
} }
/* We don't support VTLB entry smaller than target page */ /* We don't support VTLB entry smaller than target page */
if ((maskbits + 12) < TARGET_PAGE_BITS) { if ((maskbits + TARGET_PAGE_BITS_MIN) < TARGET_PAGE_BITS) {
goto invalid; goto invalid;
} }
env->CP0_PageMask = mask << CP0PM_MASK; env->CP0_PageMask = mask << CP0PM_MASK;
@ -913,7 +913,8 @@ void update_pagemask(CPUMIPSState *env, target_ulong arg1, int32_t *pagemask)
invalid: invalid:
/* When invalid, set to default target page size. */ /* When invalid, set to default target page size. */
env->CP0_PageMask = (~TARGET_PAGE_MASK >> 12) << CP0PM_MASK; mask = (~TARGET_PAGE_MASK >> TARGET_PAGE_BITS_MIN);
env->CP0_PageMask = mask << CP0PM_MASK;
} }
void helper_mtc0_pagemask(CPUMIPSState *env, target_ulong arg1) void helper_mtc0_pagemask(CPUMIPSState *env, target_ulong arg1)

View File

@ -858,8 +858,8 @@ refill:
break; break;
} }
} }
pw_pagemask = m >> 12; pw_pagemask = m >> TARGET_PAGE_BITS_MIN;
update_pagemask(env, pw_pagemask << 13, &pw_pagemask); update_pagemask(env, pw_pagemask << CP0PM_MASK, &pw_pagemask);
pw_entryhi = (address & ~0x1fff) | (env->CP0_EntryHi & 0xFF); pw_entryhi = (address & ~0x1fff) | (env->CP0_EntryHi & 0xFF);
{ {
target_ulong tmp_entryhi = env->CP0_EntryHi; target_ulong tmp_entryhi = env->CP0_EntryHi;