On 11/27/18 1:07 PM, Alistair Francis wrote:
> +void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr,
> + uintptr_t addr)
> +{
> + intptr_t offset = (intptr_t)addr - (intptr_t)jmp_addr;
> + tcg_debug_assert(offset == (int32_t)offset);
> +
> + int32_t hi20 = ((offset + 0x800) >> 12) << 12;
> + int32_t lo12 = offset - hi20;
> +
> + atomic_set((uint32_t *)jmp_addr, encode_uimm20(hi20));
> + atomic_set((uint32_t *)jmp_addr + 4, encode_imm12(lo12));
> +
> + flush_icache_range(jmp_addr, jmp_addr + 8);
> +}
Two atomic_sets do not help. You want a single 64-bit atomic_set updating both
insns simultaneously. But since you're currently setting
> +#define TCG_TARGET_HAS_direct_jump 0
this code isn't used at all. Better to simply remove it for now.
Otherwise,
Reviewed-by: Richard Henderson <[email protected]>
r~