From nobody Tue Mar 26 02:09:26 2024 X-Original-To: dev-commits-src-main@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 4V3YCB5Cfnz5Fnmp; Tue, 26 Mar 2024 02:09:26 +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 4V3YCB4h6tz4Z9g; Tue, 26 Mar 2024 02:09:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711418966; 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=MdiFaFxXMP4PmDt6o4r+LSOeYMiNmh0dGc5uKEoNljk=; b=cJGSruzRvQMIvNGBZ0FapGs1IgeifkDaxtP1IO8ivWBDKCRY+4S0WdiCnk7/JH52E6JLfl zRUVclAFmbwlnBGn6A9DLL1QniFP0xDOZoJDAgsN2ubsdmX3z406QrbsnLmn9Zx0N2KFur 7lsfKn5JCSRullgBXtPzTIf5Ikve2+5O70pvyMVK0tW0NuYpKcCVGEEGy3uUhJl4Jkwnch heNw+PSPuivdovwS+s3zlQFYSyA4mqZU4mZ6hSQlgpOOIaFzU+v2w4GaOdqmcWf4TKGxLp XrZ5XrM+AjKke1w9L6RSWBTQ5hl0Djwrkcuplk3Mtv/28irsgH2qvUebQgEMww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711418966; a=rsa-sha256; cv=none; b=ku0uM5bYyMOvP350hQVdiF6Cft81wJ5h4mR8X6ErAugfWfRcoUygMYjNiDJ3SdhH6Wfm+o Mx2sJDJJ0BU3Tag8c/X2ClkUkxkQ8s1sKEDpxr4dLX++LUhw0g3q6qALIbB9x3UZEjSSDr bqs2NVsNKumaJBNfUhVAu1kecd2jFtvOChS6JF73GupArIzAFMfBFLX9SWhbZwMHG9fXcX 87YSQ4XkNuIn0sJW5Wo7PAuv3e9Do+u1OWHKpziIY4G4EqQkt4K+bG/KBkLTtdyg3R1q2s nkAKANAQ6ULNhEi9y/1k3FpC4pUMJKNrHRbF9weNV6kPPWyfphJc5K3nbLqbkA== 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=1711418966; 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=MdiFaFxXMP4PmDt6o4r+LSOeYMiNmh0dGc5uKEoNljk=; b=nvKNHFE1cTCUIFxFdq6nNU+4nJTf6YZBbdDx7gCqizOFPbTEgemJKzDuc5qj+49j6mtT64 cgOJmnite8L8oCYdrgSdFanQHZhy/OjGxUmNuliVPi/DNKUmGFQTe1HIMo2qALb20WgPcM RF7AWrLFVl7ijuc/nUu5QeirXj6uwrTH9gZ26wbTQFb/orsbTTAHhlm/JSdhnI10z3ySkV qrJfnMQrqGrjsUFOs93+OITV/GUnB6qq0tY4Ee5yz8vW2N29RZkJ/T3ICHxXh/GnF/fLdd 3LevTzr9MGsdGIMP7XAWXZ0sGNsxtNeBAmU7VMJqCAb86IpJ1xdh8t2W3wBiCQ== 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 4V3YCB4HMrzhMS; Tue, 26 Mar 2024 02:09:26 +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 42Q29QGJ013820; Tue, 26 Mar 2024 02:09:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42Q29QLU013817; Tue, 26 Mar 2024 02:09:26 GMT (envelope-from git) Date: Tue, 26 Mar 2024 02:09:26 GMT Message-Id: <202403260209.42Q29QLU013817@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 960d151eaa1e - main - x86: test the right CPUID bit when checking for XSAVEOPT support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 960d151eaa1ecde109accc30ca0c3306551d8e58 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=960d151eaa1ecde109accc30ca0c3306551d8e58 commit 960d151eaa1ecde109accc30ca0c3306551d8e58 Author: Konstantin Belousov AuthorDate: 2024-03-25 10:34:06 +0000 Commit: Konstantin Belousov CommitDate: 2024-03-26 02:01:30 +0000 x86: test the right CPUID bit when checking for XSAVEOPT support Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44497 --- 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 83bcc8f0776d..dcc6ff1a03a8 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -233,9 +233,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 25c760ca55e7..16ad7a96ab35 100644 --- a/sys/i386/i386/npx.c +++ b/sys/i386/i386/npx.c @@ -315,9 +315,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);