Hi, Richard, We are going to remove obsoleted helpers, that was just an honest mistake made in a rush.
For unprotected access to gpr, we are going to insert if(reg1 != 0) in two places. However, it looks there is a bigger problem now in SCWP. QEMU crashes with this message: /qemu/tcg/tcg.c:2862: tcg fatal error This happens in user mode only, system mode case runs fine. the problem seems to appear as a consequence of using tcg_gen_brcond_*((). Do you have any idea what are we doing wrong here? > +static void gen_scwp(DisasContext *ctx, uint32_t base, int16_t offset, > + uint32_t reg1, uint32_t reg2) > +{ > + TCGv taddr = tcg_temp_new(); > + TCGv lladdr = tcg_temp_new(); > + TCGv_i64 tval = tcg_temp_new_i64(); > + TCGv_i64 llval = tcg_temp_new_i64(); > + TCGv_i64 val = tcg_temp_new_i64(); > + TCGv tmp1 = tcg_temp_new(); > + TCGv tmp2 = tcg_temp_new(); > + TCGLabel *lab_fail = gen_new_label(); > + TCGLabel *lab_done = gen_new_label(); > + > + gen_base_offset_addr(ctx, taddr, base, offset); > + > + tcg_gen_ld_tl(lladdr, cpu_env, offsetof(CPUMIPSState, lladdr)); > + tcg_gen_brcond_tl(TCG_COND_NE, taddr, lladdr, lab_fail); > + > + gen_load_gpr(tmp1, reg1); > + gen_load_gpr(tmp2, reg2); > + > +#ifdef TARGET_WORDS_BIGENDIAN > + tcg_gen_concat_tl_i64(tval, tmp2, tmp1); > +#else > + tcg_gen_concat_tl_i64(tval, tmp1, tmp2); > +#endif > + > + tcg_gen_ld_i64(llval, cpu_env, offsetof(CPUMIPSState, llval_wp)); > + tcg_gen_atomic_cmpxchg_i64(val, taddr, llval, tval, > + ctx->mem_idx, MO_64); > + tcg_gen_movi_tl(cpu_gpr[reg1], 1); > + tcg_gen_brcond_i64(TCG_COND_EQ, val, llval, lab_done); > + > + gen_set_label(lab_fail); > + > + tcg_gen_movi_tl(cpu_gpr[reg1], 0); > + > + gen_set_label(lab_done); > + tcg_gen_movi_tl(lladdr, -1); > + tcg_gen_st_tl(lladdr, cpu_env, offsetof(CPUMIPSState, lladdr)); > +} > + Regards, Aleksandar