From patchwork Thu Dec 21 09:38:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: guoguangyao X-Patchwork-Id: 13502180 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D621C35274 for ; Thu, 21 Dec 2023 13:46:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGJN8-0006tP-9J; Thu, 21 Dec 2023 08:45:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rGFVk-0004RV-Ab for qemu-devel@nongnu.org; Thu, 21 Dec 2023 04:38:37 -0500 Received: from smtp21.cstnet.cn ([159.226.251.21] helo=cstnet.cn) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1rGFVg-0007Kx-Ln for qemu-devel@nongnu.org; Thu, 21 Dec 2023 04:38:36 -0500 Received: from nano.. (unknown [123.125.11.122]) by APP-01 (Coremail) with SMTP id qwCowABXWTF_BoRldMqGAw--.30538S2; Thu, 21 Dec 2023 17:34:02 +0800 (CST) From: guoguangyao To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, pbonzini@redhat.com, eduardo@habkost.net Subject: [PATCH] Signed-off-by: guoguangyao Date: Thu, 21 Dec 2023 17:38:05 +0800 Message-Id: <20231221093805.309502-1-guoguangyao18@mails.ucas.ac.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CM-TRANS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a7IU8m9aPUUUUU== X-Originating-IP: [123.125.11.122] X-CM-SenderInfo: 5jxrw35dqj5trrryqzpdlo2hpxfd2hldfou0/ Received-SPF: pass client-ip=159.226.251.21; envelope-from=guoguangyao18@mails.ucas.ac.cn; helo=cstnet.cn X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 21 Dec 2023 08:45:53 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org target/i386: Eip error in x86_64-softmmu When closing PCREL, qemu-system-x86_64 run into error. Eip modification here leads to the result. Fixes: b5e0d5d22fbf("target/i386: Fix 32-bit wrapping of pc/eip computation") Changes to be committed: modified: target/i386/tcg/translate.c --- target/i386/tcg/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 037bc47e7c..3dc7781a41 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -566,9 +566,9 @@ static void gen_update_eip_next(DisasContext *s) if (tb_cflags(s->base.tb) & CF_PCREL) { tcg_gen_addi_tl(cpu_eip, cpu_eip, s->pc - s->pc_save); } else if (CODE64(s)) { - tcg_gen_movi_tl(cpu_eip, s->base.pc_next); + tcg_gen_movi_tl(cpu_eip, s->pc); } else { - tcg_gen_movi_tl(cpu_eip, (uint32_t)(s->base.pc_next - s->cs_base)); + tcg_gen_movi_tl(cpu_eip, (uint32_t)(s->pc - s->cs_base)); } s->pc_save = s->pc; }