From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atddy-0008Av-3M for qemu-devel@nongnu.org; Fri, 22 Apr 2016 12:09:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1atddx-0008HH-93 for qemu-devel@nongnu.org; Fri, 22 Apr 2016 12:09:22 -0400 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]:33202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atddw-0008HB-Uc for qemu-devel@nongnu.org; Fri, 22 Apr 2016 12:09:21 -0400 Received: by mail-lf0-x22f.google.com with SMTP id e190so82102625lfe.0 for ; Fri, 22 Apr 2016 09:09:20 -0700 (PDT) From: Sergey Fedorov Date: Fri, 22 Apr 2016 19:08:51 +0300 Message-Id: <1461341333-19646-10-git-send-email-sergey.fedorov@linaro.org> In-Reply-To: <1461341333-19646-1-git-send-email-sergey.fedorov@linaro.org> References: <1461341333-19646-1-git-send-email-sergey.fedorov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v2 09/11] tcg/sparc: Make direct jump patching thread-safe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Sergey Fedorov , Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Sergey Fedorov , Blue Swirl From: Sergey Fedorov Ensure direct jump patching in SPARC is atomic by using atomic_read()/atomic_set() for code patching. Signed-off-by: Sergey Fedorov Signed-off-by: Sergey Fedorov Reviewed-by: Alex Bennée --- Changes in v2: * Use deposit32() to put displacement into call instruction 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..3b54fbd22760 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, deposit32(CALL, 0, 30, disp >> 2)); flush_icache_range(jmp_addr, jmp_addr + 4); } -- 2.8.1