xref: /openbmc/linux/arch/x86/include/asm/linkage.h (revision ccc319dc)
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_X86_32
12 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
13 #endif /* CONFIG_X86_32 */
14 
15 #ifdef __ASSEMBLY__
16 
17 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16)
18 #define __ALIGN		.p2align 4, 0x90
19 #define __ALIGN_STR	__stringify(__ALIGN)
20 #endif
21 
22 #ifdef CONFIG_SLS
23 #define RET	ret; int3
24 #else
25 #define RET	ret
26 #endif
27 
28 #else /* __ASSEMBLY__ */
29 
30 #ifdef CONFIG_SLS
31 #define ASM_RET	"ret; int3\n\t"
32 #else
33 #define ASM_RET	"ret\n\t"
34 #endif
35 
36 #endif /* __ASSEMBLY__ */
37 
38 /* SYM_FUNC_START -- use for global functions */
39 #define SYM_FUNC_START(name)				\
40 	SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)	\
41 	ENDBR
42 
43 /* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */
44 #define SYM_FUNC_START_NOALIGN(name)			\
45 	SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)	\
46 	ENDBR
47 
48 /* SYM_FUNC_START_LOCAL -- use for local functions */
49 #define SYM_FUNC_START_LOCAL(name)			\
50 	SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)	\
51 	ENDBR
52 
53 /* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */
54 #define SYM_FUNC_START_LOCAL_NOALIGN(name)		\
55 	SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)	\
56 	ENDBR
57 
58 /* SYM_FUNC_START_WEAK -- use for weak functions */
59 #define SYM_FUNC_START_WEAK(name)			\
60 	SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN)	\
61 	ENDBR
62 
63 /* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */
64 #define SYM_FUNC_START_WEAK_NOALIGN(name)		\
65 	SYM_START(name, SYM_L_WEAK, SYM_A_NONE)		\
66 	ENDBR
67 
68 #endif /* _ASM_X86_LINKAGE_H */
69 
70