Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Aug 2013 07:42:38 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255058 - head/sys/amd64/include
Message-ID:  <201308300742.r7U7gcEw053190@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308300742.r7U7gcEw053190>