On Fri, 7 Dec 2018 at 10:36, Richard Henderson <richard.hender...@linaro.org> wrote: > > The pattern > > ARMMMUIdx mmu_idx = core_to_arm_mmu_idx(env, cpu_mmu_index(env, false)); > > is computing the full ARMMMUIdx, stripping off the ARM bits, > and then putting them back. > > Avoid the extra two steps with the appropriate helper function. > > Signed-off-by: Richard Henderson <richard.hender...@linaro.org> > --- > target/arm/cpu.h | 1 + > target/arm/helper.c | 27 ++++++++++++++++----------- > 2 files changed, 17 insertions(+), 11 deletions(-) > > diff --git a/target/arm/cpu.h b/target/arm/cpu.h > index 18f2378b87..6bac5c18d0 100644 > --- a/target/arm/cpu.h > +++ b/target/arm/cpu.h > @@ -2740,6 +2740,7 @@ ARMMMUIdx > arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, > ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate); > > /* Determine the current mmu_idx to use for normal loads/stores */ > +ARMMMUIdx arm_mmu_idx(CPUARMState *env); > int cpu_mmu_index(CPUARMState *env, bool ifetch);
Could we give the new function its own comment rather than making it share with the existing function, please? Otherwise Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> thanks -- PMM