On 20/04/16 13:01, Alex Bennée wrote: > Sergey Fedorov <sergey.fedo...@linaro.org> writes: >> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h >> index 82399175fe80..e18cc24e50f0 100644 >> --- a/include/exec/exec-all.h >> +++ b/include/exec/exec-all.h (snip) >> @@ -1716,6 +1718,10 @@ static inline void tcg_out_op(TCGContext *s, >> TCGOpcode opc, >> >> case INDEX_op_goto_tb: >> if (s->tb_jmp_offset) { >> + /* align branch displacement for atomic pathing */ > s/pathing/patching/ > >> + if (((uintptr_t)s->code_ptr & 3) == 0) { >> + tcg_out16(s, NOP); >> + } > Isn't this the wrong way around? Shouldn't we insert the NOP is code_ptr & 3 > == 2 (I assume 1 & 3 are impossible). Or is it that we need to be > unaligned when we out the jmp so the offset itself is aligned.
Yes, it is the offset itself should be aligned to patch in atomically. Kind regards, Sergey > >> tcg_out16(s, RIL_BRCL | (S390_CC_ALWAYS << 4)); >> s->tb_jmp_offset[args[0]] = tcg_current_code_size(s); >> s->code_ptr += 2;