]> xenbits.xensource.com Git - xen.git/commitdiff
x86/msr: Remove HAVE_AS_FSGSBASE
authorDenis Mukhin <dmukhin@ford.com>
Thu, 3 Apr 2025 18:23:09 +0000 (18:23 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 3 Apr 2025 20:29:34 +0000 (21:29 +0100)
The new toolchain baseline knows the {RD,WR}{F,G}SBASE instructions; no need
to carry the workaround in the code.

No functional change.

Resolves: https://gitlab.com/xen-project/xen/-/work_items/207
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/arch.mk
xen/arch/x86/include/asm/msr.h

index e9fa1c92d75ba7102cdfd7ab0d90c453d5c61256..6d2876b1a8c6bfa7732f69c9b1476e5ed42d50d3 100644 (file)
@@ -12,7 +12,6 @@ $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-option-add,CFLAGS,CC,"crc32 %eax$(comma)%eax",-DHAVE_AS_SSE4_2)
 $(call as-option-add,CFLAGS,CC,"rdrand %eax",-DHAVE_AS_RDRAND)
-$(call as-option-add,CFLAGS,CC,"rdfsbase %rax",-DHAVE_AS_FSGSBASE)
 $(call as-option-add,CFLAGS,CC,"xsaveopt (%rax)",-DHAVE_AS_XSAVEOPT)
 $(call as-option-add,CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED)
 $(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB)
index 549d40b404cb14bbccaf5b6b6e52e84cc61c6cd3..0d3b1d63748863e798200f6ae475b3456bcce221 100644 (file)
@@ -152,11 +152,7 @@ static inline unsigned long __rdfsbase(void)
 {
     unsigned long base;
 
-#ifdef HAVE_AS_FSGSBASE
     asm volatile ( "rdfsbase %0" : "=r" (base) );
-#else
-    asm volatile ( ".byte 0xf3, 0x48, 0x0f, 0xae, 0xc0" : "=a" (base) );
-#endif
 
     return base;
 }
@@ -165,31 +161,19 @@ static inline unsigned long __rdgsbase(void)
 {
     unsigned long base;
 
-#ifdef HAVE_AS_FSGSBASE
     asm volatile ( "rdgsbase %0" : "=r" (base) );
-#else
-    asm volatile ( ".byte 0xf3, 0x48, 0x0f, 0xae, 0xc8" : "=a" (base) );
-#endif
 
     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)
@@ -253,15 +237,9 @@ static inline void write_gs_shadow(unsigned long base)
     if ( read_cr4() & X86_CR4_FSGSBASE )
     {
         asm volatile ( "swapgs\n\t"
-#ifdef HAVE_AS_FSGSBASE
                        "wrgsbase %0\n\t"
                        "swapgs"
                        :: "r" (base) );
-#else
-                       ".byte 0xf3, 0x48, 0x0f, 0xae, 0xd8\n\t"
-                       "swapgs"
-                       :: "a" (base) );
-#endif
     }
     else
         wrmsrl(MSR_SHADOW_GS_BASE, base);