On Wed, 2 Aug 2023 at 18:02, Jean-Philippe Brucker <jean-phili...@linaro.org> wrote: > > The AT instruction is UNDEFINED if the {NSE,NS} configuration is > invalid. Add a function to check this on all AT instructions that apply > to an EL lower than 3. > > Suggested-by: Peter Maydell <peter.mayd...@linaro.org> > Signed-off-by: Jean-Philippe Brucker <jean-phili...@linaro.org> > --- > target/arm/helper.c | 36 +++++++++++++++++++++++++----------- > 1 file changed, 25 insertions(+), 11 deletions(-) > > diff --git a/target/arm/helper.c b/target/arm/helper.c > index fbb03c364b..77dd80ad28 100644 > --- a/target/arm/helper.c > +++ b/target/arm/helper.c > @@ -3616,6 +3616,20 @@ static void ats1h_write(CPUARMState *env, const > ARMCPRegInfo *ri, > #endif /* CONFIG_TCG */ > } > > +static CPAccessResult at_e012_access(CPUARMState *env, const ARMCPRegInfo > *ri, > + bool isread) > +{ > + /* > + * R_NYXTL: instruction is UNDEFINED if it applies to an Exception level > + * lower than EL3 and the combination SCR_EL3.{NSE,NS} is reserved. > + */ > + if (cpu_isar_feature(aa64_rme, env_archcpu(env)) && > + (env->cp15.scr_el3 & (SCR_NSE | SCR_NS)) == SCR_NSE) { > + return CP_ACCESS_TRAP; > + }
The AArch64.AT() pseudocode and the text in the individual AT insn descriptions ("When FEAT_RME is implemented, if the Effective value of SCR_EL3.{NSE, NS} is a reserved value, this instruction is UNDEFINED at EL3") say that this check needs an "arm_current_el(env) == 3" condition too. > + return CP_ACCESS_OK; > +} > + > static CPAccessResult at_s1e2_access(CPUARMState *env, const ARMCPRegInfo > *ri, > bool isread) > { thanks -- PMM