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
This commit is contained in:
Konstantin Belousov 2017-08-14 11:20:54 +00:00
parent 7bf0049e48
commit 0fd7ea1f21

View file

@ -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)
{