From nobody Mon Nov 25 07:29:43 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=1716538308; cv=none; d=zohomail.com; s=zohoarc; b=ZccIC+o18X1dcrump9Xy0C+sTOvTlRN6hNiErj7Ntb4C5FAsWgms9Rj9hVXUEnxRf2LNlgdcrK0NpYPG06wXpSz7+cpfQPciptRLmXica9n3sffj4vlYTEqrE1Sz6NNnaS1R6oQGRynkB+HLLlPe1v7SQdo/ZnpDcOJ59xQDB0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538308; 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=ixOp6LvLNnzS8WvJ2+NP52iNUpz5IJz+mvxbQUZVrIs=; b=NeHJq92koriwkbVA3OhEaO4JF1nNE0jfCX66X1H7KYUG9A6JsocGnQY4LeaolvBdKR8MJow6WjjBt97/xXMlg4pdf6aBUheeVAymsIVidLn3bzkL1OhOb/mMlcanGO+guvPO5xNkNpZ+6qTEPTxP2ebyRxWVSj/HhD4bxVbjeQM= 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 1716538308355632.682585072545; Fri, 24 May 2024 01:11:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0U-0004yB-Ld; Fri, 24 May 2024 04:10:32 -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 1sAQ0R-0004vQ-Vt for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:28 -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 1sAQ0Q-0000Ij-HQ for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:27 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-646-HhaF9CRpOo6dlO8gRd19Pw-1; Fri, 24 May 2024 04:10:23 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a626ac4c2faso29134666b.3 for ; Fri, 24 May 2024 01:10:23 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda6e1esm89631466b.215.2024.05.24.01.10.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538225; 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=ixOp6LvLNnzS8WvJ2+NP52iNUpz5IJz+mvxbQUZVrIs=; b=MwPzXSkcCL44rrP8Okadr1GjPBdm856ajPpNesfrcvvRXmd7kRRYSXwwMfbIWLa01yiCpn 7Pi3on2ByzucvM/+A4zTudGaBTO1re3mAnxYzifGOMcKb2ZerXQ15FtOG+JAWTOmckUCR0 GgJwRrLkvwNGd8Q7icP2R8J2ihTxDwY= X-MC-Unique: HhaF9CRpOo6dlO8gRd19Pw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538222; x=1717143022; 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=ixOp6LvLNnzS8WvJ2+NP52iNUpz5IJz+mvxbQUZVrIs=; b=fOQqk4tXZF+UhtmFbEv4qa02o1hWRmfx97+yY1IGc2nQHQhKpUM8ABzqX60r/mUD/T MTTe/F1zycldcqbc5ZbeMSc6TCc6cjhJdYJ5VHTDDiynNLNOevk3psO3FNp0Dm8KNiIM MGGopooCUA8Nqs/gNcheRD0ezVeEU75NCJlrWk/x2OV6ZyPydV+Ts4qQvdOg/oO8dfz5 YGpZW+aOc+8aX+jOhTzMpRqunp2RAHGVQHp6VfcoSobI+1pNEmd+2VO2sYi7HvRlh0Ll 3E/M3mY3vtx4pDzDo3TUJ/JaS0P1AP1Na3xYPSjCa7kbHA4URRqzUaGQs0Tf502aMdPu m0PQ== X-Gm-Message-State: AOJu0YwfxbvNzH3u7qWnBBaZfck66eu4K71hOfWLlNbcxwMBiVrNjOp5 n2F7af3oR0oEPuh84YoNP7DluWsOUr0PActsYt2JHFAUF64wBtPmZFUQJbCn20ds8Y0svhpbsMk fczT+ds6ewU7xDgDB7cd9EhRxxNRtj5edZEUx8c09/FBwjGskljAtMw8aPU0eztedPpPczXwWVR yqkSyARCQdVgPYZRqb4Ah3I8Wd08klyHkSGLHp X-Received: by 2002:a17:906:6d97:b0:a62:47d7:247d with SMTP id a640c23a62f3a-a626511b0bamr151011066b.56.1716538222107; Fri, 24 May 2024 01:10:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERgUJ9LLDxEfzhYR7dL04Z73ysvaupWkBNld1gCtLdc/mWLVXQtv9HwfGc1BhGk6t4kDCSWA== X-Received: by 2002:a17:906:6d97:b0:a62:47d7:247d with SMTP id a640c23a62f3a-a626511b0bamr151008566b.56.1716538221520; Fri, 24 May 2024 01:10:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 01/16] target/i386: remove unnecessary gen_update_cc_op before gen_eob* Date: Fri, 24 May 2024 10:10:04 +0200 Message-ID: <20240524081019.1141359-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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_H4=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: 1716538308841100003 Content-Type: text/plain; charset="utf-8" This is already handled in gen_eob(). Before adding another DISAS_* case, remove the double calls. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 76be7425800..f44edb3c29c 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -4776,14 +4776,12 @@ static void i386_tr_tb_stop(DisasContextBase *dcbas= e, CPUState *cpu) gen_jmp_rel_csize(dc, 0, 0); break; case DISAS_EOB_NEXT: - gen_update_cc_op(dc); gen_update_eip_cur(dc); /* fall through */ case DISAS_EOB_ONLY: gen_eob(dc); break; case DISAS_EOB_INHIBIT_IRQ: - gen_update_cc_op(dc); gen_update_eip_cur(dc); gen_eob_inhibit_irq(dc); break; --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538350; cv=none; d=zohomail.com; s=zohoarc; b=VWucWSt6XG4GCmXSJXy5/7MC1rIol554uHC/B3VL/xKCwkt+OPGt2M/+YOREWBHJdUHeXf8Mb+OejMa/yIB5z3Qqf9x/IVqSK/wSr2lwg/DfbJTTVQ4WrTBcmTUn3tLSCFIMVcOccRdE3lNU8bSMDDm67ql6CyQq4a3kq0Hrt1Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538350; 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=72PbcHRv/pFHTWTtQDS+C3T5q7MCkz97s7uPdQE0p0s=; b=BMoyaPQ31Tf5a4ITJhPYbFFuckVO4kFiol+0vWubvN2tkk+5Z8cDP9PxR5Jqg1fV0Cvfm8/UEoxG8HSRvGdP7IYWTDepLFD6oQ7xhpjCCk4rHfS2FH3PbYdDpSF2dOMFCqEwrAEtOVACSkkp5KcUeW/AGUst26nQB4RpDKtXEXI= 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 1716538350075163.34162431964046; Fri, 24 May 2024 01:12:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0a-00053h-9U; Fri, 24 May 2024 04:10:36 -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 1sAQ0U-0004yd-O8 for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:32 -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 1sAQ0T-0000Kk-8d for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:30 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-686-k4kATvNQNva3TXGFF9Gxjw-1; Fri, 24 May 2024 04:10:26 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a6269ad7288so23368966b.2 for ; Fri, 24 May 2024 01:10:26 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc8c287sm89414966b.162.2024.05.24.01.10.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538227; 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=72PbcHRv/pFHTWTtQDS+C3T5q7MCkz97s7uPdQE0p0s=; b=X12wOEFrzSirl9TMVUMcdbYc+zP6tDTPWtdaTSd62YjYiuotuetic7BEY42ANSk9K6xXV0 wFRiXL7jsbgbO/FnnkRUqcxQO/fDIXq4X/Nh5BTgpD4outEsf3vfeUDIB0kztSQ9B66bHK Y6EX2u/crUjDGew//nexWCsy6Q6/c+M= X-MC-Unique: k4kATvNQNva3TXGFF9Gxjw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538224; x=1717143024; 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=72PbcHRv/pFHTWTtQDS+C3T5q7MCkz97s7uPdQE0p0s=; b=A1nzt5j3HZZDypg0toBVYJQaEUGi7zr181eQATCzr+Xtre07D151S0jj3vi88P0vFx yTu3xhqDFEoZ+NanCUq4HYDLq0QGoPY5XKbDr3YmYsGdNjRF7OSzTeSYtwo5HA7od7+n dUGqR1x7WpRBQoiTebMbLPYDsSfJQKeST1dhEFfnsN6h/E/6W8uB6lAt21ADTcPbBr2l j553BrQeMuPhzseUtOaXlHtYx4ffd11oMguJF6aQKdFUEICnzw/+wOscwS/ZVf3ogEHL kpUCwFNU1j1/6hrA6lPGpzPSXygbHzw20BXSoamNlkY0I2A7g5KVhNCqBdIp07o2UxQr edRA== X-Gm-Message-State: AOJu0Yxm4BNoAzp6pP8xSZTVUS8MOQ/QXo4QAsk/Evg1AZHyG7LhHVdd 3XlhLNsXSSCsSL/aiq8vB/BDybXxBuldTDq0zrCOcuyH2Dfyu2Bily9MWQ9JgodOyW4+ivX7rCQ Dbh1lRMAvCcHaYrqAhR7bAt89Wc2KL2fGGNLZv0++GG36K9Ywiru8pC1cXHrO+r6rlX4nEmAJDp T8kZOi7jA/rK7r94s4WUUZd1D8MsVwIjgR5Cqy X-Received: by 2002:a17:906:2b82:b0:a62:2cae:c10 with SMTP id a640c23a62f3a-a6264f1600dmr109627566b.47.1716538224433; Fri, 24 May 2024 01:10:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVe1dL0yunhUsZRGQ99Cw800q/hFGYEbQ+PG473cDCldXlnmQ5EkE3CLVzZ91/CxAnN8E13w== X-Received: by 2002:a17:906:2b82:b0:a62:2cae:c10 with SMTP id a640c23a62f3a-a6264f1600dmr109625666b.47.1716538224009; Fri, 24 May 2024 01:10:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 02/16] target/i386: cleanup eob handling of RSM Date: Fri, 24 May 2024 10:10:05 +0200 Message-ID: <20240524081019.1141359-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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_H4=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: 1716538351096100006 Content-Type: text/plain; charset="utf-8" gen_helper_rsm cannot generate an exception, and reloads the flags. So there's no need to spill cc_op and update cpu_eip, but on the other hand cc_op must be reset to CC_OP_EFLAGS before returning. It all works by chance, because by spilling cc_op before the call to the helper, it becomes non-dirty and gen_eob will not overwrite the CC_OP_EFLAGS value that is placed there by the helper. But let's clean it up. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index f44edb3c29c..3c7d8d72144 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -4488,9 +4488,8 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) /* we should not be in SMM mode */ g_assert_not_reached(); #else - gen_update_cc_op(s); - gen_update_eip_next(s); gen_helper_rsm(tcg_env); + set_cc_op(s, CC_OP_EFLAGS); #endif /* CONFIG_USER_ONLY */ s->base.is_jmp =3D DISAS_EOB_ONLY; break; --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538331; cv=none; d=zohomail.com; s=zohoarc; b=HlYptX1Kex61DjfNUGaqyfVMOdNts1S1YjYiZRRZfUFXPquS+Nvv8a0/WQcH/XGsh4yZwsyjnQdsiXjW9X4wW0uRAof38HRsnON/N8PlKWE8EV1e/g/QT9qu5bG+PiuNINTwGzOt2yKvTViv7SZb/DsWrwHK6Dj3wq1lClJ6i1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538331; 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=wbTLiCeUvWkQ0K+ApblZWP5HmsgfyWXFWN9Nk07xfSw=; b=Lh6vDYA1F6vLMrhEQ5LzowERG9AnWWZPjoGzhQYFo6aLoCje63UuyM0A5lRAV6qX/4pym1QsrIz2jg8bOIWEpHnJt6X6lDAHRZpqSlihvKQ9gZRzjzeuuJZ6u9BiDej3Ytt/Mfw+DyfS9BHBjgViqK+DYA8aCagPiVEFq6Uy2/k= 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 1716538331601189.82290364086623; Fri, 24 May 2024 01:12:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0b-000546-0w; Fri, 24 May 2024 04:10:37 -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 1sAQ0X-00050z-Fg for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:34 -0400 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 1sAQ0V-0000Ma-VS for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:33 -0400 Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-2SVnUSDuMEaYdcbK-RlgCQ-1; Fri, 24 May 2024 04:10:28 -0400 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2e95a1f049aso5523911fa.0 for ; Fri, 24 May 2024 01:10:28 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c97a1fbsm90994066b.92.2024.05.24.01.10.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538231; 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=wbTLiCeUvWkQ0K+ApblZWP5HmsgfyWXFWN9Nk07xfSw=; b=basF5e5V8UWOheFy5oMI3uy5hyr5EnkA4biGDi6D3+OySYq93zyaBg6IQweYz/XUhhjeKL k1+0On+AX2T1A0sHPxSxJD0R/nibzkL2ZreyVg2JR/k4sEAZK/96koLfdASwf6cyxxT6VU fOqlLxMLf3uqC5bvdY84cfVttQPW8Do= X-MC-Unique: 2SVnUSDuMEaYdcbK-RlgCQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538227; x=1717143027; 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=wbTLiCeUvWkQ0K+ApblZWP5HmsgfyWXFWN9Nk07xfSw=; b=pMbzYGV/3xK1OPdnr82o5aB7N3vvJ5qibCg1+8FkRkF00f18T9+NIQOVlenmbDUH/j jHdSVvAUsVpb587IOFkMoIJAALDBTo6cN05bhjYrxvVZ8M3S6F7orKegsYeg+7ge9bYT pVM1QeF6WU8ngFejPpvrKbAmc1sU5fhkv8E2AvsDK87NHKRH8xmkqo2ClLJazaLXGSvd j7+yaBh2MGogM8Chxn6PYsW+lyZvbxSTZ0V8zBIvdOjrxzf9iknbjoiingiWtfvnQXoE hF/Huu2Muixbd2w36cVAJoyU0DxYtx6YEm7XYW8Kn57DRS71OY/x9eQL9BWa1oSpp16r R48Q== X-Gm-Message-State: AOJu0YzwelvuNAi6sIUZDOLXXcpC8wgbTSTiF0Jjl875R0NJDoR802xn YXLHXVHNmsTi5dOTyv+xWve/5Ey7NQSQ+vcC4hvnwzStSJ5t3xxSWY72ByaIOChArZmRHnzM1uN b7WQo76DJwj9vrsACRAkROibhMhVKU02P0iRGZlxNFIjrRTy714aBsDm5SKQlMIPFzhOoERYW1I vZnZ36bsVEKyxJM3mQnMzHSmdzyIglcf94zmDG X-Received: by 2002:a2e:9f4a:0:b0:2e7:1e4a:31e0 with SMTP id 38308e7fff4ca-2e95b096f07mr13619991fa.18.1716538226973; Fri, 24 May 2024 01:10:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhOFQEAsml9prPJCio1TD8WXvfG6LQdmw1+r3T3yGeaVrojs7m52NNJD1Ii/nJcT2DOVm63g== X-Received: by 2002:a2e:9f4a:0:b0:2e7:1e4a:31e0 with SMTP id 38308e7fff4ca-2e95b096f07mr13619741fa.18.1716538226456; Fri, 24 May 2024 01:10:26 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 03/16] target/i386: document and group DISAS_* constants Date: Fri, 24 May 2024 10:10:06 +0200 Message-ID: <20240524081019.1141359-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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: -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_H4=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: 1716538332959100003 Content-Type: text/plain; charset="utf-8" Place DISAS_* constants that update cpu_eip first, and the "jump" ones last. Add comments explaining the differences and usage. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 3c7d8d72144..52d758a224b 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -144,9 +144,28 @@ typedef struct DisasContext { TCGOp *prev_insn_end; } DisasContext; =20 -#define DISAS_EOB_ONLY DISAS_TARGET_0 -#define DISAS_EOB_NEXT DISAS_TARGET_1 -#define DISAS_EOB_INHIBIT_IRQ DISAS_TARGET_2 +/* + * Point EIP to next instruction before ending translation. + * For instructions that can change hflags. + */ +#define DISAS_EOB_NEXT DISAS_TARGET_0 + +/* + * Point EIP to next instruction and set HF_INHIBIT_IRQ if not + * already set. For instructions that activate interrupt shadow. + */ +#define DISAS_EOB_INHIBIT_IRQ DISAS_TARGET_1 + +/* + * EIP has already been updated. For jumps that do not use + * lookup_and_goto_ptr() + */ +#define DISAS_EOB_ONLY DISAS_TARGET_2 + +/* + * EIP has already been updated. For jumps that wish to use + * lookup_and_goto_ptr() + */ #define DISAS_JUMP DISAS_TARGET_3 =20 /* The environment in which user-only runs is constrained. */ --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538434; cv=none; d=zohomail.com; s=zohoarc; b=QGoBVoZjyq1mZ6XEHazxV6ISuGY8VMVTiL4thJXrGxQeQv2ls2UxW7a/DIeQw4oU8CqeQ+8vDVIOx6dqX53aTsnZVk9M43v/fOUiKOU2zABzZtE1BKQqPuSyZNPEut91Bx+XlvLTXAPsiqIWzo20GCApHegxSs2HUCPhLJRoTfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538434; 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=pzMu4bGplTJ0/IjTAQY/99ej8JAgWkuVwj+4BdBCfyk=; b=Vb3zbsT5oDnrHV0lzXBCE5NLUuVpJT7o1T1eG8np6aFkHreQZGYeKdeyzxhtbClzOTxP6T+XMrgsPEcjHmaggV+4+0oUGAak6SdhzuHUWQ6dzxlNK3pZp0Pkh+HtAUCQveX9ALzNiMvp0/Cvsa1VWobDcQ2ZbIQNHzYPeMXHBSs= 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 1716538434377202.53464775020188; Fri, 24 May 2024 01:13:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0d-00054y-69; Fri, 24 May 2024 04:10:39 -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 1sAQ0Z-00052Z-9I for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:36 -0400 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 1sAQ0X-0000NK-MS for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:34 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-197-2IZSzd3LMQu8OLb9wXZErA-1; Fri, 24 May 2024 04:10:31 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a6265d3cb78so26097566b.0 for ; Fri, 24 May 2024 01:10:30 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c817a98sm91542866b.37.2024.05.24.01.10.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538233; 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=pzMu4bGplTJ0/IjTAQY/99ej8JAgWkuVwj+4BdBCfyk=; b=ZEBbRjIITJuZTw5WKWKXwq4oQ63WOnzJqc9xKuo1TyAA5qPoKYhPNFrmlljQuASN0BVHPM UpFL+i2rK6UaXPkfxZ0e2ZbuTvJi4dm8HVMO/K2iae5zgRWxSm3Bg+ly+FGqHIl5YM9E8g JEBcO15a4zwR8Yoo5du8eEDQBuRdHqg= X-MC-Unique: 2IZSzd3LMQu8OLb9wXZErA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538229; x=1717143029; 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=pzMu4bGplTJ0/IjTAQY/99ej8JAgWkuVwj+4BdBCfyk=; b=csfUmlTAQzoTjGgWUO1xg/lUCRzi36WMjZ1yHh4wfgqI08StTE70vEWvTroSeECtaS mMFTo3QGkp1AJeugwQX5qcMoajD43fYNBOcgbp4vIuUaRVn49PvoWnBsMtJSSOIA+VNb 23MMijmJHOVGZ/verpoZNAi2Ost8USzoC02BigUdjH10MOk79FLEFMCxDSuveVGxgzBz /RtnF/0c2HLfZOQHgsCGxKakKV9VyVQlHETKVCnIN7jn6vcm+nPuCwIVS32oNvQbfY4U OoOicFLng3CUrcQjKkLZsTh5bZRPc4xg7IR9OJHci7DFZjCJa5FQmb544EoQ/UpG0hMn nJmw== X-Gm-Message-State: AOJu0YzlT7u9095MO53k7Ns1eqd+PW0zJ1UkT9iX2wwXeH9AFeoS/UGo IbMZzhHELZwxCroDznAjHE7iDiXmUk+Es4U4lBqfQZi2w1vQCAYpyn0AuQoFNfHzUyD7sRUwJOU /VtVK0OGx/1mOES3RrUzjo5dOlQMeJ1rGBGf/2yIakyBK2ov5/ZpPMUdAhYO1nlimLH1Br6gpB1 7ntokuN7u9jdbCXZY5KS3WO/KqNuCGevHnGfgG X-Received: by 2002:a17:906:a252:b0:a58:eba0:6716 with SMTP id a640c23a62f3a-a6265128466mr82816566b.60.1716538228977; Fri, 24 May 2024 01:10:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFOJqWx8aoDtHqY04Lf8yWJPeTups4VdBXnAWuLIWQ4AUiqeldEcWzwOOqd3yDr8gcyO3RoAA== X-Received: by 2002:a17:906:a252:b0:a58:eba0:6716 with SMTP id a640c23a62f3a-a6265128466mr82815166b.60.1716538228550; Fri, 24 May 2024 01:10:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 04/16] target/i386: avoid calling gen_eob_syscall before tb_stop Date: Fri, 24 May 2024 10:10:07 +0200 Message-ID: <20240524081019.1141359-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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: -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_H4=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: 1716538435435100003 Content-Type: text/plain; charset="utf-8" syscall and sysret only have one exit, so they do not need to generate the end-of-translation code inline. It can be deferred to tb_stop. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 52d758a224b..24e83c1af84 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -168,6 +168,12 @@ typedef struct DisasContext { */ #define DISAS_JUMP DISAS_TARGET_3 =20 +/* + * EIP has already been updated. Use updated value of + * EFLAGS.TF to determine singlestep trap (SYSCALL/SYSRET). + */ +#define DISAS_EOB_RECHECK_TF DISAS_TARGET_4 + /* The environment in which user-only runs is constrained. */ #ifdef CONFIG_USER_ONLY #define PE(S) true @@ -3576,7 +3582,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) /* TF handling for the syscall insn is different. The TF bit is c= hecked after the syscall insn completes. This allows #DB to not be generated after one has entered CPL0 if TF is set in FMASK. */ - gen_eob_syscall(s); + s->base.is_jmp =3D DISAS_EOB_RECHECK_TF; break; case 0x107: /* sysret */ /* For Intel SYSRET is only valid in long mode */ @@ -3595,7 +3601,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) checked after the sysret insn completes. This allows #DB to= be generated "as if" the syscall insn in userspace has just completed. */ - gen_eob_syscall(s); + s->base.is_jmp =3D DISAS_EOB_RECHECK_TF; } break; case 0x1a2: /* cpuid */ @@ -4799,6 +4805,9 @@ static void i386_tr_tb_stop(DisasContextBase *dcbase,= CPUState *cpu) case DISAS_EOB_ONLY: gen_eob(dc); break; + case DISAS_EOB_RECHECK_TF: + gen_eob_syscall(dc); + break; case DISAS_EOB_INHIBIT_IRQ: gen_update_eip_cur(dc); gen_eob_inhibit_irq(dc); --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538336; cv=none; d=zohomail.com; s=zohoarc; b=K/21q5MsPvN2l+C+TTT3b2c9ZPHLS0tfWVmnUQ0IKeQRTLkcDeg+SeBzXk4p6CD3D8L1w8OAmIcNK47tCM7s1YaHz2md3BkmubG5hDEgo8dNbaVNiM2lQVb8T7hKSf99VO7CG1Vstw3hKFbwetTN5yIQhIys+o0gDMFidkrqq8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538336; 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=Br6UNVLB3xRS4K0FimCnEwOTUqULB678+ykTuEHd9fM=; b=PFQji6aIhM08LYBj6PjVa2hzX+6AnHhd6RFt+n46aAl4kBc8QVVxW45d+FytwrryZwUZxw6oWADsUabtwcAz/94ex8/cXb+amt3hG8vDWFxcskb/9cJ4OagBPwZSHu/3Dg8RFfusKlN2HquEBGZvw7BQaYXEPgyo0LcEMODNrr8= 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 1716538336833879.8530422285506; Fri, 24 May 2024 01:12:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0f-00055f-D3; Fri, 24 May 2024 04:10:41 -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 1sAQ0c-00054g-JZ for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:38 -0400 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 1sAQ0b-0000PX-4c for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:38 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-YHkBLedSOImK0rJhMm3S9A-1; Fri, 24 May 2024 04:10:34 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a6269ad800aso27581866b.2 for ; Fri, 24 May 2024 01:10:34 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cd9fed2sm90000466b.187.2024.05.24.01.10.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538236; 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=Br6UNVLB3xRS4K0FimCnEwOTUqULB678+ykTuEHd9fM=; b=FZU/bS68pIfS/BbL59QY3bRRtEOHWL7j73Qy7TM5HC5QQKQWj64NFYK65MzAGXhUCqCAS0 7hR5zRcAZ0D6lyY8pYBPgS5oZzSRaxxRttdGzgvs3Ape3ktoPzt6qKR7A8vTFvDsjE9OE9 M1sq2E0nT/uUlFy37AR398SAf27oM2Q= X-MC-Unique: YHkBLedSOImK0rJhMm3S9A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538232; x=1717143032; 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=Br6UNVLB3xRS4K0FimCnEwOTUqULB678+ykTuEHd9fM=; b=l6exJlvDj8C7IhpOuMcWLXafAR6kcnTAZUfka4COsklAotom0h42uWQTxYyjsJ+8vs ZiMyBirdiBearmm8zo3NKE12/IbO5LX5ohvNu08lUNKoWGhYNksDXJiyHAQ69KOIgTYK FBvrPA9/xyfEwB1BkTeyWtg40BbHjd7RkyYabKoK6XLICfXe112c67TkfxYy5JlmQapZ DXLlP8kzZGFg+pdoksGDUXu7RRcC/POHrkr1AglEjQ6eGxbPcq0TNqjqGgdHvIb4PRyQ RorcqnxHTJfiXwcEHWsWfC/MiWZ6hY+3LKbHIST939eelndmY0N4P5rGNSPeRaZ2brz3 cL3w== X-Gm-Message-State: AOJu0YwkVLGbb3lp9ZY5SthSSaMDxXpdqSNRfaqh8NcQnjhP+7bNEfvr vyjPo8IC8wJK45je+GslQel343z3UUJ0Si++s+DFwrTZFQa93AJz70EfMc3ya2HE7TozGymACHD Xr0e62hhaL9bGqqLMZUsRcGYk20IMF1OBveQMz5nQC06TkeCEMLVWd0N851iz/LDO67qfM5dkPE 3OY4mGQipYxPeLkTdgwZVOnw/kMkNYiPGlXGgT X-Received: by 2002:a17:906:478c:b0:a59:d0be:dba4 with SMTP id a640c23a62f3a-a62641c2e07mr180444066b.13.1716538232356; Fri, 24 May 2024 01:10:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZ+Rd2AlsD38sd8fJKKklm8D1CVNI39r41Mz4JRJFcz9gdHbvuLGnCfjFGcvCihT23KqamUQ== X-Received: by 2002:a17:906:478c:b0:a59:d0be:dba4 with SMTP id a640c23a62f3a-a62641c2e07mr180441766b.13.1716538231974; Fri, 24 May 2024 01:10:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 05/16] target/i386: avoid calling gen_eob_inhibit_irq before tb_stop Date: Fri, 24 May 2024 10:10:08 +0200 Message-ID: <20240524081019.1141359-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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: -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_H4=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: 1716538336978100001 Content-Type: text/plain; charset="utf-8" sti only has one exit, so it does not need to generate the end-of-translation code inline. It can be deferred to tb_stop. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 13 ------------- target/i386/tcg/emit.c.inc | 4 +--- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 24e83c1af84..5dae890d2b6 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -557,19 +557,6 @@ static void gen_update_eip_cur(DisasContext *s) s->pc_save =3D s->base.pc_next; } =20 -static void gen_update_eip_next(DisasContext *s) -{ - assert(s->pc_save !=3D -1); - 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->pc); - } else { - tcg_gen_movi_tl(cpu_eip, (uint32_t)(s->pc - s->cs_base)); - } - s->pc_save =3D s->pc; -} - static int cur_insn_len(DisasContext *s) { return s->pc - s->base.pc_next; diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index c78e35b1e28..8e311b6d213 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -3475,9 +3475,7 @@ static void gen_STD(DisasContext *s, CPUX86State *env= , X86DecodedInsn *decode) static void gen_STI(DisasContext *s, CPUX86State *env, X86DecodedInsn *dec= ode) { gen_set_eflags(s, IF_MASK); - /* interruptions are enabled only the first insn after sti */ - gen_update_eip_next(s); - gen_eob_inhibit_irq(s); + s->base.is_jmp =3D DISAS_EOB_INHIBIT_IRQ; } =20 static void gen_VAESKEYGEN(DisasContext *s, CPUX86State *env, X86DecodedIn= sn *decode) --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538287; cv=none; d=zohomail.com; s=zohoarc; b=XmXpdmgvNpHpBp9oJd9D/b8iKsWV51URJmdt5oYwKU1YbOkc+ql1wltjOTSPNdWhfDukHoIOa5qsdLapsVjrqNs35CdHC5ia2df9iFJTLffNfILXS0LWTcIta5KlU4lMCWRSRhMgbKjJlzUgsrwSqRI/M+1E7M96IOY5tv+gtm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538287; 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=14ZWCEFaUxfzP+sSE8uYTknx8SNfEZ//ya7oX9lpCZw=; b=ZidFuw14K88K+rNqGDtzY/nTFe9kOubcRQiHw9iCxBRg1Qg0PHmuxwZBf8AG6dD831hA9t0frv4fYq5SEgE/9l75MLu9hG/Rr2/GyodqULG726w17ST5seBqIohBjTUiDe0i37TcMVNmpPwfMHy37EC4kg52OYVEGefh79RCMt0= 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 1716538287543674.7644426430242; Fri, 24 May 2024 01:11:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0i-0005Fa-5M; Fri, 24 May 2024 04:10:44 -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 1sAQ0e-00055j-P1 for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:41 -0400 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 1sAQ0d-0000Pn-BJ for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:40 -0400 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-679-YixUjvb6Owa3GW2ZFP18cQ-1; Fri, 24 May 2024 04:10:36 -0400 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a6270b93d0dso23368766b.3 for ; Fri, 24 May 2024 01:10:36 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc4f811sm90879766b.132.2024.05.24.01.10.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538238; 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=14ZWCEFaUxfzP+sSE8uYTknx8SNfEZ//ya7oX9lpCZw=; b=Sm6VHOaVGojoP69mDi6NLfDNn6oYoqViYKfTqiqWZqKeTsDtna8p5/DWCv1ZqHQI6rdvhL d+wwsslLfD/Izh+Lf3+2HEberut/L5SxBZ87l7uxLWQvpC0cM4QzD8MF7sHsEvLn2/UXLu Cu6QqGOjzQNBoK14FSwFW0Zpv1eOwV4= X-MC-Unique: YixUjvb6Owa3GW2ZFP18cQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538235; x=1717143035; 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=14ZWCEFaUxfzP+sSE8uYTknx8SNfEZ//ya7oX9lpCZw=; b=U4JCPE8UmAzLerCOV0HC5uQAKnV2Nx+u0GiwfAEFazxH3EIKWn/X+AbWB4V22vpa81 bXMU6H5JDk3dCMeprFBfHy0hPGJXCGcG4BQI7WVCYqS0NosL0beJzt3UAl2hTOawlCy+ w/37rmGaGRNwXblvfWBG4VvxBCRsThex0ylLvdMco0ZSHzNRdmAjmClGVxWy34DPHDly v71bovdQrKgFqGnDD0lXrbTj2YivhxOXHP61pY8HFM/o33W18i3vCEvPRcCm1VYy9x4M 7GUUqRlfGkUe0Ok66h3bbr6GLVRWTc84RPjbz0YqgEfN3Tlq50jBqelc6GuTcA3dJqRl b7RA== X-Gm-Message-State: AOJu0YyvdY2B7/l7KIff1YJprZS6Wq5ySb5dpNGCmZoAmChy4YX2HEt8 6n2Di6nUgTApC9N+68SWbvy0QqXHgKXZbUz1dQq1dxyhATNmPq6ejUckxIXe48YV76sh6oKufLn d13lVl8m8RBFVHBe2u8KDvJYaWK/RELDvF6/TehWZLAhxF3Pql3OXro0EZEGAIvZDNPz5rjBfM0 JBuWOjjjufm2j5nbMCLdnqBeEK2USrqve1xd+e X-Received: by 2002:a17:906:3e0c:b0:a59:aae5:5840 with SMTP id a640c23a62f3a-a62651140b6mr98452966b.75.1716538234782; Fri, 24 May 2024 01:10:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEiDuE+K8E1jszd9Jnrz4R8MMWmEUiTzckv3sgFy9FGGIYLm92VF83j5/SLg7SY1R4Ku0Rww== X-Received: by 2002:a17:906:3e0c:b0:a59:aae5:5840 with SMTP id a640c23a62f3a-a62651140b6mr98451266b.75.1716538234480; Fri, 24 May 2024 01:10:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 06/16] target/i386: assert that gen_update_eip_cur and gen_update_eip_next are the same in tb_stop Date: Fri, 24 May 2024 10:10:09 +0200 Message-ID: <20240524081019.1141359-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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: -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_H4=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: 1716538288755100011 Content-Type: text/plain; charset="utf-8" This is an invariant, since these cases of tb_stop() should only be reached through the "instruction decoding completed" path of i386_tr_translate_insn(). Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 5dae890d2b6..2c7917d239f 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -4787,6 +4787,7 @@ static void i386_tr_tb_stop(DisasContextBase *dcbase,= CPUState *cpu) gen_jmp_rel_csize(dc, 0, 0); break; case DISAS_EOB_NEXT: + assert(dc->base.pc_next =3D=3D dc->pc); gen_update_eip_cur(dc); /* fall through */ case DISAS_EOB_ONLY: @@ -4796,6 +4797,7 @@ static void i386_tr_tb_stop(DisasContextBase *dcbase,= CPUState *cpu) gen_eob_syscall(dc); break; case DISAS_EOB_INHIBIT_IRQ: + assert(dc->base.pc_next =3D=3D dc->pc); gen_update_eip_cur(dc); gen_eob_inhibit_irq(dc); break; --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538350; cv=none; d=zohomail.com; s=zohoarc; b=WCc1hOBW8P4hbxysENhoSvgodsRqt+33HqBn/wrXy90kyD+rxSRHqisqlOblRn5vvdgEeGaGmaje8ByRXKjjIks80WrKimID4ZuF5cLGA3wTNgqaizdwg7k7DCE0wtb9vGZ0KD3o8io4eJvUHNojqERmOPDaUjLF4/Kq5nzUdMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538350; 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=L2BbL6jR1b542eSscLXiZLPQxRUIoJp8BSdDrVwqVsM=; b=I1eENSGYuj3ue8NJXy0wduvG7aUkNDJtM98wM3ztP514RlCcPwVyhbe2+Q83rzqzp+OXGq7xeACyadM1ysC5CMKpkrIyTQEwVZPiGLr2anl4Ogb6WqutSj9C+kiaejv3ytX9rDRQfms3QO0cTmW3JccN+PkFfp4UmypbVkFU1Xo= 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 1716538350054857.4028684103173; Fri, 24 May 2024 01:12:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0k-0005Hw-O7; Fri, 24 May 2024 04:10:46 -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 1sAQ0j-0005GZ-7e for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:45 -0400 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 1sAQ0h-0000as-FB for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:44 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-9-U5afqTSUN7-4wzLfRfAkXA-1; Fri, 24 May 2024 04:10:39 -0400 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a6269ad7288so23389166b.2 for ; Fri, 24 May 2024 01:10:39 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc8e295sm89405366b.185.2024.05.24.01.10.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538242; 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=L2BbL6jR1b542eSscLXiZLPQxRUIoJp8BSdDrVwqVsM=; b=E1lMNzgWtuly3mRM6u2MxsTEfVLV4cvzO32PRHcYJtUFo92PwUV2cQEk/vR1c4O00nISv0 qx1oJXoscdJ3fTO+NZbw2tI1AoF/M4RSzsc3odfpLJFP+ktzPmc9v+4NISrLIy3RsjvD6a nhfpDshdvK9c7+3Lu7HaXF+hf1qNw4o= X-MC-Unique: U5afqTSUN7-4wzLfRfAkXA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538238; x=1717143038; 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=L2BbL6jR1b542eSscLXiZLPQxRUIoJp8BSdDrVwqVsM=; b=YQWTR6BlFob5HA4HKaX74V+A+ipTsmJzh/wicr2376zuejTquvtXyqjtNgmhB9ijmI P0TCANcYJlRFWJGfibo9A54bvKHm5Cir6Imcd7lmgKRiKelouTscQ25GSHczy1AClbUr 8DnbHpIvaFnvajzaPdrtEEWjXBCH9LYisQTyyKYGILRf+M4+4wNW+afZVZEV0xVc/BLl 113UEMxr1eu/tJaV4zS5DkP77DKswNwSNGup0XqArl2bfK0HVqITnD9KxWJLXP93NnUs 1qUqtEfnV79/ydhU1cN/AyO2D7L7N8WBzo3lxNvhmdH8FkFZ2TbOSKDH2B2NJ0H9+quU xu1A== X-Gm-Message-State: AOJu0YylsdWtJqmUqinsiKPeV+3WZm0hSfW3CYZbI7E5EnCUbDfCpScO 7nWInyPq9vpP+Tl9LkZREOXrwiYPpGZdnwZ/TxG8Psee88Q500H9Nu5rg3HZgU/kk2t/jKeTTcv HBC2CDdJaJL+8ZCHcqn8ttBNHDuzq1nmWXnmDkqE4XAMFIhrJF4LgU0GbR+EgFde/jyIE2i/Xn6 f59XBqca9Csco3rQZVnPEYs1G3gAKK3Y9XviK3 X-Received: by 2002:a17:906:181b:b0:a59:cdc9:6fe1 with SMTP id a640c23a62f3a-a62641d9a28mr93873766b.19.1716538237715; Fri, 24 May 2024 01:10:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMIDXQbHlxHTKiXWl5zfEyGrKKfbRMt5cHsjOTz+1mZUXyhw4lAhk83d9pnxHrKKmN3v/8zw== X-Received: by 2002:a17:906:181b:b0:a59:cdc9:6fe1 with SMTP id a640c23a62f3a-a62641d9a28mr93871466b.19.1716538236916; Fri, 24 May 2024 01:10:36 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 07/16] target/i386: raze the gen_eob* jungle Date: Fri, 24 May 2024 10:10:10 +0200 Message-ID: <20240524081019.1141359-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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: -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_H4=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: 1716538351095100005 Content-Type: text/plain; charset="utf-8" Make gen_eob take the DISAS_* constant as an argument, so that it is not necessary to have wrappers around it. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 60 +++++++++---------------------------- 1 file changed, 14 insertions(+), 46 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 2c7917d239f..c46385be060 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -260,8 +260,6 @@ STUB_HELPER(write_crN, TCGv_env env, TCGv_i32 reg, TCGv= val) STUB_HELPER(wrmsr, TCGv_env env) #endif =20 -static void gen_eob(DisasContext *s); -static void gen_jr(DisasContext *s); static void gen_jmp_rel(DisasContext *s, MemOp ot, int diff, int tb_num); static void gen_jmp_rel_csize(DisasContext *s, int diff, int tb_num); static void gen_exception_gpf(DisasContext *s); @@ -2259,12 +2257,13 @@ static void gen_bnd_jmp(DisasContext *s) } } =20 -/* Generate an end of block. Trace exception is also generated if needed. - If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. - If RECHECK_TF, emit a rechecking helper for #DB, ignoring the state of - S->TF. This is used by the syscall/sysret insns. */ +/* + * Generate an end of block, including common tasks such as generating + * single step traps, resetting the RF flag, and handling the interrupt + * shadow. + */ static void -gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, bool jr) +gen_eob(DisasContext *s, int mode) { bool inhibit_reset; =20 @@ -2275,52 +2274,29 @@ gen_eob_worker(DisasContext *s, bool inhibit, bool = recheck_tf, bool jr) if (s->flags & HF_INHIBIT_IRQ_MASK) { gen_reset_hflag(s, HF_INHIBIT_IRQ_MASK); inhibit_reset =3D true; - } else if (inhibit) { + } else if (mode =3D=3D DISAS_EOB_INHIBIT_IRQ) { gen_set_hflag(s, HF_INHIBIT_IRQ_MASK); } =20 if (s->base.tb->flags & HF_RF_MASK) { gen_reset_eflags(s, RF_MASK); } - if (recheck_tf) { + if (mode =3D=3D DISAS_EOB_RECHECK_TF) { gen_helper_rechecking_single_step(tcg_env); tcg_gen_exit_tb(NULL, 0); } else if (s->flags & HF_TF_MASK) { gen_helper_single_step(tcg_env); - } else if (jr && + } else if (mode =3D=3D DISAS_JUMP && /* give irqs a chance to happen */ !inhibit_reset) { tcg_gen_lookup_and_goto_ptr(); } else { tcg_gen_exit_tb(NULL, 0); } + s->base.is_jmp =3D DISAS_NORETURN; } =20 -static inline void -gen_eob_syscall(DisasContext *s) -{ - gen_eob_worker(s, false, true, false); -} - -/* End of block. Set HF_INHIBIT_IRQ_MASK if it isn't already set. */ -static void gen_eob_inhibit_irq(DisasContext *s) -{ - gen_eob_worker(s, true, false, false); -} - -/* End of block, resetting the inhibit irq flag. */ -static void gen_eob(DisasContext *s) -{ - gen_eob_worker(s, false, false, false); -} - -/* Jump to register */ -static void gen_jr(DisasContext *s) -{ - gen_eob_worker(s, false, false, true); -} - /* Jump to eip+diff, truncating the result to OT. */ static void gen_jmp_rel(DisasContext *s, MemOp ot, int diff, int tb_num) { @@ -2372,9 +2348,9 @@ static void gen_jmp_rel(DisasContext *s, MemOp ot, in= t diff, int tb_num) tcg_gen_movi_tl(cpu_eip, new_eip); } if (s->jmp_opt) { - gen_jr(s); /* jump to another page */ + gen_eob(s, DISAS_JUMP); /* jump to another page */ } else { - gen_eob(s); /* exit to main loop */ + gen_eob(s, DISAS_EOB_ONLY); /* exit to main loop */ } } } @@ -4787,22 +4763,14 @@ static void i386_tr_tb_stop(DisasContextBase *dcbas= e, CPUState *cpu) gen_jmp_rel_csize(dc, 0, 0); break; case DISAS_EOB_NEXT: + case DISAS_EOB_INHIBIT_IRQ: assert(dc->base.pc_next =3D=3D dc->pc); gen_update_eip_cur(dc); /* fall through */ case DISAS_EOB_ONLY: - gen_eob(dc); - break; case DISAS_EOB_RECHECK_TF: - gen_eob_syscall(dc); - break; - case DISAS_EOB_INHIBIT_IRQ: - assert(dc->base.pc_next =3D=3D dc->pc); - gen_update_eip_cur(dc); - gen_eob_inhibit_irq(dc); - break; case DISAS_JUMP: - gen_jr(dc); + gen_eob(dc, dc->base.is_jmp); break; default: g_assert_not_reached(); --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538401; cv=none; d=zohomail.com; s=zohoarc; b=emMI9pbhdPmMp1bBmXQhzlu98biQ1xcbdL2Yh0ZR1Ca5XHWK2rHD/prGY2hA7MZR+uvLF8EDxmM6rk1I+0lMq+R9QdoV1sSb0av6x5eykHl2Ct9lnvijmwVshuIsyJLOZC3heWr/9k9mBslQZUe9iCqJEVURQeWZpNEapzXlfy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538401; 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=LOf1GDc1mw7wQ8tgJj66VHZbtkhao7Ks6veQoOnKMHc=; b=l7Mk2YXGtXEPQGfaMECLM8NwXehDY7CFchLtxBikcxTDAqwxAuBurySo3dbUebuXVm0/n9XAJ1EANDo3H1HnVXy2Dky5jpnQge1rMjgkpqWQnToCo9ztQz6fs2i3aJweWN55drNSlpTZCnI9aMasMwdjLWTVT66Eg1C3Nuq4I0U= 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 171653840194742.0432389460816; Fri, 24 May 2024 01:13:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0l-0005IF-CX; Fri, 24 May 2024 04:10:47 -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 1sAQ0j-0005GY-AD for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:45 -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 1sAQ0h-0000aq-A6 for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:44 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-178-ymontsuLNPKhuNC0GXcx6Q-1; Fri, 24 May 2024 04:10:40 -0400 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a6266ffd419so25016966b.1 for ; Fri, 24 May 2024 01:10:40 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c93707csm91368966b.57.2024.05.24.01.10.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538242; 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=LOf1GDc1mw7wQ8tgJj66VHZbtkhao7Ks6veQoOnKMHc=; b=POy4OEjjwdL0n68owRvf+gfTiNBTqOpBzi6Ga16lbGK0S+x8VsIm9mg4iQXVnri5/g2qaV lZ3J8W1SFOHLtbxhmS464dk9rffg9FMrZtEihp4kqmcHcA2i6m5YiCPSwMGw5pcxNBnHq6 vufamORg77j8CFZk86mrZYWV4ZIJgic= X-MC-Unique: ymontsuLNPKhuNC0GXcx6Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538238; x=1717143038; 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=LOf1GDc1mw7wQ8tgJj66VHZbtkhao7Ks6veQoOnKMHc=; b=qERkBl0cVwH4ttkniwqVrZwW3TAYv5rKPN3A+AviMo1DBMXfojBv25wz270jiM+r8c 52xJXl539o8ERvO5nupLKrnwQ0iXoVu13j58Wn6X0IYPTJVeUvkl2ZxQu387Qvrxh/ec qkijXWrEKZ4ecJHYicu1EqUqbubt2D9IyNE6aqs++RcfOlhrZFtiQoBKLdWyPx9e5ZDm ecbX7nr36BP8xluurFqQSOTrNgq0oFD4vMVBLf0tcdnxSgBP8KrPpWK4g1MWDlm2fCCL 9DJz3mGrcKnEAZDp8fdOwhI1fczIW/sc+VHTPMm5SVSZKdmvkbU7HUtJ4NNawmwPEsFz QFhA== X-Gm-Message-State: AOJu0YyV6Bbw85jwy+cmeEYsE8MmeHwVd2SZhQsWMhk7O4zGe8d/CQ3c sf+ofHTvFGD2olDTM4vLrrvdp7KMbuElt5u0V8uKohyMdgpSCn//HHKbx9ngckDqHHxV9/Akeq+ LjgwLyfdLdgyRrH7M5E2fa/OwWypQGipDf50+PMTrUlRT3TgtYBVj9yfflEXixlHUuVfFMVMkpK Nh/zCLo7J9r5pMmWBdTVIt9AXTTA1ab4JmP5jn X-Received: by 2002:a17:906:788:b0:a59:adf8:a6e1 with SMTP id a640c23a62f3a-a62651144f1mr90978166b.47.1716538238520; Fri, 24 May 2024 01:10:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkLnYpCjlOoGTWiQNIpiIuXci86y7vSmMhwG5fLep1/NBQc1IUTST4kkrgoOwBsDmgq5TvdQ== X-Received: by 2002:a17:906:788:b0:a59:adf8:a6e1 with SMTP id a640c23a62f3a-a62651144f1mr90975766b.47.1716538237979; Fri, 24 May 2024 01:10:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 08/16] target/i386: reg in gen_ldst_modrm is always OR_TMP0 Date: Fri, 24 May 2024 10:10:11 +0200 Message-ID: <20240524081019.1141359-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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_H4=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: 1716538403306100007 Content-Type: text/plain; charset="utf-8" Values other than OR_TMP0 were only ever used by MOV and MOVNTI opcodes. Now that these have been converted to the new decoder, remove the argument. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index c46385be060..b75d61a9141 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -1821,10 +1821,9 @@ static void gen_add_A0_ds_seg(DisasContext *s) gen_lea_v_seg(s, s->aflag, s->A0, R_DS, s->override); } =20 -/* generate modrm memory load or store of 'reg'. TMP0 is used if reg =3D= =3D - OR_TMP0 */ +/* generate modrm memory load or store of 'reg'. */ static void gen_ldst_modrm(CPUX86State *env, DisasContext *s, int modrm, - MemOp ot, int reg, int is_store) + MemOp ot, int is_store) { int mod, rm; =20 @@ -1832,24 +1831,16 @@ static void gen_ldst_modrm(CPUX86State *env, DisasC= ontext *s, int modrm, rm =3D (modrm & 7) | REX_B(s); if (mod =3D=3D 3) { if (is_store) { - if (reg !=3D OR_TMP0) - gen_op_mov_v_reg(s, ot, s->T0, reg); gen_op_mov_reg_v(s, ot, rm, s->T0); } else { gen_op_mov_v_reg(s, ot, s->T0, rm); - if (reg !=3D OR_TMP0) - gen_op_mov_reg_v(s, ot, reg, s->T0); } } else { gen_lea_modrm(env, s, modrm); if (is_store) { - if (reg !=3D OR_TMP0) - gen_op_mov_v_reg(s, ot, s->T0, reg); gen_op_st_v(s, ot, s->T0, s->A0); } else { gen_op_ld_v(s, ot, s->T0, s->A0); - if (reg !=3D OR_TMP0) - gen_op_mov_reg_v(s, ot, reg, s->T0); } } } @@ -3440,7 +3431,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) ot =3D dflag; modrm =3D x86_ldub_code(env, s); reg =3D ((modrm >> 3) & 7) | REX_R(s); - gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); + gen_ldst_modrm(env, s, modrm, ot, 0); gen_extu(ot, s->T0); =20 /* Note that lzcnt and tzcnt are in different extensions. */ @@ -3587,14 +3578,14 @@ static void disas_insn_old(DisasContext *s, CPUStat= e *cpu, int b) tcg_gen_ld32u_tl(s->T0, tcg_env, offsetof(CPUX86State, ldt.selector)); ot =3D mod =3D=3D 3 ? dflag : MO_16; - gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1); + gen_ldst_modrm(env, s, modrm, ot, 1); break; case 2: /* lldt */ if (!PE(s) || VM86(s)) goto illegal_op; if (check_cpl0(s)) { gen_svm_check_intercept(s, SVM_EXIT_LDTR_WRITE); - gen_ldst_modrm(env, s, modrm, MO_16, OR_TMP0, 0); + gen_ldst_modrm(env, s, modrm, MO_16, 0); tcg_gen_trunc_tl_i32(s->tmp2_i32, s->T0); gen_helper_lldt(tcg_env, s->tmp2_i32); } @@ -3609,14 +3600,14 @@ static void disas_insn_old(DisasContext *s, CPUStat= e *cpu, int b) tcg_gen_ld32u_tl(s->T0, tcg_env, offsetof(CPUX86State, tr.selector)); ot =3D mod =3D=3D 3 ? dflag : MO_16; - gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1); + gen_ldst_modrm(env, s, modrm, ot, 1); break; case 3: /* ltr */ if (!PE(s) || VM86(s)) goto illegal_op; if (check_cpl0(s)) { gen_svm_check_intercept(s, SVM_EXIT_TR_WRITE); - gen_ldst_modrm(env, s, modrm, MO_16, OR_TMP0, 0); + gen_ldst_modrm(env, s, modrm, MO_16, 0); tcg_gen_trunc_tl_i32(s->tmp2_i32, s->T0); gen_helper_ltr(tcg_env, s->tmp2_i32); } @@ -3625,7 +3616,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) case 5: /* verw */ if (!PE(s) || VM86(s)) goto illegal_op; - gen_ldst_modrm(env, s, modrm, MO_16, OR_TMP0, 0); + gen_ldst_modrm(env, s, modrm, MO_16, 0); gen_update_cc_op(s); if (op =3D=3D 4) { gen_helper_verr(tcg_env, s->T0); @@ -3889,7 +3880,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) */ mod =3D (modrm >> 6) & 3; ot =3D (mod !=3D 3 ? MO_16 : s->dflag); - gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1); + gen_ldst_modrm(env, s, modrm, ot, 1); break; case 0xee: /* rdpkru */ if (s->prefix & (PREFIX_LOCK | PREFIX_DATA @@ -3916,7 +3907,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) break; } gen_svm_check_intercept(s, SVM_EXIT_WRITE_CR0); - gen_ldst_modrm(env, s, modrm, MO_16, OR_TMP0, 0); + gen_ldst_modrm(env, s, modrm, MO_16, 0); /* * Only the 4 lower bits of CR0 are modified. * PE cannot be set to zero if already set to one. @@ -3988,7 +3979,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) ot =3D dflag !=3D MO_16 ? MO_32 : MO_16; modrm =3D x86_ldub_code(env, s); reg =3D ((modrm >> 3) & 7) | REX_R(s); - gen_ldst_modrm(env, s, modrm, MO_16, OR_TMP0, 0); + gen_ldst_modrm(env, s, modrm, MO_16, 0); t0 =3D tcg_temp_new(); gen_update_cc_op(s); if (b =3D=3D 0x102) { @@ -4492,7 +4483,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) reg =3D ((modrm >> 3) & 7) | REX_R(s); =20 ot =3D dflag; - gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); + gen_ldst_modrm(env, s, modrm, ot, 0); gen_extu(ot, s->T0); tcg_gen_mov_tl(cpu_cc_src, s->T0); tcg_gen_ctpop_tl(s->T0, s->T0); --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538399; cv=none; d=zohomail.com; s=zohoarc; b=aiUnDRenB6GAXqxzbX5QvxRilah/9I5rxKzqszuGN5QHiEmQ8i2FK3KHN5wfd9iRrdR6sbjfZQdKrhvTekw9tucrTyEVR4POYeVUeLDNGwE2DOreTukeyB0CQgHRjL9IHaiRJ5/G1bXFWXfExSfvNGWcAz/klyjSNeq2ZrSIC1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538399; 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=OXmBE/duhd+71tzkCPvAsV1jTylKJ/o/izbc+RObas4=; b=mKLzPIkuQclKzIK6kNFQtXtCp+VvENonRnxSKCNyfq7RsOmgu7uwZr3Yiu9qBxOQQ1OBdaWW82WiwrMGH3o+C2kolKNHi1FOrLKaspzXoVZN1rUKRguLVY6vwqj027iN7CSPmzXEcRbsl74E3fa0M1WDwNDTOgIyY6hORmlsokw= 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 1716538399382367.8297403970088; Fri, 24 May 2024 01:13:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0n-0005LN-2h; Fri, 24 May 2024 04:10:49 -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 1sAQ0l-0005Ic-KN for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:47 -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 1sAQ0i-0000ay-Af for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:47 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-456-7a2OZAT4MFGbBaglqS2l3w-1; Fri, 24 May 2024 04:10:41 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a6269ad800aso27587466b.2 for ; Fri, 24 May 2024 01:10:41 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc523d1sm89632066b.134.2024.05.24.01.10.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538243; 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=OXmBE/duhd+71tzkCPvAsV1jTylKJ/o/izbc+RObas4=; b=dRdB1rL5k+GpSMWmta4/WhOx+3nlfEXRSCDX+xFf0A1Rftgf5Wf5+niPLAWay9mARu7d1Q UF1MLadWsNySznkcYAuJZvSOh+K47PVe8CTnYX6nzNsb+U4DDLTBFkYCFPbtHArKXXT9M4 xpyF/z2UOsiW50F3J0rWmaBxLkYFjCg= X-MC-Unique: 7a2OZAT4MFGbBaglqS2l3w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538239; x=1717143039; 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=OXmBE/duhd+71tzkCPvAsV1jTylKJ/o/izbc+RObas4=; b=SsNXi6aPElnkYowtguDacuQwFgUnzInQoiTzlnh7CUrohSmjoLGTox8yc2I02sRmoD In5/AgKHIIWn3YQUwkmFgBl69SF+8+i/SWRkQs2cCPUHObi94x2PSMg6/tgf2RV3IMIE RW0a0//Bp+nE2I0m30b7TRLUKuMnV2HHEfc4kJQSRSiHiPkE1YneJ/LONUEWAc90tGnj DC+zPatqjC7LYQs0sTti37V4BptqJVIk/y7ZDHbXTjTb5/gjGRoNFIWpgwJ9lG7CuhJ/ Rr5KI5PuI+jyvFDPQorOLfEfkr0G3xHvPrYgj070jn1S6aslgCutRM3zLEe2mS6ZWqlg AQQQ== X-Gm-Message-State: AOJu0YxnfSxq5sF3CPAETp9W4yzd+LmUGiL32jDJF2tV+I8KpJ7nzhwg pXcS7ctQQW+GEiYKu1MsHaVD7dZBZLu3qdUtPi7qqP2Jnk3iHWH3VvrganMGGSzvfw507Z2lZw/ qIay3YdgyKJhxdiKLWyU7EXfsE+HKj07ghUWCl9Onc9dfgdFhf2J9ZaKnVytf/Q7ts8K46I43nF 3ohx+tiEJB1oaX3PtIEWAP9ipilumaXa3+6tHB X-Received: by 2002:a17:906:f18a:b0:a59:edbc:193d with SMTP id a640c23a62f3a-a6265119d6amr161720266b.55.1716538239465; Fri, 24 May 2024 01:10:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElkwnnW03vwuPXGRw9U68ha9FnoNq7bz+KAMbfF8RUsZAmDV8KEB5PEb9XN1Fr7lWJLPjoDg== X-Received: by 2002:a17:906:f18a:b0:a59:edbc:193d with SMTP id a640c23a62f3a-a6265119d6amr161718666b.55.1716538239015; Fri, 24 May 2024 01:10:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 09/16] target/i386: split gen_ldst_modrm for load and store Date: Fri, 24 May 2024 10:10:12 +0200 Message-ID: <20240524081019.1141359-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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_H4=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: 1716538401306100003 Content-Type: text/plain; charset="utf-8" The is_store argument of gen_ldst_modrm has only ever been passed a constant. Just split the function in two. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 52 +++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index b75d61a9141..d32b5b63f5c 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -1821,27 +1821,33 @@ static void gen_add_A0_ds_seg(DisasContext *s) gen_lea_v_seg(s, s->aflag, s->A0, R_DS, s->override); } =20 -/* generate modrm memory load or store of 'reg'. */ -static void gen_ldst_modrm(CPUX86State *env, DisasContext *s, int modrm, - MemOp ot, int is_store) +/* generate modrm load of memory or register. */ +static void gen_ld_modrm(CPUX86State *env, DisasContext *s, int modrm, Mem= Op ot) { int mod, rm; =20 mod =3D (modrm >> 6) & 3; rm =3D (modrm & 7) | REX_B(s); if (mod =3D=3D 3) { - if (is_store) { - gen_op_mov_reg_v(s, ot, rm, s->T0); - } else { - gen_op_mov_v_reg(s, ot, s->T0, rm); - } + gen_op_mov_v_reg(s, ot, s->T0, rm); } else { gen_lea_modrm(env, s, modrm); - if (is_store) { - gen_op_st_v(s, ot, s->T0, s->A0); - } else { - gen_op_ld_v(s, ot, s->T0, s->A0); - } + gen_op_ld_v(s, ot, s->T0, s->A0); + } +} + +/* generate modrm store of memory or register. */ +static void gen_st_modrm(CPUX86State *env, DisasContext *s, int modrm, Mem= Op ot) +{ + int mod, rm; + + mod =3D (modrm >> 6) & 3; + rm =3D (modrm & 7) | REX_B(s); + if (mod =3D=3D 3) { + gen_op_mov_reg_v(s, ot, rm, s->T0); + } else { + gen_lea_modrm(env, s, modrm); + gen_op_st_v(s, ot, s->T0, s->A0); } } =20 @@ -3431,7 +3437,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) ot =3D dflag; modrm =3D x86_ldub_code(env, s); reg =3D ((modrm >> 3) & 7) | REX_R(s); - gen_ldst_modrm(env, s, modrm, ot, 0); + gen_ld_modrm(env, s, modrm, ot); gen_extu(ot, s->T0); =20 /* Note that lzcnt and tzcnt are in different extensions. */ @@ -3578,14 +3584,14 @@ static void disas_insn_old(DisasContext *s, CPUStat= e *cpu, int b) tcg_gen_ld32u_tl(s->T0, tcg_env, offsetof(CPUX86State, ldt.selector)); ot =3D mod =3D=3D 3 ? dflag : MO_16; - gen_ldst_modrm(env, s, modrm, ot, 1); + gen_st_modrm(env, s, modrm, ot); break; case 2: /* lldt */ if (!PE(s) || VM86(s)) goto illegal_op; if (check_cpl0(s)) { gen_svm_check_intercept(s, SVM_EXIT_LDTR_WRITE); - gen_ldst_modrm(env, s, modrm, MO_16, 0); + gen_ld_modrm(env, s, modrm, MO_16); tcg_gen_trunc_tl_i32(s->tmp2_i32, s->T0); gen_helper_lldt(tcg_env, s->tmp2_i32); } @@ -3600,14 +3606,14 @@ static void disas_insn_old(DisasContext *s, CPUStat= e *cpu, int b) tcg_gen_ld32u_tl(s->T0, tcg_env, offsetof(CPUX86State, tr.selector)); ot =3D mod =3D=3D 3 ? dflag : MO_16; - gen_ldst_modrm(env, s, modrm, ot, 1); + gen_st_modrm(env, s, modrm, ot); break; case 3: /* ltr */ if (!PE(s) || VM86(s)) goto illegal_op; if (check_cpl0(s)) { gen_svm_check_intercept(s, SVM_EXIT_TR_WRITE); - gen_ldst_modrm(env, s, modrm, MO_16, 0); + gen_ld_modrm(env, s, modrm, MO_16); tcg_gen_trunc_tl_i32(s->tmp2_i32, s->T0); gen_helper_ltr(tcg_env, s->tmp2_i32); } @@ -3616,7 +3622,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) case 5: /* verw */ if (!PE(s) || VM86(s)) goto illegal_op; - gen_ldst_modrm(env, s, modrm, MO_16, 0); + gen_ld_modrm(env, s, modrm, MO_16); gen_update_cc_op(s); if (op =3D=3D 4) { gen_helper_verr(tcg_env, s->T0); @@ -3880,7 +3886,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) */ mod =3D (modrm >> 6) & 3; ot =3D (mod !=3D 3 ? MO_16 : s->dflag); - gen_ldst_modrm(env, s, modrm, ot, 1); + gen_st_modrm(env, s, modrm, ot); break; case 0xee: /* rdpkru */ if (s->prefix & (PREFIX_LOCK | PREFIX_DATA @@ -3907,7 +3913,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) break; } gen_svm_check_intercept(s, SVM_EXIT_WRITE_CR0); - gen_ldst_modrm(env, s, modrm, MO_16, 0); + gen_ld_modrm(env, s, modrm, MO_16); /* * Only the 4 lower bits of CR0 are modified. * PE cannot be set to zero if already set to one. @@ -3979,7 +3985,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) ot =3D dflag !=3D MO_16 ? MO_32 : MO_16; modrm =3D x86_ldub_code(env, s); reg =3D ((modrm >> 3) & 7) | REX_R(s); - gen_ldst_modrm(env, s, modrm, MO_16, 0); + gen_ld_modrm(env, s, modrm, MO_16); t0 =3D tcg_temp_new(); gen_update_cc_op(s); if (b =3D=3D 0x102) { @@ -4483,7 +4489,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) reg =3D ((modrm >> 3) & 7) | REX_R(s); =20 ot =3D dflag; - gen_ldst_modrm(env, s, modrm, ot, 0); + gen_ld_modrm(env, s, modrm, ot); gen_extu(ot, s->T0); tcg_gen_mov_tl(cpu_cc_src, s->T0); tcg_gen_ctpop_tl(s->T0, s->T0); --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538283; cv=none; d=zohomail.com; s=zohoarc; b=UivGvEVSkhnfEvuOIG09qSANo67D8ka5o+KaePOZ1ma8aDTSm3M9Cv4DSu3dgsN0Surrc2+K09jI2UagXT/JDTrYfQYbHaz34ebmPmagMOsVPgd+puT3t5pCRsu34EhLS4SnnEB9fLgyxyrRSfTdS0mqm/q9TrkA53v95mI8ku0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538283; 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=ZQcrqiJjxHNOISOcZ6yKLEOGsror00Tl7WLp+qhe8Mc=; b=cRZ/NY7/RVIL2qnSkkzV9uJnNji31etAmjdxIBCnzG3h/aTOWub1Hy4LCv164XZO8T/Dhuf1Kh/TBsTvemietd2pndsjAUG2b8rKGtDteHM9s6la8ICeutT2sl4ytUO98g44eM9MjkO/OM2wZjlsB4DXTXdDBLOkEyRl42KX7cI= 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 17165382836411010.7190168246201; Fri, 24 May 2024 01:11:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0q-0005QO-Nl; Fri, 24 May 2024 04:10: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 1sAQ0p-0005NE-Bd for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:51 -0400 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 1sAQ0n-0000bY-Nv for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:51 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-617-wz-SpQ4gMnStJjE5PQZI8w-1; Fri, 24 May 2024 04:10:47 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a626603837cso21205566b.0 for ; Fri, 24 May 2024 01:10:47 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc4f465sm89556166b.120.2024.05.24.01.10.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538249; 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=ZQcrqiJjxHNOISOcZ6yKLEOGsror00Tl7WLp+qhe8Mc=; b=SxFCfQJdBmBG9i44Mx8uieKPIwxpCckPHRFJmeMCWiQ2GkLIouxinxP+GVa8BXMYHNKAFJ va4s4JCyEzSUKo8jSno3Nkwp9VfbeltL+E/mVyz/jDgz2LtB3yiD0sXhgy4tDaiO0NLmTs /x4Hd7rHCKy6s0Hx7Of7K2IEu3t03wA= X-MC-Unique: wz-SpQ4gMnStJjE5PQZI8w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538245; x=1717143045; 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=ZQcrqiJjxHNOISOcZ6yKLEOGsror00Tl7WLp+qhe8Mc=; b=FjeecHgubwciQQiYxJErIpcu07/4DkaWkuaC3qujI+NFU6IUXbFFVk09QUvFLmIAql KqDv9ieQdFPAaNXiI2X40Y3UNXWQfY14lVJutIclsmK7cyldA5QIPVSr6JsKYuXcM8t+ jP2p0p+cf+IzjdUHsevt/nYxlQ5Od12xTPWUHBST4KARLuxAPDEPfy9LepUd5ZiVP61j W0FixfHYKyCXE406FbwGvoOxv5CTviT/Di1SHV1kRWEgMdc0BmePzfv/2jVmzY3QfpCa y87fvGOJv8ojSkCz8puR3j5pnyeLFbXxUPgn/EOcvmpFJWyi1qPG1n6N64KkIl09rNqU J+mg== X-Gm-Message-State: AOJu0Yz+vmpPZj2V/WDMGExIC3cm0zcvNfdYF+KrVR/AVN8aQ+SshWK5 h6SM5mMS6n592qTz/cK/vrVLzw57JSAO/R8k6xHKxQpqJyFB9VUcHDsecjnmiLZfRGZe69cHCxf Aq5oI7Z/xk/973Hd9do7KmlRxULK0pgTyn+zFipAlaauTSwsT9VRFHuR4MXP6SiFsH/x4YpnLJn oAVu/R4+E9tat4cAab3Xo3olaVmZUrbP5nvt2r X-Received: by 2002:a17:906:3f87:b0:a59:b590:5d71 with SMTP id a640c23a62f3a-a626308f264mr105707966b.0.1716538245099; Fri, 24 May 2024 01:10:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHl6Mo9kEoWFJYUNEFWNkmK7Cxir1kVqoJzTXdZANBpcL4klgNht6BkzgNEzO5qaWoCZWansQ== X-Received: by 2002:a17:906:3f87:b0:a59:b590:5d71 with SMTP id a640c23a62f3a-a626308f264mr105706466b.0.1716538244724; Fri, 24 May 2024 01:10:44 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 10/16] target/i386: inline gen_add_A0_ds_seg Date: Fri, 24 May 2024 10:10:13 +0200 Message-ID: <20240524081019.1141359-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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: -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_H4=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: 1716538284753100003 Content-Type: text/plain; charset="utf-8" It is only used in MONITOR, where a direct call of gen_lea_v_seg is simpler, and in XLAT. Inline it in the latter. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 9 +-------- target/i386/tcg/emit.c.inc | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index d32b5b63f5c..8138da23b3d 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -1815,12 +1815,6 @@ static void gen_bndck(CPUX86State *env, DisasContext= *s, int modrm, gen_helper_bndck(tcg_env, s->tmp2_i32); } =20 -/* used for LEA and MOV AX, mem */ -static void gen_add_A0_ds_seg(DisasContext *s) -{ - gen_lea_v_seg(s, s->aflag, s->A0, R_DS, s->override); -} - /* generate modrm load of memory or register. */ static void gen_ld_modrm(CPUX86State *env, DisasContext *s, int modrm, Mem= Op ot) { @@ -3663,8 +3657,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) } gen_update_cc_op(s); gen_update_eip_cur(s); - tcg_gen_mov_tl(s->A0, cpu_regs[R_EAX]); - gen_add_A0_ds_seg(s); + gen_lea_v_seg(s, s->aflag, cpu_regs[R_EAX], R_DS, s->override); gen_helper_monitor(tcg_env, s->A0); break; =20 diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 8e311b6d213..f293db01b5c 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -4043,7 +4043,7 @@ static void gen_XLAT(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) { /* AL is already zero-extended into s->T0. */ tcg_gen_add_tl(s->A0, cpu_regs[R_EBX], s->T0); - gen_add_A0_ds_seg(s); + gen_lea_v_seg(s, s->aflag, s->A0, R_DS, s->override); gen_op_ld_v(s, MO_8, s->T0, s->A0); } =20 --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538293; cv=none; d=zohomail.com; s=zohoarc; b=IRpEpkQZWvmw6Puzn3egpSkKKQwAqIFYk3IZHzCfskPZskLI0H+3tbfeFwiNH+78o7BM0ibhtpQ7af5gOCiwUsYFVYQtABljYnxvHG0gy/qSyDYnUSuXax+NlB03tb+o+OPWpOf/2apLg+KRPwrZsq2GrWF49G28wbLwBNt8T8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538293; 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=FmC8Okn408+OIImdpDOg08XGTOAlF1tk7pin60JmUdw=; b=b2nOntDpfWGMGwhESUGYv2SeOvgfUzEZUMX8wKMyqOJV8fTpZ2shbOHLDaa6sifqydZqLhY0epMKUje595TFULKFCiZLQhGRPK+B3+EziR1ghzStoJuuxaDavZdBNkfwqdmtv89stfLx2QBVYymcMV0N9PBYmdYKySF98Jp8ZPU= 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 1716538293355619.6088032529581; Fri, 24 May 2024 01:11:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0t-0005RY-TY; Fri, 24 May 2024 04:10:55 -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 1sAQ0r-0005QQ-52 for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:53 -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 1sAQ0p-0000bi-Js for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:52 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-486-d9c6mPJjPIi1G5hPmPUDYA-1; Fri, 24 May 2024 04:10:48 -0400 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-578517c51ceso284253a12.2 for ; Fri, 24 May 2024 01:10:48 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57852339ea7sm1224446a12.1.2024.05.24.01.10.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538250; 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=FmC8Okn408+OIImdpDOg08XGTOAlF1tk7pin60JmUdw=; b=UKrnU1JcxuYK1NX3Jhv0DIn/p8cyksde786ZjrJGSbIMpIOGtdvqZiedJhmnDI822n1oTX zq6mAc1YbCncS7D0cFWUXzhc87nLmCYLMggilJaFKrJjbSZMgQtNPBuqZzxpeygkJI5SXR RWR3zWTKbL9ebKtyxMHPdEYJmk3iq3c= X-MC-Unique: d9c6mPJjPIi1G5hPmPUDYA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538246; x=1717143046; 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=FmC8Okn408+OIImdpDOg08XGTOAlF1tk7pin60JmUdw=; b=TW7mNhbjMIVUc+ZP7QI+ytI0HHpLiZmYXcRytkS9P94Ij26VrNvMNm/7/TPvHqBMr9 /V/G2d8U/45urJa96KTf4b46gq0LooYE4S95mIGz0QRaQSN3w2bZ+p63xuBn3fVRpMV9 TVDBvPJoXrUvLzqOcCc/wFpfIV6qodq7sG9MxApdzSMkRAgkQmJJS9f4//pjosXVqhzd TBS/7xH1sJmHYYKzVgkyIeB7xjxMEPy4nff58IS7/z7ZOZ6w/9SJs08gFLOLqtS/RaZL eMBTfh8SaAe6z6wXO13qNMQk8Pc4JgvB5hifPR8yM/Z5wkAIpDP+Ws0RYV/7p4K2ccAX o+tQ== X-Gm-Message-State: AOJu0YwdT8R+ihEX9LOI00ekvgFf4qH4A2JzYrvtUP0ln6ZMeBUnJL+1 AKWW+2ImTcDkZPQ8NFdi1LS2YL9PXHhmN4TkttD4pwsv765skrQ+ZTZKjnHml7cAzttoaxfVJqZ 8djngklYf0b1n4rJzO4699DgooY/1dAwut7E+tjgYWxNiCz3I5UehfWUy/ls+9c/HJmH5SMB76X I5PO02GmaBS+Z09MKa/+zbbYOgO/0W92Z9oaUW X-Received: by 2002:a50:d001:0:b0:572:d082:79fa with SMTP id 4fb4d7f45d1cf-578519870b5mr1009808a12.14.1716538246049; Fri, 24 May 2024 01:10:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCaRG9TQWKKY3llApjg3+z6Qmt266abydjDih4HHQddCYOdgdI/2bdPkm6pdb6tIFki4C8OQ== X-Received: by 2002:a50:d001:0:b0:572:d082:79fa with SMTP id 4fb4d7f45d1cf-578519870b5mr1009797a12.14.1716538245665; Fri, 24 May 2024 01:10:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 11/16] target/i386: use mo_stacksize more Date: Fri, 24 May 2024 10:10:14 +0200 Message-ID: <20240524081019.1141359-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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_H4=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: 1716538294898100007 Content-Type: text/plain; charset="utf-8" Use mo_stacksize for all stack accesses, including when a 64-bit code segment is impossible and the code is therefore checking only for SS32(s). Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 8138da23b3d..7b6bc486a63 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2068,12 +2068,12 @@ static inline void gen_pop_update(DisasContext *s, = MemOp ot) =20 static inline void gen_stack_A0(DisasContext *s) { - gen_lea_v_seg(s, SS32(s) ? MO_32 : MO_16, cpu_regs[R_ESP], R_SS, -1); + gen_lea_v_seg(s, mo_stacksize(s), cpu_regs[R_ESP], R_SS, -1); } =20 static void gen_pusha(DisasContext *s) { - MemOp s_ot =3D SS32(s) ? MO_32 : MO_16; + MemOp s_ot =3D mo_stacksize(s); MemOp d_ot =3D s->dflag; int size =3D 1 << d_ot; int i; @@ -2089,7 +2089,7 @@ static void gen_pusha(DisasContext *s) =20 static void gen_popa(DisasContext *s) { - MemOp s_ot =3D SS32(s) ? MO_32 : MO_16; + MemOp s_ot =3D mo_stacksize(s); MemOp d_ot =3D s->dflag; int size =3D 1 << d_ot; int i; @@ -2111,7 +2111,7 @@ static void gen_popa(DisasContext *s) static void gen_enter(DisasContext *s, int esp_addend, int level) { MemOp d_ot =3D mo_pushpop(s, s->dflag); - MemOp a_ot =3D CODE64(s) ? MO_64 : SS32(s) ? MO_32 : MO_16; + MemOp a_ot =3D mo_stacksize(s); int size =3D 1 << d_ot; =20 /* Push BP; compute FrameTemp into T1. */ --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538404; cv=none; d=zohomail.com; s=zohoarc; b=HRj7J2pXuTl6+4Ug2pKuC8pGsBpx3BCh03xt4ZzPAkHkgerD/9x0Y8v89L7ooyATE65Eyrv9Tzn/UbG7IFGjUMpmBwLtWpidNsGwHmb4ZtsFYtgxohBj2Zl0SEu/G4vd63Il+zssN8Np8VIiYGS7n3hz5MqZUiAF1DZJTCHgENo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538404; 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=v+JQIOco7Z7DojAja/MONveF1DDSe6+yvz+MIJpJggo=; b=DA85qerconmCj74LJWdP/zEC8sO76NX7gxwYn+8Iy4r84gUaVkVx1C8MX+Vq8RhSl2r/ZIu6KQLE0diWCjgZ/Ff2p7Hoj6kzSkOeX/P/l5jO/GaOOmZbfkTjV6XPjjeNtgP2CdprZVCmy9M/wQVnO2Qi84TntAoWHvkwLIZEL6c= 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 1716538404581844.1931910356078; Fri, 24 May 2024 01:13:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0v-0005XU-F5; Fri, 24 May 2024 04:10:57 -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 1sAQ0t-0005SM-I4 for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:55 -0400 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 1sAQ0r-0000dV-Sz for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:55 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-495-SGgKG310OFa5Z_3SFDbBsA-1; Fri, 24 May 2024 04:10:51 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a626ac4d29aso27520066b.3 for ; Fri, 24 May 2024 01:10:51 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c93b538sm91628766b.71.2024.05.24.01.10.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538253; 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=v+JQIOco7Z7DojAja/MONveF1DDSe6+yvz+MIJpJggo=; b=d6Mt7nkvElSuCc0ZBRg1p6yBigdi+7DmxtrtH98xUkK90lgQ+QyIreNAF8HA3+6dGdBhFH u1pod2hwgQqaaAjNwEBjxZ0ZnXNjaQrVrgbKhcGE19SL8V45M80uZSW8BClR3nnb7eM8k5 bcOSGFY68w38xYXH92WFKvhdzruWKxE= X-MC-Unique: SGgKG310OFa5Z_3SFDbBsA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538249; x=1717143049; 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=v+JQIOco7Z7DojAja/MONveF1DDSe6+yvz+MIJpJggo=; b=FQVkTq7maEKNfflLW0kK979eUaeI6Up6aJpDU/vDE7qnXigf6foS27EGUoFLHCcpMM rWlukTNg7grgUcCpBegIR4iefYuuG9lg1HNIP4p3YFPbe8rqKav4OSzO7+Yz3UoQ5SSu pExJLHtfMXseZz2jGWjXGUYO5IEqL5NwvJrxyfBDJvQ+JgZlAfvtekGpsbSdOmRiablF Go/N3XFJDsltNTcESpM1GFZwLIV+X11qkApY9qfzpo3+9MfRwMQiwGIP9hH+Wx6SwGsZ y77v+xYn2d8ZoWeui7kiHzqL0lmGFK8lShffbDgYSRzL3EMfertgj5WcMlrM29TSZG4I yisQ== X-Gm-Message-State: AOJu0YxOxtwMLybz7kewHj1wEQe9K6xhbz6r+MVGWXm2IVxy2yHe7Wvz j636qYq/3uQkZSm9fI16DRY6LYs2P5YdISc/AjPHUhrxrmG4JnkEVF03ii70/zdEHOFgWldoD2K ONmFM6zJ7AbHEu2zACG5kzE5YDUoJBY9clbzJes1xDK7iUOw8sKVxUI/b9/YeVX4kFdUMYmNIYe YQqcjUvlb2Vnp6EBC/kYO8cbKI4VH3N5RkPj+W X-Received: by 2002:a17:907:c920:b0:a59:9eab:1622 with SMTP id a640c23a62f3a-a6265148b95mr81871566b.56.1716538248912; Fri, 24 May 2024 01:10:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEfqPp+E3FmJ09/n96pWtgy++tCnSYydhkmraAZIQOClCPCghH01tigBff4TChBJe4cQdeTCQ== X-Received: by 2002:a17:907:c920:b0:a59:9eab:1622 with SMTP id a640c23a62f3a-a6265148b95mr81870766b.56.1716538248461; Fri, 24 May 2024 01:10:48 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 12/16] target/i386: introduce gen_lea_ss_ofs Date: Fri, 24 May 2024 10:10:15 +0200 Message-ID: <20240524081019.1141359-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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: -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_H4=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: 1716538405293100011 Content-Type: text/plain; charset="utf-8" Generalize gen_stack_A0() to include an initial add and to use an arbitrary destination. This is a common pattern and it is not a huge burden to add the extra arguments to the only caller of gen_stack_A0(). Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 51 +++++++++++++++---------------------- target/i386/tcg/emit.c.inc | 2 +- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 7b6bc486a63..8354209b037 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2028,24 +2028,27 @@ static inline void gen_stack_update(DisasContext *s= , int addend) gen_op_add_reg_im(s, mo_stacksize(s), R_ESP, addend); } =20 +static void gen_lea_ss_ofs(DisasContext *s, TCGv dest, TCGv src, target_ul= ong offset) +{ + if (offset) { + tcg_gen_addi_tl(dest, src, offset); + src =3D dest; + } + gen_lea_v_seg_dest(s, mo_stacksize(s), dest, src, R_SS, -1); +} + /* Generate a push. It depends on ss32, addseg and dflag. */ static void gen_push_v(DisasContext *s, TCGv val) { MemOp d_ot =3D mo_pushpop(s, s->dflag); MemOp a_ot =3D mo_stacksize(s); int size =3D 1 << d_ot; - TCGv new_esp =3D s->A0; + TCGv new_esp =3D tcg_temp_new(); =20 - tcg_gen_subi_tl(s->A0, cpu_regs[R_ESP], size); - - if (!CODE64(s)) { - if (ADDSEG(s)) { - new_esp =3D tcg_temp_new(); - tcg_gen_mov_tl(new_esp, s->A0); - } - gen_lea_v_seg(s, a_ot, s->A0, R_SS, -1); - } + tcg_gen_subi_tl(new_esp, cpu_regs[R_ESP], size); =20 + /* Now reduce the value to the address size and apply SS base. */ + gen_lea_ss_ofs(s, s->A0, new_esp, 0); gen_op_st_v(s, d_ot, val, s->A0); gen_op_mov_reg_v(s, a_ot, R_ESP, new_esp); } @@ -2055,7 +2058,7 @@ static MemOp gen_pop_T0(DisasContext *s) { MemOp d_ot =3D mo_pushpop(s, s->dflag); =20 - gen_lea_v_seg_dest(s, mo_stacksize(s), s->T0, cpu_regs[R_ESP], R_SS, -= 1); + gen_lea_ss_ofs(s, s->T0, cpu_regs[R_ESP], 0); gen_op_ld_v(s, d_ot, s->T0, s->T0); =20 return d_ot; @@ -2066,21 +2069,14 @@ static inline void gen_pop_update(DisasContext *s, = MemOp ot) gen_stack_update(s, 1 << ot); } =20 -static inline void gen_stack_A0(DisasContext *s) -{ - gen_lea_v_seg(s, mo_stacksize(s), cpu_regs[R_ESP], R_SS, -1); -} - static void gen_pusha(DisasContext *s) { - MemOp s_ot =3D mo_stacksize(s); MemOp d_ot =3D s->dflag; int size =3D 1 << d_ot; int i; =20 for (i =3D 0; i < 8; i++) { - tcg_gen_addi_tl(s->A0, cpu_regs[R_ESP], (i - 8) * size); - gen_lea_v_seg(s, s_ot, s->A0, R_SS, -1); + gen_lea_ss_ofs(s, s->A0, cpu_regs[R_ESP], (i - 8) * size); gen_op_st_v(s, d_ot, cpu_regs[7 - i], s->A0); } =20 @@ -2089,7 +2085,6 @@ static void gen_pusha(DisasContext *s) =20 static void gen_popa(DisasContext *s) { - MemOp s_ot =3D mo_stacksize(s); MemOp d_ot =3D s->dflag; int size =3D 1 << d_ot; int i; @@ -2099,8 +2094,7 @@ static void gen_popa(DisasContext *s) if (7 - i =3D=3D R_ESP) { continue; } - tcg_gen_addi_tl(s->A0, cpu_regs[R_ESP], i * size); - gen_lea_v_seg(s, s_ot, s->A0, R_SS, -1); + gen_lea_ss_ofs(s, s->A0, cpu_regs[R_ESP], i * size); gen_op_ld_v(s, d_ot, s->T0, s->A0); gen_op_mov_reg_v(s, d_ot, 7 - i, s->T0); } @@ -2116,7 +2110,7 @@ static void gen_enter(DisasContext *s, int esp_addend= , int level) =20 /* Push BP; compute FrameTemp into T1. */ tcg_gen_subi_tl(s->T1, cpu_regs[R_ESP], size); - gen_lea_v_seg(s, a_ot, s->T1, R_SS, -1); + gen_lea_ss_ofs(s, s->A0, s->T1, 0); gen_op_st_v(s, d_ot, cpu_regs[R_EBP], s->A0); =20 level &=3D 31; @@ -2125,18 +2119,15 @@ static void gen_enter(DisasContext *s, int esp_adde= nd, int level) =20 /* Copy level-1 pointers from the previous frame. */ for (i =3D 1; i < level; ++i) { - tcg_gen_subi_tl(s->A0, cpu_regs[R_EBP], size * i); - gen_lea_v_seg(s, a_ot, s->A0, R_SS, -1); + gen_lea_ss_ofs(s, s->A0, cpu_regs[R_EBP], -size * i); gen_op_ld_v(s, d_ot, s->tmp0, s->A0); =20 - tcg_gen_subi_tl(s->A0, s->T1, size * i); - gen_lea_v_seg(s, a_ot, s->A0, R_SS, -1); + gen_lea_ss_ofs(s, s->A0, s->T1, -size * i); gen_op_st_v(s, d_ot, s->tmp0, s->A0); } =20 /* Push the current FrameTemp as the last level. */ - tcg_gen_subi_tl(s->A0, s->T1, size * level); - gen_lea_v_seg(s, a_ot, s->A0, R_SS, -1); + gen_lea_ss_ofs(s, s->A0, s->T1, -size * level); gen_op_st_v(s, d_ot, s->T1, s->A0); } =20 @@ -2153,7 +2144,7 @@ static void gen_leave(DisasContext *s) MemOp d_ot =3D mo_pushpop(s, s->dflag); MemOp a_ot =3D mo_stacksize(s); =20 - gen_lea_v_seg(s, a_ot, cpu_regs[R_EBP], R_SS, -1); + gen_lea_ss_ofs(s, s->A0, cpu_regs[R_EBP], 0); gen_op_ld_v(s, d_ot, s->T0, s->A0); =20 tcg_gen_addi_tl(s->T1, cpu_regs[R_EBP], 1 << d_ot); diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index f293db01b5c..83fa745fd8a 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -3077,7 +3077,7 @@ static void gen_RETF(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) int16_t adjust =3D decode->e.op2 =3D=3D X86_TYPE_I ? decode->immediate= : 0; =20 if (!PE(s) || VM86(s)) { - gen_stack_A0(s); + gen_lea_ss_ofs(s, s->A0, cpu_regs[R_ESP], 0); /* pop offset */ gen_op_ld_v(s, s->dflag, s->T0, s->A0); /* NOTE: keeping EIP updated is not a problem in case of --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538436; cv=none; d=zohomail.com; s=zohoarc; b=Jogn4CBOkpf3Un+3kTJayWX8sWXDIZQdW2OznqJT5hUm6HoPOXvXU5zcADK3SJjhO8CLtXTSzEBPYGBYiFpiOM9kOR+jVQEtQEhbp8WMRf1V6wcfG0ckOH1EHJLWCtqGQdJUORlkWJnbeV4xpNJKRSiwh3fBO4d8Yg8GEFREYkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538436; 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=CNB7yIXWrmDB/iISbVm985kavI7s1g592wuWZJrSyvA=; b=Csr9RhDisSZEMRFxSNvj5o9tDCcCZwFzYORXNSIoZ8mh4nZXKQFMG8Ms9kgjcgi/RAQvxGcHTQJIRuDE8sYJQBCqUTswZWXc+0ksao0Ynmbaohnr6MtfPqJFfZr10adES3QhG9lU0hcykOQIG06fX1Uy/flr/f+YsM28gi8/494= 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 1716538436668852.3077297856578; Fri, 24 May 2024 01:13:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0u-0005Tc-Ok; Fri, 24 May 2024 04:10:56 -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 1sAQ0t-0005Sa-S1 for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:55 -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 1sAQ0s-0000db-7F for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:55 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-70-UOdBZUoRM22mVpN8fnNj4w-1; Fri, 24 May 2024 04:10:51 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a6269ad800aso27595166b.2 for ; Fri, 24 May 2024 01:10:51 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a627623c38bsm60924066b.23.2024.05.24.01.10.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538253; 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=CNB7yIXWrmDB/iISbVm985kavI7s1g592wuWZJrSyvA=; b=KIyHtUgYqpqgJpjssLP3PwDbVpvBSvqvCFClk9CYNdTaGC3pp/4HepWNCddmJv/vtXo5ZO NUr6ryKhaujQgigPjo7FYMi7JNAyAXkFawhVBNArm7drSlWPlzU9iiJYSdM6zK3UyGR3TR 308afpgl4J11txSNgRkwWsRUGm9lu8Y= X-MC-Unique: UOdBZUoRM22mVpN8fnNj4w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538250; x=1717143050; 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=CNB7yIXWrmDB/iISbVm985kavI7s1g592wuWZJrSyvA=; b=TMY6228aQtXLp7lb0gOVZq1vblUwrvwcBjvM+MAQ2vyW7hOOFkGH3KCjvdmkVtEQvI i6ws84BA728i9ZCqgMK584/sOoy2flbRCnWdlEoenZ8GX+CR7KzBDmdxOMmNkjxHVi9Y GTXbHCDKjabPiGAw0KzAsz/NXGm2udE8LZCEIM3IiGL/ayCiSGNLOyHONuoXyRwQd5NK Xhn85iLej2u8YZVVjJ6/sAPP+kCkBRxD4N+si1CZ2Z4hKt6IiY11Q6zMXWqEe5AwxzfZ WEKDSzPpkTNdUnQ0Uku21Zi22oyaxedVqfdUoeyQVJm/8cgLVwZ/4MQtqt8Hh+6QcXdZ gPTA== X-Gm-Message-State: AOJu0YzB54pxz7qyK8B9x/4B6usjYFivxykMJNV/GtyiqG2zE9bZ5WSu blNlRiqcd0nMsFBJHZsW+Yd7kkgJyigWMqpfjpWqybbWebLw9uNsdll03W22O9QvAZC/BtkbDXp F2JJmlvsr1Vr3ZIZAAHP53hRcRw9xOCXYmXlEG33o40maFXxT7NExm0aMBC97lta14Pdzb3guhm sgjTQPJU4jEQg3l0/yCFIbfIwIjkSPKOdT4FP7 X-Received: by 2002:a17:906:1287:b0:a59:c577:c5c3 with SMTP id a640c23a62f3a-a62642e8fe1mr148924366b.29.1716538250008; Fri, 24 May 2024 01:10:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdmh7MnYoVpwU0QmVSmUfTcwCNf1NZkkhwkdKAMDWXwzenfR+9isccp9puJH80N8gYHca4EA== X-Received: by 2002:a17:906:1287:b0:a59:c577:c5c3 with SMTP id a640c23a62f3a-a62642e8fe1mr148921166b.29.1716538249445; Fri, 24 May 2024 01:10:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 13/16] target/i386: clean up repeated string operations Date: Fri, 24 May 2024 10:10:16 +0200 Message-ID: <20240524081019.1141359-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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_H4=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: 1716538437447100007 Content-Type: text/plain; charset="utf-8" Do not bother generating inline wrappers for gen_repz and gen_repz2; use s->prefix to separate REPZ from REPNZ in the case of SCAS and CMPS. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 22 ++++------------------ target/i386/tcg/emit.c.inc | 22 +++++++++------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 8354209b037..18d8c0de674 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -1320,14 +1320,12 @@ static void gen_repz(DisasContext *s, MemOp ot, gen_jmp_rel_csize(s, -cur_insn_len(s), 0); } =20 -#define GEN_REPZ(op) \ - static inline void gen_repz_ ## op(DisasContext *s, MemOp ot) \ - { gen_repz(s, ot, gen_##op); } - -static void gen_repz2(DisasContext *s, MemOp ot, int nz, - void (*fn)(DisasContext *s, MemOp ot)) +static void gen_repz_nz(DisasContext *s, MemOp ot, + void (*fn)(DisasContext *s, MemOp ot)) { TCGLabel *l2; + int nz =3D (s->prefix & PREFIX_REPNZ) ? 1 : 0; + l2 =3D gen_jz_ecx_string(s); fn(s, ot); gen_op_add_reg_im(s, s->aflag, R_ECX, -1); @@ -1343,18 +1341,6 @@ static void gen_repz2(DisasContext *s, MemOp ot, int= nz, gen_jmp_rel_csize(s, -cur_insn_len(s), 0); } =20 -#define GEN_REPZ2(op) \ - static inline void gen_repz_ ## op(DisasContext *s, MemOp ot, int nz) \ - { gen_repz2(s, ot, nz, gen_##op); } - -GEN_REPZ(movs) -GEN_REPZ(stos) -GEN_REPZ(lods) -GEN_REPZ(ins) -GEN_REPZ(outs) -GEN_REPZ2(scas) -GEN_REPZ2(cmps) - static void gen_helper_fp_arith_ST0_FT0(int op) { switch (op) { diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 83fa745fd8a..bc96735f61d 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -1508,10 +1508,8 @@ static void gen_CMPccXADD(DisasContext *s, CPUX86Sta= te *env, X86DecodedInsn *dec static void gen_CMPS(DisasContext *s, CPUX86State *env, X86DecodedInsn *de= code) { MemOp ot =3D decode->op[2].ot; - if (s->prefix & PREFIX_REPNZ) { - gen_repz_cmps(s, ot, 1); - } else if (s->prefix & PREFIX_REPZ) { - gen_repz_cmps(s, ot, 0); + if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) { + gen_repz_nz(s, ot, gen_cmps); } else { gen_cmps(s, ot); } @@ -1834,7 +1832,7 @@ static void gen_INS(DisasContext *s, CPUX86State *env= , X86DecodedInsn *decode) =20 translator_io_start(&s->base); if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) { - gen_repz_ins(s, ot); + gen_repz(s, ot, gen_ins); } else { gen_ins(s, ot); } @@ -1993,7 +1991,7 @@ static void gen_LODS(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) { MemOp ot =3D decode->op[2].ot; if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) { - gen_repz_lods(s, ot); + gen_repz(s, ot, gen_lods); } else { gen_lods(s, ot); } @@ -2155,7 +2153,7 @@ static void gen_MOVS(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) { MemOp ot =3D decode->op[2].ot; if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) { - gen_repz_movs(s, ot); + gen_repz(s, ot, gen_movs); } else { gen_movs(s, ot); } @@ -2321,7 +2319,7 @@ static void gen_OUTS(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) =20 translator_io_start(&s->base); if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) { - gen_repz_outs(s, ot); + gen_repz(s, ot, gen_outs); } else { gen_outs(s, ot); } @@ -3329,10 +3327,8 @@ static void gen_SBB(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) static void gen_SCAS(DisasContext *s, CPUX86State *env, X86DecodedInsn *de= code) { MemOp ot =3D decode->op[2].ot; - if (s->prefix & PREFIX_REPNZ) { - gen_repz_scas(s, ot, 1); - } else if (s->prefix & PREFIX_REPZ) { - gen_repz_scas(s, ot, 0); + if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) { + gen_repz_nz(s, ot, gen_scas); } else { gen_scas(s, ot); } @@ -3495,7 +3491,7 @@ static void gen_STOS(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) { MemOp ot =3D decode->op[1].ot; if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) { - gen_repz_stos(s, ot); + gen_repz(s, ot, gen_stos); } else { gen_stos(s, ot); } --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538324; cv=none; d=zohomail.com; s=zohoarc; b=FYhXy736SZHGpajZ8b96BHxi428Yc7tqw/uRiBBM+oQ98c9by8cWCaqkHi89Iud9omy1Yi9A2o+oGy6Byaw6gTarnFHSeeaaNQAqtQyzM0T+xyx9bbL4gst90Qp3zJCgNjTmOgQMRUV6f/yzuWPpzqdL0Nbc+OimDOyZgQaEHDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538324; 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=PFmVAnU2PZErTRTu3pvGi8VA91HPuCkI7gZtNWLo2q4=; b=gYCphgQywp5PEi5ptHD62EjkRnq71e19AGbDQFCcpm1E2+tJHCeJjEDtvoTr97FvUOET+xsZpDLpDRTy3N9/N6DdnGg6qj5ukHJqEY2WGJcGCYrxhUVpxozGowMhDZvPYziqRiIn7jurO0ZZ7Q7VL1/m1SYMA1U+C50dHUhBNRA= 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 171653832471214.795325466739541; Fri, 24 May 2024 01:12:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ0z-0005kK-5i; Fri, 24 May 2024 04:11:01 -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 1sAQ0w-0005aC-63 for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:58 -0400 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 1sAQ0u-0000dz-As for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:57 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-113-4e7iuc5QMBCfBSqkylKO3w-1; Fri, 24 May 2024 04:10:54 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a6269ad7288so23409666b.2 for ; Fri, 24 May 2024 01:10:53 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c93b6d4sm90738866b.88.2024.05.24.01.10.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538255; 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=PFmVAnU2PZErTRTu3pvGi8VA91HPuCkI7gZtNWLo2q4=; b=KNpbIllG5O3Sgb8eO8IYxi06GXDO0C71sJ/N20UpPiFGbg5RevQyhlnw1NAivLIJIxjM3U 6W3BTcH8C2b4XxbkpfRBUDBFbgGFJC24awMOWBV1bzxUTjwMJO81x85qXJm9R7zqs7xwpX TeMseAKbT8Q7erjRkAW/2+awi51I35M= X-MC-Unique: 4e7iuc5QMBCfBSqkylKO3w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538252; x=1717143052; 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=PFmVAnU2PZErTRTu3pvGi8VA91HPuCkI7gZtNWLo2q4=; b=PmpNcwT3c76c1XHF89vye7JdsjZInBkjDtWsn6jks8wqlHX91mv62Z/Zuy1ofi/YUO yUM5QCSZYsZylJErQut1fk9M5dEOU80if8loY6as3f3v1qUCrsfH0BtB9/0qT9XUIIXZ ohclG5ugttbsquKwmID/N3HJrA3ONukD+FvzyhioyPMaKDRuNU4Nz/Akq/A7ECzA9lVp 2f/Zzt8woujbGdlbUGjJwUgKnw+veDnDdXnw6/YnxiokWQWbOxZ41IWw5ZkZVjfBxeRv NWJdjjFsvinN4smI5EjZeIsJkjBqqWFKp41xz0GsBgrNcz9b49FLhfL+19lbWolZeMXh pTug== X-Gm-Message-State: AOJu0Yza3HO0Yix5puj/zryIcTvVPILbM1H/fQvFxVzyhyirPrz7P5xg FNHbKT2VZqK2WWx4S7E/tSHsD2B1guogjsqpwS5rVHh437xsmEta2/+eBj7iaC0/7oMbwoz5Hjg 9+jEtfeaTvSYs+zjxqOJp2UwEvBS8DW2fvHFaMgrD0D2n8Vq3BO/EM61/r3Z8FuG8mkbNaUGW/9 G5+CpXI/0s7gS+PgZxgKjEqM55sK7GlTzOxXhY X-Received: by 2002:a17:906:d147:b0:a59:9f4e:4e3b with SMTP id a640c23a62f3a-a62641a3aafmr93174466b.2.1716538252234; Fri, 24 May 2024 01:10:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYe+hCAukNlsjh9haF38siBXMXm3UkSykoGAKgeOq0WfQELLVWimVKXOA16xUnarOquV6dtg== X-Received: by 2002:a17:906:d147:b0:a59:9f4e:4e3b with SMTP id a640c23a62f3a-a62641a3aafmr93173266b.2.1716538251765; Fri, 24 May 2024 01:10:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 14/16] target/i386: remove aflag argument of gen_lea_v_seg Date: Fri, 24 May 2024 10:10:17 +0200 Message-ID: <20240524081019.1141359-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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: -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_H4=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: 1716538324942100001 Content-Type: text/plain; charset="utf-8" It is always s->aflag. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 20 ++++++++++---------- target/i386/tcg/emit.c.inc | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 18d8c0de674..1a776e77297 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -673,20 +673,20 @@ static void gen_lea_v_seg_dest(DisasContext *s, MemOp= aflag, TCGv dest, TCGv a0, } } =20 -static void gen_lea_v_seg(DisasContext *s, MemOp aflag, TCGv a0, +static void gen_lea_v_seg(DisasContext *s, TCGv a0, int def_seg, int ovr_seg) { - gen_lea_v_seg_dest(s, aflag, s->A0, a0, def_seg, ovr_seg); + gen_lea_v_seg_dest(s, s->aflag, s->A0, a0, def_seg, ovr_seg); } =20 static inline void gen_string_movl_A0_ESI(DisasContext *s) { - gen_lea_v_seg(s, s->aflag, cpu_regs[R_ESI], R_DS, s->override); + gen_lea_v_seg(s, cpu_regs[R_ESI], R_DS, s->override); } =20 static inline void gen_string_movl_A0_EDI(DisasContext *s) { - gen_lea_v_seg(s, s->aflag, cpu_regs[R_EDI], R_ES, -1); + gen_lea_v_seg(s, cpu_regs[R_EDI], R_ES, -1); } =20 static inline TCGv gen_compute_Dshift(DisasContext *s, MemOp ot) @@ -1777,7 +1777,7 @@ static void gen_lea_modrm(CPUX86State *env, DisasCont= ext *s, int modrm) { AddressParts a =3D gen_lea_modrm_0(env, s, modrm); TCGv ea =3D gen_lea_modrm_1(s, a, false); - gen_lea_v_seg(s, s->aflag, ea, a.def_seg, s->override); + gen_lea_v_seg(s, ea, a.def_seg, s->override); } =20 static void gen_nop_modrm(CPUX86State *env, DisasContext *s, int modrm) @@ -2516,7 +2516,7 @@ static bool disas_insn_x87(DisasContext *s, CPUState = *cpu, int b) bool update_fdp =3D true; =20 tcg_gen_mov_tl(last_addr, ea); - gen_lea_v_seg(s, s->aflag, ea, a.def_seg, s->override); + gen_lea_v_seg(s, ea, a.def_seg, s->override); =20 switch (op) { case 0x00 ... 0x07: /* fxxxs */ @@ -3313,7 +3313,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) tcg_gen_sari_tl(s->tmp0, s->T1, 3 + ot); tcg_gen_shli_tl(s->tmp0, s->tmp0, ot); tcg_gen_add_tl(s->A0, gen_lea_modrm_1(s, a, false), s->tmp0); - gen_lea_v_seg(s, s->aflag, s->A0, a.def_seg, s->override); + gen_lea_v_seg(s, s->A0, a.def_seg, s->override); if (!(s->prefix & PREFIX_LOCK)) { gen_op_ld_v(s, ot, s->T0, s->A0); } @@ -3634,7 +3634,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) } gen_update_cc_op(s); gen_update_eip_cur(s); - gen_lea_v_seg(s, s->aflag, cpu_regs[R_EAX], R_DS, s->override); + gen_lea_v_seg(s, cpu_regs[R_EAX], R_DS, s->override); gen_helper_monitor(tcg_env, s->A0); break; =20 @@ -4040,7 +4040,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) } else { tcg_gen_movi_tl(s->A0, 0); } - gen_lea_v_seg(s, s->aflag, s->A0, a.def_seg, s->override); + gen_lea_v_seg(s, s->A0, a.def_seg, s->override); if (a.index >=3D 0) { tcg_gen_mov_tl(s->T0, cpu_regs[a.index]); } else { @@ -4145,7 +4145,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) } else { tcg_gen_movi_tl(s->A0, 0); } - gen_lea_v_seg(s, s->aflag, s->A0, a.def_seg, s->override); + gen_lea_v_seg(s, s->A0, a.def_seg, s->override); if (a.index >=3D 0) { tcg_gen_mov_tl(s->T0, cpu_regs[a.index]); } else { diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index bc96735f61d..9eecf7ab56c 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -76,7 +76,7 @@ static void gen_NM_exception(DisasContext *s) static void gen_load_ea(DisasContext *s, AddressParts *mem, bool is_vsib) { TCGv ea =3D gen_lea_modrm_1(s, *mem, is_vsib); - gen_lea_v_seg(s, s->aflag, ea, mem->def_seg, s->override); + gen_lea_v_seg(s, ea, mem->def_seg, s->override); } =20 static inline int mmx_offset(MemOp ot) @@ -2044,7 +2044,7 @@ static void gen_MOV(DisasContext *s, CPUX86State *env= , X86DecodedInsn *decode) =20 static void gen_MASKMOV(DisasContext *s, CPUX86State *env, X86DecodedInsn = *decode) { - gen_lea_v_seg(s, s->aflag, cpu_regs[R_EDI], R_DS, s->override); + gen_lea_v_seg(s, cpu_regs[R_EDI], R_DS, s->override); =20 if (s->prefix & PREFIX_DATA) { gen_helper_maskmov_xmm(tcg_env, OP_PTR1, OP_PTR2, s->A0); @@ -4039,7 +4039,7 @@ static void gen_XLAT(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) { /* AL is already zero-extended into s->T0. */ tcg_gen_add_tl(s->A0, cpu_regs[R_EBX], s->T0); - gen_lea_v_seg(s, s->aflag, s->A0, R_DS, s->override); + gen_lea_v_seg(s, s->A0, R_DS, s->override); gen_op_ld_v(s, MO_8, s->T0, s->A0); } =20 --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538285; cv=none; d=zohomail.com; s=zohoarc; b=IZkpuhGTqof0SXgdMKM9jM8iX2FB8qQGb9dEmtkKZQyu+wK5uv3ce69zlzvBsVzysW9P5trwVptJt/FC8mwlXMbUseIYFDNFHmBKSSV71Ptry2E2SyGQj5ZEP1dQYhC5GMF56Comhp1FO5tLKX3pXRKkn0VlHaX5B3oUjlpGmKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538285; 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=7MYcC6Q1D9ri/NOlxqffS6MJV/c4iIBiGqbzxlhkUs8=; b=S3HcJNI3xRAHmDY9GdSa6Lz2Y8ov1G2VwGQflsBmcOMG/s3rGNbG6kGAXbRfj2z2dJGFOL+Nn2FZ8V02ypdj21jnrJjMXUXDz7qopA0hndv05OLITUh2RWNYVHx/5sKo4tfI8AxANZTMhjuNzr32vrp4d+kp6WFWrq1bMvaB+gw= 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 1716538285660252.14900501115278; Fri, 24 May 2024 01:11:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ11-0005og-KI; Fri, 24 May 2024 04:11:03 -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 1sAQ0y-0005hP-6u for qemu-devel@nongnu.org; Fri, 24 May 2024 04:11:00 -0400 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 1sAQ0w-0000eB-EW for qemu-devel@nongnu.org; Fri, 24 May 2024 04:10:59 -0400 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-153-ySVwXInENpKltwv6MMbu_w-1; Fri, 24 May 2024 04:10:55 -0400 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a6266c77502so28181966b.1 for ; Fri, 24 May 2024 01:10:55 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626fc72ee3sm82827166b.195.2024.05.24.01.10.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538256; 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=7MYcC6Q1D9ri/NOlxqffS6MJV/c4iIBiGqbzxlhkUs8=; b=Ay+OThu2rndQKOlKS25Hm22kq1s147kGHE0bN8lWA04XIVcdGrvPdIKPCENBcyjvwoYPA2 3PqYK42ahzRuBr+w95NlpX5WP/xec0woxnM9cpWl/lUha/ulPExVsPjeHjec+2/jp2rGkm ene2HtqLC9gzXf282V9txkfphO7mpMI= X-MC-Unique: ySVwXInENpKltwv6MMbu_w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538253; x=1717143053; 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=7MYcC6Q1D9ri/NOlxqffS6MJV/c4iIBiGqbzxlhkUs8=; b=X3sALli63rL2Won2bhj1gOIzsleVKmLJ0W4l+W2zPzuC58fA0GL5IfsLvTh+eZE4R9 d+a8eLYpZXSbPwzUQsWCFe9nqoyuu7Gh1tapf6y6d1R3QE3LbH3inbwWrfXiaksxrDuX lqd4Y2Gg12kkxGIrpfb2ONgVrBBogg8pnvZ7pvllTLe+MiJySCY0eZsryyH+VH9PA1dh WGn3bFUrvEGWZdoqpwAVfzgMZXBQfXaJcK8aRhCjETjoHYkFvvBKm32ZB8wOavpGaXPD K1tSZNGknBPF7OY6zcOx+qUX+bCwRoX94h0tTvfrHn4nif7yqDL+utfzQ6KkSoq/MP2c wGPg== X-Gm-Message-State: AOJu0Yx/xjdJmXQZYKYDVgp0wcDU3WtaqC0AQh4GRQgoeZDWlMdkegTJ VgCLXbGoVWJqgkns4+YS+XymQ2yRbFffjvo41NgVS/ssv6Seu+ThDuDXwemyc8T8/ARVZlURC+h gErUjYanLiw4BHGvPzMMS/gi9QukDtM3G29/NBBWIq3SMb74RoFO4RMY5KCtL4UUP2VORDWt9Qb coXcae7qmspbDzDuNr1fXa7m4SGhO9SseCQz4X X-Received: by 2002:a17:906:470f:b0:a5c:e240:ceb7 with SMTP id a640c23a62f3a-a6264f0e8c9mr98379966b.62.1716538253143; Fri, 24 May 2024 01:10:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHpU5N3NKmoyUY1FhQuVzGs9Gsj+oF21Pz8XGrZixmk4Bt1MkQLZrO5gB+6hivtcUULe0E+Kw== X-Received: by 2002:a17:906:470f:b0:a5c:e240:ceb7 with SMTP id a640c23a62f3a-a6264f0e8c9mr98378866b.62.1716538252765; Fri, 24 May 2024 01:10:52 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 15/16] target/i386: cpu_load_eflags already sets cc_op Date: Fri, 24 May 2024 10:10:18 +0200 Message-ID: <20240524081019.1141359-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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: -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_H4=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: 1716538286789100007 Content-Type: text/plain; charset="utf-8" No need to set it again at the end of the translation block, cc_op_dirty can be set to false. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 37 ++++++++++++++++++++++++------------- target/i386/tcg/emit.c.inc | 2 +- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 1a776e77297..7442a8a51b1 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -332,7 +332,7 @@ static const uint8_t cc_op_live[CC_OP_NB] =3D { [CC_OP_POPCNT] =3D USES_CC_SRC, }; =20 -static void set_cc_op(DisasContext *s, CCOp op) +static void set_cc_op_1(DisasContext *s, CCOp op, bool dirty) { int dead; =20 @@ -355,20 +355,27 @@ static void set_cc_op(DisasContext *s, CCOp op) tcg_gen_discard_tl(s->cc_srcT); } =20 - if (op =3D=3D CC_OP_DYNAMIC) { - /* The DYNAMIC setting is translator only, and should never be - stored. Thus we always consider it clean. */ - s->cc_op_dirty =3D false; - } else { - /* Discard any computed CC_OP value (see shifts). */ - if (s->cc_op =3D=3D CC_OP_DYNAMIC) { - tcg_gen_discard_i32(cpu_cc_op); - } - s->cc_op_dirty =3D true; + if (dirty && s->cc_op =3D=3D CC_OP_DYNAMIC) { + tcg_gen_discard_i32(cpu_cc_op); } + s->cc_op_dirty =3D dirty; s->cc_op =3D op; } =20 +static void set_cc_op(DisasContext *s, CCOp op) +{ + /* + * The DYNAMIC setting is translator only, everything else + * will be spilled later. + */ + set_cc_op_1(s, op, op !=3D CC_OP_DYNAMIC); +} + +static void assume_cc_op(DisasContext *s, CCOp op) +{ + set_cc_op_1(s, op, false); +} + static void gen_update_cc_op(DisasContext *s) { if (s->cc_op_dirty) { @@ -3510,6 +3517,10 @@ static void disas_insn_old(DisasContext *s, CPUState= *cpu, int b) gen_update_cc_op(s); gen_update_eip_cur(s); gen_helper_syscall(tcg_env, cur_insn_len_i32(s)); + /* condition codes are modified only in long mode */ + if (LMA(s)) { + assume_cc_op(s, CC_OP_EFLAGS); + } /* TF handling for the syscall insn is different. The TF bit is c= hecked after the syscall insn completes. This allows #DB to not be generated after one has entered CPL0 if TF is set in FMASK. */ @@ -3526,7 +3537,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) gen_helper_sysret(tcg_env, tcg_constant_i32(dflag - 1)); /* condition codes are modified only in long mode */ if (LMA(s)) { - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); } /* TF handling for the sysret insn is different. The TF bit is checked after the sysret insn completes. This allows #DB to= be @@ -4444,7 +4455,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) g_assert_not_reached(); #else gen_helper_rsm(tcg_env); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); #endif /* CONFIG_USER_ONLY */ s->base.is_jmp =3D DISAS_EOB_ONLY; break; diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 9eecf7ab56c..9fea395dfbf 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -1881,7 +1881,7 @@ static void gen_IRET(DisasContext *s, CPUX86State *en= v, X86DecodedInsn *decode) gen_helper_iret_protected(tcg_env, tcg_constant_i32(s->dflag - 1), eip_next_i32(s)); } - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); s->base.is_jmp =3D DISAS_EOB_ONLY; } =20 --=20 2.45.1 From nobody Mon Nov 25 07:29:43 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=1716538336; cv=none; d=zohomail.com; s=zohoarc; b=hZIxtDUBmQs8LJ2nHAWYpoIiGRWcFdLIGl60qPYYFI9+LH2oKKF83rk4Eeo5PGBHz+cTgTHTZIYY2zxnffaNfnsLNfpg8dYpTnfGyosBaJCWS0Jvo6urpfp7fdhWr00FvDaj8xXjvguHeTKTZGveCC/08LSWzBdR8axuzyQGGvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716538336; 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=3DwY6doHsFQvj/Rs/g+hb5d9pWSIsZtB4sTT+qGB5ek=; b=Q3sEob8AHRDICyXmEsoH7k0ZDkkyrFo/zDPQfnbwPErCTE+KUD80+LALebzA1x0BNW1ZDOQxPAiRx8eUsflgjx809tONzjbK/MW9kDevu9HUzQQEnmdcpVLqlR+sT0PTaN4tI8FEmENuzcJdH8es/4+yhI97sX+ox5efC3tELW4= 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 171653833689146.245120291131116; Fri, 24 May 2024 01:12:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sAQ13-0005sJ-S5; Fri, 24 May 2024 04:11:05 -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 1sAQ11-0005p4-5V for qemu-devel@nongnu.org; Fri, 24 May 2024 04:11:03 -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 1sAQ0y-0000ec-Gc for qemu-devel@nongnu.org; Fri, 24 May 2024 04:11:02 -0400 Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-0M4MbElYPQyyKRzj4OvZvg-1; Fri, 24 May 2024 04:10:58 -0400 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2e95a62c11cso4449671fa.1 for ; Fri, 24 May 2024 01:10:57 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc4f647sm89829466b.117.2024.05.24.01.10.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716538259; 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=3DwY6doHsFQvj/Rs/g+hb5d9pWSIsZtB4sTT+qGB5ek=; b=GJ7IiLZugUYJZOPATQvJvhHc7t1Z5Kondz2g5pXFTC5Vwiezg1ki/x656knomr7j39RNE8 kdDlVwBvivAyn5rBhM6IpSmO4tptev19Gl1EsCCW574te8ylh/K156YqlMjAUjxvqVDBNH huee7ECmV7m+HABkmlnkeIdzchQq4RE= X-MC-Unique: 0M4MbElYPQyyKRzj4OvZvg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716538256; x=1717143056; 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=3DwY6doHsFQvj/Rs/g+hb5d9pWSIsZtB4sTT+qGB5ek=; b=aqIMJ3zLCIt6ef6UbujY4/J+S61MUezwdiedIuBhaOY1f/s0WbjxNpY8pzAqnXYiu8 1xL3oowtngoHFpxFGojAcVZL3vTVEAvHxmQ5RY4cb+XSXbu/r7g5nzHjVq0kdOd8urbW GmwmoLRE9rwNstRCwI2ABogDVe/6wlUUyew2kBVmE1nQs+nx5HbSh4XhcN5Ca/KuUcGR Ngle2H6HRF/GTN9lO/qp1YcichYfpo4oJdM2AYBTfTfoRXshea1od+EIWs19x8yOEj/3 SuSO8SyJCoqnc9aK8CER6YTj19PpYMSsfTYjrKuAw6ofX0zB+B3yxZCvoTuI++CrZyk+ T7fA== X-Gm-Message-State: AOJu0Yx+H7WVqJaKABWF4X+DNlmE6cQXSCCZy9eZNTc7Xi0aR124YoFi GM61EollEODJXtQU7CwvUFjyaD/0FhubRtftGHDZ/yt+KWUjp4XPUXy6qJACWxar6IwST17g0Kw ImY1GZ9bTVNK7d/7uIU2OB/LRnFTmEBiAZO4S8VEBb9fjnbIbGBWkipp0nTHtfyv4cbdQWBtwCg xT1iv+ANWjhFoN6HgRjrDiz4j+NCX+ycia+niw X-Received: by 2002:a2e:9119:0:b0:2e0:5d7:a3a6 with SMTP id 38308e7fff4ca-2e95b0417ccmr13180511fa.9.1716538255969; Fri, 24 May 2024 01:10:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrMpqbJ1v5xO3jg8q25mBcxokKe8HzY4VGKkRbCU/2mvite/HZD7H/EZecii99GepxzgRyBQ== X-Received: by 2002:a2e:9119:0:b0:2e0:5d7:a3a6 with SMTP id 38308e7fff4ca-2e95b0417ccmr13180321fa.9.1716538255197; Fri, 24 May 2024 01:10:55 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 16/16] target/i386: set CC_OP in helpers if they want CC_OP_EFLAGS Date: Fri, 24 May 2024 10:10:19 +0200 Message-ID: <20240524081019.1141359-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524081019.1141359-1-pbonzini@redhat.com> References: <20240524081019.1141359-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_H4=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: 1716538338983100007 Content-Type: text/plain; charset="utf-8" Mark cc_op as clean and do not spill it at the end of the translation block. Technically this is a tiny bit less efficient, but: * it results in translations that are a tiny bit smaller * for most of these instructions, it is not unlikely that they are close to the end of the basic block, in which case the spilling of cc_op would be there anyway * even in other cases, the cost is probably dwarfed by that of computing fl= ags. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/ops_sse.h | 8 ++++++++ target/i386/tcg/fpu_helper.c | 2 ++ target/i386/tcg/int_helper.c | 13 +++++++++---- target/i386/tcg/seg_helper.c | 16 ++++++++-------- target/i386/tcg/translate.c | 12 ++++++------ target/i386/tcg/emit.c.inc | 22 +++++++++++----------- 6 files changed, 44 insertions(+), 29 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index 6a465a35fdb..f0aa1894aa2 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -1111,6 +1111,7 @@ void helper_ucomiss(CPUX86State *env, Reg *d, Reg *s) s1 =3D s->ZMM_S(0); ret =3D float32_compare_quiet(s0, s1, &env->sse_status); CC_SRC =3D comis_eflags[ret + 1]; + CC_OP =3D CC_OP_EFLAGS; } =20 void helper_comiss(CPUX86State *env, Reg *d, Reg *s) @@ -1122,6 +1123,7 @@ void helper_comiss(CPUX86State *env, Reg *d, Reg *s) s1 =3D s->ZMM_S(0); ret =3D float32_compare(s0, s1, &env->sse_status); CC_SRC =3D comis_eflags[ret + 1]; + CC_OP =3D CC_OP_EFLAGS; } =20 void helper_ucomisd(CPUX86State *env, Reg *d, Reg *s) @@ -1133,6 +1135,7 @@ void helper_ucomisd(CPUX86State *env, Reg *d, Reg *s) d1 =3D s->ZMM_D(0); ret =3D float64_compare_quiet(d0, d1, &env->sse_status); CC_SRC =3D comis_eflags[ret + 1]; + CC_OP =3D CC_OP_EFLAGS; } =20 void helper_comisd(CPUX86State *env, Reg *d, Reg *s) @@ -1144,6 +1147,7 @@ void helper_comisd(CPUX86State *env, Reg *d, Reg *s) d1 =3D s->ZMM_D(0); ret =3D float64_compare(d0, d1, &env->sse_status); CC_SRC =3D comis_eflags[ret + 1]; + CC_OP =3D CC_OP_EFLAGS; } #endif =20 @@ -1610,6 +1614,7 @@ void glue(helper_ptest, SUFFIX)(CPUX86State *env, Reg= *d, Reg *s) cf |=3D (s->Q(i) & ~d->Q(i)); } CC_SRC =3D (zf ? 0 : CC_Z) | (cf ? 0 : CC_C); + CC_OP =3D CC_OP_EFLAGS; } =20 #define FMOVSLDUP(i) s->L((i) & ~1) @@ -1966,6 +1971,7 @@ static inline unsigned pcmpxstrx(CPUX86State *env, Re= g *d, Reg *s, validd--; =20 CC_SRC =3D (valids < upper ? CC_Z : 0) | (validd < upper ? CC_S : 0); + CC_OP =3D CC_OP_EFLAGS; =20 switch ((ctrl >> 2) & 3) { case 0: @@ -2297,6 +2303,7 @@ void glue(helper_vtestps, SUFFIX)(CPUX86State *env, R= eg *d, Reg *s) cf |=3D (s->L(i) & ~d->L(i)); } CC_SRC =3D ((zf >> 31) ? 0 : CC_Z) | ((cf >> 31) ? 0 : CC_C); + CC_OP =3D CC_OP_EFLAGS; } =20 void glue(helper_vtestpd, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) @@ -2309,6 +2316,7 @@ void glue(helper_vtestpd, SUFFIX)(CPUX86State *env, R= eg *d, Reg *s) cf |=3D (s->Q(i) & ~d->Q(i)); } CC_SRC =3D ((zf >> 63) ? 0 : CC_Z) | ((cf >> 63) ? 0 : CC_C); + CC_OP =3D CC_OP_EFLAGS; } =20 void glue(helper_vpmaskmovd_st, SUFFIX)(CPUX86State *env, diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index ece22a3553f..8df8cae6310 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -487,6 +487,7 @@ void helper_fcomi_ST0_FT0(CPUX86State *env) ret =3D floatx80_compare(ST0, FT0, &env->fp_status); eflags =3D cpu_cc_compute_all(env) & ~(CC_Z | CC_P | CC_C); CC_SRC =3D eflags | fcomi_ccval[ret + 1]; + CC_OP =3D CC_OP_EFLAGS; merge_exception_flags(env, old_flags); } =20 @@ -499,6 +500,7 @@ void helper_fucomi_ST0_FT0(CPUX86State *env) ret =3D floatx80_compare_quiet(ST0, FT0, &env->fp_status); eflags =3D cpu_cc_compute_all(env) & ~(CC_Z | CC_P | CC_C); CC_SRC =3D eflags | fcomi_ccval[ret + 1]; + CC_OP =3D CC_OP_EFLAGS; merge_exception_flags(env, old_flags); } =20 diff --git a/target/i386/tcg/int_helper.c b/target/i386/tcg/int_helper.c index 4cc59f15203..e1f92405282 100644 --- a/target/i386/tcg/int_helper.c +++ b/target/i386/tcg/int_helper.c @@ -187,6 +187,7 @@ void helper_aaa(CPUX86State *env) } env->regs[R_EAX] =3D (env->regs[R_EAX] & ~0xffff) | al | (ah << 8); CC_SRC =3D eflags; + CC_OP =3D CC_OP_EFLAGS; } =20 void helper_aas(CPUX86State *env) @@ -211,6 +212,7 @@ void helper_aas(CPUX86State *env) } env->regs[R_EAX] =3D (env->regs[R_EAX] & ~0xffff) | al | (ah << 8); CC_SRC =3D eflags; + CC_OP =3D CC_OP_EFLAGS; } =20 void helper_daa(CPUX86State *env) @@ -238,6 +240,7 @@ void helper_daa(CPUX86State *env) eflags |=3D parity_table[al]; /* pf */ eflags |=3D (al & 0x80); /* sf */ CC_SRC =3D eflags; + CC_OP =3D CC_OP_EFLAGS; } =20 void helper_das(CPUX86State *env) @@ -269,6 +272,7 @@ void helper_das(CPUX86State *env) eflags |=3D parity_table[al]; /* pf */ eflags |=3D (al & 0x80); /* sf */ CC_SRC =3D eflags; + CC_OP =3D CC_OP_EFLAGS; } =20 #ifdef TARGET_X86_64 @@ -449,10 +453,11 @@ target_ulong HELPER(rdrand)(CPUX86State *env) error_free(err); /* Failure clears CF and all other flags, and returns 0. */ env->cc_src =3D 0; - return 0; + ret =3D 0; + } else { + /* Success sets CF and clears all others. */ + env->cc_src =3D CC_C; } - - /* Success sets CF and clears all others. */ - env->cc_src =3D CC_C; + env->cc_op =3D CC_OP_EFLAGS; return ret; } diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c index 34ccabd8ce3..0301459004e 100644 --- a/target/i386/tcg/seg_helper.c +++ b/target/i386/tcg/seg_helper.c @@ -2326,7 +2326,7 @@ void helper_verr(CPUX86State *env, target_ulong selec= tor1) int rpl, dpl, cpl; =20 selector =3D selector1 & 0xffff; - eflags =3D cpu_cc_compute_all(env); + eflags =3D cpu_cc_compute_all(env) | CC_Z; if ((selector & 0xfffc) =3D=3D 0) { goto fail; } @@ -2351,11 +2351,11 @@ void helper_verr(CPUX86State *env, target_ulong sel= ector1) } else { if (dpl < cpl || dpl < rpl) { fail: - CC_SRC =3D eflags & ~CC_Z; - return; + eflags &=3D ~CC_Z; } } - CC_SRC =3D eflags | CC_Z; + CC_SRC =3D eflags; + CC_OP =3D CC_OP_EFLAGS; } =20 void helper_verw(CPUX86State *env, target_ulong selector1) @@ -2364,7 +2364,7 @@ void helper_verw(CPUX86State *env, target_ulong selec= tor1) int rpl, dpl, cpl; =20 selector =3D selector1 & 0xffff; - eflags =3D cpu_cc_compute_all(env); + eflags =3D cpu_cc_compute_all(env) | CC_Z; if ((selector & 0xfffc) =3D=3D 0) { goto fail; } @@ -2385,9 +2385,9 @@ void helper_verw(CPUX86State *env, target_ulong selec= tor1) } if (!(e2 & DESC_W_MASK)) { fail: - CC_SRC =3D eflags & ~CC_Z; - return; + eflags &=3D ~CC_Z; } } - CC_SRC =3D eflags | CC_Z; + CC_SRC =3D eflags; + CC_OP =3D CC_OP_EFLAGS; } diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 7442a8a51b1..851ac86ff32 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2940,7 +2940,7 @@ static bool disas_insn_x87(DisasContext *s, CPUState = *cpu, int b) gen_update_cc_op(s); gen_helper_fmov_FT0_STN(tcg_env, tcg_constant_i32(opreg)); gen_helper_fucomi_ST0_FT0(tcg_env); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); break; case 0x1e: /* fcomi */ if (!(s->cpuid_features & CPUID_CMOV)) { @@ -2949,7 +2949,7 @@ static bool disas_insn_x87(DisasContext *s, CPUState = *cpu, int b) gen_update_cc_op(s); gen_helper_fmov_FT0_STN(tcg_env, tcg_constant_i32(opreg)); gen_helper_fcomi_ST0_FT0(tcg_env); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); break; case 0x28: /* ffree sti */ gen_helper_ffree_STN(tcg_env, tcg_constant_i32(opreg)); @@ -3008,7 +3008,7 @@ static bool disas_insn_x87(DisasContext *s, CPUState = *cpu, int b) gen_helper_fmov_FT0_STN(tcg_env, tcg_constant_i32(opreg)); gen_helper_fucomi_ST0_FT0(tcg_env); gen_helper_fpop(tcg_env); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); break; case 0x3e: /* fcomip */ if (!(s->cpuid_features & CPUID_CMOV)) { @@ -3018,7 +3018,7 @@ static bool disas_insn_x87(DisasContext *s, CPUState = *cpu, int b) gen_helper_fmov_FT0_STN(tcg_env, tcg_constant_i32(opreg)); gen_helper_fcomi_ST0_FT0(tcg_env); gen_helper_fpop(tcg_env); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); break; case 0x10 ... 0x13: /* fcmovxx */ case 0x18 ... 0x1b: @@ -3224,7 +3224,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) gen_helper_rdrand(s->T0, tcg_env); rm =3D (modrm & 7) | REX_B(s); gen_op_mov_reg_v(s, dflag, rm, s->T0); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); break; =20 default: @@ -3611,7 +3611,7 @@ static void disas_insn_old(DisasContext *s, CPUState = *cpu, int b) } else { gen_helper_verw(tcg_env, s->T0); } - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); break; default: goto unknown_op; diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc index 9fea395dfbf..e990141454b 100644 --- a/target/i386/tcg/emit.c.inc +++ b/target/i386/tcg/emit.c.inc @@ -918,7 +918,7 @@ static void gen_##uname(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decod } else { = \ gen_helper_##lname##_ymm(tcg_env, OP_PTR1, OP_PTR2); = \ } = \ - set_cc_op(s, CC_OP_EFLAGS); = \ + assume_cc_op(s, CC_OP_EFLAGS); = \ } UNARY_CMP_SSE(VPTEST, ptest) UNARY_CMP_SSE(VTESTPS, vtestps) @@ -1079,7 +1079,7 @@ static void gen_AAA(DisasContext *s, CPUX86State *env= , X86DecodedInsn *decode) { gen_update_cc_op(s); gen_helper_aaa(tcg_env); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); } =20 static void gen_AAD(DisasContext *s, CPUX86State *env, X86DecodedInsn *dec= ode) @@ -1102,7 +1102,7 @@ static void gen_AAS(DisasContext *s, CPUX86State *env= , X86DecodedInsn *decode) { gen_update_cc_op(s); gen_helper_aas(tcg_env); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); } =20 static void gen_ADC(DisasContext *s, CPUX86State *env, X86DecodedInsn *dec= ode) @@ -1564,14 +1564,14 @@ static void gen_DAA(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decode) { gen_update_cc_op(s); gen_helper_daa(tcg_env); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); } =20 static void gen_DAS(DisasContext *s, CPUX86State *env, X86DecodedInsn *dec= ode) { gen_update_cc_op(s); gen_helper_das(tcg_env); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); } =20 static void gen_DEC(DisasContext *s, CPUX86State *env, X86DecodedInsn *dec= ode) @@ -2351,14 +2351,14 @@ static void gen_PCMPESTRI(DisasContext *s, CPUX86St= ate *env, X86DecodedInsn *dec { TCGv_i32 imm =3D tcg_constant8u_i32(decode->immediate); gen_helper_pcmpestri_xmm(tcg_env, OP_PTR1, OP_PTR2, imm); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); } =20 static void gen_PCMPESTRM(DisasContext *s, CPUX86State *env, X86DecodedIns= n *decode) { TCGv_i32 imm =3D tcg_constant8u_i32(decode->immediate); gen_helper_pcmpestrm_xmm(tcg_env, OP_PTR1, OP_PTR2, imm); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); if ((s->prefix & PREFIX_VEX) && !s->vex_l) { tcg_gen_gvec_dup_imm(MO_64, offsetof(CPUX86State, xmm_regs[0].ZMM_= X(1)), 16, 16, 0); @@ -2369,14 +2369,14 @@ static void gen_PCMPISTRI(DisasContext *s, CPUX86St= ate *env, X86DecodedInsn *dec { TCGv_i32 imm =3D tcg_constant8u_i32(decode->immediate); gen_helper_pcmpistri_xmm(tcg_env, OP_PTR1, OP_PTR2, imm); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); } =20 static void gen_PCMPISTRM(DisasContext *s, CPUX86State *env, X86DecodedIns= n *decode) { TCGv_i32 imm =3D tcg_constant8u_i32(decode->immediate); gen_helper_pcmpistrm_xmm(tcg_env, OP_PTR1, OP_PTR2, imm); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); if ((s->prefix & PREFIX_VEX) && !s->vex_l) { tcg_gen_gvec_dup_imm(MO_64, offsetof(CPUX86State, xmm_regs[0].ZMM_= X(1)), 16, 16, 0); @@ -3589,7 +3589,7 @@ static void gen_VCOMI(DisasContext *s, CPUX86State *e= nv, X86DecodedInsn *decode) SSEFunc_0_epp fn; fn =3D s->prefix & PREFIX_DATA ? gen_helper_comisd : gen_helper_comiss; fn(tcg_env, OP_PTR1, OP_PTR2); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); } =20 static void gen_VCVTPD2PS(DisasContext *s, CPUX86State *env, X86DecodedIns= n *decode) @@ -3976,7 +3976,7 @@ static void gen_VUCOMI(DisasContext *s, CPUX86State *= env, X86DecodedInsn *decode SSEFunc_0_epp fn; fn =3D s->prefix & PREFIX_DATA ? gen_helper_ucomisd : gen_helper_ucomi= ss; fn(tcg_env, OP_PTR1, OP_PTR2); - set_cc_op(s, CC_OP_EFLAGS); + assume_cc_op(s, CC_OP_EFLAGS); } =20 static void gen_VZEROALL(DisasContext *s, CPUX86State *env, X86DecodedInsn= *decode) --=20 2.45.1