On 05/04/2016 17:32, Alex Bennée wrote:
> + cpu->tb_invalidated_flag = false;
> tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flags,
> max_cycles | CF_NOCACHE
> | (ignore_icount ? CF_IGNORE_ICOUNT : 0));
> - tb->orig_tb = tcg_ctx.tb_ctx.tb_invalidated_flag ? NULL : orig_tb;
> + tb->orig_tb = cpu->tb_invalidated_flag ? NULL : orig_tb;
> cpu->current_tb = tb;
Based on discussion, it's safest to save the old value at the beginning
of the hunk, and "OR" it into cpu->tb_invalidated_flag here.
> /* if no translated code available, then translate it now */
> + cpu->tb_invalidated_flag = false;
Please remove this...
> tb = tb_gen_code(cpu, pc, cs_base, flags, 0);
>
> #ifdef CONFIG_USER_ONLY
> @@ -509,12 +509,11 @@ int cpu_exec(CPUState *cpu)
> tb = tb_find_fast(cpu);
> /* Note: we do it here to avoid a gcc bug on Mac OS X when
> doing it in tb_find_slow */
> - if (tcg_ctx.tb_ctx.tb_invalidated_flag) {
> + if (cpu->tb_invalidated_flag) {
> /* as some TB could have been invalidated because
> - of memory exceptions while generating the code, we
> + of a tb_flush while generating the code, we
> must recompute the hash index here */
> next_tb = 0;
> - tcg_ctx.tb_ctx.tb_invalidated_flag = 0;
... and leave the zeroing here.
Paolo
> }