Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / include / linux / linkage.h
blob2119610b24f812fe1c80a6f806c679af11d56ab9
1 #ifndef _LINUX_LINKAGE_H
2 #define _LINUX_LINKAGE_H
4 #include <asm/linkage.h>
6 #ifdef __cplusplus
7 #define CPP_ASMLINKAGE extern "C"
8 #else
9 #define CPP_ASMLINKAGE
10 #endif
12 #ifndef asmlinkage
13 #define asmlinkage CPP_ASMLINKAGE
14 #endif
16 #ifndef asmregparm
17 # define asmregparm
18 #endif
21 * This is used by architectures to keep arguments on the stack
22 * untouched by the compiler by keeping them live until the end.
23 * The argument stack may be owned by the assembly-language
24 * caller, not the callee, and gcc doesn't always understand
25 * that.
27 * We have the return value, and a maximum of six arguments.
29 * This should always be followed by a "return ret" for the
30 * protection to work (ie no more work that the compiler might
31 * end up needing stack temporaries for).
33 /* Assembly files may be compiled with -traditional .. */
34 #ifndef __ASSEMBLY__
35 #ifndef asmlinkage_protect
36 # define asmlinkage_protect(n, ret, args...) do { } while (0)
37 #endif
38 #endif
40 #ifndef __ALIGN
41 #define __ALIGN .align 4,0x90
42 #define __ALIGN_STR ".align 4,0x90"
43 #endif
45 #ifdef __ASSEMBLY__
47 #define ALIGN __ALIGN
48 #define ALIGN_STR __ALIGN_STR
50 #ifndef ENTRY
51 #define ENTRY(name) \
52 .globl name; \
53 ALIGN; \
54 name:
55 #endif
57 #ifndef WEAK
58 #define WEAK(name) \
59 .weak name; \
60 name:
61 #endif
63 #define KPROBE_ENTRY(name) \
64 .pushsection .kprobes.text, "ax"; \
65 ENTRY(name)
67 #define KPROBE_END(name) \
68 END(name); \
69 .popsection
71 #ifndef END
72 #define END(name) \
73 .size name, .-name
74 #endif
76 /* If symbol 'name' is treated as a subroutine (gets called, and returns)
77 * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
78 * static analysis tools such as stack depth analyzer.
80 #ifndef ENDPROC
81 #define ENDPROC(name) \
82 .type name, @function; \
83 END(name)
84 #endif
86 #endif
88 #define NORET_TYPE /**/
89 #define ATTRIB_NORET __attribute__((noreturn))
90 #define NORET_AND noreturn,
92 #endif