From nobody Tue Apr 02 08:59:40 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V81zJ6l7vz5G4ZH; Tue, 2 Apr 2024 08:59:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V81zJ6DMRz4VM6; Tue, 2 Apr 2024 08:59:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712048380; 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; bh=9Jbx2XDpo8Xv1ES0eAcnTwD08eazOi9U6yoG3mS67Ek=; b=qroNVbTrznkkYMHawao/o4tF5dcxpFlO5YRxA65DWlS5bXZLWiRemvZtA9IzZnX7jhThhS or8RS3bVK4byu8BcUY7c1G7HuDzA5hVe4YFI7A7JW5OeiEBPD7QtOa6qB0HAa7UMOfc0rR Kcfd9xWfdX6LudKjh9+Lo2Pg0lrL/xlD/ks6hUiPHxmhuMLpARVPzsEYwu4AjWZZGQlfbp PNle2sr+kc4xXgh2S5+5nbo7NtAaLMDJR/XUP5f88oo/a8L93gKZCXzaggb9zVcUffzCHQ VUkExhU1sBiuOks7YrjARbvBJxeuXab7lIEnZeLg+MPuMnoboTRteJJcQwY90A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712048380; a=rsa-sha256; cv=none; b=xxKhv/cFY/s6b3D9YJQs8XwLI95oQWt2UCgPuW5sXGwgo2LKFJne8HEqNpnp58TJrOHW1y v2JnRbVwuMQb1hjzXT4nbYlLhJCZcjwlkHJV4lok7Hkt+jiVTUYnLZc5mAJt/Ok+VLA/OX Q1bQvkOFXNAlYLMYzz3eM6WqDC+IyObFMgXTcd5f7Yc9Jr4vPuQ+ye1XnsMu0gY9z0ALKg EBuPtnSkKbmgDYEtvohRYhsy9M2sENlfJPCrmghMx5cGdlw6DWn/wav0r4bQIN8zFlYFet gbXMAhsF5KuddzXy/lj5DgcVlTPfKfiTmWE2Rvw4Z6O6OV1TCg83Mlz3P8ggIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712048380; 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; bh=9Jbx2XDpo8Xv1ES0eAcnTwD08eazOi9U6yoG3mS67Ek=; b=Qck/5KuRobR2iwGlKqMrEuMicwwMXUQ7/VoljLeOmsTsPPTwpV53xqMuqw1zNk3l4V1NSc Q9ZZLLY3eEDcUclcJbpcU7M4mQWPNpFGR1FtLVYZL893pc4mHN8R64dJ4kxH8sWonYqmWW yuKCU3feXkpUg6MU6n1sG6ClqNUvQsUxTJKCKWdhOenqgA4ORSMog/vLbvMYf5Fz3XJUxp 1lZ0XMpYtRh5W2GtNRTmaJvYaogCmHnNaHqNfN8pTI9zeAkYh/CBtBHwC5LqILl74jzcMO 6Jaqz+6Cph8ePN33RNh/h9e/zzDzuRIvBA1yEKOROf6wGmDjzyj5Wx/KLu+UHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V81zJ5qX4zjZ3; Tue, 2 Apr 2024 08:59:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4328xexX014597; Tue, 2 Apr 2024 08:59:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4328xett014594; Tue, 2 Apr 2024 08:59:40 GMT (envelope-from git) Date: Tue, 2 Apr 2024 08:59:40 GMT Message-Id: <202404020859.4328xett014594@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b40ed1134d67 - stable/14 - x86: test the right CPUID bit when checking for XSAVEOPT support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b40ed1134d6763ef8a24f6fe2f0f219dba5d3f6e Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b40ed1134d6763ef8a24f6fe2f0f219dba5d3f6e commit b40ed1134d6763ef8a24f6fe2f0f219dba5d3f6e Author: Konstantin Belousov AuthorDate: 2024-03-25 10:34:06 +0000 Commit: Konstantin Belousov CommitDate: 2024-04-02 08:58:20 +0000 x86: test the right CPUID bit when checking for XSAVEOPT support (cherry picked from commit 960d151eaa1ecde109accc30ca0c3306551d8e58) --- sys/amd64/amd64/fpu.c | 5 ++++- sys/i386/i386/npx.c | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 3432e62bf7f8..63fcf7b0a361 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -236,9 +236,12 @@ fpurestore_fxrstor(void *addr) DEFINE_IFUNC(, void, fpusave, (void *)) { + u_int cp[4]; + if (!use_xsave) return (fpusave_fxsave); - if ((cpu_stdext_feature & CPUID_EXTSTATE_XSAVEOPT) != 0) { + cpuid_count(0xd, 0x1, cp); + if ((cp[0] & CPUID_EXTSTATE_XSAVEOPT) != 0) { return ((cpu_stdext_feature & CPUID_STDEXT_NFPUSG) != 0 ? fpusave_xsaveopt64 : fpusave_xsaveopt3264); } diff --git a/sys/i386/i386/npx.c b/sys/i386/i386/npx.c index 26def3f433f1..9cbb1340e9d1 100644 --- a/sys/i386/i386/npx.c +++ b/sys/i386/i386/npx.c @@ -317,9 +317,13 @@ fpusave_fnsave(union savefpu *addr) DEFINE_IFUNC(, void, fpusave, (union savefpu *)) { - if (use_xsave) - return ((cpu_stdext_feature & CPUID_EXTSTATE_XSAVEOPT) != 0 ? + u_int cp[4]; + + if (use_xsave) { + cpuid_count(0xd, 0x1, cp); + return ((cp[0] & CPUID_EXTSTATE_XSAVEOPT) != 0 ? fpusave_xsaveopt : fpusave_xsave); + } if (cpu_fxsr) return (fpusave_fxsave); return (fpusave_fnsave);