1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_LINKAGE_H
3 #define _LINUX_LINKAGE_H
5 #include <linux/compiler_types.h>
6 #include <linux/stringify.h>
7 #include <linux/export.h>
8 #include <asm/linkage.h>
10 /* Some toolchains use other characters (e.g. '`') to mark new line in macro */
16 #define CPP_ASMLINKAGE extern "C"
18 #define CPP_ASMLINKAGE
22 #define asmlinkage CPP_ASMLINKAGE
26 #define cond_syscall(x) asm( \
27 ".weak " VMLINUX_SYMBOL_STR(x) "\n\t" \
28 ".set " VMLINUX_SYMBOL_STR(x) "," \
29 VMLINUX_SYMBOL_STR(sys_ni_syscall))
33 #define SYSCALL_ALIAS(alias, name) asm( \
34 ".globl " VMLINUX_SYMBOL_STR(alias) "\n\t" \
35 ".set " VMLINUX_SYMBOL_STR(alias) "," \
36 VMLINUX_SYMBOL_STR(name))
39 #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE)
40 #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE)
43 * For assembly routines.
45 * Note when using these that you must specify the appropriate
46 * alignment directives yourself
48 #define __PAGE_ALIGNED_DATA .section ".data..page_aligned", "aw"
49 #define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw"
52 * This is used by architectures to keep arguments on the stack
53 * untouched by the compiler by keeping them live until the end.
54 * The argument stack may be owned by the assembly-language
55 * caller, not the callee, and gcc doesn't always understand
58 * We have the return value, and a maximum of six arguments.
60 * This should always be followed by a "return ret" for the
61 * protection to work (ie no more work that the compiler might
62 * end up needing stack temporaries for).
64 /* Assembly files may be compiled with -traditional .. */
66 #ifndef asmlinkage_protect
67 # define asmlinkage_protect(n, ret, args...) do { } while (0)
72 #define __ALIGN .align 4,0x90
73 #define __ALIGN_STR ".align 4,0x90"
80 #define ALIGN_STR __ALIGN_STR
88 #endif /* LINKER_SCRIPT */
101 /* If symbol 'name' is treated as a subroutine (gets called, and returns)
102 * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
103 * static analysis tools such as stack depth analyzer.
106 #define ENDPROC(name) \
107 .type name, @function ASM_NL \