From patchwork Wed Jul 10 06:29:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 811771 Delivered-To: patch@linaro.org Received: by 2002:adf:ee12:0:b0:367:895a:4699 with SMTP id y18csp612100wrn; Tue, 9 Jul 2024 23:29:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVjoeQWqBCP3DpulHwTKS2xIt0zg2iIgIYhTuf26cwEGwB0JgV2+8S9xZt36b7mI1HB7Pj/ya4FIAVaFTOS4QyH X-Google-Smtp-Source: AGHT+IEphTCVPWYwAmsJxvKHybxER488kQzZSkZvdDM7MeDi+3CETd8lQzG76f0QMwsEtHUdCp6Q X-Received: by 2002:a05:620a:5d:b0:79d:7a40:1bde with SMTP id af79cd13be357-79f19a50927mr487457485a.45.1720592991857; Tue, 09 Jul 2024 23:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720592991; cv=none; d=google.com; s=arc-20160816; b=w+P69QqEoNNlunZlqMTwkYVRk8kDZXA3e1sQ8Rh7/7dZl6JuPlQVMPH0T70NbGMnoH Xm1eDkg14Oh8TC/X0yMM17pkWUILQ3ljeb2c8jZxpxo+r/updx40M2LYx2wCrQlz9UUh SKcvIJJDf6+kjjxaRBMA7PdktvygdDgHWDgL1tZUDtDbrySDZwZMwe0Rkz/mHKO6AFUk JZGqjkn9ILqiu1su0sZDuSBmltGdll4O1xAeQ/cPfsPfAOGSoZ3a/5kJCevVzFZPpw5Z /Chv3TSeyCKfwXFNQGzKWihblFysiE9fNisJtvIRhlwwgbkT6mG4zKA+VGitb4UXM4Kf pr2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zysmERLOD7LqFn2JG/XTo8hRSGrS1y0PB/cgSbGIed8=; fh=/6rEROlJiatsWcL3eO75DVvps3BAflSRhCYH1t6q/+4=; b=MWbekmfUQXbmCyytVw5hOEzDbEwbp7FVvvCka5VInNtiWg9dCBE2AZVrPblVsZFM5G hX02vPFTPooEHz4UXhl5arZ2kQlUyQSbEZAiftBghJJ1u9h3atzNYdvVM2dANiNfE388 a6JdeL2jH5Y+SjkzvLgNnJzPC0icf8ofWuL9aJ4ceS+yARiBsBvh7dxBgCD4SDO6+O7K 7MMyZ8/4pKI8ONMUIt6HA7+CvlaYSwgGtyk3JRxDofbKzuImWerE9K6XljrStub6Lctc 9hEVzfdakCwRteXLNvxz085eYPJ/vOZBAh9uczT8i3Ac3++peIcEXKzfj1qFnoe/yXzq kXXg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ApfrPFIO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79f190b6579si387781885a.411.2024.07.09.23.29.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jul 2024 23:29:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ApfrPFIO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRQpi-0008D1-Fv; Wed, 10 Jul 2024 02:29:43 -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 1sRQpb-0008AI-VB for qemu-devel@nongnu.org; Wed, 10 Jul 2024 02:29:35 -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 1sRQpZ-0000u6-W2 for qemu-devel@nongnu.org; Wed, 10 Jul 2024 02:29:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720592972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zysmERLOD7LqFn2JG/XTo8hRSGrS1y0PB/cgSbGIed8=; b=ApfrPFIO83ayI6RbViraM+l3GHDnBm89QAdStO/ZnI8mISl+M8FqUB+nYVEQ4BBdsx9bxT drTEOzZmtR2eFEFCP/LkfYetV4LK6JCWT4aFFmfhtuFsY93vSWVipNuAapZ1DwYp7lu8ar lo0RZ7dVoVnJDv6sAWRMWjRvl6B7g00= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-2-ne1ETC2cNqadSX46lAMe4A-1; Wed, 10 Jul 2024 02:29:28 -0400 X-MC-Unique: ne1ETC2cNqadSX46lAMe4A-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-52e9557e312so1590805e87.0 for ; Tue, 09 Jul 2024 23:29:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720592966; x=1721197766; 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=zysmERLOD7LqFn2JG/XTo8hRSGrS1y0PB/cgSbGIed8=; b=IlA/O6bK34wE6nMHwYZT82J3GvUXXPVBk4F+JTvLhfuY99eSQgy7pt4hCkx7eNLcRW sg38vAPoCAKl0eb8obSKEpZzO+o4v3DGPIoDWIfJ6M5O7PINUKrhJ/RsHllhBv7cjaFL XHWwlZK0t/lcI6B0vg9GRGCnOjNN/16MRZg85dT8EuQOqbSxdN/+nV0C1DBRQ7YC4f23 P8+GaFMjkfJhfJvcEgPj4ZHRc343qWlN4JbFuAkHlEgvqvwJrvLYL5449lft3Q1+zkdh pBsQnDjSKqE0AAqdW3BjVm/adTpRQr9+vP+zRMk/tqNehjtbXUl72iuFKeZw28Bhju3Y Qcuw== X-Gm-Message-State: AOJu0YwKa/kt1rk7U1YOk5a4/pNzaWHmnOCHflBVD3jntHeRu2cmJw5k i2aoE74m0slFsAXr3vBd/a0Z5fe26LWgMTEN1g6CwpGmKaTaZz4/qeNPjJRluq0tbQjED9HAxsj Q/WGWhO5i1qdoFMtE2/E71vghhuAxBtuYbxZTix6XajdSQ296szYhGKorjoJeZNHBQD1Qumh64N CjAhLy4ix9dk5IktUv+KD8aQp34Di5Sr0+vCcu X-Received: by 2002:ac2:4288:0:b0:52c:e121:c927 with SMTP id 2adb3069b0e04-52eb99d6d24mr2346022e87.62.1720592965833; Tue, 09 Jul 2024 23:29:25 -0700 (PDT) X-Received: by 2002:ac2:4288:0:b0:52c:e121:c927 with SMTP id 2adb3069b0e04-52eb99d6d24mr2346008e87.62.1720592965300; Tue, 09 Jul 2024 23:29:25 -0700 (PDT) Received: from avogadro.local ([151.95.101.29]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4266f736939sm68500425e9.37.2024.07.09.23.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 23:29:23 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: rrh.henry@gmail.com, richard.henderson@linaro.org Subject: [PATCH 01/10] target/i386/tcg: Remove SEG_ADDL Date: Wed, 10 Jul 2024 08:29:11 +0200 Message-ID: <20240710062920.73063-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240710062920.73063-1-pbonzini@redhat.com> References: <20240710062920.73063-1-pbonzini@redhat.com> MIME-Version: 1.0 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: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.144, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This truncation is now handled by MMU_*32_IDX. The introduction of MMU_*32_IDX in fact applied correct 32-bit wraparound to 16-bit accesses with a high segment base (e.g. big real mode or vm86 mode), which did not use SEG_ADDL. Signed-off-by: Richard Henderson Link: https://lore.kernel.org/r/20240617161210.4639-3-richard.henderson@linaro.org Signed-off-by: Paolo Bonzini --- target/i386/tcg/seg_helper.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c index aee3d19f29b..19d6b41a589 100644 --- a/target/i386/tcg/seg_helper.c +++ b/target/i386/tcg/seg_helper.c @@ -579,10 +579,6 @@ int exception_has_error_code(int intno) } while (0) #endif -/* in 64-bit machines, this can overflow. So this segment addition macro - * can be used to trim the value to 32-bit whenever needed */ -#define SEG_ADDL(ssp, sp, sp_mask) ((uint32_t)((ssp) + (sp & (sp_mask)))) - /* XXX: add a is_user flag to have proper security support */ #define PUSHW_RA(ssp, sp, sp_mask, val, ra) \ { \ @@ -593,7 +589,7 @@ int exception_has_error_code(int intno) #define PUSHL_RA(ssp, sp, sp_mask, val, ra) \ { \ sp -= 4; \ - cpu_stl_kernel_ra(env, SEG_ADDL(ssp, sp, sp_mask), (uint32_t)(val), ra); \ + cpu_stl_kernel_ra(env, (ssp) + (sp & (sp_mask)), (val), ra); \ } #define POPW_RA(ssp, sp, sp_mask, val, ra) \ @@ -604,7 +600,7 @@ int exception_has_error_code(int intno) #define POPL_RA(ssp, sp, sp_mask, val, ra) \ { \ - val = (uint32_t)cpu_ldl_kernel_ra(env, SEG_ADDL(ssp, sp, sp_mask), ra); \ + val = (uint32_t)cpu_ldl_kernel_ra(env, (ssp) + (sp & (sp_mask)), ra); \ sp += 4; \ }