]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - include/linux/linkage.h
Merge remote-tracking branch 'signal/for-next'
[karo-tx-linux.git] / include / linux / linkage.h
1 #ifndef _LINUX_LINKAGE_H
2 #define _LINUX_LINKAGE_H
3
4 #include <linux/compiler.h>
5 #include <linux/export.h>
6 #include <asm/linkage.h>
7
8 #ifdef __cplusplus
9 #define CPP_ASMLINKAGE extern "C"
10 #else
11 #define CPP_ASMLINKAGE
12 #endif
13
14 #ifndef asmlinkage
15 #define asmlinkage CPP_ASMLINKAGE
16 #endif
17
18 #ifndef cond_syscall
19 #define cond_syscall(x) asm(".weak\t" VMLINUX_SYMBOL_STR(x) "\n\t"      \
20                             ".set\t" VMLINUX_SYMBOL_STR(x) ","  \
21                             VMLINUX_SYMBOL_STR(sys_ni_syscall))
22 #endif
23
24 #ifndef SYSCALL_ALIAS
25 #define SYSCALL_ALIAS(alias, name)                              \
26         asm ("\t.globl " VMLINUX_SYMBOL_STR(alias)                      \
27         "\n\t.set\t" VMLINUX_SYMBOL_STR(alias) "," VMLINUX_SYMBOL_STR(name))
28 #endif
29
30 #define __page_aligned_data     __section(.data..page_aligned) __aligned(PAGE_SIZE)
31 #define __page_aligned_bss      __section(.bss..page_aligned) __aligned(PAGE_SIZE)
32
33 /*
34  * For assembly routines.
35  *
36  * Note when using these that you must specify the appropriate
37  * alignment directives yourself
38  */
39 #define __PAGE_ALIGNED_DATA     .section ".data..page_aligned", "aw"
40 #define __PAGE_ALIGNED_BSS      .section ".bss..page_aligned", "aw"
41
42 /*
43  * This is used by architectures to keep arguments on the stack
44  * untouched by the compiler by keeping them live until the end.
45  * The argument stack may be owned by the assembly-language
46  * caller, not the callee, and gcc doesn't always understand
47  * that.
48  *
49  * We have the return value, and a maximum of six arguments.
50  *
51  * This should always be followed by a "return ret" for the
52  * protection to work (ie no more work that the compiler might
53  * end up needing stack temporaries for).
54  */
55 /* Assembly files may be compiled with -traditional .. */
56 #ifndef __ASSEMBLY__
57 #ifndef asmlinkage_protect
58 # define asmlinkage_protect(n, ret, args...)    do { } while (0)
59 #endif
60 #endif
61
62 #ifndef __ALIGN
63 #define __ALIGN         .align 4,0x90
64 #define __ALIGN_STR     ".align 4,0x90"
65 #endif
66
67 #ifdef __ASSEMBLY__
68
69 #ifndef LINKER_SCRIPT
70 #define ALIGN __ALIGN
71 #define ALIGN_STR __ALIGN_STR
72
73 #ifndef ENTRY
74 #define ENTRY(name) \
75   .globl name; \
76   ALIGN; \
77   name:
78 #endif
79 #endif /* LINKER_SCRIPT */
80
81 #ifndef WEAK
82 #define WEAK(name)         \
83         .weak name;        \
84         name:
85 #endif
86
87 #ifndef END
88 #define END(name) \
89   .size name, .-name
90 #endif
91
92 /* If symbol 'name' is treated as a subroutine (gets called, and returns)
93  * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
94  * static analysis tools such as stack depth analyzer.
95  */
96 #ifndef ENDPROC
97 #define ENDPROC(name) \
98   .type name, @function; \
99   END(name)
100 #endif
101
102 #endif
103
104 #endif