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

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

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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 */
  2 #ifndef _ASM_X86_LINKAGE_H
  3 #define _ASM_X86_LINKAGE_H
  4 
  5 #include <linux/stringify.h>
  6 #include <asm/ibt.h>
  7 
  8 #undef notrace
  9 #define notrace __attribute__((no_instrument_function))
 10 
 11 #ifdef CONFIG_64BIT
 12 /*
 13  * The generic version tends to create spurious ENDBR instructions under
 14  * certain conditions.
 15  */
 16 #define _THIS_IP_ ({ unsigned long __here; asm ("lea 0(%%rip), %0" : "=r" (__here)); __here; })
 17 #endif
 18 
 19 #ifdef CONFIG_X86_32
 20 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
 21 #endif /* CONFIG_X86_32 */
 22 
 23 #define __ALIGN         .balign CONFIG_FUNCTION_ALIGNMENT, 0x90;
 24 #define __ALIGN_STR     __stringify(__ALIGN)
 25 
 26 #if defined(CONFIG_CALL_PADDING) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
 27 #define FUNCTION_PADDING        .skip CONFIG_FUNCTION_ALIGNMENT, 0x90;
 28 #else
 29 #define FUNCTION_PADDING
 30 #endif
 31 
 32 #if (CONFIG_FUNCTION_ALIGNMENT > 8) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
 33 # define __FUNC_ALIGN           __ALIGN; FUNCTION_PADDING
 34 #else
 35 # define __FUNC_ALIGN           __ALIGN
 36 #endif
 37 
 38 #define ASM_FUNC_ALIGN          __stringify(__FUNC_ALIGN)
 39 #define SYM_F_ALIGN             __FUNC_ALIGN
 40 
 41 #ifdef __ASSEMBLY__
 42 
 43 #if defined(CONFIG_MITIGATION_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
 44 #define RET     jmp __x86_return_thunk
 45 #else /* CONFIG_MITIGATION_RETPOLINE */
 46 #ifdef CONFIG_MITIGATION_SLS
 47 #define RET     ret; int3
 48 #else
 49 #define RET     ret
 50 #endif
 51 #endif /* CONFIG_MITIGATION_RETPOLINE */
 52 
 53 #else /* __ASSEMBLY__ */
 54 
 55 #if defined(CONFIG_MITIGATION_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
 56 #define ASM_RET "jmp __x86_return_thunk\n\t"
 57 #else /* CONFIG_MITIGATION_RETPOLINE */
 58 #ifdef CONFIG_MITIGATION_SLS
 59 #define ASM_RET "ret; int3\n\t"
 60 #else
 61 #define ASM_RET "ret\n\t"
 62 #endif
 63 #endif /* CONFIG_MITIGATION_RETPOLINE */
 64 
 65 #endif /* __ASSEMBLY__ */
 66 
 67 /*
 68  * Depending on -fpatchable-function-entry=N,N usage (CONFIG_CALL_PADDING) the
 69  * CFI symbol layout changes.
 70  *
 71  * Without CALL_THUNKS:
 72  *
 73  *      .align  FUNCTION_ALIGNMENT
 74  * __cfi_##name:
 75  *      .skip   FUNCTION_PADDING, 0x90
 76  *      .byte   0xb8
 77  *      .long   __kcfi_typeid_##name
 78  * name:
 79  *
 80  * With CALL_THUNKS:
 81  *
 82  *      .align FUNCTION_ALIGNMENT
 83  * __cfi_##name:
 84  *      .byte   0xb8
 85  *      .long   __kcfi_typeid_##name
 86  *      .skip   FUNCTION_PADDING, 0x90
 87  * name:
 88  *
 89  * In both cases the whole thing is FUNCTION_ALIGNMENT aligned and sized.
 90  */
 91 
 92 #ifdef CONFIG_CALL_PADDING
 93 #define CFI_PRE_PADDING
 94 #define CFI_POST_PADDING        .skip   CONFIG_FUNCTION_PADDING_BYTES, 0x90;
 95 #else
 96 #define CFI_PRE_PADDING         .skip   CONFIG_FUNCTION_PADDING_BYTES, 0x90;
 97 #define CFI_POST_PADDING
 98 #endif
 99 
100 #define __CFI_TYPE(name)                                        \
101         SYM_START(__cfi_##name, SYM_L_LOCAL, SYM_A_NONE)        \
102         CFI_PRE_PADDING                                         \
103         .byte 0xb8 ASM_NL                                       \
104         .long __kcfi_typeid_##name ASM_NL                       \
105         CFI_POST_PADDING                                        \
106         SYM_FUNC_END(__cfi_##name)
107 
108 /* UML needs to be able to override memcpy() and friends for KASAN. */
109 #ifdef CONFIG_UML
110 # define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS_WEAK
111 #else
112 # define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS
113 #endif
114 
115 /* SYM_TYPED_FUNC_START -- use for indirectly called globals, w/ CFI type */
116 #define SYM_TYPED_FUNC_START(name)                              \
117         SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_F_ALIGN)        \
118         ENDBR
119 
120 /* SYM_FUNC_START -- use for global functions */
121 #define SYM_FUNC_START(name)                            \
122         SYM_START(name, SYM_L_GLOBAL, SYM_F_ALIGN)      \
123         ENDBR
124 
125 /* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */
126 #define SYM_FUNC_START_NOALIGN(name)                    \
127         SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)       \
128         ENDBR
129 
130 /* SYM_FUNC_START_LOCAL -- use for local functions */
131 #define SYM_FUNC_START_LOCAL(name)                      \
132         SYM_START(name, SYM_L_LOCAL, SYM_F_ALIGN)       \
133         ENDBR
134 
135 /* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */
136 #define SYM_FUNC_START_LOCAL_NOALIGN(name)              \
137         SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)        \
138         ENDBR
139 
140 /* SYM_FUNC_START_WEAK -- use for weak functions */
141 #define SYM_FUNC_START_WEAK(name)                       \
142         SYM_START(name, SYM_L_WEAK, SYM_F_ALIGN)        \
143         ENDBR
144 
145 /* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */
146 #define SYM_FUNC_START_WEAK_NOALIGN(name)               \
147         SYM_START(name, SYM_L_WEAK, SYM_A_NONE)         \
148         ENDBR
149 
150 #endif /* _ASM_X86_LINKAGE_H */
151 
152 

~ [ 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