18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_LINKAGE_H
38c2ecf20Sopenharmony_ci#define _ASM_X86_LINKAGE_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/stringify.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#undef notrace
88c2ecf20Sopenharmony_ci#define notrace __attribute__((no_instrument_function))
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_32
118c2ecf20Sopenharmony_ci#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
128c2ecf20Sopenharmony_ci#endif /* CONFIG_X86_32 */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#ifdef __ASSEMBLY__
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16)
178c2ecf20Sopenharmony_ci#define __ALIGN		.p2align 4, 0x90
188c2ecf20Sopenharmony_ci#define __ALIGN_STR	__stringify(__ALIGN)
198c2ecf20Sopenharmony_ci#endif
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
228c2ecf20Sopenharmony_ci#define RET	jmp __x86_return_thunk
238c2ecf20Sopenharmony_ci#else /* CONFIG_RETPOLINE */
248c2ecf20Sopenharmony_ci#ifdef CONFIG_SLS
258c2ecf20Sopenharmony_ci#define RET	ret; int3
268c2ecf20Sopenharmony_ci#else
278c2ecf20Sopenharmony_ci#define RET	ret
288c2ecf20Sopenharmony_ci#endif
298c2ecf20Sopenharmony_ci#endif /* CONFIG_RETPOLINE */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#else /* __ASSEMBLY__ */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
348c2ecf20Sopenharmony_ci#define ASM_RET	"jmp __x86_return_thunk\n\t"
358c2ecf20Sopenharmony_ci#else /* CONFIG_RETPOLINE */
368c2ecf20Sopenharmony_ci#ifdef CONFIG_SLS
378c2ecf20Sopenharmony_ci#define ASM_RET	"ret; int3\n\t"
388c2ecf20Sopenharmony_ci#else
398c2ecf20Sopenharmony_ci#define ASM_RET	"ret\n\t"
408c2ecf20Sopenharmony_ci#endif
418c2ecf20Sopenharmony_ci#endif /* CONFIG_RETPOLINE */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#endif /* _ASM_X86_LINKAGE_H */
468c2ecf20Sopenharmony_ci
47