Sergey Fedorov <sergey.fedo...@linaro.org> writes:

> From: Sergey Fedorov <serge.f...@gmail.com>
>
> Ensure direct jump patching in SPARC is atomic by using
> atomic_read()/atomic_set() for code patching.
>
> Signed-off-by: Sergey Fedorov <serge.f...@gmail.com>
> Signed-off-by: Sergey Fedorov <sergey.fedo...@linaro.org>
> ---
>  tcg/sparc/tcg-target.inc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c
> index 54df1bc42432..629dd7bdafff 100644
> --- a/tcg/sparc/tcg-target.inc.c
> +++ b/tcg/sparc/tcg-target.inc.c
> @@ -1647,6 +1647,6 @@ void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t 
> addr)
>         the code_gen_buffer can't be larger than 2GB.  */
>      assert(disp == (int32_t)disp);
>
> -    *ptr = CALL | (uint32_t)disp >> 2;
> +    atomic_set(ptr, CALL | (uint32_t)disp >> 2);

atomic_set(ptr, deposit32(CALL, 0, 30, disp >> 2))

might be a little more explicit.

Otherwise:

Reviewed-by: Alex Bennée <alex.ben...@linaro.org>


>      flush_icache_range(jmp_addr, jmp_addr + 4);
>  }


--
Alex Bennée

Reply via email to