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