On Wed, 3 Apr 2019 at 04:55, Richard Henderson <richard.hender...@linaro.org> wrote: > > Cc: Chris Wulff <crwu...@gmail.com> > Cc: Marek Vasut <ma...@denx.de> > Signed-off-by: Richard Henderson <richard.hender...@linaro.org> > --- > target/nios2/cpu.h | 5 +- > target/nios2/cpu.c | 5 +- > target/nios2/helper.c | 181 ++++++++++++++++++++---------------------- > target/nios2/mmu.c | 12 --- > 4 files changed, 92 insertions(+), 111 deletions(-) > --- a/target/nios2/helper.c > +++ b/target/nios2/helper.c > @@ -36,17 +36,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) > env->regs[R_EA] = env->regs[R_PC] + 4; > } > > -int nios2_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, > - int rw, int mmu_idx) > -{ > - cs->exception_index = 0xaa; > - /* Page 0x1000 is kuser helper */ > - if (address < 0x1000 || address >= 0x2000) { > - cpu_dump_state(cs, stderr, fprintf, 0); > - } > - return 1; > -}
For user mode we used to set cs->exception_index to 0xaa... > +bool nios2_cpu_tlb_fill(CPUState *cs, vaddr address, int size, > + MMUAccessType access_type, int mmu_idx, > + bool probe, uintptr_t retaddr) > +{ > + Nios2CPU *cpu = NIOS2_CPU(cs); > + CPUNios2State *env = &cpu->env; > + unsigned int excp = EXCP_TLBD; ...but in the new code we end up setting it to EXCP_TLBD, which is 12. > + > +#ifndef CONFIG_USER_ONLY [...] > #endif /* !CONFIG_USER_ONLY */ > + > + cs->exception_index = excp; > + env->regs[CR_BADADDR] = address; > + cpu_loop_exit_restore(cs, retaddr); > +} We also set env->regs[CR_BADADDR], which we weren't doing before. We've lost the cpu_dump_state() as well (though I'm not sure why that was there -- maybe stray debug printing?) Otherwise the changes look OK (ie no-behaviour-change). thanks -- PMM