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