From nobody Wed Feb 11 06:15:58 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1683098225; cv=none; d=zohomail.com; s=zohoarc; b=dnlamlMp9zr244d0VgaILt/fvYEISgyaTWj/YuXSVEdCkqJDzxSj1Z6FEGU1uta1c5P3uxh3etMPHz32DS7mXe1VxwsNk6rpUA8UTvRJf0HD7OxDAkUc9rzlN27kdorvUMS83P4AFfP4hbOP53YR1TSICLEttLRKIfgAow6ZR9g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683098225; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ie4qD4RsOKAembPT/VL7Wty2S+rmvIpYPQ8gnkDX74w=; b=S0Bmpi6Cp8KaCNtqNYC00OdGP0KNFp7nVNVMll+XRjIwN9W2j4AVOMQW+UkNDpZQpPRqGkyKbC4PHGYytkfNSgHSZz5pvLtKm95PLfIYx7KNFnUQE6CfJY9U24EUduKRm+dtys6d2I+7DtDv3oh6czoPzk2WwJliMMZ+0ieRTu8= 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 1683098225591785.0107273769355; Wed, 3 May 2023 00:17:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pu6dp-0004W7-Ou; Wed, 03 May 2023 03:11:09 -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 1pu6dQ-0002vo-Fl for qemu-devel@nongnu.org; Wed, 03 May 2023 03:10:47 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pu6dI-00072Q-6U for qemu-devel@nongnu.org; Wed, 03 May 2023 03:10:43 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3f19a80a330so29525565e9.2 for ; Wed, 03 May 2023 00:10:31 -0700 (PDT) Received: from stoup.Home ([2a02:c7c:74db:8d00:c01d:9d74:b630:9087]) by smtp.gmail.com with ESMTPSA id v9-20020a05600c444900b003f173be2ccfsm54223673wmn.2.2023.05.03.00.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 May 2023 00:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683097830; x=1685689830; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ie4qD4RsOKAembPT/VL7Wty2S+rmvIpYPQ8gnkDX74w=; b=ivJXbfqOVAy4sCeV//Ge6LVUFpdTvj1BhbXCSm5CJyRqssQFp64eDlkhxnars94GTj phlLEQarljBSjQSZkEA4UHsBdoCxELuW3DbI1EJFHDizk1Vk5461uIRRuVOvKJ1OPbd4 UJnaI8vTv0b1Mz9mAxEnMPPTBvmVBwq9IDGLSlhL19jKEOhoSYXcRsfMp3AxdqrCjgTN cG0DDKfHQj8SKOPt02OMg7rLm65NV1diYL7Cut0VhjskovLP/lfpMQ8o9WsQjGHVqFqV BP1lp3HDe1hz4QiA+0jiEbMDusR/jHjqbcZhxRSbA8YtJPUA2NCI9TMQwNwf3NA1dNwO opHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683097830; x=1685689830; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ie4qD4RsOKAembPT/VL7Wty2S+rmvIpYPQ8gnkDX74w=; b=lAqQp8l+CXj/ymaW4gZkP5J/cDcp/XqscA5v9QSidQJbToREiHJHHu60OIUELxNZRi LcO1Y2Mq8MQztAfOYkqx6OcDdiPjQK8dPy6rcj73dyHwEmmU/+/unthwRh2IovJdpVKQ PNb0/JHX0C64JfZxlxR6accD8/mrmdX3+73lBw1RCYTvlUuhWg/6ZoS2DOGB30lpwIsT b3FNFktgMuB/+/vMAAHiP6lZXBGwkvBShQ1mg8p9AVaEbvdjewU/dnf1g+sva5i1JZu0 bdFmcGdVTZROXGl/mGfjP1B7+MN+oMyW0Xq+OMPXQ5jhtAZ1JzOxT91eRqYAThGuMWTn mIvQ== X-Gm-Message-State: AC+VfDzkDPsmZTWRhDdRX+FdWaC+TKDrrL00J53DpuvhAvMXTZNGYw9M wiXrCEIfjPJt/XOGYCmRjoqWNwBRNRjLlhJQ/1InLQ== X-Google-Smtp-Source: ACHHUZ4czBAuYg5PD74PnM7UXKB0nTkIO8m84kc17GVPb7HKLNytjD1Jl8oMwfIymz2zI5+3/nP9uw== X-Received: by 2002:a7b:c446:0:b0:3ee:6d55:8b73 with SMTP id l6-20020a7bc446000000b003ee6d558b73mr13330105wmi.29.1683097830591; Wed, 03 May 2023 00:10:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: git@xen0n.name, gaosong@loongson.cn, philmd@linaro.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH v4 43/57] tcg/i386: Use atom_and_align_for_opc Date: Wed, 3 May 2023 08:06:42 +0100 Message-Id: <20230503070656.1746170-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230503070656.1746170-1-richard.henderson@linaro.org> References: <20230503070656.1746170-1-richard.henderson@linaro.org> 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=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1683098227599100004 Content-Type: text/plain; charset="utf-8" No change to the ultimate load/store routines yet, so some atomicity conditions not yet honored, but plumbs the change to alignment through the relevant functions. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- tcg/i386/tcg-target.c.inc | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 7c72bf6684..3e21f067d6 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1774,6 +1774,8 @@ typedef struct { int index; int ofs; int seg; + MemOp align; + MemOp atom; } HostAddress; =20 bool tcg_target_has_memory_bswap(MemOp memop) @@ -1895,8 +1897,12 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContex= t *s, HostAddress *h, { TCGLabelQemuLdst *ldst =3D NULL; MemOp opc =3D get_memop(oi); - unsigned a_bits =3D get_alignment_bits(opc); - unsigned a_mask =3D (1 << a_bits) - 1; + MemOp atom_u; + unsigned a_mask; + + h->align =3D atom_and_align_for_opc(s, &h->atom, &atom_u, opc, + MO_ATOM_IFALIGN, false); + a_mask =3D (1 << h->align) - 1; =20 #ifdef CONFIG_SOFTMMU int cmp_ofs =3D is_ld ? offsetof(CPUTLBEntry, addr_read) @@ -1941,10 +1947,12 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGConte= xt *s, HostAddress *h, TLB_MASK_TABLE_OFS(mem_index) + offsetof(CPUTLBDescFast, table)); =20 - /* If the required alignment is at least as large as the access, simply - copy the address and mask. For lesser alignments, check that we do= n't - cross pages for the complete access. */ - if (a_bits >=3D s_bits) { + /* + * If the required alignment is at least as large as the access, simply + * copy the address and mask. For lesser alignments, check that we do= n't + * cross pages for the complete access. + */ + if (a_mask >=3D s_mask) { tcg_out_mov(s, ttype, TCG_REG_L1, addrlo); } else { tcg_out_modrm_offset(s, OPC_LEA + trexw, TCG_REG_L1, @@ -1976,12 +1984,12 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGConte= xt *s, HostAddress *h, tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_L0, TCG_REG_L0, offsetof(CPUTLBEntry, addend)); =20 - *h =3D (HostAddress) { - .base =3D addrlo, - .index =3D TCG_REG_L0, - }; + h->base =3D addrlo; + h->index =3D TCG_REG_L0; + h->ofs =3D 0; + h->seg =3D 0; #else - if (a_bits) { + if (a_mask) { ldst =3D new_ldst_label(s); =20 ldst->is_ld =3D is_ld; @@ -1996,8 +2004,10 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContex= t *s, HostAddress *h, s->code_ptr +=3D 4; } =20 - *h =3D x86_guest_base; h->base =3D addrlo; + h->index =3D x86_guest_base.index; + h->ofs =3D x86_guest_base.ofs; + h->seg =3D x86_guest_base.seg; #endif =20 return ldst; --=20 2.34.1