Author: kib
Date: Mon Aug 14 11:20:54 2017
New Revision: 322495
URL: https://svnweb.freebsd.org/changeset/base/322495

Log:
  Add {rd,wr}{fs,gs}base C wrappers for instructions.
  
  Tested by:    pho (as part of the larger patch)
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/sys/amd64/include/cpufunc.h

Modified: head/sys/amd64/include/cpufunc.h
==============================================================================
--- head/sys/amd64/include/cpufunc.h    Mon Aug 14 11:20:10 2017        
(r322494)
+++ head/sys/amd64/include/cpufunc.h    Mon Aug 14 11:20:54 2017        
(r322495)
@@ -651,6 +651,38 @@ load_gs(u_short sel)
 }
 #endif
 
+static __inline uint64_t
+rdfsbase(void)
+{
+       uint64_t x;
+
+       __asm __volatile("rdfsbase %0" : "=r" (x));
+       return (x);
+}
+
+static __inline void
+wrfsbase(uint64_t x)
+{
+
+       __asm __volatile("wrfsbase %0" : : "r" (x));
+}
+
+static __inline uint64_t
+rdgsbase(void)
+{
+       uint64_t x;
+
+       __asm __volatile("rdgsbase %0" : "=r" (x));
+       return (x);
+}
+
+static __inline void
+wrgsbase(uint64_t x)
+{
+
+       __asm __volatile("wrgsbase %0" : : "r" (x));
+}
+
 static __inline void
 bare_lgdt(struct region_descriptor *addr)
 {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to