Richard Henderson <richard.hender...@linaro.org> writes:
> Now setting, but not relying upon, env->hflags. > > Signed-off-by: Richard Henderson <richard.hender...@linaro.org> > --- > linux-user/syscall.c | 1 + > target/arm/cpu.c | 1 + > target/arm/helper-a64.c | 3 +++ > target/arm/helper.c | 2 ++ > target/arm/machine.c | 1 + > target/arm/op_helper.c | 1 + > target/arm/translate-a64.c | 6 +++++- > target/arm/translate.c | 18 ++++++++++++++++-- > 8 files changed, 30 insertions(+), 3 deletions(-) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 8b41a03901..be01c33759 100644 <snip> I had to manually fix these up due to the patch failing to apply. I think because 9e9b10c64911 removes the gen_io_end() calls. > diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c > index fc3e5f5c38..4412c60383 100644 > --- a/target/arm/translate-a64.c > +++ b/target/arm/translate-a64.c > @@ -1777,11 +1777,15 @@ static void handle_sys(DisasContext *s, uint32_t > insn, bool isread, > /* I/O operations must end the TB here (whether read or write) */ > gen_io_end(); > s->base.is_jmp = DISAS_UPDATE; > - } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { > + } > + if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { > /* We default to ending the TB on a coprocessor register write, > * but allow this to be suppressed by the register definition > * (usually only necessary to work around guest bugs). > */ > + TCGv_i32 tcg_el = tcg_const_i32(s->current_el); > + gen_helper_rebuild_hflags_a64(cpu_env, tcg_el); > + tcg_temp_free_i32(tcg_el); > s->base.is_jmp = DISAS_UPDATE; > } > } > diff --git a/target/arm/translate.c b/target/arm/translate.c > index d948757131..2f7beca065 100644 > --- a/target/arm/translate.c > +++ b/target/arm/translate.c > @@ -7130,6 +7130,8 @@ static int disas_coproc_insn(DisasContext *s, uint32_t > insn) > ri = get_arm_cp_reginfo(s->cp_regs, > ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); > if (ri) { > + bool need_exit_tb; > + > /* Check access permissions */ > if (!cp_access_ok(s->current_el, ri, isread)) { > return 1; > @@ -7301,15 +7303,27 @@ static int disas_coproc_insn(DisasContext *s, > uint32_t insn) > } > } > > + need_exit_tb = false; > if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & > ARM_CP_IO)) { > /* I/O operations must end the TB here (whether read or write) */ > gen_io_end(); > - gen_lookup_tb(s); > - } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { > + need_exit_tb = true; > + } > + if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { > /* We default to ending the TB on a coprocessor register write, > * but allow this to be suppressed by the register definition > * (usually only necessary to work around guest bugs). > */ > + TCGv_i32 tcg_el = tcg_const_i32(s->current_el); > + if (arm_dc_feature(s, ARM_FEATURE_M)) { > + gen_helper_rebuild_hflags_m32(cpu_env, tcg_el); > + } else { > + gen_helper_rebuild_hflags_a32(cpu_env, tcg_el); > + } > + tcg_temp_free_i32(tcg_el); > + need_exit_tb = true; > + } > + if (need_exit_tb) { > gen_lookup_tb(s); > } -- Alex Bennée