On 22/11/24, Richard Henderson wrote:
> On 11/20/24 19:49, Anton Johansson wrote:
> > Adds a functions to return the current mmu index given tb_flags of the
> > current translation block.  Required by helper-to-tcg in order to
> > retrieve the mmu index for memory operations without changing the
> > signature of helper functions.
> > 
> > Signed-off-by: Anton Johansson <a...@rev.ng>
> > ---
> >   target/hexagon/cpu.h | 12 ++++++++++++
> >   1 file changed, 12 insertions(+)
> > 
> > diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
> > index 764f3c38cc..7be4b5769e 100644
> > --- a/target/hexagon/cpu.h
> > +++ b/target/hexagon/cpu.h
> > @@ -153,6 +153,18 @@ static inline void 
> > cpu_get_tb_cpu_state(CPUHexagonState *env, vaddr *pc,
> >       }
> >   }
> > +// Returns the current mmu index given tb_flags of the current translation
> > +// block.  Required by helper-to-tcg in order to retrieve the mmu index for
> > +// memory operations without changing the signature of helper functions.
> > +static inline int get_tb_mmu_index(uint32_t flags)
> > +{
> > +#ifdef CONFIG_USER_ONLY
> > +    return MMU_USER_IDX;
> > +#else
> > +#error System mode not supported on Hexagon yet
> > +#endif
> > +}
> > +
> >   typedef HexagonCPU ArchCPU;
> >   void hexagon_translate_init(void);
> 
> I suggest placing this somewhere other than cpu.h, as it's private to the
> translator and its generated code.

Makes sense!

//Anton

Reply via email to