From nobody Wed Nov 13 07:26:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1705580866; cv=none; d=zohomail.com; s=zohoarc; b=lEQ1BCZdJRhy696VxvvTXl90pMQX3vtCqMGmovgDjvP2bHjOMOMep+Dc7zOkEIwoc6XhfgxBk5cANL6ZpQe6Wu+sbPx3uIckd64UdhUpTL8794J4+1DI+cJotkiymHUSdt2RHnEjCO81/1gSDTsItYEi2m08q1J3iEvKG+VH6kQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705580866; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IxvX/wxNBwVtKGkT3vFrlSLqiMV2FttRmJQLp4ASRQ0=; b=kBla1y7yOHlaHZXq2jiPJ/Ebg3MyJOafYkrdB+7jD/uU7wGEC7uC8m/sE1/PaDJOcctc2OfevAaGiK3rogRDHkLUtG3prXAntWSbZ8CRMYYenQEiTXmJf08LPN8/DBP9YrlKsUIuiFaN7Twce3UsrBG3M/KflAHjgkYpHLt734E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705580866953242.50313398322714; Thu, 18 Jan 2024 04:27:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQRS3-0004BZ-R3; Thu, 18 Jan 2024 07:24:55 -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 1rQRRs-0003WR-Rp for qemu-devel@nongnu.org; Thu, 18 Jan 2024 07:24:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQRRr-0006Gf-7j for qemu-devel@nongnu.org; Thu, 18 Jan 2024 07:24:44 -0500 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-5zakvBx-PaCj0SfF05ElkQ-1; Thu, 18 Jan 2024 07:24:40 -0500 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-55926d2bbe2so1467413a12.1 for ; Thu, 18 Jan 2024 04:24:40 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:4783:a68:c1ee:15c5]) by smtp.gmail.com with ESMTPSA id c10-20020a056402100a00b0055974156563sm4142191edu.26.2024.01.18.04.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 04:24:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705580682; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IxvX/wxNBwVtKGkT3vFrlSLqiMV2FttRmJQLp4ASRQ0=; b=Qci2nQQiXymBQSgHGbhlfBijLqmrqXmm8DG9FMREY5kcWlHBSOysBYrvJZnTqD80Pb2Cjv GwuinVL7GlpwhEMLw00yjaEvkt2igpKLWaLbWkTZR4SBX1JoTZHRyNnjUgpQc2/8lIPCdW NLJ3h69DrrfzZ+ad0XLbioHmXfAfih8= X-MC-Unique: 5zakvBx-PaCj0SfF05ElkQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705580679; x=1706185479; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IxvX/wxNBwVtKGkT3vFrlSLqiMV2FttRmJQLp4ASRQ0=; b=KCKcJyV6nBSrYARdn9vB0GWCS/+hb1ut4dKoLYlHTFeNceY6BNK63IgA+nPxEZFwa5 wVkMj/mVhmrU3uUpQCbnsM52/MAiFHDyfA5zvxowYTxP5lTQEpjjenrFx8+Pz8WiP+FS 9vyBIhnsx+oOIukcKAVtseofZ4Vbgs5kdum3VODTh+JLSRHsJyXSFj+WwackMB7wmAHi CKSmr8cxhd0gbRAP8pOwmjuEN0W7KeQPAQhROv7EzaFIluADPvc8R8r2UKNAwxkUBagx DtUKh4ICw4xIDUtvBTbbHn2dsVcEXgXlSkCt/sCyXXADWxXYi2m2xkp4zazTqih/6pmD xmYg== X-Gm-Message-State: AOJu0YxBbipcijzLPJHt3WNq3M9ryPsrCd4l4Bp+DEZSid66bd07Xttz vIa+c77mIMFmctVcDLZTsxKKAdSgH0v8Zc46ZVQL3vFDtUEhuUywhKALOeGmaAySvrYtQaOFAIe EVeT605vPAKPmskoEmJIKZU1OMJVz4J6nHamBy/A3aM0+tR7hMFVbLfczsfuF7ZZycTY5B++s+F V6sGr2vZXzkMP8oeZjTi8PnpyPJu7Y7Tgi7lfH X-Received: by 2002:a50:9ea4:0:b0:559:b943:c067 with SMTP id a33-20020a509ea4000000b00559b943c067mr529664edf.79.1705580679117; Thu, 18 Jan 2024 04:24:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOuLJK78kHdR+iTZkutVu8nI+QN9+sP2yyWn+jd3CgVlwW1NGYJdKEsOpFab4LFVgIhsHD4g== X-Received: by 2002:a50:9ea4:0:b0:559:b943:c067 with SMTP id a33-20020a509ea4000000b00559b943c067mr529659edf.79.1705580678911; Thu, 18 Jan 2024 04:24:38 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: guoguangyao , qemu-stable@nongnu.org, Richard Henderson Subject: [PULL 12/16] target/i386: fix incorrect EIP in PC-relative translation blocks Date: Thu, 18 Jan 2024 13:24:12 +0100 Message-ID: <20240118122416.9209-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240118122416.9209-1-pbonzini@redhat.com> References: <20240118122416.9209-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -38 X-Spam_score: -3.9 X-Spam_bar: --- X-Spam_report: (-3.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1705580868866100011 Content-Type: text/plain; charset="utf-8" From: guoguangyao The PCREL patches introduced a bug when updating EIP in the !CF_PCREL case. Using s->pc in func gen_update_eip_next() solves the problem. Cc: qemu-stable@nongnu.org Fixes: b5e0d5d22fbf ("target/i386: Fix 32-bit wrapping of pc/eip computatio= n") Signed-off-by: guoguangyao Reviewed-by: Richard Henderson Message-ID: <20240115020804.30272-1-guoguangyao18@mails.ucas.ac.cn> Signed-off-by: Paolo Bonzini --- 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 d4d7e904adb..cadf13bce43 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -567,9 +567,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 =3D s->pc; } --=20 2.43.0