From nobody Sun Dec 15 15:40:37 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 4YB6jL09Bpz5gyCg; Sun, 15 Dec 2024 15:40:38 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YB6jK2Bspz40Nq; Sun, 15 Dec 2024 15:40:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734277237; 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=j3x6vjBQePddEoU+0hmYNJRGO7Tk4BwAQprLO7LsG8g=; b=VQtcNEGVAPxxA/MvZsDn2RvXDB1488Gxv84Xyqj62P7NcsNEnEM62W8tlWv8aqfqy1ANh5 XJX88pjhycxXKKm4TbVpgOuMJkU6PKHddBfgNpZTd8bHljMxUidlYpLr9B8Xjvm31id+oE F6v392+ehdRzRlQZXfCVglupw/WmIir0lJcRYkdo2Kt0flU02s9ypv/0zf9pa1qlyPn1/K 46EpT3BvuZ2tspdHuR0bRBRXJ5wNjZP7LoQy+KWLHVRoNhPTmaz1PusSqhDAWJLxZswK5r mH6thgYLZmX6Lwjubv0nXxj3nXCf8J7YOY2Cg/a5e+qrR3s/WkZHAnehj5psaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734277237; 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=j3x6vjBQePddEoU+0hmYNJRGO7Tk4BwAQprLO7LsG8g=; b=SM76mebdCvt0ROHbr8x9YlGjtIDx7sNxqmNdAibdzDsRe5jYoX89FinlYXC99VkXvkDFOg 8V8zq3MzLrr1qCPrNsjosBA+k6fj7DDPzr+6XdOS7CPap6fgf13g/TPLv/l+UON8m4OXiO JzgNxOsd8RGIZ0lQLszLn+WFckCruD2sN+xRvmvcbEkReNoWyKNwpFQJUuDGFT/v6uOJdl LQdMKzpzD4KH9erPyCnuhZcpSuArpOYybFOrfxuVaMOrjFiqeKHtH2i2Qas5G0O+cX0WUq LTGQomifKfZ+AI1I5MfjOeTk/dy5QgAOkPJclAyqbrLGOIqx4mDFwJJQjAfzlA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734277237; a=rsa-sha256; cv=none; b=SaFMsEgeIkRMcG9oDzd1RHsPIALrDMfdGRpX5iHSuEgHeuUrDhYWvsouq12ZnJKyKEfY5N aXb0Mg98GHHsUdHoMVoLXz/GaYgV71yPBLFo9NGGSLls2WTwjWociUXhBq07NjhjNktHQi Zg8TzAHYsairlr/gaRJzNEWIqh21br3Hc/7Z8dWK5yKGSAL4dx9oxiDnuiuBWv9JaNKJ0K nwsqpWMUCzZ5kwNSNmmNqOwumix8rBOK0Y1bvuPXcKRy9Af7r3Nlq40lZFeWh2CvzCiTab n2XBzldxZlyBec6PHoEaDWHfMGuE+/bu2mpmJZ4VtNwOXr24NefjksOiup8e8g== 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 4YB6jK1pKSzDw9; Sun, 15 Dec 2024 15:40:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BFFebas069397; Sun, 15 Dec 2024 15:40:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BFFebXj069394; Sun, 15 Dec 2024 15:40:37 GMT (envelope-from git) Date: Sun, 15 Dec 2024 15:40:37 GMT Message-Id: <202412151540.4BFFebXj069394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: 593e874e6124 - main - amd64: Add wrappers for XRSTORS and XSAVES 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 593e874e61249c845ca83e9284e4d9061643e8fb Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=593e874e61249c845ca83e9284e4d9061643e8fb commit 593e874e61249c845ca83e9284e4d9061643e8fb Author: Bojan Novković AuthorDate: 2024-12-15 14:02:13 +0000 Commit: Bojan Novković CommitDate: 2024-12-15 15:39:36 +0000 amd64: Add wrappers for XRSTORS and XSAVES Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46984 --- sys/amd64/include/cpufunc.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index ca53d73b0186..d180f5c76afb 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -942,6 +942,29 @@ sgx_eremove(void *epc) return (sgx_encls(SGX_EREMOVE, 0, (uint64_t)epc, 0)); } +static __inline void +xrstors(uint8_t *save_area, uint64_t state_bitmap) +{ + uint32_t low, hi; + + low = state_bitmap; + hi = state_bitmap >> 32; + __asm __volatile("xrstors %0" : : "m"(*save_area), "a"(low), + "d"(hi)); +} + +static __inline void +xsaves(uint8_t *save_area, uint64_t state_bitmap) +{ + uint32_t low, hi; + + low = state_bitmap; + hi = state_bitmap >> 32; + __asm __volatile("xsaves %0" : "=m"(*save_area) : "a"(low), + "d"(hi) + : "memory"); +} + void reset_dbregs(void); #ifdef _KERNEL