Received: from eggs.gnu.org ([2001:4830:134:3::10]:42225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWrkT-0004Ld-Ry for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:06:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWrkP-00066R-LO for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:06:12 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39776 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWrkP-00066F-Fm for qemu-devel@nongnu.org; Mon, 08 Aug 2016 17:06:09 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u78KxsbF032202 for ; Mon, 8 Aug 2016 17:06:09 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0b-001b2d01.pphosted.com with ESMTP id 24na1wtwpj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 08 Aug 2016 17:06:09 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Aug 2016 15:06:08 -0600 From: Michael Roth Date: Mon, 8 Aug 2016 16:04:12 -0500 In-Reply-To: <1470690267-31454-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1470690267-31454-1-git-send-email-mdroth@linux.vnet.ibm.com> Message-Id: <1470690267-31454-42-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 41/56] target-sparc: fix register corruption in ldstub if there is no write permission List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Artyom Tarasenko , Mark Cave-Ayland From: Artyom Tarasenko Signed-off-by: Artyom Tarasenko Reviewed-by: Richard Henderson Signed-off-by: Mark Cave-Ayland (cherry picked from commit b64d2e57e704edbb56ae969de864292dd38379bf) Signed-off-by: Michael Roth --- target-sparc/translate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target-sparc/translate.c b/target-sparc/translate.c index 7998ff5..502510c 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -4668,12 +4668,15 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) case 0xd: /* ldstub -- XXX: should be atomically */ { TCGv r_const; + TCGv tmp = tcg_temp_new(); gen_address_mask(dc, cpu_addr); - tcg_gen_qemu_ld8u(cpu_val, cpu_addr, dc->mem_idx); + tcg_gen_qemu_ld8u(tmp, cpu_addr, dc->mem_idx); r_const = tcg_const_tl(0xff); tcg_gen_qemu_st8(r_const, cpu_addr, dc->mem_idx); + tcg_gen_mov_tl(cpu_val, tmp); tcg_temp_free(r_const); + tcg_temp_free(tmp); } break; case 0x0f: -- 1.9.1