]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef _LINUX_LINKAGE_H |
2 | #define _LINUX_LINKAGE_H | |
3 | ||
a7bf0bd5 | 4 | #include <linux/compiler.h> |
e1b5bb6d | 5 | #include <linux/stringify.h> |
1da177e4 LT |
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 | ||
e1b5bb6d | 18 | #ifdef CONFIG_SYMBOL_PREFIX |
126de6b2 | 19 | #define __SYMBOL_NAME(x) CONFIG_SYMBOL_PREFIX __stringify(x) |
e1b5bb6d | 20 | #else |
126de6b2 | 21 | #define __SYMBOL_NAME(x) __stringify(x) |
e1b5bb6d | 22 | #endif |
e1b5bb6d AV |
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 | ||
75b13483 | 35 | #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) |
7c74df07 | 36 | #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) |
a7bf0bd5 | 37 | |
d2af12ae TA |
38 | /* |
39 | * For assembly routines. | |
40 | * | |
41 | * Note when using these that you must specify the appropriate | |
42 | * alignment directives yourself | |
43 | */ | |
75b13483 | 44 | #define __PAGE_ALIGNED_DATA .section ".data..page_aligned", "aw" |
7c74df07 | 45 | #define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw" |
d2af12ae | 46 | |
d10d89ec LT |
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 | */ | |
b0fac023 HC |
60 | /* Assembly files may be compiled with -traditional .. */ |
61 | #ifndef __ASSEMBLY__ | |
54a01510 RM |
62 | #ifndef asmlinkage_protect |
63 | # define asmlinkage_protect(n, ret, args...) do { } while (0) | |
1da177e4 | 64 | #endif |
b0fac023 | 65 | #endif |
1da177e4 LT |
66 | |
67 | #ifndef __ALIGN | |
68 | #define __ALIGN .align 4,0x90 | |
69 | #define __ALIGN_STR ".align 4,0x90" | |
70 | #endif | |
71 | ||
72 | #ifdef __ASSEMBLY__ | |
73 | ||
42f29a25 | 74 | #ifndef LINKER_SCRIPT |
1da177e4 LT |
75 | #define ALIGN __ALIGN |
76 | #define ALIGN_STR __ALIGN_STR | |
77 | ||
ab7efcc9 | 78 | #ifndef ENTRY |
1da177e4 LT |
79 | #define ENTRY(name) \ |
80 | .globl name; \ | |
81 | ALIGN; \ | |
82 | name: | |
ab7efcc9 | 83 | #endif |
42f29a25 | 84 | #endif /* LINKER_SCRIPT */ |
1da177e4 | 85 | |
214541d1 RR |
86 | #ifndef WEAK |
87 | #define WEAK(name) \ | |
88 | .weak name; \ | |
89 | name: | |
90 | #endif | |
91 | ||
ab7efcc9 JB |
92 | #ifndef END |
93 | #define END(name) \ | |
94 | .size name, .-name | |
95 | #endif | |
96 | ||
6b8be6df JR |
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 | */ | |
ab7efcc9 JB |
101 | #ifndef ENDPROC |
102 | #define ENDPROC(name) \ | |
103 | .type name, @function; \ | |
104 | END(name) | |
105 | #endif | |
d0aaff97 | 106 | |
1da177e4 LT |
107 | #endif |
108 | ||
1da177e4 | 109 | #endif |