~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/include/asm/gsseg.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 #ifndef _ASM_X86_GSSEG_H
  3 #define _ASM_X86_GSSEG_H
  4 
  5 #include <linux/types.h>
  6 
  7 #include <asm/asm.h>
  8 #include <asm/cpufeature.h>
  9 #include <asm/alternative.h>
 10 #include <asm/processor.h>
 11 #include <asm/nops.h>
 12 
 13 #ifdef CONFIG_X86_64
 14 
 15 extern asmlinkage void asm_load_gs_index(u16 selector);
 16 
 17 /* Replace with "lkgs %di" once binutils support LKGS instruction */
 18 #define LKGS_DI _ASM_BYTES(0xf2,0x0f,0x00,0xf7)
 19 
 20 static inline void native_lkgs(unsigned int selector)
 21 {
 22         u16 sel = selector;
 23         asm_inline volatile("1: " LKGS_DI
 24                             _ASM_EXTABLE_TYPE_REG(1b, 1b, EX_TYPE_ZERO_REG, %k[sel])
 25                             : [sel] "+D" (sel));
 26 }
 27 
 28 static inline void native_load_gs_index(unsigned int selector)
 29 {
 30         if (cpu_feature_enabled(X86_FEATURE_LKGS)) {
 31                 native_lkgs(selector);
 32         } else {
 33                 unsigned long flags;
 34 
 35                 local_irq_save(flags);
 36                 asm_load_gs_index(selector);
 37                 local_irq_restore(flags);
 38         }
 39 }
 40 
 41 #endif /* CONFIG_X86_64 */
 42 
 43 static inline void __init lkgs_init(void)
 44 {
 45 #ifdef CONFIG_PARAVIRT_XXL
 46 #ifdef CONFIG_X86_64
 47         if (cpu_feature_enabled(X86_FEATURE_LKGS))
 48                 pv_ops.cpu.load_gs_index = native_lkgs;
 49 #endif
 50 #endif
 51 }
 52 
 53 #ifndef CONFIG_PARAVIRT_XXL
 54 
 55 static inline void load_gs_index(unsigned int selector)
 56 {
 57 #ifdef CONFIG_X86_64
 58         native_load_gs_index(selector);
 59 #else
 60         loadsegment(gs, selector);
 61 #endif
 62 }
 63 
 64 #endif /* CONFIG_PARAVIRT_XXL */
 65 
 66 #endif /* _ASM_X86_GSSEG_H */
 67 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php