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)
 {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to