From owner-svn-src-head@FreeBSD.ORG Fri Aug 30 07:42:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C693C9DC; Fri, 30 Aug 2013 07:42:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B4B192DB0; Fri, 30 Aug 2013 07:42:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7U7gcRD053191; Fri, 30 Aug 2013 07:42:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7U7gcEw053190; Fri, 30 Aug 2013 07:42:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201308300742.r7U7gcEw053190@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 30 Aug 2013 07:42:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255058 - head/sys/amd64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Aug 2013 07:42:38 -0000 Author: kib Date: Fri Aug 30 07:42:38 2013 New Revision: 255058 URL: http://svnweb.freebsd.org/changeset/base/255058 Log: Provide a wrapper for the INVPCID instruction, definition of the descriptor and symbolic names for the operation types. Sponsored by: The FreeBSD Foundation Reviewed by: alc Tested by: pho, bf Modified: head/sys/amd64/include/cpufunc.h Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Fri Aug 30 07:37:45 2013 (r255057) +++ head/sys/amd64/include/cpufunc.h Fri Aug 30 07:42:38 2013 (r255058) @@ -472,6 +472,26 @@ invlpg(u_long addr) __asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory"); } +#define INVPCID_ADDR 0 +#define INVPCID_CTX 1 +#define INVPCID_CTXGLOB 2 +#define INVPCID_ALLCTX 3 + +struct invpcid_descr { + uint64_t pcid:12 __packed; + uint64_t pad:52 __packed; + uint64_t addr; +} __packed; + +static __inline void +invpcid(struct invpcid_descr *d, int type) +{ + + /* invpcid (%rdx),%rax */ + __asm __volatile(".byte 0x66,0x0f,0x38,0x82,0x02" + : : "d" (d), "a" ((u_long)type) : "memory"); +} + static __inline u_short rfs(void) {