From nobody Wed Nov 27 17:56:08 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=1697712552; cv=none; d=zohomail.com; s=zohoarc; b=LH+0AFDgqLjqL3AmjYX5UYU8i74yuwAXyH0ZvRV78C0BhrN4m875pQQGgf/oqG1VAofYfhqo+qilR/4FGQA8JkWtiqRb5KtXPRu+X8+YmhUk9XD1+L52A1kMd0sOuJwk5mEQXK7u/GLHQPIfguBttBV9gTJAjB94BZlZCDaGvoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697712552; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=yc1wAytN855M32R5CShLNXtSB0oVJdwxN5lIj8DxbsA=; b=VVXSc5AUc/PThHUVSl/6GiSSWvaD2vF4FMH51Xg/75T9vgWxVLjqXsoy5P8BIuYWcHUMPRcK9UT+L8T+wUy/D12Kdi4F6QqrtPDPlIyi1+Ir+bhPTtpm9GAs71eTuIhwRoDPVnh3mMiomr6nsiZKu8jN9qjfOgJKAfwRisg4u84= 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 1697712552043572.7211789070818; Thu, 19 Oct 2023 03:49:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtQZF-0007CV-9a; Thu, 19 Oct 2023 06:47:53 -0400 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 1qtQYq-0006aU-63 for qemu-devel@nongnu.org; Thu, 19 Oct 2023 06:47:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtQYk-0006K6-RX for qemu-devel@nongnu.org; Thu, 19 Oct 2023 06:47:27 -0400 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-344-eP4CVUTMOFK6IIxgtGWm9w-1; Thu, 19 Oct 2023 06:47:14 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-53e2acda9d6so5324654a12.2 for ; Thu, 19 Oct 2023 03:47:14 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id s14-20020a05640217ce00b0053e4d1cbc6esm4179905edy.55.2023.10.19.03.47.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 03:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697712440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yc1wAytN855M32R5CShLNXtSB0oVJdwxN5lIj8DxbsA=; b=MjIRrDEUx3ioOghVof+h8urWbdazm2beTIXCUTUGVzLClhkAxKjynBHcKxNDeUtAUq5FLf xTYSnCUURBAkEQqnyeqVW785q/JHeYcp0zMtw+tIcWGiHHzspIR7R9WkdEZPPEDD2kOeSP gRpVs6/7H9C6N6UEn4vZuinAWtbsFZA= X-MC-Unique: eP4CVUTMOFK6IIxgtGWm9w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697712432; x=1698317232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yc1wAytN855M32R5CShLNXtSB0oVJdwxN5lIj8DxbsA=; b=HMfyjB7AqBIi+bDwA4K9vRNTAeWPfEktBfEEQBLtnK5Dji1XXWGj5z6afYt8WW6Vnh foYCLN8Zy1gr/oVhrONovQd9jUaqUMa5/txmFkX9E+atCIb1ZB1BpdSVjxOXSXyHNJ0Y tFyVd5OxUh0FjdZSDU+ZGqsUL0iUL41t9PDLSzLpSnKDmDUsuTXAnsD4bdVsxcR4FEhy XZLlol6rJFzLmneX2lO9KlnrOhkxwHzaMzGovZkw/VN7sbplOimlg/aUT2QiewuseUAF XP5WSq0TMlvbQJWtyRvJ8dQNTE8QiLu228/JNk9u7ULpP3Dci66+2wwTChp7ETHMyxeI 1gUQ== X-Gm-Message-State: AOJu0YwQ+s5eeuyNMDJU81FUkQhawiEYeZ/26to5bf79hWgrO5lSJ7D5 wVd5sRLNyaesUgU+x0ph3/huA/KRuxDo5QjhwN5NZEb+XBFTg/LrjwG4yG8GqWkBY0wyighEiPr 9vMuWCnr8zZLpk0FtlU5o/3CqCffkTwx6vV8KlAdKxwKu13ci5jC7jEer7gA5JqW9MtGuVbl03g M= X-Received: by 2002:a05:6402:430b:b0:53d:bc68:633d with SMTP id m11-20020a056402430b00b0053dbc68633dmr1531994edc.7.1697712432704; Thu, 19 Oct 2023 03:47:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEAK966MZBi3UTq1SDApChVnv8oYaJY9ExHCuYYa4I0GNcfjNCRyJlMOdCG0b/YkmLOOrRG0A== X-Received: by 2002:a05:6402:430b:b0:53d:bc68:633d with SMTP id m11-20020a056402430b00b0053dbc68633dmr1531970edc.7.1697712432295; Thu, 19 Oct 2023 03:47:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 13/19] target/i386: split eflags computation out of gen_compute_eflags Date: Thu, 19 Oct 2023 12:46:42 +0200 Message-ID: <20231019104648.389942-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019104648.389942-1-pbonzini@redhat.com> References: <20231019104648.389942-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.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: 1697712553632100003 Content-Type: text/plain; charset="utf-8" The new x86 decoder wants to compute EFLAGS before writeback, which can be an issue for some instructions such as ARPL. Extract code to compute the EFLAGS without clobbering CC_SRC, in case the ARPL memory write causes a fault. Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index e13bf7df591..2da7c357cdc 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -872,18 +872,20 @@ static void gen_op_update_neg_cc(DisasContext *s) tcg_gen_movi_tl(s->cc_srcT, 0); } =20 -/* compute all eflags to cc_src */ -static void gen_compute_eflags(DisasContext *s) +/* compute all eflags to reg */ +static void gen_mov_eflags(DisasContext *s, TCGv reg) { TCGv zero, dst, src1, src2; int live, dead; =20 if (s->cc_op =3D=3D CC_OP_EFLAGS) { + if (reg !=3D cpu_cc_src) { + tcg_gen_mov_tl(reg, cpu_cc_src); + } return; } if (s->cc_op =3D=3D CC_OP_CLR) { - tcg_gen_movi_tl(cpu_cc_src, CC_Z | CC_P); - set_cc_op(s, CC_OP_EFLAGS); + tcg_gen_movi_tl(reg, CC_Z | CC_P); return; } =20 @@ -909,7 +911,13 @@ static void gen_compute_eflags(DisasContext *s) } =20 gen_update_cc_op(s); - gen_helper_cc_compute_all(cpu_cc_src, dst, src1, src2, cpu_cc_op); + gen_helper_cc_compute_all(reg, dst, src1, src2, cpu_cc_op); +} + +/* compute all eflags to cc_src */ +static void gen_compute_eflags(DisasContext *s) +{ + gen_mov_eflags(s, cpu_cc_src); set_cc_op(s, CC_OP_EFLAGS); } =20 --=20 2.41.0