return base;
}
+static inline void __wrfsbase(unsigned long base)
+{
+#ifdef HAVE_AS_FSGSBASE
+ asm volatile ( "wrfsbase %0" :: "r" (base) );
+#else
+ asm volatile ( ".byte 0xf3, 0x48, 0x0f, 0xae, 0xd0" :: "a" (base) );
+#endif
+}
+
+static inline void __wrgsbase(unsigned long base)
+{
+#ifdef HAVE_AS_FSGSBASE
+ asm volatile ( "wrgsbase %0" :: "r" (base) );
+#else
+ asm volatile ( ".byte 0xf3, 0x48, 0x0f, 0xae, 0xd8" :: "a" (base) );
+#endif
+}
+
static inline unsigned long read_fs_base(void)
{
unsigned long base;
static inline void write_fs_base(unsigned long base)
{
if ( read_cr4() & X86_CR4_FSGSBASE )
-#ifdef HAVE_AS_FSGSBASE
- asm volatile ( "wrfsbase %0" :: "r" (base) );
-#else
- asm volatile ( ".byte 0xf3, 0x48, 0x0f, 0xae, 0xd0" :: "a" (base) );
-#endif
+ __wrfsbase(base);
else
wrmsrl(MSR_FS_BASE, base);
}
static inline void write_gs_base(unsigned long base)
{
if ( read_cr4() & X86_CR4_FSGSBASE )
-#ifdef HAVE_AS_FSGSBASE
- asm volatile ( "wrgsbase %0" :: "r" (base) );
-#else
- asm volatile ( ".byte 0xf3, 0x48, 0x0f, 0xae, 0xd8" :: "a" (base) );
-#endif
+ __wrgsbase(base);
else
wrmsrl(MSR_GS_BASE, base);
}