From patchwork Mon Jul 10 06:59:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Biao X-Patchwork-Id: 786050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x5bVG5Fbcz9ryr for ; Mon, 10 Jul 2017 16:51:50 +1000 (AEST) Received: from localhost ([::1]:38756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUSXs-0006hK-NP for incoming@patchwork.ozlabs.org; Mon, 10 Jul 2017 02:51:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUSXV-0006h2-RJ for qemu-devel@nongnu.org; Mon, 10 Jul 2017 02:51:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUSXS-00078b-PP for qemu-devel@nongnu.org; Mon, 10 Jul 2017 02:51:25 -0400 Received: from mx7.zte.com.cn ([202.103.147.169]:46721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUSXQ-00076A-H9 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 02:51:22 -0400 X-scanvirus: By SEG_CYREN AntiVirus Engine X-scanresult: CLEAN X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170710143850 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 10 Jul 2017 06:38:50 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v6A6ooJp039648; Mon, 10 Jul 2017 14:50:50 +0800 (GMT-8) (envelope-from jiang.biao2@zte.com.cn) Received: from localhost.localdomain ([10.75.9.60]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017071014505247-3523565 ; Mon, 10 Jul 2017 14:50:52 +0800 From: Jiang Biao To: qemu-devel@nongnu.org Date: Mon, 10 Jul 2017 14:59:39 +0800 Message-Id: <1499669979-25904-1-git-send-email-jiang.biao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-10 14:50:52, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-10 14:50:50, Serialize complete at 2017-07-10 14:50:50 X-MAIL: mse01.zte.com.cn v6A6ooJp039648 X-HQIP: 127.0.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 202.103.147.169 Subject: [Qemu-devel] [PATCH v3] tcg/mips: Bugfix for crash when running program with qemu-i386. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: james.hogan@imgtec.com, zhong.weidong@zte.com.cn, wang.liang82@zte.com.cn, shi.zhongbing@zte.com.cn, jinguojie@loongson.cn, jiang.yong5@zte.com.cn, jiang.biao2@zte.com.cn, rth@twiddle.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When running a helloworld program with qemu-i386 in linux-user mode on Loongson 3A3000, it will crash. This patch fix the bug. Signed-off-by: Jiang Biao Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.inc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c index 8cff9a6..85756b8 100644 --- a/tcg/mips/tcg-target.inc.c +++ b/tcg/mips/tcg-target.inc.c @@ -1547,8 +1547,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64) } else if (guest_base == (int16_t)guest_base) { tcg_out_opc_imm(s, ALIAS_PADDI, base, addr_regl, guest_base); } else { - tcg_out_movi(s, TCG_TYPE_PTR, base, guest_base); - tcg_out_opc_reg(s, ALIAS_PADD, base, base, addr_regl); + tcg_out_movi(s, TCG_TYPE_PTR, TCG_TMP0, guest_base); + tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_TMP0, addr_regl); } tcg_out_qemu_ld_direct(s, data_regl, data_regh, base, opc, is_64); #endif @@ -1652,8 +1652,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64) } else if (guest_base == (int16_t)guest_base) { tcg_out_opc_imm(s, ALIAS_PADDI, base, addr_regl, guest_base); } else { - tcg_out_movi(s, TCG_TYPE_PTR, base, guest_base); - tcg_out_opc_reg(s, ALIAS_PADD, base, base, addr_regl); + tcg_out_movi(s, TCG_TYPE_PTR, TCG_TMP0, guest_base); + tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_TMP0, addr_regl); } tcg_out_qemu_st_direct(s, data_regl, data_regh, base, opc); #endif