On Wed, 3 Apr 2019 at 04:52, Richard Henderson <richard.hender...@linaro.org> wrote: > > Cc: Anthony Green <gr...@moxielogic.com> > Signed-off-by: Richard Henderson <richard.hender...@linaro.org> > ---
> > -#if defined(CONFIG_USER_ONLY) > - > -void moxie_cpu_do_interrupt(CPUState *cs) > -{ > - CPUState *cs = CPU(moxie_env_get_cpu(env)); > - > - cs->exception_index = -1; > -} > - > -int moxie_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, > - int rw, int mmu_idx) > -{ > - MoxieCPU *cpu = MOXIE_CPU(cs); > - > - cs->exception_index = 0xaa; > - cpu->env.debug1 = address; > - cpu_dump_state(cs, stderr, fprintf, 0); > - return 1; > -} The commit message should say that we can just delete the old user-only code because we don't have a moxie-linux-user config. > - > -#else /* !CONFIG_USER_ONLY */ > - > -int moxie_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, > - int rw, int mmu_idx) > +bool moxie_cpu_tlb_fill(CPUState *cs, vaddr address, int size, > + MMUAccessType access_type, int mmu_idx, > + bool probe, uintptr_t retaddr) > { > MoxieCPU *cpu = MOXIE_CPU(cs); > CPUMoxieState *env = &cpu->env; > MoxieMMUResult res; > int prot, miss; > - target_ulong phy; > - int r = 1; > > address &= TARGET_PAGE_MASK; > prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; > - miss = moxie_mmu_translate(&res, env, address, rw, mmu_idx); > - if (miss) { > - /* handle the miss. */ > - phy = 0; > - cs->exception_index = MOXIE_EX_MMU_MISS; > - } else { > - phy = res.phy; > - r = 0; > + miss = moxie_mmu_translate(&res, env, address, access_type, mmu_idx); > + if (likely(!miss)) { > + tlb_set_page(cs, address, res.phy, prot, mmu_idx, TARGET_PAGE_SIZE); > + return true; > + } > + if (probe) { > + return false; > } > - tlb_set_page(cs, address, phy, prot, mmu_idx, TARGET_PAGE_SIZE); > - return r; > -} > > + cs->exception_index = MOXIE_EX_MMU_MISS; > + cpu_loop_exit_restore(cs, retaddr); > +} The old code was calling tlb_set_page() even on an MMU miss, and the new could doesn't do that. This looks like it was a bug to me, but if we're fixing bugs we should mention them in the commit message, at least. Otherwise Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> thanks -- PMM