tcg/sparc: Make direct jump patching thread-safe

Ensure direct jump patching in SPARC is atomic by using
atomic_read()/atomic_set() for code patching.

Backports commit 84f79fb7c6e857edc807e4a251338243ce0cbac3 from qemu
This commit is contained in:
Sergey Fedorov 2018-02-23 20:41:38 -05:00 committed by Lioncash
parent a45f8cb49d
commit 7538001da9
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -1614,6 +1614,6 @@ void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr)
the code_gen_buffer can't be larger than 2GB. */
tcg_debug_assert(disp == (int32_t)disp);
*ptr = CALL | (uint32_t)disp >> 2;
atomic_set(ptr, deposit32(CALL, 0, 30, disp >> 2));
flush_icache_range(jmp_addr, jmp_addr + 4);
}