Received: from eggs.gnu.org ([2001:4830:134:3::10]:38439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b10kj-0000e8-Co for qemu-devel@nongnu.org; Thu, 12 May 2016 20:14:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b10kh-0002mU-5G for qemu-devel@nongnu.org; Thu, 12 May 2016 20:14:48 -0400 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:35808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b10kh-0002mG-1Q for qemu-devel@nongnu.org; Thu, 12 May 2016 20:14:47 -0400 Received: by mail-qk0-x241.google.com with SMTP id n62so1260077qkc.2 for ; Thu, 12 May 2016 17:14:47 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Thu, 12 May 2016 14:13:12 -1000 Message-Id: <1463098420-29113-12-git-send-email-rth@twiddle.net> In-Reply-To: <1463098420-29113-1-git-send-email-rth@twiddle.net> References: <1463098420-29113-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PULL 11/39] tcg/mips: Make direct jump patching thread-safe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Sergey Fedorov , Sergey Fedorov From: Sergey Fedorov Ensure direct jump patching in MIPS is atomic by using atomic_read()/atomic_set() for code patching. Signed-off-by: Sergey Fedorov Signed-off-by: Sergey Fedorov Message-Id: <1461341333-19646-11-git-send-email-sergey.fedorov@linaro.org> Signed-off-by: Richard Henderson [rth: Merged the deposit32 followup.] [rth: Merged the following followup.] Message-Id: <1462210518-26522-1-git-send-email-sergey.fedorov@linaro.org> --- tcg/mips/tcg-target.inc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c index aaf881c..1e5a6b4 100644 --- a/tcg/mips/tcg-target.inc.c +++ b/tcg/mips/tcg-target.inc.c @@ -1885,7 +1885,6 @@ static void tcg_target_init(TCGContext *s) void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr) { - uint32_t *ptr = (uint32_t *)jmp_addr; - *ptr = deposit32(*ptr, 0, 26, addr >> 2); + atomic_set((uint32_t *)jmp_addr, deposit32(OPC_J, 0, 26, addr >> 2)); flush_icache_range(jmp_addr, jmp_addr + 4); } -- 2.5.5